docs: 仓库链接指向本镜像仓库
Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s

This commit is contained in:
TanTan committed 2026-11-13 09:25:58 +08:00
1 parent f954252a34
commit e311ca3275
35554 files changed
+6229626 -4

No files matched your search

@@ -0,0 +1,8 @@
'use strict';
var globalThis = require('globalthis')();
var implementation = require('./implementation');
module.exports = function getPolyfill() {
return typeof globalThis.Iterator === 'function' ? globalThis.Iterator : implementation;
};
@@ -0,0 +1,127 @@
/*
* Copyright 2022 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
import {
calculateColumnSizes,
getMaxWidth,
getMinWidth
} from './TableUtils';
import {ColumnSize, TableCollection} from '@react-types/table';
import {GridNode} from '@react-types/grid';
import {Key} from '@react-types/shared';
export interface TableColumnLayoutOptions<T> {
getDefaultWidth?: (column: GridNode<T>) => ColumnSize | null | undefined,
getDefaultMinWidth?: (column: GridNode<T>) => ColumnSize | null | undefined
}
export class TableColumnLayout<T> {
getDefaultWidth: (column: GridNode<T>) => ColumnSize | null | undefined;
getDefaultMinWidth: (column: GridNode<T>) => ColumnSize | null | undefined;
columnWidths: Map<Key, number> = new Map();
columnMinWidths: Map<Key, number> = new Map();
columnMaxWidths: Map<Key, number> = new Map();
constructor(options: TableColumnLayoutOptions<T>) {
this.getDefaultWidth = options?.getDefaultWidth ?? (() => '1fr');
this.getDefaultMinWidth = options?.getDefaultMinWidth ?? (() => 75);
}
/** Takes an array of columns and splits it into 2 maps of columns with controlled and columns with uncontrolled widths. */
splitColumnsIntoControlledAndUncontrolled(columns: Array<GridNode<T>>): [Map<Key, GridNode<T>>, Map<Key, GridNode<T>>] {
return columns.reduce((acc, col) => {
if (col.props.width != null) {
acc[0].set(col.key, col);
} else {
acc[1].set(col.key, col);
}
return acc;
}, [new Map(), new Map()]);
}
/** Takes uncontrolled and controlled widths and joins them into a single Map. */
recombineColumns(columns: Array<GridNode<T>>, uncontrolledWidths: Map<Key, ColumnSize>, uncontrolledColumns: Map<Key, GridNode<T>>, controlledColumns: Map<Key, GridNode<T>>): Map<Key, ColumnSize> {
return new Map(columns.map(col => {
if (uncontrolledColumns.has(col.key)) {
return [col.key, uncontrolledWidths.get(col.key)];
} else {
return [col.key, controlledColumns.get(col.key)!.props.width];
}
}));
}
/** Used to make an initial Map of the uncontrolled widths based on default widths. */
getInitialUncontrolledWidths(uncontrolledColumns: Map<Key, GridNode<T>>): Map<Key, ColumnSize> {
return new Map(Array.from(uncontrolledColumns).map(([key, col]) =>
[key, col.props.defaultWidth ?? this.getDefaultWidth?.(col) ?? '1fr']
));
}
getColumnWidth(key: Key): number {
return this.columnWidths.get(key) ?? 0;
}
getColumnMinWidth(key: Key): number {
return this.columnMinWidths.get(key) ?? 0;
}
getColumnMaxWidth(key: Key): number {
return this.columnMaxWidths.get(key) ?? 0;
}
resizeColumnWidth(collection: TableCollection<T>, uncontrolledWidths: Map<Key, ColumnSize>, col: Key, width: number): Map<Key, ColumnSize> {
let prevColumnWidths = this.columnWidths;
let freeze = true;
let newWidths = new Map<Key, ColumnSize>();
width = Math.max(this.getColumnMinWidth(col), Math.min(this.getColumnMaxWidth(col), Math.floor(width)));
collection.columns.forEach(column => {
if (column.key === col) {
newWidths.set(column.key, width);
freeze = false;
} else if (freeze) {
// freeze columns to the left to their previous pixel value
newWidths.set(column.key, prevColumnWidths.get(column.key) ?? 0);
} else {
newWidths.set(column.key, column.props.width ?? uncontrolledWidths.get(column.key));
}
});
return newWidths;
}
buildColumnWidths(tableWidth: number, collection: TableCollection<T>, widths: Map<Key, ColumnSize>): Map<Key, number> {
this.columnWidths = new Map();
this.columnMinWidths = new Map();
this.columnMaxWidths = new Map();
// initial layout or table/window resizing
let columnWidths = calculateColumnSizes(
tableWidth,
collection.columns.map(col => ({...col.props, key: col.key})),
widths,
(i) => this.getDefaultWidth(collection.columns[i]),
(i) => this.getDefaultMinWidth(collection.columns[i])
);
// columns going in will be the same order as the columns coming out
columnWidths.forEach((width, index) => {
let key = collection.columns[index].key;
let column = collection.columns[index];
this.columnWidths.set(key, width);
this.columnMinWidths.set(key, getMinWidth(column.props.minWidth ?? this.getDefaultMinWidth(column), tableWidth));
this.columnMaxWidths.set(key, getMaxWidth(column.props.maxWidth, tableWidth));
});
return this.columnWidths;
}
}
@@ -0,0 +1,7 @@
export type Callback = import('./lib/index.js').Callback;
export type Middleware = import('./lib/index.js').Middleware;
export type Pipeline = import('./lib/index.js').Pipeline;
export type Run = import('./lib/index.js').Run;
export type Use = import('./lib/index.js').Use;
export { trough, wrap } from "./lib/index.js";
//# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,221 @@
import * as react from 'react';
import { RefObject, ReactNode } from 'react';
import * as _react_stately_slider from '@react-stately/slider';
import { SliderState } from '@react-stately/slider';
import * as _heroui_system from '@heroui/system';
import { PropGetter, HTMLHeroUIProps, DOMAttributes } from '@heroui/system';
import { SliderVariantProps, SlotsToClasses, SliderSlots } from '@heroui/theme';
import { ReactRef } from '@heroui/react-utils';
import { AriaSliderThumbProps, AriaSliderProps } from '@react-aria/slider';
import { TooltipProps } from '@heroui/tooltip';
import { ValueBase } from '@react-types/shared';
interface Props$1 extends HTMLHeroUIProps<"div"> {
/**
* Ref to the DOM node.
*/
ref?: ReactRef<HTMLElement | null>;
/**
* slider state, created via `useSliderState`.
*/
state: SliderState;
/**
* A ref to the track element.
*/
trackRef: RefObject<HTMLDivElement>;
/**
* @internal
*/
isVertical: boolean;
/**
* @internal
*/
showTooltip?: boolean;
/**
* @internal
*/
formatOptions?: Intl.NumberFormatOptions;
/**
* @internal
*/
tooltipProps?: UseSliderProps["tooltipProps"];
/**
* Function to render the thumb. It can be used to add a tooltip or custom icon.
*/
renderThumb?: UseSliderProps["renderThumb"];
}
type UseSliderThumbProps = Props$1 & AriaSliderThumbProps & SliderVariantProps;
declare function useSliderThumb(props: UseSliderThumbProps): {
Component: _heroui_system.As<any>;
index: number | undefined;
showTooltip: boolean | undefined;
renderThumb: ((props: SliderRenderThumbProps) => react.ReactNode) | undefined;
getThumbProps: PropGetter<Record<string, unknown>, _heroui_system.DOMAttributes<_heroui_system.DOMElement>>;
getTooltipProps: () => TooltipProps;
getInputProps: PropGetter<Record<string, unknown>, _heroui_system.DOMAttributes<_heroui_system.DOMElement>>;
};
type UseSliderThumbReturn = ReturnType<typeof useSliderThumb>;
interface SliderThumbProps extends UseSliderThumbProps {
}
declare const SliderThumb: _heroui_system.InternalForwardRefRenderFunction<"div", SliderThumbProps, never>;
type SliderValue = number | number[];
type SliderStepMark = {
value: number;
label: string;
};
type SliderRenderThumbProps = DOMAttributes<HTMLDivElement> & {
index?: number;
};
interface Props extends HTMLHeroUIProps<"div"> {
/**
* Ref to the DOM node.
*/
ref?: ReactRef<HTMLElement | null>;
/**
* The content to display as the label.
*/
label?: ReactNode;
/**
* The input name.
*/
name?: string;
/**
* The offset from which to start the fill.
*/
fillOffset?: number;
/**
* The display format of the value label.
*/
formatOptions?: Intl.NumberFormatOptions;
/**
* The display format of the tooltip value label.
* @default formatOptions
*/
tooltipValueFormatOptions?: Intl.NumberFormatOptions;
/**
* Whether to show the step indicators.
* @default false
*/
showSteps?: boolean;
/**
* Whether the thumbs should have a tooltip with the value on hover the slider.
* @default false
*/
showTooltip?: boolean;
/**
* Custom steps labels.
* @example [{value: 0, label: "0"}, {value: 50, label: "50"}, {value: 100, label: "100"}]
* @default []
*/
marks?: SliderStepMark[];
/**
* Element to be rendered in the start side of the slider.
*/
startContent?: React.ReactNode;
/**
* Element to be rendered in the end side of the slider.
*/
endContent?: React.ReactNode;
/**
* Classname or List of classes to change the classNames of the element.
* if `className` is passed, it will be added to the base slot.
*
* @example
* ```ts
* <Slider classNames={{
* base:"base-classes",
* step: "step-classes",
* labelWrapper: "label-wrapper-classes",
* label: "label-classes",
* value: "value-classes",
* trackWrapper: "track-wrapper-classes",
* track: "track-classes",
* filler: "filler-classes",
* thumb: "thumb-classes",
* mark: "mark-classes",
* }} />
* ```
*/
classNames?: SlotsToClasses<SliderSlots>;
/**
* Tooltip props.
* @see [Tooltip](https://heroui.com/components/tooltip) for more details.
* @default {
* offset: 15,
* delay: 0,
* size: "sm",
* showArrow: true,
* placement: "top", // "right" for vertical slider
* content: [sliderValue],
* color: sliderProps?.color, // same as the slider color
* isDisabled: sliderProps?.isDisabled,
* }
*/
tooltipProps?: Partial<TooltipProps>;
/**
* A function that returns the content to display as the value label.
* Overrides default formatted number.
*/
getValue?: (value: SliderValue) => string;
/**
* Function to render the label.
*/
renderLabel?: (props: DOMAttributes<HTMLLabelElement>) => React.ReactNode;
/**
* Function to render the value label.
*/
renderValue?: (props: DOMAttributes<HTMLOutputElement>) => React.ReactNode;
/**
* Function to render the thumb. It can be used to add a tooltip or custom icon.
*/
renderThumb?: (props: SliderRenderThumbProps) => React.ReactNode;
}
type UseSliderProps = Omit<Props, keyof ValueBase<SliderValue>> & AriaSliderProps & SliderVariantProps;
declare function useSlider(originalProps: UseSliderProps): {
Component: _heroui_system.As<any>;
state: _react_stately_slider.SliderState;
value: string;
domRef: react.RefObject<HTMLElement>;
label: ReactNode;
steps: number;
marks: SliderStepMark[];
startContent: ReactNode;
endContent: ReactNode;
getStepProps: (index: number) => {
className: string;
"data-slot": string;
"data-in-range": boolean;
style: {
[x: string]: string;
};
};
getBaseProps: PropGetter<Record<string, unknown>, DOMAttributes<_heroui_system.DOMElement>>;
getValue: ((value: SliderValue) => string) | undefined;
renderLabel: ((props: DOMAttributes<HTMLLabelElement>) => ReactNode) | undefined;
renderValue: ((props: DOMAttributes<HTMLOutputElement>) => ReactNode) | undefined;
getTrackWrapperProps: PropGetter<Record<string, unknown>, DOMAttributes<_heroui_system.DOMElement>>;
getLabelWrapperProps: PropGetter<Record<string, unknown>, DOMAttributes<_heroui_system.DOMElement>>;
getLabelProps: PropGetter<Record<string, unknown>, DOMAttributes<_heroui_system.DOMElement>>;
getValueProps: PropGetter<Record<string, unknown>, DOMAttributes<_heroui_system.DOMElement>>;
getTrackProps: PropGetter<Record<string, unknown>, DOMAttributes<_heroui_system.DOMElement>>;
getFillerProps: PropGetter<Record<string, unknown>, DOMAttributes<_heroui_system.DOMElement>>;
getThumbProps: (index: number) => SliderThumbProps;
getMarkProps: (mark: SliderStepMark) => {
className: string;
"data-slot": string;
"data-in-range": boolean;
style: {
[x: string]: string;
};
onMouseDown: (e: React.MouseEvent) => void;
onPointerDown: (e: React.PointerEvent) => void;
onClick: (e: any) => void;
};
getStartContentProps: PropGetter<Record<string, unknown>, DOMAttributes<_heroui_system.DOMElement>>;
getEndContentProps: PropGetter<Record<string, unknown>, DOMAttributes<_heroui_system.DOMElement>>;
};
type UseSliderReturn = ReturnType<typeof useSlider>;
export { SliderValue as S, UseSliderProps as U, SliderStepMark as a, SliderRenderThumbProps as b, UseSliderThumbProps as c, useSliderThumb as d, UseSliderThumbReturn as e, SliderThumb as f, SliderThumbProps as g, UseSliderReturn as h, useSlider as u };
@@ -0,0 +1,3 @@
declare const _default: <T>(fieldValues: T[], index: number, value: T) => T[];
export default _default;
//# sourceMappingURL=update.d.ts.map
@@ -0,0 +1,40 @@
/**
* @author Toru Nagashima <https://github.com/mysticatea>
* See LICENSE file in root directory for full license.
*/
"use strict"
const {
definePrototypeMethodHandler,
} = require("../util/define-prototype-method-handler")
module.exports = {
meta: {
docs: {
description:
"disallow the `String.prototype.{trimStart,trimEnd}` methods.",
category: "ES2019",
recommended: false,
url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-string-prototype-trimstart-trimend.html",
},
fixable: null,
messages: {
forbidden: "ES2019 '{{name}}' method is forbidden.",
},
schema: [
{
type: "object",
properties: {
aggressive: { type: "boolean" },
},
additionalProperties: false,
},
],
type: "problem",
},
create(context) {
return definePrototypeMethodHandler(context, {
String: ["trimEnd", "trimStart"],
})
},
}
@@ -0,0 +1,271 @@
"use client";
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.ts
var src_exports = {};
__export(src_exports, {
Card: () => card_default,
CardBody: () => card_body_default,
CardFooter: () => card_footer_default,
CardHeader: () => card_header_default,
CardProvider: () => CardProvider,
useCard: () => useCard,
useCardContext: () => useCardContext
});
module.exports = __toCommonJS(src_exports);
// src/use-card.ts
var import_theme = require("@heroui/theme");
var import_react = require("react");
var import_utils = require("@react-aria/utils");
var import_focus = require("@react-aria/focus");
var import_interactions = require("@react-aria/interactions");
var import_use_aria_button = require("@heroui/use-aria-button");
var import_system = require("@heroui/system");
var import_shared_utils = require("@heroui/shared-utils");
var import_react_utils = require("@heroui/react-utils");
var import_react_utils2 = require("@heroui/react-utils");
var import_ripple = require("@heroui/ripple");
function useCard(originalProps) {
var _a, _b, _c, _d;
const globalContext = (0, import_system.useProviderContext)();
const [props, variantProps] = (0, import_system.mapPropsVariants)(originalProps, import_theme.card.variantKeys);
const {
ref,
as,
children,
onClick,
onPress,
autoFocus,
className,
classNames,
allowTextSelectionOnPress = true,
...otherProps
} = props;
const domRef = (0, import_react_utils2.useDOMRef)(ref);
const Component = as || (originalProps.isPressable ? "button" : "div");
const shouldFilterDOMProps = typeof Component === "string";
const disableAnimation = (_b = (_a = originalProps.disableAnimation) != null ? _a : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _b : false;
const disableRipple = (_d = (_c = originalProps.disableRipple) != null ? _c : globalContext == null ? void 0 : globalContext.disableRipple) != null ? _d : false;
const baseStyles = (0, import_shared_utils.clsx)(classNames == null ? void 0 : classNames.base, className);
const { onClear: onClearRipple, onPress: onRipplePressHandler, ripples } = (0, import_ripple.useRipple)();
const handlePress = (0, import_react.useCallback)(
(e) => {
if (disableRipple || disableAnimation)
return;
domRef.current && onRipplePressHandler(e);
},
[disableRipple, disableAnimation, domRef, onRipplePressHandler]
);
const { buttonProps, isPressed } = (0, import_use_aria_button.useAriaButton)(
{
onPress: (0, import_utils.chain)(onPress, handlePress),
elementType: as,
isDisabled: !originalProps.isPressable,
onClick,
allowTextSelectionOnPress,
...otherProps
},
domRef
);
const { hoverProps, isHovered } = (0, import_interactions.useHover)({
isDisabled: !originalProps.isHoverable,
...otherProps
});
const { isFocusVisible, isFocused, focusProps } = (0, import_focus.useFocusRing)({
autoFocus
});
const slots = (0, import_react.useMemo)(
() => (0, import_theme.card)({
...variantProps,
disableAnimation
}),
[(0, import_shared_utils.objectToDeps)(variantProps), disableAnimation]
);
const context = (0, import_react.useMemo)(
() => ({
slots,
classNames,
disableAnimation,
isDisabled: originalProps.isDisabled,
isFooterBlurred: originalProps.isFooterBlurred,
fullWidth: originalProps.fullWidth
}),
[
slots,
classNames,
originalProps.isDisabled,
originalProps.isFooterBlurred,
disableAnimation,
originalProps.fullWidth
]
);
const getCardProps = (0, import_react.useCallback)(
(props2 = {}) => {
return {
ref: domRef,
className: slots.base({ class: baseStyles }),
tabIndex: originalProps.isPressable ? 0 : -1,
"data-hover": (0, import_shared_utils.dataAttr)(isHovered),
"data-pressed": (0, import_shared_utils.dataAttr)(isPressed),
"data-focus": (0, import_shared_utils.dataAttr)(isFocused),
"data-focus-visible": (0, import_shared_utils.dataAttr)(isFocusVisible),
"data-disabled": (0, import_shared_utils.dataAttr)(originalProps.isDisabled),
...(0, import_utils.mergeProps)(
originalProps.isPressable ? { ...buttonProps, ...focusProps, role: "button" } : {},
originalProps.isHoverable ? hoverProps : {},
(0, import_react_utils.filterDOMProps)(otherProps, {
enabled: shouldFilterDOMProps
}),
(0, import_react_utils.filterDOMProps)(props2)
)
};
},
[
domRef,
slots,
baseStyles,
shouldFilterDOMProps,
originalProps.isPressable,
originalProps.isHoverable,
originalProps.isDisabled,
isHovered,
isPressed,
isFocusVisible,
buttonProps,
focusProps,
hoverProps,
otherProps
]
);
const getRippleProps = (0, import_react.useCallback)(
() => ({ ripples, onClear: onClearRipple }),
[ripples, onClearRipple]
);
return {
context,
domRef,
Component,
classNames,
children,
isHovered,
isPressed,
disableAnimation,
isPressable: originalProps.isPressable,
isHoverable: originalProps.isHoverable,
disableRipple,
handlePress,
isFocusVisible,
getCardProps,
getRippleProps
};
}
// src/card-context.ts
var import_react_utils3 = require("@heroui/react-utils");
var [CardProvider, useCardContext] = (0, import_react_utils3.createContext)({
name: "CardContext",
strict: true,
errorMessage: "useCardContext: `context` is undefined. Seems you forgot to wrap component within <Card />"
});
// src/card.tsx
var import_system2 = require("@heroui/system");
var import_ripple2 = require("@heroui/ripple");
var import_jsx_runtime = require("react/jsx-runtime");
var Card = (0, import_system2.forwardRef)((props, ref) => {
const {
children,
context,
Component,
isPressable,
disableAnimation,
disableRipple,
getCardProps,
getRippleProps
} = useCard({ ...props, ref });
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Component, { ...getCardProps(), children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CardProvider, { value: context, children }),
isPressable && !disableAnimation && !disableRipple && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ripple2.Ripple, { ...getRippleProps() })
] });
});
Card.displayName = "HeroUI.Card";
var card_default = Card;
// src/card-header.tsx
var import_system3 = require("@heroui/system");
var import_react_utils4 = require("@heroui/react-utils");
var import_shared_utils2 = require("@heroui/shared-utils");
var import_jsx_runtime2 = require("react/jsx-runtime");
var CardHeader = (0, import_system3.forwardRef)((props, ref) => {
var _a;
const { as, className, children, ...otherProps } = props;
const Component = as || "div";
const domRef = (0, import_react_utils4.useDOMRef)(ref);
const { slots, classNames } = useCardContext();
const headerStyles = (0, import_shared_utils2.clsx)(classNames == null ? void 0 : classNames.header, className);
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Component, { ref: domRef, className: (_a = slots.header) == null ? void 0 : _a.call(slots, { class: headerStyles }), ...otherProps, children });
});
CardHeader.displayName = "HeroUI.CardHeader";
var card_header_default = CardHeader;
// src/card-body.tsx
var import_system4 = require("@heroui/system");
var import_react_utils5 = require("@heroui/react-utils");
var import_shared_utils3 = require("@heroui/shared-utils");
var import_jsx_runtime3 = require("react/jsx-runtime");
var CardBody = (0, import_system4.forwardRef)((props, ref) => {
var _a;
const { as, className, children, ...otherProps } = props;
const Component = as || "div";
const domRef = (0, import_react_utils5.useDOMRef)(ref);
const { slots, classNames } = useCardContext();
const bodyStyles = (0, import_shared_utils3.clsx)(classNames == null ? void 0 : classNames.body, className);
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Component, { ref: domRef, className: (_a = slots.body) == null ? void 0 : _a.call(slots, { class: bodyStyles }), ...otherProps, children });
});
CardBody.displayName = "HeroUI.CardBody";
var card_body_default = CardBody;
// src/card-footer.tsx
var import_system5 = require("@heroui/system");
var import_react_utils6 = require("@heroui/react-utils");
var import_shared_utils4 = require("@heroui/shared-utils");
var import_jsx_runtime4 = require("react/jsx-runtime");
var CardFooter = (0, import_system5.forwardRef)((props, ref) => {
var _a;
const { as, className, children, ...otherProps } = props;
const Component = as || "div";
const domRef = (0, import_react_utils6.useDOMRef)(ref);
const { slots, classNames } = useCardContext();
const footerStyles = (0, import_shared_utils4.clsx)(classNames == null ? void 0 : classNames.footer, className);
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Component, { ref: domRef, className: (_a = slots.footer) == null ? void 0 : _a.call(slots, { class: footerStyles }), ...otherProps, children });
});
CardFooter.displayName = "HeroUI.CardFooter";
var card_footer_default = CardFooter;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Card,
CardBody,
CardFooter,
CardHeader,
CardProvider,
useCard,
useCardContext
});
@@ -0,0 +1,74 @@
import { isScalar, isPair } from '../../nodes/identity.js';
import { toJS } from '../../nodes/toJS.js';
import { YAMLMap } from '../../nodes/YAMLMap.js';
import { YAMLSeq } from '../../nodes/YAMLSeq.js';
import { resolvePairs, createPairs } from './pairs.js';
class YAMLOMap extends YAMLSeq {
constructor() {
super();
this.add = YAMLMap.prototype.add.bind(this);
this.delete = YAMLMap.prototype.delete.bind(this);
this.get = YAMLMap.prototype.get.bind(this);
this.has = YAMLMap.prototype.has.bind(this);
this.set = YAMLMap.prototype.set.bind(this);
this.tag = YAMLOMap.tag;
}
/**
* If `ctx` is given, the return type is actually `Map<unknown, unknown>`,
* but TypeScript won't allow widening the signature of a child method.
*/
toJSON(_, ctx) {
if (!ctx)
return super.toJSON(_);
const map = new Map();
if (ctx?.onCreate)
ctx.onCreate(map);
for (const pair of this.items) {
let key, value;
if (isPair(pair)) {
key = toJS(pair.key, '', ctx);
value = toJS(pair.value, key, ctx);
}
else {
key = toJS(pair, '', ctx);
}
if (map.has(key))
throw new Error('Ordered maps must not include duplicate keys');
map.set(key, value);
}
return map;
}
static from(schema, iterable, ctx) {
const pairs = createPairs(schema, iterable, ctx);
const omap = new this();
omap.items = pairs.items;
return omap;
}
}
YAMLOMap.tag = 'tag:yaml.org,2002:omap';
const omap = {
collection: 'seq',
identify: value => value instanceof Map,
nodeClass: YAMLOMap,
default: false,
tag: 'tag:yaml.org,2002:omap',
resolve(seq, onError) {
const pairs = resolvePairs(seq, onError);
const seenKeys = [];
for (const { key } of pairs.items) {
if (isScalar(key)) {
if (seenKeys.includes(key.value)) {
onError(`Ordered maps must not include duplicate keys: ${key.value}`);
}
else {
seenKeys.push(key.value);
}
}
}
return Object.assign(new YAMLOMap(), pairs);
},
createNode: (schema, iterable, ctx) => YAMLOMap.from(schema, iterable, ctx)
};
export { YAMLOMap, omap };
@@ -0,0 +1,5 @@
function _classPrivateFieldBase(e, t) {
if (!{}.hasOwnProperty.call(e, t)) throw new TypeError("attempted to use private field on non-instance");
return e;
}
module.exports = _classPrivateFieldBase, module.exports.__esModule = true, module.exports["default"] = module.exports;
@@ -0,0 +1,29 @@
/**
* @license
* Lodash (Custom Build) lodash.com/license | Underscore.js 1.8.3 underscorejs.org/LICENSE
* Build: `lodash core -o ./dist/lodash.core.js`
*/
;(function(){function n(n){return H(n)&&pn.call(n,"callee")&&!yn.call(n,"callee")}function t(n,t){return n.push.apply(n,t),n}function r(n){return function(t){return null==t?Z:t[n]}}function e(n,t,r,e,u){return u(n,function(n,u,o){r=e?(e=false,n):t(r,n,u,o)}),r}function u(n,t){return j(t,function(t){return n[t]})}function o(n){return n instanceof i?n:new i(n)}function i(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t}function c(n,t,r){if(typeof n!="function")throw new TypeError("Expected a function");
return setTimeout(function(){n.apply(Z,r)},t)}function f(n,t){var r=true;return mn(n,function(n,e,u){return r=!!t(n,e,u)}),r}function a(n,t,r){for(var e=-1,u=n.length;++e<u;){var o=n[e],i=t(o);if(null!=i&&(c===Z?i===i:r(i,c)))var c=i,f=o}return f}function l(n,t){var r=[];return mn(n,function(n,e,u){t(n,e,u)&&r.push(n)}),r}function p(n,r,e,u,o){var i=-1,c=n.length;for(e||(e=R),o||(o=[]);++i<c;){var f=n[i];0<r&&e(f)?1<r?p(f,r-1,e,u,o):t(o,f):u||(o[o.length]=f)}return o}function s(n,t){return n&&On(n,t,Dn);
}function h(n,t){return l(t,function(t){return U(n[t])})}function v(n,t){return n>t}function b(n,t,r,e,u){return n===t||(null==n||null==t||!H(n)&&!H(t)?n!==n&&t!==t:y(n,t,r,e,b,u))}function y(n,t,r,e,u,o){var i=Nn(n),c=Nn(t),f=i?"[object Array]":hn.call(n),a=c?"[object Array]":hn.call(t),f="[object Arguments]"==f?"[object Object]":f,a="[object Arguments]"==a?"[object Object]":a,l="[object Object]"==f,c="[object Object]"==a,a=f==a;o||(o=[]);var p=An(o,function(t){return t[0]==n}),s=An(o,function(n){
return n[0]==t});if(p&&s)return p[1]==t;if(o.push([n,t]),o.push([t,n]),a&&!l){if(i)r=T(n,t,r,e,u,o);else n:{switch(f){case"[object Boolean]":case"[object Date]":case"[object Number]":r=J(+n,+t);break n;case"[object Error]":r=n.name==t.name&&n.message==t.message;break n;case"[object RegExp]":case"[object String]":r=n==t+"";break n}r=false}return o.pop(),r}return 1&r||(i=l&&pn.call(n,"__wrapped__"),f=c&&pn.call(t,"__wrapped__"),!i&&!f)?!!a&&(r=B(n,t,r,e,u,o),o.pop(),r):(i=i?n.value():n,f=f?t.value():t,
r=u(i,f,r,e,o),o.pop(),r)}function g(n){return typeof n=="function"?n:null==n?X:(typeof n=="object"?d:r)(n)}function _(n,t){return n<t}function j(n,t){var r=-1,e=M(n)?Array(n.length):[];return mn(n,function(n,u,o){e[++r]=t(n,u,o)}),e}function d(n){var t=_n(n);return function(r){var e=t.length;if(null==r)return!e;for(r=Object(r);e--;){var u=t[e];if(!(u in r&&b(n[u],r[u],3)))return false}return true}}function m(n,t){return n=Object(n),C(t,function(t,r){return r in n&&(t[r]=n[r]),t},{})}function O(n){return xn(I(n,void 0,X),n+"");
}function x(n,t,r){var e=-1,u=n.length;for(0>t&&(t=-t>u?0:u+t),r=r>u?u:r,0>r&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0,r=Array(u);++e<u;)r[e]=n[e+t];return r}function A(n){return x(n,0,n.length)}function E(n,t){var r;return mn(n,function(n,e,u){return r=t(n,e,u),!r}),!!r}function w(n,r){return C(r,function(n,r){return r.func.apply(r.thisArg,t([n],r.args))},n)}function k(n,t,r){var e=!r;r||(r={});for(var u=-1,o=t.length;++u<o;){var i=t[u],c=Z;if(c===Z&&(c=n[i]),e)r[i]=c;else{var f=r,a=f[i];pn.call(f,i)&&J(a,c)&&(c!==Z||i in f)||(f[i]=c);
}}return r}function N(n){return O(function(t,r){var e=-1,u=r.length,o=1<u?r[u-1]:Z,o=3<n.length&&typeof o=="function"?(u--,o):Z;for(t=Object(t);++e<u;){var i=r[e];i&&n(t,i,e,o)}return t})}function F(n){return function(){var t=arguments,r=dn(n.prototype),t=n.apply(r,t);return V(t)?t:r}}function S(n,t,r){function e(){for(var o=-1,i=arguments.length,c=-1,f=r.length,a=Array(f+i),l=this&&this!==on&&this instanceof e?u:n;++c<f;)a[c]=r[c];for(;i--;)a[c++]=arguments[++o];return l.apply(t,a)}if(typeof n!="function")throw new TypeError("Expected a function");
var u=F(n);return e}function T(n,t,r,e,u,o){var i=n.length,c=t.length;if(i!=c&&!(1&r&&c>i))return false;var c=o.get(n),f=o.get(t);if(c&&f)return c==t&&f==n;for(var c=-1,f=true,a=2&r?[]:Z;++c<i;){var l=n[c],p=t[c];if(void 0!==Z){f=false;break}if(a){if(!E(t,function(n,t){if(!P(a,t)&&(l===n||u(l,n,r,e,o)))return a.push(t)})){f=false;break}}else if(l!==p&&!u(l,p,r,e,o)){f=false;break}}return f}function B(n,t,r,e,u,o){var i=1&r,c=Dn(n),f=c.length,a=Dn(t).length;if(f!=a&&!i)return false;for(a=f;a--;){var l=c[a];if(!(i?l in t:pn.call(t,l)))return false;
}var p=o.get(n),l=o.get(t);if(p&&l)return p==t&&l==n;for(p=true;++a<f;){var l=c[a],s=n[l],h=t[l];if(void 0!==Z||s!==h&&!u(s,h,r,e,o)){p=false;break}i||(i="constructor"==l)}return p&&!i&&(r=n.constructor,e=t.constructor,r!=e&&"constructor"in n&&"constructor"in t&&!(typeof r=="function"&&r instanceof r&&typeof e=="function"&&e instanceof e)&&(p=false)),p}function R(t){return Nn(t)||n(t)}function D(n){var t=[];if(null!=n)for(var r in Object(n))t.push(r);return t}function I(n,t,r){return t=jn(t===Z?n.length-1:t,0),
function(){for(var e=arguments,u=-1,o=jn(e.length-t,0),i=Array(o);++u<o;)i[u]=e[t+u];for(u=-1,o=Array(t+1);++u<t;)o[u]=e[u];return o[t]=r(i),n.apply(this,o)}}function $(n){return(null==n?0:n.length)?p(n,1):[]}function q(n){return n&&n.length?n[0]:Z}function P(n,t,r){var e=null==n?0:n.length;r=typeof r=="number"?0>r?jn(e+r,0):r:0,r=(r||0)-1;for(var u=t===t;++r<e;){var o=n[r];if(u?o===t:o!==o)return r}return-1}function z(n,t){return mn(n,g(t))}function C(n,t,r){return e(n,g(t),r,3>arguments.length,mn);
}function G(n,t){var r;if(typeof t!="function")throw new TypeError("Expected a function");return n=Fn(n),function(){return 0<--n&&(r=t.apply(this,arguments)),1>=n&&(t=Z),r}}function J(n,t){return n===t||n!==n&&t!==t}function M(n){var t;return(t=null!=n)&&(t=n.length,t=typeof t=="number"&&-1<t&&0==t%1&&9007199254740991>=t),t&&!U(n)}function U(n){return!!V(n)&&(n=hn.call(n),"[object Function]"==n||"[object GeneratorFunction]"==n||"[object AsyncFunction]"==n||"[object Proxy]"==n)}function V(n){var t=typeof n;
return null!=n&&("object"==t||"function"==t)}function H(n){return null!=n&&typeof n=="object"}function K(n){return typeof n=="number"||H(n)&&"[object Number]"==hn.call(n)}function L(n){return typeof n=="string"||!Nn(n)&&H(n)&&"[object String]"==hn.call(n)}function Q(n){return typeof n=="string"?n:null==n?"":n+""}function W(n){return null==n?[]:u(n,Dn(n))}function X(n){return n}function Y(n,r,e){var u=Dn(r),o=h(r,u);null!=e||V(r)&&(o.length||!u.length)||(e=r,r=n,n=this,o=h(r,Dn(r)));var i=!(V(e)&&"chain"in e&&!e.chain),c=U(n);
return mn(o,function(e){var u=r[e];n[e]=u,c&&(n.prototype[e]=function(){var r=this.__chain__;if(i||r){var e=n(this.__wrapped__);return(e.__actions__=A(this.__actions__)).push({func:u,args:arguments,thisArg:n}),e.__chain__=r,e}return u.apply(n,t([this.value()],arguments))})}),n}var Z,nn=1/0,tn=/[&<>"']/g,rn=RegExp(tn.source),en=/^(?:0|[1-9]\d*)$/,un=typeof self=="object"&&self&&self.Object===Object&&self,on=typeof global=="object"&&global&&global.Object===Object&&global||un||Function("return this")(),cn=(un=typeof exports=="object"&&exports&&!exports.nodeType&&exports)&&typeof module=="object"&&module&&!module.nodeType&&module,fn=function(n){
return function(t){return null==n?Z:n[t]}}({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"}),an=Array.prototype,ln=Object.prototype,pn=ln.hasOwnProperty,sn=0,hn=ln.toString,vn=on._,bn=Object.create,yn=ln.propertyIsEnumerable,gn=on.isFinite,_n=function(n,t){return function(r){return n(t(r))}}(Object.keys,Object),jn=Math.max,dn=function(){function n(){}return function(t){return V(t)?bn?bn(t):(n.prototype=t,t=new n,n.prototype=Z,t):{}}}();i.prototype=dn(o.prototype),i.prototype.constructor=i;
var mn=function(n,t){return function(r,e){if(null==r)return r;if(!M(r))return n(r,e);for(var u=r.length,o=t?u:-1,i=Object(r);(t?o--:++o<u)&&false!==e(i[o],o,i););return r}}(s),On=function(n){return function(t,r,e){var u=-1,o=Object(t);e=e(t);for(var i=e.length;i--;){var c=e[n?i:++u];if(false===r(o[c],c,o))break}return t}}(),xn=X,An=function(n){return function(t,r,e){var u=Object(t);if(!M(t)){var o=g(r);t=Dn(t),r=function(n){return o(u[n],n,u)}}return r=n(t,r,e),-1<r?u[o?t[r]:r]:Z}}(function(n,t,r){var e=null==n?0:n.length;
if(!e)return-1;r=null==r?0:Fn(r),0>r&&(r=jn(e+r,0));n:{for(t=g(t),e=n.length,r+=-1;++r<e;)if(t(n[r],r,n)){n=r;break n}n=-1}return n}),En=O(function(n,t,r){return S(n,t,r)}),wn=O(function(n,t){return c(n,1,t)}),kn=O(function(n,t,r){return c(n,Sn(t)||0,r)}),Nn=Array.isArray,Fn=Number,Sn=Number,Tn=N(function(n,t){k(t,_n(t),n)}),Bn=N(function(n,t){k(t,D(t),n)}),Rn=O(function(n,t){n=Object(n);var r,e=-1,u=t.length,o=2<u?t[2]:Z;if(r=o){r=t[0];var i=t[1];if(V(o)){var c=typeof i;if("number"==c){if(c=M(o))var c=o.length,f=typeof i,c=null==c?9007199254740991:c,c=!!c&&("number"==f||"symbol"!=f&&en.test(i))&&-1<i&&0==i%1&&i<c;
}else c="string"==c&&i in o;r=!!c&&J(o[i],r)}else r=false}for(r&&(u=1);++e<u;)for(o=t[e],r=In(o),i=-1,c=r.length;++i<c;){var f=r[i],a=n[f];(a===Z||J(a,ln[f])&&!pn.call(n,f))&&(n[f]=o[f])}return n}),Dn=_n,In=D,$n=function(n){return xn(I(n,Z,$),n+"")}(function(n,t){return null==n?{}:m(n,t)});o.assignIn=Bn,o.before=G,o.bind=En,o.chain=function(n){return n=o(n),n.__chain__=true,n},o.compact=function(n){return l(n,Boolean)},o.concat=function(){var n=arguments.length;if(!n)return[];for(var r=Array(n-1),e=arguments[0];n--;)r[n-1]=arguments[n];
return t(Nn(e)?A(e):[e],p(r,1))},o.create=function(n,t){var r=dn(n);return null==t?r:Tn(r,t)},o.defaults=Rn,o.defer=wn,o.delay=kn,o.filter=function(n,t){return l(n,g(t))},o.flatten=$,o.flattenDeep=function(n){return(null==n?0:n.length)?p(n,nn):[]},o.iteratee=g,o.keys=Dn,o.map=function(n,t){return j(n,g(t))},o.matches=function(n){return d(Tn({},n))},o.mixin=Y,o.negate=function(n){if(typeof n!="function")throw new TypeError("Expected a function");return function(){return!n.apply(this,arguments)}},o.once=function(n){
return G(2,n)},o.pick=$n,o.slice=function(n,t,r){var e=null==n?0:n.length;return r=r===Z?e:+r,e?x(n,null==t?0:+t,r):[]},o.sortBy=function(n,t){var e=0;return t=g(t),j(j(n,function(n,r,u){return{value:n,index:e++,criteria:t(n,r,u)}}).sort(function(n,t){var r;n:{r=n.criteria;var e=t.criteria;if(r!==e){var u=r!==Z,o=null===r,i=r===r,c=e!==Z,f=null===e,a=e===e;if(!f&&r>e||o&&c&&a||!u&&a||!i){r=1;break n}if(!o&&r<e||f&&u&&i||!c&&i||!a){r=-1;break n}}r=0}return r||n.index-t.index}),r("value"))},o.tap=function(n,t){
return t(n),n},o.thru=function(n,t){return t(n)},o.toArray=function(n){return M(n)?n.length?A(n):[]:W(n)},o.values=W,o.extend=Bn,Y(o,o),o.clone=function(n){return V(n)?Nn(n)?A(n):k(n,_n(n)):n},o.escape=function(n){return(n=Q(n))&&rn.test(n)?n.replace(tn,fn):n},o.every=function(n,t,r){return t=r?Z:t,f(n,g(t))},o.find=An,o.forEach=z,o.has=function(n,t){return null!=n&&pn.call(n,t)},o.head=q,o.identity=X,o.indexOf=P,o.isArguments=n,o.isArray=Nn,o.isBoolean=function(n){return true===n||false===n||H(n)&&"[object Boolean]"==hn.call(n);
},o.isDate=function(n){return H(n)&&"[object Date]"==hn.call(n)},o.isEmpty=function(t){return M(t)&&(Nn(t)||L(t)||U(t.splice)||n(t))?!t.length:!_n(t).length},o.isEqual=function(n,t){return b(n,t)},o.isFinite=function(n){return typeof n=="number"&&gn(n)},o.isFunction=U,o.isNaN=function(n){return K(n)&&n!=+n},o.isNull=function(n){return null===n},o.isNumber=K,o.isObject=V,o.isRegExp=function(n){return H(n)&&"[object RegExp]"==hn.call(n)},o.isString=L,o.isUndefined=function(n){return n===Z},o.last=function(n){
var t=null==n?0:n.length;return t?n[t-1]:Z},o.max=function(n){return n&&n.length?a(n,X,v):Z},o.min=function(n){return n&&n.length?a(n,X,_):Z},o.noConflict=function(){return on._===this&&(on._=vn),this},o.noop=function(){},o.reduce=C,o.result=function(n,t,r){return t=null==n?Z:n[t],t===Z&&(t=r),U(t)?t.call(n):t},o.size=function(n){return null==n?0:(n=M(n)?n:_n(n),n.length)},o.some=function(n,t,r){return t=r?Z:t,E(n,g(t))},o.uniqueId=function(n){var t=++sn;return Q(n)+t},o.each=z,o.first=q,Y(o,function(){
var n={};return s(o,function(t,r){pn.call(o.prototype,r)||(n[r]=t)}),n}(),{chain:false}),o.VERSION="4.17.21",mn("pop join replace reverse split push shift sort splice unshift".split(" "),function(n){var t=(/^(?:replace|split)$/.test(n)?String.prototype:an)[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|join|replace|shift)$/.test(n);o.prototype[n]=function(){var n=arguments;if(e&&!this.__chain__){var u=this.value();return t.apply(Nn(u)?u:[],n)}return this[r](function(r){return t.apply(Nn(r)?r:[],n);
})}}),o.prototype.toJSON=o.prototype.valueOf=o.prototype.value=function(){return w(this.__wrapped__,this.__actions__)},typeof define=="function"&&typeof define.amd=="object"&&define.amd?(on._=o, define(function(){return o})):cn?((cn.exports=o)._=o,un._=o):on._=o}).call(this);
@@ -0,0 +1,368 @@
# Config Array
## Description
A config array is a way of managing configurations that are based on glob pattern matching of filenames. Each config array contains the information needed to determine the correct configuration for any file based on the filename.
**Note:** This is a generic package that can be used outside of ESLint. It contains no ESLint-specific functionality.
## Installation
For Node.js and compatible runtimes:
```shell
npm install @eslint/config-array
# or
yarn add @eslint/config-array
# or
pnpm install @eslint/config-array
# or
bun add @eslint/config-array
```
For Deno:
```shell
deno add @eslint/config-array
```
## Background
The basic idea is that all configuration, including overrides, can be represented by a single array where each item in the array is a config object. Config objects appearing later in the array override config objects appearing earlier in the array. You can calculate a config for a given file by traversing all config objects in the array to find the ones that match the filename. Matching is done by specifying glob patterns in `files` and `ignores` properties on each config object. Here's an example:
```js
export default [
// match all JSON files
{
name: "JSON Handler",
files: ["**/*.json"],
handler: jsonHandler,
},
// match only package.json
{
name: "package.json Handler",
files: ["package.json"],
handler: packageJsonHandler,
},
];
```
In this example, there are two config objects: the first matches all JSON files in all directories and the second matches just `package.json` in the base path directory (all the globs are evaluated as relative to a base path that can be specified). When you retrieve a configuration for `foo.json`, only the first config object matches so `handler` is equal to `jsonHandler`; when you retrieve a configuration for `package.json`, `handler` is equal to `packageJsonHandler` (because both config objects match, the second one wins).
## Usage
First, import the `ConfigArray` constructor:
```js
import { ConfigArray } from "@eslint/config-array";
// or using CommonJS
const { ConfigArray } = require("@eslint/config-array");
```
When you create a new instance of `ConfigArray`, you must pass in two arguments: an array of configs and an options object. The array of configs is most likely read in from a configuration file, so here's a typical example:
```js
const configFilename = path.resolve(process.cwd(), "my.config.js");
const { default: rawConfigs } = await import(configFilename);
const configs = new ConfigArray(rawConfigs, {
// the path to match filenames from
basePath: process.cwd(),
// additional items in each config
schema: mySchema,
});
```
This example reads in an object or array from `my.config.js` and passes it into the `ConfigArray` constructor as the first argument. The second argument is an object specifying the `basePath` (the directory in which `my.config.js` is found) and a `schema` to define the additional properties of a config object beyond `files`, `ignores`, `basePath`, and `name`.
### Specifying a Schema
The `schema` option is required for you to use additional properties in config objects. The schema is an object that follows the format of an [`ObjectSchema`](https://npmjs.com/package/@eslint/object-schema). The schema specifies both validation and merge rules that the `ConfigArray` instance needs to combine configs when there are multiple matches. Here's an example:
```js
const configFilename = path.resolve(process.cwd(), "my.config.js");
const { default: rawConfigs } = await import(configFilename);
const mySchema = {
// define the handler key in configs
handler: {
required: true,
merge(a, b) {
if (!b) return a;
if (!a) return b;
},
validate(value) {
if (typeof value !== "function") {
throw new TypeError("Function expected.");
}
}
}
};
const configs = new ConfigArray(rawConfigs, {
// the path to match filenames from
basePath: process.cwd(),
// additional item schemas in each config
schema: mySchema,
// additional config types supported (default: [])
extraConfigTypes: ["array", "function"];
});
```
### Config Arrays
Config arrays can be multidimensional, so it's possible for a config array to contain another config array when `extraConfigTypes` contains `"array"`, such as:
```js
export default [
// JS config
{
files: ["**/*.js"],
handler: jsHandler,
},
// JSON configs
[
// match all JSON files
{
name: "JSON Handler",
files: ["**/*.json"],
handler: jsonHandler,
},
// match only package.json
{
name: "package.json Handler",
files: ["package.json"],
handler: packageJsonHandler,
},
],
// filename must match function
{
files: [filePath => filePath.endsWith(".md")],
handler: markdownHandler,
},
// filename must match all patterns in subarray
{
files: [["*.test.*", "*.js"]],
handler: jsTestHandler,
},
// filename must not match patterns beginning with !
{
name: "Non-JS files",
files: ["!*.js"],
settings: {
js: false,
},
},
// specific settings for files inside `src` directory
{
name: "Source files",
basePath: "src",
files: ["**/*"],
settings: {
source: true,
},
},
];
```
In this example, the array contains both config objects and a config array. When a config array is normalized (see details below), it is flattened so only config objects remain. However, the order of evaluation remains the same.
If the `files` array contains a function, then that function is called with the path of the file as it was passed in. The function is expected to return `true` if there is a match and `false` if not. (The `ignores` array can also contain functions.)
If the `files` array contains an item that is an array of strings and functions, then all patterns must match in order for the config to match. In the preceding examples, both `*.test.*` and `*.js` must match in order for the config object to be used.
If a pattern in the files array begins with `!` then it excludes that pattern. In the preceding example, any filename that doesn't end with `.js` will automatically get a `settings.js` property set to `false`.
You can also specify an `ignores` key that will force files matching those patterns to not be included. If the `ignores` key is in a config object without any other keys, then those ignores will always be applied; otherwise those ignores act as exclusions. Here's an example:
```js
export default [
// Always ignored
{
ignores: ["**/.git/**", "**/node_modules/**"]
},
// .eslintrc.js file is ignored only when .js file matches
{
files: ["**/*.js"],
ignores: [".eslintrc.js"]
handler: jsHandler
}
];
```
You can use negated patterns in `ignores` to exclude a file that was already ignored, such as:
```js
export default [
// Ignore all JSON files except tsconfig.json
{
files: ["**/*"],
ignores: ["**/*.json", "!tsconfig.json"],
},
];
```
### Config Functions
Config arrays can also include config functions when `extraConfigTypes` contains `"function"`. A config function accepts a single parameter, `context` (defined by you), and must return either a config object or a config array (it cannot return another function). Config functions allow end users to execute code in the creation of appropriate config objects. Here's an example:
```js
export default [
// JS config
{
files: ["**/*.js"],
handler: jsHandler,
},
// JSON configs
function (context) {
return [
// match all JSON files
{
name: context.name + " JSON Handler",
files: ["**/*.json"],
handler: jsonHandler,
},
// match only package.json
{
name: context.name + " package.json Handler",
files: ["package.json"],
handler: packageJsonHandler,
},
];
},
];
```
When a config array is normalized, each function is executed and replaced in the config array with the return value.
**Note:** Config functions can also be async.
### Normalizing Config Arrays
Once a config array has been created and loaded with all of the raw config data, it must be normalized before it can be used. The normalization process goes through and flattens the config array as well as executing all config functions to get their final values.
To normalize a config array, call the `normalize()` method and pass in a context object:
```js
await configs.normalize({
name: "MyApp",
});
```
The `normalize()` method returns a promise, so be sure to use the `await` operator. The config array instance is normalized in-place, so you don't need to create a new variable.
If you want to disallow async config functions, you can call `normalizeSync()` instead. This method is completely synchronous and does not require using the `await` operator as it does not return a promise:
```js
await configs.normalizeSync({
name: "MyApp",
});
```
**Important:** Once a `ConfigArray` is normalized, it cannot be changed further. You can, however, create a new `ConfigArray` and pass in the normalized instance to create an unnormalized copy.
### Getting Config for a File
To get the config for a file, use the `getConfig()` method on a normalized config array and pass in the filename to get a config for:
```js
// pass in filename
const fileConfig = configs.getConfig(
path.resolve(process.cwd(), "package.json"),
);
```
The config array always returns an object, even if there are no configs matching the given filename. You can then inspect the returned config object to determine how to proceed.
A few things to keep in mind:
- If a filename is not an absolute path, it will be resolved relative to the base path directory.
- The returned config object never has `files`, `ignores`, `basePath`, or `name` properties; the only properties on the object will be the other configuration options specified.
- The config array caches configs, so subsequent calls to `getConfig()` with the same filename will return in a fast lookup rather than another calculation.
- A config will only be generated if the filename matches an entry in a `files` key. A config will not be generated without matching a `files` key (configs without a `files` key are only applied when another config with a `files` key is applied; configs without `files` are never applied on their own). Any config with a `files` key entry that is `*` or ends with `/**` or `/*` will only be applied if another entry in the same `files` key matches or another config matches.
## Determining Ignored Paths
You can determine if a file is ignored by using the `isFileIgnored()` method and passing in the path of any file, as in this example:
```js
const ignored = configs.isFileIgnored("/foo/bar/baz.txt");
```
A file is considered ignored if any of the following is true:
- **It's parent directory is ignored.** For example, if `foo` is in `ignores`, then `foo/a.js` is considered ignored.
- **It has an ancestor directory that is ignored.** For example, if `foo` is in `ignores`, then `foo/baz/a.js` is considered ignored.
- **It matches an ignored file pattern.** For example, if `**/a.js` is in `ignores`, then `foo/a.js` and `foo/baz/a.js` are considered ignored.
- **If it matches an entry in `files` and also in `ignores`.** For example, if `**/*.js` is in `files` and `**/a.js` is in `ignores`, then `foo/a.js` and `foo/baz/a.js` are considered ignored.
- **The file is outside the `basePath`.** If the `basePath` is `/usr/me`, then `/foo/a.js` is considered ignored.
For directories, use the `isDirectoryIgnored()` method and pass in the path of any directory, as in this example:
```js
const ignored = configs.isDirectoryIgnored("/foo/bar/");
```
A directory is considered ignored if any of the following is true:
- **It's parent directory is ignored.** For example, if `foo` is in `ignores`, then `foo/baz` is considered ignored.
- **It has an ancestor directory that is ignored.** For example, if `foo` is in `ignores`, then `foo/bar/baz/a.js` is considered ignored.
- **It matches and ignored file pattern.** For example, if `**/a.js` is in `ignores`, then `foo/a.js` and `foo/baz/a.js` are considered ignored.
- **If it matches an entry in `files` and also in `ignores`.** For example, if `**/*.js` is in `files` and `**/a.js` is in `ignores`, then `foo/a.js` and `foo/baz/a.js` are considered ignored.
- **The file is outside the `basePath`.** If the `basePath` is `/usr/me`, then `/foo/a.js` is considered ignored.
**Important:** A pattern such as `foo/**` means that `foo` and `foo/` are _not_ ignored whereas `foo/bar` is ignored. If you want to ignore `foo` and all of its subdirectories, use the pattern `foo` or `foo/` in `ignores`.
## Caching Mechanisms
Each `ConfigArray` aggressively caches configuration objects to avoid unnecessary work. This caching occurs in two ways:
1. **File-based Caching.** For each filename that is passed into a method, the resulting config is cached against that filename so you're always guaranteed to get the same object returned from `getConfig()` whenever you pass the same filename in.
2. **Index-based Caching.** Whenever a config is calculated, the config elements that were used to create the config are also cached. So if a given filename matches elements 1, 5, and 7, the resulting config is cached with a key of `1,5,7`. That way, if another file is passed that matches the same config elements, the result is already known and doesn't have to be recalculated. That means two files that match all the same elements will return the same config from `getConfig()`.
## Acknowledgements
The design of this project was influenced by feedback on the ESLint RFC, and incorporates ideas from:
- Teddy Katz (@not-an-aardvark)
- Toru Nagashima (@mysticatea)
- Kai Cataldo (@kaicataldo)
## License
Apache 2.0
<!-- NOTE: This section is autogenerated. Do not manually edit.-->
<!--sponsorsstart-->
## Sponsors
The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. [Become a Sponsor](https://eslint.org/donate)
to get your logo on our READMEs and [website](https://eslint.org/sponsors).
<h3>Platinum Sponsors</h3>
<p><a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="128"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="128"></a></p><h3>Gold Sponsors</h3>
<p><a href="https://qlty.sh/"><img src="https://images.opencollective.com/qltysh/33d157d/logo.png" alt="Qlty Software" height="96"></a> <a href="https://trunk.io/"><img src="https://images.opencollective.com/trunkio/fb92d60/avatar.png" alt="trunk.io" height="96"></a> <a href="https://shopify.engineering/"><img src="https://avatars.githubusercontent.com/u/8085" alt="Shopify" height="96"></a></p><h3>Silver Sponsors</h3>
<p><a href="https://vite.dev/"><img src="https://images.opencollective.com/vite/e6d15e1/logo.png" alt="Vite" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301" alt="American Express" height="64"></a> <a href="https://stackblitz.com"><img src="https://avatars.githubusercontent.com/u/28635252" alt="StackBlitz" height="64"></a></p><h3>Bronze Sponsors</h3>
<p><a href="https://syntax.fm"><img src="https://github.com/syntaxfm.png" alt="Syntax" height="32"></a> <a href="https://cybozu.co.jp/"><img src="https://images.opencollective.com/cybozu/933e46d/logo.png" alt="Cybozu" height="32"></a> <a href="https://sentry.io"><img src="https://github.com/getsentry.png" alt="Sentry" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.gitbook.com"><img src="https://avatars.githubusercontent.com/u/7111340" alt="GitBook" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104" alt="Nx" height="32"></a> <a href="https://opensource.mercedes-benz.com/"><img src="https://avatars.githubusercontent.com/u/34240465" alt="Mercedes-Benz Group" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774" alt="HeroCoders" height="32"></a> <a href="https://www.lambdatest.com"><img src="https://avatars.githubusercontent.com/u/171592363" alt="LambdaTest" height="32"></a></p>
<h3>Technology Sponsors</h3>
Technology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work.
<p><a href="https://netlify.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/netlify-icon.svg" alt="Netlify" height="32"></a> <a href="https://algolia.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/algolia-icon.svg" alt="Algolia" height="32"></a> <a href="https://1password.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/1password-icon.svg" alt="1Password" height="32"></a></p>
<!--sponsorsend-->
@@ -0,0 +1,587 @@
import * as tailwind_variants from 'tailwind-variants';
import { VariantProps } from 'tailwind-variants';
import * as tailwind_variants_dist_config from 'tailwind-variants/dist/config';
/**
* Pagination wrapper **Tailwind Variants** component
*
* const {base,cursor, prev, next, item } = pagination({...})
*
* @example
* <ul className={base()} aria-label="pagination navigation">
* <li className={cursor()} aria-hidden="true">{active page}</li> // this marks the active page
* <li role="button" className={prev()} aria-label="Go to previous page" data-disabled="true">Prev</li>
* <li role="button" className={item()} aria-label="page 1" data-active="true">1</li>
* <li role="button" className={item()} aria-label="page 2">2</li>
* <li role="button" className={item()} aria-hidden="true">...</li>
* <li role="button" className={item()} aria-label="page 10">10</li>
* <li role="button" className={next()} aria-label="Go to next page">Next</li>
* </ul>
*/
declare const pagination: tailwind_variants.TVReturnType<{
variant: {
bordered: {
item: string[];
};
light: {
item: string;
};
flat: {};
faded: {
item: string[];
};
};
color: {
default: {
cursor: string;
};
primary: {
cursor: string;
};
secondary: {
cursor: string;
};
success: {
cursor: string;
};
warning: {
cursor: string;
};
danger: {
cursor: string;
};
};
size: {
sm: {};
md: {};
lg: {};
};
radius: {
none: {};
sm: {};
md: {};
lg: {};
full: {};
};
isCompact: {
true: {
wrapper: string;
item: string[];
prev: string;
next: string;
};
};
isDisabled: {
true: {
base: string;
};
};
showShadow: {
true: {};
};
disableCursorAnimation: {
true: {
cursor: string;
};
};
disableAnimation: {
true: {
item: string;
cursor: string;
};
false: {
item: string[];
cursor: string[];
};
};
}, {
base: string[];
wrapper: string[];
item: string[];
prev: string;
next: string;
cursor: string[];
forwardIcon: string[];
ellipsis: string;
chevronNext: string;
}, undefined, tailwind_variants_dist_config.TVConfig<{
variant: {
bordered: {
item: string[];
};
light: {
item: string;
};
flat: {};
faded: {
item: string[];
};
};
color: {
default: {
cursor: string;
};
primary: {
cursor: string;
};
secondary: {
cursor: string;
};
success: {
cursor: string;
};
warning: {
cursor: string;
};
danger: {
cursor: string;
};
};
size: {
sm: {};
md: {};
lg: {};
};
radius: {
none: {};
sm: {};
md: {};
lg: {};
full: {};
};
isCompact: {
true: {
wrapper: string;
item: string[];
prev: string;
next: string;
};
};
isDisabled: {
true: {
base: string;
};
};
showShadow: {
true: {};
};
disableCursorAnimation: {
true: {
cursor: string;
};
};
disableAnimation: {
true: {
item: string;
cursor: string;
};
false: {
item: string[];
cursor: string[];
};
};
}, {
variant: {
bordered: {
item: string[];
};
light: {
item: string;
};
flat: {};
faded: {
item: string[];
};
};
color: {
default: {
cursor: string;
};
primary: {
cursor: string;
};
secondary: {
cursor: string;
};
success: {
cursor: string;
};
warning: {
cursor: string;
};
danger: {
cursor: string;
};
};
size: {
sm: {};
md: {};
lg: {};
};
radius: {
none: {};
sm: {};
md: {};
lg: {};
full: {};
};
isCompact: {
true: {
wrapper: string;
item: string[];
prev: string;
next: string;
};
};
isDisabled: {
true: {
base: string;
};
};
showShadow: {
true: {};
};
disableCursorAnimation: {
true: {
cursor: string;
};
};
disableAnimation: {
true: {
item: string;
cursor: string;
};
false: {
item: string[];
cursor: string[];
};
};
}>, {
variant: {
bordered: {
item: string[];
};
light: {
item: string;
};
flat: {};
faded: {
item: string[];
};
};
color: {
default: {
cursor: string;
};
primary: {
cursor: string;
};
secondary: {
cursor: string;
};
success: {
cursor: string;
};
warning: {
cursor: string;
};
danger: {
cursor: string;
};
};
size: {
sm: {};
md: {};
lg: {};
};
radius: {
none: {};
sm: {};
md: {};
lg: {};
full: {};
};
isCompact: {
true: {
wrapper: string;
item: string[];
prev: string;
next: string;
};
};
isDisabled: {
true: {
base: string;
};
};
showShadow: {
true: {};
};
disableCursorAnimation: {
true: {
cursor: string;
};
};
disableAnimation: {
true: {
item: string;
cursor: string;
};
false: {
item: string[];
cursor: string[];
};
};
}, {
base: string[];
wrapper: string[];
item: string[];
prev: string;
next: string;
cursor: string[];
forwardIcon: string[];
ellipsis: string;
chevronNext: string;
}, tailwind_variants.TVReturnType<{
variant: {
bordered: {
item: string[];
};
light: {
item: string;
};
flat: {};
faded: {
item: string[];
};
};
color: {
default: {
cursor: string;
};
primary: {
cursor: string;
};
secondary: {
cursor: string;
};
success: {
cursor: string;
};
warning: {
cursor: string;
};
danger: {
cursor: string;
};
};
size: {
sm: {};
md: {};
lg: {};
};
radius: {
none: {};
sm: {};
md: {};
lg: {};
full: {};
};
isCompact: {
true: {
wrapper: string;
item: string[];
prev: string;
next: string;
};
};
isDisabled: {
true: {
base: string;
};
};
showShadow: {
true: {};
};
disableCursorAnimation: {
true: {
cursor: string;
};
};
disableAnimation: {
true: {
item: string;
cursor: string;
};
false: {
item: string[];
cursor: string[];
};
};
}, {
base: string[];
wrapper: string[];
item: string[];
prev: string;
next: string;
cursor: string[];
forwardIcon: string[];
ellipsis: string;
chevronNext: string;
}, undefined, tailwind_variants_dist_config.TVConfig<{
variant: {
bordered: {
item: string[];
};
light: {
item: string;
};
flat: {};
faded: {
item: string[];
};
};
color: {
default: {
cursor: string;
};
primary: {
cursor: string;
};
secondary: {
cursor: string;
};
success: {
cursor: string;
};
warning: {
cursor: string;
};
danger: {
cursor: string;
};
};
size: {
sm: {};
md: {};
lg: {};
};
radius: {
none: {};
sm: {};
md: {};
lg: {};
full: {};
};
isCompact: {
true: {
wrapper: string;
item: string[];
prev: string;
next: string;
};
};
isDisabled: {
true: {
base: string;
};
};
showShadow: {
true: {};
};
disableCursorAnimation: {
true: {
cursor: string;
};
};
disableAnimation: {
true: {
item: string;
cursor: string;
};
false: {
item: string[];
cursor: string[];
};
};
}, {
variant: {
bordered: {
item: string[];
};
light: {
item: string;
};
flat: {};
faded: {
item: string[];
};
};
color: {
default: {
cursor: string;
};
primary: {
cursor: string;
};
secondary: {
cursor: string;
};
success: {
cursor: string;
};
warning: {
cursor: string;
};
danger: {
cursor: string;
};
};
size: {
sm: {};
md: {};
lg: {};
};
radius: {
none: {};
sm: {};
md: {};
lg: {};
full: {};
};
isCompact: {
true: {
wrapper: string;
item: string[];
prev: string;
next: string;
};
};
isDisabled: {
true: {
base: string;
};
};
showShadow: {
true: {};
};
disableCursorAnimation: {
true: {
cursor: string;
};
};
disableAnimation: {
true: {
item: string;
cursor: string;
};
false: {
item: string[];
cursor: string[];
};
};
}>, unknown, unknown, undefined>>;
type PaginationVariantProps = VariantProps<typeof pagination>;
type PaginationSlots = keyof ReturnType<typeof pagination>;
export { PaginationSlots, PaginationVariantProps, pagination };
@@ -0,0 +1,254 @@
var $625cf83917e112ad$exports = require("./utils.main.js");
var $cR3F8$reactariautils = require("@react-aria/utils");
var $cR3F8$react = require("react");
var $cR3F8$reactariassr = require("@react-aria/ssr");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "addWindowFocusTracking", () => $e77252a287ef94ab$export$2f1888112f558a7d);
$parcel$export(module.exports, "isFocusVisible", () => $e77252a287ef94ab$export$b9b3dfddab17db27);
$parcel$export(module.exports, "getInteractionModality", () => $e77252a287ef94ab$export$630ff653c5ada6a9);
$parcel$export(module.exports, "setInteractionModality", () => $e77252a287ef94ab$export$8397ddfc504fdb9a);
$parcel$export(module.exports, "useInteractionModality", () => $e77252a287ef94ab$export$98e20ec92f614cfe);
$parcel$export(module.exports, "useFocusVisible", () => $e77252a287ef94ab$export$ffd9e5021c1fb2d6);
$parcel$export(module.exports, "useFocusVisibleListener", () => $e77252a287ef94ab$export$ec71b4b83ac08ec3);
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ // Portions of the code in this file are based on code from react.
// Original licensing for the following can be found in the
// NOTICE file in the root directory of this source tree.
// See https://github.com/facebook/react/tree/cc7c1aece46a6b69b41958d731e0fd27c94bfc6c/packages/react-interactions
let $e77252a287ef94ab$var$currentModality = null;
let $e77252a287ef94ab$var$changeHandlers = new Set();
let $e77252a287ef94ab$export$d90243b58daecda7 = new Map(); // We use a map here to support setting event listeners across multiple document objects.
let $e77252a287ef94ab$var$hasEventBeforeFocus = false;
let $e77252a287ef94ab$var$hasBlurredWindowRecently = false;
// Only Tab or Esc keys will make focus visible on text input elements
const $e77252a287ef94ab$var$FOCUS_VISIBLE_INPUT_KEYS = {
Tab: true,
Escape: true
};
function $e77252a287ef94ab$var$triggerChangeHandlers(modality, e) {
for (let handler of $e77252a287ef94ab$var$changeHandlers)handler(modality, e);
}
/**
* Helper function to determine if a KeyboardEvent is unmodified and could make keyboard focus styles visible.
*/ function $e77252a287ef94ab$var$isValidKey(e) {
// Control and Shift keys trigger when navigating back to the tab with keyboard.
return !(e.metaKey || !(0, $cR3F8$reactariautils.isMac)() && e.altKey || e.ctrlKey || e.key === 'Control' || e.key === 'Shift' || e.key === 'Meta');
}
function $e77252a287ef94ab$var$handleKeyboardEvent(e) {
$e77252a287ef94ab$var$hasEventBeforeFocus = true;
if ($e77252a287ef94ab$var$isValidKey(e)) {
$e77252a287ef94ab$var$currentModality = 'keyboard';
$e77252a287ef94ab$var$triggerChangeHandlers('keyboard', e);
}
}
function $e77252a287ef94ab$var$handlePointerEvent(e) {
$e77252a287ef94ab$var$currentModality = 'pointer';
if (e.type === 'mousedown' || e.type === 'pointerdown') {
$e77252a287ef94ab$var$hasEventBeforeFocus = true;
$e77252a287ef94ab$var$triggerChangeHandlers('pointer', e);
}
}
function $e77252a287ef94ab$var$handleClickEvent(e) {
if ((0, $cR3F8$reactariautils.isVirtualClick)(e)) {
$e77252a287ef94ab$var$hasEventBeforeFocus = true;
$e77252a287ef94ab$var$currentModality = 'virtual';
}
}
function $e77252a287ef94ab$var$handleFocusEvent(e) {
// Firefox fires two extra focus events when the user first clicks into an iframe:
// first on the window, then on the document. We ignore these events so they don't
// cause keyboard focus rings to appear.
if (e.target === window || e.target === document || (0, $625cf83917e112ad$exports.ignoreFocusEvent) || !e.isTrusted) return;
// If a focus event occurs without a preceding keyboard or pointer event, switch to virtual modality.
// This occurs, for example, when navigating a form with the next/previous buttons on iOS.
if (!$e77252a287ef94ab$var$hasEventBeforeFocus && !$e77252a287ef94ab$var$hasBlurredWindowRecently) {
$e77252a287ef94ab$var$currentModality = 'virtual';
$e77252a287ef94ab$var$triggerChangeHandlers('virtual', e);
}
$e77252a287ef94ab$var$hasEventBeforeFocus = false;
$e77252a287ef94ab$var$hasBlurredWindowRecently = false;
}
function $e77252a287ef94ab$var$handleWindowBlur() {
if (0, $625cf83917e112ad$exports.ignoreFocusEvent) return;
// When the window is blurred, reset state. This is necessary when tabbing out of the window,
// for example, since a subsequent focus event won't be fired.
$e77252a287ef94ab$var$hasEventBeforeFocus = false;
$e77252a287ef94ab$var$hasBlurredWindowRecently = true;
}
/**
* Setup global event listeners to control when keyboard focus style should be visible.
*/ function $e77252a287ef94ab$var$setupGlobalFocusEvents(element) {
if (typeof window === 'undefined' || typeof document === 'undefined' || $e77252a287ef94ab$export$d90243b58daecda7.get((0, $cR3F8$reactariautils.getOwnerWindow)(element))) return;
const windowObject = (0, $cR3F8$reactariautils.getOwnerWindow)(element);
const documentObject = (0, $cR3F8$reactariautils.getOwnerDocument)(element);
// Programmatic focus() calls shouldn't affect the current input modality.
// However, we need to detect other cases when a focus event occurs without
// a preceding user event (e.g. screen reader focus). Overriding the focus
// method on HTMLElement.prototype is a bit hacky, but works.
let focus = windowObject.HTMLElement.prototype.focus;
windowObject.HTMLElement.prototype.focus = function() {
$e77252a287ef94ab$var$hasEventBeforeFocus = true;
focus.apply(this, arguments);
};
documentObject.addEventListener('keydown', $e77252a287ef94ab$var$handleKeyboardEvent, true);
documentObject.addEventListener('keyup', $e77252a287ef94ab$var$handleKeyboardEvent, true);
documentObject.addEventListener('click', $e77252a287ef94ab$var$handleClickEvent, true);
// Register focus events on the window so they are sure to happen
// before React's event listeners (registered on the document).
windowObject.addEventListener('focus', $e77252a287ef94ab$var$handleFocusEvent, true);
windowObject.addEventListener('blur', $e77252a287ef94ab$var$handleWindowBlur, false);
if (typeof PointerEvent !== 'undefined') {
documentObject.addEventListener('pointerdown', $e77252a287ef94ab$var$handlePointerEvent, true);
documentObject.addEventListener('pointermove', $e77252a287ef94ab$var$handlePointerEvent, true);
documentObject.addEventListener('pointerup', $e77252a287ef94ab$var$handlePointerEvent, true);
} else if (process.env.NODE_ENV === 'test') {
documentObject.addEventListener('mousedown', $e77252a287ef94ab$var$handlePointerEvent, true);
documentObject.addEventListener('mousemove', $e77252a287ef94ab$var$handlePointerEvent, true);
documentObject.addEventListener('mouseup', $e77252a287ef94ab$var$handlePointerEvent, true);
}
// Add unmount handler
windowObject.addEventListener('beforeunload', ()=>{
$e77252a287ef94ab$var$tearDownWindowFocusTracking(element);
}, {
once: true
});
$e77252a287ef94ab$export$d90243b58daecda7.set(windowObject, {
focus: focus
});
}
const $e77252a287ef94ab$var$tearDownWindowFocusTracking = (element, loadListener)=>{
const windowObject = (0, $cR3F8$reactariautils.getOwnerWindow)(element);
const documentObject = (0, $cR3F8$reactariautils.getOwnerDocument)(element);
if (loadListener) documentObject.removeEventListener('DOMContentLoaded', loadListener);
if (!$e77252a287ef94ab$export$d90243b58daecda7.has(windowObject)) return;
windowObject.HTMLElement.prototype.focus = $e77252a287ef94ab$export$d90243b58daecda7.get(windowObject).focus;
documentObject.removeEventListener('keydown', $e77252a287ef94ab$var$handleKeyboardEvent, true);
documentObject.removeEventListener('keyup', $e77252a287ef94ab$var$handleKeyboardEvent, true);
documentObject.removeEventListener('click', $e77252a287ef94ab$var$handleClickEvent, true);
windowObject.removeEventListener('focus', $e77252a287ef94ab$var$handleFocusEvent, true);
windowObject.removeEventListener('blur', $e77252a287ef94ab$var$handleWindowBlur, false);
if (typeof PointerEvent !== 'undefined') {
documentObject.removeEventListener('pointerdown', $e77252a287ef94ab$var$handlePointerEvent, true);
documentObject.removeEventListener('pointermove', $e77252a287ef94ab$var$handlePointerEvent, true);
documentObject.removeEventListener('pointerup', $e77252a287ef94ab$var$handlePointerEvent, true);
} else if (process.env.NODE_ENV === 'test') {
documentObject.removeEventListener('mousedown', $e77252a287ef94ab$var$handlePointerEvent, true);
documentObject.removeEventListener('mousemove', $e77252a287ef94ab$var$handlePointerEvent, true);
documentObject.removeEventListener('mouseup', $e77252a287ef94ab$var$handlePointerEvent, true);
}
$e77252a287ef94ab$export$d90243b58daecda7.delete(windowObject);
};
function $e77252a287ef94ab$export$2f1888112f558a7d(element) {
const documentObject = (0, $cR3F8$reactariautils.getOwnerDocument)(element);
let loadListener;
if (documentObject.readyState !== 'loading') $e77252a287ef94ab$var$setupGlobalFocusEvents(element);
else {
loadListener = ()=>{
$e77252a287ef94ab$var$setupGlobalFocusEvents(element);
};
documentObject.addEventListener('DOMContentLoaded', loadListener);
}
return ()=>$e77252a287ef94ab$var$tearDownWindowFocusTracking(element, loadListener);
}
// Server-side rendering does not have the document object defined
// eslint-disable-next-line no-restricted-globals
if (typeof document !== 'undefined') $e77252a287ef94ab$export$2f1888112f558a7d();
function $e77252a287ef94ab$export$b9b3dfddab17db27() {
return $e77252a287ef94ab$var$currentModality !== 'pointer';
}
function $e77252a287ef94ab$export$630ff653c5ada6a9() {
return $e77252a287ef94ab$var$currentModality;
}
function $e77252a287ef94ab$export$8397ddfc504fdb9a(modality) {
$e77252a287ef94ab$var$currentModality = modality;
$e77252a287ef94ab$var$triggerChangeHandlers(modality, null);
}
function $e77252a287ef94ab$export$98e20ec92f614cfe() {
$e77252a287ef94ab$var$setupGlobalFocusEvents();
let [modality, setModality] = (0, $cR3F8$react.useState)($e77252a287ef94ab$var$currentModality);
(0, $cR3F8$react.useEffect)(()=>{
let handler = ()=>{
setModality($e77252a287ef94ab$var$currentModality);
};
$e77252a287ef94ab$var$changeHandlers.add(handler);
return ()=>{
$e77252a287ef94ab$var$changeHandlers.delete(handler);
};
}, []);
return (0, $cR3F8$reactariassr.useIsSSR)() ? null : modality;
}
const $e77252a287ef94ab$var$nonTextInputTypes = new Set([
'checkbox',
'radio',
'range',
'color',
'file',
'image',
'button',
'submit',
'reset'
]);
/**
* If this is attached to text input component, return if the event is a focus event (Tab/Escape keys pressed) so that
* focus visible style can be properly set.
*/ function $e77252a287ef94ab$var$isKeyboardFocusEvent(isTextInput, modality, e) {
let document1 = (0, $cR3F8$reactariautils.getOwnerDocument)(e === null || e === void 0 ? void 0 : e.target);
const IHTMLInputElement = typeof window !== 'undefined' ? (0, $cR3F8$reactariautils.getOwnerWindow)(e === null || e === void 0 ? void 0 : e.target).HTMLInputElement : HTMLInputElement;
const IHTMLTextAreaElement = typeof window !== 'undefined' ? (0, $cR3F8$reactariautils.getOwnerWindow)(e === null || e === void 0 ? void 0 : e.target).HTMLTextAreaElement : HTMLTextAreaElement;
const IHTMLElement = typeof window !== 'undefined' ? (0, $cR3F8$reactariautils.getOwnerWindow)(e === null || e === void 0 ? void 0 : e.target).HTMLElement : HTMLElement;
const IKeyboardEvent = typeof window !== 'undefined' ? (0, $cR3F8$reactariautils.getOwnerWindow)(e === null || e === void 0 ? void 0 : e.target).KeyboardEvent : KeyboardEvent;
// For keyboard events that occur on a non-input element that will move focus into input element (aka ArrowLeft going from Datepicker button to the main input group)
// we need to rely on the user passing isTextInput into here. This way we can skip toggling focus visiblity for said input element
isTextInput = isTextInput || document1.activeElement instanceof IHTMLInputElement && !$e77252a287ef94ab$var$nonTextInputTypes.has(document1.activeElement.type) || document1.activeElement instanceof IHTMLTextAreaElement || document1.activeElement instanceof IHTMLElement && document1.activeElement.isContentEditable;
return !(isTextInput && modality === 'keyboard' && e instanceof IKeyboardEvent && !$e77252a287ef94ab$var$FOCUS_VISIBLE_INPUT_KEYS[e.key]);
}
function $e77252a287ef94ab$export$ffd9e5021c1fb2d6(props = {}) {
let { isTextInput: isTextInput, autoFocus: autoFocus } = props;
let [isFocusVisibleState, setFocusVisible] = (0, $cR3F8$react.useState)(autoFocus || $e77252a287ef94ab$export$b9b3dfddab17db27());
$e77252a287ef94ab$export$ec71b4b83ac08ec3((isFocusVisible)=>{
setFocusVisible(isFocusVisible);
}, [
isTextInput
], {
isTextInput: isTextInput
});
return {
isFocusVisible: isFocusVisibleState
};
}
function $e77252a287ef94ab$export$ec71b4b83ac08ec3(fn, deps, opts) {
$e77252a287ef94ab$var$setupGlobalFocusEvents();
(0, $cR3F8$react.useEffect)(()=>{
let handler = (modality, e)=>{
// We want to early return for any keyboard events that occur inside text inputs EXCEPT for Tab and Escape
if (!$e77252a287ef94ab$var$isKeyboardFocusEvent(!!(opts === null || opts === void 0 ? void 0 : opts.isTextInput), modality, e)) return;
fn($e77252a287ef94ab$export$b9b3dfddab17db27());
};
$e77252a287ef94ab$var$changeHandlers.add(handler);
return ()=>{
$e77252a287ef94ab$var$changeHandlers.delete(handler);
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, deps);
}
//# sourceMappingURL=useFocusVisible.main.js.map
@@ -0,0 +1,35 @@
// src/bold/volume-low.tsx
import { jsx, jsxs } from "react/jsx-runtime";
var VolumeLowBoldIcon = (props) => /* @__PURE__ */ jsxs(
"svg",
{
"aria-hidden": "true",
fill: "none",
focusable: "false",
height: "1em",
role: "presentation",
viewBox: "0 0 24 24",
width: "1em",
...props,
children: [
/* @__PURE__ */ jsx(
"path",
{
d: "M19.3284 16.7503C19.1684 16.7503 19.0184 16.7003 18.8784 16.6003C18.5484 16.3503 18.4784 15.8803 18.7284 15.5503C20.2984 13.4603 20.2984 10.5403 18.7284 8.45027C18.4784 8.12027 18.5484 7.65027 18.8784 7.40027C19.2084 7.15027 19.6784 7.22027 19.9284 7.55027C21.8984 10.1703 21.8984 13.8303 19.9284 16.4503C19.7884 16.6503 19.5584 16.7503 19.3284 16.7503Z",
fill: "currentColor"
}
),
/* @__PURE__ */ jsx(
"path",
{
d: "M15.3481 3.78168C14.2281 3.16168 12.7981 3.32168 11.3381 4.23168L8.41813 6.06168C8.21813 6.18168 7.98813 6.25168 7.75813 6.25168H6.82812H6.32812C3.90812 6.25168 2.57812 7.58168 2.57812 10.0017V14.0017C2.57812 16.4217 3.90812 17.7517 6.32812 17.7517H6.82812H7.75813C7.98813 17.7517 8.21813 17.8217 8.41813 17.9417L11.3381 19.7717C12.2181 20.3217 13.0781 20.5917 13.8781 20.5917C14.3981 20.5917 14.8981 20.4717 15.3481 20.2217C16.4581 19.6017 17.0781 18.3117 17.0781 16.5917V7.41168C17.0781 5.69168 16.4581 4.40168 15.3481 3.78168Z",
fill: "currentColor"
}
)
]
}
);
export {
VolumeLowBoldIcon
};
@@ -0,0 +1,171 @@
# micromark-core-commonmark
[![Build][build-badge]][build]
[![Coverage][coverage-badge]][coverage]
[![Downloads][downloads-badge]][downloads]
[![Size][bundle-size-badge]][bundle-size]
[![Sponsors][sponsors-badge]][opencollective]
[![Backers][backers-badge]][opencollective]
[![Chat][chat-badge]][chat]
[micromark][] constructs that make up the core of CommonMark.
Some of these can be [turned off][disable], but they are often essential to
markdown and weird things might happen.
## Contents
* [What is this?](#what-is-this)
* [When should I use this?](#when-should-i-use-this)
* [Install](#install)
* [Use](#use)
* [API](#api)
* [Types](#types)
* [Compatibility](#compatibility)
* [Security](#security)
* [Contribute](#contribute)
* [License](#license)
## What is this?
This package exposes the default constructs.
## When should I use this?
This package is useful when you are making your own micromark extensions.
## Install
This package is [ESM only][esm].
In Node.js (version 16+), install with [npm][]:
```sh
npm install micromark-core-commonmark
```
In Deno with [`esm.sh`][esmsh]:
```js
import * as core from 'https://esm.sh/micromark-core-commonmark@1'
```
In browsers with [`esm.sh`][esmsh]:
```html
<script type="module">
import * as core from 'https://esm.sh/micromark-core-commonmark@1?bundle'
</script>
```
## Use
```js
import {autolink} from 'micromark-core-commonmark'
console.log(autolink) // Do things with `autolink`.
```
## API
This module exports the following identifiers: `attention`, `autolink`,
`blankLine`, `blockQuote`, `characterEscape`, `characterReference`,
`codeFenced`, `codeIndented`, `codeText`, `content`, `definition`,
`hardBreakEscape`, `headingAtx`, `htmlFlow`, `htmlText`, `labelEnd`,
`labelStartImage`, `labelStartLink`, `lineEnding`, `list`, `setextUnderline`,
`thematicBreak`.
There is no default export.
Each identifier refers to a [construct][].
See the code for more on the exported constructs.
## Types
This package is fully typed with [TypeScript][].
It exports no additional types.
## Compatibility
Projects maintained by the unified collective are compatible with maintained
versions of Node.js.
When we cut a new major release, we drop support for unmaintained versions of
Node.
This means we try to keep the current release line,
`micromark-core-commonmark@2`, compatible with Node.js 16.
This package works with `micromark@3`.
## Security
This package is safe.
See [`security.md`][securitymd] in [`micromark/.github`][health] for how to
submit a security report.
## Contribute
See [`contributing.md`][contributing] in [`micromark/.github`][health] for ways
to get started.
See [`support.md`][support] for ways to get help.
This project has a [code of conduct][coc].
By interacting with this repository, organisation, or community you agree to
abide by its terms.
## License
[MIT][license] © [Titus Wormer][author]
<!-- Definitions -->
[author]: https://wooorm.com
[backers-badge]: https://opencollective.com/unified/backers/badge.svg
[build]: https://github.com/micromark/micromark/actions
[build-badge]: https://github.com/micromark/micromark/workflows/main/badge.svg
[bundle-size]: https://bundlejs.com/?q=micromark-core-commonmark
[bundle-size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=micromark-core-commonmark
[chat]: https://github.com/micromark/micromark/discussions
[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg
[coc]: https://github.com/micromark/.github/blob/main/code-of-conduct.md
[construct]: https://github.com/micromark/micromark#constructs
[contributing]: https://github.com/micromark/.github/blob/main/contributing.md
[coverage]: https://codecov.io/github/micromark/micromark
[coverage-badge]: https://img.shields.io/codecov/c/github/micromark/micromark.svg
[disable]: https://github.com/micromark/micromark#case-turn-off-constructs
[downloads]: https://www.npmjs.com/package/micromark-core-commonmark
[downloads-badge]: https://img.shields.io/npm/dm/micromark-core-commonmark.svg
[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
[esmsh]: https://esm.sh
[health]: https://github.com/micromark/.github
[license]: https://github.com/micromark/micromark/blob/main/license
[micromark]: https://github.com/micromark/micromark
[npm]: https://docs.npmjs.com/cli/install
[opencollective]: https://opencollective.com/unified
[securitymd]: https://github.com/micromark/.github/blob/main/security.md
[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg
[support]: https://github.com/micromark/.github/blob/main/support.md
[typescript]: https://www.typescriptlang.org
@@ -0,0 +1,439 @@
/**
* @import {Element, ElementContent, Nodes, Parents, Root} from 'hast'
* @import {Root as MdastRoot} from 'mdast'
* @import {ComponentProps, ElementType, ReactElement} from 'react'
* @import {Options as RemarkRehypeOptions} from 'remark-rehype'
* @import {BuildVisitor} from 'unist-util-visit'
* @import {PluggableList, Processor} from 'unified'
*/
/**
* @callback AllowElement
* Filter elements.
* @param {Readonly<Element>} element
* Element to check.
* @param {number} index
* Index of `element` in `parent`.
* @param {Readonly<Parents> | undefined} parent
* Parent of `element`.
* @returns {boolean | null | undefined}
* Whether to allow `element` (default: `false`).
*/
/**
* @typedef ExtraProps
* Extra fields we pass.
* @property {Element | undefined} [node]
* passed when `passNode` is on.
*/
/**
* @typedef {{
* [Key in Extract<ElementType, string>]?: ElementType<ComponentProps<Key> & ExtraProps>
* }} Components
* Map tag names to components.
*/
/**
* @typedef Deprecation
* Deprecation.
* @property {string} from
* Old field.
* @property {string} id
* ID in readme.
* @property {keyof Options} [to]
* New field.
*/
/**
* @typedef Options
* Configuration.
* @property {AllowElement | null | undefined} [allowElement]
* Filter elements (optional);
* `allowedElements` / `disallowedElements` is used first.
* @property {ReadonlyArray<string> | null | undefined} [allowedElements]
* Tag names to allow (default: all tag names);
* cannot combine w/ `disallowedElements`.
* @property {string | null | undefined} [children]
* Markdown.
* @property {string | null | undefined} [className]
* Wrap in a `div` with this class name.
* @property {Components | null | undefined} [components]
* Map tag names to components.
* @property {ReadonlyArray<string> | null | undefined} [disallowedElements]
* Tag names to disallow (default: `[]`);
* cannot combine w/ `allowedElements`.
* @property {PluggableList | null | undefined} [rehypePlugins]
* List of rehype plugins to use.
* @property {PluggableList | null | undefined} [remarkPlugins]
* List of remark plugins to use.
* @property {Readonly<RemarkRehypeOptions> | null | undefined} [remarkRehypeOptions]
* Options to pass through to `remark-rehype`.
* @property {boolean | null | undefined} [skipHtml=false]
* Ignore HTML in markdown completely (default: `false`).
* @property {boolean | null | undefined} [unwrapDisallowed=false]
* Extract (unwrap) what’s in disallowed elements (default: `false`);
* normally when say `strong` is not allowed, it and it’s children are dropped,
* with `unwrapDisallowed` the element itself is replaced by its children.
* @property {UrlTransform | null | undefined} [urlTransform]
* Change URLs (default: `defaultUrlTransform`)
*/
/**
* @callback UrlTransform
* Transform all URLs.
* @param {string} url
* URL.
* @param {string} key
* Property name (example: `'href'`).
* @param {Readonly<Element>} node
* Node.
* @returns {string | null | undefined}
* Transformed URL (optional).
*/
import {unreachable} from 'devlop'
import {toJsxRuntime} from 'hast-util-to-jsx-runtime'
import {urlAttributes} from 'html-url-attributes'
import {Fragment, jsx, jsxs} from 'react/jsx-runtime'
import {createElement, useEffect, useState} from 'react'
import remarkParse from 'remark-parse'
import remarkRehype from 'remark-rehype'
import {unified} from 'unified'
import {visit} from 'unist-util-visit'
import {VFile} from 'vfile'
const changelog =
'https://github.com/remarkjs/react-markdown/blob/main/changelog.md'
/** @type {PluggableList} */
const emptyPlugins = []
/** @type {Readonly<RemarkRehypeOptions>} */
const emptyRemarkRehypeOptions = {allowDangerousHtml: true}
const safeProtocol = /^(https?|ircs?|mailto|xmpp)$/i
// Mutable because we `delete` any time it’s used and a message is sent.
/** @type {ReadonlyArray<Readonly<Deprecation>>} */
const deprecations = [
{from: 'astPlugins', id: 'remove-buggy-html-in-markdown-parser'},
{from: 'allowDangerousHtml', id: 'remove-buggy-html-in-markdown-parser'},
{
from: 'allowNode',
id: 'replace-allownode-allowedtypes-and-disallowedtypes',
to: 'allowElement'
},
{
from: 'allowedTypes',
id: 'replace-allownode-allowedtypes-and-disallowedtypes',
to: 'allowedElements'
},
{
from: 'disallowedTypes',
id: 'replace-allownode-allowedtypes-and-disallowedtypes',
to: 'disallowedElements'
},
{from: 'escapeHtml', id: 'remove-buggy-html-in-markdown-parser'},
{from: 'includeElementIndex', id: '#remove-includeelementindex'},
{
from: 'includeNodeIndex',
id: 'change-includenodeindex-to-includeelementindex'
},
{from: 'linkTarget', id: 'remove-linktarget'},
{from: 'plugins', id: 'change-plugins-to-remarkplugins', to: 'remarkPlugins'},
{from: 'rawSourcePos', id: '#remove-rawsourcepos'},
{from: 'renderers', id: 'change-renderers-to-components', to: 'components'},
{from: 'source', id: 'change-source-to-children', to: 'children'},
{from: 'sourcePos', id: '#remove-sourcepos'},
{from: 'transformImageUri', id: '#add-urltransform', to: 'urlTransform'},
{from: 'transformLinkUri', id: '#add-urltransform', to: 'urlTransform'}
]
/**
* Component to render markdown.
*
* This is a synchronous component.
* When using async plugins,
* see {@linkcode MarkdownAsync} or {@linkcode MarkdownHooks}.
*
* @param {Readonly<Options>} options
* Props.
* @returns {ReactElement}
* React element.
*/
export function Markdown(options) {
const processor = createProcessor(options)
const file = createFile(options)
return post(processor.runSync(processor.parse(file), file), options)
}
/**
* Component to render markdown with support for async plugins
* through async/await.
*
* Components returning promises are supported on the server.
* For async support on the client,
* see {@linkcode MarkdownHooks}.
*
* @param {Readonly<Options>} options
* Props.
* @returns {Promise<ReactElement>}
* Promise to a React element.
*/
export async function MarkdownAsync(options) {
const processor = createProcessor(options)
const file = createFile(options)
const tree = await processor.run(processor.parse(file), file)
return post(tree, options)
}
/**
* Component to render markdown with support for async plugins through hooks.
*
* This uses `useEffect` and `useState` hooks.
* Hooks run on the client and do not immediately render something.
* For async support on the server,
* see {@linkcode MarkdownAsync}.
*
* @param {Readonly<Options>} options
* Props.
* @returns {ReactElement}
* React element.
*/
export function MarkdownHooks(options) {
const processor = createProcessor(options)
const [error, setError] = useState(
/** @type {Error | undefined} */ (undefined)
)
const [tree, setTree] = useState(/** @type {Root | undefined} */ (undefined))
useEffect(
/* c8 ignore next 7 -- hooks are client-only. */
function () {
const file = createFile(options)
processor.run(processor.parse(file), file, function (error, tree) {
setError(error)
setTree(tree)
})
},
[
options.children,
options.rehypePlugins,
options.remarkPlugins,
options.remarkRehypeOptions
]
)
/* c8 ignore next -- hooks are client-only. */
if (error) throw error
/* c8 ignore next -- hooks are client-only. */
return tree ? post(tree, options) : createElement(Fragment)
}
/**
* Set up the `unified` processor.
*
* @param {Readonly<Options>} options
* Props.
* @returns {Processor<MdastRoot, MdastRoot, Root, undefined, undefined>}
* Result.
*/
function createProcessor(options) {
const rehypePlugins = options.rehypePlugins || emptyPlugins
const remarkPlugins = options.remarkPlugins || emptyPlugins
const remarkRehypeOptions = options.remarkRehypeOptions
? {...options.remarkRehypeOptions, ...emptyRemarkRehypeOptions}
: emptyRemarkRehypeOptions
const processor = unified()
.use(remarkParse)
.use(remarkPlugins)
.use(remarkRehype, remarkRehypeOptions)
.use(rehypePlugins)
return processor
}
/**
* Set up the virtual file.
*
* @param {Readonly<Options>} options
* Props.
* @returns {VFile}
* Result.
*/
function createFile(options) {
const children = options.children || ''
const file = new VFile()
if (typeof children === 'string') {
file.value = children
} else {
unreachable(
'Unexpected value `' +
children +
'` for `children` prop, expected `string`'
)
}
return file
}
/**
* Process the result from unified some more.
*
* @param {Nodes} tree
* Tree.
* @param {Readonly<Options>} options
* Props.
* @returns {ReactElement}
* React element.
*/
function post(tree, options) {
const allowedElements = options.allowedElements
const allowElement = options.allowElement
const components = options.components
const disallowedElements = options.disallowedElements
const skipHtml = options.skipHtml
const unwrapDisallowed = options.unwrapDisallowed
const urlTransform = options.urlTransform || defaultUrlTransform
for (const deprecation of deprecations) {
if (Object.hasOwn(options, deprecation.from)) {
unreachable(
'Unexpected `' +
deprecation.from +
'` prop, ' +
(deprecation.to
? 'use `' + deprecation.to + '` instead'
: 'remove it') +
' (see <' +
changelog +
'#' +
deprecation.id +
'> for more info)'
)
}
}
if (allowedElements && disallowedElements) {
unreachable(
'Unexpected combined `allowedElements` and `disallowedElements`, expected one or the other'
)
}
// Wrap in `div` if there’s a class name.
if (options.className) {
tree = {
type: 'element',
tagName: 'div',
properties: {className: options.className},
// Assume no doctypes.
children: /** @type {Array<ElementContent>} */ (
tree.type === 'root' ? tree.children : [tree]
)
}
}
visit(tree, transform)
return toJsxRuntime(tree, {
Fragment,
// @ts-expect-error
// React components are allowed to return numbers,
// but not according to the types in hast-util-to-jsx-runtime
components,
ignoreInvalidStyle: true,
jsx,
jsxs,
passKeys: true,
passNode: true
})
/** @type {BuildVisitor<Root>} */
function transform(node, index, parent) {
if (node.type === 'raw' && parent && typeof index === 'number') {
if (skipHtml) {
parent.children.splice(index, 1)
} else {
parent.children[index] = {type: 'text', value: node.value}
}
return index
}
if (node.type === 'element') {
/** @type {string} */
let key
for (key in urlAttributes) {
if (
Object.hasOwn(urlAttributes, key) &&
Object.hasOwn(node.properties, key)
) {
const value = node.properties[key]
const test = urlAttributes[key]
if (test === null || test.includes(node.tagName)) {
node.properties[key] = urlTransform(String(value || ''), key, node)
}
}
}
}
if (node.type === 'element') {
let remove = allowedElements
? !allowedElements.includes(node.tagName)
: disallowedElements
? disallowedElements.includes(node.tagName)
: false
if (!remove && allowElement && typeof index === 'number') {
remove = !allowElement(node, index, parent)
}
if (remove && parent && typeof index === 'number') {
if (unwrapDisallowed && node.children) {
parent.children.splice(index, 1, ...node.children)
} else {
parent.children.splice(index, 1)
}
return index
}
}
}
}
/**
* Make a URL safe.
*
* @satisfies {UrlTransform}
* @param {string} value
* URL.
* @returns {string}
* Safe URL.
*/
export function defaultUrlTransform(value) {
// Same as:
// <https://github.com/micromark/micromark/blob/929275e/packages/micromark-util-sanitize-uri/dev/index.js#L34>
// But without the `encode` part.
const colon = value.indexOf(':')
const questionMark = value.indexOf('?')
const numberSign = value.indexOf('#')
const slash = value.indexOf('/')
if (
// If there is no protocol, it’s relative.
colon === -1 ||
// If the first colon is after a `?`, `#`, or `/`, it’s not a protocol.
(slash !== -1 && colon > slash) ||
(questionMark !== -1 && colon > questionMark) ||
(numberSign !== -1 && colon > numberSign) ||
// It is a protocol, it should be allowed.
safeProtocol.test(value.slice(0, colon))
) {
return value
}
return ''
}
@@ -0,0 +1,4 @@
/** @type {Construct} */
export const labelStartLink: Construct;
import type { Construct } from 'micromark-util-types';
//# sourceMappingURL=label-start-link.d.ts.map
@@ -0,0 +1,49 @@
/**
* Google Hardware Attestation Root 1
*
* Downloaded from https://developer.android.com/training/articles/security-key-attestation#root_certificate
* (first entry)
*
* Valid until 2026-05-24 @ 09:28 PST
*
* SHA256 Fingerprint
* C1:98:4A:3E:F4:5C:1E:2A:91:85:51:DE:10:60:3C:86:F7:05:1B:22:49:C4:89:1C:AE:32:30:EA:BD:0C:97:D5
*/
export declare const Google_Hardware_Attestation_Root_1 = "-----BEGIN CERTIFICATE-----\nMIIFYDCCA0igAwIBAgIJAOj6GWMU0voYMA0GCSqGSIb3DQEBCwUAMBsxGTAXBgNV\nBAUTEGY5MjAwOWU4NTNiNmIwNDUwHhcNMTYwNTI2MTYyODUyWhcNMjYwNTI0MTYy\nODUyWjAbMRkwFwYDVQQFExBmOTIwMDllODUzYjZiMDQ1MIICIjANBgkqhkiG9w0B\nAQEFAAOCAg8AMIICCgKCAgEAr7bHgiuxpwHsK7Qui8xUFmOr75gvMsd/dTEDDJdS\nSxtf6An7xyqpRR90PL2abxM1dEqlXnf2tqw1Ne4Xwl5jlRfdnJLmN0pTy/4lj4/7\ntv0Sk3iiKkypnEUtR6WfMgH0QZfKHM1+di+y9TFRtv6y//0rb+T+W8a9nsNL/ggj\nnar86461qO0rOs2cXjp3kOG1FEJ5MVmFmBGtnrKpa73XpXyTqRxB/M0n1n/W9nGq\nC4FSYa04T6N5RIZGBN2z2MT5IKGbFlbC8UrW0DxW7AYImQQcHtGl/m00QLVWutHQ\noVJYnFPlXTcHYvASLu+RhhsbDmxMgJJ0mcDpvsC4PjvB+TxywElgS70vE0XmLD+O\nJtvsBslHZvPBKCOdT0MS+tgSOIfga+z1Z1g7+DVagf7quvmag8jfPioyKvxnK/Eg\nsTUVi2ghzq8wm27ud/mIM7AY2qEORR8Go3TVB4HzWQgpZrt3i5MIlCaY504LzSRi\nigHCzAPlHws+W0rB5N+er5/2pJKnfBSDiCiFAVtCLOZ7gLiMm0jhO2B6tUXHI/+M\nRPjy02i59lINMRRev56GKtcd9qO/0kUJWdZTdA2XoS82ixPvZtXQpUpuL12ab+9E\naDK8Z4RHJYYfCT3Q5vNAXaiWQ+8PTWm2QgBR/bkwSWc+NpUFgNPN9PvQi8WEg5Um\nAGMCAwEAAaOBpjCBozAdBgNVHQ4EFgQUNmHhAHyIBQlRi0RsR/8aTMnqTxIwHwYD\nVR0jBBgwFoAUNmHhAHyIBQlRi0RsR/8aTMnqTxIwDwYDVR0TAQH/BAUwAwEB/zAO\nBgNVHQ8BAf8EBAMCAYYwQAYDVR0fBDkwNzA1oDOgMYYvaHR0cHM6Ly9hbmRyb2lk\nLmdvb2dsZWFwaXMuY29tL2F0dGVzdGF0aW9uL2NybC8wDQYJKoZIhvcNAQELBQAD\nggIBACDIw41L3KlXG0aMiS//cqrG+EShHUGo8HNsw30W1kJtjn6UBwRM6jnmiwfB\nPb8VA91chb2vssAtX2zbTvqBJ9+LBPGCdw/E53Rbf86qhxKaiAHOjpvAy5Y3m00m\nqC0w/Zwvju1twb4vhLaJ5NkUJYsUS7rmJKHHBnETLi8GFqiEsqTWpG/6ibYCv7rY\nDBJDcR9W62BW9jfIoBQcxUCUJouMPH25lLNcDc1ssqvC2v7iUgI9LeoM1sNovqPm\nQUiG9rHli1vXxzCyaMTjwftkJLkf6724DFhuKug2jITV0QkXvaJWF4nUaHOTNA4u\nJU9WDvZLI1j83A+/xnAJUucIv/zGJ1AMH2boHqF8CY16LpsYgBt6tKxxWH00XcyD\nCdW2KlBCeqbQPcsFmWyWugxdcekhYsAWyoSf818NUsZdBWBaR/OukXrNLfkQ79Iy\nZohZbvabO/X+MVT3rriAoKc8oE2Uws6DF+60PV7/WIPjNvXySdqspImSN78mflxD\nqwLqRBYkA3I75qppLGG9rp7UCdRjxMl8ZDBld+7yvHVgt1cVzJx9xnyGCC23Uaic\nMDSXYrB4I4WHXPGjxhZuCuPBLTdOLU8YRvMYdEvYebWHMpvwGCF6bAx3JBpIeOQ1\nwDB5y0USicV3YgYGmi+NZfhA4URSh77Yd6uuJOJENRaNVTzk\n-----END CERTIFICATE-----\n";
/**
* Google Hardware Attestation Root 2
*
* Downloaded from https://developer.android.com/training/articles/security-key-attestation#root_certificate
* (second entry)
*
* Valid until 2034-11-18 @ 12:37 PST
*
* SHA256 Fingerprint
* 1E:F1:A0:4B:8B:A5:8A:B9:45:89:AC:49:8C:89:82:A7:83:F2:4E:A7:30:7E:01:59:A0:C3:A7:3B:37:7D:87:CC
*/
export declare const Google_Hardware_Attestation_Root_2 = "-----BEGIN CERTIFICATE-----\nMIIFHDCCAwSgAwIBAgIJANUP8luj8tazMA0GCSqGSIb3DQEBCwUAMBsxGTAXBgNV\nBAUTEGY5MjAwOWU4NTNiNmIwNDUwHhcNMTkxMTIyMjAzNzU4WhcNMzQxMTE4MjAz\nNzU4WjAbMRkwFwYDVQQFExBmOTIwMDllODUzYjZiMDQ1MIICIjANBgkqhkiG9w0B\nAQEFAAOCAg8AMIICCgKCAgEAr7bHgiuxpwHsK7Qui8xUFmOr75gvMsd/dTEDDJdS\nSxtf6An7xyqpRR90PL2abxM1dEqlXnf2tqw1Ne4Xwl5jlRfdnJLmN0pTy/4lj4/7\ntv0Sk3iiKkypnEUtR6WfMgH0QZfKHM1+di+y9TFRtv6y//0rb+T+W8a9nsNL/ggj\nnar86461qO0rOs2cXjp3kOG1FEJ5MVmFmBGtnrKpa73XpXyTqRxB/M0n1n/W9nGq\nC4FSYa04T6N5RIZGBN2z2MT5IKGbFlbC8UrW0DxW7AYImQQcHtGl/m00QLVWutHQ\noVJYnFPlXTcHYvASLu+RhhsbDmxMgJJ0mcDpvsC4PjvB+TxywElgS70vE0XmLD+O\nJtvsBslHZvPBKCOdT0MS+tgSOIfga+z1Z1g7+DVagf7quvmag8jfPioyKvxnK/Eg\nsTUVi2ghzq8wm27ud/mIM7AY2qEORR8Go3TVB4HzWQgpZrt3i5MIlCaY504LzSRi\nigHCzAPlHws+W0rB5N+er5/2pJKnfBSDiCiFAVtCLOZ7gLiMm0jhO2B6tUXHI/+M\nRPjy02i59lINMRRev56GKtcd9qO/0kUJWdZTdA2XoS82ixPvZtXQpUpuL12ab+9E\naDK8Z4RHJYYfCT3Q5vNAXaiWQ+8PTWm2QgBR/bkwSWc+NpUFgNPN9PvQi8WEg5Um\nAGMCAwEAAaNjMGEwHQYDVR0OBBYEFDZh4QB8iAUJUYtEbEf/GkzJ6k8SMB8GA1Ud\nIwQYMBaAFDZh4QB8iAUJUYtEbEf/GkzJ6k8SMA8GA1UdEwEB/wQFMAMBAf8wDgYD\nVR0PAQH/BAQDAgIEMA0GCSqGSIb3DQEBCwUAA4ICAQBOMaBc8oumXb2voc7XCWnu\nXKhBBK3e2KMGz39t7lA3XXRe2ZLLAkLM5y3J7tURkf5a1SutfdOyXAmeE6SRo83U\nh6WszodmMkxK5GM4JGrnt4pBisu5igXEydaW7qq2CdC6DOGjG+mEkN8/TA6p3cno\nL/sPyz6evdjLlSeJ8rFBH6xWyIZCbrcpYEJzXaUOEaxxXxgYz5/cTiVKN2M1G2ok\nQBUIYSY6bjEL4aUN5cfo7ogP3UvliEo3Eo0YgwuzR2v0KR6C1cZqZJSTnghIC/vA\nD32KdNQ+c3N+vl2OTsUVMC1GiWkngNx1OO1+kXW+YTnnTUOtOIswUP/Vqd5SYgAI\nmMAfY8U9/iIgkQj6T2W6FsScy94IN9fFhE1UtzmLoBIuUFsVXJMTz+Jucth+IqoW\nFua9v1R93/k98p41pjtFX+H8DslVgfP097vju4KDlqN64xV1grw3ZLl4CiOe/A91\noeLm2UHOq6wn3esB4r2EIQKb6jTVGu5sYCcdWpXr0AUVqcABPdgL+H7qJguBw09o\njm6xNIrw2OocrDKsudk/okr/AwqEyPKw9WnMlQgLIKw1rODG2NvU9oR3GVGdMkUB\nZutL8VuFkERQGt6vQ2OCw0sV47VMkuYbacK/xyZFiRcrPJPb41zgbQj9XAEyLKCH\nex0SdDrx+tWUDqG8At2JHA==\n-----END CERTIFICATE-----\n";
/**
* Google Hardware Attestation Root 3
*
* Downloaded from https://developer.android.com/training/articles/security-key-attestation#root_certificate
* (third entry)
*
* Valid until 2036-11-13 @ 15:10 PST
*
* SHA256 Fingerprint
* AB:66:41:17:8A:36:E1:79:AA:0C:1C:DD:DF:9A:16:EB:45:FA:20:94:3E:2B:8C:D7:C7:C0:5C:26:CF:8B:48:7A
*/
export declare const Google_Hardware_Attestation_Root_3 = "\n-----BEGIN CERTIFICATE-----\nMIIFHDCCAwSgAwIBAgIJAMNrfES5rhgxMA0GCSqGSIb3DQEBCwUAMBsxGTAXBgNV\nBAUTEGY5MjAwOWU4NTNiNmIwNDUwHhcNMjExMTE3MjMxMDQyWhcNMzYxMTEzMjMx\nMDQyWjAbMRkwFwYDVQQFExBmOTIwMDllODUzYjZiMDQ1MIICIjANBgkqhkiG9w0B\nAQEFAAOCAg8AMIICCgKCAgEAr7bHgiuxpwHsK7Qui8xUFmOr75gvMsd/dTEDDJdS\nSxtf6An7xyqpRR90PL2abxM1dEqlXnf2tqw1Ne4Xwl5jlRfdnJLmN0pTy/4lj4/7\ntv0Sk3iiKkypnEUtR6WfMgH0QZfKHM1+di+y9TFRtv6y//0rb+T+W8a9nsNL/ggj\nnar86461qO0rOs2cXjp3kOG1FEJ5MVmFmBGtnrKpa73XpXyTqRxB/M0n1n/W9nGq\nC4FSYa04T6N5RIZGBN2z2MT5IKGbFlbC8UrW0DxW7AYImQQcHtGl/m00QLVWutHQ\noVJYnFPlXTcHYvASLu+RhhsbDmxMgJJ0mcDpvsC4PjvB+TxywElgS70vE0XmLD+O\nJtvsBslHZvPBKCOdT0MS+tgSOIfga+z1Z1g7+DVagf7quvmag8jfPioyKvxnK/Eg\nsTUVi2ghzq8wm27ud/mIM7AY2qEORR8Go3TVB4HzWQgpZrt3i5MIlCaY504LzSRi\nigHCzAPlHws+W0rB5N+er5/2pJKnfBSDiCiFAVtCLOZ7gLiMm0jhO2B6tUXHI/+M\nRPjy02i59lINMRRev56GKtcd9qO/0kUJWdZTdA2XoS82ixPvZtXQpUpuL12ab+9E\naDK8Z4RHJYYfCT3Q5vNAXaiWQ+8PTWm2QgBR/bkwSWc+NpUFgNPN9PvQi8WEg5Um\nAGMCAwEAAaNjMGEwHQYDVR0OBBYEFDZh4QB8iAUJUYtEbEf/GkzJ6k8SMB8GA1Ud\nIwQYMBaAFDZh4QB8iAUJUYtEbEf/GkzJ6k8SMA8GA1UdEwEB/wQFMAMBAf8wDgYD\nVR0PAQH/BAQDAgIEMA0GCSqGSIb3DQEBCwUAA4ICAQBTNNZe5cuf8oiq+jV0itTG\nzWVhSTjOBEk2FQvh11J3o3lna0o7rd8RFHnN00q4hi6TapFhh4qaw/iG6Xg+xOan\n63niLWIC5GOPFgPeYXM9+nBb3zZzC8ABypYuCusWCmt6Tn3+Pjbz3MTVhRGXuT/T\nQH4KGFY4PhvzAyXwdjTOCXID+aHud4RLcSySr0Fq/L+R8TWalvM1wJJPhyRjqRCJ\nerGtfBagiALzvhnmY7U1qFcS0NCnKjoO7oFedKdWlZz0YAfu3aGCJd4KHT0MsGiL\nZez9WP81xYSrKMNEsDK+zK5fVzw6jA7cxmpXcARTnmAuGUeI7VVDhDzKeVOctf3a\n0qQLwC+d0+xrETZ4r2fRGNw2YEs2W8Qj6oDcfPvq9JySe7pJ6wcHnl5EZ0lwc4xH\n7Y4Dx9RA1JlfooLMw3tOdJZH0enxPXaydfAD3YifeZpFaUzicHeLzVJLt9dvGB0b\nHQLE4+EqKFgOZv2EoP686DQqbVS1u+9k0p2xbMA105TBIk7npraa8VM0fnrRKi7w\nlZKwdH+aNAyhbXRW9xsnODJ+g8eF452zvbiKKngEKirK5LGieoXBX7tZ9D1GNBH2\nOb3bKOwwIWdEFle/YF/h6zWgdeoaNGDqVBrLr2+0DtWoiB1aDEjLWl9FmyIUyUm7\nmD/vFDkzF+wm7cyWpQpCVQ==\n-----END CERTIFICATE-----\n";
/**
* Google Hardware Attestation Root 4
*
* Downloaded from https://developer.android.com/training/articles/security-key-attestation#root_certificate
* (fourth entry)
*
* Valid until 2042-03-15 @ 11:07 PDT
*
* SHA256 Fingerprint
* CE:DB:1C:B6:DC:89:6A:E5:EC:79:73:48:BC:E9:28:67:53:C2:B3:8E:E7:1C:E0:FB:E3:4A:9A:12:48:80:0D:FC
*/
export declare const Google_Hardware_Attestation_Root_4 = "\n-----BEGIN CERTIFICATE-----\nMIIFHDCCAwSgAwIBAgIJAPHBcqaZ6vUdMA0GCSqGSIb3DQEBCwUAMBsxGTAXBgNV\nBAUTEGY5MjAwOWU4NTNiNmIwNDUwHhcNMjIwMzIwMTgwNzQ4WhcNNDIwMzE1MTgw\nNzQ4WjAbMRkwFwYDVQQFExBmOTIwMDllODUzYjZiMDQ1MIICIjANBgkqhkiG9w0B\nAQEFAAOCAg8AMIICCgKCAgEAr7bHgiuxpwHsK7Qui8xUFmOr75gvMsd/dTEDDJdS\nSxtf6An7xyqpRR90PL2abxM1dEqlXnf2tqw1Ne4Xwl5jlRfdnJLmN0pTy/4lj4/7\ntv0Sk3iiKkypnEUtR6WfMgH0QZfKHM1+di+y9TFRtv6y//0rb+T+W8a9nsNL/ggj\nnar86461qO0rOs2cXjp3kOG1FEJ5MVmFmBGtnrKpa73XpXyTqRxB/M0n1n/W9nGq\nC4FSYa04T6N5RIZGBN2z2MT5IKGbFlbC8UrW0DxW7AYImQQcHtGl/m00QLVWutHQ\noVJYnFPlXTcHYvASLu+RhhsbDmxMgJJ0mcDpvsC4PjvB+TxywElgS70vE0XmLD+O\nJtvsBslHZvPBKCOdT0MS+tgSOIfga+z1Z1g7+DVagf7quvmag8jfPioyKvxnK/Eg\nsTUVi2ghzq8wm27ud/mIM7AY2qEORR8Go3TVB4HzWQgpZrt3i5MIlCaY504LzSRi\nigHCzAPlHws+W0rB5N+er5/2pJKnfBSDiCiFAVtCLOZ7gLiMm0jhO2B6tUXHI/+M\nRPjy02i59lINMRRev56GKtcd9qO/0kUJWdZTdA2XoS82ixPvZtXQpUpuL12ab+9E\naDK8Z4RHJYYfCT3Q5vNAXaiWQ+8PTWm2QgBR/bkwSWc+NpUFgNPN9PvQi8WEg5Um\nAGMCAwEAAaNjMGEwHQYDVR0OBBYEFDZh4QB8iAUJUYtEbEf/GkzJ6k8SMB8GA1Ud\nIwQYMBaAFDZh4QB8iAUJUYtEbEf/GkzJ6k8SMA8GA1UdEwEB/wQFMAMBAf8wDgYD\nVR0PAQH/BAQDAgIEMA0GCSqGSIb3DQEBCwUAA4ICAQB8cMqTllHc8U+qCrOlg3H7\n174lmaCsbo/bJ0C17JEgMLb4kvrqsXZs01U3mB/qABg/1t5Pd5AORHARs1hhqGIC\nW/nKMav574f9rZN4PC2ZlufGXb7sIdJpGiO9ctRhiLuYuly10JccUZGEHpHSYM2G\ntkgYbZba6lsCPYAAP83cyDV+1aOkTf1RCp/lM0PKvmxYN10RYsK631jrleGdcdkx\noSK//mSQbgcWnmAEZrzHoF1/0gso1HZgIn0YLzVhLSA/iXCX4QT2h3J5z3znluKG\n1nv8NQdxei2DIIhASWfu804CA96cQKTTlaae2fweqXjdN1/v2nqOhngNyz1361mF\nmr4XmaKH/ItTwOe72NI9ZcwS1lVaCvsIkTDCEXdm9rCNPAY10iTunIHFXRh+7KPz\nlHGewCq/8TOohBRn0/NNfh7uRslOSZ/xKbN9tMBtw37Z8d2vvnXq/YWdsm1+JLVw\nn6yYD/yacNJBlwpddla8eaVMjsF6nBnIgQOf9zKSe06nSTqvgwUHosgOECZJZ1Eu\nzbH4yswbt02tKtKEFhx+v+OTge/06V+jGsqTWLsfrOCNLuA8H++z+pUENmpqnnHo\nvaI47gC+TNpkgYGkkBT6B/m/U01BuOBBTzhIlMEZq9qkDWuM2cA5kW5V3FJUcfHn\nw1IdYIg2Wxg7yHcQZemFQg==\n-----END CERTIFICATE-----\n";
//# sourceMappingURL=android-key.d.ts.map
@@ -0,0 +1,37 @@
import fs from "node:fs/promises";
import { describe, it, expect } from "vitest";
import { parseFeed } from "./index.js";
const documents = new URL("__fixtures__/Documents/", import.meta.url);
describe("parseFeed", () => {
it("(rssFeed)", async () =>
expect(
parseFeed(
await fs.readFile(
new URL("RSS_Example.xml", documents),
"utf8",
),
),
).toMatchSnapshot());
it("(atomFeed)", async () =>
expect(
parseFeed(
await fs.readFile(
new URL("Atom_Example.xml", documents),
"utf8",
),
),
).toMatchSnapshot());
it("(rdfFeed)", async () =>
expect(
parseFeed(
await fs.readFile(
new URL("RDF_Example.xml", documents),
"utf8",
),
),
).toMatchSnapshot());
});
@@ -0,0 +1,38 @@
// Kannada [kn]
import dayjs from '../index';
var locale = {
name: 'kn',
weekdays: 'ಭಾನುವಾರ_ಸೋಮವಾರ_ಮಂಗಳವಾರ_ಬುಧವಾರ_ಗುರುವಾರ_ಶುಕ್ರವಾರ_ಶನಿವಾರ'.split('_'),
months: 'ಜನವರಿ_ಫೆಬ್ರವರಿ_ಮಾರ್ಚ್_ಏಪ್ರಿಲ್_ಮೇ_ಜೂನ್_ಜುಲೈ_ಆಗಸ್ಟ್_ಸೆಪ್ಟೆಂಬರ್_ಅಕ್ಟೋಬರ್_ನವೆಂಬರ್_ಡಿಸೆಂಬರ್'.split('_'),
weekdaysShort: 'ಭಾನು_ಸೋಮ_ಮಂಗಳ_ಬುಧ_ಗುರು_ಶುಕ್ರ_ಶನಿ'.split('_'),
monthsShort: 'ಜನ_ಫೆಬ್ರ_ಮಾರ್ಚ್_ಏಪ್ರಿಲ್_ಮೇ_ಜೂನ್_ಜುಲೈ_ಆಗಸ್ಟ್_ಸೆಪ್ಟೆಂ_ಅಕ್ಟೋ_ನವೆಂ_ಡಿಸೆಂ'.split('_'),
weekdaysMin: 'ಭಾ_ಸೋ_ಮಂ_ಬು_ಗು_ಶು_ಶ'.split('_'),
ordinal: function ordinal(n) {
return n;
},
formats: {
LT: 'A h:mm',
LTS: 'A h:mm:ss',
L: 'DD/MM/YYYY',
LL: 'D MMMM YYYY',
LLL: 'D MMMM YYYY, A h:mm',
LLLL: 'dddd, D MMMM YYYY, A h:mm'
},
relativeTime: {
future: '%s ನಂತರ',
past: '%s ಹಿಂದೆ',
s: 'ಕೆಲವು ಕ್ಷಣಗಳು',
m: 'ಒಂದು ನಿಮಿಷ',
mm: '%d ನಿಮಿಷ',
h: 'ಒಂದು ಗಂಟೆ',
hh: '%d ಗಂಟೆ',
d: 'ಒಂದು ದಿನ',
dd: '%d ದಿನ',
M: 'ಒಂದು ತಿಂಗಳು',
MM: '%d ತಿಂಗಳು',
y: 'ಒಂದು ವರ್ಷ',
yy: '%d ವರ್ಷ'
}
};
dayjs.locale(locale, null, true);
export default locale;
@@ -0,0 +1,235 @@
// Imported from DefinitelyTyped project.
// TypeScript definitions for ansi-colors
// Definitions by: Rogier Schouten <https://github.com/rogierschouten>
// Integrated by: Jordan Mele <https://github.com/Silic0nS0ldier>
interface SymbolsType {
/**
* `undefined` on windows, `✘` on other platforms.
*/
ballotCross?: "✘";
ballotDisabled: "☒";
ballotOff: "☐";
ballotOn: "☑";
bullet: "•";
bulletWhite: "◦";
/**
* `√` on windows, `✔` on other platforms.
*/
check: "√" | "✔";
/**
* `×` on windows, `✖` on other platforms.
*/
cross: "×" | "✖";
/**
* `...` on windows, `⋯` on other platforms.
*/
ellipsisLarge: "..." | "⋯";
/**
* `...` on windows, `…` on other platforms.
*/
ellipsis: "..." | "…";
fullBlock: "█";
heart: "❤";
identicalTo: "≡";
info: "i" | "ℹ";
line: "─";
mark: "※";
middot: "·";
minus: "-";
multiplication: "×";
obelus: "÷";
pencilDownRight: "✎";
pencilRight: "✏";
pencilUpRight: "✐";
percent: "%";
pilcrow2: "❡";
pilcrow: "¶";
plusMinus: "±";
/**
* `>` on windows, `▸` on linux, and `❯` on other platforms.
*/
pointer: ">" | "▸" | "❯";
/**
* `»` on windows, `‣` on linux, and `›` on other platforms.
*/
pointerSmall: "»" | "‣" | "›";
question: "?";
/**
* `undefined` on windows, `?` on other platforms.
*/
questionFull?: "?";
/**
* `?` on windows, `﹖` on other platforms.
*/
questionSmall: "?" | "﹖";
/**
* `( )` on windows, `◯` on other platforms.
*/
radioOff: "( )" | "◯";
/**
* `(*)` on windows, `◉` on other platforms.
*/
radioOn: "(*)" | "◉";
section: "§";
starsOff: "☆";
starsOn: "★";
upDownArrow: "↕";
/**
* `‼` on windows, `⚠` on other platforms.
*/
warning: "‼" | "⚠";
}
type StyleArrayStructure = [number, number];
interface StyleArrayProperties {
open: string;
close: string;
closeRe: string;
}
type StyleType = StyleArrayStructure & StyleArrayProperties;
interface StylesType<T> {
// modifiers
reset: T;
bold: T;
dim: T;
italic: T;
underline: T;
inverse: T;
hidden: T;
strikethrough: T;
// colors
black: T;
red: T;
green: T;
yellow: T;
blue: T;
magenta: T;
cyan: T;
white: T;
gray: T;
grey: T;
// bright colors
blackBright: T;
redBright: T;
greenBright: T;
yellowBright: T;
blueBright: T;
magentaBright: T;
cyanBright: T;
whiteBright: T;
// background colors
bgBlack: T;
bgRed: T;
bgGreen: T;
bgYellow: T;
bgBlue: T;
bgMagenta: T;
bgCyan: T;
bgWhite: T;
// bright background colors
bgBlackBright: T;
bgRedBright: T;
bgGreenBright: T;
bgYellowBright: T;
bgBlueBright: T;
bgMagentaBright: T;
bgCyanBright: T;
bgWhiteBright: T;
}
declare namespace ansiColors {
interface StyleFunction extends StylesType<StyleFunction> {
(s: string): string;
}
// modifiers
const reset: StyleFunction;
const bold: StyleFunction;
const dim: StyleFunction;
const italic: StyleFunction;
const underline: StyleFunction;
const inverse: StyleFunction;
const hidden: StyleFunction;
const strikethrough: StyleFunction;
// colors
const black: StyleFunction;
const red: StyleFunction;
const green: StyleFunction;
const yellow: StyleFunction;
const blue: StyleFunction;
const magenta: StyleFunction;
const cyan: StyleFunction;
const white: StyleFunction;
const gray: StyleFunction;
const grey: StyleFunction;
// bright colors
const blackBright: StyleFunction;
const redBright: StyleFunction;
const greenBright: StyleFunction;
const yellowBright: StyleFunction;
const blueBright: StyleFunction;
const magentaBright: StyleFunction;
const cyanBright: StyleFunction;
const whiteBright: StyleFunction;
// background colors
const bgBlack: StyleFunction;
const bgRed: StyleFunction;
const bgGreen: StyleFunction;
const bgYellow: StyleFunction;
const bgBlue: StyleFunction;
const bgMagenta: StyleFunction;
const bgCyan: StyleFunction;
const bgWhite: StyleFunction;
// bright background colors
const bgBlackBright: StyleFunction;
const bgRedBright: StyleFunction;
const bgGreenBright: StyleFunction;
const bgYellowBright: StyleFunction;
const bgBlueBright: StyleFunction;
const bgMagentaBright: StyleFunction;
const bgCyanBright: StyleFunction;
const bgWhiteBright: StyleFunction;
let enabled: boolean;
let visible: boolean;
const ansiRegex: RegExp;
/**
* Remove styles from string
*/
function stripColor(s: string): string;
/**
* Remove styles from string
*/
function strip(s: string): string;
/**
* Remove styles from string
*/
function unstyle(s: string): string;
const styles: StylesType<StyleType>;
const symbols: SymbolsType;
/**
* Outputs a string with check-symbol as prefix
*/
function ok(...args: string[]): string;
function create(): typeof ansiColors;
}
export = ansiColors;
@@ -0,0 +1,24 @@
const { join, resolve } = require('path');
const { readdir, stat } = require('fs');
const { promisify } = require('util');
const toStats = promisify(stat);
const toRead = promisify(readdir);
async function totalist(dir, callback, pre='') {
dir = resolve('.', dir);
await toRead(dir).then(arr => {
return Promise.all(
arr.map(str => {
let abs = join(dir, str);
return toStats(abs).then(stats => {
return stats.isDirectory()
? totalist(abs, callback, join(pre, str))
: callback(join(pre, str), abs, stats)
});
})
);
});
}
exports.totalist = totalist;
@@ -0,0 +1 @@
{"name":"parseurl","version":"1.3.3","requiresBuild":false,"files":{"package.json":{"checkedAt":1794532089661,"integrity":"sha512-W+W6jhctKI/Y9m3Tr8+uddn0jX/tNki8NLSQH8w/bsylmrfWpz/aKY260zo3LXTAg2lukWnmpkhee8SxZvrjGA==","mode":420,"size":1180},"HISTORY.md":{"checkedAt":1794532089661,"integrity":"sha512-pErRoZOSTnIBAGQiy5lSVHhKwvUiNzPdAMmgcZAoOYIkcScfj6v5HXxynQ1RxEHHPDHbrMsc0ADOmTT8U19nHQ==","mode":420,"size":1043},"index.js":{"checkedAt":1794532089661,"integrity":"sha512-9Q2JuQhQeT51kZwZAkqfH9J5KWKLycEh1oX3PFRyx1bIJg8BASaVUO5HCNNwGGRywBuoCnbpIg0c52P0NyWELg==","mode":420,"size":2809},"LICENSE":{"checkedAt":1794532089661,"integrity":"sha512-1WgrYTNxE+YHKhqzqqKI0EYky0o+n0b9wCaaRmF/RxvmIFZd5qgGO8P3m18xRkhVBUWATubFv8pVyYnrvrc2Ww==","mode":420,"size":1173},"README.md":{"checkedAt":1794532089661,"integrity":"sha512-Tjps7HcJswGPvfog/amSd7xgngatRaYpJlIif5dRrxvdHODYc8Ol1UfgffT+XQJw8FrC8yiVRxrdwdVwxQ4wqg==","mode":420,"size":4094}}}
@@ -0,0 +1 @@
{"name":"vinyl","version":"1.2.0","requiresBuild":false,"files":{"package.json":{"checkedAt":1794532118662,"integrity":"sha512-N9yBMpeqCEZ2DYZM40lV23VQkq/BfhM6Dw6ZVlEN7yAAlQFFB28xEP+f9Cs50hNP4kfPn/eAae/Y8ey99r1oWw==","mode":420,"size":1203},"README.md":{"checkedAt":1794532118663,"integrity":"sha512-u1VzQ9R86vZtXrlhel+tFkVCER7m67GH69mGmuHY+pNr6rhFEhu1p2DjXn2rUnYYGOy8DOZ14MStAtGovUleQA==","mode":420,"size":6769},"LICENSE":{"checkedAt":1794532118663,"integrity":"sha512-HBBAzAeA1yn/Qw4TxCyvtBI2rYksHL0VFngASxMpI5Hr0zkoVIdIIkuR4cvHMdU0JPIpN8OBSivcgBpfw7UI+g==","mode":420,"size":1078},"index.js":{"checkedAt":1794532118663,"integrity":"sha512-bHW+Axhz2fKRpE6xzXRNcmrQjWqkhYUXlk9oKsX+k2xTeumBzZR6t/Evlx6W7xnQBAj31IPxg9xUF5Ioi2FN6Q==","mode":420,"size":6482},"CHANGELOG.md":{"checkedAt":1794532118663,"integrity":"sha512-enzlnM5qdw60RnFO9Tl+ANEBF17SWgIJfdY/fq8tGln14od+FPnqTHDoGxh3yoHhotI+p/NGusmyNcMol5b79g==","mode":420,"size":16065},"lib/cloneBuffer.js":{"checkedAt":1794532118663,"integrity":"sha512-EVI81ESpmPBND7rCKxJHM5WPRUCc5qWdUn0VjKxO2JLpDUCZaylpw+WkKyC4kc3blDsRcHgr0ZmSjx3GEr1gSg==","mode":420,"size":143},"lib/inspectStream.js":{"checkedAt":1794532118663,"integrity":"sha512-+11Yx3le/ajMCU+m4226DofUtdTAiTTO1pWegmwn+BlqI7IXmDfTjEESiH4RepiNwFl/+x7cWxIV2zeL8BCd9w==","mode":420,"size":288},"lib/isBuffer.js":{"checkedAt":1794532118663,"integrity":"sha512-r8zWiOT3Md8gG7OgmykI1szdedzOH/IWFAro21sCfPU56k7Rqk6qzw8YxvPi9roYxkcm4Ru9jCTOFiGcaepyCw==","mode":420,"size":52},"lib/isNull.js":{"checkedAt":1794532118663,"integrity":"sha512-hvnG70JZ84mBvPks6UAkhMEBkE7OTIsp341S81OeK3HzIn+IH/WuAoPfjLRJT4EXny3W7JPkv2a8y5oIjOvIjA==","mode":420,"size":55},"lib/isStream.js":{"checkedAt":1794532118664,"integrity":"sha512-ADFZiwa2M8dwuWBaWyvcivFV7FD6nffxgGGPAsI8L+muBg+xjkZXrQuI+yNpnzq8WjjFvXtam0S4fTzxP0UT8A==","mode":420,"size":111}}}
@@ -0,0 +1,74 @@
# signal-exit
When you want to fire an event no matter how a process exits:
- reaching the end of execution.
- explicitly having `process.exit(code)` called.
- having `process.kill(pid, sig)` called.
- receiving a fatal signal from outside the process
Use `signal-exit`.
```js
// Hybrid module, either works
import { onExit } from 'signal-exit'
// or:
// const { onExit } = require('signal-exit')
onExit((code, signal) => {
console.log('process exited!', code, signal)
})
```
## API
`remove = onExit((code, signal) => {}, options)`
The return value of the function is a function that will remove
the handler.
Note that the function _only_ fires for signals if the signal
would cause the process to exit. That is, there are no other
listeners, and it is a fatal signal.
If the global `process` object is not suitable for this purpose
(ie, it's unset, or doesn't have an `emit` method, etc.) then the
`onExit` function is a no-op that returns a no-op `remove` method.
### Options
- `alwaysLast`: Run this handler after any other signal or exit
handlers. This causes `process.emit` to be monkeypatched.
### Capturing Signal Exits
If the handler returns an exact boolean `true`, and the exit is a
due to signal, then the signal will be considered handled, and
will _not_ trigger a synthetic `process.kill(process.pid,
signal)` after firing the `onExit` handlers.
In this case, it your responsibility as the caller to exit with a
signal (for example, by calling `process.kill()`) if you wish to
preserve the same exit status that would otherwise have occurred.
If you do not, then the process will likely exit gracefully with
status 0 at some point, assuming that no other terminating signal
or other exit trigger occurs.
Prior to calling handlers, the `onExit` machinery is unloaded, so
any subsequent exits or signals will not be handled, even if the
signal is captured and the exit is thus prevented.
Note that numeric code exits may indicate that the process is
already committed to exiting, for example due to a fatal
exception or unhandled promise rejection, and so there is no way to
prevent it safely.
### Browser Fallback
The `'signal-exit/browser'` module is the same fallback shim that
just doesn't do anything, but presents the same function
interface.
Patches welcome to add something that hooks onto
`window.onbeforeunload` or similar, but it might just not be a
thing that makes sense there.
@@ -0,0 +1 @@
module.exports={C:{"3":0.00469,"101":0.00469,"115":0.03754,"125":0.03284,"130":0.00469,"133":0.00469,"142":0.00938,"143":1.173,"144":0.28152,_:"2 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 102 103 104 105 106 107 108 109 110 111 112 113 114 116 117 118 119 120 121 122 123 124 126 127 128 129 131 132 134 135 136 137 138 139 140 141 145 146 147 3.5 3.6"},D:{"39":0.00469,"40":0.00469,"41":0.00469,"42":0.00469,"43":0.00938,"44":0.00469,"45":0.00469,"46":0.00469,"47":0.00469,"48":0.03754,"49":0.00469,"50":0.00469,"51":0.00469,"52":0.00469,"53":0.00938,"54":0.00469,"55":0.00469,"56":0.00469,"57":0.00469,"58":0.00469,"59":0.00469,"60":0.00469,"70":0.00469,"71":0.00469,"73":0.00469,"79":0.00469,"83":0.00469,"86":0.1173,"90":0.00938,"91":0.01408,"97":0.00469,"98":0.00469,"99":0.00469,"102":0.00938,"103":0.00469,"104":0.09384,"105":0.01408,"108":0.00469,"109":0.31436,"111":0.01408,"114":0.02815,"115":0.00469,"116":0.00938,"119":0.00469,"120":0.01408,"121":0.00938,"122":0.00938,"123":0.00469,"124":0.04223,"125":23.90574,"126":0.02346,"127":0.00938,"128":0.01408,"129":0.00469,"130":0.03284,"131":0.08915,"132":0.02346,"133":0.02815,"134":1.23869,"135":0.03284,"136":0.06569,"137":0.04223,"138":0.21583,"139":0.15014,"140":2.22401,"141":6.57818,"142":0.04223,"143":0.00469,_:"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 61 62 63 64 65 66 67 68 69 72 74 75 76 77 78 80 81 84 85 87 88 89 92 93 94 95 96 100 101 106 107 110 112 113 117 118 144 145"},F:{"92":0.01408,"117":0.00469,"120":0.01877,"121":0.00469,"122":0.14545,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 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 109 110 111 112 113 114 115 116 118 119 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"17":0.00469,"18":0.01408,"92":0.01408,"109":0.01877,"110":0.00469,"114":0.02346,"117":0.02815,"129":0.00469,"131":0.00938,"133":0.00469,"134":0.00469,"135":0.00469,"136":0.00469,"138":0.00469,"139":0.01877,"140":0.28152,"141":1.24338,_:"12 13 14 15 16 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 111 112 113 115 116 118 119 120 121 122 123 124 125 126 127 128 130 132 137 142"},E:{"4":0.00469,_:"0 5 6 7 8 9 10 11 12 13 14 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 11.1 12.1 15.1 15.2-15.3 15.4 15.5 16.0 16.1 16.3 16.4 17.0 17.2 18.1 26.2","13.1":0.00469,"14.1":0.00469,"15.6":0.01877,"16.2":0.00469,"16.5":0.00469,"16.6":0.03284,"17.1":0.00469,"17.3":0.00469,"17.4":0.00469,"17.5":0.00938,"17.6":0.02815,"18.0":0.00469,"18.2":0.00938,"18.3":0.01408,"18.4":0.01408,"18.5-18.6":0.02815,"26.0":0.32375,"26.1":0.00469},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00117,"5.0-5.1":0,"6.0-6.1":0.00468,"7.0-7.1":0.00351,"8.1-8.4":0,"9.0-9.2":0,"9.3":0.01052,"10.0-10.2":0.00117,"10.3":0.01988,"11.0-11.2":0.29468,"11.3-11.4":0.00702,"12.0-12.1":0.00234,"12.2-12.5":0.0573,"13.0-13.1":0,"13.2":0.00585,"13.3":0.00234,"13.4-13.7":0.00935,"14.0-14.4":0.01988,"14.5-14.8":0.02105,"15.0-15.1":0.01988,"15.2-15.3":0.0152,"15.4":0.01754,"15.5":0.01988,"15.6-15.8":0.2596,"16.0":0.03508,"16.1":0.06548,"16.2":0.03391,"16.3":0.06081,"16.4":0.0152,"16.5":0.0269,"16.6-16.7":0.3473,"17.0":0.02456,"17.1":0.03742,"17.2":0.0269,"17.3":0.03976,"17.4":0.07016,"17.5":0.12044,"17.6-17.7":0.30403,"18.0":0.06899,"18.1":0.14266,"18.2":0.07718,"18.3":0.2479,"18.4":0.12746,"18.5-18.6":6.49926,"26.0":0.80335,"26.1":0.02923},P:{"4":0.03079,"20":0.01026,"21":0.02052,"22":0.05131,"23":0.04105,"24":0.01026,"25":0.06157,"26":0.06157,"27":0.14367,"28":1.42644,"29":0.09236,_:"5.0-5.4 6.2-6.4 8.2 9.2 10.1 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0","7.2-7.4":0.04105,"11.1-11.2":0.01026},I:{"0":0.0265,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.00001,"4.4":0,"4.4.3-4.4.4":0.00001},K:{"0":0.27071,_:"10 11 12 11.1 11.5 12.1"},A:{"8":0.11797,"9":0.01475,"10":0.04424,"11":0.02949,_:"6 7 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{"0":0.12739},Q:{"14.9":0.02654},O:{"0":0.84928},H:{"0":0},L:{"0":44.08607}};
@@ -0,0 +1,179 @@
/**
* @fileoverview Rule to enforce consistent naming of "this" context variables
* @author Raphael Pigulla
*/
"use strict";
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "suggestion",
docs: {
description:
"Enforce consistent naming when capturing the current execution context",
recommended: false,
frozen: true,
url: "https://eslint.org/docs/latest/rules/consistent-this",
},
schema: {
type: "array",
items: {
type: "string",
minLength: 1,
},
uniqueItems: true,
},
defaultOptions: ["that"],
messages: {
aliasNotAssignedToThis:
"Designated alias '{{name}}' is not assigned to 'this'.",
unexpectedAlias: "Unexpected alias '{{name}}' for 'this'.",
},
},
create(context) {
const aliases = context.options;
const sourceCode = context.sourceCode;
/**
* Reports that a variable declarator or assignment expression is assigning
* a non-'this' value to the specified alias.
* @param {ASTNode} node The assigning node.
* @param {string} name the name of the alias that was incorrectly used.
* @returns {void}
*/
function reportBadAssignment(node, name) {
context.report({
node,
messageId: "aliasNotAssignedToThis",
data: { name },
});
}
/**
* Checks that an assignment to an identifier only assigns 'this' to the
* appropriate alias, and the alias is only assigned to 'this'.
* @param {ASTNode} node The assigning node.
* @param {Identifier} name The name of the variable assigned to.
* @param {Expression} value The value of the assignment.
* @returns {void}
*/
function checkAssignment(node, name, value) {
const isThis = value.type === "ThisExpression";
if (aliases.includes(name)) {
if (!isThis || (node.operator && node.operator !== "=")) {
reportBadAssignment(node, name);
}
} else if (isThis) {
context.report({
node,
messageId: "unexpectedAlias",
data: { name },
});
}
}
/**
* Ensures that a variable declaration of the alias in a program or function
* is assigned to the correct value.
* @param {string} alias alias the check the assignment of.
* @param {Object} scope scope of the current code we are checking.
* @private
* @returns {void}
*/
function checkWasAssigned(alias, scope) {
const variable = scope.set.get(alias);
if (!variable) {
return;
}
if (
variable.defs.some(
def =>
def.node.type === "VariableDeclarator" &&
def.node.init !== null,
)
) {
return;
}
/*
* The alias has been declared and not assigned: check it was
* assigned later in the same scope.
*/
if (
!variable.references.some(reference => {
const write = reference.writeExpr;
return (
reference.from === scope &&
write &&
write.type === "ThisExpression" &&
write.parent.operator === "="
);
})
) {
variable.defs
.map(def => def.node)
.forEach(node => {
reportBadAssignment(node, alias);
});
}
}
/**
* Check each alias to ensure that is was assigned to the correct value.
* @param {ASTNode} node The node that represents the scope to check.
* @returns {void}
*/
function ensureWasAssigned(node) {
const scope = sourceCode.getScope(node);
// if this is program scope we also need to check module scope
const extraScope =
node.type === "Program" && node.sourceType === "module"
? scope.childScopes[0]
: null;
aliases.forEach(alias => {
checkWasAssigned(alias, scope);
if (extraScope) {
checkWasAssigned(alias, extraScope);
}
});
}
return {
"Program:exit": ensureWasAssigned,
"FunctionExpression:exit": ensureWasAssigned,
"FunctionDeclaration:exit": ensureWasAssigned,
VariableDeclarator(node) {
const id = node.id;
const isDestructuring =
id.type === "ArrayPattern" || id.type === "ObjectPattern";
if (node.init !== null && !isDestructuring) {
checkAssignment(node, id.name, node.init);
}
},
AssignmentExpression(node) {
if (node.left.type === "Identifier") {
checkAssignment(node, node.left.name, node.right);
}
},
};
},
};
@@ -0,0 +1,6 @@
import { CreateType } from '../create/type.mjs';
import { Kind } from '../symbols/index.mjs';
/** `[JavaScript]` Creates a Promise type */
export function Promise(item, options) {
return CreateType({ [Kind]: 'Promise', type: 'Promise', item }, options);
}
@@ -0,0 +1,9 @@
import { _ as _array_with_holes } from "./_array_with_holes.js";
import { _ as _iterable_to_array } from "./_iterable_to_array.js";
import { _ as _non_iterable_rest } from "./_non_iterable_rest.js";
import { _ as _unsupported_iterable_to_array } from "./_unsupported_iterable_to_array.js";
function _to_array(arr) {
return _array_with_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_rest();
}
export { _to_array as _ };
@@ -0,0 +1,8 @@
"use client";
import {
breadcrumb_item_default
} from "./chunk-W2E7RG4O.mjs";
import "./chunk-QRIBVF72.mjs";
export {
breadcrumb_item_default as default
};
@@ -0,0 +1,37 @@
var baseCreate = require('./_baseCreate'),
isObject = require('./isObject');
/**
* Creates a function that produces an instance of `Ctor` regardless of
* whether it was invoked as part of a `new` expression or by `call` or `apply`.
*
* @private
* @param {Function} Ctor The constructor to wrap.
* @returns {Function} Returns the new wrapped function.
*/
function createCtor(Ctor) {
return function() {
// Use a `switch` statement to work with class constructors. See
// http://ecma-international.org/ecma-262/7.0/#sec-ecmascript-function-objects-call-thisargument-argumentslist
// for more details.
var args = arguments;
switch (args.length) {
case 0: return new Ctor;
case 1: return new Ctor(args[0]);
case 2: return new Ctor(args[0], args[1]);
case 3: return new Ctor(args[0], args[1], args[2]);
case 4: return new Ctor(args[0], args[1], args[2], args[3]);
case 5: return new Ctor(args[0], args[1], args[2], args[3], args[4]);
case 6: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
case 7: return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
}
var thisBinding = baseCreate(Ctor.prototype),
result = Ctor.apply(thisBinding, args);
// Mimic the constructor's `return` behavior.
// See https://es5.github.io/#x13.2.2 for more details.
return isObject(result) ? result : thisBinding;
};
}
module.exports = createCtor;
@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"uBACa,OAAO,gBAAgB,EAAE,QAAQ;yBACjC,OAAO,gBAAgB,EAAE,UAAU;uBACnC,OAAO,gBAAgB,EAAE,QAAQ;kBACjC,OAAO,gBAAgB,EAAE,GAAG;kBAC5B,OAAO,gBAAgB,EAAE,GAAG"}
@@ -0,0 +1,36 @@
import arrayReduceRight from './_arrayReduceRight.js';
import baseEachRight from './_baseEachRight.js';
import baseIteratee from './_baseIteratee.js';
import baseReduce from './_baseReduce.js';
import isArray from './isArray.js';
/**
* This method is like `_.reduce` except that it iterates over elements of
* `collection` from right to left.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Collection
* @param {Array|Object} collection The collection to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @param {*} [accumulator] The initial value.
* @returns {*} Returns the accumulated value.
* @see _.reduce
* @example
*
* var array = [[0, 1], [2, 3], [4, 5]];
*
* _.reduceRight(array, function(flattened, other) {
* return flattened.concat(other);
* }, []);
* // => [4, 5, 2, 3, 0, 1]
*/
function reduceRight(collection, iteratee, accumulator) {
var func = isArray(collection) ? arrayReduceRight : baseReduce,
initAccum = arguments.length < 3;
return func(collection, baseIteratee(iteratee, 4), accumulator, initAccum, baseEachRight);
}
export default reduceRight;
@@ -0,0 +1 @@
{"mappings":";;;;;;;;;;;;AAEO,SAAS,0CAAiB,EAAkB;IACjD,IAAI,OAAO,0CAA2B,CAAA,GAAA,sCAAe,EAAE;IACvD,IAAI,SAAS,IAAI;QACf,IAAI,MACF,0CAAoB,MAAM;QAE5B,IAAI,IACF,0CAAqB,IAAI;IAE7B;AACF;AAEO,SAAS,0CAAoB,IAAa,EAAE,EAAkB;IACnE,KAAK,aAAa,CAAC,IAAI,WAAW,QAAQ;QAAC,eAAe;IAAE;IAC5D,KAAK,aAAa,CAAC,IAAI,WAAW,YAAY;QAAC,SAAS;QAAM,eAAe;IAAE;AACjF;AAEO,SAAS,0CAAqB,EAAW,EAAE,IAAoB;IACpE,GAAG,aAAa,CAAC,IAAI,WAAW,SAAS;QAAC,eAAe;IAAI;IAC7D,GAAG,aAAa,CAAC,IAAI,WAAW,WAAW;QAAC,SAAS;QAAM,eAAe;IAAI;AAChF;AAEO,SAAS,0CAA2B,QAAkB;IAC3D,IAAI,gBAAgB,CAAA,GAAA,sCAAe,EAAE;IACrC,IAAI,mBAAmB,0BAAA,oCAAA,cAAe,YAAY,CAAC;IACnD,IAAI,kBACF,OAAO,SAAS,cAAc,CAAC,qBAAqB;IAGtD,OAAO;AACT","sources":["packages/@react-aria/focus/src/virtualFocus.ts"],"sourcesContent":["import {getActiveElement, getOwnerDocument} from '@react-aria/utils';\n\nexport function moveVirtualFocus(to: Element | null): void {\n let from = getVirtuallyFocusedElement(getOwnerDocument(to));\n if (from !== to) {\n if (from) {\n dispatchVirtualBlur(from, to);\n }\n if (to) {\n dispatchVirtualFocus(to, from);\n }\n }\n}\n\nexport function dispatchVirtualBlur(from: Element, to: Element | null): void {\n from.dispatchEvent(new FocusEvent('blur', {relatedTarget: to}));\n from.dispatchEvent(new FocusEvent('focusout', {bubbles: true, relatedTarget: to}));\n}\n\nexport function dispatchVirtualFocus(to: Element, from: Element | null): void {\n to.dispatchEvent(new FocusEvent('focus', {relatedTarget: from}));\n to.dispatchEvent(new FocusEvent('focusin', {bubbles: true, relatedTarget: from}));\n}\n\nexport function getVirtuallyFocusedElement(document: Document): Element | null {\n let activeElement = getActiveElement(document);\n let activeDescendant = activeElement?.getAttribute('aria-activedescendant');\n if (activeDescendant) {\n return document.getElementById(activeDescendant) || activeElement;\n }\n\n return activeElement;\n}\n"],"names":[],"version":3,"file":"virtualFocus.main.js.map"}
@@ -0,0 +1,74 @@
'use strict';
var test = require('tape');
var typedArrayLength = require('../');
var isCallable = require('is-callable');
var generators = require('make-generator-function')();
var arrowFn = require('make-arrow-function')();
var forEach = require('for-each');
var inspect = require('object-inspect');
var typedArrayNames = require('possible-typed-array-names');
test('not arrays', function (t) {
t.test('non-number/string primitives', function (st) {
// @ts-expect-error
st.equal(false, typedArrayLength(), 'undefined is not typed array');
st.equal(false, typedArrayLength(null), 'null is not typed array');
st.equal(false, typedArrayLength(false), 'false is not typed array');
st.equal(false, typedArrayLength(true), 'true is not typed array');
st.end();
});
t.equal(false, typedArrayLength({}), 'object is not typed array');
t.equal(false, typedArrayLength(/a/g), 'regex literal is not typed array');
t.equal(false, typedArrayLength(new RegExp('a', 'g')), 'regex object is not typed array');
t.equal(false, typedArrayLength(new Date()), 'new Date() is not typed array');
t.test('numbers', function (st) {
st.equal(false, typedArrayLength(42), 'number is not typed array');
st.equal(false, typedArrayLength(Object(42)), 'number object is not typed array');
st.equal(false, typedArrayLength(NaN), 'NaN is not typed array');
st.equal(false, typedArrayLength(Infinity), 'Infinity is not typed array');
st.end();
});
t.test('strings', function (st) {
st.equal(false, typedArrayLength('foo'), 'string primitive is not typed array');
st.equal(false, typedArrayLength(Object('foo')), 'string object is not typed array');
st.end();
});
t.end();
});
test('Functions', function (t) {
t.equal(false, typedArrayLength(function () {}), 'function is not typed array');
t.end();
});
test('Generators', { skip: generators.length === 0 }, function (t) {
forEach(generators, function (genFn) {
t.equal(false, typedArrayLength(genFn), 'generator function ' + inspect(genFn) + ' is not typed array');
});
t.end();
});
test('Arrow functions', { skip: !arrowFn }, function (t) {
t.equal(false, typedArrayLength(arrowFn), 'arrow function is not typed array');
t.end();
});
test('Typed Arrays', function (t) {
forEach(typedArrayNames, function (typedArray) {
/** @type {Int8ArrayConstructor | Uint8ArrayConstructor | Uint8ClampedArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Int32ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor | Float64ArrayConstructor | BigInt64ArrayConstructor | BigUint64ArrayConstructor} */
var TypedArray = global[typedArray];
if (isCallable(TypedArray)) {
var length = 10;
var arr = new TypedArray(length);
t.equal(typedArrayLength(arr), length, 'new ' + typedArray + '(10) is typed array of length ' + length);
} else {
t.comment('# SKIP ' + typedArray + ' is not supported');
}
});
t.end();
});
@@ -0,0 +1,59 @@
import { isValidMotionProp } from '../../../motion/utils/valid-prop.mjs';
let shouldForward = (key) => !isValidMotionProp(key);
function loadExternalIsValidProp(isValidProp) {
if (typeof isValidProp !== "function")
return;
// Explicitly filter our events
shouldForward = (key) => key.startsWith("on") ? !isValidMotionProp(key) : isValidProp(key);
}
/**
* Emotion and Styled Components both allow users to pass through arbitrary props to their components
* to dynamically generate CSS. They both use the `@emotion/is-prop-valid` package to determine which
* of these should be passed to the underlying DOM node.
*
* However, when styling a Motion component `styled(motion.div)`, both packages pass through *all* props
* as it's seen as an arbitrary component rather than a DOM node. Motion only allows arbitrary props
* passed through the `custom` prop so it doesn't *need* the payload or computational overhead of
* `@emotion/is-prop-valid`, however to fix this problem we need to use it.
*
* By making it an optionalDependency we can offer this functionality only in the situations where it's
* actually required.
*/
try {
/**
* We attempt to import this package but require won't be defined in esm environments, in that case
* isPropValid will have to be provided via `MotionContext`. In a 6.0.0 this should probably be removed
* in favour of explicit injection.
*/
loadExternalIsValidProp(require("@emotion/is-prop-valid").default);
}
catch {
// We don't need to actually do anything here - the fallback is the existing `isPropValid`.
}
function filterProps(props, isDom, forwardMotionProps) {
const filteredProps = {};
for (const key in props) {
/**
* values is considered a valid prop by Emotion, so if it's present
* this will be rendered out to the DOM unless explicitly filtered.
*
* We check the type as it could be used with the `feColorMatrix`
* element, which we support.
*/
if (key === "values" && typeof props.values === "object")
continue;
if (shouldForward(key) ||
(forwardMotionProps === true && isValidMotionProp(key)) ||
(!isDom && !isValidMotionProp(key)) ||
// If trying to use native HTML drag events, forward drag listeners
(props["draggable"] &&
key.startsWith("onDrag"))) {
filteredProps[key] =
props[key];
}
}
return filteredProps;
}
export { filterProps, loadExternalIsValidProp };
@@ -0,0 +1,46 @@
/**
* @author Toru Nagashima <https://github.com/mysticatea>
* See LICENSE file in root directory for full license.
*/
"use strict"
const { READ, ReferenceTracker } = require("@eslint-community/eslint-utils")
const { getSourceCode } = require("eslint-compat-utils")
module.exports = {
meta: {
docs: {
description: "disallow the `Object.assign` method.",
category: "ES2015",
recommended: false,
url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-object-assign.html",
},
fixable: null,
messages: {
forbidden: "ES2015 '{{name}}' method is forbidden.",
},
schema: [],
type: "problem",
},
create(context) {
return {
"Program:exit"(program) {
const sourceCode = getSourceCode(context)
const tracker = new ReferenceTracker(
sourceCode.getScope(program),
)
for (const { node, path } of tracker.iterateGlobalReferences({
Object: {
assign: { [READ]: true },
},
})) {
context.report({
node,
messageId: "forbidden",
data: { name: path.join(".") },
})
}
},
}
},
}
@@ -0,0 +1,18 @@
/**
* Converts `set` to its value-value pairs.
*
* @private
* @param {Object} set The set to convert.
* @returns {Array} Returns the value-value pairs.
*/
function setToPairs(set) {
var index = -1,
result = Array(set.size);
set.forEach(function(value) {
result[++index] = [value, value];
});
return result;
}
export default setToPairs;
@@ -0,0 +1,123 @@
const whiteSpaces = [" ", "\n", "\t"];
class StringSource{
constructor(str){
this.line = 1;
this.cols = 0;
this.buffer = str;
//a boundary pointer to indicate where from the buffer dat should be read
// data before this pointer can be deleted to free the memory
this.startIndex = 0;
}
readCh() {
return this.buffer[this.startIndex++];
}
readChAt(index) {
return this.buffer[this.startIndex+index];
}
readStr(n,from){
if(typeof from === "undefined") from = this.startIndex;
return this.buffer.substring(from, from + n);
}
readUpto(stopStr) {
const inputLength = this.buffer.length;
const stopLength = stopStr.length;
for (let i = this.startIndex; i < inputLength; i++) {
let match = true;
for (let j = 0; j < stopLength; j++) {
if (this.buffer[i + j] !== stopStr[j]) {
match = false;
break;
}
}
if (match) {
const result = this.buffer.substring(this.startIndex, i);
this.startIndex = i + stopLength;
return result;
}
}
throw new Error(`Unexpected end of source. Reading '${stopStr}'`);
}
readUptoCloseTag(stopStr) { //stopStr: "</tagname"
const inputLength = this.buffer.length;
const stopLength = stopStr.length;
let stopIndex = 0;
//0: non-matching, 1: matching stop string, 2: matching closing
let match = 0;
for (let i = this.startIndex; i < inputLength; i++) {
if(match === 1){//initial part matched
if(stopIndex === 0) stopIndex = i;
if(this.buffer[i] === ' ' || this.buffer[i] === '\t') continue;
else if(this.buffer[i] === '>'){
match = 2;
//tag boundary found
// this.startIndex
}
}else{
match = 1;
for (let j = 0; j < stopLength; j++) {
if (this.buffer[i + j] !== stopStr[j]) {
match = 0;
break;
}
}
}
if (match === 2) {//matched closing part
const result = this.buffer.substring(this.startIndex, stopIndex - 1 );
this.startIndex = i + 1;
return result;
}
}
throw new Error(`Unexpected end of source. Reading '${stopStr}'`);
}
readFromBuffer(n, updateIndex){
let ch;
if(n===1){
ch = this.buffer[this.startIndex];
// if(ch === "\n") {
// this.line++;
// this.cols = 1;
// }else{
// this.cols++;
// }
}else{
ch = this.buffer.substring(this.startIndex, this.startIndex + n);
// if("".indexOf("\n") !== -1){
// //TODO: handle the scenario when there are multiple lines
// //TODO: col should be set to number of chars after last '\n'
// // this.cols = 1;
// }else{
// this.cols += n;
// }
}
if(updateIndex) this.updateBufferBoundary(n);
return ch;
}
//TODO: rename to updateBufferReadIndex
updateBufferBoundary(n = 1) { //n: number of characters read
this.startIndex += n;
}
canRead(n){
n = n || this.startIndex;
return this.buffer.length - n + 1 > 0;
}
}
module.exports = StringSource;
@@ -0,0 +1,147 @@
# napi-postinstall
[![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/un-ts/napi-postinstall/ci.yml?branch=main)](https://github.com/un-ts/napi-postinstall/actions/workflows/ci.yml?query=branch%3Amain)
[![Codecov](https://img.shields.io/codecov/c/github/un-ts/napi-postinstall.svg)](https://codecov.io/gh/un-ts/napi-postinstall)
[![type-coverage](https://img.shields.io/badge/dynamic/json.svg?label=type-coverage&prefix=%E2%89%A5&suffix=%&query=$.typeCoverage.atLeast&uri=https%3A%2F%2Fraw.githubusercontent.com%2Fun-ts%2Fnapi-postinstall%2Fmain%2Fpackage.json)](https://github.com/plantain-00/type-coverage)
[![CodeRabbit Pull Request Reviews](https://img.shields.io/coderabbit/prs/github/un-ts/napi-postinstall)](https://coderabbit.ai)
[![npm](https://img.shields.io/npm/v/napi-postinstall.svg)](https://www.npmjs.com/package/napi-postinstall)
[![GitHub Release](https://img.shields.io/github/release/un-ts/napi-postinstall)](https://github.com/un-ts/napi-postinstall/releases)
[![Conventional Commits](https://img.shields.io/badge/conventional%20commits-1.0.0-yellow.svg)](https://conventionalcommits.org)
[![Renovate enabled](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
[![Code Style: Prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
[![changesets](https://img.shields.io/badge/maintained%20with-changesets-176de3.svg)](https://github.com/changesets/changesets)
The `postinstall` script helper for handling native bindings in legacy `npm` versions, this is a reimplementation of the [`node-install`][node-install] functionality from [`esbuild`][esbuild] for [`napi-rs`][napi-rs] ecosystem packages like [`rollup`][rollup], [`@swc/core`][swc-core] and [`unrs-resolver`][unrs-resolver].
For more details, please refer to the following issues:
- [npm/cli#4828](https://github.com/npm/cli/issues/4828) -- root cause
- [napi-rs/napi-rs#2569](https://github.com/napi-rs/napi-rs/issues/2569)
- [unrs/unrs-resolver#56](https://github.com/unrs/unrs-resolver/issues/56)
## TOC <!-- omit in toc -->
- [Usage](#usage)
- [Install](#install)
- [CLI](#cli)
- [API](#api)
- [Types](#types)
- [Example](#example)
- [Sponsors and Backers](#sponsors-and-backers)
- [Sponsors](#sponsors)
- [Backers](#backers)
- [Changelog](#changelog)
- [License](#license)
## Usage
### Install
```sh
# pnpm
pnpm add napi-postinstall
# yarn
yarn add napi-postinstall
# npm
npm i napi-postinstall
# bun
bun add napi-postinstall
```
### CLI
```sh
napi-postinstall unrs-resolver #<napi-package-name>
```
You can put it into `scripts#postinstall` of your `package.json`:
```json
{
"scripts": {
"postinstall": "napi-postinstall unrs-resolver"
}
}
```
This will check and prepare the napi binding packages for you automatically.
### API
#### Types
```ts
// napi-postinstall
export interface PackageJson {
name: string
version: string
}
export declare function checkAndPreparePackage(
packageNameOrPackageJson: PackageJson | string,
checkVersion?: boolean,
): Promise<void>
// napi-postinstall/fallback
declare function fallback<T = unknown>(
packageJsonPath: string,
checkVersion?: boolean,
): T
export = fallback
```
#### Example
```js
// index.js
const { checkAndPreparePackage, isNpm } = require('napi-postinstall')
if (isNpm()) {
void checkAndPreparePackage('unrs-resolver' /* <napi-package-name> */)
}
// fallback.js
module.exports = require('napi-postinstall/fallback')(
require.resolve('./package.json') /* <napi-package-json-path> */,
true /* <check-version> */,
)
```
## Sponsors and Backers
[![Sponsors](https://raw.githubusercontent.com/1stG/static/master/sponsors.svg)](https://github.com/sponsors/JounQin)
### Sponsors
| 1stG | RxTS | UnTS |
| ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| [![1stG Open Collective sponsors](https://opencollective.com/1stG/organizations.svg)](https://opencollective.com/1stG) | [![RxTS Open Collective sponsors](https://opencollective.com/rxts/organizations.svg)](https://opencollective.com/rxts) | [![UnTS Open Collective sponsors](https://opencollective.com/unts/organizations.svg)](https://opencollective.com/unts) |
### Backers
| 1stG | RxTS | UnTS |
| ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
| [![1stG Open Collective backers](https://opencollective.com/1stG/individuals.svg)](https://opencollective.com/1stG) | [![RxTS Open Collective backers](https://opencollective.com/rxts/individuals.svg)](https://opencollective.com/rxts) | [![UnTS Open Collective backers](https://opencollective.com/unts/individuals.svg)](https://opencollective.com/unts) |
## Changelog
Detailed changes for each release are documented in [CHANGELOG.md](./CHANGELOG.md).
## License
[MIT][] © [JounQin][]@[1stG.me][]
[node-install]: https://github.com/evanw/esbuild/blob/4475787eef4c4923b92b9fa37ebba1c88b9e1d9b/lib/npm/node-install.ts
[esbuild]: https://github.com/evanw/esbuild
[napi-rs]: https://github.com/napi-rs/napi-rs
[rollup]: https://github.com/rollup/rollup
[swc-core]: https://github.com/swc-project/swc
[unrs-resolver]: https://github.com/unrs/unrs-resolver
[1stG.me]: https://www.1stG.me
[JounQin]: https://github.com/JounQin
[MIT]: http://opensource.org/licenses/MIT
@@ -0,0 +1,239 @@
import {NOTHING} from "../internal"
type AnyFunc = (...args: any[]) => any
type PrimitiveType = number | string | boolean
/** Object types that should never be mapped */
type AtomicObject = Function | Promise<any> | Date | RegExp
/**
* If the lib "ES2015.Collection" is not included in tsconfig.json,
* types like ReadonlyArray, WeakMap etc. fall back to `any` (specified nowhere)
* or `{}` (from the node types), in both cases entering an infinite recursion in
* pattern matching type mappings
* This type can be used to cast these types to `void` in these cases.
*/
export type IfAvailable<T, Fallback = void> =
// fallback if any
true | false extends (T extends never
? true
: false)
? Fallback // fallback if empty type
: keyof T extends never
? Fallback // original type
: T
/**
* These should also never be mapped but must be tested after regular Map and
* Set
*/
type WeakReferences = IfAvailable<WeakMap<any, any>> | IfAvailable<WeakSet<any>>
export type WritableDraft<T> = {-readonly [K in keyof T]: Draft<T[K]>}
/** Convert a readonly type into a mutable type, if possible */
export type Draft<T> = T extends PrimitiveType
? T
: T extends AtomicObject
? T
: T extends ReadonlyMap<infer K, infer V> // Map extends ReadonlyMap
? Map<Draft<K>, Draft<V>>
: T extends ReadonlySet<infer V> // Set extends ReadonlySet
? Set<Draft<V>>
: T extends WeakReferences
? T
: T extends object
? WritableDraft<T>
: T
/** Convert a mutable type into a readonly type */
export type Immutable<T> = T extends PrimitiveType
? T
: T extends AtomicObject
? T
: T extends ReadonlyMap<infer K, infer V> // Map extends ReadonlyMap
? ReadonlyMap<Immutable<K>, Immutable<V>>
: T extends ReadonlySet<infer V> // Set extends ReadonlySet
? ReadonlySet<Immutable<V>>
: T extends WeakReferences
? T
: T extends object
? {readonly [K in keyof T]: Immutable<T[K]>}
: T
export interface Patch {
op: "replace" | "remove" | "add"
path: (string | number)[]
value?: any
}
export type PatchListener = (patches: Patch[], inversePatches: Patch[]) => void
/** Converts `nothing` into `undefined` */
type FromNothing<T> = T extends typeof NOTHING ? undefined : T
/** The inferred return type of `produce` */
export type Produced<Base, Return> = Return extends void
? Base
: FromNothing<Return>
/**
* Utility types
*/
type PatchesTuple<T> = readonly [T, Patch[], Patch[]]
type ValidRecipeReturnType<State> =
| State
| void
| undefined
| (State extends undefined ? typeof NOTHING : never)
type ReturnTypeWithPatchesIfNeeded<
State,
UsePatches extends boolean
> = UsePatches extends true ? PatchesTuple<State> : State
/**
* Core Producer inference
*/
type InferRecipeFromCurried<Curried> = Curried extends (
base: infer State,
...rest: infer Args
) => any // extra assertion to make sure this is a proper curried function (state, args) => state
? ReturnType<Curried> extends State
? (
draft: Draft<State>,
...rest: Args
) => ValidRecipeReturnType<Draft<State>>
: never
: never
type InferInitialStateFromCurried<Curried> = Curried extends (
base: infer State,
...rest: any[]
) => any // extra assertion to make sure this is a proper curried function (state, args) => state
? State
: never
type InferCurriedFromRecipe<
Recipe,
UsePatches extends boolean
> = Recipe extends (draft: infer DraftState, ...args: infer RestArgs) => any // verify return type
? ReturnType<Recipe> extends ValidRecipeReturnType<DraftState>
? (
base: Immutable<DraftState>,
...args: RestArgs
) => ReturnTypeWithPatchesIfNeeded<DraftState, UsePatches> // N.b. we return mutable draftstate, in case the recipe's first arg isn't read only, and that isn't expected as output either
: never // incorrect return type
: never // not a function
type InferCurriedFromInitialStateAndRecipe<
State,
Recipe,
UsePatches extends boolean
> = Recipe extends (
draft: Draft<State>,
...rest: infer RestArgs
) => ValidRecipeReturnType<State>
? (
base?: State | undefined,
...args: RestArgs
) => ReturnTypeWithPatchesIfNeeded<State, UsePatches>
: never // recipe doesn't match initial state
/**
* The `produce` function takes a value and a "recipe function" (whose
* return value often depends on the base state). The recipe function is
* free to mutate its first argument however it wants. All mutations are
* only ever applied to a __copy__ of the base state.
*
* Pass only a function to create a "curried producer" which relieves you
* from passing the recipe function every time.
*
* Only plain objects and arrays are made mutable. All other objects are
* considered uncopyable.
*
* Note: This function is __bound__ to its `Immer` instance.
*
* @param {any} base - the initial state
* @param {Function} producer - function that receives a proxy of the base state as first argument and which can be freely modified
* @param {Function} patchListener - optional function that will be called with all the patches produced here
* @returns {any} a new state, or the initial state if nothing was modified
*/
export interface IProduce {
/** Curried producer that infers the recipe from the curried output function (e.g. when passing to setState) */
<Curried>(
recipe: InferRecipeFromCurried<Curried>,
initialState?: InferInitialStateFromCurried<Curried>
): Curried
/** Curried producer that infers curried from the recipe */
<Recipe extends AnyFunc>(recipe: Recipe): InferCurriedFromRecipe<
Recipe,
false
>
/** Curried producer that infers curried from the State generic, which is explicitly passed in. */
<State>(
recipe: (
state: Draft<State>,
initialState: State
) => ValidRecipeReturnType<State>
): (state?: State) => State
<State, Args extends any[]>(
recipe: (
state: Draft<State>,
...args: Args
) => ValidRecipeReturnType<State>,
initialState: State
): (state?: State, ...args: Args) => State
<State>(recipe: (state: Draft<State>) => ValidRecipeReturnType<State>): (
state: State
) => State
<State, Args extends any[]>(
recipe: (state: Draft<State>, ...args: Args) => ValidRecipeReturnType<State>
): (state: State, ...args: Args) => State
/** Curried producer with initial state, infers recipe from initial state */
<State, Recipe extends Function>(
recipe: Recipe,
initialState: State
): InferCurriedFromInitialStateAndRecipe<State, Recipe, false>
/** Normal producer */
<Base, D = Draft<Base>>( // By using a default inferred D, rather than Draft<Base> in the recipe, we can override it.
base: Base,
recipe: (draft: D) => ValidRecipeReturnType<D>,
listener?: PatchListener
): Base
}
/**
* Like `produce`, but instead of just returning the new state,
* a tuple is returned with [nextState, patches, inversePatches]
*
* Like produce, this function supports currying
*/
export interface IProduceWithPatches {
// Types copied from IProduce, wrapped with PatchesTuple
<Recipe extends AnyFunc>(recipe: Recipe): InferCurriedFromRecipe<Recipe, true>
<State, Recipe extends Function>(
recipe: Recipe,
initialState: State
): InferCurriedFromInitialStateAndRecipe<State, Recipe, true>
<Base, D = Draft<Base>>(
base: Base,
recipe: (draft: D) => ValidRecipeReturnType<D>,
listener?: PatchListener
): PatchesTuple<Base>
}
/**
* The type for `recipe function`
*/
export type Producer<T> = (draft: Draft<T>) => ValidRecipeReturnType<Draft<T>>
// Fixes #507: bili doesn't export the types of this file if there is no actual source in it..
// hopefully it get's tree-shaken away for everyone :)
export function never_used() {}
@@ -0,0 +1,55 @@
'use strict';
var $TypeError = require('es-errors/type');
var MAX_SAFE_INTEGER = require('math-intrinsics/constants/maxSafeInteger');
var Call = require('./Call');
var CreateDataPropertyOrThrow = require('./CreateDataPropertyOrThrow');
var Get = require('./Get');
var HasProperty = require('./HasProperty');
var IsArray = require('./IsArray');
var ToLength = require('./ToLength');
var ToString = require('./ToString');
// https://262.ecma-international.org/10.0/#sec-flattenintoarray
module.exports = function FlattenIntoArray(target, source, sourceLen, start, depth) {
var mapperFunction;
if (arguments.length > 5) {
mapperFunction = arguments[5];
}
var targetIndex = start;
var sourceIndex = 0;
while (sourceIndex < sourceLen) {
var P = ToString(sourceIndex);
var exists = HasProperty(source, P);
if (exists === true) {
var element = Get(source, P);
if (typeof mapperFunction !== 'undefined') {
if (arguments.length <= 6) {
throw new $TypeError('Assertion failed: thisArg is required when mapperFunction is provided');
}
element = Call(mapperFunction, arguments[6], [element, sourceIndex, source]);
}
var shouldFlatten = false;
if (depth > 0) {
shouldFlatten = IsArray(element);
}
if (shouldFlatten) {
var elementLen = ToLength(Get(element, 'length'));
targetIndex = FlattenIntoArray(target, element, elementLen, targetIndex, depth - 1);
} else {
if (targetIndex >= MAX_SAFE_INTEGER) {
throw new $TypeError('index too large');
}
CreateDataPropertyOrThrow(target, ToString(targetIndex), element);
targetIndex += 1;
}
}
sourceIndex += 1;
}
return targetIndex;
};
@@ -0,0 +1 @@
{"version":3,"file":"table.js","names":["Block","Container","TableCell","blotName","tagName","create","value","node","setAttribute","tableId","formats","domNode","hasAttribute","getAttribute","undefined","cellOffset","parent","children","indexOf","format","name","row","rowOffset","table","TableRow","checkMerge","next","head","thisHead","thisTail","tail","nextHead","nextTail","optimize","context","forEach","child","childFormats","nextFormats","splitAfter","prev","TableBody","TableContainer","balanceCells","rows","descendants","maxColumns","reduce","max","Math","length","Array","fill","blot","scroll","appendChild","cells","column","map","at","deleteColumn","index","body","descendant","cell","remove","insertColumn","ref","insertBefore","insertRow","id","allowedChildren","requiredContainer","random","toString","slice"],"sources":["../../src/formats/table.ts"],"sourcesContent":["import type { LinkedList } from 'parchment';\nimport Block from '../blots/block.js';\nimport Container from '../blots/container.js';\n\nclass TableCell extends Block {\n static blotName = 'table';\n static tagName = 'TD';\n\n static create(value: string) {\n const node = super.create() as HTMLElement;\n if (value) {\n node.setAttribute('data-row', value);\n } else {\n node.setAttribute('data-row', tableId());\n }\n return node;\n }\n\n static formats(domNode: HTMLElement) {\n if (domNode.hasAttribute('data-row')) {\n return domNode.getAttribute('data-row');\n }\n return undefined;\n }\n\n next: this | null;\n\n cellOffset() {\n if (this.parent) {\n return this.parent.children.indexOf(this);\n }\n return -1;\n }\n\n format(name: string, value: string) {\n if (name === TableCell.blotName && value) {\n this.domNode.setAttribute('data-row', value);\n } else {\n super.format(name, value);\n }\n }\n\n row(): TableRow {\n return this.parent as TableRow;\n }\n\n rowOffset() {\n if (this.row()) {\n return this.row().rowOffset();\n }\n return -1;\n }\n\n table() {\n return this.row() && this.row().table();\n }\n}\n\nclass TableRow extends Container {\n static blotName = 'table-row';\n static tagName = 'TR';\n\n children: LinkedList<TableCell>;\n next: this | null;\n\n checkMerge() {\n // @ts-expect-error\n if (super.checkMerge() && this.next.children.head != null) {\n // @ts-expect-error\n const thisHead = this.children.head.formats();\n // @ts-expect-error\n const thisTail = this.children.tail.formats();\n // @ts-expect-error\n const nextHead = this.next.children.head.formats();\n // @ts-expect-error\n const nextTail = this.next.children.tail.formats();\n return (\n thisHead.table === thisTail.table &&\n thisHead.table === nextHead.table &&\n thisHead.table === nextTail.table\n );\n }\n return false;\n }\n\n optimize(context: { [key: string]: any }) {\n super.optimize(context);\n this.children.forEach((child) => {\n if (child.next == null) return;\n const childFormats = child.formats();\n const nextFormats = child.next.formats();\n if (childFormats.table !== nextFormats.table) {\n const next = this.splitAfter(child);\n if (next) {\n // @ts-expect-error TODO: parameters of optimize() should be a optional\n next.optimize();\n }\n // We might be able to merge with prev now\n if (this.prev) {\n // @ts-expect-error TODO: parameters of optimize() should be a optional\n this.prev.optimize();\n }\n }\n });\n }\n\n rowOffset() {\n if (this.parent) {\n return this.parent.children.indexOf(this);\n }\n return -1;\n }\n\n table() {\n return this.parent && this.parent.parent;\n }\n}\n\nclass TableBody extends Container {\n static blotName = 'table-body';\n static tagName = 'TBODY';\n\n children: LinkedList<TableRow>;\n}\n\nclass TableContainer extends Container {\n static blotName = 'table-container';\n static tagName = 'TABLE';\n\n children: LinkedList<TableBody>;\n\n balanceCells() {\n const rows = this.descendants(TableRow);\n const maxColumns = rows.reduce((max, row) => {\n return Math.max(row.children.length, max);\n }, 0);\n rows.forEach((row) => {\n new Array(maxColumns - row.children.length).fill(0).forEach(() => {\n let value;\n if (row.children.head != null) {\n value = TableCell.formats(row.children.head.domNode);\n }\n const blot = this.scroll.create(TableCell.blotName, value);\n row.appendChild(blot);\n // @ts-expect-error TODO: parameters of optimize() should be a optional\n blot.optimize(); // Add break blot\n });\n });\n }\n\n cells(column: number) {\n return this.rows().map((row) => row.children.at(column));\n }\n\n deleteColumn(index: number) {\n // @ts-expect-error\n const [body] = this.descendant(TableBody)Line truncated
@@ -0,0 +1,87 @@
// Copyright (c) 2011-2012 Ryan Prichard
//
// 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.
#ifndef COORD_H
#define COORD_H
#include <windows.h>
#include <string>
#include "../shared/winpty_snprintf.h"
struct Coord : COORD {
Coord()
{
X = 0;
Y = 0;
}
Coord(SHORT x, SHORT y)
{
X = x;
Y = y;
}
Coord(COORD other)
{
*(COORD*)this = other;
}
Coord(const Coord &other)
{
*(COORD*)this = *(const COORD*)&other;
}
Coord &operator=(const Coord &other)
{
*(COORD*)this = *(const COORD*)&other;
return *this;
}
bool operator==(const Coord &other) const
{
return X == other.X && Y == other.Y;
}
bool operator!=(const Coord &other) const
{
return !(*this == other);
}
Coord operator+(const Coord &other) const
{
return Coord(X + other.X, Y + other.Y);
}
bool isEmpty() const
{
return X <= 0 || Y <= 0;
}
std::string toString() const
{
char ret[32];
winpty_snprintf(ret, "(%d,%d)", X, Y);
return std::string(ret);
}
};
#endif // COORD_H
@@ -0,0 +1,62 @@
'use strict';
var inspect = require('object-inspect');
var forEach = require('for-each');
var v = require('es-value-fixtures');
module.exports = function (groupBy, t) {
t.test('callback function', function (st) {
forEach(v.nonFunctions, function (nonFunction) {
st['throws'](
function () { groupBy([], nonFunction); },
TypeError,
inspect(nonFunction) + ' is not a function'
);
});
st.end();
});
t.test('grouping', function (st) {
st.deepEqual(
groupBy([], function () { return 'a'; }),
{ __proto__: null },
'an empty array produces an empty object'
);
var arr = [0, -0, 1, 2, 3, 4, 5, NaN, Infinity, -Infinity];
var parity = function (x) {
if (x !== x) {
return void undefined;
}
if (!isFinite(x)) {
return '∞';
}
return x % 2 === 0 ? 'even' : 'odd';
};
var grouped = {
__proto__: null,
even: [0, -0, 2, 4],
odd: [1, 3, 5],
undefined: [NaN],
'∞': [Infinity, -Infinity]
};
st.deepEqual(
groupBy(arr, parity),
grouped,
inspect(arr) + ' group by parity groups to ' + inspect(grouped)
);
st.deepEqual(
groupBy(arr, function (x, i) {
st.equal(this, undefined, 'receiver is as expected'); // eslint-disable-line no-invalid-this
st.equal(x, arr[i], 'second argument ' + i + ' is ' + inspect(arr[i]));
return 42;
}),
{ __proto__: null, 42: arr },
'thisArg and callback arguments are as expected'
);
st.end();
});
};
@@ -0,0 +1,7 @@
import type { Token } from "./parser/tokenizer";
export default class NameManager {
private readonly usedNames;
constructor(code: string, tokens: Array<Token>);
claimFreeName(name: string): string;
findFreeName(name: string): string;
}
@@ -0,0 +1,18 @@
;(function (root, factory, undef) {
if (typeof exports === "object") {
// CommonJS
module.exports = exports = factory(require("./core"), require("./sha1"), require("./hmac"));
}
else if (typeof define === "function" && define.amd) {
// AMD
define(["./core", "./sha1", "./hmac"], factory);
}
else {
// Global (browser)
factory(root.CryptoJS);
}
}(this, function (CryptoJS) {
return CryptoJS.HmacSHA1;
}));
@@ -0,0 +1,43 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/common/numbers.ts
var numbers_exports = {};
__export(numbers_exports, {
clamp: () => clamp,
clampPercentage: () => clampPercentage,
range: () => range
});
module.exports = __toCommonJS(numbers_exports);
function range(start, end) {
const length = end - start + 1;
return Array.from({ length }, (_, index) => index + start);
}
function clamp(value, min, max) {
return Math.min(Math.max(value, min), max);
}
function clampPercentage(value, max = 100) {
return Math.min(Math.max(value, 0), max);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
clamp,
clampPercentage,
range
});
@@ -0,0 +1,3 @@
import Decimal from 'decimal.js';
import { NumberFormatInternal } from '../types/number';
export declare function FormatNumeric(internalSlots: NumberFormatInternal, x: Decimal): string;
@@ -0,0 +1,214 @@
import {
AnyClassGroupIds,
AnyConfig,
AnyThemeGroupIds,
ClassGroup,
ClassValidator,
Config,
ThemeGetter,
ThemeObject,
} from './types'
export interface ClassPartObject {
nextPart: Map<string, ClassPartObject>
validators: ClassValidatorObject[]
classGroupId?: AnyClassGroupIds
}
interface ClassValidatorObject {
classGroupId: AnyClassGroupIds
validator: ClassValidator
}
const CLASS_PART_SEPARATOR = '-'
export const createClassGroupUtils = (config: AnyConfig) => {
const classMap = createClassMap(config)
const { conflictingClassGroups, conflictingClassGroupModifiers } = config
const getClassGroupId = (className: string) => {
const classParts = className.split(CLASS_PART_SEPARATOR)
// Classes like `-inset-1` produce an empty string as first classPart. We assume that classes for negative values are used correctly and remove it from classParts.
if (classParts[0] === '' && classParts.length !== 1) {
classParts.shift()
}
return getGroupRecursive(classParts, classMap) || getGroupIdForArbitraryProperty(className)
}
const getConflictingClassGroupIds = (
classGroupId: AnyClassGroupIds,
hasPostfixModifier: boolean,
) => {
const conflicts = conflictingClassGroups[classGroupId] || []
if (hasPostfixModifier && conflictingClassGroupModifiers[classGroupId]) {
return [...conflicts, ...conflictingClassGroupModifiers[classGroupId]!]
}
return conflicts
}
return {
getClassGroupId,
getConflictingClassGroupIds,
}
}
const getGroupRecursive = (
classParts: string[],
classPartObject: ClassPartObject,
): AnyClassGroupIds | undefined => {
if (classParts.length === 0) {
return classPartObject.classGroupId
}
const currentClassPart = classParts[0]!
const nextClassPartObject = classPartObject.nextPart.get(currentClassPart)
const classGroupFromNextClassPart = nextClassPartObject
? getGroupRecursive(classParts.slice(1), nextClassPartObject)
: undefined
if (classGroupFromNextClassPart) {
return classGroupFromNextClassPart
}
if (classPartObject.validators.length === 0) {
return undefined
}
const classRest = classParts.join(CLASS_PART_SEPARATOR)
return classPartObject.validators.find(({ validator }) => validator(classRest))?.classGroupId
}
const arbitraryPropertyRegex = /^\[(.+)\]$/
const getGroupIdForArbitraryProperty = (className: string) => {
if (arbitraryPropertyRegex.test(className)) {
const arbitraryPropertyClassName = arbitraryPropertyRegex.exec(className)![1]
const property = arbitraryPropertyClassName?.substring(
0,
arbitraryPropertyClassName.indexOf(':'),
)
if (property) {
// I use two dots here because one dot is used as prefix for class groups in plugins
return 'arbitrary..' + property
}
}
}
/**
* Exported for testing only
*/
export const createClassMap = (config: Config<AnyClassGroupIds, AnyThemeGroupIds>) => {
const { theme, prefix } = config
const classMap: ClassPartObject = {
nextPart: new Map<string, ClassPartObject>(),
validators: [],
}
const prefixedClassGroupEntries = getPrefixedClassGroupEntries(
Object.entries(config.classGroups),
prefix,
)
prefixedClassGroupEntries.forEach(([classGroupId, classGroup]) => {
processClassesRecursively(classGroup, classMap, classGroupId, theme)
})
return classMap
}
const processClassesRecursively = (
classGroup: ClassGroup<AnyThemeGroupIds>,
classPartObject: ClassPartObject,
classGroupId: AnyClassGroupIds,
theme: ThemeObject<AnyThemeGroupIds>,
) => {
classGroup.forEach((classDefinition) => {
if (typeof classDefinition === 'string') {
const classPartObjectToEdit =
classDefinition === '' ? classPartObject : getPart(classPartObject, classDefinition)
classPartObjectToEdit.classGroupId = classGroupId
return
}
if (typeof classDefinition === 'function') {
if (isThemeGetter(classDefinition)) {
processClassesRecursively(
classDefinition(theme),
classPartObject,
classGroupId,
theme,
)
return
}
classPartObject.validators.push({
validator: classDefinition,
classGroupId,
})
return
}
Object.entries(classDefinition).forEach(([key, classGroup]) => {
processClassesRecursively(
classGroup,
getPart(classPartObject, key),
classGroupId,
theme,
)
})
})
}
const getPart = (classPartObject: ClassPartObject, path: string) => {
let currentClassPartObject = classPartObject
path.split(CLASS_PART_SEPARATOR).forEach((pathPart) => {
if (!currentClassPartObject.nextPart.has(pathPart)) {
currentClassPartObject.nextPart.set(pathPart, {
nextPart: new Map(),
validators: [],
})
}
currentClassPartObject = currentClassPartObject.nextPart.get(pathPart)!
})
return currentClassPartObject
}
const isThemeGetter = (func: ClassValidator | ThemeGetter): func is ThemeGetter =>
(func as ThemeGetter).isThemeGetter
const getPrefixedClassGroupEntries = (
classGroupEntries: Array<[classGroupId: string, classGroup: ClassGroup<AnyThemeGroupIds>]>,
prefix: string | undefined,
): Array<[classGroupId: string, classGroup: ClassGroup<AnyThemeGroupIds>]> => {
if (!prefix) {
return classGroupEntries
}
return classGroupEntries.map(([classGroupId, classGroup]) => {
const prefixedClassGroup = classGroup.map((classDefinition) => {
if (typeof classDefinition === 'string') {
return prefix + classDefinition
}
if (typeof classDefinition === 'object') {
return Object.fromEntries(
Object.entries(classDefinition).map(([key, value]) => [prefix + key, value]),
)
}
return classDefinition
})
return [classGroupId, prefixedClassGroup]
})
}
@@ -0,0 +1,40 @@
'use strict';
var applyReviver = require('../doc/applyReviver.js');
var identity = require('./identity.js');
var toJS = require('./toJS.js');
class NodeBase {
constructor(type) {
Object.defineProperty(this, identity.NODE_TYPE, { value: type });
}
/** Create a copy of this node. */
clone() {
const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
if (this.range)
copy.range = this.range.slice();
return copy;
}
/** A plain JavaScript representation of this node. */
toJS(doc, { mapAsMap, maxAliasCount, onAnchor, reviver } = {}) {
if (!identity.isDocument(doc))
throw new TypeError('A document argument is required');
const ctx = {
anchors: new Map(),
doc,
keep: true,
mapAsMap: mapAsMap === true,
mapKeyWarned: false,
maxAliasCount: typeof maxAliasCount === 'number' ? maxAliasCount : 100
};
const res = toJS.toJS(this, '', ctx);
if (typeof onAnchor === 'function')
for (const { count, res } of ctx.anchors.values())
onAnchor(res, count);
return typeof reviver === 'function'
? applyReviver.applyReviver(reviver, { '': res }, '', res)
: res;
}
}
exports.NodeBase = NodeBase;
@@ -0,0 +1 @@
{"name":"@types/unist","version":"2.0.11","requiresBuild":false,"files":{"LICENSE":{"checkedAt":1794532114051,"integrity":"sha512-HQaIQk9pwOcyKutyDk4o2a87WnotwYuLGYFW43emGm4FvIJFKPyg+OYaw5sTegKAKf+C5SKa1ACjzCLivbaHrQ==","mode":420,"size":1141},"README.md":{"checkedAt":1794532114051,"integrity":"sha512-gRey2ZdT1SFJjzVojK8ZcKIFiztBPHFm3kF4AAN3iL1auNt2WhimSK5XmOQEYzfK3iPN+GoI6vsGtBCT1cZzvw==","mode":420,"size":3298},"index.d.ts":{"checkedAt":1794532114051,"integrity":"sha512-SE9xtTZXxv757j2VlTQsQLoU1biVp2ELLQ44me+fQXWFqrDGPRhTFBcR1uj7hA3SQJC4XEoFKu5sGTxwKEJgbQ==","mode":420,"size":2452},"package.json":{"checkedAt":1794532114051,"integrity":"sha512-mcn14C8Bfl84R+KBTeGLpKx+lB6OFF3VRY2SXbdwGE6zENzVLCCyWrsffe3cJAa3BDiYtvw6M1AWTYEkntCKgQ==","mode":420,"size":1652}}}
@@ -0,0 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Computed = Computed;
const index_1 = require("../create/index");
const symbols_1 = require("../symbols/symbols");
/** `[Internal]` Creates a deferred computed type. This type is used exclusively in modules to defer resolution of computable types that contain interior references */
function Computed(target, parameters, options) {
return (0, index_1.CreateType)({ [symbols_1.Kind]: 'Computed', target, parameters }, options);
}
@@ -0,0 +1,11 @@
"use client";
import {
DEFAULT_SLOT,
useContextProps,
useSlottedContext
} from "./chunk-BSTJ7ZCN.mjs";
export {
DEFAULT_SLOT,
useContextProps,
useSlottedContext
};
@@ -0,0 +1,11 @@
import { ServiceIdentifier } from './ServiceIdentifier';
declare const islazyServiceIdentifierSymbol: unique symbol;
export declare class LazyServiceIdentifier<TInstance = unknown> {
#private;
[islazyServiceIdentifierSymbol]: true;
constructor(buildServiceId: () => ServiceIdentifier<TInstance>);
static is<TInstance = unknown>(value: unknown): value is LazyServiceIdentifier<TInstance>;
unwrap(): ServiceIdentifier<TInstance>;
}
export {};
//# sourceMappingURL=LazyServiceIdentifier.d.ts.map
@@ -0,0 +1,91 @@
var $6acf696f746f932c$exports = require("./utils.main.js");
var $7ff3f66df3873a5e$exports = require("./intlStrings.main.js");
var $33PgG$reactariautils = require("@react-aria/utils");
var $33PgG$react = require("react");
var $33PgG$reactariainteractions = require("@react-aria/interactions");
var $33PgG$reactariagrid = require("@react-aria/grid");
var $33PgG$reactariai18n = require("@react-aria/i18n");
function $parcel$interopDefault(a) {
return a && a.__esModule ? a.default : a;
}
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "useTableColumnHeader", () => $7669c34a63ef0113$export$9514819a8c81e960);
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
function $7669c34a63ef0113$export$9514819a8c81e960(props, state, ref) {
var _state_sortDescriptor, _state_sortDescriptor1;
let { node: node } = props;
let allowsSorting = node.props.allowsSorting;
// if there are no focusable children, the column header will focus the cell
let { gridCellProps: gridCellProps } = (0, $33PgG$reactariagrid.useGridCell)({
...props,
focusMode: 'child'
}, state, ref);
let isSelectionCellDisabled = node.props.isSelectionCell && state.selectionManager.selectionMode === 'single';
let { pressProps: pressProps } = (0, $33PgG$reactariainteractions.usePress)({
isDisabled: !allowsSorting || isSelectionCellDisabled,
onPress () {
state.sort(node.key);
},
ref: ref
});
// Needed to pick up the focusable context, enabling things like Tooltips for example
let { focusableProps: focusableProps } = (0, $33PgG$reactariainteractions.useFocusable)({}, ref);
let ariaSort = undefined;
let isSortedColumn = ((_state_sortDescriptor = state.sortDescriptor) === null || _state_sortDescriptor === void 0 ? void 0 : _state_sortDescriptor.column) === node.key;
let sortDirection = (_state_sortDescriptor1 = state.sortDescriptor) === null || _state_sortDescriptor1 === void 0 ? void 0 : _state_sortDescriptor1.direction;
// aria-sort not supported in Android Talkback
if (node.props.allowsSorting && !(0, $33PgG$reactariautils.isAndroid)()) ariaSort = isSortedColumn ? sortDirection : 'none';
let stringFormatter = (0, $33PgG$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($7ff3f66df3873a5e$exports))), '@react-aria/table');
let sortDescription;
if (allowsSorting) {
sortDescription = `${stringFormatter.format('sortable')}`;
// Android Talkback doesn't support aria-sort so we add sort order details to the aria-described by here
if (isSortedColumn && sortDirection && (0, $33PgG$reactariautils.isAndroid)()) sortDescription = `${sortDescription}, ${stringFormatter.format(sortDirection)}`;
}
let descriptionProps = (0, $33PgG$reactariautils.useDescription)(sortDescription);
let shouldDisableFocus = state.collection.size === 0;
(0, $33PgG$react.useEffect)(()=>{
if (shouldDisableFocus && state.selectionManager.focusedKey === node.key) state.selectionManager.setFocusedKey(null);
}, [
shouldDisableFocus,
state.selectionManager,
node.key
]);
return {
columnHeaderProps: {
...(0, $33PgG$reactariautils.mergeProps)(focusableProps, gridCellProps, pressProps, descriptionProps, // If the table is empty, make all column headers untabbable
shouldDisableFocus ? {
tabIndex: -1
} : null),
role: 'columnheader',
id: (0, $6acf696f746f932c$exports.getColumnHeaderId)(state, node.key),
'aria-colspan': node.colSpan && node.colSpan > 1 ? node.colSpan : undefined,
'aria-sort': ariaSort
}
};
}
//# sourceMappingURL=useTableColumnHeader.main.js.map
@@ -0,0 +1,115 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _concatLimit = require('./concatLimit.js');
var _concatLimit2 = _interopRequireDefault(_concatLimit);
var _awaitify = require('./internal/awaitify.js');
var _awaitify2 = _interopRequireDefault(_awaitify);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Applies `iteratee` to each item in `coll`, concatenating the results. Returns
* the concatenated list. The `iteratee`s are called in parallel, and the
* results are concatenated as they return. The results array will be returned in
* the original order of `coll` passed to the `iteratee` function.
*
* @name concat
* @static
* @memberOf module:Collections
* @method
* @category Collection
* @alias flatMap
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
* @param {AsyncFunction} iteratee - A function to apply to each item in `coll`,
* which should use an array as its result. Invoked with (item, callback).
* @param {Function} [callback] - A callback which is called after all the
* `iteratee` functions have finished, or an error occurs. Results is an array
* containing the concatenated results of the `iteratee` function. Invoked with
* (err, results).
* @returns A Promise, if no callback is passed
* @example
*
* // dir1 is a directory that contains file1.txt, file2.txt
* // dir2 is a directory that contains file3.txt, file4.txt
* // dir3 is a directory that contains file5.txt
* // dir4 does not exist
*
* let directoryList = ['dir1','dir2','dir3'];
* let withMissingDirectoryList = ['dir1','dir2','dir3', 'dir4'];
*
* // Using callbacks
* async.concat(directoryList, fs.readdir, function(err, results) {
* if (err) {
* console.log(err);
* } else {
* console.log(results);
* // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ]
* }
* });
*
* // Error Handling
* async.concat(withMissingDirectoryList, fs.readdir, function(err, results) {
* if (err) {
* console.log(err);
* // [ Error: ENOENT: no such file or directory ]
* // since dir4 does not exist
* } else {
* console.log(results);
* }
* });
*
* // Using Promises
* async.concat(directoryList, fs.readdir)
* .then(results => {
* console.log(results);
* // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ]
* }).catch(err => {
* console.log(err);
* });
*
* // Error Handling
* async.concat(withMissingDirectoryList, fs.readdir)
* .then(results => {
* console.log(results);
* }).catch(err => {
* console.log(err);
* // [ Error: ENOENT: no such file or directory ]
* // since dir4 does not exist
* });
*
* // Using async/await
* async () => {
* try {
* let results = await async.concat(directoryList, fs.readdir);
* console.log(results);
* // [ 'file1.txt', 'file2.txt', 'file3.txt', 'file4.txt', file5.txt ]
* } catch (err) {
* console.log(err);
* }
* }
*
* // Error Handling
* async () => {
* try {
* let results = await async.concat(withMissingDirectoryList, fs.readdir);
* console.log(results);
* } catch (err) {
* console.log(err);
* // [ Error: ENOENT: no such file or directory ]
* // since dir4 does not exist
* }
* }
*
*/
function concat(coll, iteratee, callback) {
return (0, _concatLimit2.default)(coll, Infinity, iteratee, callback);
}
exports.default = (0, _awaitify2.default)(concat, 3);
module.exports = exports.default;
@@ -0,0 +1 @@
{"version":3,"file":"cloneConstantValueBinding.js","sourceRoot":"","sources":["../../../../src/binding/calculations/cloneConstantValueBinding.ts"],"names":[],"mappings":";;AAMA,8DAgBC;AArBD,2DAAwD;AAExD;;GAEG;AACH,SAAgB,yBAAyB,CACvC,OAAyC;IAEzC,OAAO;QACL,KAAK,EAAE,IAAA,qCAAiB,EAAC,OAAO,CAAC,KAAK,CAAC;QACvC,EAAE,EAAE,OAAO,CAAC,EAAE;QACd,aAAa,EAAE,OAAO,CAAC,aAAa;QACpC,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,cAAc,EAAE,OAAO,CAAC,cAAc;QACtC,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,iBAAiB,EAAE,OAAO,CAAC,iBAAiB;QAC5C,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,mDAAmD;QACnD,KAAK,EAAE,OAAO,CAAC,KAAK;KACrB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,168 @@
# tar-stream
tar-stream is a streaming tar parser and generator and nothing else. It is streams2 and operates purely using streams which means you can easily extract/parse tarballs without ever hitting the file system.
Note that you still need to gunzip your data if you have a `.tar.gz`. We recommend using [gunzip-maybe](https://github.com/mafintosh/gunzip-maybe) in conjunction with this.
```
npm install tar-stream
```
[![build status](https://secure.travis-ci.org/mafintosh/tar-stream.png)](http://travis-ci.org/mafintosh/tar-stream)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](http://opensource.org/licenses/MIT)
## Usage
tar-stream exposes two streams, [pack](https://github.com/mafintosh/tar-stream#packing) which creates tarballs and [extract](https://github.com/mafintosh/tar-stream#extracting) which extracts tarballs. To [modify an existing tarball](https://github.com/mafintosh/tar-stream#modifying-existing-tarballs) use both.
It implementes USTAR with additional support for pax extended headers. It should be compatible with all popular tar distributions out there (gnutar, bsdtar etc)
## Related
If you want to pack/unpack directories on the file system check out [tar-fs](https://github.com/mafintosh/tar-fs) which provides file system bindings to this module.
## Packing
To create a pack stream use `tar.pack()` and call `pack.entry(header, [callback])` to add tar entries.
``` js
var tar = require('tar-stream')
var pack = tar.pack() // pack is a streams2 stream
// add a file called my-test.txt with the content "Hello World!"
pack.entry({ name: 'my-test.txt' }, 'Hello World!')
// add a file called my-stream-test.txt from a stream
var entry = pack.entry({ name: 'my-stream-test.txt', size: 11 }, function(err) {
// the stream was added
// no more entries
pack.finalize()
})
entry.write('hello')
entry.write(' ')
entry.write('world')
entry.end()
// pipe the pack stream somewhere
pack.pipe(process.stdout)
```
## Extracting
To extract a stream use `tar.extract()` and listen for `extract.on('entry', (header, stream, next) )`
``` js
var extract = tar.extract()
extract.on('entry', function(header, stream, next) {
// header is the tar header
// stream is the content body (might be an empty stream)
// call next when you are done with this entry
stream.on('end', function() {
next() // ready for next entry
})
stream.resume() // just auto drain the stream
})
extract.on('finish', function() {
// all entries read
})
pack.pipe(extract)
```
The tar archive is streamed sequentially, meaning you **must** drain each entry's stream as you get them or else the main extract stream will receive backpressure and stop reading.
## Headers
The header object using in `entry` should contain the following properties.
Most of these values can be found by stat'ing a file.
``` js
{
name: 'path/to/this/entry.txt',
size: 1314, // entry size. defaults to 0
mode: 0644, // entry mode. defaults to to 0755 for dirs and 0644 otherwise
mtime: new Date(), // last modified date for entry. defaults to now.
type: 'file', // type of entry. defaults to file. can be:
// file | link | symlink | directory | block-device
// character-device | fifo | contiguous-file
linkname: 'path', // linked file name
uid: 0, // uid of entry owner. defaults to 0
gid: 0, // gid of entry owner. defaults to 0
uname: 'maf', // uname of entry owner. defaults to null
gname: 'staff', // gname of entry owner. defaults to null
devmajor: 0, // device major version. defaults to 0
devminor: 0 // device minor version. defaults to 0
}
```
## Modifying existing tarballs
Using tar-stream it is easy to rewrite paths / change modes etc in an existing tarball.
``` js
var extract = tar.extract()
var pack = tar.pack()
var path = require('path')
extract.on('entry', function(header, stream, callback) {
// let's prefix all names with 'tmp'
header.name = path.join('tmp', header.name)
// write the new entry to the pack stream
stream.pipe(pack.entry(header, callback))
})
extract.on('finish', function() {
// all entries done - lets finalize it
pack.finalize()
})
// pipe the old tarball to the extractor
oldTarballStream.pipe(extract)
// pipe the new tarball the another stream
pack.pipe(newTarballStream)
```
## Saving tarball to fs
``` js
var fs = require('fs')
var tar = require('tar-stream')
var pack = tar.pack() // pack is a streams2 stream
var path = 'YourTarBall.tar'
var yourTarball = fs.createWriteStream(path)
// add a file called YourFile.txt with the content "Hello World!"
pack.entry({name: 'YourFile.txt'}, 'Hello World!', function (err) {
if (err) throw err
pack.finalize()
})
// pipe the pack stream to your file
pack.pipe(yourTarball)
yourTarball.on('close', function () {
console.log(path + ' has been written')
fs.stat(path, function(err, stats) {
if (err) throw err
console.log(stats)
console.log('Got file info successfully!')
})
})
```
## Performance
[See tar-fs for a performance comparison with node-tar](https://github.com/mafintosh/tar-fs/blob/master/README.md#performance)
# License
MIT
@@ -0,0 +1,26 @@
"use strict"
const { READ } = require("@eslint-community/eslint-utils")
/**
* @satisfies {import('../types.js').SupportVersionTraceMap}
*/
const sea = {
isSea: { [READ]: { supported: ["21.7.0", "20.12.0"] } },
getAsset: { [READ]: { supported: ["21.7.0", "20.12.0"] } },
getAssetAsBlob: { [READ]: { supported: ["21.7.0", "20.12.0"] } },
getRawAsset: { [READ]: { supported: ["21.7.0", "20.12.0"] } },
sea: {},
}
sea.sea = sea
/**
* @satisfies {import('../types.js').SupportVersionTraceMap}
*/
module.exports = {
"node:sea": {
[READ]: { experimental: ["21.7.0", "20.12.0"] },
...sea,
},
}
@@ -0,0 +1,36 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
function _export(target, all) {
for(var name in all)Object.defineProperty(target, name, {
enumerable: true,
get: all[name]
});
}
_export(exports, {
lazyPostcss: function() {
return lazyPostcss;
},
lazyPostcssImport: function() {
return lazyPostcssImport;
},
lazyAutoprefixer: function() {
return lazyAutoprefixer;
},
lazyCssnano: function() {
return lazyCssnano;
}
});
function lazyPostcss() {
return require("postcss");
}
function lazyPostcssImport() {
return require("postcss-import");
}
function lazyAutoprefixer() {
return require("autoprefixer");
}
function lazyCssnano() {
return require("cssnano");
}
@@ -0,0 +1,11 @@
import * as _heroui_system from '@heroui/system';
import { UseCheckboxProps } from './use-checkbox.mjs';
import '@heroui/theme';
import '@react-types/checkbox';
import 'react';
interface CheckboxProps extends UseCheckboxProps {
}
declare const Checkbox: _heroui_system.InternalForwardRefRenderFunction<"input", CheckboxProps, never>;
export { type CheckboxProps, Checkbox as default };
@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014-2016, Jon Schlinkert.
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 @@
!function(_,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("dayjs")):"function"==typeof define&&define.amd?define(["dayjs"],e):(_="undefined"!=typeof globalThis?globalThis:_||self).dayjs_locale_mr=e(_.dayjs)}(this,(function(_){"use strict";function e(_){return _&&"object"==typeof _&&"default"in _?_:{default:_}}var t=e(_),n={name:"mr",weekdays:"रविवार_सोमवार_मंगळवार_बुधवार_गुरूवार_शुक्रवार_शनिवार".split("_"),months:"जानेवारी_फेब्रुवारी_मार्च_एप्रिल_मे_जून_जुलै_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर".split("_"),weekdaysShort:"रवि_सोम_मंगळ_बुध_गुरू_शुक्र_शनि".split("_"),monthsShort:"जाने._फेब्रु._मार्च._एप्रि._मे._जून._जुलै._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.".split("_"),weekdaysMin:"र_सो_मं_बु_गु_शु_श".split("_"),ordinal:function(_){return _},formats:{LT:"A h:mm वाजता",LTS:"A h:mm:ss वाजता",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY, A h:mm वाजता",LLLL:"dddd, D MMMM YYYY, A h:mm वाजता"}};return t.default.locale(n,null,!0),n}));
@@ -0,0 +1,45 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var groupRole = {
abstract: false,
accessibleNameRequired: false,
baseConcepts: [],
childrenPresentational: false,
nameFrom: ['author'],
prohibitedProps: [],
props: {
'aria-activedescendant': null,
'aria-disabled': null
},
relatedConcepts: [{
concept: {
name: 'details'
},
module: 'HTML'
}, {
concept: {
name: 'fieldset'
},
module: 'HTML'
}, {
concept: {
name: 'optgroup'
},
module: 'HTML'
}, {
concept: {
name: 'address'
},
module: 'HTML'
}],
requireContextRole: [],
requiredContextRole: [],
requiredOwnedElements: [],
requiredProps: {},
superClass: [['roletype', 'structure', 'section']]
};
var _default = exports.default = groupRole;
@@ -0,0 +1,5 @@
var convert = require('./convert'),
func = convert('over', require('../over'));
func.placeholder = require('./placeholder');
module.exports = func;
@@ -0,0 +1,10 @@
'use strict';
var bind = require('function-bind');
var $apply = require('./functionApply');
var actualApply = require('./actualApply');
/** @type {import('./applyBind')} */
module.exports = function applyBind() {
return actualApply(bind, $apply, arguments);
};
@@ -0,0 +1,116 @@
import { useConstant } from '../../utils/use-constant.mjs';
/**
* Can manually trigger a drag gesture on one or more `drag`-enabled `motion` components.
*
* ```jsx
* const dragControls = useDragControls()
*
* function startDrag(event) {
* dragControls.start(event, { snapToCursor: true })
* }
*
* return (
* <>
* <div onPointerDown={startDrag} />
* <motion.div drag="x" dragControls={dragControls} />
* </>
* )
* ```
*
* @public
*/
class DragControls {
constructor() {
this.componentControls = new Set();
}
/**
* Subscribe a component's internal `VisualElementDragControls` to the user-facing API.
*
* @internal
*/
subscribe(controls) {
this.componentControls.add(controls);
return () => this.componentControls.delete(controls);
}
/**
* Start a drag gesture on every `motion` component that has this set of drag controls
* passed into it via the `dragControls` prop.
*
* ```jsx
* dragControls.start(e, {
* snapToCursor: true
* })
* ```
*
* @param event - PointerEvent
* @param options - Options
*
* @public
*/
start(event, options) {
this.componentControls.forEach((controls) => {
controls.start(event.nativeEvent || event, options);
});
}
/**
* Cancels a drag gesture.
*
* ```jsx
* dragControls.cancel()
* ```
*
* @public
*/
cancel() {
this.componentControls.forEach((controls) => {
controls.cancel();
});
}
/**
* Stops a drag gesture.
*
* ```jsx
* dragControls.stop()
* ```
*
* @public
*/
stop() {
this.componentControls.forEach((controls) => {
controls.stop();
});
}
}
const createDragControls = () => new DragControls();
/**
* Usually, dragging is initiated by pressing down on a `motion` component with a `drag` prop
* and moving it. For some use-cases, for instance clicking at an arbitrary point on a video scrubber, we
* might want to initiate that dragging from a different component than the draggable one.
*
* By creating a `dragControls` using the `useDragControls` hook, we can pass this into
* the draggable component's `dragControls` prop. It exposes a `start` method
* that can start dragging from pointer events on other components.
*
* ```jsx
* const dragControls = useDragControls()
*
* function startDrag(event) {
* dragControls.start(event, { snapToCursor: true })
* }
*
* return (
* <>
* <div onPointerDown={startDrag} />
* <motion.div drag="x" dragControls={dragControls} />
* </>
* )
* ```
*
* @public
*/
function useDragControls() {
return useConstant(createDragControls);
}
export { DragControls, useDragControls };
@@ -0,0 +1,50 @@
"use strict"
const { READ } = require("@eslint-community/eslint-utils")
/**
* @satisfies {import('../types.js').SupportVersionTraceMap}
*/
const sqlite = {
constants: {
[READ]: { supported: ["22.13.0", "23.5.0"] },
SQLITE_CHANGESET_OMIT: { [READ]: { supported: ["22.13.0", "23.5.0"] } },
SQLITE_CHANGESET_REPLACE: {
[READ]: { supported: ["22.13.0", "23.5.0"] },
},
SQLITE_CHANGESET_ABORT: {
[READ]: { supported: ["22.13.0", "23.5.0"] },
},
},
backup: { [READ]: { supported: ["22.16.0", "23.8.0"] } },
DatabaseSync: { [READ]: { supported: ["22.5.0"] } },
StatementSync: { [READ]: { supported: ["22.5.0"] } },
SQLITE_CHANGESET_OMIT: {
[READ]: {
experimental: ["22.12.0"],
deprecated: ["22.13.0"],
},
},
SQLITE_CHANGESET_REPLACE: {
[READ]: {
experimental: ["22.12.0"],
deprecated: ["22.13.0"],
},
},
SQLITE_CHANGESET_ABORT: {
[READ]: {
experimental: ["22.12.0"],
deprecated: ["22.13.0"],
},
},
}
/**
* @satisfies {import('../types.js').SupportVersionTraceMap}
*/
module.exports = {
"node:sqlite": {
[READ]: { experimental: ["22.5.0"] },
...sqlite,
},
}
@@ -0,0 +1,29 @@
/**
* @author Toru Nagashima <https://github.com/mysticatea>
* See LICENSE file in root directory for full license.
*/
"use strict"
module.exports = {
meta: {
docs: {
description: "disallow generator function declarations.",
category: "ES2015",
recommended: false,
url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-generators.html",
},
fixable: null,
messages: {
forbidden: "ES2015 generator function declarations are forbidden.",
},
schema: [],
type: "problem",
},
create(context) {
return {
":function[generator=true]"(node) {
context.report({ node, messageId: "forbidden" })
},
}
},
}
@@ -0,0 +1,8 @@
"use client";
import {
HeroUIProvider
} from "./chunk-3KFOFPK7.mjs";
import "./chunk-Q3W45BN5.mjs";
export {
HeroUIProvider
};
@@ -0,0 +1,379 @@
'use strict';var _slicedToArray = function () {function sliceIterator(arr, i) {var _arr = [];var _n = true;var _d = false;var _e = undefined;try {for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {_arr.push(_s.value);if (i && _arr.length === i) break;}} catch (err) {_d = true;_e = err;} finally {try {if (!_n && _i["return"]) _i["return"]();} finally {if (_d) throw _e;}}return _arr;}return function (arr, i) {if (Array.isArray(arr)) {return arr;} else if (Symbol.iterator in Object(arr)) {return sliceIterator(arr, i);} else {throw new TypeError("Invalid attempt to destructure non-iterable instance");}};}();var _contextCompat = require('eslint-module-utils/contextCompat');
var _resolve = require('eslint-module-utils/resolve');var _resolve2 = _interopRequireDefault(_resolve);
var _semver = require('semver');var _semver2 = _interopRequireDefault(_semver);
var _arrayPrototype = require('array.prototype.flatmap');var _arrayPrototype2 = _interopRequireDefault(_arrayPrototype);
var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };}function _toArray(arr) {return Array.isArray(arr) ? arr : Array.from(arr);}
var typescriptPkg = void 0;
try {
typescriptPkg = require('typescript/package.json'); // eslint-disable-line import/no-extraneous-dependencies
} catch (e) {/**/}
function isPunctuator(node, value) {
return node.type === 'Punctuator' && node.value === value;
}
// Get the name of the default import of `node`, if any.
function getDefaultImportName(node) {
var defaultSpecifier = node.specifiers.
find(function (specifier) {return specifier.type === 'ImportDefaultSpecifier';});
return defaultSpecifier != null ? defaultSpecifier.local.name : undefined;
}
// Checks whether `node` has a namespace import.
function hasNamespace(node) {
var specifiers = node.specifiers.
filter(function (specifier) {return specifier.type === 'ImportNamespaceSpecifier';});
return specifiers.length > 0;
}
// Checks whether `node` has any non-default specifiers.
function hasSpecifiers(node) {
var specifiers = node.specifiers.
filter(function (specifier) {return specifier.type === 'ImportSpecifier';});
return specifiers.length > 0;
}
// Checks whether `node` has a comment (that ends) on the previous line or on
// the same line as `node` (starts).
function hasCommentBefore(node, sourceCode) {
return sourceCode.getCommentsBefore(node).
some(function (comment) {return comment.loc.end.line >= node.loc.start.line - 1;});
}
// Checks whether `node` has a comment (that starts) on the same line as `node`
// (ends).
function hasCommentAfter(node, sourceCode) {
return sourceCode.getCommentsAfter(node).
some(function (comment) {return comment.loc.start.line === node.loc.end.line;});
}
// Checks whether `node` has any comments _inside,_ except inside the `{...}`
// part (if any).
function hasCommentInsideNonSpecifiers(node, sourceCode) {
var tokens = sourceCode.getTokens(node);
var openBraceIndex = tokens.findIndex(function (token) {return isPunctuator(token, '{');});
var closeBraceIndex = tokens.findIndex(function (token) {return isPunctuator(token, '}');});
// Slice away the first token, since we're no looking for comments _before_
// `node` (only inside). If there's a `{...}` part, look for comments before
// the `{`, but not before the `}` (hence the `+1`s).
var someTokens = openBraceIndex >= 0 && closeBraceIndex >= 0 ?
tokens.slice(1, openBraceIndex + 1).concat(tokens.slice(closeBraceIndex + 1)) :
tokens.slice(1);
return someTokens.some(function (token) {return sourceCode.getCommentsBefore(token).length > 0;});
}
// It's not obvious what the user wants to do with comments associated with
// duplicate imports, so skip imports with comments when autofixing.
function hasProblematicComments(node, sourceCode) {
return (
hasCommentBefore(node, sourceCode) ||
hasCommentAfter(node, sourceCode) ||
hasCommentInsideNonSpecifiers(node, sourceCode));
}
/** @type {(first: import('estree').ImportDeclaration, rest: import('estree').ImportDeclaration[], sourceCode: import('eslint').SourceCode.SourceCode, context: import('eslint').Rule.RuleContext) => import('eslint').Rule.ReportFixer | undefined} */
function getFix(first, rest, sourceCode, context) {
// Sorry ESLint <= 3 users, no autofix for you. Autofixing duplicate imports
// requires multiple `fixer.whatever()` calls in the `fix`: We both need to
// update the first one, and remove the rest. Support for multiple
// `fixer.whatever()` in a single `fix` was added in ESLint 4.1.
// `sourceCode.getCommentsBefore` was added in 4.0, so that's an easy thing to
// check for.
if (typeof sourceCode.getCommentsBefore !== 'function') {
return undefined;
}
// Adjusting the first import might make it multiline, which could break
// `eslint-disable-next-line` comments and similar, so bail if the first
// import has comments. Also, if the first import is `import * as ns from
// './foo'` there's nothing we can do.
if (hasProblematicComments(first, sourceCode) || hasNamespace(first)) {
return undefined;
}
var defaultImportNames = new Set(
(0, _arrayPrototype2['default'])([].concat(first, rest || []), function (x) {return getDefaultImportName(x) || [];}));
// Bail if there are multiple different default import names – it's up to the
// user to choose which one to keep.
if (defaultImportNames.size > 1) {
return undefined;
}
// Leave it to the user to handle comments. Also skip `import * as ns from
// './foo'` imports, since they cannot be merged into another import.
var restWithoutComments = rest.filter(function (node) {return !hasProblematicComments(node, sourceCode) && !hasNamespace(node);});
var specifiers = restWithoutComments.
map(function (node) {
var tokens = sourceCode.getTokens(node);
var openBrace = tokens.find(function (token) {return isPunctuator(token, '{');});
var closeBrace = tokens.find(function (token) {return isPunctuator(token, '}');});
if (openBrace == null || closeBrace == null) {
return undefined;
}
return {
importNode: node,
identifiers: sourceCode.text.slice(openBrace.range[1], closeBrace.range[0]).split(','), // Split the text into separate identifiers (retaining any whitespace before or after)
isEmpty: !hasSpecifiers(node) };
}).
filter(function (x) {return !!x;});
var unnecessaryImports = restWithoutComments.filter(function (node) {return !hasSpecifiers(node) &&
!hasNamespace(node) &&
!specifiers.some(function (specifier) {return specifier.importNode === node;});});
var shouldAddDefault = getDefaultImportName(first) == null && defaultImportNames.size === 1;
var shouldAddSpecifiers = specifiers.length > 0;
var shouldRemoveUnnecessary = unnecessaryImports.length > 0;
var preferInline = context.options[0] && context.options[0]['prefer-inline'];
if (!(shouldAddDefault || shouldAddSpecifiers || shouldRemoveUnnecessary)) {
return undefined;
}
/** @type {import('eslint').Rule.ReportFixer} */
return function (fixer) {
var tokens = sourceCode.getTokens(first);
var openBrace = tokens.find(function (token) {return isPunctuator(token, '{');});
var closeBrace = tokens.find(function (token) {return isPunctuator(token, '}');});
var firstToken = sourceCode.getFirstToken(first);var _defaultImportNames = _slicedToArray(
defaultImportNames, 1),defaultImportName = _defaultImportNames[0];
var firstHasTrailingComma = closeBrace != null && isPunctuator(sourceCode.getTokenBefore(closeBrace), ',');
var firstIsEmpty = !hasSpecifiers(first);
var firstExistingIdentifiers = firstIsEmpty ?
new Set() :
new Set(sourceCode.text.slice(openBrace.range[1], closeBrace.range[0]).
split(',').
map(function (x) {return x.trim();}));var _specifiers$reduce =
specifiers.reduce(
function (_ref, specifier) {var _ref2 = _slicedToArray(_ref, 3),result = _ref2[0],needsComma = _ref2[1],existingIdentifiers = _ref2[2];
var isTypeSpecifier = specifier.importNode.importKind === 'type';
// a user might set prefer-inline but not have a supporting TypeScript version. Flow does not support inline types so this should fail in that case as well.
if (preferInline && (!typescriptPkg || !_semver2['default'].satisfies(typescriptPkg.version, '>= 4.5'))) {
throw new Error('Your version of TypeScript does not support inline type imports.');
}
// Add *only* the new identifiers that don't already exist, and track any new identifiers so we don't add them again in the next loop
var _specifier$identifier = specifier.identifiers.reduce(function (_ref3, cur) {var _ref4 = _slicedToArray(_ref3, 2),text = _ref4[0],set = _ref4[1];
var trimmed = cur.trim(); // Trim whitespace before/after to compare to our set of existing identifiers
var curWithType = trimmed.length > 0 && preferInline && isTypeSpecifier ? 'type ' + String(cur) : cur;
if (existingIdentifiers.has(trimmed)) {
return [text, set];
}
return [text.length > 0 ? String(text) + ',' + String(curWithType) : curWithType, set.add(trimmed)];
}, ['', existingIdentifiers]),_specifier$identifier2 = _slicedToArray(_specifier$identifier, 2),specifierText = _specifier$identifier2[0],updatedExistingIdentifiers = _specifier$identifier2[1];
return [
needsComma && !specifier.isEmpty && specifierText.length > 0 ? String(
result) + ',' + String(specifierText) : '' + String(
result) + String(specifierText),
specifier.isEmpty ? needsComma : true,
updatedExistingIdentifiers];
},
['', !firstHasTrailingComma && !firstIsEmpty, firstExistingIdentifiers]),_specifiers$reduce2 = _slicedToArray(_specifiers$reduce, 1),specifiersText = _specifiers$reduce2[0];
/** @type {import('eslint').Rule.Fix[]} */
var fixes = [];
if (shouldAddSpecifiers && preferInline && first.importKind === 'type') {
// `import type {a} from './foo'` → `import {type a} from './foo'`
var typeIdentifierToken = tokens.find(function (token) {return token.type === 'Identifier' && token.value === 'type';});
fixes.push(fixer.removeRange([typeIdentifierToken.range[0], typeIdentifierToken.range[1] + 1]));
tokens.
filter(function (token) {return firstExistingIdentifiers.has(token.value);}).
forEach(function (identifier) {
fixes.push(fixer.replaceTextRange([identifier.range[0], identifier.range[1]], 'type ' + String(identifier.value)));
});
}
if (shouldAddDefault && openBrace == null && shouldAddSpecifiers) {
// `import './foo'` → `import def, {...} from './foo'`
fixes.push(
fixer.insertTextAfter(firstToken, ' ' + String(defaultImportName) + ', {' + String(specifiersText) + '} from'));
} else if (shouldAddDefault && openBrace == null && !shouldAddSpecifiers) {
// `import './foo'` → `import def from './foo'`
fixes.push(fixer.insertTextAfter(firstToken, ' ' + String(defaultImportName) + ' from'));
} else if (shouldAddDefault && openBrace != null && closeBrace != null) {
// `import {...} from './foo'` → `import def, {...} from './foo'`
fixes.push(fixer.insertTextAfter(firstToken, ' ' + String(defaultImportName) + ','));
if (shouldAddSpecifiers) {
// `import def, {...} from './foo'` → `import def, {..., ...} from './foo'`
fixes.push(fixer.insertTextBefore(closeBrace, specifiersText));
}
} else if (!shouldAddDefault && openBrace == null && shouldAddSpecifiers) {
if (first.specifiers.length === 0) {
// `import './foo'` → `import {...} from './foo'`
fixes.push(fixer.insertTextAfter(firstToken, ' {' + String(specifiersText) + '} from'));
} else {
// `import def from './foo'` → `import def, {...} from './foo'`
fixes.push(fixer.insertTextAfter(first.specifiers[0], ', {' + String(specifiersText) + '}'));
}
} else if (!shouldAddDefault && openBrace != null && closeBrace != null) {
// `import {...} './foo'` → `import {..., ...} from './foo'`
fixes.push(fixer.insertTextBefore(closeBrace, specifiersText));
}
// Remove imports whose specifiers have been moved into the first import.
specifiers.forEach(function (specifier) {
var importNode = specifier.importNode;
fixes.push(fixer.remove(importNode));
var charAfterImportRange = [importNode.range[1], importNode.range[1] + 1];
var charAfterImport = sourceCode.text.substring(charAfterImportRange[0], charAfterImportRange[1]);
if (charAfterImport === '\n') {
fixes.push(fixer.removeRange(charAfterImportRange));
}
});
// Remove imports whose default import has been moved to the first import,
// and side-effect-only imports that are unnecessary due to the first
// import.
unnecessaryImports.forEach(function (node) {
fixes.push(fixer.remove(node));
var charAfterImportRange = [node.range[1], node.range[1] + 1];
var charAfterImport = sourceCode.text.substring(charAfterImportRange[0], charAfterImportRange[1]);
if (charAfterImport === '\n') {
fixes.push(fixer.removeRange(charAfterImportRange));
}
});
return fixes;
};
}
/** @type {(imported: Map<string, import('estree').ImportDeclaration[]>, context: import('eslint').Rule.RuleContext) => void} */
function checkImports(imported, context) {var _iteratorNormalCompletion = true;var _didIteratorError = false;var _iteratorError = undefined;try {
for (var _iterator = imported.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {var _ref5 = _step.value;var _ref6 = _slicedToArray(_ref5, 2);var _module = _ref6[0];var nodes = _ref6[1];
if (nodes.length > 1) {(function () {
var message = '\'' + String(_module) + '\' imported multiple times.';var _nodes = _toArray(
nodes),first = _nodes[0],rest = _nodes.slice(1);
var sourceCode = (0, _contextCompat.getSourceCode)(context);
var fix = getFix(first, rest, sourceCode, context);
context.report({
node: first.source,
message: message,
fix: fix // Attach the autofix (if any) to the first import.
});
rest.forEach(function (node) {
context.report({
node: node.source,
message: message });
});})();
}
}} catch (err) {_didIteratorError = true;_iteratorError = err;} finally {try {if (!_iteratorNormalCompletion && _iterator['return']) {_iterator['return']();}} finally {if (_didIteratorError) {throw _iteratorError;}}}
}
/** @type {import('eslint').Rule.RuleModule} */
module.exports = {
meta: {
type: 'problem',
docs: {
category: 'Style guide',
description: 'Forbid repeated import of the same module in multiple places.',
url: (0, _docsUrl2['default'])('no-duplicates') },
fixable: 'code',
schema: [
{
type: 'object',
properties: {
considerQueryString: {
type: 'boolean' },
'prefer-inline': {
type: 'boolean' } },
additionalProperties: false }] },
/** @param {import('eslint').Rule.RuleContext} context */
create: function () {function create(context) {
/** @type {boolean} */
// Prepare the resolver from options.
var considerQueryStringOption = context.options[0] && context.options[0].considerQueryString;
/** @type {boolean} */
var preferInline = context.options[0] && context.options[0]['prefer-inline'];
var defaultResolver = function () {function defaultResolver(sourcePath) {return (0, _resolve2['default'])(sourcePath, context) || sourcePath;}return defaultResolver;}();
var resolver = considerQueryStringOption ? function (sourcePath) {
var parts = sourcePath.match(/^([^?]*)\?(.*)$/);
if (!parts) {
return defaultResolver(sourcePath);
}
return String(defaultResolver(parts[1])) + '?' + String(parts[2]);
} : defaultResolver;
/** @type {Map<unknown, { imported: Map<string, import('estree').ImportDeclaration[]>, nsImported: Map<string, import('estree').ImportDeclaration[]>, defaultTypesImported: Map<string, import('estree').ImportDeclaration[]>, namedTypesImported: Map<string, import('estree').ImportDeclaration[]>}>} */
var moduleMaps = new Map();
/** @param {import('estree').ImportDeclaration} n */
/** @returns {typeof moduleMaps[keyof typeof moduleMaps]} */
function getImportMap(n) {
if (!moduleMaps.has(n.parent)) {
moduleMaps.set(n.parent, /** @type {typeof moduleMaps} */{
imported: new Map(),
nsImported: new Map(),
defaultTypesImported: new Map(),
namedTypesImported: new Map() });
}
var map = moduleMaps.get(n.parent);
if (!preferInline && n.importKind === 'type') {
return n.specifiers.length > 0 && n.specifiers[0].type === 'ImportDefaultSpecifier' ? map.defaultTypesImported : map.namedTypesImported;
}
if (!preferInline && n.specifiers.some(function (spec) {return spec.importKind === 'type';})) {
return map.namedTypesImported;
}
return hasNamespace(n) ? map.nsImported : map.imported;
}
return {
/** @param {import('estree').ImportDeclaration} n */
ImportDeclaration: function () {function ImportDeclaration(n) {
/** @type {string} */
// resolved path will cover aliased duplicates
var resolvedPath = resolver(n.source.value);
var importMap = getImportMap(n);
if (importMap.has(resolvedPath)) {
importMap.get(resolvedPath).push(n);
} else {
importMap.set(resolvedPath, [n]);
}
}return ImportDeclaration;}(),
'Program:exit': function () {function ProgramExit() {var _iteratorNormalCompletion2 = true;var _didIteratorError2 = false;var _iteratorError2 = undefined;try {
for (var _iterator2 = moduleMaps.values()[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {var map = _step2.value;
checkImports(map.imported, context);
checkImports(map.nsImported, context);
checkImports(map.defaultTypesImported, context);
checkImports(map.namedTypesImported, context);
}} catch (err) {_didIteratorError2 = true;_iteratorError2 = err;} finally {try {if (!_iteratorNormalCompletion2 && _iterator2['return']) {_iterator2['return']();}} finally {if (_didIteratorError2) {throw _iteratorError2;}}}
}return ProgramExit;}() };
}return create;}() };
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1kdXBsaWNhdGVzLmpzIl0sIm5hbWVzIjpbInR5cGVzY3JpcHRQa2ciLCJyZXF1aXJlIiwiZSIsImlzUHVuY3R1YXRvciIsIm5vZGUiLCJ2YWx1ZSIsInR5cGUiLCJnZXREZWZhdWx0SW1wb3J0TmFtZSIsImRlZmF1bHRTcGVjaWZpZXIiLCJzcGVjaWZpZXJzIiwiZmluZCIsInNwZWNpZmllciIsImxvY2FsIiwibmFtZSIsInVuZGVmaW5lZCIsImhhc05hbWVzcGFjZSIsImZpbHRlciIsImxlbmd0aCIsImhhc1NwZWNpZmllcnMiLCJoYXNDb21tZW50QmVmb3JlIiwic291cmNlQ29kZSIsImdldENvbW1lbnRzQmVmb3JlIiwic29tZSIsImNvbW1lbnQiLCJsb2MiLCJlbmQiLCJsaW5lIiwic3RhcnQiLCJoYXNDb21tZW50QWZ0ZXIiLCJnZXRDb21tZW50c0FmdGVyIiwiaGFzQ29tbWVudEluc2lkZU5vblNwZWNpZmllcnMiLCJ0b2tlbnMiLCJnZXRUb2tlbnMiLCJvcGVuQnJhY2VJbmRleCIsImZpbmRJbmRleCIsInRva2VuIiwiY2xvc2VCcmFjZUluZGV4Iiwic29tZVRva2VucyIsInNsaWNlIiwiY29uY2F0IiwiaGFzUHJvYmxlbWF0aWNDb21tZW50cyIsImdldEZpeCIsImZpcnN0IiwicmVzdCIsImNvbnRleHQiLCJkZWZhdWx0SW1wb3J0TmFtZXMiLCJTZXQiLCJ4Iiwic2l6ZSIsInJlc3RXaXRob3V0Q29tbWVudHMiLCJtYXAiLCJvcGVuQnJhY2UiLCJjbG9zZUJyYWNlIiwiaW1wb3J0Tm9kZSIsImlkZW50aWZpZXJzIiwidGV4dCIsInJhbmdlIiwic3BsaXQiLCJpc0VtcHR5IiwidW5uZWNlc3NhcnlJbXBvcnRzIiwic2hvdWxkQWRkRGVmYXVsdCIsInNob3VsZEFkZFNwZWNpZmllcnMiLCJzaG91bGRSZW1vdmVVbm5lY2Vzc2FyeSIsInByZWZlcklubGluZSIsIm9wdGlvbnMiLCJmaXhlciIsImZpcnN0VG9rZW4iLCJnZXRGaXJzdFRva2VuIiwiZGVmYXVsdEltcG9ydE5hbWUiLCJmaXJzdEhhc1RyYWlsaW5nQ29tbWEiLCJnZXRUb2tlbkJlZm9yZSIsImZpcnN0SXNFbXB0eSIsImZpcnN0RXhpc3RpbmdJZGVudGlmaWVycyIsInRyaW0iLCJyZWR1Y2UiLCJyZXN1bHQiLCJuZWVkc0NvbW1hIiwiZXhpc3RpbmdJZGVudGlmaWVycyIsImlzVHlwZVNwZWNpZmllciIsImltcG9ydEtpbmQiLCJzZW12ZXIiLCJzYXRpc2ZpZXMiLCJ2ZXJzaW9uIiwiRXJyb3IiLCJjdXIiLCJzZXQiLCJ0cmltbWVkIiwiY3VyV2l0aFR5cGUiLCJoYXMiLCJhZGQiLCJzcGVjaWZpZXJUZXh0IiwidXBkYXRlZEV4aXN0aW5nSWRlbnRpZmllcnMiLCJzcGVjaWZpZXJzVGV4dCIsImZpeGVzIiwidHlwZUlkZW50aWZpZXJUb2tlbiIsInB1c2giLCJyZW1vdmVSYW5nZSIsImZvckVhY2giLCJpZGVudGlmaWVyIiwicmVwbGFjZVRleHRSYW5nZSIsImluc2VydFRleHRBZnRlciIsImluc2VydFRleHRCZWZvcmUiLCJyZW1vdmUiLCJjaGFyQWZ0ZXJJbXBvcnRSYW5nZSIsImNoYXJBZnRlckltcG9ydCIsInN1YnN0cmluZyIsImNoZWNrSW1wb3J0cyIsImltcG9ydGVkIiwiZW50cmllcyIsIm1vZHVsZSIsIm5vZGVzIiwibWVzc2FnZSIsImZpeCIsInJlcG9ydCIsInNvdXJjZSIsImV4cG9ydHMiLCJtZXRhIiwiZG9jcyIsImNhdGVnb3J5IiwiZGVzY3JpcHRpb24iLCJ1cmwiLCJmaXhhYmxlIiwic2NoZW1hIiwicHJvcGVydGllcyIsImNvbnNpZGVyUXVlcnlTdHJpbmciLCJhZGRpdGlvbmFsUHJvcGVydGllcyIsImNyZWF0ZSIsImNvbnNpZGVyUXVlcnlTdHJpbmdPcHRpb24iLCJkZWZhdWx0UmVzb2x2ZXIiLCJzb3VyY2VQYXRoIiwicmVzb2x2ZXIiLCJwYXJ0cyIsIm1hdGNoIiwibW9kdWxlTWFwcyIsIk1hcCIsImdldEltcG9ydE1hcCIsIm4iLCJwYXJlbnQiLCJuc0ltcG9ydGVkIiwiZGVmYXVsdFR5cGVzSW1wb3J0ZWQiLCJuYW1lZFR5cGVzSW1wb3J0ZWQiLCJnZXQiLCJzcGVjIiwiSW1wb3J0RGVjbGFyYXRpb24iLCJyZXNvbHZlZFBhdGgiLCJpbXBvcnRNYXAiLCJ2YWx1ZXMiXSwibWFwcGluZ3MiOiJxb0JBQUE7QUFDQSxzRDtBQUNBLGdDO0FBQ0EseUQ7O0FBRUEscUM7O0FBRUEsSUFBSUEsc0JBQUo7QUFDQSxJQUFJO0FBQ0ZBLGtCQUFnQkMsUUFBUSx5QkFBUixDQUFoQixDQURFLENBQ2tEO0FBQ3JELENBRkQsQ0FFRSxPQUFPQyxDQUFQLEVBQVUsQ0FBRSxJQUFNOztBQUVwQixTQUFTQyxZQUFULENBQXNCQyxJQUF0QixFQUE0QkMsS0FBNUIsRUFBbUM7QUFDakMsU0FBT0QsS0FBS0UsSUFBTCxLQUFjLFlBQWQsSUFBOEJGLEtBQUtDLEtBQUwsS0FBZUEsS0FBcEQ7QUFDRDs7QUFFRDtBQUNBLFNBQVNFLG9CQUFULENBQThCSCxJQUE5QixFQUFvQztBQUNsQyxNQUFNSSxtQkFBbUJKLEtBQUtLLFVBQUw7QUFDdEJDLE1BRHNCLENBQ2pCLFVBQUNDLFNBQUQsVUFBZUEsVUFBVUwsSUFBVixLQUFtQix3QkFBbEMsRUFEaUIsQ0FBekI7QUFFQSxTQUFPRSxvQkFBb0IsSUFBcEIsR0FBMkJBLGlCQUFpQkksS0FBakIsQ0FBdUJDLElBQWxELEdBQXlEQyxTQUFoRTtBQUNEOztBQUVEO0FBQ0EsU0FBU0MsWUFBVCxDQUFzQlgsSUFBdEIsRUFBNEI7QUFDMUIsTUFBTUssYUFBYUwsS0FBS0ssVUFBTDtBQUNoQk8sUUFEZ0IsQ0FDVCxVQUFDTCxTQUFELFVBQWVBLFVBQVVMLElBQVYsS0FBbUIsMEJBQWxDLEVBRFMsQ0FBbkI7QUFFQSxTQUFPRyxXQUFXUSxNQUFYLEdBQW9CLENBQTNCO0FBQ0Q7O0FBRUQ7QUFDQSxTQUFTQyxhQUFULENBQXVCZCxJQUF2QixFQUE2QjtBQUMzQixNQUFNSyxhQUFhTCxLQUFLSyxVQUFMO0FBQ2hCTyxRQURnQixDQUNULFVBQUNMLFNBQUQsVUFBZUEsVUFBVUwsSUFBVixLQUFtQixpQkFBbEMsRUFEUyxDQUFuQjtBQUVBLFNBQU9HLFdBQVdRLE1BQVgsR0FBb0IsQ0FBM0I7QUFDRDs7QUFFRDtBQUNBO0FBQ0EsU0FBU0UsZ0JBQVQsQ0FBMEJmLElBQTFCLEVBQWdDZ0IsVUFBaEMsRUFBNEM7QUFDMUMsU0FBT0EsV0FBV0MsaUJBQVgsQ0FBNkJqQixJQUE3QjtBQUNKa0IsTUFESSxDQUNDLFVBQUNDLE9BQUQsVUFBYUEsUUFBUUMsR0FBUixDQUFZQyxHQUFaLENBQWdCQyxJQUFoQixJQUF3QnRCLEtBQUtvQixHQUFMLENBQVNHLEtBQVQsQ0FBZUQsSUFBZixHQUFzQixDQUEzRCxFQURELENBQVA7QUFFRDs7QUFFRDtBQUNBO0FBQ0EsU0FBU0UsZUFBVCxDQUF5QnhCLElBQXpCLEVBQStCZ0IsVUFBL0IsRUFBMkM7QUFDekMsU0FBT0EsV0FBV1MsZ0JBQVgsQ0FBNEJ6QixJQUE1QjtBQUNKa0IsTUFESSxDQUNDLFVBQUNDLE9BQUQsVUFBYUEsUUFBUUMsR0FBUixDQUFZRyxLQUFaLENBQWtCRCxJQUFsQixLQUEyQnRCLEtBQUtvQixHQUFMLENBQVNDLEdBQVQsQ0FBYUMsSUFBckQsRUFERCxDQUFQO0FBRUQ7O0FBRUQ7QUFDQTtBQUNBLFNBQVNJLDZCQUFULENBQXVDMUIsSUFBdkMsRUFBNkNnQixVQUE3QyxFQUF5RDtBQUN2RCxNQUFNVyxTQUFTWCxXQUFXWSxTQUFYLENBQXFCNUIsSUFBckIsQ0FBZjtBQUNBLE1BQU02QixpQkFBaUJGLE9BQU9HLFNBQVAsQ0FBaUIsVUFBQ0MsS0FBRCxVQUFXaEMsYUFBYWdDLEtBQWIsRUFBb0IsR0FBcEIsQ0FBWCxFQUFqQixDQUF2QjtBQUNBLE1BQU1DLGtCQUFrQkwsT0FBT0csU0FBUCxDQUFpQixVQUFDQyxLQUFELFVBQVdoQyxhQUFhZ0MsS0FBYixFQUFvQixHQUFwQixDQUFYLEVBQWpCLENBQXhCO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsTUFBTUUsYUFBYUosa0JBQWtCLENBQWxCLElBQXVCRyxtQkFBbUIsQ0FBMUM7QUFDZkwsU0FBT08sS0FBUCxDQUFhLENBQWIsRUFBZ0JMLGlCQUFpQixDQUFqQyxFQUFvQ00sTUFBcEMsQ0FBMkNSLE9BQU9Line truncated
@@ -0,0 +1 @@
{"version":3,"file":"isParentBindingConstraintsWithTag.spec.d.ts","sourceRoot":"","sources":["../../../../src/binding/calculations/isParentBindingConstraintsWithTag.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
type CachedKey = string | number;
declare const getCachePromise: (cacheKey: CachedKey) => Promise<any> | undefined;
declare const setCachePromise: (cacheKey: CachedKey, promise: Promise<any>) => void;
export { getCachePromise, setCachePromise };
@@ -0,0 +1,65 @@
import { AlwaysDelay } from "./always.delay";
import { IBackOffOptions, getSanitizedOptions } from "../../options";
describe(AlwaysDelay.name, () => {
let options: IBackOffOptions;
let delay: AlwaysDelay;
function initClass() {
delay = new AlwaysDelay(options);
}
beforeEach(() => {
options = getSanitizedOptions({});
initClass();
jest.useFakeTimers();
});
it(`when calling #apply, the delay is equal to the starting delay`, async () => {
const spy = jest.fn();
delay.apply().then(spy);
jest.runTimersToTime(options.startingDelay);
await Promise.resolve();
expect(spy).toHaveBeenCalledTimes(1);
});
it(`when the attempt number is 1, when calling #apply,
the delay is equal to the starting delay multiplied by the time multiple`, async () => {
delay.setAttemptNumber(1);
const spy = jest.fn();
delay.apply().then(spy);
jest.runTimersToTime(options.startingDelay * options.timeMultiple);
await Promise.resolve();
expect(spy).toHaveBeenCalledTimes(1);
});
it(`when the attempt number is 2, when calling #apply,
the delay is equal to the starting delay multiplied by the time multiple raised by the attempt number`, async () => {
const attemptNumber = 2;
delay.setAttemptNumber(attemptNumber);
const spy = jest.fn();
delay.apply().then(spy);
jest.runTimersToTime(
options.startingDelay * Math.pow(options.timeMultiple, attemptNumber)
);
await Promise.resolve();
expect(spy).toHaveBeenCalledTimes(1);
});
it(`when the #maxDelay is less than #startingDelay, when calling #apply,
the delay is equal to the #maxDelay`, async () => {
options.maxDelay = options.startingDelay - 1;
const spy = jest.fn();
delay.apply().then(spy);
jest.runTimersToTime(options.maxDelay);
await Promise.resolve();
expect(spy).toHaveBeenCalledTimes(1);
});
});
@@ -0,0 +1 @@
{"version":3,"names":["inferers","require","_t","anyTypeAnnotation","isAnyTypeAnnotation","isArrayTypeAnnotation","isBooleanTypeAnnotation","isEmptyTypeAnnotation","isFlowBaseAnnotation","isGenericTypeAnnotation","isIdentifier","isMixedTypeAnnotation","isNumberTypeAnnotation","isStringTypeAnnotation","isTSArrayType","isTSTypeAnnotation","isTSTypeReference","isTupleTypeAnnotation","isTypeAnnotation","isUnionTypeAnnotation","isVoidTypeAnnotation","stringTypeAnnotation","voidTypeAnnotation","getTypeAnnotation","type","getData","_getTypeAnnotation","call","typeAnnotation","setData","typeAnnotationInferringNodes","WeakSet","node","key","parentPath","isVariableDeclarator","declar","declarParent","isForInStatement","isForOfStatement","has","add","_inferer","inferer","validParent","delete","isBaseType","baseName","soft","_isBaseType","Error","couldBeBaseType","name","type2","types","baseTypeStrictlyMatches","rightArg","left","right","isGenericType","genericName","id","typeName"],"sources":["../../../src/path/inference/index.ts"],"sourcesContent":["import type NodePath from \"../index.ts\";\nimport * as inferers from \"./inferers.ts\";\nimport {\n anyTypeAnnotation,\n isAnyTypeAnnotation,\n isArrayTypeAnnotation,\n isBooleanTypeAnnotation,\n isEmptyTypeAnnotation,\n isFlowBaseAnnotation,\n isGenericTypeAnnotation,\n isIdentifier,\n isMixedTypeAnnotation,\n isNumberTypeAnnotation,\n isStringTypeAnnotation,\n isTSArrayType,\n isTSTypeAnnotation,\n isTSTypeReference,\n isTupleTypeAnnotation,\n isTypeAnnotation,\n isUnionTypeAnnotation,\n isVoidTypeAnnotation,\n stringTypeAnnotation,\n voidTypeAnnotation,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\n\n/**\n * Infer the type of the current `NodePath`.\n */\n\nexport function getTypeAnnotation(this: NodePath): t.FlowType | t.TSType {\n let type = this.getData(\"typeAnnotation\");\n if (type != null) {\n return type;\n }\n type = _getTypeAnnotation.call(this) || anyTypeAnnotation();\n if (isTypeAnnotation(type) || isTSTypeAnnotation(type)) {\n type = type.typeAnnotation;\n }\n this.setData(\"typeAnnotation\", type);\n return type;\n}\n\n// Used to avoid infinite recursion in cases like\n// var b, c; if (0) { c = 1; b = c; } c = b;\n// It also works with indirect recursion.\nconst typeAnnotationInferringNodes = new WeakSet();\n\n/**\n * todo: split up this method\n */\n\nexport function _getTypeAnnotation(this: NodePath): any {\n const node = this.node;\n\n if (!node) {\n // handle initializerless variables, add in checks for loop initializers too\n if (this.key === \"init\" && this.parentPath.isVariableDeclarator()) {\n const declar = this.parentPath.parentPath;\n const declarParent = declar.parentPath;\n\n // for (let NODE in bar) {}\n if (declar.key === \"left\" && declarParent.isForInStatement()) {\n return stringTypeAnnotation();\n }\n\n // for (let NODE of bar) {}\n if (declar.key === \"left\" && declarParent.isForOfStatement()) {\n return anyTypeAnnotation();\n }\n\n return voidTypeAnnotation();\n } else {\n return;\n }\n }\n\n // @ts-expect-error typeAnnotation may not index node\n if (node.typeAnnotation) {\n // @ts-expect-error typeAnnotation may not index node\n return node.typeAnnotation;\n }\n\n if (typeAnnotationInferringNodes.has(node)) {\n // Bail out from type inference to avoid infinite loops\n return;\n }\n typeAnnotationInferringNodes.add(node);\n\n try {\n let inferer =\n // @ts-expect-error inferers do not cover all AST types\n inferers[node.type];\n if (inferer) {\n return inferer.call(this, node);\n }\n\n // @ts-expect-error inferers do not cover all AST types\n inferer = inferers[this.parentPath.type];\n if (inferer?.validParent) {\n return this.parentPath.getTypeAnnotation();\n }\n } finally {\n typeAnnotationInferringNodes.delete(node);\n }\n}\n\nexport function isBaseType(\n this: NodePath,\n baseName: string,\n soft?: boolean,\n): boolean {\n return _isBaseType(baseName, this.getTypeAnnotation(), soft);\n}\n\nfunction _isBaseType(\n baseName: string,\n type?: t.FlowType | t.TSType,\n soft?: boolean,\n): boolean {\n if (baseName === \"string\") {\n return isStringTypeAnnotation(type);\n } else if (baseName === \"number\") {\n return isNumberTypeAnnotation(type);\n } else if (baseName === \"boolean\") {\n return isBooleanTypeAnnotation(type);\n } else if (baseName === \"any\") {\n return isAnyTypeAnnotation(type);\n } else if (baseName === \"mixed\") {\n return isMixedTypeAnnotation(type);\n } else if (baseName === \"empty\") {\n return isEmptyTypeAnnotation(type);\n } else if (baseName === \"void\") {\n return isVoidTypeAnnotation(type);\n } else {\n if (soft) {\n return false;\n } else {\n throw new Error(`Unknown base type ${baseName}`);\n }\n }\n}\n\nexport function couldBeBaseType(thisLine truncated
@@ -0,0 +1,65 @@
{
"root": true,
"extends": "@ljharb",
"rules": {
"indent": [2, 4],
"strict": 0,
"complexity": 0,
"consistent-return": 0,
"curly": 0,
"dot-notation": [2, { "allowKeywords": true }],
"func-name-matching": 0,
"func-style": 0,
"global-require": 1,
"id-length": [2, { "min": 1, "max": 40 }],
"max-lines": [2, 360],
"max-lines-per-function": 0,
"max-nested-callbacks": 0,
"max-params": 0,
"max-statements-per-line": [2, { "max": 2 }],
"max-statements": 0,
"no-magic-numbers": 0,
"no-shadow": 0,
"no-use-before-define": 0,
"sort-keys": 0,
},
"overrides": [
{
"files": "bin/**",
"rules": {
"no-process-exit": "off",
},
},
{
"files": "example/**",
"rules": {
"no-console": 0,
},
},
{
"files": "test/resolver/nested_symlinks/mylib/*.js",
"rules": {
"no-throw-literal": 0,
},
},
{
"files": "test/**",
"parserOptions": {
"ecmaVersion": 5,
"allowReserved": false,
},
"rules": {
"dot-notation": [2, { "allowPattern": "throws" }],
"max-lines": 0,
"max-lines-per-function": 0,
"no-unused-vars": [2, { "vars": "all", "args": "none" }],
},
},
],
"ignorePatterns": [
"./test/resolver/malformed_package_json/package.json",
],
}
@@ -0,0 +1,272 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@typescript-eslint/utils");
const util_1 = require("../util");
var Group;
(function (Group) {
Group["conditional"] = "conditional";
Group["function"] = "function";
Group["import"] = "import";
Group["intersection"] = "intersection";
Group["keyword"] = "keyword";
Group["nullish"] = "nullish";
Group["literal"] = "literal";
Group["named"] = "named";
Group["object"] = "object";
Group["operator"] = "operator";
Group["tuple"] = "tuple";
Group["union"] = "union";
})(Group || (Group = {}));
function getGroup(node) {
switch (node.type) {
case utils_1.AST_NODE_TYPES.TSConditionalType:
return Group.conditional;
case utils_1.AST_NODE_TYPES.TSConstructorType:
case utils_1.AST_NODE_TYPES.TSFunctionType:
return Group.function;
case utils_1.AST_NODE_TYPES.TSImportType:
return Group.import;
case utils_1.AST_NODE_TYPES.TSIntersectionType:
return Group.intersection;
case utils_1.AST_NODE_TYPES.TSAnyKeyword:
case utils_1.AST_NODE_TYPES.TSBigIntKeyword:
case utils_1.AST_NODE_TYPES.TSBooleanKeyword:
case utils_1.AST_NODE_TYPES.TSNeverKeyword:
case utils_1.AST_NODE_TYPES.TSNumberKeyword:
case utils_1.AST_NODE_TYPES.TSObjectKeyword:
case utils_1.AST_NODE_TYPES.TSStringKeyword:
case utils_1.AST_NODE_TYPES.TSSymbolKeyword:
case utils_1.AST_NODE_TYPES.TSThisType:
case utils_1.AST_NODE_TYPES.TSUnknownKeyword:
case utils_1.AST_NODE_TYPES.TSIntrinsicKeyword:
return Group.keyword;
case utils_1.AST_NODE_TYPES.TSNullKeyword:
case utils_1.AST_NODE_TYPES.TSUndefinedKeyword:
case utils_1.AST_NODE_TYPES.TSVoidKeyword:
return Group.nullish;
case utils_1.AST_NODE_TYPES.TSLiteralType:
case utils_1.AST_NODE_TYPES.TSTemplateLiteralType:
return Group.literal;
case utils_1.AST_NODE_TYPES.TSArrayType:
case utils_1.AST_NODE_TYPES.TSIndexedAccessType:
case utils_1.AST_NODE_TYPES.TSInferType:
case utils_1.AST_NODE_TYPES.TSTypeReference:
case utils_1.AST_NODE_TYPES.TSQualifiedName:
return Group.named;
case utils_1.AST_NODE_TYPES.TSMappedType:
case utils_1.AST_NODE_TYPES.TSTypeLiteral:
return Group.object;
case utils_1.AST_NODE_TYPES.TSTypeOperator:
case utils_1.AST_NODE_TYPES.TSTypeQuery:
return Group.operator;
case utils_1.AST_NODE_TYPES.TSTupleType:
return Group.tuple;
case utils_1.AST_NODE_TYPES.TSUnionType:
return Group.union;
// These types should never occur as part of a union/intersection
case utils_1.AST_NODE_TYPES.TSAbstractKeyword:
case utils_1.AST_NODE_TYPES.TSAsyncKeyword:
case utils_1.AST_NODE_TYPES.TSDeclareKeyword:
case utils_1.AST_NODE_TYPES.TSExportKeyword:
case utils_1.AST_NODE_TYPES.TSNamedTupleMember:
case utils_1.AST_NODE_TYPES.TSOptionalType:
case utils_1.AST_NODE_TYPES.TSPrivateKeyword:
case utils_1.AST_NODE_TYPES.TSProtectedKeyword:
case utils_1.AST_NODE_TYPES.TSPublicKeyword:
case utils_1.AST_NODE_TYPES.TSReadonlyKeyword:
case utils_1.AST_NODE_TYPES.TSRestType:
case utils_1.AST_NODE_TYPES.TSStaticKeyword:
case utils_1.AST_NODE_TYPES.TSTypePredicate:
/* istanbul ignore next */
throw new Error(`Unexpected Type ${node.type}`);
}
}
function caseSensitiveSort(a, b) {
if (a < b) {
return -1;
}
if (a > b) {
return 1;
}
return 0;
}
exports.default = (0, util_1.createRule)({
name: 'sort-type-constituents',
meta: {
type: 'suggestion',
deprecated: {
deprecatedSince: '7.13.0',
replacedBy: [
{
plugin: {
name: 'eslint-plugin-perfectionist',
url: 'https://perfectionist.dev',
},
rule: {
name: 'perfectionist/sort-intersection-types',
url: 'https://perfectionist.dev/rules/sort-intersection-types',
},
},
{
plugin: {
name: 'eslint-plugin-perfectionist',
url: 'https://perfectionist.dev',
},
rule: {
name: 'perfectionist/sort-union-types',
url: 'https://perfectionist.dev/rules/sort-union-types',
},
},
],
url: 'https://github.com/typescript-eslint/typescript-eslint/pull/9253',
},
docs: {
description: 'Enforce constituents of a type union/intersection to be sorted alphabetically',
},
fixable: 'code',
hasSuggestions: true,
messages: {
notSorted: '{{type}} type constituents must be sorted.',
notSortedNamed: '{{type}} type {{name}} constituents must be sorted.',
suggestFix: 'Sort constituents of type (removes all comments).',
},
replacedBy: [
'perfectionist/sort-intersection-types',
'perfectionist/sort-union-types',
],
schema: [
{
type: 'object',
additionalProperties: false,
properties: {
caseSensitive: {
type: 'boolean',
description: 'Whether to sort using case sensitive string comparisons.',
},
checkIntersections: {
type: 'boolean',
description: 'Whether to check intersection types (`&`).',
},
checkUnions: {
type: 'boolean',
description: 'Whether to check union types (`|`).',
},
groupOrder: {
type: 'array',
description: 'Ordering of the groups.',
items: {
type: 'string',
enum: (0, util_1.getEnumNames)(Group),
},
},
},
},
],
},
defaultOptions: [
{
caseSensitive: false,
checkIntersections: true,
checkUnions: true,
groupOrder: [
Group.named,
Group.keyword,
Group.operator,
Group.literal,
Group.function,
Group.import,
Group.conditional,
Group.object,
Group.tuple,
Group.intersection,
Group.union,
Group.nullish,
],
},
],
create(context, [{ caseSensitive, checkIntersections, checkUnions, groupOrder }]) {
const collator = new Intl.Collator('en', {
numeric: true,
sensitivity: 'base',
});
function checkSorting(node) {
const sourceOrder = node.types.map(type => {
const group = groupOrder?.indexOf(getGroup(type)) ?? -1;
return {
node: type,
group: group === -1 ? Number.MAX_SAFE_INTEGER : group,
text: context.sourceCode.getText(type),
};
});
const expectedOrder = [...sourceOrder].sort((a, b) => {
if (a.group !== b.group) {
return a.group - b.group;
}
if (caseSensitive) {
return caseSensitiveSort(a.text, b.text);
}
return (collator.compare(a.text, b.text) ||
(a.text < b.text ? -1 : a.text > b.text ? 1 : 0));
});
const hasComments = node.types.some(type => {
const count = context.sourceCode.getCommentsBefore(type).length +
context.sourceCode.getCommentsAfter(type).length;
return count > 0;
});
for (let i = 0; i < expectedOrder.length; i += 1) {
if (expectedOrder[i].node !== sourceOrder[i].node) {
let messageId = 'notSorted';
const data = {
name: '',
type: node.type === utils_1.AST_NODE_TYPES.TSIntersectionType
? 'Intersection'
: 'Union',
};
if (node.parent.type === utils_1.AST_NODE_TYPES.TSTypeAliasDeclaration) {
messageId = 'notSortedNamed';
data.name = node.parent.id.name;
}
const fix = fixer => {
const sorted = expectedOrder
.map(t => (0, util_1.typeNodeRequiresParentheses)(t.node, t.text) ||
(node.type === utils_1.AST_NODE_TYPES.TSIntersectionType &&
t.node.type === utils_1.AST_NODE_TYPES.TSUnionType)
? `(${t.text})`
: t.text)
.join(node.type === utils_1.AST_NODE_TYPES.TSIntersectionType ? ' & ' : ' | ');
return fixer.replaceText(node, sorted);
};
return context.report({
node,
messageId,
data,
// don't autofix if any of the types have leading/trailing comments
// the logic for preserving them correctly is a pain - we may implement this later
...(hasComments
? {
suggest: [
{
messageId: 'suggestFix',
fix,
},
],
}
: { fix }),
});
}
}
}
return {
...(checkIntersections && {
TSIntersectionType(node) {
checkSorting(node);
},
}),
...(checkUnions && {
TSUnionType(node) {
checkSorting(node);
},
}),
};
},
});
@@ -0,0 +1,301 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var get_import_nodes_1 = require("../get-import-nodes");
var get_sorted_nodes_1 = require("../get-sorted-nodes");
var get_sorted_nodes_modules_names_1 = require("../get-sorted-nodes-modules-names");
var get_sorted_nodes_names_1 = require("../get-sorted-nodes-names");
var code = "// first comment\n// second comment\nimport z from 'z';\nimport c, { cD } from 'c';\nimport g from 'g';\nimport { tC, tA, tB } from 't';\nimport k, { kE, kB } from 'k';\nimport * as a from 'a';\nimport * as x from 'x';\nimport BY from 'BY';\nimport Ba from 'Ba';\nimport XY from 'XY';\nimport Xa from 'Xa';\n";
test('it returns all sorted nodes', function () {
var result = (0, get_import_nodes_1.getImportNodes)(code);
var sorted = (0, get_sorted_nodes_1.getSortedNodes)(result, {
importOrder: [],
importOrderCaseInsensitive: false,
importOrderSeparation: false,
importOrderGroupNamespaceSpecifiers: false,
importOrderSortSpecifiers: false,
importOrderSideEffects: true,
});
expect((0, get_sorted_nodes_names_1.getSortedNodesNames)(sorted)).toEqual([
'BY',
'Ba',
'XY',
'Xa',
'a',
'c',
'g',
'k',
't',
'x',
'z',
]);
expect(sorted
.filter(function (node) { return node.type === 'ImportDeclaration'; })
.map(function (importDeclaration) {
return (0, get_sorted_nodes_modules_names_1.getSortedNodesModulesNames)(importDeclaration.specifiers);
})).toEqual([
['BY'],
['Ba'],
['XY'],
['Xa'],
['a'],
['c', 'cD'],
['g'],
['k', 'kE', 'kB'],
['tC', 'tA', 'tB'],
['x'],
['z'],
]);
});
test('it returns all sorted nodes case-insensitive', function () {
var result = (0, get_import_nodes_1.getImportNodes)(code);
var sorted = (0, get_sorted_nodes_1.getSortedNodes)(result, {
importOrder: [],
importOrderCaseInsensitive: true,
importOrderSeparation: false,
importOrderGroupNamespaceSpecifiers: false,
importOrderSortSpecifiers: false,
importOrderSideEffects: true,
});
expect((0, get_sorted_nodes_names_1.getSortedNodesNames)(sorted)).toEqual([
'a',
'Ba',
'BY',
'c',
'g',
'k',
't',
'x',
'Xa',
'XY',
'z',
]);
expect(sorted
.filter(function (node) { return node.type === 'ImportDeclaration'; })
.map(function (importDeclaration) {
return (0, get_sorted_nodes_modules_names_1.getSortedNodesModulesNames)(importDeclaration.specifiers);
})).toEqual([
['a'],
['Ba'],
['BY'],
['c', 'cD'],
['g'],
['k', 'kE', 'kB'],
['tC', 'tA', 'tB'],
['x'],
['Xa'],
['XY'],
['z'],
]);
});
test('it returns all sorted nodes with sort order', function () {
var result = (0, get_import_nodes_1.getImportNodes)(code);
var sorted = (0, get_sorted_nodes_1.getSortedNodes)(result, {
importOrder: ['^a$', '^t$', '^k$', '^B'],
importOrderCaseInsensitive: false,
importOrderSeparation: false,
importOrderGroupNamespaceSpecifiers: false,
importOrderSortSpecifiers: false,
importOrderSideEffects: true,
});
expect((0, get_sorted_nodes_names_1.getSortedNodesNames)(sorted)).toEqual([
'XY',
'Xa',
'c',
'g',
'x',
'z',
'a',
't',
'k',
'BY',
'Ba',
]);
expect(sorted
.filter(function (node) { return node.type === 'ImportDeclaration'; })
.map(function (importDeclaration) {
return (0, get_sorted_nodes_modules_names_1.getSortedNodesModulesNames)(importDeclaration.specifiers);
})).toEqual([
['XY'],
['Xa'],
['c', 'cD'],
['g'],
['x'],
['z'],
['a'],
['tC', 'tA', 'tB'],
['k', 'kE', 'kB'],
['BY'],
['Ba'],
]);
});
test('it returns all sorted nodes with sort order case-insensitive', function () {
var result = (0, get_import_nodes_1.getImportNodes)(code);
var sorted = (0, get_sorted_nodes_1.getSortedNodes)(result, {
importOrder: ['^a$', '^t$', '^k$', '^B'],
importOrderCaseInsensitive: true,
importOrderSeparation: false,
importOrderGroupNamespaceSpecifiers: false,
importOrderSortSpecifiers: false,
importOrderSideEffects: true,
});
expect((0, get_sorted_nodes_names_1.getSortedNodesNames)(sorted)).toEqual([
'c',
'g',
'x',
'Xa',
'XY',
'z',
'a',
't',
'k',
'Ba',
'BY',
]);
expect(sorted
.filter(function (node) { return node.type === 'ImportDeclaration'; })
.map(function (importDeclaration) {
return (0, get_sorted_nodes_modules_names_1.getSortedNodesModulesNames)(importDeclaration.specifiers);
})).toEqual([
['c', 'cD'],
['g'],
['x'],
['Xa'],
['XY'],
['z'],
['a'],
['tC', 'tA', 'tB'],
['k', 'kE', 'kB'],
['Ba'],
['BY'],
]);
});
test('it returns all sorted import nodes with sorted import specifiers', function () {
var result = (0, get_import_nodes_1.getImportNodes)(code);
var sorted = (0, get_sorted_nodes_1.getSortedNodes)(result, {
importOrder: ['^a$', '^t$', '^k$', '^B'],
importOrderCaseInsensitive: false,
importOrderSeparation: false,
importOrderGroupNamespaceSpecifiers: false,
importOrderSortSpecifiers: true,
importOrderSideEffects: true,
});
expect((0, get_sorted_nodes_names_1.getSortedNodesNames)(sorted)).toEqual([
'XY',
'Xa',
'c',
'g',
'x',
'z',
'a',
't',
'k',
'BY',
'Ba',
]);
expect(sorted
.filter(function (node) { return node.type === 'ImportDeclaration'; })
.map(function (importDeclaration) {
return (0, get_sorted_nodes_modules_names_1.getSortedNodesModulesNames)(importDeclaration.specifiers);
})).toEqual([
['XY'],
['Xa'],
['c', 'cD'],
['g'],
['x'],
['z'],
['a'],
['tA', 'tB', 'tC'],
['k', 'kB', 'kE'],
['BY'],
['Ba'],
]);
});
test('it returns all sorted import nodes with sorted import specifiers with case-insensitive ', function () {
var result = (0, get_import_nodes_1.getImportNodes)(code);
var sorted = (0, get_sorted_nodes_1.getSortedNodes)(result, {
importOrder: ['^a$', '^t$', '^k$', '^B'],
importOrderCaseInsensitive: true,
importOrderSeparation: false,
importOrderGroupNamespaceSpecifiers: false,
importOrderSortSpecifiers: true,
importOrderSideEffects: true,
});
expect((0, get_sorted_nodes_names_1.getSortedNodesNames)(sorted)).toEqual([
'c',
'g',
'x',
'Xa',
'XY',
'z',
'a',
't',
'k',
'Ba',
'BY',
]);
expect(sorted
.filter(function (node) { return node.type === 'ImportDeclaration'; })
.map(function (importDeclaration) {
return (0, get_sorted_nodes_modules_names_1.getSortedNodesModulesNames)(importDeclaration.specifiers);
})).toEqual([
['c', 'cD'],
['g'],
['x'],
['Xa'],
['XY'],
['z'],
['a'],
['tA', 'tB', 'tC'],
['k', 'kB', 'kE'],
['Ba'],
['BY'],
]);
});
test('it returns all sorted nodes with custom third party modules', function () {
var result = (0, get_import_nodes_1.getImportNodes)(code);
var sorted = (0, get_sorted_nodes_1.getSortedNodes)(result, {
importOrder: ['^a$', '<THIRD_PARTY_MODULES>', '^t$', '^k$'],
importOrderSeparation: false,
importOrderCaseInsensitive: true,
importOrderGroupNamespaceSpecifiers: false,
importOrderSortSpecifiers: false,
importOrderSideEffects: true,
});
expect((0, get_sorted_nodes_names_1.getSortedNodesNames)(sorted)).toEqual([
'a',
'Ba',
'BY',
'c',
'g',
'x',
'Xa',
'XY',
'z',
't',
'k',
]);
});
test('it returns all sorted nodes with namespace specifiers at the top', function () {
var result = (0, get_import_nodes_1.getImportNodes)(code);
var sorted = (0, get_sorted_nodes_1.getSortedNodes)(result, {
importOrder: [],
importOrderCaseInsensitive: false,
importOrderSeparation: false,
importOrderGroupNamespaceSpecifiers: true,
importOrderSortSpecifiers: false,
importOrderSideEffects: true,
});
expect((0, get_sorted_nodes_names_1.getSortedNodesNames)(sorted)).toEqual([
'a',
'x',
'BY',
'Ba',
'XY',
'Xa',
'c',
'g',
'k',
't',
'z',
]);
});
@@ -0,0 +1,18 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./assert"), exports);
@@ -0,0 +1 @@
function t(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const e=(t,e,n)=>n>e?e:n<t?t:n;const n={},s=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);const i=t=>/^0[^.\s]+$/u.test(t);function r(t){let e;return()=>(void 0===e&&(e=t()),e)}const a=t=>t,o=(t,e)=>n=>e(t(n)),l=(...t)=>t.reduce(o),u=(t,e,n)=>{const s=e-t;return 0===s?1:(n-t)/s};class h{constructor(){this.subscriptions=[]}add(e){var n,s;return n=this.subscriptions,s=e,-1===n.indexOf(s)&&n.push(s),()=>t(this.subscriptions,e)}notify(t,e,n){const s=this.subscriptions.length;if(s)if(1===s)this.subscriptions[0](t,e,n);else for(let i=0;i<s;i++){const s=this.subscriptions[i];s&&s(t,e,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const c=t=>1e3*t,d=t=>t/1e3;function p(t,e){return e?t*(1e3/e):0}const m=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t;function f(t,e,n,s){if(t===e&&n===s)return a;const i=e=>function(t,e,n,s,i){let r,a,o=0;do{a=e+(n-e)/2,r=m(a,s,i)-t,r>0?n=a:e=a}while(Math.abs(r)>1e-7&&++o<12);return a}(e,0,1,t,n);return t=>0===t||1===t?t:m(i(t),e,s)}const y=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,g=t=>e=>1-t(1-e),v=f(.33,1.53,.69,.99),b=g(v),w=y(b),T=t=>(t*=2)<1?.5*b(t):.5*(2-Math.pow(2,-10*(t-1))),M=t=>1-Math.sin(Math.acos(t)),V=g(M),A=y(M),S=f(.42,0,1,1),x=f(0,0,.58,1),k=f(.42,0,.58,1),C=t=>Array.isArray(t)&&"number"!=typeof t[0];function F(t,e){return C(t)?t[((t,e,n)=>{const s=e-t;return((n-t)%s+s)%s+t})(0,t.length,e)]:t}const P=t=>Array.isArray(t)&&"number"==typeof t[0],D={linear:a,easeIn:S,easeInOut:k,easeOut:x,circIn:M,circInOut:A,circOut:V,backIn:b,backInOut:w,backOut:v,anticipate:T},E=t=>{if(P(t)){t.length;const[e,n,s,i]=t;return f(e,n,s,i)}return"string"==typeof t?D[t]:t},O=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"],I={value:null,addProjectionMetrics:null};function R(t,e){let s=!1,i=!0;const r={delta:0,timestamp:0,isProcessing:!1},a=()=>s=!0,o=O.reduce((t,n)=>(t[n]=function(t,e){let n=new Set,s=new Set,i=!1,r=!1;const a=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1},l=0;function u(e){a.has(e)&&(h.schedule(e),t()),l++,e(o)}const h={schedule:(t,e=!1,r=!1)=>{const o=r&&i?n:s;return e&&a.add(t),o.has(t)||o.add(t),t},cancel:t=>{s.delete(t),a.delete(t)},process:t=>{o=t,i?r=!0:(i=!0,[n,s]=[s,n],n.forEach(u),e&&I.value&&I.value.frameloop[e].push(l),l=0,n.clear(),i=!1,r&&(r=!1,h.process(t)))}};return h}(a,e?n:void 0),t),{}),{setup:l,read:u,resolveKeyframes:h,preUpdate:c,update:d,preRender:p,render:m,postRender:f}=o,y=()=>{const a=n.useManualTiming?r.timestamp:performance.now();s=!1,n.useManualTiming||(r.delta=i?1e3/60:Math.max(Math.min(a-r.timestamp,40),1)),r.timestamp=a,r.isProcessing=!0,l.process(r),u.process(r),h.process(r),c.process(r),d.process(r),p.process(r),m.process(r),f.process(r),r.isProcessing=!1,s&&e&&(i=!1,t(y))};return{schedule:O.reduce((e,n)=>{const a=o[n];return e[n]=(e,n=!1,o=!1)=>(s||(s=!0,i=!0,r.isProcessing||t(y)),a.schedule(e,n,o)),e},{}),cancel:t=>{for(let e=0;e<O.length;e++)o[O[e]].cancel(t)},state:r,steps:o}}const{schedule:B,cancel:N,state:K,steps:j}=R("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:a,!0);let W;function Y(){W=void 0}const $={now:()=>(void 0===W&&$.set(K.isProcessing||n.useManualTiming?K.timestamp:performance.now()),W),set:t=>{W=t,queueMicrotask(Y)}},L=t=>e=>"string"==typeof e&&e.startsWith(t),U=L("--"),X=L("var(--"),q=t=>!!X(t)&&z.test(t.split("/*")[0].trim()),z=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Z={test:t=>"number"==typeof t,parse:parseFloat,transform:t=>t},H={...Z,transform:t=>e(0,1,t)},_={...Z,default:1},G=t=>Math.round(1e5*t)/1e5,J=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;const Q=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,tt=(t,e)=>n=>Boolean("string"==typeof n&&Q.test(n)&&n.startsWith(t)||e&&!function(t){return null==t}(n)&&Object.prototype.hasOwnProperty.call(n,e)),et=(t,e,n)=>s=>{if("string"!=typeof s)return s;const[i,r,a,o]=s.match(J);return{[t]:parseFloat(i),[e]:parseFloat(r),[n]:parseFloat(a),alpha:void 0!==o?parseFloat(o):1}},nt={...Z,transform:t=>Math.round((t=>e(0,255,t))(t))},st={test:tt("rgb","red"),parse:et("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:s=1})=>"rgba("+nt.transform(t)+", "+nt.transform(e)+", "+nt.transform(n)+", "+G(H.transform(s))+")"};const it={test:tt("#"),parse:function(t){let e="",n="",s="",i="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),s=t.substring(5,7),i=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),s=t.substring(3,4),i=t.substring(4,5),e+=e,n+=n,s+=s,i+=i),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:i?parseInt(i,16)/255:1}},transform:st.transform},rt=t=>({test:e=>"string"==typeof e&&e.endsWith(t)&&1===e.split(" ").length,parse:parseFloat,transform:e=>`${e}${t}`}),at=rt("deg"),ot=rt("%"),lt=rt("px"),ut=rt("vh"),ht=rt("vw"),ct=(()=>({...ot,parse:t=>ot.parse(t)/100,transform:t=>ot.transform(1Line truncated
@@ -0,0 +1,133 @@
// Copyright 2015 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Helper functions for woff2 variable length types: 255UInt16 and UIntBase128
#include "./variable_length.h"
namespace woff2 {
size_t Size255UShort(uint16_t value) {
size_t result = 3;
if (value < 253) {
result = 1;
} else if (value < 762) {
result = 2;
} else {
result = 3;
}
return result;
}
void Write255UShort(std::vector<uint8_t>* out, int value) {
if (value < 253) {
out->push_back(value);
} else if (value < 506) {
out->push_back(255);
out->push_back(value - 253);
} else if (value < 762) {
out->push_back(254);
out->push_back(value - 506);
} else {
out->push_back(253);
out->push_back(value >> 8);
out->push_back(value & 0xff);
}
}
void Store255UShort(int val, size_t* offset, uint8_t* dst) {
std::vector<uint8_t> packed;
Write255UShort(&packed, val);
for (uint8_t val : packed) {
dst[(*offset)++] = val;
}
}
// Based on section 6.1.1 of MicroType Express draft spec
bool Read255UShort(Buffer* buf, unsigned int* value) {
static const int kWordCode = 253;
static const int kOneMoreByteCode2 = 254;
static const int kOneMoreByteCode1 = 255;
static const int kLowestUCode = 253;
uint8_t code = 0;
if (!buf->ReadU8(&code)) {
return FONT_COMPRESSION_FAILURE();
}
if (code == kWordCode) {
uint16_t result = 0;
if (!buf->ReadU16(&result)) {
return FONT_COMPRESSION_FAILURE();
}
*value = result;
return true;
} else if (code == kOneMoreByteCode1) {
uint8_t result = 0;
if (!buf->ReadU8(&result)) {
return FONT_COMPRESSION_FAILURE();
}
*value = result + kLowestUCode;
return true;
} else if (code == kOneMoreByteCode2) {
uint8_t result = 0;
if (!buf->ReadU8(&result)) {
return FONT_COMPRESSION_FAILURE();
}
*value = result + kLowestUCode * 2;
return true;
} else {
*value = code;
return true;
}
}
bool ReadBase128(Buffer* buf, uint32_t* value) {
uint32_t result = 0;
for (size_t i = 0; i < 5; ++i) {
uint8_t code = 0;
if (!buf->ReadU8(&code)) {
return FONT_COMPRESSION_FAILURE();
}
// If any of the top seven bits are set then we're about to overflow.
if (result & 0xfe000000) {
return FONT_COMPRESSION_FAILURE();
}
result = (result << 7) | (code & 0x7f);
if ((code & 0x80) == 0) {
*value = result;
return true;
}
}
// Make sure not to exceed the size bound
return FONT_COMPRESSION_FAILURE();
}
size_t Base128Size(size_t n) {
size_t size = 1;
for (; n >= 128; n >>= 7) ++size;
return size;
}
void StoreBase128(size_t len, size_t* offset, uint8_t* dst) {
size_t size = Base128Size(len);
for (int i = 0; i < size; ++i) {
int b = static_cast<int>((len >> (7 * (size - i - 1))) & 0x7f);
if (i < size - 1) {
b |= 0x80;
}
dst[(*offset)++] = b;
}
}
} // namespace woff2
@@ -0,0 +1,30 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v1.0.2](https://github.com/ljharb/call-bind-apply-helpers/compare/v1.0.1...v1.0.2) - 2025-02-12
### Commits
- [types] improve inferred types [`e6f9586`](https://github.com/ljharb/call-bind-apply-helpers/commit/e6f95860a3c72879cb861a858cdfb8138fbedec1)
- [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/tsconfig`, `@types/tape`, `es-value-fixtures`, `for-each`, `has-strict-mode`, `object-inspect` [`e43d540`](https://github.com/ljharb/call-bind-apply-helpers/commit/e43d5409f97543bfbb11f345d47d8ce4e066d8c1)
## [v1.0.1](https://github.com/ljharb/call-bind-apply-helpers/compare/v1.0.0...v1.0.1) - 2024-12-08
### Commits
- [types] `reflectApply`: fix types [`4efc396`](https://github.com/ljharb/call-bind-apply-helpers/commit/4efc3965351a4f02cc55e836fa391d3d11ef2ef8)
- [Fix] `reflectApply`: oops, Reflect is not a function [`83cc739`](https://github.com/ljharb/call-bind-apply-helpers/commit/83cc7395de6b79b7730bdf092f1436f0b1263c75)
- [Dev Deps] update `@arethetypeswrong/cli` [`80bd5d3`](https://github.com/ljharb/call-bind-apply-helpers/commit/80bd5d3ae58b4f6b6995ce439dd5a1bcb178a940)
## v1.0.0 - 2024-12-05
### Commits
- Initial implementation, tests, readme [`7879629`](https://github.com/ljharb/call-bind-apply-helpers/commit/78796290f9b7430c9934d6f33d94ae9bc89fce04)
- Initial commit [`3f1dc16`](https://github.com/ljharb/call-bind-apply-helpers/commit/3f1dc164afc43285631b114a5f9dd9137b2b952f)
- npm init [`081df04`](https://github.com/ljharb/call-bind-apply-helpers/commit/081df048c312fcee400922026f6e97281200a603)
- Only apps should have lockfiles [`5b9ca0f`](https://github.com/ljharb/call-bind-apply-helpers/commit/5b9ca0fe8101ebfaf309c549caac4e0a017ed930)
@@ -0,0 +1,50 @@
var unsupportedIterableToArray = require("./unsupportedIterableToArray.js");
function _createForOfIteratorHelper(r, e) {
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
if (!t) {
if (Array.isArray(r) || (t = unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
t && (r = t);
var _n = 0,
F = function F() {};
return {
s: F,
n: function n() {
return _n >= r.length ? {
done: !0
} : {
done: !1,
value: r[_n++]
};
},
e: function e(r) {
throw r;
},
f: F
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
var o,
a = !0,
u = !1;
return {
s: function s() {
t = t.call(r);
},
n: function n() {
var r = t.next();
return a = r.done, r;
},
e: function e(r) {
u = !0, o = r;
},
f: function f() {
try {
a || null == t["return"] || t["return"]();
} finally {
if (u) throw o;
}
}
};
}
module.exports = _createForOfIteratorHelper, module.exports.__esModule = true, module.exports["default"] = module.exports;
@@ -0,0 +1 @@
{"name":"@inversifyjs/reflect-metadata-utils","version":"1.4.1","requiresBuild":false,"files":{"lib/cjs/reflectMetadata/utils/buildArrayMetadataWithArray.js":{"checkedAt":1794532100708,"integrity":"sha512-UhqlJzQHkSBGcPNqMjwOec6y6PTQUUTPX8DL0XnjaQJ2rhi81yJHCLRpoCPXtdhazJUTmYmWVWeymbw/vIabfg==","mode":420,"size":376},"lib/cjs/reflectMetadata/utils/buildArrayMetadataWithElement.js":{"checkedAt":1794532100708,"integrity":"sha512-M9nrN0yw3YVcLKWNC096cOCWaU/d07ncRKILwUjunp1Y4zVp859fsCOctYkvtCZVf9UWFmRmqP8ql7jYawdgSQ==","mode":420,"size":371},"lib/cjs/reflectMetadata/utils/buildArrayMetadataWithIndex.js":{"checkedAt":1794532100709,"integrity":"sha512-ySaWbeTyYONOWC7Bka1LLS7yVm/nX0vqcJvH/0sFoC9t45UjiamXqnOGflnmSS36RPqrXfYyQXW3BTdizT14dw==","mode":420,"size":373},"lib/cjs/reflectMetadata/utils/buildEmptyArrayMetadata.js":{"checkedAt":1794532100709,"integrity":"sha512-QYbBe6djRcY3eusyXn5qgTsMFEoBo7V/o09DpzWkCxh/R5Q2XXPnBNJV5XpAfnDmXZBAdnN2IaxPYHqLADPyOQ==","mode":420,"size":241},"lib/cjs/reflectMetadata/utils/buildEmptyMapMetadata.js":{"checkedAt":1794532100709,"integrity":"sha512-f4ALRT53DWxa7tP467AkrnqNG6A1/8zZH2P+k3O9IwDEh0KHoCPBgZ1ifb6sx/mNx+gC7xQLsjdIJi0EhTVhvg==","mode":420,"size":240},"lib/cjs/reflectMetadata/utils/buildEmptySetMetadata.js":{"checkedAt":1794532100710,"integrity":"sha512-QlZplKcTbs/KL0I0GPsIbvTLq+ftI2NqKL7zbGKmtvTSxwXw20cM0aIPrZmrFrpYxATLklUrShpCmet+9QRFqQ==","mode":420,"size":240},"lib/cjs/reflectMetadata/utils/getOwnReflectMetadata.js":{"checkedAt":1794532100710,"integrity":"sha512-WMJpQpdNNKf/wsrSzSNjf6OrQvOiwON6CFyOJLAKMpOlgTiJOCKVTGerSjMJUWjwdivkSXKUAGqGLpnXKmnuJg==","mode":420,"size":397},"lib/cjs/reflectMetadata/utils/getReflectMetadata.js":{"checkedAt":1794532100710,"integrity":"sha512-wVceSfjI0Ei2zR2bh9DBLyjj4H7nUGIsJxpBV1ykqNOAEKg10mn23ufwwIYAIP/GRvpbjSxoanPOSPeuNDHY0A==","mode":420,"size":382},"lib/cjs/index.js":{"checkedAt":1794532100710,"integrity":"sha512-3n2BL9vfYxrBS6oXFxZ/olT26+quYvOAmCwVeXUERioJMk/ogC2HtCn5zi6WQetBqLiESrPWe2N7NF1pSWQjjw==","mode":420,"size":3580},"lib/esm/index.js":{"checkedAt":1794532100710,"integrity":"sha512-/L61E5bG740dSIlI0heNt77Sb8ND6u88dquj/CqUNEo/NQnInfkvrMj1XSvPsuddjbffsPLkjH6DtVD7gI/h8A==","mode":420,"size":962},"lib/cjs/reflectMetadata/utils/setReflectMetadata.js":{"checkedAt":1794532100710,"integrity":"sha512-8ShRPVf046q5HMdC3C7DETh3Ubd9nsm9alOyp92Ii6BR8LAPQ1El2/VXxZh7YzNkgXVdoG4JJE4tNHS/UmFyhg==","mode":420,"size":320},"lib/cjs/reflectMetadata/utils/updateOwnReflectMetadata.js":{"checkedAt":1794532100710,"integrity":"sha512-/VypMaOtfKCw8b3P+b81orpXbwYcJqjmAvPBJn4ptrsRCPxJyIvmUg1FIJnLsT+qPKDfUBj1Kn8uDv+KzdjY8A==","mode":420,"size":624},"lib/cjs/reflectMetadata/utils/updateReflectMetadata.js":{"checkedAt":1794532100710,"integrity":"sha512-2RyoRDPIU+eKR7r0S8/i8PtaiytQkp7t/q10B0GpqliIhOZHpFCFUE4jkqktmy92Dbl5hhI/+D5siC52xBd/cw==","mode":420,"size":592},"lib/cjs/reflectMetadata/utils/updateSetMetadataWithList.js":{"checkedAt":1794532100711,"integrity":"sha512-EvGEic3ZkYXecq3TOcmq91AxzNObqFj4hpuYuLi55p/w9ZyD2WWz5kpt8Su6bGXZeY2dF3NTOAueAOCqAH/A/w==","mode":420,"size":399},"lib/cjs/package.json":{"checkedAt":1794532100711,"integrity":"sha512-8U1e2/m1/MZLAABugPPCT7pT1gQsJ0emvlef4tzYwWdTJIrY6/1Ks6sAUDIRPeWx9i1UbwxIXcxgesvNgTTtuA==","mode":420,"size":24},"lib/esm/package.json":{"checkedAt":1794532100711,"integrity":"sha512-0/qKvY+e4vDrutI/Gs9dbxgY8+4bWMP+lwjtUzPoWNp8Btq/+DNRn4Fl+lNX+8ULTmX/HqaMXapHD6wIA6VgiQ==","mode":420,"size":22},"package.json":{"checkedAt":1794532100711,"integrity":"sha512-8D5E/Re3uwmJaFkQK4xG4mDYKykwnTIjtSaRlXa2q+pxfgt9zooDGhcrc/A2fK7tdiln5sLZFmnKYzZzIs939w==","mode":420,"size":2073},"lib/cjs/reflectMetadata/utils/buildArrayMetadataWithArray.d.ts.map":{"checkedAt":1794532100711,"integrity":"sha512-+1YjKqlEE8y8xS5dRWqa/0bebCZx0QXp2XYjkE7iZ4aAO1WA3aNPia+nMS0pUp33aahTVkJ9sbKiK1WH7kQnpg==","mode":420,"size":297},"lib/cjs/reflectMetadata/utils/buildArrayMetadataWithArray.js.map":{"checkedAt":1794532100711,"integrity":"sha512-jh8R//nkBr3E2AItt7qOZspvgsNv26kjVeHd0b9W4eoVgOVj+agPKHePz6z2xC+m/2mBYzXng7nD6Y60kI25vA==","mode":420,"size":347},"lib/cjs/reflectMetadata/utils/buildArrayMetadataWithArray.spec.d.ts.map":{"checkedAt":1794532100711,"integrity":"sha512-76v0sNOYSd0zl0FN1SKfhjIs05hhSDdfrstnVPx5yTpeS980PP+iSYEVaWxpL+DZ0E306Hdus0/mJjFX8SMeKA==","mode":420,"size":189},"lib/cjs/reflectMetadata/utils/buildArrayMetadataWithElement.d.ts.map":{"checkedAt":1794532100711,"integrity":"sha512-tM4zxBtfcyy4T6UjHNGj7Nbmk/Gg12caOlrth6ByrqHXnkUCZeQWtr+hm0h5ruRqoJqpSMAGY1SVmaJViGltJg==","mode":420,"size":283},"lib/cjs/reflectMetadata/utils/buildArrayMetadataWithElement.js.map":{"checkedAt":1794532100711,"integrity":"sha512-4xjZxnYiKQ8TOeqD+VYDO4xePbfezvLzRxC2Oy985Yrc0mlarf8ncvOwOmp+LFfZLxErvdPkYhjd56i5cRe6lA==","mode":420,"size":341},"lib/cjs/reflectMetadata/utils/buildArrayMetadataWithElement.spec.d.ts.map":{"checkedAt":1794532100712,"integrity":"sha512-4PHUNGom3O2pZjdwXEQdYKL6UxTRr560AFPPJbD8kGsVilAeSr5WobCphWRNMcnuSQVRDp9P0QIS9j1/0nTPwg==","mode":420,"sizLine truncated
@@ -0,0 +1,42 @@
'use strict'
const PROMISE_STATICS = require('./lib/promise-statics')
const getDocsUrl = require('./lib/get-docs-url')
module.exports = {
meta: {
type: 'problem',
docs: {
description: 'Disallow calling `new` on a Promise static method.',
url: getDocsUrl('no-new-statics'),
},
fixable: 'code',
schema: [],
messages: {
avoidNewStatic: "Avoid calling 'new' on 'Promise.{{ name }}()'",
},
},
create(context) {
return {
NewExpression(node) {
if (
node.callee.type === 'MemberExpression' &&
node.callee.object.name === 'Promise' &&
PROMISE_STATICS.has(node.callee.property.name)
) {
context.report({
node,
messageId: 'avoidNewStatic',
data: { name: node.callee.property.name },
fix(fixer) {
return fixer.replaceTextRange(
[node.range[0], node.range[0] + 'new '.length],
'',
)
},
})
}
},
}
},
}
@@ -0,0 +1,628 @@
export default `flf2a$ 6 5 16 0 14
Original font by Gordon Lee <93cmgl@eng.cam.ac.uk>
==================================================
Original figletization by Tony Nugent (T.Nugent@sct.gu.edu.au)
Version 1 - Needs refining with hardblanks and cleaning up of some of
the characters. The last 6 chars need to be done properly.
==================================================
Version 2 by Ian Chai <spectre@uiuc.edu> Added the hardblank fix and
the German characters.
==================================================
---
Font modified June 17, 2007 by patorjk
This was to widen the space character.
$ $@
$ $@
$ $@
$ $@
$ $@
$ $@@
oo$ @
8888$@
8888$@
88$ @
oo$ @
@@
888 888$@
888 888$@
@
@
@
@@
ooo ooo$ @
o888ooo888o$@
888 888$ @
o888ooo888o$@
888 888$ @
@@
oo oo$ @
oo88o88o8$ @
88o88o88oo$ @
88 88 88$@
o8o88o88o8$ @
88 88$ @@
oo ooo$@
8 8 o88$ @
88 o88 oo$ @
o88 8 8$@
o88 88$ @
@@
oooooo$ @
888 888$ @
88o88 o88$@
888 88o8$ @
888o88 88o$@
@@
888$@
888$@
o88$ @
@
@
@@
o88$@
888$ @
888$ @
888$ @
888$ @
88o$@@
88o$ @
888$ @
888$@
888$@
888$ @
o88$ @@
oo oo$ @
88oo88$ @
o88888888o$@
oo88oo$ @
o88 88o$ @
@@
ooo$ @
888$ @
oooo888oooo$@
888$ @
888$ @
@@
@
@
@
ooo$@
888$@
o88$ @@
@
@
ooooooooo$@
@
@
@@
@
@
@
ooo$@
888$@
@@
o88$@
o88$ @
o88$ @
o88$ @
o88$ @
o88$ @@
ooooooo$ @
o888 o888o$@
888 8 888$@
888o8 o888$@
88ooo88$ @
@@
oo$ @
o888$ @
888$ @
888$ @
o888o$@
@@
ooooooo$ @
o88 888$@
o888$ @
o888 o$@
o8888oooo88$@
@@
ooooooo$ @
o88 888o$@
88888o$ @
88o o888$@
88ooo88$ @
@@
o88$ @
o8888$ @
o88 888$ @
o888oo888oo$@
o888o$ @
@@
oooooooooo$ @
888$ @
888888888o$ @
ooo o888$@
88ooo88$ @
@@
ooooooo$ @
o88$ @
888888888o$ @
88o o888$@
88ooo88$ @
@@
ooooooooooo$@
888 888$ @
888$ @
888$ @
888$ @
@@
ooooooo$ @
o888 888o$@
888888888$ @
888o o888$@
88ooo88$ @
@@
ooooooo$ @
888 88o$@
888oo8888$@
888$ @
o888$ @
@@
@
ooo$@
888$@
ooo$@
888$@
@@
ooo$@
888$@
ooo$@
888$@
o88$ @
@@
o88$@
o88$ @
o88$ @
88o$ @
88o$@
@@
@
ooooooooo$@
@
ooooooooo$@
@
@@
88o$ @
88o$ @
88o$@
o88$ @
o88$ @
@@
o8888888o$ @
888 888$@
o888$ @
888$ @
ooo$ @
@@
o8888888o$ @
888 oo 888$@
888 8 8 888$@
888 88o88$ @
888ooooo8$ @
@@
o$ @
888$ @
8 88$ @
8oooo88$ @
o88o o888o$@
@@
oooooooooo$ @
888 888$@
888oooo88$ @
888 888$@
o888ooo888$ @
@@
oooooooo8$@
o888 88$@
888$ @
888o oo$@
888oooo88$ @
@@
ooooooooo$ @
888 88o$@
888 888$@
888 888$@
o888ooo88$ @
@@
ooooooooooo$@
888 88$ @
888ooo8$ @
888 oo$ @
o888ooo8888$@
@@
ooooooooooo$@
888 88$ @
888ooo8$ @
888$ @
o888o$ @
@@
ooooooo8$ @
o888 88$ @
888 oooo$@
888o 88$ @
888ooo888$ @
@@
ooooo ooooo$@
888 888$ @
888ooo888$ @
888 888$ @
o888o o888o$@
@@
ooooo$@
888$ @
888$ @
888$ @
o888o$@
@@
ooooo$@
888$ @
888$ @
888$ @
888$ @
8o888$ @@
oooo oooo$@
888 o88$ @
888888$ @
888 88o$ @
o888o o888o$@
@@
ooooo$ @
888$ @
888$ @
888 o$@
o888ooooo88$@
@@
oooo oooo$@
8888o 888$ @
88 888o8 88$ @
88 888 88$ @
o88o 8 o88o$@
@@
oooo oooo$@
8888o 88$ @
88 888o88$ @
88 8888$ @
o88o 88$ @
@@
ooooooo$ @
o888 888o$@
888 888$@
888o o888$@
88ooo88$ @
@@
oooooooooo$ @
888 888$@
888oooo88$ @
888$ @
o888o$ @
@@
ooooooo$ @
o888 888o$@
888 888$@
888o 8o888$@
88ooo88$ @
88o8$@@
oooooooooo$ @
888 888$@
888oooo88$ @
888 88o$ @
o888o 88o8$@
@@
oooooooo8$ @
888$ @
888oooooo$ @
888$@
o88oooo888$ @
@@
ooooooooooo$@
88 888 88$@
888$ @
888$ @
o888o$ @
@@
ooooo oooo$@
888 88$ @
888 88$ @
888 88$ @
888oo88$ @
@@
ooooo oooo$@
888 88$ @
888 88$ @
88888$ @
888$ @
@@
oooo oooo$@
88 88 88$ @
88 888 88$ @
888 888$ @
8 8$ @
@@
ooooo oooo$@
888 88$ @
888$ @
88 888$ @
o88o o888o$@
@@
ooooo oooo$@
888 88$ @
888$ @
888$ @
o888o$ @
@@
ooooooooooo$@
88 888$ @
888$ @
888 oo$@
o888oooo888$@
@@
888888$@
888$ @
888$ @
888$ @
888$ @
888888$@@
88o$ @
88o$ @
88o$ @
88o$ @
88o$ @
88o$@@
888888$@
888$@
888$@
888$@
888$@
888888$@@
o$ @
o8o$ @
o888o$ @
o88o88o$ @
o8888888o$@
@@
@
@
@
@
@
oooooooooooo$@@
888$ @
888$ @
88o$@
@
@
@@
@
ooooooo$ @
ooooo888$ @
888 888$ @
88ooo88 8o$@
@@
oooo$ @
888ooooo$ @
888 888$@
888 888$@
o888ooo88$ @
@@
@
ooooooo$ @
888 888$@
888$ @
88ooo888$ @
@@
oooo$@
ooooo888$ @
888 888$ @
888 888$ @
88ooo888o$@
@@
@
ooooooooo8$@
888oooooo8$ @
888$ @
88oooo888$@
@@
o888o$@
o888oo$ @
888$ @
888$ @
o888o$ @
@@
@
oooooooo8$@
888 88o$ @
888oo888o$ @
888 888$@
888ooo888$ @@
oooo$ @
888ooooo$ @
888 888$ @
888 888$ @
o888o o888o$@
@@
o88$ @
oooo$ @
888$ @
888$ @
o888o$@
@@
o88$@
oooo$@
888$@
888$@
888$@
o88$ @@
oooo$ @
888 ooooo$@
888o888$ @
8888 88o$ @
o888o o888o$@
@@
o888$ @
888$ @
888$ @
888$ @
o888o$@
@@
@
oo ooo oooo$ @
888 888 888$ @
888 888 888$ @
o888o888o888o$@
@@
@
oo oooooo$ @
888 888$ @
888 888$ @
o888o o888o$@
@@
@
ooooooo$ @
888 888$@
888 888$@
88ooo88$ @
@@
@
ooooooooo$ @
888 888$@
888 888$@
888ooo88$ @
o888$ @@
@
ooooooooo$@
888 888$ @
888 888$ @
88ooo888$ @
888o$@@
@
oo oooooo$ @
888 888$@
888$ @
o888o$ @
@@
@
oooooooo8$ @
888ooooooo$ @
888$@
88oooooo88$ @
@@
o8$ @
o888oo$@
888$ @
888$ @
888o$@
@@
@
oooo oooo$ @
888 888$ @
888 888$ @
888o88 8o$@
@@
@
oooo oooo$@
888 888$ @
888 888$ @
888$ @
@@
@
oooo o oooo$@
888 888 888$ @
888888888$ @
88 88$ @
@@
@
oooo oooo$@
888o888$ @
o88 88o$ @
o88o o88o$@
@@
@
oooo oooo$@
888 888$ @
888 888$ @
8888$ @
o8o888$ @@
@
ooooooooooo$@
8888$ @
8888$ @
o888ooooooo$@
@@
o8888$@
888$ @
o888$ @
888o$ @
888$ @
8888o$@@
888$@
888$@
888$@
888$@
888$@
888$@@
8888o$ @
888$ @
888o$@
o888$@
888$ @
o8888$ @@
o888o o888$@
888 888888$ @
@
@
@
@@
88 o 88$ @
888$ @
8 88$ @
8oooo88$ @
o88o o888o$@
@@
88ooooo88$ @
o888 888o$@
888 888$@
888o o888$@
88ooo88$ @
@@
o88oo o88o$@
888 88$ @
888 88$ @
888 88$ @
888oo88$ @
@@
88 88$ @
ooooooo$ @
ooooo888$ @
888 888$ @
88ooo88 8o$@
@@
88 88$ @
ooooooo$ @
888 888$@
888 888$@
88ooo88$ @
@@
88 88 @
oooo oooo$ @
888 888$ @
888 888$ @
888o88 8o$@
@@
ooooooo$ @
o88 888$@
888oooo88$ @
888 888$@
888 oo888$ @
o88 @@
`
@@ -0,0 +1 @@
{"mappings":";;;;;;;;;;;;;AAiBA,MAAM,kDAA4B;AAClC,MAAM,sCAAgB;AACtB,MAAM,qCAAe;AACrB,MAAM,sCAAgB,KAAK,EAAE,GAAG,IAAI,MAAM;AAMnC,SAAS,0CAAwB,OAAoC;IAC1E,IAAI,WAAC,OAAO,cAAE,UAAU,UAAE,MAAM,cAAE,UAAU,EAAC,GAAG;IAChD,IAAI,iBAAiB,CAAA,GAAA,mBAAK,EAAsC;IAChE,IAAI,cAAc,CAAA,GAAA,mBAAK,EAAuB;IAC9C,IAAI,oBAAoB,CAAA,GAAA,mBAAK,EAAU;IACvC,IAAI,UAAU,CAAA,GAAA,mBAAK,EAA6C;IAChE,IAAI,mBAAmB,CAAA,GAAA,mBAAK,EAA6C;IACzE,IAAI,cAAc,CAAA,GAAA,mBAAK,EAAgC;IACvD,IAAI,+BAA+B,CAAA,GAAA,mBAAK,EAAU;IAClD,IAAI,CAAC,sBAAsB,wBAAwB,GAAG,CAAA,GAAA,qBAAO,EAAE;IAE/D,IAAI,oBAAoB;QACtB,IAAI,WAAW,OAAO,EAAE;YACtB,YAAY,OAAO,GAAG,WAAW,OAAO,CAAC,qBAAqB;YAC9D,YAAY,OAAO,GAAG;QACxB;IACF;IACA,CAAA,GAAA,uCAAgB,EAAE;QAAC,KAAK;QAAY,UAAU;IAAiB;IAE/D,IAAI,QAAQ;QACV,wBAAwB;QACxB,6BAA6B,OAAO,GAAG;QACvC,eAAe,OAAO,GAAG;IAC3B;IAEA,IAAI,WAAW,CAAA,GAAA,mDAAqB;IAEpC,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,wBAAwB,QAAQ,OAAO,EACzC,AAAC,QAAQ,OAAO,CAAiB,KAAK,CAAC,aAAa,GAAG;aAEvD,AAAC,QAAQ,OAAO,CAAiB,KAAK,CAAC,aAAa,GAAG;IAE3D,GAAG;QAAC;QAAS;KAAqB;IAElC,CAAA,GAAA,sBAAQ,EAAE;QACR,IAAI,UAAU,WAAW,OAAO;QAChC,IAAI,OAAO,QAAQ,OAAO;QAE1B,IAAI,cAAc,CAAC,WAAW,CAAC,UAAU,aAAa,aAAa,CAAC,MAAM;YACxE;YACA;QACF;QACA,YAAY,OAAO,GAAG,QAAQ,qBAAqB;QAEnD,IAAI,gBAAgB,CAAC;YACnB,IAAI,EAAE,WAAW,KAAK,WAAW,EAAE,WAAW,KAAK,OACjD;YAGF,IAAI,cAAc,KAAK,GAAG;YAE1B,WAAW;YACX,IAAI,cAAc,kBAAkB,OAAO,GAAG,qCAC5C;YAEF,aAAa,QAAQ,OAAO;YAC5B,aAAa,iBAAiB,OAAO;YAErC,IAAI,EAAC,SAAS,MAAM,EAAE,SAAS,MAAM,EAAC,GAAG;YAEzC,IAAI,CAAC,eAAe,OAAO,EAAE;gBAC3B,eAAe,OAAO,GAAG;oBAAC,GAAG;oBAAQ,GAAG;gBAAM;gBAC9C;YACF;YAEA,IAAI,CAAC,YAAY,OAAO,EACtB;YAGF,IAAI,CAAC,YAAY,OAAO,EACtB,YAAY,OAAO,GAAG,SAAS,YAAY,OAAO,CAAC,KAAK,GAAG,SAAS;YAGtE,oCAAoC;YACpC,IAAI,SAAS,KAAK,qBAAqB,GAAG,IAAI,IAAI,SAAS,KAAK,qBAAqB,GAAG,KAAK,IAAI,SAAS,KAAK,qBAAqB,GAAG,GAAG,IAAI,SAAS,KAAK,qBAAqB,GAAG,MAAM,EAAE;gBAC1L;gBACA;YACF;YAEA;;;;;;MAMA,GACA,IAAI,aAAa,eAAe,OAAO,CAAC,CAAC;YACzC,IAAI,aAAa,eAAe,OAAO,CAAC,CAAC;YACzC,IAAI,aAAa,YAAY,OAAO,KAAK,UAAU,YAAY,OAAO,CAAC,IAAI,GAAG,aAAa,aAAa,YAAY,OAAO,CAAC,KAAK;YACjI,IAAI,WAAW,KAAK,KAAK,CAAC,aAAa,YAAY,OAAO,CAAC,GAAG,EAAE,cAAc;YAC9E,IAAI,cAAc,KAAK,KAAK,CAAC,aAAa,YAAY,OAAO,CAAC,MAAM,EAAE,cAAc;YACpF,IAAI,eAAe,KAAK,KAAK,CAAC,aAAa,QAAS,YAAY,OAAO,KAAK,SAAS,CAAE,CAAA,SAAS,UAAS,IAAK,SAAS;YACvH,IAAI,yBAAyB,eAAe,YAAY,eAAe;YAEvE,6BAA6B,OAAO,GAAG,yBACrC,KAAK,GAAG,CAAC,6BAA6B,OAAO,GAAG,GAAG,mDACnD,KAAK,GAAG,CAAC,6BAA6B,OAAO,GAAG,GAAG;YAErD,IAAI,6BAA6B,OAAO,IAAI,iDAC1C,wBAAwB;iBAExB,wBAAwB;YAG1B,kBAAkB,OAAO,GAAG;YAC5B,eAAe,OAAO,GAAG;gBAAC,GAAG;gBAAQ,GAAG;YAAM;YAE9C,qHAAqH;YACrH,IAAI,wBACF,QAAQ,OAAO,GAAG,WAAW;gBAC3B;gBACA,iBAAiB,OAAO,GAAG,WAAW;oBACpC,yDAAyD;oBACzD,sDAAsD;oBACtD,IAAI,SAAS,SAAS,gBAAgB,CAAC,QAAQ;oBAC/C,IAAI,UAAU,KAAK,QAAQ,CAAC,SAC1B,OAAO,aAAa,CAAC,IAAI,aAAa,eAAe;wBAAC,SAAS;wBAAM,YAAY;oBAAI;gBAEzF,GAAG;YACL,GAAG;QAEP;QAEA,OAAO,gBAAgB,CAAC,eAAe;QAEvC,OAAO;YACL,OAAO,mBAAmB,CAAC,eAAe;YAC1C,aAAa,QAAQ,OAAO;YAC5B,aAAa,iBAAiB,OAAO;YACrC,6BAA6B,OAAO,GAAG;QACzC;IAEF,GAAG;QAAC;QAAY;QAAQ;QAAS;QAAU;QAAyB;KAAW;AACjF","sources":["packages/@react-aria/menu/src/useSafelyMouseToSubmenu.ts"],"sourcesContent":["\nimport {RefObject} from '@react-types/shared';\nimport {useEffect, useRef, useState} from 'react';\nimport {useInteractionModality} from '@react-aria/interactions';\nimport {useResizeObserver} from '@react-aria/utils';\n\ninterface SafelyMouseToSubmenuOptions {\n /** Ref for the parent menu. */\n menuRef: RefObject<Element | null>,\n /** Ref for the submenu. */\n submenuRef: RefObject<Element | null>,\n /** Whether the submenu is open. */\n isOpen: boolean,\n /** Whether this feature is disabled. */\n isDisabled?: boolean\n}\n\nconst ALLOWED_INVALID_MOVEMENTS = 2;\nconst THROTTLE_TIME = 50;\nconst TIMEOUT_TIME = 1000;\nconst ANGLE_PADDING = Math.PI / 12; // 15°\n\n/**\n * Allows the user to move their pointer to the submenu without it closing when their mouse leaves the trigger element.\n * Prevents pointer events from going to the underlying menu if the user is moving their pointer towards the sub-menu.\n */\nexport function useSafelyMouseToSubmenu(options: SafelyMouseToSubmenuOptions) {\n let {menuRef, submenuRef, isOpen, isDisabled} = options;\n let prevPointerPos = useRef<{x: number, y: number} | undefined>(undefined);\n let submenuRect = useRef<DOMRect | undefined>(undefined);\n let lastProcessedTime = useRef<number>(0);\n let timeout = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n let autoCloseTimeout = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n let submenuSide = useRef<'left' | 'right' | undefined>(undefined);\n let movementsTowardsSubmenuCount = useRef<number>(2);\n let [preventPointerEvents, setPreventPointerEvents] = useState(false);\n\n let updateSubmenuRect = () => {\n if (submenuRef.current) {\n submenuRect.current = submenuRef.current.getBoundingClientRect();\n submenuSide.current = undefined;\n }\n };\n useResizeObserver({ref: submenuRef, onResize: updateSubmenuRect});\n\n let reset = () => {\n setPreventPointerEvents(false);\n movementsTowardsSubLine truncated
@@ -0,0 +1,125 @@
{
"name": "eslint-plugin-react",
"version": "7.37.5",
"author": "Yannick Croissant <yannick.croissant+npm@gmail.com>",
"description": "React specific linting rules for ESLint",
"main": "index.js",
"types": "index.d.ts",
"scripts": {
"clean-built-types": "rm -f $(find . -maxdepth 1 -type f -name '*.d.ts*') $(find lib -type f -name '*.d.ts*' ! -name 'types.d.ts')",
"prebuild-types": "npm run clean-built-types",
"build-types": "tsc -p build.tsconfig.json",
"prepack": "npm run build-types && npmignore --auto --commentLines=autogenerated",
"prelint": "npm run lint:docs",
"lint:docs": "markdownlint \"**/*.md\"",
"postlint:docs": "npm run update:eslint-docs -- --check",
"lint": "eslint .",
"postlint": "npm run type-check",
"pretest": "npm run lint",
"test": "npm run unit-test",
"posttest": "npx npm@'>= 10.2' audit --production",
"type-check": "tsc",
"unit-test": "istanbul cover node_modules/mocha/bin/_mocha tests/lib/**/*.js tests/util/**/*.js tests/index.js tests/flat-config.js",
"update:eslint-docs": "eslint-doc-generator"
},
"repository": {
"type": "git",
"url": "https://github.com/jsx-eslint/eslint-plugin-react"
},
"directories": {
"test": [
"test",
"tests",
"test-published-types"
]
},
"homepage": "https://github.com/jsx-eslint/eslint-plugin-react",
"bugs": "https://github.com/jsx-eslint/eslint-plugin-react/issues",
"dependencies": {
"array-includes": "^3.1.8",
"array.prototype.findlast": "^1.2.5",
"array.prototype.flatmap": "^1.3.3",
"array.prototype.tosorted": "^1.1.4",
"doctrine": "^2.1.0",
"es-iterator-helpers": "^1.2.1",
"estraverse": "^5.3.0",
"hasown": "^2.0.2",
"jsx-ast-utils": "^2.4.1 || ^3.0.0",
"minimatch": "^3.1.2",
"object.entries": "^1.1.9",
"object.fromentries": "^2.0.8",
"object.values": "^1.2.1",
"prop-types": "^15.8.1",
"resolve": "^2.0.0-next.5",
"semver": "^6.3.1",
"string.prototype.matchall": "^4.0.12",
"string.prototype.repeat": "^1.0.0"
},
"devDependencies": {
"@babel/core": "^7.26.10",
"@babel/eslint-parser": "^7.27.0",
"@babel/plugin-syntax-decorators": "^7.25.9",
"@babel/plugin-syntax-do-expressions": "^7.25.9",
"@babel/plugin-syntax-function-bind": "^7.25.9",
"@babel/preset-react": "^7.26.3",
"@types/eslint": "=7.2.10",
"@types/estree": "0.0.52",
"@types/node": "^4.9.5",
"@typescript-eslint/parser": "^2.34.0 || ^3.10.1 || ^4 || ^5 || ^6.20 || ^7.14.1 || 8.4 - 8.17",
"babel-eslint": "^8 || ^9 || ^10.1.0",
"eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9.7",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-doc-generator": "^1.7.1",
"eslint-plugin-eslint-plugin": "^2.3.0 || ^3.5.3 || ^4.0.1 || ^5.0.5",
"eslint-plugin-import": "^2.31.0",
"eslint-remote-tester": "^3.0.1",
"eslint-remote-tester-repositories": "^1.0.1",
"eslint-scope": "^3.7.3",
"espree": "^3.5.4",
"gfm-footnotes": "^1.0.1",
"glob": "=10.3.7",
"istanbul": "^0.4.5",
"jackspeak": "=2.1.1",
"ls-engines": "^0.8.1",
"markdownlint-cli": "^0.8.0 || ^0.32.2",
"mocha": "^5.2.0",
"npmignore": "^0.3.1",
"sinon": "^7.5.0",
"typescript": "^3.9.9",
"typescript-eslint-parser": "^20.1.1"
},
"peerDependencies": {
"eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^9.7"
},
"engines": {
"node": ">=4"
},
"keywords": [
"eslint",
"eslint-plugin",
"eslintplugin",
"react"
],
"license": "MIT",
"publishConfig": {
"ignore": [
".github/",
"!lib",
"docs/",
"test/",
"test-published-types/",
"tests/",
"*.md",
"*.config.js",
".eslint-doc-generatorrc.js",
".eslintrc",
".editorconfig",
"tsconfig.json",
"build.tsconfig.json",
".markdownlint*",
"types",
"!*.d.ts",
"!*.d.ts.map"
]
}
}
@@ -0,0 +1,19 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./anyschema"), exports);
__exportStar(require("./schema"), exports);
Loaded 100 of 35554 files, more files were not shown because too many files have changed in this diff. Show more