docs: 仓库链接指向本镜像仓库
Build NapCat Artifacts / Type Check & Test (push) Waiting to run

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,21 @@
'use strict';
var GetIntrinsic = require('get-intrinsic');
var $TypeError = require('es-errors/type');
var $Date = GetIntrinsic('%Date%');
var $String = GetIntrinsic('%String%');
var $isNaN = require('math-intrinsics/isNaN');
// https://262.ecma-international.org/6.0/#sec-todatestring
module.exports = function ToDateString(tv) {
if (typeof tv !== 'number') {
throw new $TypeError('Assertion failed: `tv` must be a Number');
}
if ($isNaN(tv)) {
return 'Invalid Date';
}
return $String(new $Date(tv));
};
@@ -0,0 +1,14 @@
import {
forwardRef,
isHeroUIEl,
mapPropsVariants,
mapPropsVariantsWithCommon,
toIterator
} from "./chunk-YFAKJTDR.mjs";
export {
forwardRef,
isHeroUIEl,
mapPropsVariants,
mapPropsVariantsWithCommon,
toIterator
};
@@ -0,0 +1,28 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.addCandidateTSConfigRootDir = addCandidateTSConfigRootDir;
exports.clearCandidateTSConfigRootDirs = clearCandidateTSConfigRootDirs;
exports.getInferredTSConfigRootDir = getInferredTSConfigRootDir;
const candidateTSConfigRootDirs = new Set();
function addCandidateTSConfigRootDir(candidate) {
candidateTSConfigRootDirs.add(candidate);
}
function clearCandidateTSConfigRootDirs() {
candidateTSConfigRootDirs.clear();
}
function getInferredTSConfigRootDir() {
const entries = [...candidateTSConfigRootDirs];
switch (entries.length) {
case 0:
return process.cwd();
case 1:
return entries[0];
default:
throw new Error([
'No tsconfigRootDir was set, and multiple candidate TSConfigRootDirs are present:',
...entries.map(candidate => ` - ${candidate}`),
"You'll need to explicitly set tsconfigRootDir in your parser options.",
'See: https://typescript-eslint.io/packages/parser/#tsconfigrootdir',
].join('\n'));
}
}
@@ -0,0 +1,345 @@
import { StringReader, StringWriter } from './strings';
import { comma, decodeInteger, encodeInteger, hasMoreVlq, semicolon } from './vlq';
const EMPTY: any[] = [];
type Line = number;
type Column = number;
type Kind = number;
type Name = number;
type Var = number;
type SourcesIndex = number;
type ScopesIndex = number;
type Mix<A, B, O> = (A & O) | (B & O);
export type OriginalScope = Mix<
[Line, Column, Line, Column, Kind],
[Line, Column, Line, Column, Kind, Name],
{ vars: Var[] }
>;
export type GeneratedRange = Mix<
[Line, Column, Line, Column],
[Line, Column, Line, Column, SourcesIndex, ScopesIndex],
{
callsite: CallSite | null;
bindings: Binding[];
isScope: boolean;
}
>;
export type CallSite = [SourcesIndex, Line, Column];
type Binding = BindingExpressionRange[];
export type BindingExpressionRange = [Name] | [Name, Line, Column];
export function decodeOriginalScopes(input: string): OriginalScope[] {
const { length } = input;
const reader = new StringReader(input);
const scopes: OriginalScope[] = [];
const stack: OriginalScope[] = [];
let line = 0;
for (; reader.pos < length; reader.pos++) {
line = decodeInteger(reader, line);
const column = decodeInteger(reader, 0);
if (!hasMoreVlq(reader, length)) {
const last = stack.pop()!;
last[2] = line;
last[3] = column;
continue;
}
const kind = decodeInteger(reader, 0);
const fields = decodeInteger(reader, 0);
const hasName = fields & 0b0001;
const scope: OriginalScope = (
hasName ? [line, column, 0, 0, kind, decodeInteger(reader, 0)] : [line, column, 0, 0, kind]
) as OriginalScope;
let vars: Var[] = EMPTY;
if (hasMoreVlq(reader, length)) {
vars = [];
do {
const varsIndex = decodeInteger(reader, 0);
vars.push(varsIndex);
} while (hasMoreVlq(reader, length));
}
scope.vars = vars;
scopes.push(scope);
stack.push(scope);
}
return scopes;
}
export function encodeOriginalScopes(scopes: OriginalScope[]): string {
const writer = new StringWriter();
for (let i = 0; i < scopes.length; ) {
i = _encodeOriginalScopes(scopes, i, writer, [0]);
}
return writer.flush();
}
function _encodeOriginalScopes(
scopes: OriginalScope[],
index: number,
writer: StringWriter,
state: [
number, // GenColumn
],
): number {
const scope = scopes[index];
const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, 4: kind, vars } = scope;
if (index > 0) writer.write(comma);
state[0] = encodeInteger(writer, startLine, state[0]);
encodeInteger(writer, startColumn, 0);
encodeInteger(writer, kind, 0);
const fields = scope.length === 6 ? 0b0001 : 0;
encodeInteger(writer, fields, 0);
if (scope.length === 6) encodeInteger(writer, scope[5], 0);
for (const v of vars) {
encodeInteger(writer, v, 0);
}
for (index++; index < scopes.length; ) {
const next = scopes[index];
const { 0: l, 1: c } = next;
if (l > endLine || (l === endLine && c >= endColumn)) {
break;
}
index = _encodeOriginalScopes(scopes, index, writer, state);
}
writer.write(comma);
state[0] = encodeInteger(writer, endLine, state[0]);
encodeInteger(writer, endColumn, 0);
return index;
}
export function decodeGeneratedRanges(input: string): GeneratedRange[] {
const { length } = input;
const reader = new StringReader(input);
const ranges: GeneratedRange[] = [];
const stack: GeneratedRange[] = [];
let genLine = 0;
let definitionSourcesIndex = 0;
let definitionScopeIndex = 0;
let callsiteSourcesIndex = 0;
let callsiteLine = 0;
let callsiteColumn = 0;
let bindingLine = 0;
let bindingColumn = 0;
do {
const semi = reader.indexOf(';');
let genColumn = 0;
for (; reader.pos < semi; reader.pos++) {
genColumn = decodeInteger(reader, genColumn);
if (!hasMoreVlq(reader, semi)) {
const last = stack.pop()!;
last[2] = genLine;
last[3] = genColumn;
continue;
}
const fields = decodeInteger(reader, 0);
const hasDefinition = fields & 0b0001;
const hasCallsite = fields & 0b0010;
const hasScope = fields & 0b0100;
let callsite: CallSite | null = null;
let bindings: Binding[] = EMPTY;
let range: GeneratedRange;
if (hasDefinition) {
const defSourcesIndex = decodeInteger(reader, definitionSourcesIndex);
definitionScopeIndex = decodeInteger(
reader,
definitionSourcesIndex === defSourcesIndex ? definitionScopeIndex : 0,
);
definitionSourcesIndex = defSourcesIndex;
range = [genLine, genColumn, 0, 0, defSourcesIndex, definitionScopeIndex] as GeneratedRange;
} else {
range = [genLine, genColumn, 0, 0] as GeneratedRange;
}
range.isScope = !!hasScope;
if (hasCallsite) {
const prevCsi = callsiteSourcesIndex;
const prevLine = callsiteLine;
callsiteSourcesIndex = decodeInteger(reader, callsiteSourcesIndex);
const sameSource = prevCsi === callsiteSourcesIndex;
callsiteLine = decodeInteger(reader, sameSource ? callsiteLine : 0);
callsiteColumn = decodeInteger(
reader,
sameSource && prevLine === callsiteLine ? callsiteColumn : 0,
);
callsite = [callsiteSourcesIndex, callsiteLine, callsiteColumn];
}
range.callsite = callsite;
if (hasMoreVlq(reader, semi)) {
bindings = [];
do {
bindingLine = genLine;
bindingColumn = genColumn;
const expressionsCount = decodeInteger(reader, 0);
let expressionRanges: BindingExpressionRange[];
if (expressionsCount < -1) {
expressionRanges = [[decodeInteger(reader, 0)]];
for (let i = -1; i > expressionsCount; i--) {
const prevBl = bindingLine;
bindingLine = decodeInteger(reader, bindingLine);
bindingColumn = decodeInteger(reader, bindingLine === prevBl ? bindingColumn : 0);
const expression = decodeInteger(reader, 0);
expressionRanges.push([expression, bindingLine, bindingColumn]);
}
} else {
expressionRanges = [[expressionsCount]];
}
bindings.push(expressionRanges);
} while (hasMoreVlq(reader, semi));
}
range.bindings = bindings;
ranges.push(range);
stack.push(range);
}
genLine++;
reader.pos = semi + 1;
} while (reader.pos < length);
return ranges;
}
export function encodeGeneratedRanges(ranges: GeneratedRange[]): string {
if (ranges.length === 0) return '';
const writer = new StringWriter();
for (let i = 0; i < ranges.length; ) {
i = _encodeGeneratedRanges(ranges, i, writer, [0, 0, 0, 0, 0, 0, 0]);
}
return writer.flush();
}
function _encodeGeneratedRanges(
ranges: GeneratedRange[],
index: number,
writer: StringWriter,
state: [
number, // GenLine
number, // GenColumn
number, // DefSourcesIndex
number, // DefScopesIndex
number, // CallSourcesIndex
number, // CallLine
number, // CallColumn
],
): number {
const range = ranges[index];
const {
0: startLine,
1: startColumn,
2: endLine,
3: endColumn,
isScope,
callsite,
bindings,
} = range;
if (state[0] < startLine) {
catchupLine(writer, state[0], startLine);
state[0] = startLine;
state[1] = 0;
} else if (index > 0) {
writer.write(comma);
}
state[1] = encodeInteger(writer, range[1], state[1]);
const fields =
(range.length === 6 ? 0b0001 : 0) | (callsite ? 0b0010 : 0) | (isScope ? 0b0100 : 0);
encodeInteger(writer, fields, 0);
if (range.length === 6) {
const { 4: sourcesIndex, 5: scopesIndex } = range;
if (sourcesIndex !== state[2]) {
state[3] = 0;
}
state[2] = encodeInteger(writer, sourcesIndex, state[2]);
state[3] = encodeInteger(writer, scopesIndex, state[3]);
}
if (callsite) {
const { 0: sourcesIndex, 1: callLine, 2: callColumn } = range.callsite!;
if (sourcesIndex !== state[4]) {
state[5] = 0;
state[6] = 0;
} else if (callLine !== state[5]) {
state[6] = 0;
}
state[4] = encodeInteger(writer, sourcesIndex, state[4]);
state[5] = encodeInteger(writer, callLine, state[5]);
state[6] = encodeInteger(writer, callColumn, state[6]);
}
if (bindings) {
for (const binding of bindings) {
if (binding.length > 1) encodeInteger(writer, -binding.length, 0);
const expression = binding[0][0];
encodeInteger(writer, expression, 0);
let bindingStartLine = startLine;
let bindingStartColumn = startColumn;
for (let i = 1; i < binding.length; i++) {
const expRange = binding[i];
bindingStartLine = encodeInteger(writer, expRange[1]!, bindingStartLine);
bindingStartColumn = encodeInteger(writer, expRange[2]!, bindingStartColumn);
encodeInteger(writer, expRange[0]!, 0);
}
}
}
for (index++; index < ranges.length; ) {
const next = ranges[index];
const { 0: l, 1: c } = next;
if (l > endLine || (l === endLine && c >= endColumn)) {
break;
}
index = _encodeGeneratedRanges(ranges, index, writer, state);
}
if (state[0] < endLine) {
catchupLine(writer, state[0], endLine);
state[0] = endLine;
state[1] = 0;
} else {
writer.write(comma);
}
state[1] = encodeInteger(writer, endColumn, state[1]);
return index;
}
function catchupLine(writer: StringWriter, lastLine: number, line: number) {
do {
writer.write(semicolon);
} while (++lastLine < line);
}
@@ -0,0 +1,238 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function() {
return _default;
}
});
const _dlv = /*#__PURE__*/ _interop_require_default(require("dlv"));
const _didyoumean = /*#__PURE__*/ _interop_require_default(require("didyoumean"));
const _transformThemeValue = /*#__PURE__*/ _interop_require_default(require("../util/transformThemeValue"));
const _index = /*#__PURE__*/ _interop_require_default(require("../value-parser/index"));
const _normalizeScreens = require("../util/normalizeScreens");
const _buildMediaQuery = /*#__PURE__*/ _interop_require_default(require("../util/buildMediaQuery"));
const _toPath = require("../util/toPath");
const _withAlphaVariable = require("../util/withAlphaVariable");
const _pluginUtils = require("../util/pluginUtils");
const _log = /*#__PURE__*/ _interop_require_default(require("../util/log"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
function isObject(input) {
return typeof input === "object" && input !== null;
}
function findClosestExistingPath(theme, path) {
let parts = (0, _toPath.toPath)(path);
do {
parts.pop();
if ((0, _dlv.default)(theme, parts) !== undefined) break;
}while (parts.length);
return parts.length ? parts : undefined;
}
function pathToString(path) {
if (typeof path === "string") return path;
return path.reduce((acc, cur, i)=>{
if (cur.includes(".")) return `${acc}[${cur}]`;
return i === 0 ? cur : `${acc}.${cur}`;
}, "");
}
function list(items) {
return items.map((key)=>`'${key}'`).join(", ");
}
function listKeys(obj) {
return list(Object.keys(obj));
}
function validatePath(config, path, defaultValue, themeOpts = {}) {
const pathString = Array.isArray(path) ? pathToString(path) : path.replace(/^['"]+|['"]+$/g, "");
const pathSegments = Array.isArray(path) ? path : (0, _toPath.toPath)(pathString);
const value = (0, _dlv.default)(config.theme, pathSegments, defaultValue);
if (value === undefined) {
let error = `'${pathString}' does not exist in your theme config.`;
const parentSegments = pathSegments.slice(0, -1);
const parentValue = (0, _dlv.default)(config.theme, parentSegments);
if (isObject(parentValue)) {
const validKeys = Object.keys(parentValue).filter((key)=>validatePath(config, [
...parentSegments,
key
]).isValid);
const suggestion = (0, _didyoumean.default)(pathSegments[pathSegments.length - 1], validKeys);
if (suggestion) {
error += ` Did you mean '${pathToString([
...parentSegments,
suggestion
])}'?`;
} else if (validKeys.length > 0) {
error += ` '${pathToString(parentSegments)}' has the following valid keys: ${list(validKeys)}`;
}
} else {
const closestPath = findClosestExistingPath(config.theme, pathString);
if (closestPath) {
const closestValue = (0, _dlv.default)(config.theme, closestPath);
if (isObject(closestValue)) {
error += ` '${pathToString(closestPath)}' has the following keys: ${listKeys(closestValue)}`;
} else {
error += ` '${pathToString(closestPath)}' is not an object.`;
}
} else {
error += ` Your theme has the following top-level keys: ${listKeys(config.theme)}`;
}
}
return {
isValid: false,
error
};
}
if (!(typeof value === "string" || typeof value === "number" || typeof value === "function" || value instanceof String || value instanceof Number || Array.isArray(value))) {
let error = `'${pathString}' was found but does not resolve to a string.`;
if (isObject(value)) {
let validKeys = Object.keys(value).filter((key)=>validatePath(config, [
...pathSegments,
key
]).isValid);
if (validKeys.length) {
error += ` Did you mean something like '${pathToString([
...pathSegments,
validKeys[0]
])}'?`;
}
}
return {
isValid: false,
error
};
}
const [themeSection] = pathSegments;
return {
isValid: true,
value: (0, _transformThemeValue.default)(themeSection)(value, themeOpts)
};
}
function extractArgs(node, vNodes, functions) {
vNodes = vNodes.map((vNode)=>resolveVNode(node, vNode, functions));
let args = [
""
];
for (let vNode of vNodes){
if (vNode.type === "div" && vNode.value === ",") {
args.push("");
} else {
args[args.length - 1] += _index.default.stringify(vNode);
}
}
return args;
}
function resolveVNode(node, vNode, functions) {
if (vNode.type === "function" && functions[vNode.value] !== undefined) {
let args = extractArgs(node, vNode.nodes, functions);
vNode.type = "word";
vNode.value = functions[vNode.value](node, ...args);
}
return vNode;
}
function resolveFunctions(node, input, functions) {
let hasAnyFn = Object.keys(functions).some((fn)=>input.includes(`${fn}(`));
if (!hasAnyFn) return input;
return (0, _index.default)(input).walk((vNode)=>{
resolveVNode(node, vNode, functions);
}).toString();
}
let nodeTypePropertyMap = {
atrule: "params",
decl: "value"
};
/**
* @param {string} path
* @returns {Iterable<[path: string, alpha: string|undefined]>}
*/ function* toPaths(path) {
// Strip quotes from beginning and end of string
// This allows the alpha value to be present inside of quotes
path = path.replace(/^['"]+|['"]+$/g, "");
let matches = path.match(/^([^\s]+)(?![^\[]*\])(?:\s*\/\s*([^\/\s]+))$/);
let alpha = undefined;
yield [
path,
undefined
];
if (matches) {
path = matches[1];
alpha = matches[2];
yield [
path,
alpha
];
}
}
/**
*
* @param {any} config
* @param {string} path
* @param {any} defaultValue
*/ function resolvePath(config, path, defaultValue) {
const results = Array.from(toPaths(path)).map(([path, alpha])=>{
return Object.assign(validatePath(config, path, defaultValue, {
opacityValue: alpha
}), {
resolvedPath: path,
alpha
});
});
var _results_find;
return (_results_find = results.find((result)=>result.isValid)) !== null && _results_find !== void 0 ? _results_find : results[0];
}
function _default(context) {
let config = context.tailwindConfig;
let functions = {
theme: (node, path, ...defaultValue)=>{
let { isValid , value , error , alpha } = resolvePath(config, path, defaultValue.length ? defaultValue : undefined);
if (!isValid) {
var _parentNode_raws_tailwind;
let parentNode = node.parent;
let candidate = (_parentNode_raws_tailwind = parentNode === null || parentNode === void 0 ? void 0 : parentNode.raws.tailwind) === null || _parentNode_raws_tailwind === void 0 ? void 0 : _parentNode_raws_tailwind.candidate;
if (parentNode && candidate !== undefined) {
// Remove this utility from any caches
context.markInvalidUtilityNode(parentNode);
// Remove the CSS node from the markup
parentNode.remove();
// Show a warning
_log.default.warn("invalid-theme-key-in-class", [
`The utility \`${candidate}\` contains an invalid theme value and was not generated.`
]);
return;
}
throw node.error(error);
}
let maybeColor = (0, _pluginUtils.parseColorFormat)(value);
let isColorFunction = maybeColor !== undefined && typeof maybeColor === "function";
if (alpha !== undefined || isColorFunction) {
if (alpha === undefined) {
alpha = 1.0;
}
value = (0, _withAlphaVariable.withAlphaValue)(maybeColor, alpha, maybeColor);
}
return value;
},
screen: (node, screen)=>{
screen = screen.replace(/^['"]+/g, "").replace(/['"]+$/g, "");
let screens = (0, _normalizeScreens.normalizeScreens)(config.theme.screens);
let screenDefinition = screens.find(({ name })=>name === screen);
if (!screenDefinition) {
throw node.error(`The '${screen}' screen does not exist in your theme.`);
}
return (0, _buildMediaQuery.default)(screenDefinition);
}
};
return (root)=>{
root.walk((node)=>{
let property = nodeTypePropertyMap[node.type];
if (property === undefined) {
return;
}
node[property] = resolveFunctions(node, node[property], functions);
});
};
}
@@ -0,0 +1,27 @@
{
"name": "@types/estree-jsx",
"version": "1.0.5",
"description": "TypeScript definitions for estree-jsx",
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree-jsx",
"license": "MIT",
"contributors": [
{
"name": "Tony Ross",
"githubUsername": "antross",
"url": "https://github.com/antross"
}
],
"main": "",
"types": "index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"directory": "types/estree-jsx"
},
"scripts": {},
"dependencies": {
"@types/estree": "*"
},
"typesPublisherContentHash": "42fda803cc34f935c5a60a45e66b78e18fac56ef350d2d47c00759e16d4fef7f",
"typeScriptVersion": "4.6"
}
@@ -0,0 +1,94 @@
'use strict';
var utils = require('../utils.js');
require('eslint-visitor-keys');
require('espree');
require('estraverse');
const PRESERVE_PREFIX_SPACE_BEFORE_GENERIC = /* @__PURE__ */ new Set([
"TSCallSignatureDeclaration",
"ArrowFunctionExpression",
"TSFunctionType",
"FunctionExpression"
]);
var typeGenericSpacing = utils.createRule({
name: "type-generic-spacing",
package: "plus",
meta: {
type: "layout",
docs: {
description: "Enforces consistent spacing inside TypeScript type generics"
},
fixable: "whitespace",
schema: [],
messages: {
genericSpacingMismatch: "Generic spaces mismatch"
}
},
defaultOptions: [],
create: (context) => {
const sourceCode = context.sourceCode;
return {
TSTypeParameterDeclaration: (node) => {
if (!PRESERVE_PREFIX_SPACE_BEFORE_GENERIC.has(node.parent.type)) {
const pre = sourceCode.text.slice(0, node.range[0]);
const preSpace = pre.match(/(\s+)$/)?.[0];
if (preSpace && preSpace.length) {
context.report({
node,
messageId: "genericSpacingMismatch",
*fix(fixer) {
yield fixer.replaceTextRange([node.range[0] - preSpace.length, node.range[0]], "");
}
});
}
}
const params = node.params;
for (let i = 1; i < params.length; i++) {
const prev = params[i - 1];
const current = params[i];
const from = prev.range[1];
const to = current.range[0];
const span = sourceCode.text.slice(from, to);
if (span !== ", " && !span.match(/,\s*\n/)) {
context.report({
*fix(fixer) {
yield fixer.replaceTextRange([from, to], ", ");
},
loc: {
start: prev.loc.end,
end: current.loc.start
},
messageId: "genericSpacingMismatch",
node
});
}
}
},
// add space around = in type Foo<T = true>
TSTypeParameter: (node) => {
if (!node.default)
return;
const endNode = node.constraint || node.name;
const from = endNode.range[1];
const to = node.default.range[0];
const span = sourceCode.text.slice(from, to);
if (!span.match(/(?:^|[^ ]) = (?:$|[^ ])/)) {
context.report({
*fix(fixer) {
yield fixer.replaceTextRange([from, to], span.replace(/\s*=\s*/, " = "));
},
loc: {
start: endNode.loc.end,
end: node.default.loc.start
},
messageId: "genericSpacingMismatch",
node
});
}
}
};
}
});
module.exports = typeGenericSpacing;
@@ -0,0 +1,93 @@
import { ContextualKeyword } from "./keywords";
import { type TokenType } from "./types";
export declare enum IdentifierRole {
Access = 0,
ExportAccess = 1,
TopLevelDeclaration = 2,
FunctionScopedDeclaration = 3,
BlockScopedDeclaration = 4,
ObjectShorthandTopLevelDeclaration = 5,
ObjectShorthandFunctionScopedDeclaration = 6,
ObjectShorthandBlockScopedDeclaration = 7,
ObjectShorthand = 8,
ImportDeclaration = 9,
ObjectKey = 10,
ImportAccess = 11
}
/**
* Extra information on jsxTagStart tokens, used to determine which of the three
* jsx functions are called in the automatic transform.
*/
export declare enum JSXRole {
NoChildren = 0,
OneChild = 1,
StaticChildren = 2,
KeyAfterPropSpread = 3
}
export declare function isDeclaration(token: Token): boolean;
export declare function isNonTopLevelDeclaration(token: Token): boolean;
export declare function isTopLevelDeclaration(token: Token): boolean;
export declare function isBlockScopedDeclaration(token: Token): boolean;
export declare function isFunctionScopedDeclaration(token: Token): boolean;
export declare function isObjectShorthandDeclaration(token: Token): boolean;
export declare class Token {
constructor();
type: TokenType;
contextualKeyword: ContextualKeyword;
start: number;
end: number;
scopeDepth: number;
isType: boolean;
identifierRole: IdentifierRole | null;
jsxRole: JSXRole | null;
shadowsGlobal: boolean;
isAsyncOperation: boolean;
contextId: number | null;
rhsEndIndex: number | null;
isExpression: boolean;
numNullishCoalesceStarts: number;
numNullishCoalesceEnds: number;
isOptionalChainStart: boolean;
isOptionalChainEnd: boolean;
subscriptStartIndex: number | null;
nullishStartIndex: number | null;
}
export declare function next(): void;
export declare function nextTemplateToken(): void;
export declare function retokenizeSlashAsRegex(): void;
export declare function pushTypeContext(existingTokensInType: number): boolean;
export declare function popTypeContext(oldIsType: boolean): void;
export declare function eat(type: TokenType): boolean;
export declare function eatTypeToken(tokenType: TokenType): void;
export declare function match(type: TokenType): boolean;
export declare function lookaheadType(): TokenType;
export declare class TypeAndKeyword {
type: TokenType;
contextualKeyword: ContextualKeyword;
constructor(type: TokenType, contextualKeyword: ContextualKeyword);
}
export declare function lookaheadTypeAndKeyword(): TypeAndKeyword;
export declare function nextTokenStart(): number;
export declare function nextTokenStartSince(pos: number): number;
export declare function lookaheadCharCode(): number;
export declare function nextToken(): void;
export declare function skipLineComment(startSkip: number): void;
export declare function skipSpace(): void;
export declare function finishToken(type: TokenType, contextualKeyword?: ContextualKeyword): void;
/**
* Reinterpret a possible > token when transitioning from a type to a non-type
* context.
*
* This comes up in two situations where >= needs to be treated as one token:
* - After an `as` expression, like in the code `a as T >= 1`.
* - In a type argument in an expression context, e.g. `f(a < b, c >= d)`, we
* need to see the token as >= so that we get an error and backtrack to
* normal expression parsing.
*
* Other situations require >= to be seen as two tokens, e.g.
* `const x: Array<T>=[];`, so it's important to treat > as its own token in
* typical type parsing situations.
*/
export declare function rescan_gt(): void;
export declare function getTokenFromCode(code: number): void;
export declare function skipWord(): void;
@@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.cloneBindingCache = cloneBindingCache;
function cloneBindingCache(cache) {
if (cache.isRight) {
return {
isRight: true,
value: cache.value,
};
}
// A left cache is not cloned, just returned
return cache;
}
//# sourceMappingURL=cloneBindingCache.js.map
@@ -0,0 +1,44 @@
{
"name": "content-disposition",
"description": "Create and parse Content-Disposition header",
"version": "1.0.0",
"author": "Douglas Christopher Wilson <doug@somethingdoug.com>",
"license": "MIT",
"keywords": [
"content-disposition",
"http",
"rfc6266",
"res"
],
"repository": "jshttp/content-disposition",
"dependencies": {
"safe-buffer": "5.2.1"
},
"devDependencies": {
"deep-equal": "1.0.1",
"eslint": "7.32.0",
"eslint-config-standard": "13.0.1",
"eslint-plugin-import": "2.25.3",
"eslint-plugin-markdown": "2.2.1",
"eslint-plugin-node": "11.1.0",
"eslint-plugin-promise": "5.2.0",
"eslint-plugin-standard": "4.1.0",
"mocha": "^9.2.2",
"nyc": "15.1.0"
},
"files": [
"LICENSE",
"HISTORY.md",
"README.md",
"index.js"
],
"engines": {
"node": ">= 0.6"
},
"scripts": {
"lint": "eslint .",
"test": "mocha --reporter spec --bail --check-leaks test/",
"test-ci": "nyc --reporter=lcovonly --reporter=text npm test",
"test-cov": "nyc --reporter=html --reporter=text npm test"
}
}
@@ -0,0 +1,67 @@
'use strict';
import utils from '../utils.js';
import AxiosURLSearchParams from '../helpers/AxiosURLSearchParams.js';
/**
* It replaces all instances of the characters `:`, `$`, `,`, `+`, `[`, and `]` with their
* URI encoded counterparts
*
* @param {string} val The value to be encoded.
*
* @returns {string} The encoded value.
*/
function encode(val) {
return encodeURIComponent(val).
replace(/%3A/gi, ':').
replace(/%24/g, '$').
replace(/%2C/gi, ',').
replace(/%20/g, '+');
}
/**
* Build a URL by appending params to the end
*
* @param {string} url The base of the url (e.g., http://www.google.com)
* @param {object} [params] The params to be appended
* @param {?(object|Function)} options
*
* @returns {string} The formatted url
*/
export default function buildURL(url, params, options) {
/*eslint no-param-reassign:0*/
if (!params) {
return url;
}
const _encode = options && options.encode || encode;
if (utils.isFunction(options)) {
options = {
serialize: options
};
}
const serializeFn = options && options.serialize;
let serializedParams;
if (serializeFn) {
serializedParams = serializeFn(params, options);
} else {
serializedParams = utils.isURLSearchParams(params) ?
params.toString() :
new AxiosURLSearchParams(params, options).toString(_encode);
}
if (serializedParams) {
const hashmarkIndex = url.indexOf("#");
if (hashmarkIndex !== -1) {
url = url.slice(0, hashmarkIndex);
}
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;
}
return url;
}
@@ -0,0 +1 @@
{"name":"@react-aria/selection","version":"3.26.0","requiresBuild":false,"files":{"LICENSE":{"checkedAt":1794532107085,"integrity":"sha512-cil7stSp3ik41Hdv2Dj+GMcbvUfs1q+MZ2Yte0804py9i6oJJN/diCiIr/brcQOZ5ZqwAI6dgaHA7l8FZheQBw==","mode":420,"size":11335},"dist/DOMLayoutDelegate.main.js":{"checkedAt":1794532107085,"integrity":"sha512-6ihOgvaRoxfETPhQeGaa5MxfAth45Ipv8Ob6MK39RFtCcTtZT1kMmJvdngB4RubJTwP9mpkwzi42wjUDhQiw5g==","mode":420,"size":3258},"dist/DOMLayoutDelegate.module.js":{"checkedAt":1794532107085,"integrity":"sha512-OgZsXKCv/v4ZT1Po15YlIUZ3cEICUXpozJ3JRlbJhfdyBQOMGwSDLlgur10dTEEFLNegSPkOgIIA08k5rcnrRg==","mode":420,"size":3138},"dist/ListKeyboardDelegate.main.js":{"checkedAt":1794532107085,"integrity":"sha512-AcCHXs0XOksPL1HzYIVNAO/R79qGcny5mnN83Mv301Q4Dd7G/HLJNSRjhhpcOQMlPAGS15Z+lL8pPcxdQyuJHA==","mode":420,"size":9673},"dist/ListKeyboardDelegate.module.js":{"checkedAt":1794532107085,"integrity":"sha512-I6+OxUzmVZ71km5/UFZrJCOCUXCtYfq4unBZAEkSwx4Pu8d8yZ8kpJEwVyPS0VBeC6UA5sVwWi8jw+F9lpi0dQ==","mode":420,"size":9534},"dist/main.js":{"checkedAt":1794532107085,"integrity":"sha512-v79wU+ec/JnxdM++4uUXNbYsLPP1xufZOisJzNv3Jy30W6xu/SI6Hf5yC0vcSKS50cc0zwpGOi8ogue/KmxR0A==","mode":420,"size":1862},"dist/module.js":{"checkedAt":1794532107085,"integrity":"sha512-9asTpsfmGzsIttIiHvs2nvLrLeV59rjSKa/Q2V03wPpJjyv1uPew8nGp/oWuZOhGHiVCDfe4fqQECId6bFss3g==","mode":420,"size":1732},"dist/useSelectableCollection.main.js":{"checkedAt":1794532107086,"integrity":"sha512-Ism7hXCj4vcH6HIquex8NPW8FCX1kHUsd5vg8jefjTFIHvgH3+18hEn0DA+f5WZu3RF9hspnVMBJhW6NSA0YZA==","mode":420,"size":25885},"dist/useSelectableCollection.module.js":{"checkedAt":1794532107086,"integrity":"sha512-AU34629zHzpPpVt56jPdFk5RaQJ89aE1ZlX3GgdyN9zZihWwq9XLnjDxJojSPoEwmWJiVcIxkaCxt+eJZ6NCOQ==","mode":420,"size":26076},"dist/useSelectableItem.main.js":{"checkedAt":1794532107086,"integrity":"sha512-LnvkrWRDpsr8t+q7+1mA4CVY7cCIYKsdGx8KjV/8dcbVpdBDJUxP9jSh/aii1/oigH8BQwqfIRh1sk7Q9/T/2g==","mode":420,"size":14451},"dist/useSelectableItem.module.js":{"checkedAt":1794532107086,"integrity":"sha512-7wFfBLiV40jbdrtHHC8FhtTpIh+PasQUU5faKmdhpPKuRxRL06/vsNEv4jbIEvWM84M7fWIrWlqpE40FXDzsAQ==","mode":420,"size":14475},"dist/useSelectableList.main.js":{"checkedAt":1794532107086,"integrity":"sha512-nSSQMUrxVgGg8LmjEBk4rYlzZYSWL6nv3W7nDN4TnrjenYPttayZjd24V7DDs7T+Gv0jwW/wJz1yTArodiVsgQ==","mode":420,"size":2602},"dist/useSelectableList.module.js":{"checkedAt":1794532107086,"integrity":"sha512-4u+wmq74ddRbJXBayv5dZY1Sy6o8GpWaqRWOBMkDGdhUn2GqjinkIjTgjgvGWcdkB1HI513iPrNXwsNZJVE0kg==","mode":420,"size":2522},"dist/useTypeSelect.main.js":{"checkedAt":1794532107086,"integrity":"sha512-DJksLdnnZ4MJto/S2c6c9aAOUso19JSe95/bLMirDok3HFoQp3wvihr4T0EghIIVipM7sTeZwPVvXP17CkyKRQ==","mode":420,"size":3598},"dist/useTypeSelect.module.js":{"checkedAt":1794532107087,"integrity":"sha512-KAYBsVr8bs0f1eVgpAyH+eDuJYBj3iA52OFeFjhyqrZ4vd/xnGUUOQoTwAziMIjwfGVi4VMryPM+RGKtCR9m4w==","mode":420,"size":3446},"dist/utils.main.js":{"checkedAt":1794532107087,"integrity":"sha512-t8Iim+asGXCci3B/kIrDKgY1khrsFAAkjf3deRBr6hiXAwIme/bd/iZDc9Zn2pb1/rQCfVawHUMh4LjAzY+rqg==","mode":420,"size":2566},"dist/utils.module.js":{"checkedAt":1794532107087,"integrity":"sha512-T6pomPebLyY0XaG2nQV0DGYpphZ7SXLYDtECW7+MfrbENE7KOeoAtiOWBTSzF0SymsYnXtm8INn5f5SBi/ZF3w==","mode":420,"size":2304},"package.json":{"checkedAt":1794532107087,"integrity":"sha512-MK/XPZWe0Ggq6vD61bRIXSLf72H2BY7mH2j1kUi6kXqxBlv1l/yKWR511KJRlPsotpvZIgLQopUNehltLAal/Q==","mode":420,"size":1162},"dist/DOMLayoutDelegate.main.js.map":{"checkedAt":1794532107087,"integrity":"sha512-j9EJ9r/OMNmiD7RSOFg11e2yyF7UcOHjWd5ySbLYVE/+31YuC58Ox/AixUIzZlx2l9BFPlLXneDsBV1WxHJ26A==","mode":420,"size":3279},"dist/DOMLayoutDelegate.module.js.map":{"checkedAt":1794532107087,"integrity":"sha512-J+zoQOR1uji1jXMqohhFtVFkTw84vVgKCHObxs3hsIzwx5zDnzLMKxtVx2+3DrfR+a0XRIT+UQ4achevwaeL3g==","mode":420,"size":3275},"dist/ListKeyboardDelegate.main.js.map":{"checkedAt":1794532107087,"integrity":"sha512-/tlRx/j1c8jQES1qkU185LDbRw3bK3CZsskpvFqZO472fmeOOuis3ouEv3HQ+fHEMPNRYNkLP6n7BPJ4O5Oo1w==","mode":420,"size":16963},"dist/ListKeyboardDelegate.module.js.map":{"checkedAt":1794532107088,"integrity":"sha512-V/WS+BN4ug+zSbtcnysS/UTmhzbU77UQ2URTbTif+3BJvfkwEiacFa15QAOB4SU4XO9QqzBC8Y0epBKL2MIfAQ==","mode":420,"size":16959},"dist/main.js.map":{"checkedAt":1794532107088,"integrity":"sha512-Lz7BxlQ5Gnx2fkgugUMqiEgb+ue8feWivjL6OAbDxpjKYMDy1YzwPNBAKEgqr6gcFG9yG0hXBxp4CxIc0MXOoA==","mode":420,"size":1540},"dist/module.js.map":{"checkedAt":1794532107088,"integrity":"sha512-4SqLtqAT1Bs8tSdHr8hyQioQlFDvkINKDgYKThXNEim9v3x6Bm+yZnBFoDfr+VBXBwp1eo4zgN0Xtsz4pkfTug==","mode":420,"size":1531},"dist/types.d.ts.map":{"checkedAt":1794532107088,"integrity":"sha512-yz65Ge58IFEV9R6aP3KIJdGVKp6ABkALYZNVGxKCnO0cIxCu2y8Oh6mshieF5zW0iEe1bHnepM8b1F0m0zRLfQ==","mode":420,"size":5990},"dist/useSelectableCollection.main.js.map":{"checkedAt":1794532107088,"integrity":"sha512-l0ERNReAtnpbyBgCu43LwEh+Be6DGQKM6GoR0xfTEinZk1jnV6zHJzwvLine truncated
@@ -0,0 +1,72 @@
import { expect, expectTypeOf, test } from "vitest";
import * as z from "zod/v4";
function nest<TData extends z.ZodType>(schema: TData) {
return z.object({
nested: schema,
});
}
test("generics", () => {
const a = nest(z.object({ a: z.string() }));
type a = z.infer<typeof a>;
expectTypeOf<a>().toEqualTypeOf<{ nested: { a: string } }>();
const b = nest(z.object({ a: z.string().optional() }));
type b = z.infer<typeof b>;
expectTypeOf<b>().toEqualTypeOf<{ nested: { a?: string | undefined } }>();
});
test("generics with optional", () => {
async function stripOuter<TData extends z.ZodType>(schema: TData, data: unknown) {
return z
.object({
nested: schema.optional(),
})
.transform((data) => {
return data.nested;
})
.parse({ nested: data });
}
const result = stripOuter(z.object({ a: z.string() }), { a: "asdf" });
expectTypeOf<typeof result>().toEqualTypeOf<Promise<{ a: string } | undefined>>();
});
// test("assignability", () => {
// const createSchemaAndParse = <K extends string, VS extends z.ZodString>(key: K, valueSchema: VS, data: unknown) => {
// const schema = z.object({
// [key]: valueSchema,
// });
// // return { [key]: valueSchema };
// const parsed = schema.parse(data);
// return parsed;
// // const inferred: z.infer<z.ZodObject<{ [k in K]: VS }>> = parsed;
// // return inferred;
// };
// const parsed = createSchemaAndParse("foo", z.string(), { foo: "" });
// expectTypeOf<typeof parsed>().toEqualTypeOf<{ foo: string }>();
// });
test("nested no undefined", () => {
const inner = z.string().or(z.array(z.string()));
const outer = z.object({ inner });
type outerSchema = z.infer<typeof outer>;
expectTypeOf<outerSchema>().toEqualTypeOf<{ inner: string | string[] }>();
expect(outer.safeParse({ inner: undefined }).success).toEqual(false);
});
test("generic on output type", () => {
const createV4Schema = <Output>(opts: {
schema: z.ZodType<Output>;
}) => {
return opts.schema;
};
createV4Schema({
schema: z.object({
name: z.string(),
}),
})?._zod?.output?.name;
});
@@ -0,0 +1 @@
export { parse, safeParse, parseAsync, safeParseAsync } from "../core/index.cjs";
@@ -0,0 +1 @@
{"mappings":";;;;;AAAA;;;;;;;;;;CAUC;;;;AAiDD,MAAM,gDAA0B;IAC9B,WAAW;IACX,YAAY;AACd;AAMO,SAAS,0CAAgC,KAAyB;IACvE,IAAI,CAAC,8BAA8B,8BAA8B,GAAG,CAAA,GAAA,eAAO,EAAE;IAC7E,IAAI,iBAAC,gBAAgB,iCAAQ,uBAAuB,mBAAE,eAAe,EAAC,GAAG;IAEzE,IAAI,UAAU,CAAA,GAAA,cAAM,EAAE,IAAO,CAAA;YAC3B,yBAAyB,2BAA2B,kBAAkB;YACtE,iBAAiB;2BACjB;YACA,SAAS,EAAE;QAEb,CAAA,GAAI;QAAC,MAAM,QAAQ;QAAE;QAAyB;QAAe;KAAgB;IAE7E,IAAI,aAAa,CAAA,GAAA,oBAAY,EAC3B,OACA,CAAA,GAAA,kBAAU,EAAE,CAAC,QAAU,IAAI,CAAA,GAAA,yCAAc,EAAE,OAAO,MAAM,UAAU;QAAC;KAAQ,GAC3E;IAEF,IAAI,gBAAC,YAAY,oBAAE,gBAAgB,EAAC,GAAG,CAAA,GAAA,mBAAW,EAAE;QAClD,GAAG,KAAK;oBACR;QACA,kBAAkB,MAAM,gBAAgB,IAAI;IAC9C;QAOkB;IALlB,OAAO;oBACL;sBACA;0BACA;QACA,yBAAyB,MAAM,uBAAuB,IAAI;QAC1D,gBAAgB,CAAA,wBAAA,MAAM,cAAc,cAApB,mCAAA,wBAAwB;QACxC,8BAA8B,WAAW,IAAI,KAAK,KAAK;uCACvD;QACA,MAAK,SAAc,EAAE,SAAsC;gBAG9B,uBAF3B;aAAA,sBAAA,MAAM,YAAY,cAAlB,0CAAA,yBAAA,OAAqB;gBACnB,QAAQ;gBACR,WAAW,sBAAA,uBAAA,YAAc,EAAA,wBAAA,MAAM,cAAc,cAApB,4CAAA,sBAAsB,MAAM,MAAK,YACtD,6CAAuB,CAAC,MAAM,cAAc,CAAC,SAAS,CAAC,GACvD;YACN;QACF;IACF;AACF;AAKO,SAAS,0CAAiD,KAAoB,EAAE,QAA4E;IACjK,IAAI,aAAa,CAAA,GAAA,cAAM,EAAE,IAAM,WAAW,MAAM,UAAU,CAAC,MAAM,CAAE,YAAY,MAAM,UAAU,EAAE;QAAC,MAAM,UAAU;QAAE;KAAS;IAC7H,IAAI,mBAAmB,MAAM,gBAAgB,CAAC,cAAc,CAAC;IAC7D,8DAA8D;IAE9D,OAAO;QACL,GAAG,KAAK;oBACR;0BACA;IACF;AACF","sources":["packages/@react-stately/table/src/useTableState.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {GridState, useGridState} from '@react-stately/grid';\nimport {TableCollection as ITableCollection, TableBodyProps, TableHeaderProps} from '@react-types/table';\nimport {Key, Node, SelectionMode, Sortable, SortDescriptor, SortDirection} from '@react-types/shared';\nimport {MultipleSelectionState, MultipleSelectionStateProps} from '@react-stately/selection';\nimport {ReactElement, useCallback, useMemo, useState} from 'react';\nimport {TableCollection} from './TableCollection';\nimport {useCollection} from '@react-stately/collections';\n\nexport interface TableState<T> extends GridState<T, ITableCollection<T>> {\n /** A collection of rows and columns in the table. */\n collection: ITableCollection<T>,\n /** Whether the row selection checkboxes should be displayed. */\n showSelectionCheckboxes: boolean,\n /** The current sorted column and direction. */\n sortDescriptor: SortDescriptor | null,\n /** Calls the provided onSortChange handler with the provided column key and sort direction. */\n sort(columnKey: Key, direction?: 'ascending' | 'descending'): void,\n /** Whether keyboard navigation is disabled, such as when the arrow keys should be handled by a component within a cell. */\n isKeyboardNavigationDisabled: boolean,\n /** Set whether keyboard navigation is disabled, such as when the arrow keys should be handled by a component within a cell. */\n setKeyboardNavigationDisabled: (val: boolean) => void\n}\n\nexport interface CollectionBuilderContext<T> {\n showSelectionCheckboxes: boolean,\n showDragButtons: boolean,\n selectionMode: SelectionMode,\n columns: Node<T>[]\n}\n\nexport interface TableStateProps<T> extends MultipleSelectionStateProps, Sortable {\n /** The elements that make up the table. Includes the TableHeader, TableBody, Columns, and Rows. */\n children?: [ReactElement<TableHeaderProps<T>>, ReactElement<TableBodyProps<T>>],\n /** A list of row keys to disable. */\n disabledKeys?: Iterable<Key>,\n /** A pre-constructed collection to use instead of building one from items and children. */\n collection?: ITableCollection<T>,\n /** Whether the row selection checkboxes should be displayed. */\n showSelectionCheckboxes?: boolean,\n /** Whether the row drag button should be displayed.\n * @private\n */\n showDragButtons?: boolean,\n /** @private - do not use unless you know what you're doing. */\n UNSAFE_selectionState?: MultipleSelectionState\n}\n\nconst OPPOSITE_SORT_DIRECTION = {\n ascending: 'descending' as SortDirection,\n descending: 'ascending' as SortDirection\n};\n\n/**\n * Provides state management for a table component. Handles building a collection\n * of columns and rows from props. In addition, it tracks row selection and manages sort order changes.\n */\nexport function useTableState<T extends object>(props: TableStateProps<T>): TableState<T> {\n let [isKeyboardNavigationDisabled, setKeyboardNavigationDisabled] = useState(false);\n let {selectionMode = 'none', showSelectLine truncated
@@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MappedKey = MappedKey;
const type_1 = require("../create/type");
const index_1 = require("../symbols/index");
// prettier-ignore
function MappedKey(T) {
return (0, type_1.CreateType)({
[index_1.Kind]: 'MappedKey',
keys: T
});
}
@@ -0,0 +1,33 @@
/**
* Generate URL-friendly unique ID. This method uses the non-secure
* predictable random generator with bigger collision probability.
*
* ```js
* import { nanoid } from 'nanoid/non-secure'
* model.id = nanoid() //=> "Uakgb_J5m9g-0JDMbcJqL"
* ```
*
* @param size Size of the ID. The default size is 21.
* @returns A random string.
*/
export function nanoid(size?: number): string
/**
* Generate a unique ID based on a custom alphabet.
* This method uses the non-secure predictable random generator
* with bigger collision probability.
*
* @param alphabet Alphabet used to generate the ID.
* @param defaultSize Size of the ID. The default size is 21.
* @returns A random string generator.
*
* ```js
* import { customAlphabet } from 'nanoid/non-secure'
* const nanoid = customAlphabet('0123456789абвгдеё', 5)
* model.id = //=> "8ё56а"
* ```
*/
export function customAlphabet(
alphabet: string,
defaultSize?: number
): (size?: number) => string
@@ -0,0 +1,42 @@
import type { EnumInfo } from "./reflection-info";
/**
* Is this a lookup object generated by Typescript, for a Typescript enum
* generated by protobuf-ts?
*
* - No `const enum` (enum must not be inlined, we need reverse mapping).
* - No string enum (we need int32 for protobuf).
* - Must have a value for 0 (otherwise, we would need to support custom default values).
*/
export declare function isEnumObject(arg: any): arg is EnumInfo[1];
/**
* Lists all values of a Typescript enum, as an array of objects with a "name"
* property and a "number" property.
*
* Note that it is possible that a number appears more than once, because it is
* possible to have aliases in an enum.
*
* Throws if the enum does not adhere to the rules of enums generated by
* protobuf-ts. See `isEnumObject()`.
*/
export declare function listEnumValues(enumObject: any): EnumObjectValue[];
/**
* A value of a Typescript enum generated by protobuf-ts.
*/
export declare type EnumObjectValue = {
name: string;
number: number;
};
/**
* Lists the names of a Typescript enum.
*
* Throws if the enum does not adhere to the rules of enums generated by
* protobuf-ts. See `isEnumObject()`.
*/
export declare function listEnumNames(enumObject: any): Array<string>;
/**
* Lists the numbers of a Typescript enum.
*
* Throws if the enum does not adhere to the rules of enums generated by
* protobuf-ts. See `isEnumObject()`.
*/
export declare function listEnumNumbers(enumObject: any): Array<number>;
@@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var BlockquoteRole = {
relatedConcepts: [{
module: 'HTML',
concept: {
name: 'blockquote'
}
}],
type: 'structure'
};
var _default = BlockquoteRole;
exports.default = _default;
@@ -0,0 +1,8 @@
"use strict";
function _class_check_private_static_field_descriptor(descriptor, action) {
if (descriptor === undefined) {
throw new TypeError("attempted to " + action + " private static field before its declaration");
}
}
exports._ = _class_check_private_static_field_descriptor;
@@ -0,0 +1,39 @@
// Spanish (Dominican Republic) [es-do]
import dayjs from '../index';
var locale = {
name: 'es-do',
weekdays: 'domingo_lunes_martes_miércoles_jueves_viernes_sábado'.split('_'),
weekdaysShort: 'dom._lun._mar._mié._jue._vie._sáb.'.split('_'),
weekdaysMin: 'do_lu_ma_mi_ju_vi_sá'.split('_'),
months: 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split('_'),
monthsShort: 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_'),
weekStart: 1,
relativeTime: {
future: 'en %s',
past: 'hace %s',
s: 'unos segundos',
m: 'un minuto',
mm: '%d minutos',
h: 'una hora',
hh: '%d horas',
d: 'un día',
dd: '%d días',
M: 'un mes',
MM: '%d meses',
y: 'un año',
yy: '%d años'
},
ordinal: function ordinal(n) {
return n + "\xBA";
},
formats: {
LT: 'h:mm A',
LTS: 'h:mm:ss A',
L: 'DD/MM/YYYY',
LL: 'D [de] MMMM [de] YYYY',
LLL: 'D [de] MMMM [de] YYYY h:mm A',
LLLL: 'dddd, D [de] MMMM [de] YYYY h:mm A'
}
};
dayjs.locale(locale, null, true);
export default locale;
@@ -0,0 +1,22 @@
/**
* Check if the value is an ES Module
*
* 校验是否是 ES Module
*
* @example
* ```js
* import { isESModule } from 'is-what-type';
*
* isESModule({}); // false
* isESModule({ __esModule: true }); // true
* isESModule({ [Symbol.toStringTag]: 'Module' }); // true
* isESModule('string'); // false
* isESModule(123); // false
* isESModule(null); // false
* isESModule(undefined); // false
* ```
*
* @param value THe value to check
* @returns `true` if the value is an ES Module, else `false`
*/
export declare function isESModule<T = object>(value: unknown): value is T;
@@ -0,0 +1,87 @@
/**
* @fileoverview Rule to flag when return statement contains assignment
* @author Ilya Volodin
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const astUtils = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
const SENTINEL_TYPE =
/^(?:[a-zA-Z]+?Statement|ArrowFunctionExpression|FunctionExpression|ClassExpression)$/u;
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "suggestion",
defaultOptions: ["except-parens"],
docs: {
description: "Disallow assignment operators in `return` statements",
recommended: false,
url: "https://eslint.org/docs/latest/rules/no-return-assign",
},
schema: [
{
enum: ["except-parens", "always"],
},
],
messages: {
returnAssignment: "Return statement should not contain assignment.",
arrowAssignment: "Arrow function should not return assignment.",
},
},
create(context) {
const always = context.options[0] !== "except-parens";
const sourceCode = context.sourceCode;
return {
AssignmentExpression(node) {
if (!always && astUtils.isParenthesised(sourceCode, node)) {
return;
}
let currentChild = node;
let parent = currentChild.parent;
// Find ReturnStatement or ArrowFunctionExpression in ancestors.
while (parent && !SENTINEL_TYPE.test(parent.type)) {
currentChild = parent;
parent = parent.parent;
}
// Reports.
if (parent && parent.type === "ReturnStatement") {
context.report({
node: parent,
messageId: "returnAssignment",
});
} else if (
parent &&
parent.type === "ArrowFunctionExpression" &&
parent.body === currentChild
) {
context.report({
node: parent,
messageId: "arrowAssignment",
});
}
},
};
},
};
@@ -0,0 +1 @@
{"version":3,"file":"jsx-space-before-closing.d.ts","sourceRoot":"","sources":["jsx-space-before-closing.js"],"names":[],"mappings":"wBAyBW,OAAO,QAAQ,EAAE,IAAI,CAAC,UAAU"}
@@ -0,0 +1,6 @@
'use strict';
/** @type {import('./isNegativeZero')} */
module.exports = function isNegativeZero(x) {
return x === 0 && 1 / x === 1 / -0;
};
@@ -0,0 +1,39 @@
var baseFor = require('./_baseFor'),
castFunction = require('./_castFunction'),
keysIn = require('./keysIn');
/**
* Iterates over own and inherited enumerable string keyed properties of an
* object and invokes `iteratee` for each property. The iteratee is invoked
* with three arguments: (value, key, object). Iteratee functions may exit
* iteration early by explicitly returning `false`.
*
* @static
* @memberOf _
* @since 0.3.0
* @category Object
* @param {Object} object The object to iterate over.
* @param {Function} [iteratee=_.identity] The function invoked per iteration.
* @returns {Object} Returns `object`.
* @see _.forInRight
* @example
*
* function Foo() {
* this.a = 1;
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.forIn(new Foo, function(value, key) {
* console.log(key);
* });
* // => Logs 'a', 'b', then 'c' (iteration order is not guaranteed).
*/
function forIn(object, iteratee) {
return object == null
? object
: baseFor(object, castFunction(iteratee), keysIn);
}
module.exports = forIn;
@@ -0,0 +1 @@
{"mappings":"AAAA,iBAAiB;IAAG,WAAW,CAAC,GAAG,CAAC;AACpC","sources":["packages/@react-aria/overlays/intl/da-DK.json"],"sourcesContent":["{\n \"dismiss\": \"Luk\"\n}\n"],"names":[],"version":3,"file":"da-DK.main.js.map"}
@@ -0,0 +1,10 @@
import type { TProperties } from '../object/index';
import { type TMappedResult } from '../mapped/index';
import { type TReadonlyWithFlag } from './readonly';
type TFromProperties<P extends TProperties, F extends boolean> = ({
[K2 in keyof P]: TReadonlyWithFlag<P[K2], F>;
});
type TFromMappedResult<R extends TMappedResult, F extends boolean> = (TFromProperties<R['properties'], F>);
export type TReadonlyFromMappedResult<R extends TMappedResult, F extends boolean, P extends TProperties = TFromMappedResult<R, F>> = (TMappedResult<P>);
export declare function ReadonlyFromMappedResult<R extends TMappedResult, F extends boolean, P extends TProperties = TFromMappedResult<R, F>>(R: R, F: F): TMappedResult<P>;
export {};
@@ -0,0 +1,11 @@
function pad(str, width, alignLeft = true) {
const diff = width - str.length;
if (diff <= 0) {
return str;
}
const padding = " ".repeat(diff);
return alignLeft ? str + padding : padding + str;
}
export {
pad as default
};
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;AAuIA,0CAyFC;AAhOD,iDAOsB;AACtB,8DAAoC;AACpC,6CAAoC;AACpC,yDAAiD;AACjD,+CAAwC;AAExC,qBAAqB;AACrB,MAAM,KAAK,GAAG,OAAO,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,qBAAU,CAAC,CAAC,CAAC,qBAAS,CAAA;AAsDpE;;;;;;GAMG;AACI,MAAM,eAAe,GAAG,CAC7B,MAAc,EAMd,EAAE;IACF,IAAI,CAAC,OAAO,EAAE,IAAI,GAAG,EAAE,EAAE,SAAS,GAAG,EAAE,EAAE,OAAO,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC,GAAG,MAAM,CAAA;IACrE,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE,CAAC;QAC/B,OAAO,GAAG,IAAI,CAAA;QACd,SAAS,GAAG,EAAE,CAAA;QACd,IAAI,GAAG,EAAE,CAAA;IACX,CAAC;SAAM,IAAI,CAAC,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACtE,IAAI,OAAO,SAAS,KAAK,UAAU;YAAE,OAAO,GAAG,SAAS,CAAA;QACxD,SAAS,GAAG,IAAI,CAAA;QAChB,IAAI,GAAG,EAAE,CAAA;IACX,CAAC;SAAM,IAAI,OAAO,SAAS,KAAK,UAAU,EAAE,CAAC;QAC3C,OAAO,GAAG,SAAS,CAAA;QACnB,SAAS,GAAG,EAAE,CAAA;IAChB,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3B,MAAM,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,OAAO,CAAA;QAC3B,OAAO,GAAG,EAAE,CAAA;QACZ,IAAI,GAAG,EAAE,CAAA;IACX,CAAC;IACD,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,SAAS,EAAE,EAAE,OAAO,CAAC,CAAA;AACnD,CAAC,CAAA;AA3BY,QAAA,eAAe,mBA2B3B;AAiCD,SAAgB,eAAe,CAC7B,GAAG,MAAc;IAEjB,MAAM,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,GAAG,IAAA,uBAAe,EAAC,MAAM,CAAC,CAAA;IAEnE,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;IAC3B,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAC7B,CAAC;IAED,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS,CAI3C,CAAA;IAED,MAAM,WAAW,GAAG,GAAG,EAAE;QACvB,IAAI,CAAC;YACH,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;YAEpB,qBAAqB;QACvB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,6BAA6B;YAC7B,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;QACvB,CAAC;QACD,oBAAoB;IACtB,CAAC,CAAA;IACD,MAAM,YAAY,GAAG,IAAA,oBAAM,EAAC,WAAW,CAAC,CAAA;IAExC,IAAA,+BAAY,EAAC,KAAK,CAAC,CAAA;IACnB,MAAM,GAAG,GAAG,IAAA,sBAAQ,EAAC,KAAK,CAAC,CAAA;IAE3B,IAAI,IAAI,GAAG,KAAK,CAAA;IAChB,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE;QACvC,qBAAqB;QACrB,IAAI,IAAI;YAAE,OAAM;QAChB,oBAAoB;QACpB,IAAI,GAAG,IAAI,CAAA;QACX,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE;YACnC,WAAW,EAAE,GAAG,CAAC,GAAG;SACrB,CAAC,CAAA;QACF,MAAM,GAAG,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,MAAM,CAAC,CAAC,CAAC,MAAM,CAAA;QACrD,YAAY,EAAE,CAAA;QAEd,IAAI,GAAG,KAAK,KAAK;YAAE,OAAM;aACpB,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;YACjC,MAAM,GAAG,GAAG,CAAA;YACZ,IAAI,GAAG,IAAI,CAAA;QACb,CAAC;aAAM,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;YACnC,IAAI,GAAG,GAAG,CAAA;YACV,MAAM,GAAG,IAAI,CAAA;QACf,CAAC;QAED,IAAI,MAAM,EAAE,CAAC;YACX,yDAAyD;YACzD,0DAA0D;YAC1D,wDAAwD;YACxD,0DAA0D;YAC1D,sCAAsC;YACtC,0BAA0B;YAC1B,UAAU,CAAC,GAAG,EAAE,GAAE,CAAC,EAAE,IAAI,CAAC,CAAA;YAC1B,IAAI,CAAC;gBACH,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;gBACjC,qBAAqB;YACvB,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,SAAS,CAAC,CAAA;YACtC,CAAC;YACD,oBAAoB;QACtB,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,CAAA;QACzB,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,OAAO,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAA;QAErC,KAAK,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE;YAC1C,OAAO,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA;QACrC,CAAC,CAAC,CAAA;QAEF,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE;YAC5C,KAAK,CAAC,IAAI,CACR,OAAuB,EACvB,UAAoC,CACrC,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC;AAED,MAAM,SAAS,GAAG,CAAC,CAAM,EAAqB,EAAE,CAC9C,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,UAAU,CAAA","sourcesContent":["import {\n ChildProcessByStdio,\n SendHandle,\n Serializable,\n spawn as nodeSpawn,\n SpawnOptions,\n ChildProcess,\n} from 'child_process'\nimport crossSpawn from 'cross-spawn'\nimport { onExit } from 'signal-exit'\nimport { proxySignals } from './proxy-signals.js'\nimport { watchdog } from './watchdog.js'\n\n/* c8 ignore start */\nconst spawn = process?.platform === 'win32' ? crossSpawn : nodeSpawn\n/* c8 ignore stop */\n\n/**\n * The signature for the cleanup method.\n *\n * Arguments indicate the exit status of the child process.\n *\n * If a Promise is returned, then the process is not terminated\n * until it resolves, and the resolution value is treated as the\n * exit status (if a number) or signal exit (if a signal string).\n *\n * If `undefined` is returned, then no change is made, and the parent\n * exits in the same way that the child exited.\n *\n * If boolean `false` is returned, then the parent's exit is canceled.\n *\n * If a number is returned, then the parent process exits with the number\n * as its exitCode.\n *\n * If a signal string is returned, then the parent process is killed with\n * the same signal that caused the child to exit.\n */\nexport type Cleanup = (\n code: number | null,\n signal: null | NodeJS.Signals,\n processInfo: {\n watchdogPid?: ChildProcess['pid']\n },\n) =>\n | void\n | undefined\n | number\n | NodeJS.Signals\n | false\n | Promise<void | undefined | nLine truncated
@@ -0,0 +1,17 @@
"use strict"
module.exports = function (layer, node, state, options) {
layer.forEach((layerPart, i) => {
if (layerPart.trim() === "") {
if (options.nameLayer) {
layer[i] = options
.nameLayer(state.anonymousLayerCounter++, state.rootFilename)
.toString()
} else {
throw node.error(
`When using anonymous layers in @import you must also set the "nameLayer" plugin option`
)
}
}
})
}
@@ -0,0 +1,177 @@
// This file was generated by lezer-generator. You probably shouldn't edit it.
export const
noSemi = 316,
noSemiType = 317,
incdec = 1,
incdecPrefix = 2,
questionDot = 3,
JSXStartTag = 4,
insertSemi = 318,
spaces = 320,
newline = 321,
LineComment = 5,
BlockComment = 6,
Script = 7,
Hashbang = 8,
ExportDeclaration = 9,
_export = 10,
Star = 11,
as = 12,
VariableName = 13,
String = 14,
Escape = 15,
from = 16,
_default = 18,
FunctionDeclaration = 19,
async = 64,
_function = 21,
VariableDefinition = 22,
TypeParamList = 25,
_in = 26,
out = 27,
_const = 28,
TypeDefinition = 29,
_extends = 30,
_this = 32,
Number = 35,
BooleanLiteral = 36,
TemplateType = 37,
InterpolationEnd = 38,
templateType = 39,
InterpolationStart = 40,
_null = 42,
_void = 44,
_typeof = 46,
PropertyName = 49,
TemplateString = 51,
templateEscape = 52,
templateExpr = 53,
_super = 54,
RegExp = 55,
ArrayExpression = 57,
Property = 63,
get = 65,
set = 66,
PropertyDefinition = 67,
Block = 68,
_new = 200,
ArgList = 75,
UnaryExpression = 76,
_delete = 77,
YieldExpression = 80,
_yield = 81,
AwaitExpression = 82,
_await = 83,
ParenthesizedExpression = 84,
ClassExpression = 85,
_class = 86,
ClassBody = 87,
MethodDeclaration = 88,
Decorator = 89,
PrivatePropertyName = 92,
TypeArgList = 94,
LessThan = 95,
declare = 225,
Privacy = 117,
_static = 99,
abstract = 208,
override = 101,
PrivatePropertyDefinition = 102,
PropertyDeclaration = 103,
readonly = 118,
accessor = 105,
Optional = 106,
TypeAnnotation = 107,
StaticBlock = 109,
FunctionExpression = 110,
ArrowFunction = 111,
ParamList = 113,
ArrayPattern = 114,
ObjectPattern = 115,
PatternProperty = 116,
MemberExpression = 120,
BinaryExpression = 121,
divide = 123,
_instanceof = 128,
satisfies = 129,
questionOp = 137,
AssignmentExpression = 139,
_import = 146,
JSXElement = 148,
JSXSelfCloseEndTag = 149,
JSXSelfClosingTag = 150,
JSXIdentifier = 151,
JSXLowerIdentifier = 153,
JSXNamespacedName = 154,
JSXMemberExpression = 155,
JSXAttributeValue = 158,
JSXEndTag = 160,
JSXOpenTag = 161,
JSXFragmentTag = 162,
JSXText = 163,
JSXEscape = 164,
JSXStartCloseTag = 165,
JSXCloseTag = 166,
tsAngleOpen = 168,
SequenceExpression = 171,
keyof = 174,
unique = 176,
infer = 179,
TypeName = 180,
ParamTypeList = 183,
IndexedType = 185,
Label = 187,
ObjectType = 190,
MethodType = 191,
PropertyType = 192,
IndexSignature = 193,
TypePredicate = 196,
asserts = 197,
is = 198,
unionOp = 202,
intersectionOp = 204,
ClassDeclaration = 207,
_implements = 209,
type = 210,
VariableDeclaration = 211,
_let = 212,
_var = 213,
using = 214,
TypeAliasDeclaration = 215,
InterfaceDeclaration = 216,
_interface = 217,
EnumDeclaration = 218,
_enum = 219,
NamespaceDeclaration = 221,
namespace = 222,
module = 223,
AmbientDeclaration = 224,
global = 227,
ExportGroup = 231,
ImportDeclaration = 234,
defer = 235,
ImportGroup = 236,
_for = 238,
ForSpec = 239,
ForInSpec = 240,
ForOfSpec = 241,
of = 242,
_while = 244,
_with = 246,
_do = 248,
_if = 250,
_else = 251,
_switch = 253,
_case = 256,
_try = 259,
_catch = 261,
_finally = 263,
_return = 265,
_throw = 267,
_break = 269,
_continue = 271,
_debugger = 273,
SingleExpression = 276,
SingleClassItem = 277,
Dialect_jsx = 0,
Dialect_ts = 1
@@ -0,0 +1 @@
{"name":"mime-types","version":"2.1.35","requiresBuild":false,"files":{"LICENSE":{"checkedAt":1794532101688,"integrity":"sha512-oaKT6wCX/oeHXzv5CMwLDujxXplcaOmEtqJOJHsulUQH15QeqWq9f+ACob37cT/fsNODnZSKM0YD8F5kSCn2Bg==","mode":420,"size":1167},"index.js":{"checkedAt":1794532101688,"integrity":"sha512-wkid43nvph1ozqfx1M5AWTpIqG9iyL4doJmkRi3wcFwyTOImCxmY6b3klNKoFYxg11F76ESNJyUjedZ12Zrhvg==","mode":420,"size":3663},"package.json":{"checkedAt":1794532101688,"integrity":"sha512-5rWjObB9Emuhyx9d8758o2x9wl4/BbSkysoJYTJSjgXVUgC0GuPTMrS48KQOyt/9kJAhZ9jdASmQ2ADlsUkkQw==","mode":420,"size":1149},"HISTORY.md":{"checkedAt":1794532101688,"integrity":"sha512-uTmDdX0THV9YPxTzIP15WP7vPkTDRm00Dl2WsE1Ka+gSP90MygNc7TbVAcGKHsXRUZVkNFT0HKTgEXQ8kvTthA==","mode":420,"size":8812},"README.md":{"checkedAt":1794532101688,"integrity":"sha512-k6Rw/FmqpVF3vT/SsGdjK9xkoyVLNZBHzownj+sVNA71Uqb83RePzRAmsWHGk/TIS0JnY6iIHc8C504TRcY5QA==","mode":420,"size":3481}}}
@@ -0,0 +1 @@
{"name":"@react-types/calendar","version":"3.8.0","requiresBuild":false,"files":{"LICENSE":{"checkedAt":1794532106952,"integrity":"sha512-cil7stSp3ik41Hdv2Dj+GMcbvUfs1q+MZ2Yte0804py9i6oJJN/diCiIr/brcQOZ5ZqwAI6dgaHA7l8FZheQBw==","mode":420,"size":11335},"package.json":{"checkedAt":1794532106952,"integrity":"sha512-3xhMMB4yWMl6PNibpv2PLgn11TiiCI9EnaZ/M7yF+wnKQqa3T1gwv0dmw980PVMHN25AmXtbWEpvnnkTuUAWMw==","mode":420,"size":568},"README.md":{"checkedAt":1794532106952,"integrity":"sha512-ylk7wACSr6AVUYK+rEBehekqUGopG2+BnPDP3OSoTnWQi1f/34VUbUhVeM10M73v60SZtQGAXFj63uQI0n13WA==","mode":420,"size":139},"src/index.d.ts":{"checkedAt":1794532106952,"integrity":"sha512-QYvz69pJD3kI+xCWhB3gWrzFZsgqwRogmET37VgFd5k+8YVYRt5wcSeD0JZ+9viqKQB19TSimfAHsaomIpaiWQ==","mode":420,"size":5109}}}
@@ -0,0 +1,146 @@
self.Flatted = (function (exports) {
'use strict';
function _typeof(o) {
"@babel/helpers - typeof";
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
return typeof o;
} : function (o) {
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
}, _typeof(o);
}
/// <reference types="../types/index.d.ts" />
// (c) 2020-present Andrea Giammarchi
var $parse = JSON.parse,
$stringify = JSON.stringify;
var keys = Object.keys;
var Primitive = String; // it could be Number
var primitive = 'string'; // it could be 'number'
var ignore = {};
var object = 'object';
var noop = function noop(_, value) {
return value;
};
var primitives = function primitives(value) {
return value instanceof Primitive ? Primitive(value) : value;
};
var Primitives = function Primitives(_, value) {
return _typeof(value) === primitive ? new Primitive(value) : value;
};
var _revive = function revive(input, parsed, output, $) {
var lazy = [];
for (var ke = keys(output), length = ke.length, y = 0; y < length; y++) {
var k = ke[y];
var value = output[k];
if (value instanceof Primitive) {
var tmp = input[value];
if (_typeof(tmp) === object && !parsed.has(tmp)) {
parsed.add(tmp);
output[k] = ignore;
lazy.push({
k: k,
a: [input, parsed, tmp, $]
});
} else output[k] = $.call(output, k, tmp);
} else if (output[k] !== ignore) output[k] = $.call(output, k, value);
}
for (var _length = lazy.length, i = 0; i < _length; i++) {
var _lazy$i = lazy[i],
_k = _lazy$i.k,
a = _lazy$i.a;
output[_k] = $.call(output, _k, _revive.apply(null, a));
}
return output;
};
var set = function set(known, input, value) {
var index = Primitive(input.push(value) - 1);
known.set(value, index);
return index;
};
/**
* Converts a specialized flatted string into a JS value.
* @param {string} text
* @param {(this: any, key: string, value: any) => any} [reviver]
* @returns {any}
*/
var parse = function parse(text, reviver) {
var input = $parse(text, Primitives).map(primitives);
var value = input[0];
var $ = reviver || noop;
var tmp = _typeof(value) === object && value ? _revive(input, new Set(), value, $) : value;
return $.call({
'': tmp
}, '', tmp);
};
/**
* Converts a JS value into a specialized flatted string.
* @param {any} value
* @param {((this: any, key: string, value: any) => any) | (string | number)[] | null | undefined} [replacer]
* @param {string | number | undefined} [space]
* @returns {string}
*/
var stringify = function stringify(value, replacer, space) {
var $ = replacer && _typeof(replacer) === object ? function (k, v) {
return k === '' || -1 < replacer.indexOf(k) ? v : void 0;
} : replacer || noop;
var known = new Map();
var input = [];
var output = [];
var i = +set(known, input, $.call({
'': value
}, '', value));
var firstRun = !i;
while (i < input.length) {
firstRun = true;
output[i] = $stringify(input[i++], replace, space);
}
return '[' + output.join(',') + ']';
function replace(key, value) {
if (firstRun) {
firstRun = !firstRun;
return value;
}
var after = $.call(this, key, value);
switch (_typeof(after)) {
case object:
if (after === null) return after;
case primitive:
return known.get(after) || set(known, input, after);
}
return after;
}
};
/**
* Converts a generic value into a JSON serializable object without losing recursion.
* @param {any} value
* @returns {any}
*/
var toJSON = function toJSON(value) {
return $parse(stringify(value));
};
/**
* Converts a previously serialized object with recursion into a recursive one.
* @param {any} value
* @returns {any}
*/
var fromJSON = function fromJSON(value) {
return parse($stringify(value));
};
exports.fromJSON = fromJSON;
exports.parse = parse;
exports.stringify = stringify;
exports.toJSON = toJSON;
return exports;
})({});
@@ -0,0 +1 @@
"use strict";var g=Object.defineProperty;var o=(r,s)=>g(r,"name",{value:s,configurable:!0});var p=require("node:module"),v=require("node:worker_threads"),f=require("./register-D46fvsV_.cjs"),h=require("node:url"),m=typeof document<"u"?document.currentScript:null;const w=o(r=>(s,e)=>{if(!e)throw new Error("The current file path (import.meta.url) must be provided in the second argument of tsImport()");const n=e.startsWith(f.fileUrlPrefix)?e:h.pathToFileURL(e).toString();return import(`tsx://${JSON.stringify({specifier:s,parentURL:n,namespace:r})}`)},"createScopedImport");let l=!1;const _=o(r=>{if(!p.register)throw new Error(`This version of Node.js (${process.version}) does not support module.register(). Please upgrade to Node v18.19 or v20.6 and above.`);if(!l){const{_resolveFilename:t}=p;p._resolveFilename=(c,...u)=>t(f.interopCjsExports(c),...u),l=!0}const{sourceMapsEnabled:s}=process;process.setSourceMapsEnabled(!0);const{port1:e,port2:n}=new v.MessageChannel;p.register(`./esm/index.mjs?${Date.now()}`,{parentURL:typeof document>"u"?require("url").pathToFileURL(__filename).href:m&&m.src||new URL("register-2sWVXuRQ.cjs",document.baseURI).href,data:{port:n,namespace:r?.namespace,tsconfig:r?.tsconfig},transferList:[n]});const d=r?.onImport,a=d&&(t=>{t.type==="load"&&d(t.url)});a&&(e.on("message",a),e.unref());const i=o(()=>(s===!1&&process.setSourceMapsEnabled(!1),a&&e.off("message",a),e.postMessage("deactivate"),new Promise(t=>{const c=o(u=>{u.type==="deactivated"&&(t(),e.off("message",c))},"onDeactivated");e.on("message",c)})),"unregister");return r?.namespace&&(i.import=w(r.namespace),i.unregister=i),i},"register");exports.register=_;
@@ -0,0 +1,3 @@
declare const _exports: import('eslint').Rule.RuleModule;
export = _exports;
//# sourceMappingURL=jsx-no-bind.d.ts.map
@@ -0,0 +1,66 @@
"use strict"
const path = require("path")
const isTypescript = require("./is-typescript")
const getTypescriptExtensionMap = require("./get-typescript-extension-map")
/**
* Maps the typescript file extension that should be added in an import statement,
* based on the given file extension of the referenced file OR fallsback to the original given extension.
*
* For example, in typescript, when referencing another typescript from a typescript file,
* a .js extension should be used instead of the original .ts extension of the referenced file.
*
* @param {import('eslint').Rule.RuleContext} context
* @param {string} filePath The filePath of the import
* @param {string} fallbackExtension The non-typescript fallback
* @returns {string} The file extension to append to the import statement.
*/
function convertTsExtensionToJs(context, filePath, fallbackExtension) {
const { forward } = getTypescriptExtensionMap(context)
const ext = path.extname(filePath)
if (
isTypescript(context) &&
ext in forward &&
Object.hasOwn(forward, ext) &&
typeof forward[ext] === "string"
) {
return forward[ext]
}
return fallbackExtension
}
/**
* Maps the typescript file extension that should be added in an import statement,
* based on the given file extension of the referenced file OR fallsback to the original given extension.
*
* For example, in typescript, when referencing another typescript from a typescript file,
* a .js extension should be used instead of the original .ts extension of the referenced file.
*
* @param {import('eslint').Rule.RuleContext} context
* @param {string} filePath The filePath of the import
* @param {string} fallbackExtension The non-typescript fallback
* @returns {string[]} The file extension to append to the import statement.
*/
function convertJsExtensionToTs(context, filePath, fallbackExtension) {
const { backward } = getTypescriptExtensionMap(context)
const ext = path.extname(filePath)
if (
isTypescript(context) &&
ext in backward &&
Object.hasOwn(backward, ext) &&
Array.isArray(backward[ext])
) {
return backward[ext]
}
return [fallbackExtension]
}
module.exports = {
convertTsExtensionToJs,
convertJsExtensionToTs,
}
@@ -0,0 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DEFAULT_PROJECT_FILES_ERROR_EXPLANATION = void 0;
exports.validateDefaultProjectForFilesGlob = validateDefaultProjectForFilesGlob;
exports.DEFAULT_PROJECT_FILES_ERROR_EXPLANATION = `
Having many files run with the default project is known to cause performance issues and slow down linting.
See https://typescript-eslint.io/troubleshooting/typed-linting#allowdefaultproject-glob-too-wide
`;
function validateDefaultProjectForFilesGlob(allowDefaultProject) {
if (!allowDefaultProject?.length) {
return;
}
for (const glob of allowDefaultProject) {
if (glob === '*') {
throw new Error(`allowDefaultProject contains the overly wide '*'.${exports.DEFAULT_PROJECT_FILES_ERROR_EXPLANATION}`);
}
if (glob.includes('**')) {
throw new Error(`allowDefaultProject glob '${glob}' contains a disallowed '**'.${exports.DEFAULT_PROJECT_FILES_ERROR_EXPLANATION}`);
}
}
}
@@ -0,0 +1,11 @@
export { MenuItem as DropdownItem, MenuItemProps as DropdownItemProps, MenuSection as DropdownSection, MenuSectionProps as DropdownSectionProps } from '@heroui/menu';
export { default as Dropdown, DropdownProps } from './dropdown.js';
export { default as DropdownTrigger, DropdownTriggerProps } from './dropdown-trigger.js';
export { default as DropdownMenu, DropdownMenuProps } from './dropdown-menu.js';
export { useDropdown } from './use-dropdown.js';
import 'react/jsx-runtime';
import 'react';
import '@heroui/popover';
import '@react-types/menu';
import '@heroui/system';
import '@heroui/react-utils';
@@ -0,0 +1,20 @@
import {
scrollbar_hide_default
} from "./chunk-4Z22WXZX.mjs";
import {
transition_default
} from "./chunk-WN6AL2BX.mjs";
import {
custom_default
} from "./chunk-W5UU3F46.mjs";
// src/utilities/index.ts
var utilities = {
...custom_default,
...transition_default,
...scrollbar_hide_default
};
export {
utilities
};
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sources":["src/get-innermost-scope.js","src/find-variable.js","src/token-predicate.js","src/get-function-head-location.js","src/get-static-value.js","src/get-string-if-constant.js","src/get-property-name.js","src/get-function-name-with-kind.js","src/has-side-effect.js","src/is-parenthesized.js","src/pattern-matcher.js","src/reference-tracker.js","src/index.js"],"sourcesContent":["/**\n * Get the innermost scope which contains a given location.\n * @param {Scope} initialScope The initial scope to search.\n * @param {Node} node The location to search.\n * @returns {Scope} The innermost scope.\n */\nexport function getInnermostScope(initialScope, node) {\n const location = node.range[0]\n\n let scope = initialScope\n let found = false\n do {\n found = false\n for (const childScope of scope.childScopes) {\n const range = childScope.block.range\n\n if (range[0] <= location && location < range[1]) {\n scope = childScope\n found = true\n break\n }\n }\n } while (found)\n\n return scope\n}\n","import { getInnermostScope } from \"./get-innermost-scope\"\n\n/**\n * Find the variable of a given name.\n * @param {Scope} initialScope The scope to start finding.\n * @param {string|Node} nameOrNode The variable name to find. If this is a Node object then it should be an Identifier node.\n * @returns {Variable|null} The found variable or null.\n */\nexport function findVariable(initialScope, nameOrNode) {\n let name = \"\"\n let scope = initialScope\n\n if (typeof nameOrNode === \"string\") {\n name = nameOrNode\n } else {\n name = nameOrNode.name\n scope = getInnermostScope(scope, nameOrNode)\n }\n\n while (scope != null) {\n const variable = scope.set.get(name)\n if (variable != null) {\n return variable\n }\n scope = scope.upper\n }\n\n return null\n}\n","/**\n * Negate the result of `this` calling.\n * @param {Token} token The token to check.\n * @returns {boolean} `true` if the result of `this(token)` is `false`.\n */\nfunction negate0(token) {\n return !this(token) //eslint-disable-line no-invalid-this\n}\n\n/**\n * Creates the negate function of the given function.\n * @param {function(Token):boolean} f - The function to negate.\n * @returns {function(Token):boolean} Negated function.\n */\nfunction negate(f) {\n return negate0.bind(f)\n}\n\n/**\n * Checks if the given token is an arrow token or not.\n * @param {Token} token - The token to check.\n * @returns {boolean} `true` if the token is an arrow token.\n */\nexport function isArrowToken(token) {\n return token.value === \"=>\" && token.type === \"Punctuator\"\n}\n\n/**\n * Checks if the given token is a comma token or not.\n * @param {Token} token - The token to check.\n * @returns {boolean} `true` if the token is a comma token.\n */\nexport function isCommaToken(token) {\n return token.value === \",\" && token.type === \"Punctuator\"\n}\n\n/**\n * Checks if the given token is a semicolon token or not.\n * @param {Token} token - The token to check.\n * @returns {boolean} `true` if the token is a semicolon token.\n */\nexport function isSemicolonToken(token) {\n return token.value === \";\" && token.type === \"Punctuator\"\n}\n\n/**\n * Checks if the given token is a colon token or not.\n * @param {Token} token - The token to check.\n * @returns {boolean} `true` if the token is a colon token.\n */\nexport function isColonToken(token) {\n return token.value === \":\" && token.type === \"Punctuator\"\n}\n\n/**\n * Checks if the given token is an opening parenthesis token or not.\n * @param {Token} token - The token to check.\n * @returns {boolean} `true` if the token is an opening parenthesis token.\n */\nexport function isOpeningParenToken(token) {\n return token.value === \"(\" && token.type === \"Punctuator\"\n}\n\n/**\n * Checks if the given token is a closing parenthesis token or not.\n * @param {Token} token - The token to check.\n * @returns {boolean} `true` if the token is a closing parenthesis token.\n */\nexport function isClosingParenToken(token) {\n return token.value === \")\" && token.type === \"Punctuator\"\n}\n\n/**\n * Checks if the given token is an opening square bracket token or not.\n * @param {Token} token - The token to check.\n * @returns {boolean} `true` if the token is an opening square bracket token.\n */\nexport function isOpeningBracketToken(token) {\n return token.value === \"[\" && token.type === \"Punctuator\"\n}\n\n/**\n * Checks if the given token is a closing square bracket token or not.\n * @param {Token} token - The token to check.\n * @returns {boolean} `true` if the token is a closing square bracket token.\n */\nexport function isClosingBracketToken(token) {\n return token.value === \"]\" && token.type === \"Punctuator\"\n}\n\n/**\n * Checks if the given token is an Line truncated
@@ -0,0 +1,12 @@
'use strict';
var $isNaN = require('./isNaN');
/** @type {import('./isFinite')} */
module.exports = function isFinite(x) {
return (typeof x === 'number' || typeof x === 'bigint')
&& !$isNaN(x)
&& x !== Infinity
&& x !== -Infinity;
};
@@ -0,0 +1,2 @@
import type { ClientRect } from '../../types';
export declare function useInitialRect(node: HTMLElement | null, measure: (node: HTMLElement) => ClientRect): ClientRect | null;
@@ -0,0 +1,21 @@
0.2.0 / 2021-05-31
==================
* Use `req.socket` over deprecated `req.connection`
0.1.2 / 2017-09-14
==================
* perf: improve header parsing
* perf: reduce overhead when no `X-Forwarded-For` header
0.1.1 / 2017-09-10
==================
* Fix trimming leading / trailing OWS
* perf: hoist regular expression
0.1.0 / 2014-09-21
==================
* Initial release
@@ -0,0 +1,291 @@
"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/use-checkbox.ts
var use_checkbox_exports = {};
__export(use_checkbox_exports, {
useCheckbox: () => useCheckbox
});
module.exports = __toCommonJS(use_checkbox_exports);
var import_system = require("@heroui/system");
var import_react = require("react");
var import_react2 = require("react");
var import_toggle = require("@react-stately/toggle");
var import_theme = require("@heroui/theme");
var import_use_callback_ref = require("@heroui/use-callback-ref");
var import_interactions = require("@react-aria/interactions");
var import_focus = require("@react-aria/focus");
var import_shared_utils = require("@heroui/shared-utils");
var import_checkbox = require("@react-aria/checkbox");
var import_use_safe_layout_effect = require("@heroui/use-safe-layout-effect");
var import_react_utils2 = require("@heroui/react-utils");
var import_form = require("@heroui/form");
// src/checkbox-group-context.ts
var import_react_utils = require("@heroui/react-utils");
var [CheckboxGroupProvider, useCheckboxGroupContext] = (0, import_react_utils.createContext)({
name: "CheckboxGroupContext",
strict: false
});
// src/use-checkbox.ts
function useCheckbox(props = {}) {
var _a, _b, _c, _d, _e, _f, _g, _h;
const globalContext = (0, import_system.useProviderContext)();
const groupContext = useCheckboxGroupContext();
const { validationBehavior: formValidationBehavior } = (0, import_form.useSlottedContext)(import_form.FormContext) || {};
const isInGroup = !!groupContext;
const {
as,
ref,
value = "",
children,
icon,
name,
isRequired,
isReadOnly: isReadOnlyProp = false,
autoFocus = false,
isSelected: isSelectedProp,
size = (_a = groupContext == null ? void 0 : groupContext.size) != null ? _a : "md",
color = (_b = groupContext == null ? void 0 : groupContext.color) != null ? _b : "primary",
radius = groupContext == null ? void 0 : groupContext.radius,
lineThrough = (_c = groupContext == null ? void 0 : groupContext.lineThrough) != null ? _c : false,
isDisabled: isDisabledProp = (_d = groupContext == null ? void 0 : groupContext.isDisabled) != null ? _d : false,
disableAnimation = (_f = (_e = groupContext == null ? void 0 : groupContext.disableAnimation) != null ? _e : globalContext == null ? void 0 : globalContext.disableAnimation) != null ? _f : false,
validationState,
isInvalid: isInvalidProp = validationState ? validationState === "invalid" : (_g = groupContext == null ? void 0 : groupContext.isInvalid) != null ? _g : false,
isIndeterminate = false,
validationBehavior = isInGroup ? groupContext.validationBehavior : (_h = formValidationBehavior != null ? formValidationBehavior : globalContext == null ? void 0 : globalContext.validationBehavior) != null ? _h : "native",
defaultSelected,
classNames,
className,
onValueChange,
validate,
...otherProps
} = props;
if (groupContext && import_shared_utils.__DEV__) {
if (isSelectedProp) {
(0, import_shared_utils.warn)(
"The Checkbox.Group is being used, `isSelected` will be ignored. Use the `value` of the Checkbox.Group instead.",
"Checkbox"
);
}
if (defaultSelected) {
(0, import_shared_utils.warn)(
"The Checkbox.Group is being used, `defaultSelected` will be ignored. Use the `defaultValue` of the Checkbox.Group instead.",
"Checkbox"
);
}
}
const Component = as || "label";
const domRef = (0, import_react2.useRef)(null);
const inputRef = (0, import_react2.useRef)(null);
let onChange = props.onChange;
if (isInGroup) {
const dispatch = () => {
groupContext.groupState.resetValidation();
};
onChange = (0, import_shared_utils.chain)(dispatch, onChange);
}
const labelId = (0, import_react.useId)();
const ariaCheckboxProps = (0, import_react2.useMemo)(
() => ({
name,
value,
children,
autoFocus,
defaultSelected,
isIndeterminate,
isRequired,
isInvalid: isInvalidProp,
isSelected: isSelectedProp,
isDisabled: isDisabledProp,
isReadOnly: isReadOnlyProp,
"aria-label": (0, import_shared_utils.safeAriaLabel)(otherProps["aria-label"], children),
"aria-labelledby": otherProps["aria-labelledby"] || labelId,
onChange: onValueChange
}),
[
name,
value,
children,
autoFocus,
defaultSelected,
isIndeterminate,
isRequired,
isInvalidProp,
isSelectedProp,
isDisabledProp,
isReadOnlyProp,
otherProps["aria-label"],
otherProps["aria-labelledby"],
labelId,
onValueChange
]
);
const toggleState = (0, import_toggle.useToggleState)(ariaCheckboxProps);
const validationProps = {
isInvalid: isInvalidProp,
isRequired,
validate,
validationState,
validationBehavior
};
const {
inputProps,
isSelected,
isDisabled,
isReadOnly,
isPressed,
isInvalid: isAriaInvalid
} = isInGroup ? (
// eslint-disable-next-line
(0, import_checkbox.useCheckboxGroupItem)(
{ ...ariaCheckboxProps, ...validationProps },
groupContext.groupState,
inputRef
)
) : (
// eslint-disable-next-line
(0, import_checkbox.useCheckbox)({ ...ariaCheckboxProps, ...validationProps }, toggleState, inputRef)
);
const isInteractionDisabled = isDisabled || isReadOnly;
const isInvalid = validationState === "invalid" || isInvalidProp || isAriaInvalid;
const pressed = isInteractionDisabled ? false : isPressed;
const { hoverProps, isHovered } = (0, import_interactions.useHover)({
isDisabled: inputProps.disabled
});
const { focusProps, isFocused, isFocusVisible } = (0, import_focus.useFocusRing)({
autoFocus: inputProps.autoFocus
});
const slots = (0, import_react2.useMemo)(
() => (0, import_theme.checkbox)({
color,
size,
radius,
isInvalid,
lineThrough,
isDisabled,
disableAnimation
}),
[color, size, radius, isInvalid, lineThrough, isDisabled, disableAnimation]
);
(0, import_use_safe_layout_effect.useSafeLayoutEffect)(() => {
if (!inputRef.current) return;
const isInputRefChecked = !!inputRef.current.checked;
toggleState.setSelected(isInputRefChecked);
}, [inputRef.current]);
const onChangeProp = (0, import_use_callback_ref.useCallbackRef)(onChange);
const handleCheckboxChange = (0, import_react.useCallback)(
(event) => {
if (isReadOnly || isDisabled) {
event.preventDefault();
return;
}
onChangeProp == null ? void 0 : onChangeProp(event);
},
[isReadOnly, isDisabled, onChangeProp]
);
const baseStyles = (0, import_shared_utils.clsx)(classNames == null ? void 0 : classNames.base, className);
const getBaseProps = (0, import_react.useCallback)(() => {
return {
ref: domRef,
className: slots.base({ class: baseStyles }),
"data-disabled": (0, import_shared_utils.dataAttr)(isDisabled),
"data-selected": (0, import_shared_utils.dataAttr)(isSelected || isIndeterminate),
"data-invalid": (0, import_shared_utils.dataAttr)(isInvalid),
"data-hover": (0, import_shared_utils.dataAttr)(isHovered),
"data-focus": (0, import_shared_utils.dataAttr)(isFocused),
"data-pressed": (0, import_shared_utils.dataAttr)(pressed),
"data-readonly": (0, import_shared_utils.dataAttr)(inputProps.readOnly),
"data-focus-visible": (0, import_shared_utils.dataAttr)(isFocusVisible),
"data-indeterminate": (0, import_shared_utils.dataAttr)(isIndeterminate),
...(0, import_shared_utils.mergeProps)(hoverProps, otherProps)
};
}, [
slots,
baseStyles,
isDisabled,
isSelected,
isIndeterminate,
isInvalid,
isHovered,
isFocused,
pressed,
inputProps.readOnly,
isFocusVisible,
hoverProps,
otherProps
]);
const getWrapperProps = (0, import_react.useCallback)(
(props2 = {}) => {
return {
...props2,
"aria-hidden": true,
className: (0, import_shared_utils.clsx)(slots.wrapper({ class: (0, import_shared_utils.clsx)(classNames == null ? void 0 : classNames.wrapper, props2 == null ? void 0 : props2.className) }))
};
},
[slots, classNames == null ? void 0 : classNames.wrapper]
);
const getInputProps = (0, import_react.useCallback)(() => {
return {
ref: (0, import_react_utils2.mergeRefs)(inputRef, ref),
...(0, import_shared_utils.mergeProps)(inputProps, focusProps),
className: slots.hiddenInput({ class: classNames == null ? void 0 : classNames.hiddenInput }),
onChange: (0, import_shared_utils.chain)(inputProps.onChange, handleCheckboxChange)
};
}, [inputProps, focusProps, handleCheckboxChange, classNames == null ? void 0 : classNames.hiddenInput]);
const getLabelProps = (0, import_react.useCallback)(
() => ({
id: labelId,
className: slots.label({ class: classNames == null ? void 0 : classNames.label })
}),
[slots, classNames == null ? void 0 : classNames.label, isDisabled, isSelected, isInvalid]
);
const getIconProps = (0, import_react.useCallback)(
() => ({
isSelected,
isIndeterminate,
disableAnimation,
className: slots.icon({ class: classNames == null ? void 0 : classNames.icon })
}),
[slots, classNames == null ? void 0 : classNames.icon, isSelected, isIndeterminate, disableAnimation]
);
return {
Component,
icon,
children,
isSelected,
isDisabled,
isInvalid,
isFocused,
isHovered,
isFocusVisible,
getBaseProps,
getWrapperProps,
getInputProps,
getLabelProps,
getIconProps
};
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
useCheckbox
});
@@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TemplateLiteralToUnion = TemplateLiteralToUnion;
const index_1 = require("../union/index");
const index_2 = require("../literal/index");
const generate_1 = require("./generate");
/** Returns a Union from the given TemplateLiteral */
function TemplateLiteralToUnion(schema) {
const R = (0, generate_1.TemplateLiteralGenerate)(schema);
const L = R.map((S) => (0, index_2.Literal)(S));
return (0, index_1.UnionEvaluated)(L);
}
@@ -0,0 +1,12 @@
module.exports = {
...require('./fs.js'),
copyFile: require('./copy-file.js'),
cp: require('./cp/index.js'),
mkdir: require('./mkdir.js'),
mkdtemp: require('./mkdtemp.js'),
rm: require('./rm/index.js'),
withTempDir: require('./with-temp-dir.js'),
withOwner: require('./with-owner.js'),
withOwnerSync: require('./with-owner-sync.js'),
writeFile: require('./write-file.js'),
}
@@ -0,0 +1,55 @@
The hook accepts a `getFilesFromEvent` prop that enhances the handling of dropped file system objects and allows more flexible use of them e.g. passing a function that accepts drop event of a folder and resolves it to an array of files adds plug-in functionality of folders drag-and-drop.
Though, note that the provided `getFilesFromEvent` fn must return a `Promise` with a list of `File` objects (or `DataTransferItem` of `{kind: 'file'}` when data cannot be accessed).
Otherwise, the results will be discarded and none of the drag events callbacks will be invoked.
In case you need to extend the `File` with some additional properties, you should use [Object.defineProperty()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty) so that the result will still pass through our filter:
```jsx harmony
import React from 'react';
import {useDropzone} from 'react-dropzone';
function Plugin(props) {
const {acceptedFiles, getRootProps, getInputProps} = useDropzone({
getFilesFromEvent: event => myCustomFileGetter(event)
});
const files = acceptedFiles.map(f => (
<li key={f.name}>
{f.name} has <strong>myProps</strong>: {f.myProp === true ? 'YES' : ''}
</li>
));
return (
<section className="container">
<div {...getRootProps({className: 'dropzone'})}>
<input {...getInputProps()} />
<p>Drag 'n' drop some files here, or click to select files</p>
</div>
<aside>
<h4>Files</h4>
<ul>{files}</ul>
</aside>
</section>
);
}
async function myCustomFileGetter(event) {
const files = [];
const fileList = event.dataTransfer ? event.dataTransfer.files : event.target.files;
for (var i = 0; i < fileList.length; i++) {
const file = fileList.item(i);
Object.defineProperty(file, 'myProp', {
value: true
});
files.push(file);
}
return files;
}
<Plugin />
```
@@ -0,0 +1,3 @@
declare const isCore: (x: string, _nodeVersion?: any) => boolean;
export = isCore;
@@ -0,0 +1,367 @@
import {
eat,
finishToken,
getTokenFromCode,
IdentifierRole,
JSXRole,
match,
next,
skipSpace,
Token,
} from "../../tokenizer/index";
import {TokenType as tt} from "../../tokenizer/types";
import {input, isTypeScriptEnabled, state} from "../../traverser/base";
import {parseExpression, parseMaybeAssign} from "../../traverser/expression";
import {expect, unexpected} from "../../traverser/util";
import {charCodes} from "../../util/charcodes";
import {IS_IDENTIFIER_CHAR, IS_IDENTIFIER_START} from "../../util/identifier";
import {tsTryParseJSXTypeArgument} from "../typescript";
/**
* Read token with JSX contents.
*
* In addition to detecting jsxTagStart and also regular tokens that might be
* part of an expression, this code detects the start and end of text ranges
* within JSX children. In order to properly count the number of children, we
* distinguish jsxText from jsxEmptyText, which is a text range that simplifies
* to the empty string after JSX whitespace trimming.
*
* It turns out that a JSX text range will simplify to the empty string if and
* only if both of these conditions hold:
* - The range consists entirely of whitespace characters (only counting space,
* tab, \r, and \n).
* - The range has at least one newline.
* This can be proven by analyzing any implementation of whitespace trimming,
* e.g. formatJSXTextLiteral in Sucrase or cleanJSXElementLiteralChild in Babel.
*/
function jsxReadToken() {
let sawNewline = false;
let sawNonWhitespace = false;
while (true) {
if (state.pos >= input.length) {
unexpected("Unterminated JSX contents");
return;
}
const ch = input.charCodeAt(state.pos);
if (ch === charCodes.lessThan || ch === charCodes.leftCurlyBrace) {
if (state.pos === state.start) {
if (ch === charCodes.lessThan) {
state.pos++;
finishToken(tt.jsxTagStart);
return;
}
getTokenFromCode(ch);
return;
}
if (sawNewline && !sawNonWhitespace) {
finishToken(tt.jsxEmptyText);
} else {
finishToken(tt.jsxText);
}
return;
}
// This is part of JSX text.
if (ch === charCodes.lineFeed) {
sawNewline = true;
} else if (ch !== charCodes.space && ch !== charCodes.carriageReturn && ch !== charCodes.tab) {
sawNonWhitespace = true;
}
state.pos++;
}
}
function jsxReadString(quote) {
state.pos++;
for (;;) {
if (state.pos >= input.length) {
unexpected("Unterminated string constant");
return;
}
const ch = input.charCodeAt(state.pos);
if (ch === quote) {
state.pos++;
break;
}
state.pos++;
}
finishToken(tt.string);
}
// Read a JSX identifier (valid tag or attribute name).
//
// Optimized version since JSX identifiers can't contain
// escape characters and so can be read as single slice.
// Also assumes that first character was already checked
// by isIdentifierStart in readToken.
function jsxReadWord() {
let ch;
do {
if (state.pos > input.length) {
unexpected("Unexpectedly reached the end of input.");
return;
}
ch = input.charCodeAt(++state.pos);
} while (IS_IDENTIFIER_CHAR[ch] || ch === charCodes.dash);
finishToken(tt.jsxName);
}
// Parse next token as JSX identifier
function jsxParseIdentifier() {
nextJSXTagToken();
}
// Parse namespaced identifier.
function jsxParseNamespacedName(identifierRole) {
jsxParseIdentifier();
if (!eat(tt.colon)) {
// Plain identifier, so this is an access.
state.tokens[state.tokens.length - 1].identifierRole = identifierRole;
return;
}
// Process the second half of the namespaced name.
jsxParseIdentifier();
}
// Parses element name in any form - namespaced, member
// or single identifier.
function jsxParseElementName() {
const firstTokenIndex = state.tokens.length;
jsxParseNamespacedName(IdentifierRole.Access);
let hadDot = false;
while (match(tt.dot)) {
hadDot = true;
nextJSXTagToken();
jsxParseIdentifier();
}
// For tags like <div> with a lowercase letter and no dots, the name is
// actually *not* an identifier access, since it's referring to a built-in
// tag name. Remove the identifier role in this case so that it's not
// accidentally transformed by the imports transform when preserving JSX.
if (!hadDot) {
const firstToken = state.tokens[firstTokenIndex];
const firstChar = input.charCodeAt(firstToken.start);
if (firstChar >= charCodes.lowercaseA && firstChar <= charCodes.lowercaseZ) {
firstToken.identifierRole = null;
}
}
}
// Parses any type of JSX attribute value.
function jsxParseAttributeValue() {
switch (state.type) {
case tt.braceL:
next();
parseExpression();
nextJSXTagToken();
return;
case tt.jsxTagStart:
jsxParseElement();
nextJSXTagToken();
return;
case tt.string:
nextJSXTagToken();
return;
default:
unexpected("JSX value should be either an expression or a quoted JSX text");
}
}
// Parse JSX spread child, after already processing the {
// Does not parse the closing }
function jsxParseSpreadChild() {
expect(tt.ellipsis);
parseExpression();
}
// Parses JSX opening tag starting after "<".
// Returns true if the tag was self-closing.
// Does not parse the last token.
function jsxParseOpeningElement(initialTokenIndex) {
if (match(tt.jsxTagEnd)) {
// This is an open-fragment.
return false;
}
jsxParseElementName();
if (isTypeScriptEnabled) {
tsTryParseJSXTypeArgument();
}
let hasSeenPropSpread = false;
while (!match(tt.slash) && !match(tt.jsxTagEnd) && !state.error) {
if (eat(tt.braceL)) {
hasSeenPropSpread = true;
expect(tt.ellipsis);
parseMaybeAssign();
// }
nextJSXTagToken();
continue;
}
if (
hasSeenPropSpread &&
state.end - state.start === 3 &&
input.charCodeAt(state.start) === charCodes.lowercaseK &&
input.charCodeAt(state.start + 1) === charCodes.lowercaseE &&
input.charCodeAt(state.start + 2) === charCodes.lowercaseY
) {
state.tokens[initialTokenIndex].jsxRole = JSXRole.KeyAfterPropSpread;
}
jsxParseNamespacedName(IdentifierRole.ObjectKey);
if (match(tt.eq)) {
nextJSXTagToken();
jsxParseAttributeValue();
}
}
const isSelfClosing = match(tt.slash);
if (isSelfClosing) {
// /
nextJSXTagToken();
}
return isSelfClosing;
}
// Parses JSX closing tag starting after "</".
// Does not parse the last token.
function jsxParseClosingElement() {
if (match(tt.jsxTagEnd)) {
// Fragment syntax, so we immediately have a tag end.
return;
}
jsxParseElementName();
}
// Parses entire JSX element, including its opening tag
// (starting after "<"), attributes, contents and closing tag.
// Does not parse the last token.
function jsxParseElementAt() {
const initialTokenIndex = state.tokens.length - 1;
state.tokens[initialTokenIndex].jsxRole = JSXRole.NoChildren;
let numExplicitChildren = 0;
const isSelfClosing = jsxParseOpeningElement(initialTokenIndex);
if (!isSelfClosing) {
nextJSXExprToken();
while (true) {
switch (state.type) {
case tt.jsxTagStart:
nextJSXTagToken();
if (match(tt.slash)) {
nextJSXTagToken();
jsxParseClosingElement();
// Key after prop spread takes precedence over number of children,
// since it means we switch to createElement, which doesn't care
// about number of children.
if (state.tokens[initialTokenIndex].jsxRole !== JSXRole.KeyAfterPropSpread) {
if (numExplicitChildren === 1) {
state.tokens[initialTokenIndex].jsxRole = JSXRole.OneChild;
} else if (numExplicitChildren > 1) {
state.tokens[initialTokenIndex].jsxRole = JSXRole.StaticChildren;
}
}
return;
}
numExplicitChildren++;
jsxParseElementAt();
nextJSXExprToken();
break;
case tt.jsxText:
numExplicitChildren++;
nextJSXExprToken();
break;
case tt.jsxEmptyText:
nextJSXExprToken();
break;
case tt.braceL:
next();
if (match(tt.ellipsis)) {
jsxParseSpreadChild();
nextJSXExprToken();
// Spread children are a mechanism to explicitly mark children as
// static, so count it as 2 children to satisfy the "more than one
// child" condition.
numExplicitChildren += 2;
} else {
// If we see {}, this is an empty pseudo-expression that doesn't
// count as a child.
if (!match(tt.braceR)) {
numExplicitChildren++;
parseExpression();
}
nextJSXExprToken();
}
break;
// istanbul ignore next - should never happen
default:
unexpected();
return;
}
}
}
}
// Parses entire JSX element from current position.
// Does not parse the last token.
export function jsxParseElement() {
nextJSXTagToken();
jsxParseElementAt();
}
// ==================================
// Overrides
// ==================================
export function nextJSXTagToken() {
state.tokens.push(new Token());
skipSpace();
state.start = state.pos;
const code = input.charCodeAt(state.pos);
if (IS_IDENTIFIER_START[code]) {
jsxReadWord();
} else if (code === charCodes.quotationMark || code === charCodes.apostrophe) {
jsxReadString(code);
} else {
// The following tokens are just one character each.
++state.pos;
switch (code) {
case charCodes.greaterThan:
finishToken(tt.jsxTagEnd);
break;
case charCodes.lessThan:
finishToken(tt.jsxTagStart);
break;
case charCodes.slash:
finishToken(tt.slash);
break;
case charCodes.equalsTo:
finishToken(tt.eq);
break;
case charCodes.leftCurlyBrace:
finishToken(tt.braceL);
break;
case charCodes.dot:
finishToken(tt.dot);
break;
case charCodes.colon:
finishToken(tt.colon);
break;
default:
unexpected();
}
}
}
function nextJSXExprToken() {
state.tokens.push(new Token());
state.start = state.pos;
jsxReadToken();
}
@@ -0,0 +1,13 @@
import {
tabs
} from "../chunk-TYZBTYGB.mjs";
import "../chunk-CWYZ2GEH.mjs";
import "../chunk-GQT3YUX3.mjs";
import "../chunk-46U6G7UJ.mjs";
import "../chunk-DGTYPKBN.mjs";
import "../chunk-UWE6H66T.mjs";
import "../chunk-GIXI35A3.mjs";
import "../chunk-GH5E4FQB.mjs";
export {
tabs
};
@@ -0,0 +1 @@
{"name":"eslint-plugin-unused-imports","version":"4.3.0","requiresBuild":false,"files":{"LICENSE":{"checkedAt":1794532118793,"integrity":"sha512-CN5wMg2X+qYRof6cz96AzhXYMlKlBsphpgo4NogSeOYmATn3X/b+qQGL3icNwkNV+A7fjojrlHOHa+35wWh+Yw==","mode":420,"size":1079},"dist/index.js":{"checkedAt":1794532118793,"integrity":"sha512-UYTbdsIQG53sRzSKO/ZVsLiyMuG/vL8jBTcS61Ut6xRpm5xYlx1ItecRI2Am2Q1IO90N59vqbfkO7+KfClmKxA==","mode":420,"size":6466},"package.json":{"checkedAt":1794532118793,"integrity":"sha512-Va1UZ+DsKtCwp+lP0cdEmp9aTnIliCpMbCNLVlor5OHEWFqzQPs9jmFWfj7//sLW1wJSvluFzBYyR+llYW0b/Q==","mode":420,"size":2085},"README.md":{"checkedAt":1794532118793,"integrity":"sha512-731HvXCxP3+scvZOm+t6aY6FwO3KkXeREp5LHO5J7prJ3Af1TDrYMs9+38mjzNUV4LQcRQDdj44syBdkVkwLMQ==","mode":420,"size":2415},"dist/index.mjs":{"checkedAt":1794532118793,"integrity":"sha512-KO1AGodwGA4bxXq6FApmyxi2izhaAmNFfk6fv8YTJwvUp2t/E7LSALadGiPc+ZK6jgxCVPOxppu0snPmv2QzvQ==","mode":420,"size":5171},"dist/index.d.mts":{"checkedAt":1794532118793,"integrity":"sha512-Iz57YFydKJ0uxGponN30rmEmXliwVN15IIb17EKJwf8Zb6AU1jqbW1OdJi0MgQMmdAP5UxRqzmp0TkAFMCUImA==","mode":420,"size":102},"dist/index.d.ts":{"checkedAt":1794532118793,"integrity":"sha512-SlJQEp0LaL3bzyVsmsUw0wKfhi/LIDUk4Solo7OU53GZq1zUCs3/XRvOBiuWZT9uUaDRusURKBEC6jGop/6ffw==","mode":420,"size":89}}}
@@ -0,0 +1,8 @@
import { mirrorEasing } from './modifiers/mirror.mjs';
import { reverseEasing } from './modifiers/reverse.mjs';
const circIn = (p) => 1 - Math.sin(Math.acos(p));
const circOut = reverseEasing(circIn);
const circInOut = mirrorEasing(circIn);
export { circIn, circInOut, circOut };
@@ -0,0 +1,21 @@
import { NetworkAdapterConfig } from '../config/config';
import { LogWrapper } from '../../napcat-core/helper/log';
import { NapCatCore } from '../../napcat-core';
import { NapCatOneBot11Adapter } from '../index';
import { ActionMap } from '../action';
import { OB11EmitEventContent, OB11NetworkReloadType } from '../network/index';
export declare abstract class IOB11NetworkAdapter<CT extends NetworkAdapterConfig> {
name: string;
isEnable: boolean;
config: CT;
readonly logger: LogWrapper;
readonly core: NapCatCore;
readonly obContext: NapCatOneBot11Adapter;
readonly actions: ActionMap;
constructor(name: string, config: CT, core: NapCatCore, obContext: NapCatOneBot11Adapter, actions: ActionMap);
abstract onEvent<T extends OB11EmitEventContent>(event: T): Promise<void>;
abstract open(): void | Promise<void>;
abstract close(): void | Promise<void>;
abstract reload(config: unknown): OB11NetworkReloadType | Promise<OB11NetworkReloadType>;
get isActive(): boolean;
}
@@ -0,0 +1,76 @@
/**
* @import {Info, State} from 'mdast-util-to-markdown'
* @import {Definition, Parents} from 'mdast'
*/
import {checkQuote} from '../util/check-quote.js'
/**
* @param {Definition} node
* @param {Parents | undefined} _
* @param {State} state
* @param {Info} info
* @returns {string}
*/
export function definition(node, _, state, info) {
const quote = checkQuote(state)
const suffix = quote === '"' ? 'Quote' : 'Apostrophe'
const exit = state.enter('definition')
let subexit = state.enter('label')
const tracker = state.createTracker(info)
let value = tracker.move('[')
value += tracker.move(
state.safe(state.associationId(node), {
before: value,
after: ']',
...tracker.current()
})
)
value += tracker.move(']: ')
subexit()
if (
// If there’s no url, or…
!node.url ||
// If there are control characters or whitespace.
/[\0- \u007F]/.test(node.url)
) {
subexit = state.enter('destinationLiteral')
value += tracker.move('<')
value += tracker.move(
state.safe(node.url, {before: value, after: '>', ...tracker.current()})
)
value += tracker.move('>')
} else {
// No whitespace, raw is prettier.
subexit = state.enter('destinationRaw')
value += tracker.move(
state.safe(node.url, {
before: value,
after: node.title ? ' ' : '\n',
...tracker.current()
})
)
}
subexit()
if (node.title) {
subexit = state.enter(`title${suffix}`)
value += tracker.move(' ' + quote)
value += tracker.move(
state.safe(node.title, {
before: value,
after: quote,
...tracker.current()
})
)
value += tracker.move(quote)
subexit()
}
exit()
return value
}
@@ -0,0 +1,24 @@
# @heroui/use-is-mobile
A Quick description of the component
> This is an internal utility, not intended for public usage.
## Installation
```sh
yarn add @heroui/use-is-mobile
# or
npm i @heroui/use-is-mobile
```
## Contribution
Yes please! See the
[contributing guidelines](https://github.com/frontio-ai/heroui/blob/master/CONTRIBUTING.md)
for details.
## License
This project is licensed under the terms of the
[MIT license](https://github.com/frontio-ai/heroui/blob/master/LICENSE).
@@ -0,0 +1,152 @@
# Bytes utility
[![NPM Version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]
[![Build Status][ci-image]][ci-url]
[![Test Coverage][coveralls-image]][coveralls-url]
Utility to parse a string bytes (ex: `1TB`) to bytes (`1099511627776`) and vice-versa.
## Installation
This is a [Node.js](https://nodejs.org/en/) module available through the
[npm registry](https://www.npmjs.com/). Installation is done using the
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
```bash
$ npm install bytes
```
## Usage
```js
var bytes = require('bytes');
```
#### bytes(number|string value, [options]): number|string|null
Default export function. Delegates to either `bytes.format` or `bytes.parse` based on the type of `value`.
**Arguments**
| Name | Type | Description |
|---------|----------|--------------------|
| value | `number`|`string` | Number value to format or string value to parse |
| options | `Object` | Conversion options for `format` |
**Returns**
| Name | Type | Description |
|---------|------------------|-------------------------------------------------|
| results | `string`|`number`|`null` | Return null upon error. Numeric value in bytes, or string value otherwise. |
**Example**
```js
bytes(1024);
// output: '1KB'
bytes('1KB');
// output: 1024
```
#### bytes.format(number value, [options]): string|null
Format the given value in bytes into a string. If the value is negative, it is kept as such. If it is a float, it is
rounded.
**Arguments**
| Name | Type | Description |
|---------|----------|--------------------|
| value | `number` | Value in bytes |
| options | `Object` | Conversion options |
**Options**
| Property | Type | Description |
|-------------------|--------|-----------------------------------------------------------------------------------------|
| decimalPlaces | `number`|`null` | Maximum number of decimal places to include in output. Default value to `2`. |
| fixedDecimals | `boolean`|`null` | Whether to always display the maximum number of decimal places. Default value to `false` |
| thousandsSeparator | `string`|`null` | Example of values: `' '`, `','` and `'.'`... Default value to `''`. |
| unit | `string`|`null` | The unit in which the result will be returned (B/KB/MB/GB/TB). Default value to `''` (which means auto detect). |
| unitSeparator | `string`|`null` | Separator to use between number and unit. Default value to `''`. |
**Returns**
| Name | Type | Description |
|---------|------------------|-------------------------------------------------|
| results | `string`|`null` | Return null upon error. String value otherwise. |
**Example**
```js
bytes.format(1024);
// output: '1KB'
bytes.format(1000);
// output: '1000B'
bytes.format(1000, {thousandsSeparator: ' '});
// output: '1 000B'
bytes.format(1024 * 1.7, {decimalPlaces: 0});
// output: '2KB'
bytes.format(1024, {unitSeparator: ' '});
// output: '1 KB'
```
#### bytes.parse(string|number value): number|null
Parse the string value into an integer in bytes. If no unit is given, or `value`
is a number, it is assumed the value is in bytes.
Supported units and abbreviations are as follows and are case-insensitive:
* `b` for bytes
* `kb` for kilobytes
* `mb` for megabytes
* `gb` for gigabytes
* `tb` for terabytes
* `pb` for petabytes
The units are in powers of two, not ten. This means 1kb = 1024b according to this parser.
**Arguments**
| Name | Type | Description |
|---------------|--------|--------------------|
| value | `string`|`number` | String to parse, or number in bytes. |
**Returns**
| Name | Type | Description |
|---------|-------------|-------------------------|
| results | `number`|`null` | Return null upon error. Value in bytes otherwise. |
**Example**
```js
bytes.parse('1KB');
// output: 1024
bytes.parse('1024');
// output: 1024
bytes.parse(1024);
// output: 1024
```
## License
[MIT](LICENSE)
[ci-image]: https://badgen.net/github/checks/visionmedia/bytes.js/master?label=ci
[ci-url]: https://github.com/visionmedia/bytes.js/actions?query=workflow%3Aci
[coveralls-image]: https://badgen.net/coveralls/c/github/visionmedia/bytes.js/master
[coveralls-url]: https://coveralls.io/r/visionmedia/bytes.js?branch=master
[downloads-image]: https://badgen.net/npm/dm/bytes
[downloads-url]: https://npmjs.org/package/bytes
[npm-image]: https://badgen.net/npm/v/bytes
[npm-url]: https://npmjs.org/package/bytes
@@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isResolvedValueMetadataInjectOptions = isResolvedValueMetadataInjectOptions;
const common_1 = require("@inversifyjs/common");
function isResolvedValueMetadataInjectOptions(options) {
return typeof options === 'object' && !common_1.LazyServiceIdentifier.is(options);
}
//# sourceMappingURL=isResolvedValueMetadataInjectOptions.js.map
@@ -0,0 +1 @@
{"version":3,"file":"cloneResolvedValueBinding.spec.d.ts","sourceRoot":"","sources":["../../../../src/binding/calculations/cloneResolvedValueBinding.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
import type { ParsedNode } from '../nodes/Node';
import type { Pair } from '../nodes/Pair';
import type { ComposeContext } from './compose-node';
export declare function mapIncludes(ctx: ComposeContext, items: Pair<ParsedNode>[], search: ParsedNode): boolean;
@@ -0,0 +1,94 @@
/**
* DON'T EDIT THIS FILE.
* This file was generated by "scripts/update-lib-flat-configs.js" script.
*/
"use strict"
module.exports = {
plugins: {
get "es-x"() {
return require("../../index.js")
},
},
rules: {
"es-x/no-array-from": "error",
"es-x/no-array-of": "error",
"es-x/no-array-prototype-copywithin": "error",
"es-x/no-array-prototype-entries": "error",
"es-x/no-array-prototype-fill": "error",
"es-x/no-array-prototype-find": "error",
"es-x/no-array-prototype-findindex": "error",
"es-x/no-array-prototype-keys": "error",
"es-x/no-array-prototype-values": "error",
"es-x/no-arrow-functions": "error",
"es-x/no-binary-numeric-literals": "error",
"es-x/no-block-scoped-functions": "error",
"es-x/no-block-scoped-variables": "error",
"es-x/no-classes": "error",
"es-x/no-computed-properties": "error",
"es-x/no-default-parameters": "error",
"es-x/no-destructuring": "error",
"es-x/no-for-of-loops": "error",
"es-x/no-generators": "error",
"es-x/no-map": "error",
"es-x/no-math-acosh": "error",
"es-x/no-math-asinh": "error",
"es-x/no-math-atanh": "error",
"es-x/no-math-cbrt": "error",
"es-x/no-math-clz32": "error",
"es-x/no-math-cosh": "error",
"es-x/no-math-expm1": "error",
"es-x/no-math-fround": "error",
"es-x/no-math-hypot": "error",
"es-x/no-math-imul": "error",
"es-x/no-math-log10": "error",
"es-x/no-math-log1p": "error",
"es-x/no-math-log2": "error",
"es-x/no-math-sign": "error",
"es-x/no-math-sinh": "error",
"es-x/no-math-tanh": "error",
"es-x/no-math-trunc": "error",
"es-x/no-modules": "error",
"es-x/no-new-target": "error",
"es-x/no-number-epsilon": "error",
"es-x/no-number-isfinite": "error",
"es-x/no-number-isinteger": "error",
"es-x/no-number-isnan": "error",
"es-x/no-number-issafeinteger": "error",
"es-x/no-number-maxsafeinteger": "error",
"es-x/no-number-minsafeinteger": "error",
"es-x/no-number-parsefloat": "error",
"es-x/no-number-parseint": "error",
"es-x/no-object-assign": "error",
"es-x/no-object-getownpropertysymbols": "error",
"es-x/no-object-is": "error",
"es-x/no-object-setprototypeof": "error",
"es-x/no-object-super-properties": "error",
"es-x/no-octal-numeric-literals": "error",
"es-x/no-promise": "error",
"es-x/no-property-shorthands": "error",
"es-x/no-proxy": "error",
"es-x/no-reflect": "error",
"es-x/no-regexp-prototype-flags": "error",
"es-x/no-regexp-u-flag": "error",
"es-x/no-regexp-y-flag": "error",
"es-x/no-rest-parameters": "error",
"es-x/no-set": "error",
"es-x/no-spread-elements": "error",
"es-x/no-string-fromcodepoint": "error",
"es-x/no-string-prototype-codepointat": "error",
"es-x/no-string-prototype-endswith": "error",
"es-x/no-string-prototype-includes": "error",
"es-x/no-string-prototype-normalize": "error",
"es-x/no-string-prototype-repeat": "error",
"es-x/no-string-prototype-startswith": "error",
"es-x/no-string-raw": "error",
"es-x/no-subclassing-builtins": "error",
"es-x/no-symbol": "error",
"es-x/no-template-literals": "error",
"es-x/no-typed-arrays": "error",
"es-x/no-unicode-codepoint-escapes": "error",
"es-x/no-weak-map": "error",
"es-x/no-weak-set": "error",
},
}
@@ -0,0 +1,31 @@
'use strict'
var stringWidth = require('string-width')
var stripAnsi = require('strip-ansi')
module.exports = wideTruncate
function wideTruncate (str, target) {
if (stringWidth(str) === 0) {
return str
}
if (target <= 0) {
return ''
}
if (stringWidth(str) <= target) {
return str
}
// We compute the number of bytes of ansi sequences here and add
// that to our initial truncation to ensure that we don't slice one
// that we want to keep in half.
var noAnsi = stripAnsi(str)
var ansiSize = str.length + noAnsi.length
var truncated = str.slice(0, target + ansiSize)
// we have to shrink the result to account for our ansi sequence buffer
// (if an ansi sequence was truncated) and double width characters.
while (stringWidth(truncated) > target) {
truncated = truncated.slice(0, -1)
}
return truncated
}
@@ -0,0 +1,81 @@
[![Build Status][travis-svg]][travis-url]
[![dependency status][deps-svg]][deps-url]
[![dev dependency status][dev-deps-svg]][dev-deps-url]
# extend() for Node.js <sup>[![Version Badge][npm-version-png]][npm-url]</sup>
`node-extend` is a port of the classic extend() method from jQuery. It behaves as you expect. It is simple, tried and true.
Notes:
* Since Node.js >= 4,
[`Object.assign`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)
now offers the same functionality natively (but without the "deep copy" option).
See [ECMAScript 2015 (ES6) in Node.js](https://nodejs.org/en/docs/es6).
* Some native implementations of `Object.assign` in both Node.js and many
browsers (since NPM modules are for the browser too) may not be fully
spec-compliant.
Check [`object.assign`](https://www.npmjs.com/package/object.assign) module for
a compliant candidate.
## Installation
This package is available on [npm][npm-url] as: `extend`
``` sh
npm install extend
```
## Usage
**Syntax:** extend **(** [`deep`], `target`, `object1`, [`objectN`] **)**
*Extend one object with one or more others, returning the modified object.*
**Example:**
``` js
var extend = require('extend');
extend(targetObject, object1, object2);
```
Keep in mind that the target object will be modified, and will be returned from extend().
If a boolean true is specified as the first argument, extend performs a deep copy, recursively copying any objects it finds. Otherwise, the copy will share structure with the original object(s).
Undefined properties are not copied. However, properties inherited from the object's prototype will be copied over.
Warning: passing `false` as the first argument is not supported.
### Arguments
* `deep` *Boolean* (optional)
If set, the merge becomes recursive (i.e. deep copy).
* `target` *Object*
The object to extend.
* `object1` *Object*
The object that will be merged into the first.
* `objectN` *Object* (Optional)
More objects to merge into the first.
## License
`node-extend` is licensed under the [MIT License][mit-license-url].
## Acknowledgements
All credit to the jQuery authors for perfecting this amazing utility.
Ported to Node.js by [Stefan Thomas][github-justmoon] with contributions by [Jonathan Buchanan][github-insin] and [Jordan Harband][github-ljharb].
[travis-svg]: https://travis-ci.org/justmoon/node-extend.svg
[travis-url]: https://travis-ci.org/justmoon/node-extend
[npm-url]: https://npmjs.org/package/extend
[mit-license-url]: http://opensource.org/licenses/MIT
[github-justmoon]: https://github.com/justmoon
[github-insin]: https://github.com/insin
[github-ljharb]: https://github.com/ljharb
[npm-version-png]: http://versionbadg.es/justmoon/node-extend.svg
[deps-svg]: https://david-dm.org/justmoon/node-extend.svg
[deps-url]: https://david-dm.org/justmoon/node-extend
[dev-deps-svg]: https://david-dm.org/justmoon/node-extend/dev-status.svg
[dev-deps-url]: https://david-dm.org/justmoon/node-extend#info=devDependencies
@@ -0,0 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isPendingClassMetadata = isPendingClassMetadata;
const reflect_metadata_utils_1 = require("@inversifyjs/reflect-metadata-utils");
const pendingClassMetadataCountReflectKey_1 = require("../../reflectMetadata/data/pendingClassMetadataCountReflectKey");
function isPendingClassMetadata(type) {
const pendingClassMetadataCount = (0, reflect_metadata_utils_1.getOwnReflectMetadata)(type, pendingClassMetadataCountReflectKey_1.pendingClassMetadataCountReflectKey);
return (pendingClassMetadataCount !== undefined && pendingClassMetadataCount !== 0);
}
//# sourceMappingURL=isPendingClassMetadata.js.map
@@ -0,0 +1,9 @@
'use strict';
var getGlobal = require('globalthis/polyfill');
// https://262.ecma-international.org/6.0/#sec-getglobalobject
module.exports = function GetGlobalObject() {
return getGlobal();
};
@@ -0,0 +1,19 @@
import * as react from 'react';
import { HTMLHeroUIProps } from '@heroui/system';
import { ValuesType } from './use-table.mjs';
import '@react-types/table';
import '@heroui/theme';
import '@react-stately/virtualizer';
import '@react-types/shared';
import '@react-stately/table';
import '@react-aria/table';
import '@heroui/react-utils';
import '@heroui/checkbox';
interface TableRowGroupProps extends HTMLHeroUIProps<"thead"> {
slots: ValuesType["slots"];
classNames?: ValuesType["classNames"];
}
declare const TableRowGroup: react.ForwardRefExoticComponent<TableRowGroupProps & react.RefAttributes<HTMLTableSectionElement>>;
export { type TableRowGroupProps, TableRowGroup as default };
@@ -0,0 +1,7 @@
import type { TSESTree } from '@typescript-eslint/utils';
/**
* Tests if a node appears at the beginning of an ancestor ExpressionStatement node.
* @param node The node to check.
* @returns Whether the node appears at the beginning of an ancestor ExpressionStatement node.
*/
export declare function isStartOfExpressionStatement(node: TSESTree.Node): boolean;
@@ -0,0 +1,67 @@
/**
* Module exports.
*/
module.exports = deprecate;
/**
* Mark that a method should not be used.
* Returns a modified function which warns once by default.
*
* If `localStorage.noDeprecation = true` is set, then it is a no-op.
*
* If `localStorage.throwDeprecation = true` is set, then deprecated functions
* will throw an Error when invoked.
*
* If `localStorage.traceDeprecation = true` is set, then deprecated functions
* will invoke `console.trace()` instead of `console.error()`.
*
* @param {Function} fn - the function to deprecate
* @param {String} msg - the string to print to the console when `fn` is invoked
* @returns {Function} a new "deprecated" version of `fn`
* @api public
*/
function deprecate (fn, msg) {
if (config('noDeprecation')) {
return fn;
}
var warned = false;
function deprecated() {
if (!warned) {
if (config('throwDeprecation')) {
throw new Error(msg);
} else if (config('traceDeprecation')) {
console.trace(msg);
} else {
console.warn(msg);
}
warned = true;
}
return fn.apply(this, arguments);
}
return deprecated;
}
/**
* Checks `localStorage` for boolean values for the given `name`.
*
* @param {String} name
* @returns {Boolean}
* @api private
*/
function config (name) {
// accessing global.localStorage can trigger a DOMException in sandboxed iframes
try {
if (!global.localStorage) return false;
} catch (_) {
return false;
}
var val = global.localStorage[name];
if (null == val) return false;
return String(val).toLowerCase() === 'true';
}
@@ -0,0 +1,106 @@
/*
* 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.
*/
import {Collection, Key, Node} from '@react-types/shared';
export class ListCollection<T> implements Collection<Node<T>> {
private keyMap: Map<Key, Node<T>> = new Map();
private iterable: Iterable<Node<T>>;
private firstKey: Key | null = null;
private lastKey: Key | null = null;
constructor(nodes: Iterable<Node<T>>) {
this.iterable = nodes;
let visit = (node: Node<T>) => {
this.keyMap.set(node.key, node);
if (node.childNodes && node.type === 'section') {
for (let child of node.childNodes) {
visit(child);
}
}
};
for (let node of nodes) {
visit(node);
}
let last: Node<T> | null = null;
let index = 0;
for (let [key, node] of this.keyMap) {
if (last) {
last.nextKey = key;
node.prevKey = last.key;
} else {
this.firstKey = key;
node.prevKey = undefined;
}
if (node.type === 'item') {
node.index = index++;
}
last = node;
// Set nextKey as undefined since this might be the last node
// If it isn't the last node, last.nextKey will properly set at start of new loop
last.nextKey = undefined;
}
this.lastKey = last?.key ?? null;
}
*[Symbol.iterator]() {
yield* this.iterable;
}
get size() {
return this.keyMap.size;
}
getKeys() {
return this.keyMap.keys();
}
getKeyBefore(key: Key) {
let node = this.keyMap.get(key);
return node ? node.prevKey ?? null : null;
}
getKeyAfter(key: Key) {
let node = this.keyMap.get(key);
return node ? node.nextKey ?? null : null;
}
getFirstKey() {
return this.firstKey;
}
getLastKey() {
return this.lastKey;
}
getItem(key: Key) {
return this.keyMap.get(key) ?? null;
}
at(idx: number) {
const keys = [...this.getKeys()];
return this.getItem(keys[idx]);
}
getChildren(key: Key): Iterable<Node<T>> {
let node = this.keyMap.get(key);
return node?.childNodes || [];
}
}
@@ -0,0 +1,16 @@
import { isoBase64URL } from './iso/index.js';
/**
* Decode an authenticator's base64url-encoded clientDataJSON to JSON
*/
export function decodeClientDataJSON(data) {
const toString = isoBase64URL.toUTF8String(data);
const clientData = JSON.parse(toString);
return _decodeClientDataJSONInternals.stubThis(clientData);
}
/**
* Make it possible to stub the return value during testing
* @ignore Don't include this in docs output
*/
export const _decodeClientDataJSONInternals = {
stubThis: (value) => value,
};
@@ -0,0 +1,30 @@
/**
* @file otf字体格式支持的表
* @author mengke01(kekee000@gmail.com)
*/
import head from './head';
import maxp from './maxp';
import cmap from './cmap';
import name from './name';
import hhea from './hhea';
import hmtx from './hmtx';
import post from './post';
import OS2 from './OS2';
import CFF from './CFF';
import GPOS from './GPOS';
import kern from './kern';
export default {
head,
maxp,
cmap,
name,
hhea,
hmtx,
post,
'OS/2': OS2,
CFF,
GPOS,
kern
};
@@ -0,0 +1,39 @@
import {useId as $83Elw$useId, useLabels as $83Elw$useLabels} from "@react-aria/utils";
/*
* 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 $d191a55c9702f145$export$8467354a121f1b9f(props) {
let { id: id, label: label, 'aria-labelledby': ariaLabelledby, 'aria-label': ariaLabel, labelElementType: labelElementType = 'label' } = props;
id = (0, $83Elw$useId)(id);
let labelId = (0, $83Elw$useId)();
let labelProps = {};
if (label) {
ariaLabelledby = ariaLabelledby ? `${labelId} ${ariaLabelledby}` : labelId;
labelProps = {
id: labelId,
htmlFor: labelElementType === 'label' ? id : undefined
};
} else if (!ariaLabelledby && !ariaLabel && process.env.NODE_ENV !== 'production') console.warn('If you do not provide a visible label, you must specify an aria-label or aria-labelledby attribute for accessibility');
let fieldProps = (0, $83Elw$useLabels)({
id: id,
'aria-label': ariaLabel,
'aria-labelledby': ariaLabelledby
});
return {
labelProps: labelProps,
fieldProps: fieldProps
};
}
export {$d191a55c9702f145$export$8467354a121f1b9f as useLabel};
//# sourceMappingURL=useLabel.module.js.map
@@ -0,0 +1,12 @@
# These are supported funding model platforms
github: [ljharb]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: npm/is-shared-array-buffer
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
@@ -0,0 +1,46 @@
{
"version": 3,
"file": "index.d.ts",
"names": [
"TSConfckFindOptions",
"TSConfckParseOptions",
"TSConfckFindAllOptions",
"TSConfckParseResult",
"TSConfckParseNativeOptions",
"TSConfckParseNativeResult",
"TSConfckCache",
"find",
"findAll",
"toJson",
"findNative",
"parse",
"TSConfckParseError",
"parseNative",
"TSConfckParseNativeError",
"TSDiagnosticError"
],
"sources": [
"../src/public.d.ts",
"../src/cache.js",
"../src/find.js",
"../src/find-all.js",
"../src/to-json.js",
"../src/find-native.js",
"../src/parse.js",
"../src/parse-native.js",
"../src/parse-native.d.ts"
],
"sourcesContent": [
null,
null,
null,
null,
null,
null,
null,
null,
null
],
"mappings": ";kBAEiBA,mBAAmBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAkCnBC,oBAAoBA;;;;kBAIpBC,sBAAsBA;;;;;;;;;;;;;;;kBAetBC,mBAAmBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA6BnBC,0BAA0BA;;;;;;;;;;;;kBAY1BC,yBAAyBA;;;;;;;;;;;;;;;;;;;;;;;;;;cC/F7BC,aAAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBCSJC,IAAIA;;;;;;;;iBCYJC,OAAOA;;;;;;;iBCTbC,MAAMA;;;;;;;;;;iBCDAC,UAAUA;;;;;;;iBCgBVC,KAAKA;cA8VdC,kBAAkBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBC9VTC,WAAWA;cAoOpBC,wBAAwBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MChNzBC,iBAAiBA",
"ignoreList": []
}
@@ -0,0 +1,727 @@
var path = require('path');
var fs = require('fs');
var test = require('tape');
var resolve = require('../');
var sync = require('../sync');
var requireResolveSupportsPaths = require.resolve.length > 1
&& !(/^v12\.[012]\./).test(process.version); // broken in v12.0-12.2, see https://github.com/nodejs/node/issues/27794
var requireResolveDefaultPathsBroken = (/^v8\.9\.|^v9\.[01]\.0|^v9\.2\./).test(process.version);
// broken in node v8.9.x, v9.0, v9.1, v9.2.x. see https://github.com/nodejs/node/pull/17113
test('`./sync` entry point', function (t) {
t.equal(resolve.sync, sync, '`./sync` entry point is the same as `.sync` on `main`');
t.end();
});
test('foo', function (t) {
var dir = path.join(__dirname, 'resolver');
t.equal(
resolve.sync('./foo', { basedir: dir }),
path.join(dir, 'foo.js'),
'./foo'
);
if (requireResolveSupportsPaths) {
t.equal(
resolve.sync('./foo', { basedir: dir }),
require.resolve('./foo', { paths: [dir] }),
'./foo: resolve.sync === require.resolve'
);
}
t.equal(
resolve.sync('./foo.js', { basedir: dir }),
path.join(dir, 'foo.js'),
'./foo.js'
);
if (requireResolveSupportsPaths) {
t.equal(
resolve.sync('./foo.js', { basedir: dir }),
require.resolve('./foo.js', { paths: [dir] }),
'./foo.js: resolve.sync === require.resolve'
);
}
t.equal(
resolve.sync('./foo.js', { basedir: dir, filename: path.join(dir, 'bar.js') }),
path.join(dir, 'foo.js')
);
t.throws(function () {
resolve.sync('foo', { basedir: dir });
});
// Test that filename is reported as the "from" value when passed.
t.throws(
function () {
resolve.sync('foo', { basedir: dir, filename: path.join(dir, 'bar.js') });
},
{
name: 'Error',
message: "Cannot find module 'foo' from '" + path.join(dir, 'bar.js') + "'"
}
);
t.end();
});
test('bar', function (t) {
var dir = path.join(__dirname, 'resolver');
var basedir = path.join(dir, 'bar');
t.equal(
resolve.sync('foo', { basedir: basedir }),
path.join(dir, 'bar/node_modules/foo/index.js'),
'foo in bar'
);
if (!requireResolveDefaultPathsBroken && requireResolveSupportsPaths) {
t.equal(
resolve.sync('foo', { basedir: basedir }),
require.resolve('foo', { paths: [basedir] }),
'foo in bar: resolve.sync === require.resolve'
);
}
t.end();
});
test('baz', function (t) {
var dir = path.join(__dirname, 'resolver');
t.equal(
resolve.sync('./baz', { basedir: dir }),
path.join(dir, 'baz/quux.js'),
'./baz'
);
if (requireResolveSupportsPaths) {
t.equal(
resolve.sync('./baz', { basedir: dir }),
require.resolve('./baz', { paths: [dir] }),
'./baz: resolve.sync === require.resolve'
);
}
t.end();
});
test('biz', function (t) {
var dir = path.join(__dirname, 'resolver/biz/node_modules');
t.equal(
resolve.sync('./grux', { basedir: dir }),
path.join(dir, 'grux/index.js')
);
if (requireResolveSupportsPaths) {
t.equal(
resolve.sync('./grux', { basedir: dir }),
require.resolve('./grux', { paths: [dir] }),
'./grux: resolve.sync === require.resolve'
);
}
var tivDir = path.join(dir, 'grux');
t.equal(
resolve.sync('tiv', { basedir: tivDir }),
path.join(dir, 'tiv/index.js')
);
if (!requireResolveDefaultPathsBroken && requireResolveSupportsPaths) {
t.equal(
resolve.sync('tiv', { basedir: tivDir }),
require.resolve('tiv', { paths: [tivDir] }),
'tiv: resolve.sync === require.resolve'
);
}
var gruxDir = path.join(dir, 'tiv');
t.equal(
resolve.sync('grux', { basedir: gruxDir }),
path.join(dir, 'grux/index.js')
);
if (!requireResolveDefaultPathsBroken && requireResolveSupportsPaths) {
t.equal(
resolve.sync('grux', { basedir: gruxDir }),
require.resolve('grux', { paths: [gruxDir] }),
'grux: resolve.sync === require.resolve'
);
}
t.end();
});
test('normalize', function (t) {
var dir = path.join(__dirname, 'resolver/biz/node_modules/grux');
t.equal(
resolve.sync('../grux', { basedir: dir }),
path.join(dir, 'index.js')
);
if (requireResolveSupportsPaths) {
t.equal(
resolve.sync('../grux', { basedir: dir }),
require.resolve('../grux', { paths: [dir] }),
'../grux: resolve.sync === require.resolve'
);
}
t.end();
});
test('cup', function (t) {
var dir = path.join(__dirname, 'resolver');
t.equal(
resolve.sync('./cup', {
basedir: dir,
extensions: ['.js', '.coffee']
}),
path.join(dir, 'cup.coffee'),
'./cup -> ./cup.coffee'
);
t.equal(
resolve.sync('./cup.coffee', { basedir: dir }),
path.join(dir, 'cup.coffee'),
'./cup.coffee'
);
t.throws(function () {
resolve.sync('./cup', {
basedir: dir,
extensions: ['.js']
});
});
if (requireResolveSupportsPaths) {
t.equal(
resolve.sync('./cup.coffee', { basedir: dir, extensions: ['.js', '.coffee'] }),
require.resolve('./cup.coffee', { paths: [dir] }),
'./cup.coffee: resolve.sync === require.resolve'
);
}
t.end();
});
test('mug', function (t) {
var dir = path.join(__dirname, 'resolver');
t.equal(
resolve.sync('./mug', { basedir: dir }),
path.join(dir, 'mug.js'),
'./mug -> ./mug.js'
);
if (requireResolveSupportsPaths) {
t.equal(
resolve.sync('./mug', { basedir: dir }),
require.resolve('./mug', { paths: [dir] }),
'./mug: resolve.sync === require.resolve'
);
}
t.equal(
resolve.sync('./mug', {
basedir: dir,
extensions: ['.coffee', '.js']
}),
path.join(dir, 'mug.coffee'),
'./mug -> ./mug.coffee'
);
t.equal(
resolve.sync('./mug', {
basedir: dir,
extensions: ['.js', '.coffee']
}),
path.join(dir, 'mug.js'),
'./mug -> ./mug.js'
);
t.end();
});
test('other path', function (t) {
var resolverDir = path.join(__dirname, 'resolver');
var dir = path.join(resolverDir, 'bar');
var otherDir = path.join(resolverDir, 'other_path');
t.equal(
resolve.sync('root', {
basedir: dir,
paths: [otherDir]
}),
path.join(resolverDir, 'other_path/root.js')
);
t.equal(
resolve.sync('lib/other-lib', {
basedir: dir,
paths: [otherDir]
}),
path.join(resolverDir, 'other_path/lib/other-lib.js')
);
t.throws(function () {
resolve.sync('root', { basedir: dir });
});
t.throws(function () {
resolve.sync('zzz', {
basedir: dir,
paths: [otherDir]
});
});
t.end();
});
test('path iterator', function (t) {
var resolverDir = path.join(__dirname, 'resolver');
var exactIterator = function (x, start, getPackageCandidates, opts) {
return [path.join(resolverDir, x)];
};
t.equal(
resolve.sync('baz', { packageIterator: exactIterator }),
path.join(resolverDir, 'baz/quux.js')
);
t.end();
});
test('incorrect main', function (t) {
var resolverDir = path.join(__dirname, 'resolver');
var dir = path.join(resolverDir, 'incorrect_main');
t.equal(
resolve.sync('./incorrect_main', { basedir: resolverDir }),
path.join(dir, 'index.js')
);
if (requireResolveSupportsPaths) {
t.equal(
resolve.sync('./incorrect_main', { basedir: resolverDir }),
require.resolve('./incorrect_main', { paths: [resolverDir] }),
'./incorrect_main: resolve.sync === require.resolve'
);
}
t.end();
});
test('missing index', function (t) {
t.plan(requireResolveSupportsPaths ? 2 : 1);
var resolverDir = path.join(__dirname, 'resolver');
try {
resolve.sync('./missing_index', { basedir: resolverDir });
t.fail('did not fail');
} catch (err) {
t.equal(err && err.code, 'INCORRECT_PACKAGE_MAIN', 'error has correct error code');
}
if (requireResolveSupportsPaths) {
try {
require.resolve('./missing_index', { basedir: resolverDir });
t.fail('require.resolve did not fail');
} catch (err) {
t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error has correct error code');
}
}
});
test('missing main', function (t) {
var resolverDir = path.join(__dirname, 'resolver');
var dir = path.join(resolverDir, 'missing_main');
t.equal(
resolve.sync('./missing_main', { basedir: resolverDir }),
path.join(dir, 'index.js')
);
if (requireResolveSupportsPaths) {
t.equal(
resolve.sync('./missing_main', { basedir: resolverDir }),
require.resolve('./missing_main', { paths: [resolverDir] }),
'"main" missing: resolve.sync === require.resolve'
);
}
t.end();
});
test('null main', function (t) {
var resolverDir = path.join(__dirname, 'resolver');
var dir = path.join(resolverDir, 'null_main');
t.equal(
resolve.sync('./null_main', { basedir: resolverDir }),
path.join(dir, 'index.js')
);
if (requireResolveSupportsPaths) {
t.equal(
resolve.sync('./null_main', { basedir: resolverDir }),
require.resolve('./null_main', { paths: [resolverDir] }),
'`"main": null`: resolve.sync === require.resolve'
);
}
t.end();
});
test('main: false', function (t) {
var basedir = path.join(__dirname, 'resolver');
var dir = path.join(basedir, 'false_main');
t.equal(
resolve.sync('./false_main', { basedir: basedir }),
path.join(dir, 'index.js'),
'`"main": false`: resolves to `index.js`'
);
if (requireResolveSupportsPaths) {
t.equal(
resolve.sync('./false_main', { basedir: basedir }),
require.resolve('./false_main', { paths: [basedir] }),
'`"main": false`: resolve.sync === require.resolve'
);
}
t.end();
});
var stubStatSync = function stubStatSync(fn) {
var statSync = fs.statSync;
try {
fs.statSync = function () {
throw new EvalError('Unknown Error');
};
return fn();
} finally {
fs.statSync = statSync;
}
};
test('#79 - re-throw non ENOENT errors from stat', function (t) {
var dir = path.join(__dirname, 'resolver');
stubStatSync(function () {
t.throws(function () {
resolve.sync('foo', { basedir: dir });
}, /Unknown Error/);
});
t.end();
});
test('#52 - incorrectly resolves module-paths like "./someFolder/" when there is a file of the same name', function (t) {
var dir = path.join(__dirname, 'resolver');
var basedir = path.join(dir, 'same_names');
t.equal(
resolve.sync('./foo', { basedir: basedir }),
path.join(dir, 'same_names/foo.js')
);
if (requireResolveSupportsPaths) {
t.equal(
resolve.sync('./foo', { basedir: basedir }),
require.resolve('./foo', { paths: [basedir] }),
'./foo: resolve.sync === require.resolve'
);
}
t.equal(
resolve.sync('./foo/', { basedir: basedir }),
path.join(dir, 'same_names/foo/index.js')
);
if (requireResolveSupportsPaths) {
t.equal(
resolve.sync('./foo/', { basedir: basedir }),
require.resolve('./foo/', { paths: [basedir] }),
'./foo/: resolve.sync === require.resolve'
);
}
t.end();
});
test('#211 - incorrectly resolves module-paths like "." when from inside a folder with a sibling file of the same name', function (t) {
var dir = path.join(__dirname, 'resolver');
var basedir = path.join(dir, 'same_names/foo');
t.equal(
resolve.sync('./', { basedir: basedir }),
path.join(dir, 'same_names/foo/index.js'),
'./'
);
if (requireResolveSupportsPaths) {
t.equal(
resolve.sync('./', { basedir: basedir }),
require.resolve('./', { paths: [basedir] }),
'./: resolve.sync === require.resolve'
);
}
t.equal(
resolve.sync('.', { basedir: basedir }),
path.join(dir, 'same_names/foo/index.js'),
'.'
);
if (requireResolveSupportsPaths) {
t.equal(
resolve.sync('.', { basedir: basedir }),
require.resolve('.', { paths: [basedir] }),
'.: resolve.sync === require.resolve',
{ todo: true }
);
}
t.end();
});
test('sync: #121 - treating an existing file as a dir when no basedir', function (t) {
var testFile = path.basename(__filename);
t.test('sanity check', function (st) {
st.equal(
resolve.sync('./' + testFile),
__filename,
'sanity check'
);
st.equal(
resolve.sync('./' + testFile),
require.resolve('./' + testFile),
'sanity check: resolve.sync === require.resolve'
);
st.end();
});
t.test('with a fake directory', function (st) {
function run() { return resolve.sync('./' + testFile + '/blah'); }
st.throws(run, 'throws an error');
try {
run();
} catch (e) {
st.equal(e.code, 'MODULE_NOT_FOUND', 'error code matches require.resolve');
st.equal(
e.message,
'Cannot find module \'./' + testFile + '/blah\' from \'' + __dirname + '\'',
'can not find nonexistent module'
);
}
st.end();
});
t.end();
});
test('sync dot main', function (t) {
var start = new Date();
t.equal(
resolve.sync('./resolver/dot_main'),
path.join(__dirname, 'resolver/dot_main/index.js'),
'./resolver/dot_main'
);
t.equal(
resolve.sync('./resolver/dot_main'),
require.resolve('./resolver/dot_main'),
'./resolver/dot_main: resolve.sync === require.resolve'
);
t.ok(new Date() - start < 50, 'resolve.sync timedout');
t.end();
});
test('sync dot slash main', function (t) {
var start = new Date();
t.equal(
resolve.sync('./resolver/dot_slash_main'),
path.join(__dirname, 'resolver/dot_slash_main/index.js')
);
t.equal(
resolve.sync('./resolver/dot_slash_main'),
require.resolve('./resolver/dot_slash_main'),
'./resolver/dot_slash_main: resolve.sync === require.resolve'
);
t.ok(new Date() - start < 50, 'resolve.sync timedout');
t.end();
});
test('not a directory', function (t) {
var path = './foo';
try {
resolve.sync(path, { basedir: __filename });
t.fail();
} catch (err) {
t.ok(err, 'a non-directory errors');
t.equal(err && err.message, 'Provided basedir "' + __filename + '" is not a directory, or a symlink to a directory');
t.equal(err && err.code, 'INVALID_BASEDIR');
}
t.end();
});
test('non-string "main" field in package.json', function (t) {
var dir = path.join(__dirname, 'resolver');
try {
var result = resolve.sync('./invalid_main', { basedir: dir });
t.equal(result, undefined, 'result should not exist');
t.fail('should not get here');
} catch (err) {
t.ok(err, 'errors on non-string main');
t.equal(err.message, 'package “invalid_main” `main` must be a string');
t.equal(err.code, 'INVALID_PACKAGE_MAIN');
}
t.end();
});
test('non-string "main" field in package.json', function (t) {
var dir = path.join(__dirname, 'resolver');
try {
var result = resolve.sync('./invalid_main', { basedir: dir });
t.equal(result, undefined, 'result should not exist');
t.fail('should not get here');
} catch (err) {
t.ok(err, 'errors on non-string main');
t.equal(err.message, 'package “invalid_main” `main` must be a string');
t.equal(err.code, 'INVALID_PACKAGE_MAIN');
}
t.end();
});
test('browser field in package.json', function (t) {
var dir = path.join(__dirname, 'resolver');
var res = resolve.sync('./browser_field', {
basedir: dir,
packageFilter: function packageFilter(pkg) {
if (pkg.browser) {
pkg.main = pkg.browser; // eslint-disable-line no-param-reassign
delete pkg.browser; // eslint-disable-line no-param-reassign
}
return pkg;
}
});
t.equal(res, path.join(dir, 'browser_field', 'b.js'));
t.end();
});
test('absolute paths', function (t) {
var extensionless = __filename.slice(0, -path.extname(__filename).length);
t.equal(
resolve.sync(__filename),
__filename,
'absolute path to this file resolves'
);
t.equal(
resolve.sync(__filename),
require.resolve(__filename),
'absolute path to this file: resolve.sync === require.resolve'
);
t.equal(
resolve.sync(extensionless),
__filename,
'extensionless absolute path to this file resolves'
);
t.equal(
resolve.sync(__filename),
require.resolve(__filename),
'absolute path to this file: resolve.sync === require.resolve'
);
t.equal(
resolve.sync(__filename, { basedir: process.cwd() }),
__filename,
'absolute path to this file with a basedir resolves'
);
if (requireResolveSupportsPaths) {
t.equal(
resolve.sync(__filename, { basedir: process.cwd() }),
require.resolve(__filename, { paths: [process.cwd()] }),
'absolute path to this file + basedir: resolve.sync === require.resolve'
);
}
t.equal(
resolve.sync(extensionless, { basedir: process.cwd() }),
__filename,
'extensionless absolute path to this file with a basedir resolves'
);
if (requireResolveSupportsPaths) {
t.equal(
resolve.sync(extensionless, { basedir: process.cwd() }),
require.resolve(extensionless, { paths: [process.cwd()] }),
'extensionless absolute path to this file + basedir: resolve.sync === require.resolve'
);
}
t.end();
});
var malformedDir = path.join(__dirname, 'resolver/malformed_package_json');
test('malformed package.json', { skip: !fs.existsSync(malformedDir) }, function (t) {
t.plan(5 + (requireResolveSupportsPaths ? 1 : 0));
var basedir = malformedDir;
var expected = path.join(basedir, 'index.js');
t.equal(
resolve.sync('./index.js', { basedir: basedir }),
expected,
'malformed package.json is silently ignored'
);
if (requireResolveSupportsPaths) {
t.equal(
resolve.sync('./index.js', { basedir: basedir }),
require.resolve('./index.js', { paths: [basedir] }),
'malformed package.json: resolve.sync === require.resolve'
);
}
var res1 = resolve.sync(
'./index.js',
{
basedir: basedir,
packageFilter: function (pkg, pkgfile, dir) {
t.fail('should not reach here');
}
}
);
t.equal(
res1,
expected,
'with packageFilter: malformed package.json is silently ignored'
);
var res2 = resolve.sync(
'./index.js',
{
basedir: basedir,
readPackageSync: function (readFileSync, pkgfile) {
t.equal(pkgfile, path.join(basedir, 'package.json'), 'readPackageSync: `pkgfile` is package.json path');
var result = String(readFileSync(pkgfile));
try {
return JSON.parse(result);
} catch (e) {
t.ok(e instanceof SyntaxError, 'readPackageSync: malformed package.json parses as a syntax error');
throw e;
}
}
}
);
t.equal(
res2,
expected,
'with readPackageSync: malformed package.json is silently ignored'
);
});
@@ -0,0 +1,22 @@
/*
* 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.
*/ /** Returns whether two sets are equal. */ function $fc36f9a046a9ce79$export$a8d0d0c8d1c5df64(a, b) {
if (a === b) return true;
if (a.size !== b.size) return false;
for (let key of a){
if (!b.has(key)) return false;
}
return true;
}
export {$fc36f9a046a9ce79$export$a8d0d0c8d1c5df64 as isSetEqual};
//# sourceMappingURL=utils.module.js.map
@@ -0,0 +1,412 @@
#!/usr/bin/env node
/*********************************************************************
* NAN - Native Abstractions for Node.js
*
* Copyright (c) 2018 NAN contributors
*
* MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
********************************************************************/
var commander = require('commander'),
fs = require('fs'),
glob = require('glob'),
groups = [],
total = 0,
warning1 = '/* ERROR: Rewrite using Buffer */\n',
warning2 = '\\/\\* ERROR\\: Rewrite using Buffer \\*\\/\\n',
length,
i;
fs.readFile(__dirname + '/package.json', 'utf8', function (err, data) {
if (err) {
throw err;
}
commander
.version(JSON.parse(data).version)
.usage('[options] <file ...>')
.parse(process.argv);
if (!process.argv.slice(2).length) {
commander.outputHelp();
}
});
/* construct strings representing regular expressions
each expression contains a unique group allowing for identification of the match
the index of this key group, relative to the regular expression in question,
is indicated by the first array member */
/* simple substistutions, key group is the entire match, 0 */
groups.push([0, [
'_NAN_',
'NODE_SET_METHOD',
'NODE_SET_PROTOTYPE_METHOD',
'NanAsciiString',
'NanEscapeScope',
'NanReturnValue',
'NanUcs2String'].join('|')]);
/* substitutions of parameterless macros, key group is 1 */
groups.push([1, ['(', [
'NanEscapableScope',
'NanReturnNull',
'NanReturnUndefined',
'NanScope'].join('|'), ')\\(\\)'].join('')]);
/* replace TryCatch with NanTryCatch once, gobbling possible namespace, key group 2 */
groups.push([2, '(?:(?:v8\\:\\:)?|(Nan)?)(TryCatch)']);
/* NanNew("string") will likely not fail a ToLocalChecked(), key group 1 */
groups.push([1, ['(NanNew)', '(\\("[^\\"]*"[^\\)]*\\))(?!\\.ToLocalChecked\\(\\))'].join('')]);
/* Removed v8 APIs, warn that the code needs rewriting using node::Buffer, key group 2 */
groups.push([2, ['(', warning2, ')?', '^.*?(', [
'GetIndexedPropertiesExternalArrayDataLength',
'GetIndexedPropertiesExternalArrayData',
'GetIndexedPropertiesExternalArrayDataType',
'GetIndexedPropertiesPixelData',
'GetIndexedPropertiesPixelDataLength',
'HasIndexedPropertiesInExternalArrayData',
'HasIndexedPropertiesInPixelData',
'SetIndexedPropertiesToExternalArrayData',
'SetIndexedPropertiesToPixelData'].join('|'), ')'].join('')]);
/* No need for NanScope in V8-exposed methods, key group 2 */
groups.push([2, ['((', [
'NAN_METHOD',
'NAN_GETTER',
'NAN_SETTER',
'NAN_PROPERTY_GETTER',
'NAN_PROPERTY_SETTER',
'NAN_PROPERTY_ENUMERATOR',
'NAN_PROPERTY_DELETER',
'NAN_PROPERTY_QUERY',
'NAN_INDEX_GETTER',
'NAN_INDEX_SETTER',
'NAN_INDEX_ENUMERATOR',
'NAN_INDEX_DELETER',
'NAN_INDEX_QUERY'].join('|'), ')\\([^\\)]*\\)\\s*\\{)\\s*NanScope\\(\\)\\s*;'].join('')]);
/* v8::Value::ToXXXXXXX returns v8::MaybeLocal<T>, key group 3 */
groups.push([3, ['([\\s\\(\\)])([^\\s\\(\\)]+)->(', [
'Boolean',
'Number',
'String',
'Object',
'Integer',
'Uint32',
'Int32'].join('|'), ')\\('].join('')]);
/* v8::Value::XXXXXXXValue returns v8::Maybe<T>, key group 3 */
groups.push([3, ['([\\s\\(\\)])([^\\s\\(\\)]+)->((?:', [
'Boolean',
'Number',
'Integer',
'Uint32',
'Int32'].join('|'), ')Value)\\('].join('')]);
/* NAN_WEAK_CALLBACK macro was removed, write out callback definition, key group 1 */
groups.push([1, '(NAN_WEAK_CALLBACK)\\(([^\\s\\)]+)\\)']);
/* node::ObjectWrap and v8::Persistent have been replaced with Nan implementations, key group 1 */
groups.push([1, ['(', [
'NanDisposePersistent',
'NanObjectWrapHandle'].join('|'), ')\\s*\\(\\s*([^\\s\\)]+)'].join('')]);
/* Since NanPersistent there is no need for NanMakeWeakPersistent, key group 1 */
groups.push([1, '(NanMakeWeakPersistent)\\s*\\(\\s*([^\\s,]+)\\s*,\\s*']);
/* Many methods of v8::Object and others now return v8::MaybeLocal<T>, key group 3 */
groups.push([3, ['([\\s])([^\\s]+)->(', [
'GetEndColumn',
'GetFunction',
'GetLineNumber',
'NewInstance',
'GetPropertyNames',
'GetOwnPropertyNames',
'GetSourceLine',
'GetStartColumn',
'ObjectProtoToString',
'ToArrayIndex',
'ToDetailString',
'CallAsConstructor',
'CallAsFunction',
'CloneElementAt',
'Delete',
'ForceSet',
'Get',
'GetPropertyAttributes',
'GetRealNamedProperty',
'GetRealNamedPropertyInPrototypeChain',
'Has',
'HasOwnProperty',
'HasRealIndexedProperty',
'HasRealNamedCallbackProperty',
'HasRealNamedProperty',
'Set',
'SetAccessor',
'SetIndexedPropertyHandler',
'SetNamedPropertyHandler',
'SetPrototype'].join('|'), ')\\('].join('')]);
/* You should get an error if any of these fail anyways,
or handle the error better, it is indicated either way, key group 2 */
groups.push([2, ['NanNew(<(?:v8\\:\\:)?(', ['Date', 'String', 'RegExp'].join('|'), ')>)(\\([^\\)]*\\))(?!\\.ToLocalChecked\\(\\))'].join('')]);
/* v8::Value::Equals now returns a v8::Maybe, key group 3 */
groups.push([3, '([\\s\\(\\)])([^\\s\\(\\)]+)->(Equals)\\(([^\\s\\)]+)']);
/* NanPersistent makes this unnecessary, key group 1 */
groups.push([1, '(NanAssignPersistent)(?:<v8\\:\\:[^>]+>)?\\(([^,]+),\\s*']);
/* args has been renamed to info, key group 2 */
groups.push([2, '(\\W)(args)(\\W)'])
/* node::ObjectWrap was replaced with NanObjectWrap, key group 2 */
groups.push([2, '(\\W)(?:node\\:\\:)?(ObjectWrap)(\\W)']);
/* v8::Persistent was replaced with NanPersistent, key group 2 */
groups.push([2, '(\\W)(?:v8\\:\\:)?(Persistent)(\\W)']);
/* counts the number of capturing groups in a well-formed regular expression,
ignoring non-capturing groups and escaped parentheses */
function groupcount(s) {
var positive = s.match(/\((?!\?)/g),
negative = s.match(/\\\(/g);
return (positive ? positive.length : 0) - (negative ? negative.length : 0);
}
/* compute the absolute position of each key group in the joined master RegExp */
for (i = 1, length = groups.length; i < length; i++) {
total += groupcount(groups[i - 1][1]);
groups[i][0] += total;
}
/* create the master RegExp, which is the union of all the groups' expressions */
master = new RegExp(groups.map(function (a) { return a[1]; }).join('|'), 'gm');
/* replacement function for String.replace, receives 21 arguments */
function replace() {
/* simple expressions */
switch (arguments[groups[0][0]]) {
case '_NAN_':
return 'NAN_';
case 'NODE_SET_METHOD':
return 'NanSetMethod';
case 'NODE_SET_PROTOTYPE_METHOD':
return 'NanSetPrototypeMethod';
case 'NanAsciiString':
return 'NanUtf8String';
case 'NanEscapeScope':
return 'scope.Escape';
case 'NanReturnNull':
return 'info.GetReturnValue().SetNull';
case 'NanReturnValue':
return 'info.GetReturnValue().Set';
case 'NanUcs2String':
return 'v8::String::Value';
default:
}
/* macros without arguments */
switch (arguments[groups[1][0]]) {
case 'NanEscapableScope':
return 'NanEscapableScope scope'
case 'NanReturnUndefined':
return 'return';
case 'NanScope':
return 'NanScope scope';
default:
}
/* TryCatch, emulate negative backref */
if (arguments[groups[2][0]] === 'TryCatch') {
return arguments[groups[2][0] - 1] ? arguments[0] : 'NanTryCatch';
}
/* NanNew("foo") --> NanNew("foo").ToLocalChecked() */
if (arguments[groups[3][0]] === 'NanNew') {
return [arguments[0], '.ToLocalChecked()'].join('');
}
/* insert warning for removed functions as comment on new line above */
switch (arguments[groups[4][0]]) {
case 'GetIndexedPropertiesExternalArrayData':
case 'GetIndexedPropertiesExternalArrayDataLength':
case 'GetIndexedPropertiesExternalArrayDataType':
case 'GetIndexedPropertiesPixelData':
case 'GetIndexedPropertiesPixelDataLength':
case 'HasIndexedPropertiesInExternalArrayData':
case 'HasIndexedPropertiesInPixelData':
case 'SetIndexedPropertiesToExternalArrayData':
case 'SetIndexedPropertiesToPixelData':
return arguments[groups[4][0] - 1] ? arguments[0] : [warning1, arguments[0]].join('');
default:
}
/* remove unnecessary NanScope() */
switch (arguments[groups[5][0]]) {
case 'NAN_GETTER':
case 'NAN_METHOD':
case 'NAN_SETTER':
case 'NAN_INDEX_DELETER':
case 'NAN_INDEX_ENUMERATOR':
case 'NAN_INDEX_GETTER':
case 'NAN_INDEX_QUERY':
case 'NAN_INDEX_SETTER':
case 'NAN_PROPERTY_DELETER':
case 'NAN_PROPERTY_ENUMERATOR':
case 'NAN_PROPERTY_GETTER':
case 'NAN_PROPERTY_QUERY':
case 'NAN_PROPERTY_SETTER':
return arguments[groups[5][0] - 1];
default:
}
/* Value conversion */
switch (arguments[groups[6][0]]) {
case 'Boolean':
case 'Int32':
case 'Integer':
case 'Number':
case 'Object':
case 'String':
case 'Uint32':
return [arguments[groups[6][0] - 2], 'NanTo<v8::', arguments[groups[6][0]], '>(', arguments[groups[6][0] - 1]].join('');
default:
}
/* other value conversion */
switch (arguments[groups[7][0]]) {
case 'BooleanValue':
return [arguments[groups[7][0] - 2], 'NanTo<bool>(', arguments[groups[7][0] - 1]].join('');
case 'Int32Value':
return [arguments[groups[7][0] - 2], 'NanTo<int32_t>(', arguments[groups[7][0] - 1]].join('');
case 'IntegerValue':
return [arguments[groups[7][0] - 2], 'NanTo<int64_t>(', arguments[groups[7][0] - 1]].join('');
case 'Uint32Value':
return [arguments[groups[7][0] - 2], 'NanTo<uint32_t>(', arguments[groups[7][0] - 1]].join('');
default:
}
/* NAN_WEAK_CALLBACK */
if (arguments[groups[8][0]] === 'NAN_WEAK_CALLBACK') {
return ['template<typename T>\nvoid ',
arguments[groups[8][0] + 1], '(const NanWeakCallbackInfo<T> &data)'].join('');
}
/* use methods on NAN classes instead */
switch (arguments[groups[9][0]]) {
case 'NanDisposePersistent':
return [arguments[groups[9][0] + 1], '.Reset('].join('');
case 'NanObjectWrapHandle':
return [arguments[groups[9][0] + 1], '->handle('].join('');
default:
}
/* use method on NanPersistent instead */
if (arguments[groups[10][0]] === 'NanMakeWeakPersistent') {
return arguments[groups[10][0] + 1] + '.SetWeak(';
}
/* These return Maybes, the upper ones take no arguments */
switch (arguments[groups[11][0]]) {
case 'GetEndColumn':
case 'GetFunction':
case 'GetLineNumber':
case 'GetOwnPropertyNames':
case 'GetPropertyNames':
case 'GetSourceLine':
case 'GetStartColumn':
case 'NewInstance':
case 'ObjectProtoToString':
case 'ToArrayIndex':
case 'ToDetailString':
return [arguments[groups[11][0] - 2], 'Nan', arguments[groups[11][0]], '(', arguments[groups[11][0] - 1]].join('');
case 'CallAsConstructor':
case 'CallAsFunction':
case 'CloneElementAt':
case 'Delete':
case 'ForceSet':
case 'Get':
case 'GetPropertyAttributes':
case 'GetRealNamedProperty':
case 'GetRealNamedPropertyInPrototypeChain':
case 'Has':
case 'HasOwnProperty':
case 'HasRealIndexedProperty':
case 'HasRealNamedCallbackProperty':
case 'HasRealNamedProperty':
case 'Set':
case 'SetAccessor':
case 'SetIndexedPropertyHandler':
case 'SetNamedPropertyHandler':
case 'SetPrototype':
return [arguments[groups[11][0] - 2], 'Nan', arguments[groups[11][0]], '(', arguments[groups[11][0] - 1], ', '].join('');
default:
}
/* Automatic ToLocalChecked(), take it or leave it */
switch (arguments[groups[12][0]]) {
case 'Date':
case 'String':
case 'RegExp':
return ['NanNew', arguments[groups[12][0] - 1], arguments[groups[12][0] + 1], '.ToLocalChecked()'].join('');
default:
}
/* NanEquals is now required for uniformity */
if (arguments[groups[13][0]] === 'Equals') {
return [arguments[groups[13][0] - 1], 'NanEquals(', arguments[groups[13][0] - 1], ', ', arguments[groups[13][0] + 1]].join('');
}
/* use method on replacement class instead */
if (arguments[groups[14][0]] === 'NanAssignPersistent') {
return [arguments[groups[14][0] + 1], '.Reset('].join('');
}
/* args --> info */
if (arguments[groups[15][0]] === 'args') {
return [arguments[groups[15][0] - 1], 'info', arguments[groups[15][0] + 1]].join('');
}
/* ObjectWrap --> NanObjectWrap */
if (arguments[groups[16][0]] === 'ObjectWrap') {
return [arguments[groups[16][0] - 1], 'NanObjectWrap', arguments[groups[16][0] + 1]].join('');
}
/* Persistent --> NanPersistent */
if (arguments[groups[17][0]] === 'Persistent') {
return [arguments[groups[17][0] - 1], 'NanPersistent', arguments[groups[17][0] + 1]].join('');
}
/* This should not happen. A switch is probably missing a case if it does. */
throw 'Unhandled match: ' + arguments[0];
}
/* reads a file, runs replacement and writes it back */
function processFile(file) {
fs.readFile(file, {encoding: 'utf8'}, function (err, data) {
if (err) {
throw err;
}
/* run replacement twice, might need more runs */
fs.writeFile(file, data.replace(master, replace).replace(master, replace), function (err) {
if (err) {
throw err;
}
});
});
}
/* process file names from command line and process the identified files */
for (i = 2, length = process.argv.length; i < length; i++) {
glob(process.argv[i], function (err, matches) {
if (err) {
throw err;
}
matches.forEach(processFile);
});
}
@@ -0,0 +1,379 @@
import type { ThunkDispatch, UnknownAction } from '@reduxjs/toolkit'
import type {
BaseQueryFn,
BaseQueryMeta,
BaseQueryResult,
} from '../../baseQueryTypes'
import type {
BaseEndpointDefinition,
DefinitionType,
} from '../../endpointDefinitions'
import { isAnyQueryDefinition } from '../../endpointDefinitions'
import type { QueryCacheKey, RootState } from '../apiState'
import type {
MutationResultSelectorResult,
QueryResultSelectorResult,
} from '../buildSelectors'
import { getMutationCacheKey } from '../buildSlice'
import type { PatchCollection, Recipe } from '../buildThunks'
import { isAsyncThunkAction, isFulfilled } from '../rtkImports'
import type {
ApiMiddlewareInternalHandler,
InternalHandlerBuilder,
PromiseWithKnownReason,
SubMiddlewareApi,
} from './types'
import { getEndpointDefinition } from '@internal/query/apiTypes'
export type ReferenceCacheLifecycle = never
export interface QueryBaseLifecycleApi<
QueryArg,
BaseQuery extends BaseQueryFn,
ResultType,
ReducerPath extends string = string,
> extends LifecycleApi<ReducerPath> {
/**
* Gets the current value of this cache entry.
*/
getCacheEntry(): QueryResultSelectorResult<
{ type: DefinitionType.query } & BaseEndpointDefinition<
QueryArg,
BaseQuery,
ResultType,
BaseQueryResult<BaseQuery>
>
>
/**
* Updates the current cache entry value.
* For documentation see `api.util.updateQueryData`.
*/
updateCachedData(updateRecipe: Recipe<ResultType>): PatchCollection
}
export type MutationBaseLifecycleApi<
QueryArg,
BaseQuery extends BaseQueryFn,
ResultType,
ReducerPath extends string = string,
> = LifecycleApi<ReducerPath> & {
/**
* Gets the current value of this cache entry.
*/
getCacheEntry(): MutationResultSelectorResult<
{ type: DefinitionType.mutation } & BaseEndpointDefinition<
QueryArg,
BaseQuery,
ResultType,
BaseQueryResult<BaseQuery>
>
>
}
type LifecycleApi<ReducerPath extends string = string> = {
/**
* The dispatch method for the store
*/
dispatch: ThunkDispatch<any, any, UnknownAction>
/**
* A method to get the current state
*/
getState(): RootState<any, any, ReducerPath>
/**
* `extra` as provided as `thunk.extraArgument` to the `configureStore` `getDefaultMiddleware` option.
*/
extra: unknown
/**
* A unique ID generated for the mutation
*/
requestId: string
}
type CacheLifecyclePromises<ResultType = unknown, MetaType = unknown> = {
/**
* Promise that will resolve with the first value for this cache key.
* This allows you to `await` until an actual value is in cache.
*
* If the cache entry is removed from the cache before any value has ever
* been resolved, this Promise will reject with
* `new Error('Promise never resolved before cacheEntryRemoved.')`
* to prevent memory leaks.
* You can just re-throw that error (or not handle it at all) -
* it will be caught outside of `cacheEntryAdded`.
*
* If you don't interact with this promise, it will not throw.
*/
cacheDataLoaded: PromiseWithKnownReason<
{
/**
* The (transformed) query result.
*/
data: ResultType
/**
* The `meta` returned by the `baseQuery`
*/
meta: MetaType
},
typeof neverResolvedError
>
/**
* Promise that allows you to wait for the point in time when the cache entry
* has been removed from the cache, by not being used/subscribed to any more
* in the application for too long or by dispatching `api.util.resetApiState`.
*/
cacheEntryRemoved: Promise<void>
}
export interface QueryCacheLifecycleApi<
QueryArg,
BaseQuery extends BaseQueryFn,
ResultType,
ReducerPath extends string = string,
> extends QueryBaseLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>,
CacheLifecyclePromises<ResultType, BaseQueryMeta<BaseQuery>> {}
export type MutationCacheLifecycleApi<
QueryArg,
BaseQuery extends BaseQueryFn,
ResultType,
ReducerPath extends string = string,
> = MutationBaseLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath> &
CacheLifecyclePromises<ResultType, BaseQueryMeta<BaseQuery>>
export type CacheLifecycleQueryExtraOptions<
ResultType,
QueryArg,
BaseQuery extends BaseQueryFn,
ReducerPath extends string = string,
> = {
onCacheEntryAdded?(
arg: QueryArg,
api: QueryCacheLifecycleApi<QueryArg, BaseQuery, ResultType, ReducerPath>,
): Promise<void> | void
}
export type CacheLifecycleInfiniteQueryExtraOptions<
ResultType,
QueryArg,
BaseQuery extends BaseQueryFn,
ReducerPath extends string = string,
> = CacheLifecycleQueryExtraOptions<
ResultType,
QueryArg,
BaseQuery,
ReducerPath
>
export type CacheLifecycleMutationExtraOptions<
ResultType,
QueryArg,
BaseQuery extends BaseQueryFn,
ReducerPath extends string = string,
> = {
onCacheEntryAdded?(
arg: QueryArg,
api: MutationCacheLifecycleApi<
QueryArg,
BaseQuery,
ResultType,
ReducerPath
>,
): Promise<void> | void
}
const neverResolvedError = new Error(
'Promise never resolved before cacheEntryRemoved.',
) as Error & {
message: 'Promise never resolved before cacheEntryRemoved.'
}
export const buildCacheLifecycleHandler: InternalHandlerBuilder = ({
api,
reducerPath,
context,
queryThunk,
mutationThunk,
internalState,
selectors: { selectQueryEntry, selectApiState },
}) => {
const isQueryThunk = isAsyncThunkAction(queryThunk)
const isMutationThunk = isAsyncThunkAction(mutationThunk)
const isFulfilledThunk = isFulfilled(queryThunk, mutationThunk)
type CacheLifecycle = {
valueResolved?(value: { data: unknown; meta: unknown }): unknown
cacheEntryRemoved(): void
}
const lifecycleMap: Record<string, CacheLifecycle> = {}
const { removeQueryResult, removeMutationResult, cacheEntriesUpserted } =
api.internalActions
function resolveLifecycleEntry(
cacheKey: string,
data: unknown,
meta: unknown,
) {
const lifecycle = lifecycleMap[cacheKey]
if (lifecycle?.valueResolved) {
lifecycle.valueResolved({
data,
meta,
})
delete lifecycle.valueResolved
}
}
function removeLifecycleEntry(cacheKey: string) {
const lifecycle = lifecycleMap[cacheKey]
if (lifecycle) {
delete lifecycleMap[cacheKey]
lifecycle.cacheEntryRemoved()
}
}
function getActionMetaFields(
action:
| ReturnType<typeof queryThunk.pending>
| ReturnType<typeof mutationThunk.pending>,
) {
const { arg, requestId } = action.meta
const { endpointName, originalArgs } = arg
return [endpointName, originalArgs, requestId] as const
}
const handler: ApiMiddlewareInternalHandler = (
action,
mwApi,
stateBefore,
) => {
const cacheKey = getCacheKey(action) as QueryCacheKey
function checkForNewCacheKey(
endpointName: string,
cacheKey: QueryCacheKey,
requestId: string,
originalArgs: unknown,
) {
const oldEntry = selectQueryEntry(stateBefore, cacheKey)
const newEntry = selectQueryEntry(mwApi.getState(), cacheKey)
if (!oldEntry && newEntry) {
handleNewKey(endpointName, originalArgs, cacheKey, mwApi, requestId)
}
}
if (queryThunk.pending.match(action)) {
const [endpointName, originalArgs, requestId] =
getActionMetaFields(action)
checkForNewCacheKey(endpointName, cacheKey, requestId, originalArgs)
} else if (cacheEntriesUpserted.match(action)) {
for (const { queryDescription, value } of action.payload) {
const { endpointName, originalArgs, queryCacheKey } = queryDescription
checkForNewCacheKey(
endpointName,
queryCacheKey,
action.meta.requestId,
originalArgs,
)
resolveLifecycleEntry(queryCacheKey, value, {})
}
} else if (mutationThunk.pending.match(action)) {
const state = mwApi.getState()[reducerPath].mutations[cacheKey]
if (state) {
const [endpointName, originalArgs, requestId] =
getActionMetaFields(action)
handleNewKey(endpointName, originalArgs, cacheKey, mwApi, requestId)
}
} else if (isFulfilledThunk(action)) {
resolveLifecycleEntry(cacheKey, action.payload, action.meta.baseQueryMeta)
} else if (
removeQueryResult.match(action) ||
removeMutationResult.match(action)
) {
removeLifecycleEntry(cacheKey)
} else if (api.util.resetApiState.match(action)) {
for (const cacheKey of Object.keys(lifecycleMap)) {
removeLifecycleEntry(cacheKey)
}
}
}
function getCacheKey(action: any) {
if (isQueryThunk(action)) return action.meta.arg.queryCacheKey
if (isMutationThunk(action)) {
return action.meta.arg.fixedCacheKey ?? action.meta.requestId
}
if (removeQueryResult.match(action)) return action.payload.queryCacheKey
if (removeMutationResult.match(action))
return getMutationCacheKey(action.payload)
return ''
}
function handleNewKey(
endpointName: string,
originalArgs: any,
queryCacheKey: string,
mwApi: SubMiddlewareApi,
requestId: string,
) {
const endpointDefinition = getEndpointDefinition(context, endpointName)
const onCacheEntryAdded = endpointDefinition?.onCacheEntryAdded
if (!onCacheEntryAdded) return
const lifecycle = {} as CacheLifecycle
const cacheEntryRemoved = new Promise<void>((resolve) => {
lifecycle.cacheEntryRemoved = resolve
})
const cacheDataLoaded: PromiseWithKnownReason<
{ data: unknown; meta: unknown },
typeof neverResolvedError
> = Promise.race([
new Promise<{ data: unknown; meta: unknown }>((resolve) => {
lifecycle.valueResolved = resolve
}),
cacheEntryRemoved.then(() => {
throw neverResolvedError
}),
])
// prevent uncaught promise rejections from happening.
// if the original promise is used in any way, that will create a new promise that will throw again
cacheDataLoaded.catch(() => {})
lifecycleMap[queryCacheKey] = lifecycle
const selector = (api.endpoints[endpointName] as any).select(
isAnyQueryDefinition(endpointDefinition) ? originalArgs : queryCacheKey,
)
const extra = mwApi.dispatch((_, __, extra) => extra)
const lifecycleApi = {
...mwApi,
getCacheEntry: () => selector(mwApi.getState()),
requestId,
extra,
updateCachedData: (isAnyQueryDefinition(endpointDefinition)
? (updateRecipe: Recipe<any>) =>
mwApi.dispatch(
api.util.updateQueryData(
endpointName as never,
originalArgs as never,
updateRecipe,
),
)
: undefined) as any,
cacheDataLoaded,
cacheEntryRemoved,
}
const runningHandler = onCacheEntryAdded(originalArgs, lifecycleApi as any)
// if a `neverResolvedError` was thrown, but not handled in the running handler, do not let it leak out further
Promise.resolve(runningHandler).catch((e) => {
if (e === neverResolvedError) return
throw e
})
}
return handler
}
@@ -0,0 +1,6 @@
import { OB11BaseNoticeEvent } from './OB11BaseNoticeEvent';
import { NapCatCore } from '../../../napcat-core';
export declare abstract class OB11OnlineFileNoticeEvent extends OB11BaseNoticeEvent {
peer_id: number;
protected constructor(core: NapCatCore, peer_id: number);
}
@@ -0,0 +1,325 @@
import * as tailwind_variants_dist_config from 'tailwind-variants/dist/config';
import * as tailwind_variants from 'tailwind-variants';
import { VariantProps } from 'tailwind-variants';
/**
* DatePicker wrapper **Tailwind Variants** component
*
* @example
*/
declare const datePicker: tailwind_variants.TVReturnType<{
[key: string]: {
[key: string]: tailwind_variants.ClassValue | {
base?: tailwind_variants.ClassValue;
selectorIcon?: tailwind_variants.ClassValue;
popoverContent?: tailwind_variants.ClassValue;
selectorButton?: tailwind_variants.ClassValue;
calendar?: tailwind_variants.ClassValue;
calendarContent?: tailwind_variants.ClassValue;
timeInputLabel?: tailwind_variants.ClassValue;
timeInput?: tailwind_variants.ClassValue;
};
};
} | {
[x: string]: {
[x: string]: tailwind_variants.ClassValue | {
base?: tailwind_variants.ClassValue;
selectorIcon?: tailwind_variants.ClassValue;
popoverContent?: tailwind_variants.ClassValue;
selectorButton?: tailwind_variants.ClassValue;
calendar?: tailwind_variants.ClassValue;
calendarContent?: tailwind_variants.ClassValue;
timeInputLabel?: tailwind_variants.ClassValue;
timeInput?: tailwind_variants.ClassValue;
};
};
} | {}, {
base: string;
selectorButton: string;
selectorIcon: string;
popoverContent: string;
calendar: string;
calendarContent: string;
timeInputLabel: string;
timeInput: string;
}, undefined, tailwind_variants_dist_config.TVConfig<unknown, {
[key: string]: {
[key: string]: tailwind_variants.ClassValue | {
base?: tailwind_variants.ClassValue;
selectorIcon?: tailwind_variants.ClassValue;
popoverContent?: tailwind_variants.ClassValue;
selectorButton?: tailwind_variants.ClassValue;
calendar?: tailwind_variants.ClassValue;
calendarContent?: tailwind_variants.ClassValue;
timeInputLabel?: tailwind_variants.ClassValue;
timeInput?: tailwind_variants.ClassValue;
};
};
} | {}>, {
[key: string]: {
[key: string]: tailwind_variants.ClassValue | {
base?: tailwind_variants.ClassValue;
selectorIcon?: tailwind_variants.ClassValue;
popoverContent?: tailwind_variants.ClassValue;
selectorButton?: tailwind_variants.ClassValue;
calendar?: tailwind_variants.ClassValue;
calendarContent?: tailwind_variants.ClassValue;
timeInputLabel?: tailwind_variants.ClassValue;
timeInput?: tailwind_variants.ClassValue;
};
};
} | {}, {
base: string;
selectorButton: string;
selectorIcon: string;
popoverContent: string;
calendar: string;
calendarContent: string;
timeInputLabel: string;
timeInput: string;
}, tailwind_variants.TVReturnType<unknown, {
base: string;
selectorButton: string;
selectorIcon: string;
popoverContent: string;
calendar: string;
calendarContent: string;
timeInputLabel: string;
timeInput: string;
}, undefined, tailwind_variants_dist_config.TVConfig<unknown, {
[key: string]: {
[key: string]: tailwind_variants.ClassValue | {
base?: tailwind_variants.ClassValue;
selectorIcon?: tailwind_variants.ClassValue;
popoverContent?: tailwind_variants.ClassValue;
selectorButton?: tailwind_variants.ClassValue;
calendar?: tailwind_variants.ClassValue;
calendarContent?: tailwind_variants.ClassValue;
timeInputLabel?: tailwind_variants.ClassValue;
timeInput?: tailwind_variants.ClassValue;
};
};
} | {}>, unknown, unknown, undefined>>;
declare const dateRangePicker: tailwind_variants.TVReturnType<{
[key: string]: {
[key: string]: tailwind_variants.ClassValue | {
separator?: tailwind_variants.ClassValue;
calendar?: tailwind_variants.ClassValue;
bottomContent?: tailwind_variants.ClassValue;
timeInputWrapper?: tailwind_variants.ClassValue;
};
};
} | {
[x: string]: {
[x: string]: tailwind_variants.ClassValue | {
separator?: tailwind_variants.ClassValue;
calendar?: tailwind_variants.ClassValue;
bottomContent?: tailwind_variants.ClassValue;
timeInputWrapper?: tailwind_variants.ClassValue;
};
};
} | {
[x: string]: {
[x: string]: tailwind_variants.ClassValue | {
separator?: tailwind_variants.ClassValue;
calendar?: tailwind_variants.ClassValue;
bottomContent?: tailwind_variants.ClassValue;
timeInputWrapper?: tailwind_variants.ClassValue;
};
};
} | {}, {
calendar: string;
bottomContent: string;
timeInputWrapper: string;
separator: string;
}, undefined, tailwind_variants_dist_config.TVConfig<{
[key: string]: {
[key: string]: tailwind_variants.ClassValue | {
separator?: tailwind_variants.ClassValue;
calendar?: tailwind_variants.ClassValue;
bottomContent?: tailwind_variants.ClassValue;
timeInputWrapper?: tailwind_variants.ClassValue;
};
};
} | {
[x: string]: {
[x: string]: tailwind_variants.ClassValue | {
separator?: tailwind_variants.ClassValue;
calendar?: tailwind_variants.ClassValue;
bottomContent?: tailwind_variants.ClassValue;
timeInputWrapper?: tailwind_variants.ClassValue;
};
};
} | {
[x: string]: {
[x: string]: tailwind_variants.ClassValue | {
separator?: tailwind_variants.ClassValue;
calendar?: tailwind_variants.ClassValue;
bottomContent?: tailwind_variants.ClassValue;
timeInputWrapper?: tailwind_variants.ClassValue;
};
};
} | {}, {
[key: string]: {
[key: string]: tailwind_variants.ClassValue | {
base?: tailwind_variants.ClassValue;
selectorIcon?: tailwind_variants.ClassValue;
popoverContent?: tailwind_variants.ClassValue;
selectorButton?: tailwind_variants.ClassValue;
calendar?: tailwind_variants.ClassValue;
calendarContent?: tailwind_variants.ClassValue;
timeInputLabel?: tailwind_variants.ClassValue;
timeInput?: tailwind_variants.ClassValue;
};
};
} | {
[x: string]: {
[x: string]: tailwind_variants.ClassValue | {
base?: tailwind_variants.ClassValue;
selectorIcon?: tailwind_variants.ClassValue;
popoverContent?: tailwind_variants.ClassValue;
selectorButton?: tailwind_variants.ClassValue;
calendar?: tailwind_variants.ClassValue;
calendarContent?: tailwind_variants.ClassValue;
timeInputLabel?: tailwind_variants.ClassValue;
timeInput?: tailwind_variants.ClassValue;
};
};
} | {}>, {
[key: string]: {
[key: string]: tailwind_variants.ClassValue | {
base?: tailwind_variants.ClassValue;
selectorIcon?: tailwind_variants.ClassValue;
popoverContent?: tailwind_variants.ClassValue;
selectorButton?: tailwind_variants.ClassValue;
calendar?: tailwind_variants.ClassValue;
calendarContent?: tailwind_variants.ClassValue;
timeInputLabel?: tailwind_variants.ClassValue;
timeInput?: tailwind_variants.ClassValue;
};
};
} | {
[x: string]: {
[x: string]: tailwind_variants.ClassValue | {
base?: tailwind_variants.ClassValue;
selectorIcon?: tailwind_variants.ClassValue;
popoverContent?: tailwind_variants.ClassValue;
selectorButton?: tailwind_variants.ClassValue;
calendar?: tailwind_variants.ClassValue;
calendarContent?: tailwind_variants.ClassValue;
timeInputLabel?: tailwind_variants.ClassValue;
timeInput?: tailwind_variants.ClassValue;
};
};
} | {}, {
base: string;
selectorButton: string;
selectorIcon: string;
popoverContent: string;
calendar: string;
calendarContent: string;
timeInputLabel: string;
timeInput: string;
}, tailwind_variants.TVReturnType<{
[key: string]: {
[key: string]: tailwind_variants.ClassValue | {
base?: tailwind_variants.ClassValue;
selectorIcon?: tailwind_variants.ClassValue;
popoverContent?: tailwind_variants.ClassValue;
selectorButton?: tailwind_variants.ClassValue;
calendar?: tailwind_variants.ClassValue;
calendarContent?: tailwind_variants.ClassValue;
timeInputLabel?: tailwind_variants.ClassValue;
timeInput?: tailwind_variants.ClassValue;
};
};
} | {
[x: string]: {
[x: string]: tailwind_variants.ClassValue | {
base?: tailwind_variants.ClassValue;
selectorIcon?: tailwind_variants.ClassValue;
popoverContent?: tailwind_variants.ClassValue;
selectorButton?: tailwind_variants.ClassValue;
calendar?: tailwind_variants.ClassValue;
calendarContent?: tailwind_variants.ClassValue;
timeInputLabel?: tailwind_variants.ClassValue;
timeInput?: tailwind_variants.ClassValue;
};
};
} | {}, {
base: string;
selectorButton: string;
selectorIcon: string;
popoverContent: string;
calendar: string;
calendarContent: string;
timeInputLabel: string;
timeInput: string;
}, undefined, tailwind_variants_dist_config.TVConfig<unknown, {
[key: string]: {
[key: string]: tailwind_variants.ClassValue | {
base?: tailwind_variants.ClassValue;
selectorIcon?: tailwind_variants.ClassValue;
popoverContent?: tailwind_variants.ClassValue;
selectorButton?: tailwind_variants.ClassValue;
calendar?: tailwind_variants.ClassValue;
calendarContent?: tailwind_variants.ClassValue;
timeInputLabel?: tailwind_variants.ClassValue;
timeInput?: tailwind_variants.ClassValue;
};
};
} | {}>, {
[key: string]: {
[key: string]: tailwind_variants.ClassValue | {
base?: tailwind_variants.ClassValue;
selectorIcon?: tailwind_variants.ClassValue;
popoverContent?: tailwind_variants.ClassValue;
selectorButton?: tailwind_variants.ClassValue;
calendar?: tailwind_variants.ClassValue;
calendarContent?: tailwind_variants.ClassValue;
timeInputLabel?: tailwind_variants.ClassValue;
timeInput?: tailwind_variants.ClassValue;
};
};
} | {}, {
base: string;
selectorButton: string;
selectorIcon: string;
popoverContent: string;
calendar: string;
calendarContent: string;
timeInputLabel: string;
timeInput: string;
}, tailwind_variants.TVReturnType<unknown, {
base: string;
selectorButton: string;
selectorIcon: string;
popoverContent: string;
calendar: string;
calendarContent: string;
timeInputLabel: string;
timeInput: string;
}, undefined, tailwind_variants_dist_config.TVConfig<unknown, {
[key: string]: {
[key: string]: tailwind_variants.ClassValue | {
base?: tailwind_variants.ClassValue;
selectorIcon?: tailwind_variants.ClassValue;
popoverContent?: tailwind_variants.ClassValue;
selectorButton?: tailwind_variants.ClassValue;
calendar?: tailwind_variants.ClassValue;
calendarContent?: tailwind_variants.ClassValue;
timeInputLabel?: tailwind_variants.ClassValue;
timeInput?: tailwind_variants.ClassValue;
};
};
} | {}>, unknown, unknown, undefined>>>;
/** Base */
type DatePickerReturnType = ReturnType<typeof datePicker>;
type DatePickerVariantProps = VariantProps<typeof datePicker>;
type DatePickerSlots = keyof ReturnType<typeof datePicker>;
/** Range */
type DateRangePickerReturnType = ReturnType<typeof dateRangePicker>;
type DateRangePickerVariantProps = VariantProps<typeof dateRangePicker>;
type DateRangePickerSlots = keyof ReturnType<typeof dateRangePicker>;
export { DatePickerReturnType, DatePickerSlots, DatePickerVariantProps, DateRangePickerReturnType, DateRangePickerSlots, DateRangePickerVariantProps, datePicker, dateRangePicker };
@@ -0,0 +1 @@
{"mappings":";;AAAA;;;;;;;;;;CAUC;AAOM,MAAM,4CAAkB,OAAO,aAAa,cAC/C,CAAA,GAAA,YAAI,EAAE,eAAe,GACrB,KAAO","sources":["packages/@react-aria/utils/src/useLayoutEffect.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport React from 'react';\n\n// During SSR, React emits a warning when calling useLayoutEffect.\n// Since neither useLayoutEffect nor useEffect run on the server,\n// we can suppress this by replace it with a noop on the server.\nexport const useLayoutEffect = typeof document !== 'undefined'\n ? React.useLayoutEffect\n : () => {};\n"],"names":[],"version":3,"file":"useLayoutEffect.module.js.map"}
@@ -0,0 +1 @@
module.exports={A:{A:{"1":"D E F A B","16":"K wC"},B:{"1":"0 1 2 3 4 5 C L M G N O P Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I"},C:{"16":"xC TC 0C 1C","129":"0 1 2 3 4 5 6 7 8 9 J ZB K D E F A B C L M G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC yC zC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC","16":"J ZB K D E F A B C L M"},E:{"16":"J ZB 2C ZC","257":"K D E F A B C L M G 3C 4C 5C 6C aC NC OC 7C 8C 9C bC cC PC AD QC dC eC fC gC hC BD RC iC jC kC lC mC CD SC nC oC pC qC rC sC tC DD ED"},F:{"1":"0 1 2 3 4 5 6 7 8 9 B C G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z FD GD HD ID NC uC JD OC","16":"F"},G:{"769":"E ZC KD vC LD MD ND OD PD QD RD SD TD UD VD WD XD YD ZD aD bD cD dD bC cC PC eD QC dC eC fC gC hC fD RC iC jC kC lC mC gD SC nC oC pC qC rC sC tC"},H:{"16":"hD"},I:{"16":"TC J I iD jD kD lD vC mD nD"},J:{"16":"D A"},K:{"1":"H","16":"A B C NC uC OC"},L:{"1":"I"},M:{"1":"MC"},N:{"16":"A B"},O:{"1":"PC"},P:{"16":"6 7 8 9 J AB BB CB DB EB FB oD pD qD rD sD aC tD uD vD wD xD QC RC SC yD"},Q:{"1":"zD"},R:{"1":"0D"},S:{"129":"1D 2D"}},B:1,C:"tabindex global attribute",D:true};
@@ -0,0 +1,45 @@
{
"name": "screenfull",
"version": "5.2.0",
"description": "Simple wrapper for cross-browser usage of the JavaScript Fullscreen API, which lets you bring the page or any element into fullscreen.",
"license": "MIT",
"repository": "sindresorhus/screenfull.js",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"main": "dist/screenfull.js",
"engines": {
"node": ">=0.10.0"
},
"scripts": {
"pretest": "grunt",
"test": "xo && tsd"
},
"files": [
"dist/screenfull.js",
"dist/screenfull.d.ts"
],
"keywords": [
"browser",
"fullscreen"
],
"devDependencies": {
"grunt": "^1.0.4",
"grunt-contrib-concat": "^1.0.1",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-uglify": "^4.0.1",
"load-grunt-tasks": "^4.0.0",
"tsd": "^0.7.1",
"xo": "^0.16.0"
},
"types": "dist/screenfull.d.ts",
"xo": {
"envs": [
"node",
"browser"
]
}
}
@@ -0,0 +1,147 @@
# finalhandler
[![NPM Version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]
[![Node.js Version][node-image]][node-url]
[![Build Status][github-actions-ci-image]][github-actions-ci-url]
[![Test Coverage][coveralls-image]][coveralls-url]
Node.js function to invoke as the final step to respond to HTTP request.
## Installation
This is a [Node.js](https://nodejs.org/en/) module available through the
[npm registry](https://www.npmjs.com/). Installation is done using the
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):
```sh
$ npm install finalhandler
```
## API
```js
var finalhandler = require('finalhandler')
```
### finalhandler(req, res, [options])
Returns function to be invoked as the final step for the given `req` and `res`.
This function is to be invoked as `fn(err)`. If `err` is falsy, the handler will
write out a 404 response to the `res`. If it is truthy, an error response will
be written out to the `res` or `res` will be terminated if a response has already
started.
When an error is written, the following information is added to the response:
* The `res.statusCode` is set from `err.status` (or `err.statusCode`). If
this value is outside the 4xx or 5xx range, it will be set to 500.
* The `res.statusMessage` is set according to the status code.
* The body will be the HTML of the status code message if `env` is
`'production'`, otherwise will be `err.stack`.
* Any headers specified in an `err.headers` object.
The final handler will also unpipe anything from `req` when it is invoked.
#### options.env
By default, the environment is determined by `NODE_ENV` variable, but it can be
overridden by this option.
#### options.onerror
Provide a function to be called with the `err` when it exists. Can be used for
writing errors to a central location without excessive function generation. Called
as `onerror(err, req, res)`.
## Examples
### always 404
```js
var finalhandler = require('finalhandler')
var http = require('http')
var server = http.createServer(function (req, res) {
var done = finalhandler(req, res)
done()
})
server.listen(3000)
```
### perform simple action
```js
var finalhandler = require('finalhandler')
var fs = require('fs')
var http = require('http')
var server = http.createServer(function (req, res) {
var done = finalhandler(req, res)
fs.readFile('index.html', function (err, buf) {
if (err) return done(err)
res.setHeader('Content-Type', 'text/html')
res.end(buf)
})
})
server.listen(3000)
```
### use with middleware-style functions
```js
var finalhandler = require('finalhandler')
var http = require('http')
var serveStatic = require('serve-static')
var serve = serveStatic('public')
var server = http.createServer(function (req, res) {
var done = finalhandler(req, res)
serve(req, res, done)
})
server.listen(3000)
```
### keep log of all errors
```js
var finalhandler = require('finalhandler')
var fs = require('fs')
var http = require('http')
var server = http.createServer(function (req, res) {
var done = finalhandler(req, res, { onerror: logerror })
fs.readFile('index.html', function (err, buf) {
if (err) return done(err)
res.setHeader('Content-Type', 'text/html')
res.end(buf)
})
})
server.listen(3000)
function logerror (err) {
console.error(err.stack || err.toString())
}
```
## License
[MIT](LICENSE)
[npm-image]: https://img.shields.io/npm/v/finalhandler.svg
[npm-url]: https://npmjs.org/package/finalhandler
[node-image]: https://img.shields.io/node/v/finalhandler.svg
[node-url]: https://nodejs.org/en/download
[coveralls-image]: https://img.shields.io/coveralls/pillarjs/finalhandler.svg
[coveralls-url]: https://coveralls.io/r/pillarjs/finalhandler?branch=master
[downloads-image]: https://img.shields.io/npm/dm/finalhandler.svg
[downloads-url]: https://npmjs.org/package/finalhandler
[github-actions-ci-image]: https://github.com/pillarjs/finalhandler/actions/workflows/ci.yml/badge.svg
[github-actions-ci-url]: https://github.com/pillarjs/finalhandler/actions/workflows/ci.yml
@@ -0,0 +1,546 @@
'use strict'
const { Minipass } = require('minipass')
const Pax = require('./pax.js')
const Header = require('./header.js')
const fs = require('fs')
const path = require('path')
const normPath = require('./normalize-windows-path.js')
const stripSlash = require('./strip-trailing-slashes.js')
const prefixPath = (path, prefix) => {
if (!prefix) {
return normPath(path)
}
path = normPath(path).replace(/^\.(\/|$)/, '')
return stripSlash(prefix) + '/' + path
}
const maxReadSize = 16 * 1024 * 1024
const PROCESS = Symbol('process')
const FILE = Symbol('file')
const DIRECTORY = Symbol('directory')
const SYMLINK = Symbol('symlink')
const HARDLINK = Symbol('hardlink')
const HEADER = Symbol('header')
const READ = Symbol('read')
const LSTAT = Symbol('lstat')
const ONLSTAT = Symbol('onlstat')
const ONREAD = Symbol('onread')
const ONREADLINK = Symbol('onreadlink')
const OPENFILE = Symbol('openfile')
const ONOPENFILE = Symbol('onopenfile')
const CLOSE = Symbol('close')
const MODE = Symbol('mode')
const AWAITDRAIN = Symbol('awaitDrain')
const ONDRAIN = Symbol('ondrain')
const PREFIX = Symbol('prefix')
const HAD_ERROR = Symbol('hadError')
const warner = require('./warn-mixin.js')
const winchars = require('./winchars.js')
const stripAbsolutePath = require('./strip-absolute-path.js')
const modeFix = require('./mode-fix.js')
const WriteEntry = warner(class WriteEntry extends Minipass {
constructor (p, opt) {
opt = opt || {}
super(opt)
if (typeof p !== 'string') {
throw new TypeError('path is required')
}
this.path = normPath(p)
// suppress atime, ctime, uid, gid, uname, gname
this.portable = !!opt.portable
// until node has builtin pwnam functions, this'll have to do
this.myuid = process.getuid && process.getuid() || 0
this.myuser = process.env.USER || ''
this.maxReadSize = opt.maxReadSize || maxReadSize
this.linkCache = opt.linkCache || new Map()
this.statCache = opt.statCache || new Map()
this.preservePaths = !!opt.preservePaths
this.cwd = normPath(opt.cwd || process.cwd())
this.strict = !!opt.strict
this.noPax = !!opt.noPax
this.noMtime = !!opt.noMtime
this.mtime = opt.mtime || null
this.prefix = opt.prefix ? normPath(opt.prefix) : null
this.fd = null
this.blockLen = null
this.blockRemain = null
this.buf = null
this.offset = null
this.length = null
this.pos = null
this.remain = null
if (typeof opt.onwarn === 'function') {
this.on('warn', opt.onwarn)
}
let pathWarn = false
if (!this.preservePaths) {
const [root, stripped] = stripAbsolutePath(this.path)
if (root) {
this.path = stripped
pathWarn = root
}
}
this.win32 = !!opt.win32 || process.platform === 'win32'
if (this.win32) {
// force the \ to / normalization, since we might not *actually*
// be on windows, but want \ to be considered a path separator.
this.path = winchars.decode(this.path.replace(/\\/g, '/'))
p = p.replace(/\\/g, '/')
}
this.absolute = normPath(opt.absolute || path.resolve(this.cwd, p))
if (this.path === '') {
this.path = './'
}
if (pathWarn) {
this.warn('TAR_ENTRY_INFO', `stripping ${pathWarn} from absolute path`, {
entry: this,
path: pathWarn + this.path,
})
}
if (this.statCache.has(this.absolute)) {
this[ONLSTAT](this.statCache.get(this.absolute))
} else {
this[LSTAT]()
}
}
emit (ev, ...data) {
if (ev === 'error') {
this[HAD_ERROR] = true
}
return super.emit(ev, ...data)
}
[LSTAT] () {
fs.lstat(this.absolute, (er, stat) => {
if (er) {
return this.emit('error', er)
}
this[ONLSTAT](stat)
})
}
[ONLSTAT] (stat) {
this.statCache.set(this.absolute, stat)
this.stat = stat
if (!stat.isFile()) {
stat.size = 0
}
this.type = getType(stat)
this.emit('stat', stat)
this[PROCESS]()
}
[PROCESS] () {
switch (this.type) {
case 'File': return this[FILE]()
case 'Directory': return this[DIRECTORY]()
case 'SymbolicLink': return this[SYMLINK]()
// unsupported types are ignored.
default: return this.end()
}
}
[MODE] (mode) {
return modeFix(mode, this.type === 'Directory', this.portable)
}
[PREFIX] (path) {
return prefixPath(path, this.prefix)
}
[HEADER] () {
if (this.type === 'Directory' && this.portable) {
this.noMtime = true
}
this.header = new Header({
path: this[PREFIX](this.path),
// only apply the prefix to hard links.
linkpath: this.type === 'Link' ? this[PREFIX](this.linkpath)
: this.linkpath,
// only the permissions and setuid/setgid/sticky bitflags
// not the higher-order bits that specify file type
mode: this[MODE](this.stat.mode),
uid: this.portable ? null : this.stat.uid,
gid: this.portable ? null : this.stat.gid,
size: this.stat.size,
mtime: this.noMtime ? null : this.mtime || this.stat.mtime,
type: this.type,
uname: this.portable ? null :
this.stat.uid === this.myuid ? this.myuser : '',
atime: this.portable ? null : this.stat.atime,
ctime: this.portable ? null : this.stat.ctime,
})
if (this.header.encode() && !this.noPax) {
super.write(new Pax({
atime: this.portable ? null : this.header.atime,
ctime: this.portable ? null : this.header.ctime,
gid: this.portable ? null : this.header.gid,
mtime: this.noMtime ? null : this.mtime || this.header.mtime,
path: this[PREFIX](this.path),
linkpath: this.type === 'Link' ? this[PREFIX](this.linkpath)
: this.linkpath,
size: this.header.size,
uid: this.portable ? null : this.header.uid,
uname: this.portable ? null : this.header.uname,
dev: this.portable ? null : this.stat.dev,
ino: this.portable ? null : this.stat.ino,
nlink: this.portable ? null : this.stat.nlink,
}).encode())
}
super.write(this.header.block)
}
[DIRECTORY] () {
if (this.path.slice(-1) !== '/') {
this.path += '/'
}
this.stat.size = 0
this[HEADER]()
this.end()
}
[SYMLINK] () {
fs.readlink(this.absolute, (er, linkpath) => {
if (er) {
return this.emit('error', er)
}
this[ONREADLINK](linkpath)
})
}
[ONREADLINK] (linkpath) {
this.linkpath = normPath(linkpath)
this[HEADER]()
this.end()
}
[HARDLINK] (linkpath) {
this.type = 'Link'
this.linkpath = normPath(path.relative(this.cwd, linkpath))
this.stat.size = 0
this[HEADER]()
this.end()
}
[FILE] () {
if (this.stat.nlink > 1) {
const linkKey = this.stat.dev + ':' + this.stat.ino
if (this.linkCache.has(linkKey)) {
const linkpath = this.linkCache.get(linkKey)
if (linkpath.indexOf(this.cwd) === 0) {
return this[HARDLINK](linkpath)
}
}
this.linkCache.set(linkKey, this.absolute)
}
this[HEADER]()
if (this.stat.size === 0) {
return this.end()
}
this[OPENFILE]()
}
[OPENFILE] () {
fs.open(this.absolute, 'r', (er, fd) => {
if (er) {
return this.emit('error', er)
}
this[ONOPENFILE](fd)
})
}
[ONOPENFILE] (fd) {
this.fd = fd
if (this[HAD_ERROR]) {
return this[CLOSE]()
}
this.blockLen = 512 * Math.ceil(this.stat.size / 512)
this.blockRemain = this.blockLen
const bufLen = Math.min(this.blockLen, this.maxReadSize)
this.buf = Buffer.allocUnsafe(bufLen)
this.offset = 0
this.pos = 0
this.remain = this.stat.size
this.length = this.buf.length
this[READ]()
}
[READ] () {
const { fd, buf, offset, length, pos } = this
fs.read(fd, buf, offset, length, pos, (er, bytesRead) => {
if (er) {
// ignoring the error from close(2) is a bad practice, but at
// this point we already have an error, don't need another one
return this[CLOSE](() => this.emit('error', er))
}
this[ONREAD](bytesRead)
})
}
[CLOSE] (cb) {
fs.close(this.fd, cb)
}
[ONREAD] (bytesRead) {
if (bytesRead <= 0 && this.remain > 0) {
const er = new Error('encountered unexpected EOF')
er.path = this.absolute
er.syscall = 'read'
er.code = 'EOF'
return this[CLOSE](() => this.emit('error', er))
}
if (bytesRead > this.remain) {
const er = new Error('did not encounter expected EOF')
er.path = this.absolute
er.syscall = 'read'
er.code = 'EOF'
return this[CLOSE](() => this.emit('error', er))
}
// null out the rest of the buffer, if we could fit the block padding
// at the end of this loop, we've incremented bytesRead and this.remain
// to be incremented up to the blockRemain level, as if we had expected
// to get a null-padded file, and read it until the end. then we will
// decrement both remain and blockRemain by bytesRead, and know that we
// reached the expected EOF, without any null buffer to append.
if (bytesRead === this.remain) {
for (let i = bytesRead; i < this.length && bytesRead < this.blockRemain; i++) {
this.buf[i + this.offset] = 0
bytesRead++
this.remain++
}
}
const writeBuf = this.offset === 0 && bytesRead === this.buf.length ?
this.buf : this.buf.slice(this.offset, this.offset + bytesRead)
const flushed = this.write(writeBuf)
if (!flushed) {
this[AWAITDRAIN](() => this[ONDRAIN]())
} else {
this[ONDRAIN]()
}
}
[AWAITDRAIN] (cb) {
this.once('drain', cb)
}
write (writeBuf) {
if (this.blockRemain < writeBuf.length) {
const er = new Error('writing more data than expected')
er.path = this.absolute
return this.emit('error', er)
}
this.remain -= writeBuf.length
this.blockRemain -= writeBuf.length
this.pos += writeBuf.length
this.offset += writeBuf.length
return super.write(writeBuf)
}
[ONDRAIN] () {
if (!this.remain) {
if (this.blockRemain) {
super.write(Buffer.alloc(this.blockRemain))
}
return this[CLOSE](er => er ? this.emit('error', er) : this.end())
}
if (this.offset >= this.length) {
// if we only have a smaller bit left to read, alloc a smaller buffer
// otherwise, keep it the same length it was before.
this.buf = Buffer.allocUnsafe(Math.min(this.blockRemain, this.buf.length))
this.offset = 0
}
this.length = this.buf.length - this.offset
this[READ]()
}
})
class WriteEntrySync extends WriteEntry {
[LSTAT] () {
this[ONLSTAT](fs.lstatSync(this.absolute))
}
[SYMLINK] () {
this[ONREADLINK](fs.readlinkSync(this.absolute))
}
[OPENFILE] () {
this[ONOPENFILE](fs.openSync(this.absolute, 'r'))
}
[READ] () {
let threw = true
try {
const { fd, buf, offset, length, pos } = this
const bytesRead = fs.readSync(fd, buf, offset, length, pos)
this[ONREAD](bytesRead)
threw = false
} finally {
// ignoring the error from close(2) is a bad practice, but at
// this point we already have an error, don't need another one
if (threw) {
try {
this[CLOSE](() => {})
} catch (er) {}
}
}
}
[AWAITDRAIN] (cb) {
cb()
}
[CLOSE] (cb) {
fs.closeSync(this.fd)
cb()
}
}
const WriteEntryTar = warner(class WriteEntryTar extends Minipass {
constructor (readEntry, opt) {
opt = opt || {}
super(opt)
this.preservePaths = !!opt.preservePaths
this.portable = !!opt.portable
this.strict = !!opt.strict
this.noPax = !!opt.noPax
this.noMtime = !!opt.noMtime
this.readEntry = readEntry
this.type = readEntry.type
if (this.type === 'Directory' && this.portable) {
this.noMtime = true
}
this.prefix = opt.prefix || null
this.path = normPath(readEntry.path)
this.mode = this[MODE](readEntry.mode)
this.uid = this.portable ? null : readEntry.uid
this.gid = this.portable ? null : readEntry.gid
this.uname = this.portable ? null : readEntry.uname
this.gname = this.portable ? null : readEntry.gname
this.size = readEntry.size
this.mtime = this.noMtime ? null : opt.mtime || readEntry.mtime
this.atime = this.portable ? null : readEntry.atime
this.ctime = this.portable ? null : readEntry.ctime
this.linkpath = normPath(readEntry.linkpath)
if (typeof opt.onwarn === 'function') {
this.on('warn', opt.onwarn)
}
let pathWarn = false
if (!this.preservePaths) {
const [root, stripped] = stripAbsolutePath(this.path)
if (root) {
this.path = stripped
pathWarn = root
}
}
this.remain = readEntry.size
this.blockRemain = readEntry.startBlockSize
this.header = new Header({
path: this[PREFIX](this.path),
linkpath: this.type === 'Link' ? this[PREFIX](this.linkpath)
: this.linkpath,
// only the permissions and setuid/setgid/sticky bitflags
// not the higher-order bits that specify file type
mode: this.mode,
uid: this.portable ? null : this.uid,
gid: this.portable ? null : this.gid,
size: this.size,
mtime: this.noMtime ? null : this.mtime,
type: this.type,
uname: this.portable ? null : this.uname,
atime: this.portable ? null : this.atime,
ctime: this.portable ? null : this.ctime,
})
if (pathWarn) {
this.warn('TAR_ENTRY_INFO', `stripping ${pathWarn} from absolute path`, {
entry: this,
path: pathWarn + this.path,
})
}
if (this.header.encode() && !this.noPax) {
super.write(new Pax({
atime: this.portable ? null : this.atime,
ctime: this.portable ? null : this.ctime,
gid: this.portable ? null : this.gid,
mtime: this.noMtime ? null : this.mtime,
path: this[PREFIX](this.path),
linkpath: this.type === 'Link' ? this[PREFIX](this.linkpath)
: this.linkpath,
size: this.size,
uid: this.portable ? null : this.uid,
uname: this.portable ? null : this.uname,
dev: this.portable ? null : this.readEntry.dev,
ino: this.portable ? null : this.readEntry.ino,
nlink: this.portable ? null : this.readEntry.nlink,
}).encode())
}
super.write(this.header.block)
readEntry.pipe(this)
}
[PREFIX] (path) {
return prefixPath(path, this.prefix)
}
[MODE] (mode) {
return modeFix(mode, this.type === 'Directory', this.portable)
}
write (data) {
const writeLen = data.length
if (writeLen > this.blockRemain) {
throw new Error('writing more to entry than is appropriate')
}
this.blockRemain -= writeLen
return super.write(data)
}
end () {
if (this.blockRemain) {
super.write(Buffer.alloc(this.blockRemain))
}
return super.end()
}
})
WriteEntry.Sync = WriteEntrySync
WriteEntry.Tar = WriteEntryTar
const getType = stat =>
stat.isFile() ? 'File'
: stat.isDirectory() ? 'Directory'
: stat.isSymbolicLink() ? 'SymbolicLink'
: 'Unsupported'
module.exports = WriteEntry
@@ -0,0 +1,233 @@
import { isDocument, isNode, isPair, isCollection, isMap, isSeq, isScalar, isAlias } from './nodes/identity.js';
const BREAK = Symbol('break visit');
const SKIP = Symbol('skip children');
const REMOVE = Symbol('remove node');
/**
* Apply a visitor to an AST node or document.
*
* Walks through the tree (depth-first) starting from `node`, calling a
* `visitor` function with three arguments:
* - `key`: For sequence values and map `Pair`, the node's index in the
* collection. Within a `Pair`, `'key'` or `'value'`, correspondingly.
* `null` for the root node.
* - `node`: The current node.
* - `path`: The ancestry of the current node.
*
* The return value of the visitor may be used to control the traversal:
* - `undefined` (default): Do nothing and continue
* - `visit.SKIP`: Do not visit the children of this node, continue with next
* sibling
* - `visit.BREAK`: Terminate traversal completely
* - `visit.REMOVE`: Remove the current node, then continue with the next one
* - `Node`: Replace the current node, then continue by visiting it
* - `number`: While iterating the items of a sequence or map, set the index
* of the next step. This is useful especially if the index of the current
* node has changed.
*
* If `visitor` is a single function, it will be called with all values
* encountered in the tree, including e.g. `null` values. Alternatively,
* separate visitor functions may be defined for each `Map`, `Pair`, `Seq`,
* `Alias` and `Scalar` node. To define the same visitor function for more than
* one node type, use the `Collection` (map and seq), `Value` (map, seq & scalar)
* and `Node` (alias, map, seq & scalar) targets. Of all these, only the most
* specific defined one will be used for each node.
*/
function visit(node, visitor) {
const visitor_ = initVisitor(visitor);
if (isDocument(node)) {
const cd = visit_(null, node.contents, visitor_, Object.freeze([node]));
if (cd === REMOVE)
node.contents = null;
}
else
visit_(null, node, visitor_, Object.freeze([]));
}
// Without the `as symbol` casts, TS declares these in the `visit`
// namespace using `var`, but then complains about that because
// `unique symbol` must be `const`.
/** Terminate visit traversal completely */
visit.BREAK = BREAK;
/** Do not visit the children of the current node */
visit.SKIP = SKIP;
/** Remove the current node */
visit.REMOVE = REMOVE;
function visit_(key, node, visitor, path) {
const ctrl = callVisitor(key, node, visitor, path);
if (isNode(ctrl) || isPair(ctrl)) {
replaceNode(key, path, ctrl);
return visit_(key, ctrl, visitor, path);
}
if (typeof ctrl !== 'symbol') {
if (isCollection(node)) {
path = Object.freeze(path.concat(node));
for (let i = 0; i < node.items.length; ++i) {
const ci = visit_(i, node.items[i], visitor, path);
if (typeof ci === 'number')
i = ci - 1;
else if (ci === BREAK)
return BREAK;
else if (ci === REMOVE) {
node.items.splice(i, 1);
i -= 1;
}
}
}
else if (isPair(node)) {
path = Object.freeze(path.concat(node));
const ck = visit_('key', node.key, visitor, path);
if (ck === BREAK)
return BREAK;
else if (ck === REMOVE)
node.key = null;
const cv = visit_('value', node.value, visitor, path);
if (cv === BREAK)
return BREAK;
else if (cv === REMOVE)
node.value = null;
}
}
return ctrl;
}
/**
* Apply an async visitor to an AST node or document.
*
* Walks through the tree (depth-first) starting from `node`, calling a
* `visitor` function with three arguments:
* - `key`: For sequence values and map `Pair`, the node's index in the
* collection. Within a `Pair`, `'key'` or `'value'`, correspondingly.
* `null` for the root node.
* - `node`: The current node.
* - `path`: The ancestry of the current node.
*
* The return value of the visitor may be used to control the traversal:
* - `Promise`: Must resolve to one of the following values
* - `undefined` (default): Do nothing and continue
* - `visit.SKIP`: Do not visit the children of this node, continue with next
* sibling
* - `visit.BREAK`: Terminate traversal completely
* - `visit.REMOVE`: Remove the current node, then continue with the next one
* - `Node`: Replace the current node, then continue by visiting it
* - `number`: While iterating the items of a sequence or map, set the index
* of the next step. This is useful especially if the index of the current
* node has changed.
*
* If `visitor` is a single function, it will be called with all values
* encountered in the tree, including e.g. `null` values. Alternatively,
* separate visitor functions may be defined for each `Map`, `Pair`, `Seq`,
* `Alias` and `Scalar` node. To define the same visitor function for more than
* one node type, use the `Collection` (map and seq), `Value` (map, seq & scalar)
* and `Node` (alias, map, seq & scalar) targets. Of all these, only the most
* specific defined one will be used for each node.
*/
async function visitAsync(node, visitor) {
const visitor_ = initVisitor(visitor);
if (isDocument(node)) {
const cd = await visitAsync_(null, node.contents, visitor_, Object.freeze([node]));
if (cd === REMOVE)
node.contents = null;
}
else
await visitAsync_(null, node, visitor_, Object.freeze([]));
}
// Without the `as symbol` casts, TS declares these in the `visit`
// namespace using `var`, but then complains about that because
// `unique symbol` must be `const`.
/** Terminate visit traversal completely */
visitAsync.BREAK = BREAK;
/** Do not visit the children of the current node */
visitAsync.SKIP = SKIP;
/** Remove the current node */
visitAsync.REMOVE = REMOVE;
async function visitAsync_(key, node, visitor, path) {
const ctrl = await callVisitor(key, node, visitor, path);
if (isNode(ctrl) || isPair(ctrl)) {
replaceNode(key, path, ctrl);
return visitAsync_(key, ctrl, visitor, path);
}
if (typeof ctrl !== 'symbol') {
if (isCollection(node)) {
path = Object.freeze(path.concat(node));
for (let i = 0; i < node.items.length; ++i) {
const ci = await visitAsync_(i, node.items[i], visitor, path);
if (typeof ci === 'number')
i = ci - 1;
else if (ci === BREAK)
return BREAK;
else if (ci === REMOVE) {
node.items.splice(i, 1);
i -= 1;
}
}
}
else if (isPair(node)) {
path = Object.freeze(path.concat(node));
const ck = await visitAsync_('key', node.key, visitor, path);
if (ck === BREAK)
return BREAK;
else if (ck === REMOVE)
node.key = null;
const cv = await visitAsync_('value', node.value, visitor, path);
if (cv === BREAK)
return BREAK;
else if (cv === REMOVE)
node.value = null;
}
}
return ctrl;
}
function initVisitor(visitor) {
if (typeof visitor === 'object' &&
(visitor.Collection || visitor.Node || visitor.Value)) {
return Object.assign({
Alias: visitor.Node,
Map: visitor.Node,
Scalar: visitor.Node,
Seq: visitor.Node
}, visitor.Value && {
Map: visitor.Value,
Scalar: visitor.Value,
Seq: visitor.Value
}, visitor.Collection && {
Map: visitor.Collection,
Seq: visitor.Collection
}, visitor);
}
return visitor;
}
function callVisitor(key, node, visitor, path) {
if (typeof visitor === 'function')
return visitor(key, node, path);
if (isMap(node))
return visitor.Map?.(key, node, path);
if (isSeq(node))
return visitor.Seq?.(key, node, path);
if (isPair(node))
return visitor.Pair?.(key, node, path);
if (isScalar(node))
return visitor.Scalar?.(key, node, path);
if (isAlias(node))
return visitor.Alias?.(key, node, path);
return undefined;
}
function replaceNode(key, path, node) {
const parent = path[path.length - 1];
if (isCollection(parent)) {
parent.items[key] = node;
}
else if (isPair(parent)) {
if (key === 'key')
parent.key = node;
else
parent.value = node;
}
else if (isDocument(parent)) {
parent.contents = node;
}
else {
const pt = isAlias(parent) ? 'alias' : 'scalar';
throw new Error(`Cannot replace node with ${pt} parent`);
}
}
export { visit, visitAsync };
@@ -0,0 +1,21 @@
{
"name": "@react-types/listbox",
"version": "3.7.4",
"description": "Spectrum UI components in React",
"license": "Apache-2.0",
"types": "src/index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/adobe/react-spectrum"
},
"dependencies": {
"@react-types/shared": "^3.32.1"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
},
"publishConfig": {
"access": "public"
},
"gitHead": "0bda51183baa23306342af32a82012ea0fe0f2dc"
}
@@ -0,0 +1 @@
{"version":3,"file":"no-invalid-html-attribute.d.ts","sourceRoot":"","sources":["no-invalid-html-attribute.js"],"names":[],"mappings":"wBA+kBW,OAAO,QAAQ,EAAE,IAAI,CAAC,UAAU"}
@@ -0,0 +1,25 @@
{
"name": "process-nextick-args",
"version": "2.0.1",
"description": "process.nextTick but always with args",
"main": "index.js",
"files": [
"index.js"
],
"scripts": {
"test": "node test.js"
},
"repository": {
"type": "git",
"url": "https://github.com/calvinmetcalf/process-nextick-args.git"
},
"author": "",
"license": "MIT",
"bugs": {
"url": "https://github.com/calvinmetcalf/process-nextick-args/issues"
},
"homepage": "https://github.com/calvinmetcalf/process-nextick-args",
"devDependencies": {
"tap": "~0.2.6"
}
}
@@ -0,0 +1,15 @@
import { color } from '../color/index.mjs';
import { complex } from '../complex/index.mjs';
import { dimensionValueTypes } from '../dimensions.mjs';
import { testValueType } from '../test.mjs';
/**
* A list of all ValueTypes
*/
const valueTypes = [...dimensionValueTypes, color, complex];
/**
* Tests a value against the list of ValueTypes
*/
const findValueType = (v) => valueTypes.find(testValueType(v));
export { findValueType };
@@ -0,0 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.loadConfig = exports.register = exports.matchFromAbsolutePathsAsync = exports.createMatchPathAsync = exports.matchFromAbsolutePaths = exports.createMatchPath = void 0;
// register is used from register.js in root dir
var match_path_sync_1 = require("./match-path-sync");
Object.defineProperty(exports, "createMatchPath", { enumerable: true, get: function () { return match_path_sync_1.createMatchPath; } });
Object.defineProperty(exports, "matchFromAbsolutePaths", { enumerable: true, get: function () { return match_path_sync_1.matchFromAbsolutePaths; } });
var match_path_async_1 = require("./match-path-async");
Object.defineProperty(exports, "createMatchPathAsync", { enumerable: true, get: function () { return match_path_async_1.createMatchPathAsync; } });
Object.defineProperty(exports, "matchFromAbsolutePathsAsync", { enumerable: true, get: function () { return match_path_async_1.matchFromAbsolutePathsAsync; } });
var register_1 = require("./register");
Object.defineProperty(exports, "register", { enumerable: true, get: function () { return register_1.register; } });
var config_loader_1 = require("./config-loader");
Object.defineProperty(exports, "loadConfig", { enumerable: true, get: function () { return config_loader_1.loadConfig; } });
//# sourceMappingURL=index.js.map
@@ -0,0 +1,81 @@
import { createRule } from '../utils/index.js';
export default createRule({
name: 'prefer-namespace-import',
meta: {
type: 'problem',
docs: {
category: 'Style guide',
description: 'Enforce using namespace imports for specific modules, like `react`/`react-dom`, etc.',
},
fixable: 'code',
schema: [
{
type: 'object',
additionalProperties: false,
properties: {
patterns: {
type: 'array',
items: {
type: 'string',
},
uniqueItems: true,
},
},
},
],
messages: {
preferNamespaceImport: 'Prefer importing {{specifier}} as \'import * as {{specifier}} from "{{source}}"\';',
},
},
defaultOptions: [],
create(context) {
const { patterns } = context.options[0] ?? {};
if (!patterns?.length) {
return {};
}
const regexps = patterns.map(toRegExp);
return {
ImportDefaultSpecifier(node) {
const importSource = node.parent.source.value;
if (!regexps.some(exp => exp.test(importSource))) {
return;
}
const defaultSpecifier = node.local.name;
const hasOtherSpecifiers = node.parent.specifiers.length > 1;
context.report({
messageId: 'preferNamespaceImport',
node: hasOtherSpecifiers ? node : node.parent,
data: {
source: importSource,
specifier: defaultSpecifier,
},
fix(fixer) {
const importDeclarationText = context.sourceCode.getText(node.parent);
const localName = node.local.name;
if (!hasOtherSpecifiers) {
return fixer.replaceText(node, `* as ${localName}`);
}
const isTypeImport = node.parent.importKind === 'type';
const importStringPrefix = `import${isTypeImport ? ' type' : ''}`;
const rightBraceIndex = importDeclarationText.indexOf('}') + 1;
const specifiers = importDeclarationText.slice(importDeclarationText.indexOf('{'), rightBraceIndex);
const remainingText = importDeclarationText.slice(rightBraceIndex);
return fixer.replaceText(node.parent, [
`${importStringPrefix} * as ${localName} ${remainingText.trimStart()}`,
`${importStringPrefix} ${specifiers}${remainingText}`,
].join('\n'));
},
});
},
};
},
});
const REGEXP_STR = /^\/(.+)\/([A-Za-z]*)$/u;
function toRegExp(string) {
const [, pattern, flags = 'u'] = REGEXP_STR.exec(string) ?? [];
if (pattern != null) {
return new RegExp(pattern, flags);
}
return { test: s => s === string };
}
//# sourceMappingURL=prefer-namespace-import.js.map
@@ -0,0 +1 @@
{"version":3,"file":"InstanceBindingNode.d.ts","sourceRoot":"","sources":["../../../../src/planning/models/InstanceBindingNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,WAAW,mBAAmB,CAElC,QAAQ,SAAS,eAAe,CAAC,GAAG,CAAC,GAAG,eAAe,CAAC,GAAG,CAAC,CAC5D,SAAQ,eAAe,CAAC,QAAQ,CAAC;IACjC,QAAQ,CAAC,aAAa,EAAE,aAAa,CAAC;IACtC,QAAQ,CAAC,iBAAiB,EAAE,CAAC,eAAe,GAAG,SAAS,CAAC,EAAE,CAAC;IAC5D,QAAQ,CAAC,cAAc,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,EAAE,eAAe,CAAC,CAAC;CAChE"}
@@ -0,0 +1,44 @@
/**
* @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 `Promise` class.",
category: "ES2015",
recommended: false,
url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-promise.html",
},
fixable: null,
messages: {
forbidden: "ES2015 '{{name}}' class 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({
Promise: { [READ]: true },
})) {
context.report({
node,
messageId: "forbidden",
data: { name: path.join(".") },
})
}
},
}
},
}
@@ -0,0 +1,3 @@
import { ResolutionParams } from '../../resolution/models/ResolutionParams';
export declare function handleResolveError(params: ResolutionParams, error: unknown): never;
//# sourceMappingURL=handleResolveError.d.ts.map
@@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = getImplicitRoleForTfoot;
/**
* Returns the implicit role for a tfoot tag.
*/
function getImplicitRoleForTfoot() {
return 'rowgroup';
}
module.exports = exports.default;
Loaded 100 of 35554 files, more files were not shown because too many files have changed in this diff. Show more