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,8 @@
var $52b96f86422025af$exports = {};
$52b96f86422025af$exports = {
"dismiss": `\u{BB34}\u{C2DC}`
};
export {$52b96f86422025af$exports as default};
//# sourceMappingURL=ko-KR.module.js.map
@@ -0,0 +1,44 @@
# slash [![Build Status](https://travis-ci.org/sindresorhus/slash.svg?branch=master)](https://travis-ci.org/sindresorhus/slash)
> Convert Windows backslash paths to slash paths: `foo\\bar` ➔ `foo/bar`
[Forward-slash paths can be used in Windows](http://superuser.com/a/176395/6877) as long as they're not extended-length paths and don't contain any non-ascii characters.
This was created since the `path` methods in Node.js outputs `\\` paths on Windows.
## Install
```
$ npm install slash
```
## Usage
```js
const path = require('path');
const slash = require('slash');
const string = path.join('foo', 'bar');
// Unix => foo/bar
// Windows => foo\\bar
slash(string);
// Unix => foo/bar
// Windows => foo/bar
```
## API
### slash(path)
Type: `string`
Accepts a Windows backslash path and returns a path with forward slashes.
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)
@@ -0,0 +1,45 @@
/**
* @typedef {import('mdast').Html} Html
* @typedef {import('mdast').PhrasingContent} PhrasingContent
*/
import {convert} from 'unist-util-is'
/**
* Check if the given value is *phrasing content*.
*
* > 👉 **Note**: Excludes `html`, which can be both phrasing or flow.
*
* @param node
* Thing to check, typically `Node`.
* @returns
* Whether `value` is phrasing content.
*/
export const phrasing =
/** @type {(node?: unknown) => node is Exclude<PhrasingContent, Html>} */
(
convert([
'break',
'delete',
'emphasis',
// To do: next major: removed since footnotes were added to GFM.
'footnote',
'footnoteReference',
'image',
'imageReference',
'inlineCode',
// Enabled by `mdast-util-math`:
'inlineMath',
'link',
'linkReference',
// Enabled by `mdast-util-mdx`:
'mdxJsxTextElement',
// Enabled by `mdast-util-mdx`:
'mdxTextExpression',
'strong',
'text',
// Enabled by `mdast-util-directive`:
'textDirective'
])
)
@@ -0,0 +1,733 @@
import XHTMLEntities from "../parser/plugins/jsx/xhtml";
import {JSXRole} from "../parser/tokenizer";
import {TokenType as tt} from "../parser/tokenizer/types";
import {charCodes} from "../parser/util/charcodes";
import getJSXPragmaInfo, {} from "../util/getJSXPragmaInfo";
import Transformer from "./Transformer";
export default class JSXTransformer extends Transformer {
// State for calculating the line number of each JSX tag in development.
__init() {this.lastLineNumber = 1}
__init2() {this.lastIndex = 0}
// In development, variable name holding the name of the current file.
__init3() {this.filenameVarName = null}
// Mapping of claimed names for imports in the automatic transform, e,g.
// {jsx: "_jsx"}. This determines which imports to generate in the prefix.
__init4() {this.esmAutomaticImportNameResolutions = {}}
// When automatically adding imports in CJS mode, we store the variable name
// holding the imported CJS module so we can require it in the prefix.
__init5() {this.cjsAutomaticModuleNameResolutions = {}}
constructor(
rootTransformer,
tokens,
importProcessor,
nameManager,
options,
) {
super();this.rootTransformer = rootTransformer;this.tokens = tokens;this.importProcessor = importProcessor;this.nameManager = nameManager;this.options = options;JSXTransformer.prototype.__init.call(this);JSXTransformer.prototype.__init2.call(this);JSXTransformer.prototype.__init3.call(this);JSXTransformer.prototype.__init4.call(this);JSXTransformer.prototype.__init5.call(this);;
this.jsxPragmaInfo = getJSXPragmaInfo(options);
this.isAutomaticRuntime = options.jsxRuntime === "automatic";
this.jsxImportSource = options.jsxImportSource || "react";
}
process() {
if (this.tokens.matches1(tt.jsxTagStart)) {
this.processJSXTag();
return true;
}
return false;
}
getPrefixCode() {
let prefix = "";
if (this.filenameVarName) {
prefix += `const ${this.filenameVarName} = ${JSON.stringify(this.options.filePath || "")};`;
}
if (this.isAutomaticRuntime) {
if (this.importProcessor) {
// CJS mode: emit require statements for all modules that were referenced.
for (const [path, resolvedName] of Object.entries(this.cjsAutomaticModuleNameResolutions)) {
prefix += `var ${resolvedName} = require("${path}");`;
}
} else {
// ESM mode: consolidate and emit import statements for referenced names.
const {createElement: createElementResolution, ...otherResolutions} =
this.esmAutomaticImportNameResolutions;
if (createElementResolution) {
prefix += `import {createElement as ${createElementResolution}} from "${this.jsxImportSource}";`;
}
const importSpecifiers = Object.entries(otherResolutions)
.map(([name, resolvedName]) => `${name} as ${resolvedName}`)
.join(", ");
if (importSpecifiers) {
const importPath =
this.jsxImportSource + (this.options.production ? "/jsx-runtime" : "/jsx-dev-runtime");
prefix += `import {${importSpecifiers}} from "${importPath}";`;
}
}
}
return prefix;
}
processJSXTag() {
const {jsxRole, start} = this.tokens.currentToken();
// Calculate line number information at the very start (if in development
// mode) so that the information is guaranteed to be queried in token order.
const elementLocationCode = this.options.production ? null : this.getElementLocationCode(start);
if (this.isAutomaticRuntime && jsxRole !== JSXRole.KeyAfterPropSpread) {
this.transformTagToJSXFunc(elementLocationCode, jsxRole);
} else {
this.transformTagToCreateElement(elementLocationCode);
}
}
getElementLocationCode(firstTokenStart) {
const lineNumber = this.getLineNumberForIndex(firstTokenStart);
return `lineNumber: ${lineNumber}`;
}
/**
* Get the line number for this source position. This is calculated lazily and
* must be called in increasing order by index.
*/
getLineNumberForIndex(index) {
const code = this.tokens.code;
while (this.lastIndex < index && this.lastIndex < code.length) {
if (code[this.lastIndex] === "\n") {
this.lastLineNumber++;
}
this.lastIndex++;
}
return this.lastLineNumber;
}
/**
* Convert the current JSX element to a call to jsx, jsxs, or jsxDEV. This is
* the primary transformation for the automatic transform.
*
* Example:
* <div a={1} key={2}>Hello{x}</div>
* becomes
* jsxs('div', {a: 1, children: ["Hello", x]}, 2)
*/
transformTagToJSXFunc(elementLocationCode, jsxRole) {
const isStatic = jsxRole === JSXRole.StaticChildren;
// First tag is always jsxTagStart.
this.tokens.replaceToken(this.getJSXFuncInvocationCode(isStatic));
let keyCode = null;
if (this.tokens.matches1(tt.jsxTagEnd)) {
// Fragment syntax.
this.tokens.replaceToken(`${this.getFragmentCode()}, {`);
this.processAutomaticChildrenAndEndProps(jsxRole);
} else {
// Normal open tag or self-closing tag.
this.processTagIntro();
this.tokens.appendCode(", {");
keyCode = this.processProps(true);
if (this.tokens.matches2(tt.slash, tt.jsxTagEnd)) {
// Self-closing tag, no children to add, so close the props.
this.tokens.appendCode("}");
} else if (this.tokens.matches1(tt.jsxTagEnd)) {
// Tag with children.
this.tokens.removeToken();
this.processAutomaticChildrenAndEndProps(jsxRole);
} else {
throw new Error("Expected either /> or > at the end of the tag.");
}
// If a key was present, move it to its own arg. Note that moving code
// like this will cause line numbers to get out of sync within the JSX
// element if the key expression has a newline in it. This is unfortunate,
// but hopefully should be rare.
if (keyCode) {
this.tokens.appendCode(`, ${keyCode}`);
}
}
if (!this.options.production) {
// If the key wasn't already added, add it now so we can correctly set
// positional args for jsxDEV.
if (keyCode === null) {
this.tokens.appendCode(", void 0");
}
this.tokens.appendCode(`, ${isStatic}, ${this.getDevSource(elementLocationCode)}, this`);
}
// We're at the close-tag or the end of a self-closing tag, so remove
// everything else and close the function call.
this.tokens.removeInitialToken();
while (!this.tokens.matches1(tt.jsxTagEnd)) {
this.tokens.removeToken();
}
this.tokens.replaceToken(")");
}
/**
* Convert the current JSX element to a createElement call. In the classic
* runtime, this is the only case. In the automatic runtime, this is called
* as a fallback in some situations.
*
* Example:
* <div a={1} key={2}>Hello{x}</div>
* becomes
* React.createElement('div', {a: 1, key: 2}, "Hello", x)
*/
transformTagToCreateElement(elementLocationCode) {
// First tag is always jsxTagStart.
this.tokens.replaceToken(this.getCreateElementInvocationCode());
if (this.tokens.matches1(tt.jsxTagEnd)) {
// Fragment syntax.
this.tokens.replaceToken(`${this.getFragmentCode()}, null`);
this.processChildren(true);
} else {
// Normal open tag or self-closing tag.
this.processTagIntro();
this.processPropsObjectWithDevInfo(elementLocationCode);
if (this.tokens.matches2(tt.slash, tt.jsxTagEnd)) {
// Self-closing tag; no children to process.
} else if (this.tokens.matches1(tt.jsxTagEnd)) {
// Tag with children and a close-tag; process the children as args.
this.tokens.removeToken();
this.processChildren(true);
} else {
throw new Error("Expected either /> or > at the end of the tag.");
}
}
// We're at the close-tag or the end of a self-closing tag, so remove
// everything else and close the function call.
this.tokens.removeInitialToken();
while (!this.tokens.matches1(tt.jsxTagEnd)) {
this.tokens.removeToken();
}
this.tokens.replaceToken(")");
}
/**
* Get the code for the relevant function for this context: jsx, jsxs,
* or jsxDEV. The following open-paren is included as well.
*
* These functions are only used for the automatic runtime, so they are always
* auto-imported, but the auto-import will be either CJS or ESM based on the
* target module format.
*/
getJSXFuncInvocationCode(isStatic) {
if (this.options.production) {
if (isStatic) {
return this.claimAutoImportedFuncInvocation("jsxs", "/jsx-runtime");
} else {
return this.claimAutoImportedFuncInvocation("jsx", "/jsx-runtime");
}
} else {
return this.claimAutoImportedFuncInvocation("jsxDEV", "/jsx-dev-runtime");
}
}
/**
* Return the code to use for the createElement function, e.g.
* `React.createElement`, including the following open-paren.
*
* This is the main function to use for the classic runtime. For the
* automatic runtime, this function is used as a fallback function to
* preserve behavior when there is a prop spread followed by an explicit
* key. In that automatic runtime case, the function should be automatically
* imported.
*/
getCreateElementInvocationCode() {
if (this.isAutomaticRuntime) {
return this.claimAutoImportedFuncInvocation("createElement", "");
} else {
const {jsxPragmaInfo} = this;
const resolvedPragmaBaseName = this.importProcessor
? this.importProcessor.getIdentifierReplacement(jsxPragmaInfo.base) || jsxPragmaInfo.base
: jsxPragmaInfo.base;
return `${resolvedPragmaBaseName}${jsxPragmaInfo.suffix}(`;
}
}
/**
* Return the code to use as the component when compiling a shorthand
* fragment, e.g. `React.Fragment`.
*
* This may be called from either the classic or automatic runtime, and
* the value should be auto-imported for the automatic runtime.
*/
getFragmentCode() {
if (this.isAutomaticRuntime) {
return this.claimAutoImportedName(
"Fragment",
this.options.production ? "/jsx-runtime" : "/jsx-dev-runtime",
);
} else {
const {jsxPragmaInfo} = this;
const resolvedFragmentPragmaBaseName = this.importProcessor
? this.importProcessor.getIdentifierReplacement(jsxPragmaInfo.fragmentBase) ||
jsxPragmaInfo.fragmentBase
: jsxPragmaInfo.fragmentBase;
return resolvedFragmentPragmaBaseName + jsxPragmaInfo.fragmentSuffix;
}
}
/**
* Return code that invokes the given function.
*
* When the imports transform is enabled, use the CJSImportTransformer
* strategy of using `.call(void 0, ...` to avoid passing a `this` value in a
* situation that would otherwise look like a method call.
*/
claimAutoImportedFuncInvocation(funcName, importPathSuffix) {
const funcCode = this.claimAutoImportedName(funcName, importPathSuffix);
if (this.importProcessor) {
return `${funcCode}.call(void 0, `;
} else {
return `${funcCode}(`;
}
}
claimAutoImportedName(funcName, importPathSuffix) {
if (this.importProcessor) {
// CJS mode: claim a name for the module and mark it for import.
const path = this.jsxImportSource + importPathSuffix;
if (!this.cjsAutomaticModuleNameResolutions[path]) {
this.cjsAutomaticModuleNameResolutions[path] =
this.importProcessor.getFreeIdentifierForPath(path);
}
return `${this.cjsAutomaticModuleNameResolutions[path]}.${funcName}`;
} else {
// ESM mode: claim a name for this function and add it to the names that
// should be auto-imported when the prefix is generated.
if (!this.esmAutomaticImportNameResolutions[funcName]) {
this.esmAutomaticImportNameResolutions[funcName] = this.nameManager.claimFreeName(
`_${funcName}`,
);
}
return this.esmAutomaticImportNameResolutions[funcName];
}
}
/**
* Process the first part of a tag, before any props.
*/
processTagIntro() {
// Walk forward until we see one of these patterns:
// jsxName to start the first prop, preceded by another jsxName to end the tag name.
// jsxName to start the first prop, preceded by greaterThan to end the type argument.
// [open brace] to start the first prop.
// [jsxTagEnd] to end the open-tag.
// [slash, jsxTagEnd] to end the self-closing tag.
let introEnd = this.tokens.currentIndex() + 1;
while (
this.tokens.tokens[introEnd].isType ||
(!this.tokens.matches2AtIndex(introEnd - 1, tt.jsxName, tt.jsxName) &&
!this.tokens.matches2AtIndex(introEnd - 1, tt.greaterThan, tt.jsxName) &&
!this.tokens.matches1AtIndex(introEnd, tt.braceL) &&
!this.tokens.matches1AtIndex(introEnd, tt.jsxTagEnd) &&
!this.tokens.matches2AtIndex(introEnd, tt.slash, tt.jsxTagEnd))
) {
introEnd++;
}
if (introEnd === this.tokens.currentIndex() + 1) {
const tagName = this.tokens.identifierName();
if (startsWithLowerCase(tagName)) {
this.tokens.replaceToken(`'${tagName}'`);
}
}
while (this.tokens.currentIndex() < introEnd) {
this.rootTransformer.processToken();
}
}
/**
* Starting at the beginning of the props, add the props argument to
* React.createElement, including the comma before it.
*/
processPropsObjectWithDevInfo(elementLocationCode) {
const devProps = this.options.production
? ""
: `__self: this, __source: ${this.getDevSource(elementLocationCode)}`;
if (!this.tokens.matches1(tt.jsxName) && !this.tokens.matches1(tt.braceL)) {
if (devProps) {
this.tokens.appendCode(`, {${devProps}}`);
} else {
this.tokens.appendCode(`, null`);
}
return;
}
this.tokens.appendCode(`, {`);
this.processProps(false);
if (devProps) {
this.tokens.appendCode(` ${devProps}}`);
} else {
this.tokens.appendCode("}");
}
}
/**
* Transform the core part of the props, assuming that a { has already been
* inserted before us and that a } will be inserted after us.
*
* If extractKeyCode is true (i.e. when using any jsx... function), any prop
* named "key" has its code captured and returned rather than being emitted to
* the output code. This shifts line numbers, and emitting the code later will
* correct line numbers again. If no key is found or if extractKeyCode is
* false, this function returns null.
*/
processProps(extractKeyCode) {
let keyCode = null;
while (true) {
if (this.tokens.matches2(tt.jsxName, tt.eq)) {
// This is a regular key={value} or key="value" prop.
const propName = this.tokens.identifierName();
if (extractKeyCode && propName === "key") {
if (keyCode !== null) {
// The props list has multiple keys. Different implementations are
// inconsistent about what to do here: as of this writing, Babel and
// swc keep the *last* key and completely remove the rest, while
// TypeScript uses the *first* key and leaves the others as regular
// props. The React team collaborated with Babel on the
// implementation of this behavior, so presumably the Babel behavior
// is the one to use.
// Since we won't ever be emitting the previous key code, we need to
// at least emit its newlines here so that the line numbers match up
// in the long run.
this.tokens.appendCode(keyCode.replace(/[^\n]/g, ""));
}
// key
this.tokens.removeToken();
// =
this.tokens.removeToken();
const snapshot = this.tokens.snapshot();
this.processPropValue();
keyCode = this.tokens.dangerouslyGetAndRemoveCodeSinceSnapshot(snapshot);
// Don't add a comma
continue;
} else {
this.processPropName(propName);
this.tokens.replaceToken(": ");
this.processPropValue();
}
} else if (this.tokens.matches1(tt.jsxName)) {
// This is a shorthand prop like <input disabled />.
const propName = this.tokens.identifierName();
this.processPropName(propName);
this.tokens.appendCode(": true");
} else if (this.tokens.matches1(tt.braceL)) {
// This is prop spread, like <div {...getProps()}>, which we can pass
// through fairly directly as an object spread.
this.tokens.replaceToken("");
this.rootTransformer.processBalancedCode();
this.tokens.replaceToken("");
} else {
break;
}
this.tokens.appendCode(",");
}
return keyCode;
}
processPropName(propName) {
if (propName.includes("-")) {
this.tokens.replaceToken(`'${propName}'`);
} else {
this.tokens.copyToken();
}
}
processPropValue() {
if (this.tokens.matches1(tt.braceL)) {
this.tokens.replaceToken("");
this.rootTransformer.processBalancedCode();
this.tokens.replaceToken("");
} else if (this.tokens.matches1(tt.jsxTagStart)) {
this.processJSXTag();
} else {
this.processStringPropValue();
}
}
processStringPropValue() {
const token = this.tokens.currentToken();
const valueCode = this.tokens.code.slice(token.start + 1, token.end - 1);
const replacementCode = formatJSXTextReplacement(valueCode);
const literalCode = formatJSXStringValueLiteral(valueCode);
this.tokens.replaceToken(literalCode + replacementCode);
}
/**
* Starting in the middle of the props object literal, produce an additional
* prop for the children and close the object literal.
*/
processAutomaticChildrenAndEndProps(jsxRole) {
if (jsxRole === JSXRole.StaticChildren) {
this.tokens.appendCode(" children: [");
this.processChildren(false);
this.tokens.appendCode("]}");
} else {
// The parser information tells us whether we will see a real child or if
// all remaining children (if any) will resolve to empty. If there are no
// non-empty children, don't emit a children prop at all, but still
// process children so that we properly transform the code into nothing.
if (jsxRole === JSXRole.OneChild) {
this.tokens.appendCode(" children: ");
}
this.processChildren(false);
this.tokens.appendCode("}");
}
}
/**
* Transform children into a comma-separated list, which will be either
* arguments to createElement or array elements of a children prop.
*/
processChildren(needsInitialComma) {
let needsComma = needsInitialComma;
while (true) {
if (this.tokens.matches2(tt.jsxTagStart, tt.slash)) {
// Closing tag, so no more children.
return;
}
let didEmitElement = false;
if (this.tokens.matches1(tt.braceL)) {
if (this.tokens.matches2(tt.braceL, tt.braceR)) {
// Empty interpolations and comment-only interpolations are allowed
// and don't create an extra child arg.
this.tokens.replaceToken("");
this.tokens.replaceToken("");
} else {
// Interpolated expression.
this.tokens.replaceToken(needsComma ? ", " : "");
this.rootTransformer.processBalancedCode();
this.tokens.replaceToken("");
didEmitElement = true;
}
} else if (this.tokens.matches1(tt.jsxTagStart)) {
// Child JSX element
this.tokens.appendCode(needsComma ? ", " : "");
this.processJSXTag();
didEmitElement = true;
} else if (this.tokens.matches1(tt.jsxText) || this.tokens.matches1(tt.jsxEmptyText)) {
didEmitElement = this.processChildTextElement(needsComma);
} else {
throw new Error("Unexpected token when processing JSX children.");
}
if (didEmitElement) {
needsComma = true;
}
}
}
/**
* Turn a JSX text element into a string literal, or nothing at all if the JSX
* text resolves to the empty string.
*
* Returns true if a string literal is emitted, false otherwise.
*/
processChildTextElement(needsComma) {
const token = this.tokens.currentToken();
const valueCode = this.tokens.code.slice(token.start, token.end);
const replacementCode = formatJSXTextReplacement(valueCode);
const literalCode = formatJSXTextLiteral(valueCode);
if (literalCode === '""') {
this.tokens.replaceToken(replacementCode);
return false;
} else {
this.tokens.replaceToken(`${needsComma ? ", " : ""}${literalCode}${replacementCode}`);
return true;
}
}
getDevSource(elementLocationCode) {
return `{fileName: ${this.getFilenameVarName()}, ${elementLocationCode}}`;
}
getFilenameVarName() {
if (!this.filenameVarName) {
this.filenameVarName = this.nameManager.claimFreeName("_jsxFileName");
}
return this.filenameVarName;
}
}
/**
* Spec for identifiers: https://tc39.github.io/ecma262/#prod-IdentifierStart.
*
* Really only treat anything starting with a-z as tag names. `_`, `$`, `é`
* should be treated as component names
*/
export function startsWithLowerCase(s) {
const firstChar = s.charCodeAt(0);
return firstChar >= charCodes.lowercaseA && firstChar <= charCodes.lowercaseZ;
}
/**
* Turn the given jsxText string into a JS string literal. Leading and trailing
* whitespace on lines is removed, except immediately after the open-tag and
* before the close-tag. Empty lines are completely removed, and spaces are
* added between lines after that.
*
* We use JSON.stringify to introduce escape characters as necessary, and trim
* the start and end of each line and remove blank lines.
*/
function formatJSXTextLiteral(text) {
let result = "";
let whitespace = "";
let isInInitialLineWhitespace = false;
let seenNonWhitespace = false;
for (let i = 0; i < text.length; i++) {
const c = text[i];
if (c === " " || c === "\t" || c === "\r") {
if (!isInInitialLineWhitespace) {
whitespace += c;
}
} else if (c === "\n") {
whitespace = "";
isInInitialLineWhitespace = true;
} else {
if (seenNonWhitespace && isInInitialLineWhitespace) {
result += " ";
}
result += whitespace;
whitespace = "";
if (c === "&") {
const {entity, newI} = processEntity(text, i + 1);
i = newI - 1;
result += entity;
} else {
result += c;
}
seenNonWhitespace = true;
isInInitialLineWhitespace = false;
}
}
if (!isInInitialLineWhitespace) {
result += whitespace;
}
return JSON.stringify(result);
}
/**
* Produce the code that should be printed after the JSX text string literal,
* with most content removed, but all newlines preserved and all spacing at the
* end preserved.
*/
function formatJSXTextReplacement(text) {
let numNewlines = 0;
let numSpaces = 0;
for (const c of text) {
if (c === "\n") {
numNewlines++;
numSpaces = 0;
} else if (c === " ") {
numSpaces++;
}
}
return "\n".repeat(numNewlines) + " ".repeat(numSpaces);
}
/**
* Format a string in the value position of a JSX prop.
*
* Use the same implementation as convertAttribute from
* babel-helper-builder-react-jsx.
*/
function formatJSXStringValueLiteral(text) {
let result = "";
for (let i = 0; i < text.length; i++) {
const c = text[i];
if (c === "\n") {
if (/\s/.test(text[i + 1])) {
result += " ";
while (i < text.length && /\s/.test(text[i + 1])) {
i++;
}
} else {
result += "\n";
}
} else if (c === "&") {
const {entity, newI} = processEntity(text, i + 1);
result += entity;
i = newI - 1;
} else {
result += c;
}
}
return JSON.stringify(result);
}
/**
* Starting at a &, see if there's an HTML entity (specified by name, decimal
* char code, or hex char code) and return it if so.
*
* Modified from jsxReadString in babel-parser.
*/
function processEntity(text, indexAfterAmpersand) {
let str = "";
let count = 0;
let entity;
let i = indexAfterAmpersand;
if (text[i] === "#") {
let radix = 10;
i++;
let numStart;
if (text[i] === "x") {
radix = 16;
i++;
numStart = i;
while (i < text.length && isHexDigit(text.charCodeAt(i))) {
i++;
}
} else {
numStart = i;
while (i < text.length && isDecimalDigit(text.charCodeAt(i))) {
i++;
}
}
if (text[i] === ";") {
const numStr = text.slice(numStart, i);
if (numStr) {
i++;
entity = String.fromCodePoint(parseInt(numStr, radix));
}
}
} else {
while (i < text.length && count++ < 10) {
const ch = text[i];
i++;
if (ch === ";") {
entity = XHTMLEntities.get(str);
break;
}
str += ch;
}
}
if (!entity) {
return {entity: "&", newI: indexAfterAmpersand};
}
return {entity, newI: i};
}
function isDecimalDigit(code) {
return code >= charCodes.digit0 && code <= charCodes.digit9;
}
function isHexDigit(code) {
return (
(code >= charCodes.digit0 && code <= charCodes.digit9) ||
(code >= charCodes.lowercaseA && code <= charCodes.lowercaseF) ||
(code >= charCodes.uppercaseA && code <= charCodes.uppercaseF)
);
}
@@ -0,0 +1,27 @@
'use strict'
const SemVer = require('../classes/semver')
const Range = require('../classes/range')
const maxSatisfying = (versions, range, options) => {
let max = null
let maxSV = null
let rangeObj = null
try {
rangeObj = new Range(range, options)
} catch (er) {
return null
}
versions.forEach((v) => {
if (rangeObj.test(v)) {
// satisfies(v, range, options)
if (!max || maxSV.compare(v) === -1) {
// compare(max, v, true)
max = v
maxSV = new SemVer(max, options)
}
}
})
return max
}
module.exports = maxSatisfying
@@ -0,0 +1,7 @@
/**
* A runtime-agnostic collection of methods for working with the WebCrypto API
* @module
*/
export { digest } from './digest.js';
export { getRandomValues } from './getRandomValues.js';
export { verify } from './verify.js';
@@ -0,0 +1,252 @@
/**
* @fileoverview Require spaces around infix operators
* @author Michael Ficarra
* @deprecated in ESLint v8.53.0
*/
"use strict";
const { isEqToken } = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
deprecated: {
message: "Formatting rules are being moved out of ESLint core.",
url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
deprecatedSince: "8.53.0",
availableUntil: "11.0.0",
replacedBy: [
{
message:
"ESLint Stylistic now maintains deprecated stylistic core rules.",
url: "https://eslint.style/guide/migration",
plugin: {
name: "@stylistic/eslint-plugin",
url: "https://eslint.style",
},
rule: {
name: "space-infix-ops",
url: "https://eslint.style/rules/space-infix-ops",
},
},
],
},
type: "layout",
docs: {
description: "Require spacing around infix operators",
recommended: false,
url: "https://eslint.org/docs/latest/rules/space-infix-ops",
},
fixable: "whitespace",
schema: [
{
type: "object",
properties: {
int32Hint: {
type: "boolean",
default: false,
},
},
additionalProperties: false,
},
],
messages: {
missingSpace: "Operator '{{operator}}' must be spaced.",
},
},
create(context) {
const int32Hint = context.options[0]
? context.options[0].int32Hint === true
: false;
const sourceCode = context.sourceCode;
/**
* Returns the first token which violates the rule
* @param {ASTNode} left The left node of the main node
* @param {ASTNode} right The right node of the main node
* @param {string} op The operator of the main node
* @returns {Object} The violator token or null
* @private
*/
function getFirstNonSpacedToken(left, right, op) {
const operator = sourceCode.getFirstTokenBetween(
left,
right,
token => token.value === op,
);
const prev = sourceCode.getTokenBefore(operator);
const next = sourceCode.getTokenAfter(operator);
if (
!sourceCode.isSpaceBetweenTokens(prev, operator) ||
!sourceCode.isSpaceBetweenTokens(operator, next)
) {
return operator;
}
return null;
}
/**
* Reports an AST node as a rule violation
* @param {ASTNode} mainNode The node to report
* @param {Object} culpritToken The token which has a problem
* @returns {void}
* @private
*/
function report(mainNode, culpritToken) {
context.report({
node: mainNode,
loc: culpritToken.loc,
messageId: "missingSpace",
data: {
operator: culpritToken.value,
},
fix(fixer) {
const previousToken =
sourceCode.getTokenBefore(culpritToken);
const afterToken = sourceCode.getTokenAfter(culpritToken);
let fixString = "";
if (culpritToken.range[0] - previousToken.range[1] === 0) {
fixString = " ";
}
fixString += culpritToken.value;
if (afterToken.range[0] - culpritToken.range[1] === 0) {
fixString += " ";
}
return fixer.replaceText(culpritToken, fixString);
},
});
}
/**
* Check if the node is binary then report
* @param {ASTNode} node node to evaluate
* @returns {void}
* @private
*/
function checkBinary(node) {
const leftNode = node.left.typeAnnotation
? node.left.typeAnnotation
: node.left;
const rightNode = node.right;
// search for = in AssignmentPattern nodes
const operator = node.operator || "=";
const nonSpacedNode = getFirstNonSpacedToken(
leftNode,
rightNode,
operator,
);
if (nonSpacedNode) {
if (!(int32Hint && sourceCode.getText(node).endsWith("|0"))) {
report(node, nonSpacedNode);
}
}
}
/**
* Check if the node is conditional
* @param {ASTNode} node node to evaluate
* @returns {void}
* @private
*/
function checkConditional(node) {
const nonSpacedConsequentNode = getFirstNonSpacedToken(
node.test,
node.consequent,
"?",
);
const nonSpacedAlternateNode = getFirstNonSpacedToken(
node.consequent,
node.alternate,
":",
);
if (nonSpacedConsequentNode) {
report(node, nonSpacedConsequentNode);
}
if (nonSpacedAlternateNode) {
report(node, nonSpacedAlternateNode);
}
}
/**
* Check if the node is a variable
* @param {ASTNode} node node to evaluate
* @returns {void}
* @private
*/
function checkVar(node) {
const leftNode = node.id.typeAnnotation
? node.id.typeAnnotation
: node.id;
const rightNode = node.init;
if (rightNode) {
const nonSpacedNode = getFirstNonSpacedToken(
leftNode,
rightNode,
"=",
);
if (nonSpacedNode) {
report(node, nonSpacedNode);
}
}
}
return {
AssignmentExpression: checkBinary,
AssignmentPattern: checkBinary,
BinaryExpression: checkBinary,
LogicalExpression: checkBinary,
ConditionalExpression: checkConditional,
VariableDeclarator: checkVar,
PropertyDefinition(node) {
if (!node.value) {
return;
}
/*
* Because of computed properties and type annotations, some
* tokens may exist between `node.key` and `=`.
* Therefore, find the `=` from the right.
*/
const operatorToken = sourceCode.getTokenBefore(
node.value,
isEqToken,
);
const leftToken = sourceCode.getTokenBefore(operatorToken);
const rightToken = sourceCode.getTokenAfter(operatorToken);
if (
!sourceCode.isSpaceBetweenTokens(
leftToken,
operatorToken,
) ||
!sourceCode.isSpaceBetweenTokens(operatorToken, rightToken)
) {
report(node, operatorToken);
}
},
};
},
};
@@ -0,0 +1,46 @@
"use client";
import {
table_default
} from "./chunk-S6VICFMP.mjs";
import "./chunk-LSK6ZGMB.mjs";
import "./chunk-YQRLDUCT.mjs";
import {
useTable
} from "./chunk-6QNXQNN7.mjs";
import "./chunk-XELIGTI4.mjs";
import "./chunk-NSERPD52.mjs";
import {
table_column_default
} from "./chunk-TSPNSPCL.mjs";
import {
table_header_default
} from "./chunk-YRZGWF2W.mjs";
import {
table_row_default
} from "./chunk-CIL4Y7FA.mjs";
import {
table_body_default
} from "./chunk-FKPXBCGS.mjs";
import {
table_cell_default
} from "./chunk-F3UDT23P.mjs";
import "./chunk-SU3P7OYB.mjs";
import "./chunk-LNVX26OF.mjs";
import "./chunk-IAFUOJEK.mjs";
import "./chunk-SAU5MAVM.mjs";
import "./chunk-UWYZDOES.mjs";
import "./chunk-UHE3PMQE.mjs";
import "./chunk-CKWQQGXG.mjs";
// src/index.ts
import { getKeyValue } from "@heroui/shared-utils";
export {
table_default as Table,
table_body_default as TableBody,
table_cell_default as TableCell,
table_column_default as TableColumn,
table_header_default as TableHeader,
table_row_default as TableRow,
getKeyValue,
useTable
};
@@ -0,0 +1,31 @@
Copyright (c) 2017-2024, Slab
Copyright (c) 2014, Jason Chen
Copyright (c) 2013, salesforce.com
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,24 @@
// src/chevron-right.tsx
import { jsx } from "react/jsx-runtime";
var ChevronRightIcon = (props) => /* @__PURE__ */ jsx(
"svg",
{
"aria-hidden": "true",
fill: "none",
focusable: "false",
height: "1em",
role: "presentation",
stroke: "currentColor",
strokeLinecap: "round",
strokeLinejoin: "round",
strokeWidth: "1.5",
viewBox: "0 0 24 24",
width: "1em",
...props,
children: /* @__PURE__ */ jsx("path", { d: "m9 18 6-6-6-6" })
}
);
export {
ChevronRightIcon
};
@@ -0,0 +1,39 @@
type ColorScale = Partial<{
50: string;
100: string;
200: string;
300: string;
400: string;
500: string;
600: string;
700: string;
800: string;
900: string;
foreground: string;
DEFAULT: string;
}> | string;
type BaseColors = {
background: ColorScale;
foreground: ColorScale;
divider: ColorScale;
overlay: ColorScale;
focus: ColorScale;
content1: ColorScale;
content2: ColorScale;
content3: ColorScale;
content4: ColorScale;
};
type ThemeColors = BaseColors & {
default: ColorScale;
primary: ColorScale;
secondary: ColorScale;
success: ColorScale;
warning: ColorScale;
danger: ColorScale;
};
type SemanticBaseColors = {
light: BaseColors;
dark: BaseColors;
};
export { BaseColors, ColorScale, SemanticBaseColors, ThemeColors };
@@ -0,0 +1,24 @@
"use strict";
var _unsupported_iterable_to_array = require("./_unsupported_iterable_to_array.cjs");
function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
if (it) return (it = it.call(o)).next.bind(it);
// Fallback for engines without symbol support
if (Array.isArray(o) || (it = _unsupported_iterable_to_array._(o)) || allowArrayLike && o && typeof o.length === "number") {
if (it) o = it;
var i = 0;
return function() {
if (i >= o.length) return { done: true };
return { done: false, value: o[i++] };
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
exports._ = _create_for_of_iterator_helper_loose;
@@ -0,0 +1 @@
{"version":3,"file":"resolveConstantValueBindingCallback.d.ts","sourceRoot":"","sources":["../../../../src/resolution/calculations/resolveConstantValueBindingCallback.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,wBAAgB,mCAAmC,CAAC,UAAU,EAC5D,OAAO,EAAE,gBAAgB,EACzB,OAAO,EAAE,oBAAoB,CAAC,UAAU,CAAC,GACxC,QAAQ,CAAC,UAAU,CAAC,CAEtB"}
@@ -0,0 +1 @@
{"name":"eslint-visitor-keys","version":"4.2.1","requiresBuild":false,"files":{"LICENSE":{"checkedAt":1794532093285,"integrity":"sha512-LK/hBSxf9yMQL2r6cNQN5Ts9V9Xiex+3PSnzFyHRHv276wJR1mZGB/cHFulPafZdeg3B465HZdPiLCPHDjjmiw==","mode":420,"size":11337},"dist/eslint-visitor-keys.cjs":{"checkedAt":1794532093286,"integrity":"sha512-s1Qbk1Dj8aynKihJbo1qGZ4P2ijnKbE8avOh98pZGjZxZDI34oWh47WZd1hw2Zm2BePM0VTqduYmExr+PZ6meA==","mode":420,"size":7586},"dist/eslint-visitor-keys.d.cts":{"checkedAt":1794532093286,"integrity":"sha512-gFYKoRNnt1B8Al2CkLCxL6aaOADGqF/joRQDTNOXs6wiI9t/5Zcb9406BhauyTcdFfPhMIvKs4ZoXzZLMiN6EQ==","mode":420,"size":773},"lib/index.js":{"checkedAt":1794532093286,"integrity":"sha512-cDJQvaixWMpA5dKzEGL35OC2Fz9JEIt/w+ke8PvrWoVYy07D0kzfr+/lapU68LeZ3BVA+CeT1gUuvBFQPn/PSA==","mode":420,"size":1864},"lib/visitor-keys.js":{"checkedAt":1794532093286,"integrity":"sha512-aZwF09sJNFpUB34jv45igioTjzYmqpvU3EjY0TlWlCWoNQNmuTboE4P4SIeIkttYp/mk90R7UBojF+u0BuIwTA==","mode":420,"size":5718},"package.json":{"checkedAt":1794532093286,"integrity":"sha512-Hn8Y+U4u1zMNRlWo711MdO8wViW/jqpyo5l9KvWSAHU693soy7QWI60uTQvnrfhpdTDgBXPx/uK9kMrOB2YhPA==","mode":420,"size":2222},"README.md":{"checkedAt":1794532093287,"integrity":"sha512-xBhh1rfA4I99xMuQShJUkneG7YfBeiQS1tAU4RqBBN/sy+hq7jWbHh41SJKP43jNUGjIoZ/yVkk7wB80rhwRuw==","mode":420,"size":6760},"dist/index.d.ts":{"checkedAt":1794532093287,"integrity":"sha512-Oi7rGgPS75lfgND/lVnf/0Pd2CKRlRvkNonUXTD2ElQuCFVibBnIHrFF4A1Fs1WnsiaUZxbNqz78vcBDHM3zTw==","mode":420,"size":596},"dist/visitor-keys.d.ts":{"checkedAt":1794532093287,"integrity":"sha512-ibICB9IRIuRxu/TKUfE+SjP68PL9eQjyg+7K/wVHgTHmIEk/UIZ0HJy7Ukb1VQijo121d2n4aodi6+kWjIjdpw==","mode":420,"size":295}}}
@@ -0,0 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.buildArrayMetadataWithArray = buildArrayMetadataWithArray;
function buildArrayMetadataWithArray(newArrayMetadata) {
return (arrayMetadata) => {
arrayMetadata.push(...newArrayMetadata);
return arrayMetadata;
};
}
//# sourceMappingURL=buildArrayMetadataWithArray.js.map
@@ -0,0 +1,6 @@
var root = require('./_root');
/** Built-in value references. */
var Symbol = root.Symbol;
module.exports = Symbol;
@@ -0,0 +1,47 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createTester = require('./internal/createTester.js');
var _createTester2 = _interopRequireDefault(_createTester);
var _eachOfLimit = require('./internal/eachOfLimit.js');
var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
var _awaitify = require('./internal/awaitify.js');
var _awaitify2 = _interopRequireDefault(_awaitify);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* The same as [`detect`]{@link module:Collections.detect} but runs only a single async operation at a time.
*
* @name detectSeries
* @static
* @memberOf module:Collections
* @method
* @see [async.detect]{@link module:Collections.detect}
* @alias findSeries
* @category Collections
* @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
* @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`.
* The iteratee must complete with a boolean value as its result.
* Invoked with (item, callback).
* @param {Function} [callback] - A callback which is called as soon as any
* iteratee returns `true`, or after all the `iteratee` functions have finished.
* Result will be the first item in the array that passes the truth test
* (iteratee) or the value `undefined` if none passed. Invoked with
* (err, result).
* @returns {Promise} a promise, if a callback is omitted
*/
function detectSeries(coll, iteratee, callback) {
return (0, _createTester2.default)(bool => bool, (res, item) => item)((0, _eachOfLimit2.default)(1), coll, iteratee, callback);
}
exports.default = (0, _awaitify2.default)(detectSeries, 3);
module.exports = exports.default;
@@ -0,0 +1,30 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _tslib = require("tslib");
var _react = require("react");
function useWhyDidYouUpdate(componentName, props) {
var prevProps = (0, _react.useRef)({});
(0, _react.useEffect)(function () {
if (prevProps.current) {
var allKeys = Object.keys((0, _tslib.__assign)((0, _tslib.__assign)({}, prevProps.current), props));
var changedProps_1 = {};
allKeys.forEach(function (key) {
if (!Object.is(prevProps.current[key], props[key])) {
changedProps_1[key] = {
from: prevProps.current[key],
to: props[key]
};
}
});
if (Object.keys(changedProps_1).length) {
console.log('[why-did-you-update]', componentName, changedProps_1);
}
}
prevProps.current = props;
});
}
var _default = exports["default"] = useWhyDidYouUpdate;
@@ -0,0 +1,28 @@
var EventEmitter = require('events').EventEmitter
function Counter () {
EventEmitter.call(this)
this.value = 0
}
Counter.prototype = Object.create(EventEmitter.prototype)
Counter.prototype.increment = function increment () {
this.value++
}
Counter.prototype.decrement = function decrement () {
if (--this.value === 0) this.emit('zero')
}
Counter.prototype.isZero = function isZero () {
return (this.value === 0)
}
Counter.prototype.onceZero = function onceZero (fn) {
if (this.isZero()) return fn()
this.once('zero', fn)
}
module.exports = Counter
@@ -0,0 +1 @@
{"version":3,"file":"InversifyContainerError.js","sourceRoot":"","sources":["../../../../src/error/models/InversifyContainerError.ts"],"names":[],"mappings":";;;AAEA,MAAM,gBAAgB,GAAkB,MAAM,CAAC,GAAG,CAChD,gDAAgD,CACjD,CAAC;AAEF,MAAa,uBAAwB,SAAQ,KAAK;IACzC,CAAC,gBAAgB,CAAC,CAAO;IAEzB,IAAI,CAA8B;IAEzC,YACE,IAAiC,EACjC,OAAgB,EAChB,OAAsB;QAEtB,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAExB,IAAI,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAEM,MAAM,CAAC,EAAE,CAAC,KAAc;QAC7B,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;YACzB,KAAK,KAAK,IAAI;YACb,KAA0C,CAAC,gBAAgB,CAAC,KAAK,IAAI,CACvE,CAAC;IACJ,CAAC;IAEM,MAAM,CAAC,aAAa,CACzB,KAAc,EACd,IAAiC;QAEjC,uEAAuE;QACvE,OAAO,uBAAuB,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC;IAClE,CAAC;CACF;AA/BD,0DA+BC"}
@@ -0,0 +1,19 @@
/**
* Should forward prop utility function
* @param {Function} filterPropFunction The flter function
*/
export function shouldForwardProp(filterPropFunction) {
/**
* The forward props function passed to `setup`
* @param {object} props
*/
function forwardProp(props) {
for (let p in props) {
if (!filterPropFunction(p)) {
delete props[p];
}
}
}
return forwardProp;
}
@@ -0,0 +1,155 @@
"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/colors/common.ts
var common_exports = {};
__export(common_exports, {
commonColors: () => commonColors
});
module.exports = __toCommonJS(common_exports);
// src/colors/blue.ts
var blue = {
50: "#e6f1fe",
100: "#cce3fd",
200: "#99c7fb",
300: "#66aaf9",
400: "#338ef7",
500: "#006FEE",
600: "#005bc4",
700: "#004493",
800: "#002e62",
900: "#001731"
};
// src/colors/green.ts
var green = {
50: "#e8faf0",
100: "#d1f4e0",
200: "#a2e9c1",
300: "#74dfa2",
400: "#45d483",
500: "#17c964",
600: "#12a150",
700: "#0e793c",
800: "#095028",
900: "#052814"
};
// src/colors/pink.ts
var pink = {
50: "#ffedfa",
100: "#ffdcf5",
200: "#ffb8eb",
300: "#ff95e1",
400: "#ff71d7",
500: "#ff4ecd",
600: "#cc3ea4",
700: "#992f7b",
800: "#661f52",
900: "#331029"
};
// src/colors/purple.ts
var purple = {
50: "#f2eafa",
100: "#e4d4f4",
200: "#c9a9e9",
300: "#ae7ede",
400: "#9353d3",
500: "#7828c8",
600: "#6020a0",
700: "#481878",
800: "#301050",
900: "#180828"
};
// src/colors/red.ts
var red = {
50: "#fee7ef",
100: "#fdd0df",
200: "#faa0bf",
300: "#f871a0",
400: "#f54180",
500: "#f31260",
600: "#c20e4d",
700: "#920b3a",
800: "#610726",
900: "#310413"
};
// src/colors/yellow.ts
var yellow = {
50: "#fefce8",
100: "#fdedd3",
200: "#fbdba7",
300: "#f9c97c",
400: "#f7b750",
500: "#f5a524",
600: "#c4841d",
700: "#936316",
800: "#62420e",
900: "#312107"
};
// src/colors/cyan.ts
var cyan = {
50: "#F0FCFF",
100: "#E6FAFE",
200: "#D7F8FE",
300: "#C3F4FD",
400: "#A5EEFD",
500: "#7EE7FC",
600: "#06B7DB",
700: "#09AACD",
800: "#0E8AAA",
900: "#053B48"
};
// src/colors/zinc.ts
var zinc = {
"50": "#fafafa",
"100": "#f4f4f5",
"200": "#e4e4e7",
"300": "#d4d4d8",
"400": "#a1a1aa",
"500": "#71717a",
"600": "#52525b",
"700": "#3f3f46",
"800": "#27272a",
"900": "#18181b"
};
// src/colors/common.ts
var commonColors = {
white: "#ffffff",
black: "#000000",
blue,
green,
pink,
purple,
red,
yellow,
cyan,
zinc
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
commonColors
});
@@ -0,0 +1,52 @@
"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/bold/plus.tsx
var plus_exports = {};
__export(plus_exports, {
PlusFilledIcon: () => PlusFilledIcon
});
module.exports = __toCommonJS(plus_exports);
var import_jsx_runtime = require("react/jsx-runtime");
var PlusFilledIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
"svg",
{
"aria-hidden": "true",
fill: "none",
focusable: "false",
height: "1em",
role: "presentation",
viewBox: "0 0 24 24",
width: "1em",
...props,
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
"path",
{
clipRule: "evenodd",
d: "M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22ZM12.75 9C12.75 8.58579 12.4142 8.25 12 8.25C11.5858 8.25 11.25 8.58579 11.25 9L11.25 11.25H9C8.58579 11.25 8.25 11.5858 8.25 12C8.25 12.4142 8.58579 12.75 9 12.75H11.25V15C11.25 15.4142 11.5858 15.75 12 15.75C12.4142 15.75 12.75 15.4142 12.75 15L12.75 12.75H15C15.4142 12.75 15.75 12.4142 15.75 12C15.75 11.5858 15.4142 11.25 15 11.25H12.75V9Z",
fill: "currentColor",
fillRule: "evenodd"
}
)
}
);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
PlusFilledIcon
});
@@ -0,0 +1,79 @@
{
"name": "unrs-resolver",
"version": "1.11.1",
"type": "commonjs",
"description": "UnRS Resolver Node API with PNP support",
"repository": "git+https://github.com/unrs/unrs-resolver.git",
"homepage": "https://github.com/unrs/unrs-resolver#readme",
"author": "JounQin <admin@1stg.me> (https://www.1stG.me)",
"funding": "https://opencollective.com/unrs-resolver",
"license": "MIT",
"main": "index.js",
"browser": "browser.js",
"files": [
"browser.js",
"index.d.ts",
"index.js"
],
"scripts": {
"postinstall": "napi-postinstall unrs-resolver 1.11.1 check"
},
"dependencies": {
"napi-postinstall": "^0.3.0"
},
"publishConfig": {
"registry": "https://registry.npmjs.org",
"access": "public"
},
"napi": {
"binaryName": "resolver",
"packageName": "@unrs/resolver-binding",
"wasm": {
"browser": {
"fs": true
}
},
"targets": [
"x86_64-pc-windows-msvc",
"aarch64-pc-windows-msvc",
"i686-pc-windows-msvc",
"x86_64-unknown-linux-gnu",
"x86_64-unknown-linux-musl",
"x86_64-unknown-freebsd",
"aarch64-linux-android",
"aarch64-unknown-linux-gnu",
"aarch64-unknown-linux-musl",
"armv7-linux-androideabi",
"armv7-unknown-linux-gnueabihf",
"armv7-unknown-linux-musleabihf",
"powerpc64le-unknown-linux-gnu",
"riscv64gc-unknown-linux-gnu",
"riscv64gc-unknown-linux-musl",
"s390x-unknown-linux-gnu",
"x86_64-apple-darwin",
"aarch64-apple-darwin",
"wasm32-wasip1-threads"
]
},
"optionalDependencies": {
"@unrs/resolver-binding-win32-x64-msvc": "1.11.1",
"@unrs/resolver-binding-win32-arm64-msvc": "1.11.1",
"@unrs/resolver-binding-win32-ia32-msvc": "1.11.1",
"@unrs/resolver-binding-linux-x64-gnu": "1.11.1",
"@unrs/resolver-binding-linux-x64-musl": "1.11.1",
"@unrs/resolver-binding-freebsd-x64": "1.11.1",
"@unrs/resolver-binding-android-arm64": "1.11.1",
"@unrs/resolver-binding-linux-arm64-gnu": "1.11.1",
"@unrs/resolver-binding-linux-arm64-musl": "1.11.1",
"@unrs/resolver-binding-android-arm-eabi": "1.11.1",
"@unrs/resolver-binding-linux-arm-gnueabihf": "1.11.1",
"@unrs/resolver-binding-linux-arm-musleabihf": "1.11.1",
"@unrs/resolver-binding-linux-ppc64-gnu": "1.11.1",
"@unrs/resolver-binding-linux-riscv64-gnu": "1.11.1",
"@unrs/resolver-binding-linux-riscv64-musl": "1.11.1",
"@unrs/resolver-binding-linux-s390x-gnu": "1.11.1",
"@unrs/resolver-binding-darwin-x64": "1.11.1",
"@unrs/resolver-binding-darwin-arm64": "1.11.1",
"@unrs/resolver-binding-wasm32-wasi": "1.11.1"
}
}
@@ -0,0 +1,68 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const vitest_1 = require("vitest");
const __1 = require("../..");
(0, vitest_1.describe)('Issue 928', () => {
(0, vitest_1.it)('should inject the right instances', () => {
let injectedA;
let injectedB;
let injectedC;
// some dependencies
let DepA = class DepA {
a = 1;
};
DepA = tslib_1.__decorate([
(0, __1.injectable)()
], DepA);
let DepB = class DepB {
b = 1;
};
DepB = tslib_1.__decorate([
(0, __1.injectable)()
], DepB);
let DepC = class DepC {
c = 1;
};
DepC = tslib_1.__decorate([
(0, __1.injectable)()
], DepC);
let AbstractCls = class AbstractCls {
constructor(a, b = { b: 0 }) {
injectedA = a;
injectedB = b;
}
};
AbstractCls = tslib_1.__decorate([
(0, __1.injectable)(),
tslib_1.__param(0, (0, __1.inject)(DepA)),
tslib_1.__param(1, (0, __1.inject)(DepB)),
tslib_1.__param(1, (0, __1.optional)()),
tslib_1.__metadata("design:paramtypes", [DepA,
DepB])
], AbstractCls);
let Cls = class Cls extends AbstractCls {
constructor(c, b = { b: 0 }, a) {
super(a, b);
injectedC = c;
}
};
Cls = tslib_1.__decorate([
(0, __1.injectable)(),
tslib_1.__param(0, (0, __1.inject)(DepC)),
tslib_1.__param(1, (0, __1.inject)(DepB)),
tslib_1.__param(1, (0, __1.optional)()),
tslib_1.__param(2, (0, __1.inject)(DepA)),
tslib_1.__metadata("design:paramtypes", [DepC,
DepB,
DepA])
], Cls);
const container = new __1.Container();
[DepA, DepB, DepC, Cls].forEach((i) => container.bind(i).toSelf().inSingletonScope());
container.get(Cls);
(0, vitest_1.expect)(injectedA).toStrictEqual(new DepA());
(0, vitest_1.expect)(injectedB).toStrictEqual(new DepB());
(0, vitest_1.expect)(injectedC).toStrictEqual(new DepC());
});
});
//# sourceMappingURL=issue_928.test.js.map
@@ -0,0 +1,15 @@
import { AlgorithmIdentifier } from "@peculiar/asn1-x509";
import { OctetString } from "@peculiar/asn1-schema";
/**
* ```asn1
* DigestInfo ::= SEQUENCE {
* digestAlgorithm DigestAlgorithm,
* digest OCTET STRING
* }
* ```
*/
export declare class DigestInfo {
digestAlgorithm: AlgorithmIdentifier;
digest: OctetString;
constructor(params?: Partial<DigestInfo>);
}
@@ -0,0 +1,8 @@
import * as _heroui_system from '@heroui/system';
import { HTMLHeroUIProps } from '@heroui/system';
interface CardFooterProps extends HTMLHeroUIProps<"div"> {
}
declare const CardFooter: _heroui_system.InternalForwardRefRenderFunction<"div", CardFooterProps, never>;
export { CardFooterProps, CardFooter as default };
@@ -0,0 +1,649 @@
'use strict'
const proc = typeof process === 'object' && process ? process : {
stdout: null,
stderr: null,
}
const EE = require('events')
const Stream = require('stream')
const SD = require('string_decoder').StringDecoder
const EOF = Symbol('EOF')
const MAYBE_EMIT_END = Symbol('maybeEmitEnd')
const EMITTED_END = Symbol('emittedEnd')
const EMITTING_END = Symbol('emittingEnd')
const EMITTED_ERROR = Symbol('emittedError')
const CLOSED = Symbol('closed')
const READ = Symbol('read')
const FLUSH = Symbol('flush')
const FLUSHCHUNK = Symbol('flushChunk')
const ENCODING = Symbol('encoding')
const DECODER = Symbol('decoder')
const FLOWING = Symbol('flowing')
const PAUSED = Symbol('paused')
const RESUME = Symbol('resume')
const BUFFERLENGTH = Symbol('bufferLength')
const BUFFERPUSH = Symbol('bufferPush')
const BUFFERSHIFT = Symbol('bufferShift')
const OBJECTMODE = Symbol('objectMode')
const DESTROYED = Symbol('destroyed')
const EMITDATA = Symbol('emitData')
const EMITEND = Symbol('emitEnd')
const EMITEND2 = Symbol('emitEnd2')
const ASYNC = Symbol('async')
const defer = fn => Promise.resolve().then(fn)
// TODO remove when Node v8 support drops
const doIter = global._MP_NO_ITERATOR_SYMBOLS_ !== '1'
const ASYNCITERATOR = doIter && Symbol.asyncIterator
|| Symbol('asyncIterator not implemented')
const ITERATOR = doIter && Symbol.iterator
|| Symbol('iterator not implemented')
// events that mean 'the stream is over'
// these are treated specially, and re-emitted
// if they are listened for after emitting.
const isEndish = ev =>
ev === 'end' ||
ev === 'finish' ||
ev === 'prefinish'
const isArrayBuffer = b => b instanceof ArrayBuffer ||
typeof b === 'object' &&
b.constructor &&
b.constructor.name === 'ArrayBuffer' &&
b.byteLength >= 0
const isArrayBufferView = b => !Buffer.isBuffer(b) && ArrayBuffer.isView(b)
class Pipe {
constructor (src, dest, opts) {
this.src = src
this.dest = dest
this.opts = opts
this.ondrain = () => src[RESUME]()
dest.on('drain', this.ondrain)
}
unpipe () {
this.dest.removeListener('drain', this.ondrain)
}
// istanbul ignore next - only here for the prototype
proxyErrors () {}
end () {
this.unpipe()
if (this.opts.end)
this.dest.end()
}
}
class PipeProxyErrors extends Pipe {
unpipe () {
this.src.removeListener('error', this.proxyErrors)
super.unpipe()
}
constructor (src, dest, opts) {
super(src, dest, opts)
this.proxyErrors = er => dest.emit('error', er)
src.on('error', this.proxyErrors)
}
}
module.exports = class Minipass extends Stream {
constructor (options) {
super()
this[FLOWING] = false
// whether we're explicitly paused
this[PAUSED] = false
this.pipes = []
this.buffer = []
this[OBJECTMODE] = options && options.objectMode || false
if (this[OBJECTMODE])
this[ENCODING] = null
else
this[ENCODING] = options && options.encoding || null
if (this[ENCODING] === 'buffer')
this[ENCODING] = null
this[ASYNC] = options && !!options.async || false
this[DECODER] = this[ENCODING] ? new SD(this[ENCODING]) : null
this[EOF] = false
this[EMITTED_END] = false
this[EMITTING_END] = false
this[CLOSED] = false
this[EMITTED_ERROR] = null
this.writable = true
this.readable = true
this[BUFFERLENGTH] = 0
this[DESTROYED] = false
}
get bufferLength () { return this[BUFFERLENGTH] }
get encoding () { return this[ENCODING] }
set encoding (enc) {
if (this[OBJECTMODE])
throw new Error('cannot set encoding in objectMode')
if (this[ENCODING] && enc !== this[ENCODING] &&
(this[DECODER] && this[DECODER].lastNeed || this[BUFFERLENGTH]))
throw new Error('cannot change encoding')
if (this[ENCODING] !== enc) {
this[DECODER] = enc ? new SD(enc) : null
if (this.buffer.length)
this.buffer = this.buffer.map(chunk => this[DECODER].write(chunk))
}
this[ENCODING] = enc
}
setEncoding (enc) {
this.encoding = enc
}
get objectMode () { return this[OBJECTMODE] }
set objectMode (om) { this[OBJECTMODE] = this[OBJECTMODE] || !!om }
get ['async'] () { return this[ASYNC] }
set ['async'] (a) { this[ASYNC] = this[ASYNC] || !!a }
write (chunk, encoding, cb) {
if (this[EOF])
throw new Error('write after end')
if (this[DESTROYED]) {
this.emit('error', Object.assign(
new Error('Cannot call write after a stream was destroyed'),
{ code: 'ERR_STREAM_DESTROYED' }
))
return true
}
if (typeof encoding === 'function')
cb = encoding, encoding = 'utf8'
if (!encoding)
encoding = 'utf8'
const fn = this[ASYNC] ? defer : f => f()
// convert array buffers and typed array views into buffers
// at some point in the future, we may want to do the opposite!
// leave strings and buffers as-is
// anything else switches us into object mode
if (!this[OBJECTMODE] && !Buffer.isBuffer(chunk)) {
if (isArrayBufferView(chunk))
chunk = Buffer.from(chunk.buffer, chunk.byteOffset, chunk.byteLength)
else if (isArrayBuffer(chunk))
chunk = Buffer.from(chunk)
else if (typeof chunk !== 'string')
// use the setter so we throw if we have encoding set
this.objectMode = true
}
// handle object mode up front, since it's simpler
// this yields better performance, fewer checks later.
if (this[OBJECTMODE]) {
/* istanbul ignore if - maybe impossible? */
if (this.flowing && this[BUFFERLENGTH] !== 0)
this[FLUSH](true)
if (this.flowing)
this.emit('data', chunk)
else
this[BUFFERPUSH](chunk)
if (this[BUFFERLENGTH] !== 0)
this.emit('readable')
if (cb)
fn(cb)
return this.flowing
}
// at this point the chunk is a buffer or string
// don't buffer it up or send it to the decoder
if (!chunk.length) {
if (this[BUFFERLENGTH] !== 0)
this.emit('readable')
if (cb)
fn(cb)
return this.flowing
}
// fast-path writing strings of same encoding to a stream with
// an empty buffer, skipping the buffer/decoder dance
if (typeof chunk === 'string' &&
// unless it is a string already ready for us to use
!(encoding === this[ENCODING] && !this[DECODER].lastNeed)) {
chunk = Buffer.from(chunk, encoding)
}
if (Buffer.isBuffer(chunk) && this[ENCODING])
chunk = this[DECODER].write(chunk)
// Note: flushing CAN potentially switch us into not-flowing mode
if (this.flowing && this[BUFFERLENGTH] !== 0)
this[FLUSH](true)
if (this.flowing)
this.emit('data', chunk)
else
this[BUFFERPUSH](chunk)
if (this[BUFFERLENGTH] !== 0)
this.emit('readable')
if (cb)
fn(cb)
return this.flowing
}
read (n) {
if (this[DESTROYED])
return null
if (this[BUFFERLENGTH] === 0 || n === 0 || n > this[BUFFERLENGTH]) {
this[MAYBE_EMIT_END]()
return null
}
if (this[OBJECTMODE])
n = null
if (this.buffer.length > 1 && !this[OBJECTMODE]) {
if (this.encoding)
this.buffer = [this.buffer.join('')]
else
this.buffer = [Buffer.concat(this.buffer, this[BUFFERLENGTH])]
}
const ret = this[READ](n || null, this.buffer[0])
this[MAYBE_EMIT_END]()
return ret
}
[READ] (n, chunk) {
if (n === chunk.length || n === null)
this[BUFFERSHIFT]()
else {
this.buffer[0] = chunk.slice(n)
chunk = chunk.slice(0, n)
this[BUFFERLENGTH] -= n
}
this.emit('data', chunk)
if (!this.buffer.length && !this[EOF])
this.emit('drain')
return chunk
}
end (chunk, encoding, cb) {
if (typeof chunk === 'function')
cb = chunk, chunk = null
if (typeof encoding === 'function')
cb = encoding, encoding = 'utf8'
if (chunk)
this.write(chunk, encoding)
if (cb)
this.once('end', cb)
this[EOF] = true
this.writable = false
// if we haven't written anything, then go ahead and emit,
// even if we're not reading.
// we'll re-emit if a new 'end' listener is added anyway.
// This makes MP more suitable to write-only use cases.
if (this.flowing || !this[PAUSED])
this[MAYBE_EMIT_END]()
return this
}
// don't let the internal resume be overwritten
[RESUME] () {
if (this[DESTROYED])
return
this[PAUSED] = false
this[FLOWING] = true
this.emit('resume')
if (this.buffer.length)
this[FLUSH]()
else if (this[EOF])
this[MAYBE_EMIT_END]()
else
this.emit('drain')
}
resume () {
return this[RESUME]()
}
pause () {
this[FLOWING] = false
this[PAUSED] = true
}
get destroyed () {
return this[DESTROYED]
}
get flowing () {
return this[FLOWING]
}
get paused () {
return this[PAUSED]
}
[BUFFERPUSH] (chunk) {
if (this[OBJECTMODE])
this[BUFFERLENGTH] += 1
else
this[BUFFERLENGTH] += chunk.length
this.buffer.push(chunk)
}
[BUFFERSHIFT] () {
if (this.buffer.length) {
if (this[OBJECTMODE])
this[BUFFERLENGTH] -= 1
else
this[BUFFERLENGTH] -= this.buffer[0].length
}
return this.buffer.shift()
}
[FLUSH] (noDrain) {
do {} while (this[FLUSHCHUNK](this[BUFFERSHIFT]()))
if (!noDrain && !this.buffer.length && !this[EOF])
this.emit('drain')
}
[FLUSHCHUNK] (chunk) {
return chunk ? (this.emit('data', chunk), this.flowing) : false
}
pipe (dest, opts) {
if (this[DESTROYED])
return
const ended = this[EMITTED_END]
opts = opts || {}
if (dest === proc.stdout || dest === proc.stderr)
opts.end = false
else
opts.end = opts.end !== false
opts.proxyErrors = !!opts.proxyErrors
// piping an ended stream ends immediately
if (ended) {
if (opts.end)
dest.end()
} else {
this.pipes.push(!opts.proxyErrors ? new Pipe(this, dest, opts)
: new PipeProxyErrors(this, dest, opts))
if (this[ASYNC])
defer(() => this[RESUME]())
else
this[RESUME]()
}
return dest
}
unpipe (dest) {
const p = this.pipes.find(p => p.dest === dest)
if (p) {
this.pipes.splice(this.pipes.indexOf(p), 1)
p.unpipe()
}
}
addListener (ev, fn) {
return this.on(ev, fn)
}
on (ev, fn) {
const ret = super.on(ev, fn)
if (ev === 'data' && !this.pipes.length && !this.flowing)
this[RESUME]()
else if (ev === 'readable' && this[BUFFERLENGTH] !== 0)
super.emit('readable')
else if (isEndish(ev) && this[EMITTED_END]) {
super.emit(ev)
this.removeAllListeners(ev)
} else if (ev === 'error' && this[EMITTED_ERROR]) {
if (this[ASYNC])
defer(() => fn.call(this, this[EMITTED_ERROR]))
else
fn.call(this, this[EMITTED_ERROR])
}
return ret
}
get emittedEnd () {
return this[EMITTED_END]
}
[MAYBE_EMIT_END] () {
if (!this[EMITTING_END] &&
!this[EMITTED_END] &&
!this[DESTROYED] &&
this.buffer.length === 0 &&
this[EOF]) {
this[EMITTING_END] = true
this.emit('end')
this.emit('prefinish')
this.emit('finish')
if (this[CLOSED])
this.emit('close')
this[EMITTING_END] = false
}
}
emit (ev, data, ...extra) {
// error and close are only events allowed after calling destroy()
if (ev !== 'error' && ev !== 'close' && ev !== DESTROYED && this[DESTROYED])
return
else if (ev === 'data') {
return !data ? false
: this[ASYNC] ? defer(() => this[EMITDATA](data))
: this[EMITDATA](data)
} else if (ev === 'end') {
return this[EMITEND]()
} else if (ev === 'close') {
this[CLOSED] = true
// don't emit close before 'end' and 'finish'
if (!this[EMITTED_END] && !this[DESTROYED])
return
const ret = super.emit('close')
this.removeAllListeners('close')
return ret
} else if (ev === 'error') {
this[EMITTED_ERROR] = data
const ret = super.emit('error', data)
this[MAYBE_EMIT_END]()
return ret
} else if (ev === 'resume') {
const ret = super.emit('resume')
this[MAYBE_EMIT_END]()
return ret
} else if (ev === 'finish' || ev === 'prefinish') {
const ret = super.emit(ev)
this.removeAllListeners(ev)
return ret
}
// Some other unknown event
const ret = super.emit(ev, data, ...extra)
this[MAYBE_EMIT_END]()
return ret
}
[EMITDATA] (data) {
for (const p of this.pipes) {
if (p.dest.write(data) === false)
this.pause()
}
const ret = super.emit('data', data)
this[MAYBE_EMIT_END]()
return ret
}
[EMITEND] () {
if (this[EMITTED_END])
return
this[EMITTED_END] = true
this.readable = false
if (this[ASYNC])
defer(() => this[EMITEND2]())
else
this[EMITEND2]()
}
[EMITEND2] () {
if (this[DECODER]) {
const data = this[DECODER].end()
if (data) {
for (const p of this.pipes) {
p.dest.write(data)
}
super.emit('data', data)
}
}
for (const p of this.pipes) {
p.end()
}
const ret = super.emit('end')
this.removeAllListeners('end')
return ret
}
// const all = await stream.collect()
collect () {
const buf = []
if (!this[OBJECTMODE])
buf.dataLength = 0
// set the promise first, in case an error is raised
// by triggering the flow here.
const p = this.promise()
this.on('data', c => {
buf.push(c)
if (!this[OBJECTMODE])
buf.dataLength += c.length
})
return p.then(() => buf)
}
// const data = await stream.concat()
concat () {
return this[OBJECTMODE]
? Promise.reject(new Error('cannot concat in objectMode'))
: this.collect().then(buf =>
this[OBJECTMODE]
? Promise.reject(new Error('cannot concat in objectMode'))
: this[ENCODING] ? buf.join('') : Buffer.concat(buf, buf.dataLength))
}
// stream.promise().then(() => done, er => emitted error)
promise () {
return new Promise((resolve, reject) => {
this.on(DESTROYED, () => reject(new Error('stream destroyed')))
this.on('error', er => reject(er))
this.on('end', () => resolve())
})
}
// for await (let chunk of stream)
[ASYNCITERATOR] () {
const next = () => {
const res = this.read()
if (res !== null)
return Promise.resolve({ done: false, value: res })
if (this[EOF])
return Promise.resolve({ done: true })
let resolve = null
let reject = null
const onerr = er => {
this.removeListener('data', ondata)
this.removeListener('end', onend)
reject(er)
}
const ondata = value => {
this.removeListener('error', onerr)
this.removeListener('end', onend)
this.pause()
resolve({ value: value, done: !!this[EOF] })
}
const onend = () => {
this.removeListener('error', onerr)
this.removeListener('data', ondata)
resolve({ done: true })
}
const ondestroy = () => onerr(new Error('stream destroyed'))
return new Promise((res, rej) => {
reject = rej
resolve = res
this.once(DESTROYED, ondestroy)
this.once('error', onerr)
this.once('end', onend)
this.once('data', ondata)
})
}
return { next }
}
// for (let chunk of stream)
[ITERATOR] () {
const next = () => {
const value = this.read()
const done = value === null
return { value, done }
}
return { next }
}
destroy (er) {
if (this[DESTROYED]) {
if (er)
this.emit('error', er)
else
this.emit(DESTROYED)
return this
}
this[DESTROYED] = true
// throw away all buffered data, it's never coming out
this.buffer.length = 0
this[BUFFERLENGTH] = 0
if (typeof this.close === 'function' && !this[CLOSED])
this.close()
if (er)
this.emit('error', er)
else // if no error to emit, still reject pending promises
this.emit(DESTROYED)
return this
}
static isStream (s) {
return !!s && (s instanceof Minipass || s instanceof Stream ||
s instanceof EE && (
typeof s.pipe === 'function' || // readable
(typeof s.write === 'function' && typeof s.end === 'function') // writable
))
}
}
@@ -0,0 +1,2 @@
import type { ClientRect } from '../../types';
export declare function useRect(element: HTMLElement | null, measure?: (element: HTMLElement) => ClientRect, fallbackRect?: ClientRect | null): ClientRect | null;
@@ -0,0 +1,9 @@
'use strict';
var $abs = require('math-intrinsics/abs');
// https://262.ecma-international.org/11.0/#eqn-abs
module.exports = function abs(x) {
return typeof x === 'bigint' ? BigInt($abs(Number(x))) : $abs(x);
};
@@ -0,0 +1,108 @@
var $6f42661ae0214332$exports = require("./ar-AE.main.js");
var $3e5d289b19f0fad9$exports = require("./bg-BG.main.js");
var $786c35956e916979$exports = require("./cs-CZ.main.js");
var $7166f564b8fa3e8a$exports = require("./da-DK.main.js");
var $12fc5e32bb482de0$exports = require("./de-DE.main.js");
var $84b67ad15c785b2c$exports = require("./el-GR.main.js");
var $86f7e6ba2423a35d$exports = require("./en-US.main.js");
var $67f524d2f2545d56$exports = require("./es-ES.main.js");
var $d8df13f1dbf6e0c4$exports = require("./et-EE.main.js");
var $e2b4dfe2d4d55739$exports = require("./fi-FI.main.js");
var $c06d6698d30993e7$exports = require("./fr-FR.main.js");
var $e775713aa5566057$exports = require("./he-IL.main.js");
var $a972cfeb69a51f5b$exports = require("./hr-HR.main.js");
var $a471da6bb87e6cd1$exports = require("./hu-HU.main.js");
var $47879155027d6c95$exports = require("./it-IT.main.js");
var $9cd8dc003c2209e6$exports = require("./ja-JP.main.js");
var $a490b9448c5f2ded$exports = require("./ko-KR.main.js");
var $99f69e0597841328$exports = require("./lt-LT.main.js");
var $28ac5b31e47d46d4$exports = require("./lv-LV.main.js");
var $d0ae97c9412add8b$exports = require("./nb-NO.main.js");
var $7e5335510891b8c3$exports = require("./nl-NL.main.js");
var $455cb5ebd5f6c27d$exports = require("./pl-PL.main.js");
var $55020c522ee676a2$exports = require("./pt-BR.main.js");
var $cc691e0f35e41c7f$exports = require("./pt-PT.main.js");
var $712b70af9d7e11e9$exports = require("./ro-RO.main.js");
var $c483d9d6d4bcff75$exports = require("./ru-RU.main.js");
var $35bc9f18e7cf9157$exports = require("./sk-SK.main.js");
var $e933d1373d8e91e0$exports = require("./sl-SI.main.js");
var $77463d6521c72512$exports = require("./sr-SP.main.js");
var $6380ab044222ca52$exports = require("./sv-SE.main.js");
var $9cb854f23a6ff322$exports = require("./tr-TR.main.js");
var $912862d79e063c74$exports = require("./uk-UA.main.js");
var $91bb887772fd7ad4$exports = require("./zh-CN.main.js");
var $a33ce76c4b030d83$exports = require("./zh-TW.main.js");
module.exports = {
"ar-AE": $6f42661ae0214332$exports,
"bg-BG": $3e5d289b19f0fad9$exports,
"cs-CZ": $786c35956e916979$exports,
"da-DK": $7166f564b8fa3e8a$exports,
"de-DE": $12fc5e32bb482de0$exports,
"el-GR": $84b67ad15c785b2c$exports,
"en-US": $86f7e6ba2423a35d$exports,
"es-ES": $67f524d2f2545d56$exports,
"et-EE": $d8df13f1dbf6e0c4$exports,
"fi-FI": $e2b4dfe2d4d55739$exports,
"fr-FR": $c06d6698d30993e7$exports,
"he-IL": $e775713aa5566057$exports,
"hr-HR": $a972cfeb69a51f5b$exports,
"hu-HU": $a471da6bb87e6cd1$exports,
"it-IT": $47879155027d6c95$exports,
"ja-JP": $9cd8dc003c2209e6$exports,
"ko-KR": $a490b9448c5f2ded$exports,
"lt-LT": $99f69e0597841328$exports,
"lv-LV": $28ac5b31e47d46d4$exports,
"nb-NO": $d0ae97c9412add8b$exports,
"nl-NL": $7e5335510891b8c3$exports,
"pl-PL": $455cb5ebd5f6c27d$exports,
"pt-BR": $55020c522ee676a2$exports,
"pt-PT": $cc691e0f35e41c7f$exports,
"ro-RO": $712b70af9d7e11e9$exports,
"ru-RU": $c483d9d6d4bcff75$exports,
"sk-SK": $35bc9f18e7cf9157$exports,
"sl-SI": $e933d1373d8e91e0$exports,
"sr-SP": $77463d6521c72512$exports,
"sv-SE": $6380ab044222ca52$exports,
"tr-TR": $9cb854f23a6ff322$exports,
"uk-UA": $912862d79e063c74$exports,
"zh-CN": $91bb887772fd7ad4$exports,
"zh-TW": $a33ce76c4b030d83$exports
};
//# sourceMappingURL=intlStrings.main.js.map
@@ -0,0 +1 @@
{"version":3,"names":["_t","require","_parser","_codeFrame","isCallExpression","isExpressionStatement","isFunction","isIdentifier","isJSXIdentifier","isNewExpression","isPlaceholder","isStatement","isStringLiteral","removePropertiesDeep","traverse","PATTERN","parseAndBuildMetadata","formatter","code","opts","placeholderWhitelist","placeholderPattern","preserveComments","syntacticPlaceholders","ast","parseWithCodeFrame","parser","validate","state","syntactic","placeholders","placeholderNames","Set","legacy","placeholderVisitorHandler","Object","assign","length","node","ancestors","_state$placeholderWhi","name","hasSyntacticPlaceholders","Error","value","test","has","slice","parent","key","type","expectedNode","push","resolve","resolveAncestors","isDuplicate","add","i","index","undefined","parserOpts","plugins","allowAwaitOutsideFunction","allowReturnOutsideFunction","allowNewTargetOutsideFunction","allowSuperOutsideMethod","allowYieldOutsideFunction","sourceType","parse","err","loc","message","codeFrameColumns","start"],"sources":["../src/parse.ts"],"sourcesContent":["import {\n isCallExpression,\n isExpressionStatement,\n isFunction,\n isIdentifier,\n isJSXIdentifier,\n isNewExpression,\n isPlaceholder,\n isStatement,\n isStringLiteral,\n removePropertiesDeep,\n traverse,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport type { TraversalAncestors } from \"@babel/types\";\nimport { parse } from \"@babel/parser\";\nimport { codeFrameColumns } from \"@babel/code-frame\";\nimport type { TemplateOpts, ParserOpts } from \"./options.ts\";\nimport type { Formatter } from \"./formatters.ts\";\n\nexport type Metadata = {\n ast: t.File;\n placeholders: Array<Placeholder>;\n placeholderNames: Set<string>;\n};\n\ntype PlaceholderType = \"string\" | \"param\" | \"statement\" | \"other\";\nexport type Placeholder = {\n name: string;\n resolve: (a: t.File) => { parent: t.Node; key: string; index?: number };\n type: PlaceholderType;\n isDuplicate: boolean;\n};\n\nconst PATTERN = /^[_$A-Z0-9]+$/;\n\nexport default function parseAndBuildMetadata<T>(\n formatter: Formatter<T>,\n code: string,\n opts: TemplateOpts,\n): Metadata {\n const {\n placeholderWhitelist,\n placeholderPattern,\n preserveComments,\n syntacticPlaceholders,\n } = opts;\n\n const ast = parseWithCodeFrame(code, opts.parser, syntacticPlaceholders);\n\n removePropertiesDeep(ast, {\n preserveComments,\n });\n\n formatter.validate(ast);\n\n const state: MetadataState = {\n syntactic: { placeholders: [], placeholderNames: new Set() },\n legacy: { placeholders: [], placeholderNames: new Set() },\n placeholderWhitelist,\n placeholderPattern,\n syntacticPlaceholders,\n };\n\n traverse(ast, placeholderVisitorHandler, state);\n\n return {\n ast,\n ...(state.syntactic.placeholders.length ? state.syntactic : state.legacy),\n };\n}\n\nfunction placeholderVisitorHandler(\n node: t.Node,\n ancestors: TraversalAncestors,\n state: MetadataState,\n) {\n let name: string;\n\n let hasSyntacticPlaceholders = state.syntactic.placeholders.length > 0;\n\n if (isPlaceholder(node)) {\n if (state.syntacticPlaceholders === false) {\n throw new Error(\n \"%%foo%%-style placeholders can't be used when \" +\n \"'.syntacticPlaceholders' is false.\",\n );\n }\n name = node.name.name;\n hasSyntacticPlaceholders = true;\n } else if (hasSyntacticPlaceholders || state.syntacticPlaceholders) {\n return;\n } else if (isIdentifier(node) || isJSXIdentifier(node)) {\n name = node.name;\n } else if (isStringLiteral(node)) {\n name = node.value;\n } else {\n return;\n }\n\n if (\n hasSyntacticPlaceholders &&\n (state.placeholderPattern != null || state.placeholderWhitelist != null)\n ) {\n // This check is also in options.js. We need it there to handle the default\n // .syntacticPlaceholders behavior.\n throw new Error(\n \"'.placeholderWhitelist' and '.placeholderPattern' aren't compatible\" +\n \" with '.syntacticPlaceholders: true'\",\n );\n }\n\n if (\n !hasSyntacticPlaceholders &&\n (state.placeholderPattern === false ||\n !(state.placeholderPattern || PATTERN).test(name)) &&\n !state.placeholderWhitelist?.has(name)\n ) {\n return;\n }\n\n // Keep our own copy of the ancestors so we can use it in .resolve().\n ancestors = ancestors.slice();\n\n const { node: parent, key } = ancestors[ancestors.length - 1];\n\n let type: PlaceholderType;\n if (\n isStringLiteral(node) ||\n isPlaceholder(node, { expectedNode: \"StringLiteral\" })\n ) {\n type = \"string\";\n } else if (\n (isNewExpression(parent) && key === \"arguments\") ||\n (isCallExpression(parent) && key === \"arguments\") ||\n (isFunction(parent) && key === \"params\")\n ) {\n type = \"param\";\n } else if (isExpressionStatement(parent) && !isPlaceholder(node)) {\n type = \"statement\";\n ancestors = Line truncated
@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=DynamicValueBinding.js.map
@@ -0,0 +1,28 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.LookupMatcher = LookupMatcher;
var BestAvailableLocale_1 = require("./BestAvailableLocale");
var utils_1 = require("./utils");
/**
* https://tc39.es/ecma402/#sec-lookupmatcher
* @param availableLocales
* @param requestedLocales
* @param getDefaultLocale
*/
function LookupMatcher(availableLocales, requestedLocales, getDefaultLocale) {
var result = { locale: '' };
for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
var locale = requestedLocales_1[_i];
var noExtensionLocale = locale.replace(utils_1.UNICODE_EXTENSION_SEQUENCE_REGEX, '');
var availableLocale = (0, BestAvailableLocale_1.BestAvailableLocale)(availableLocales, noExtensionLocale);
if (availableLocale) {
result.locale = availableLocale;
if (locale !== noExtensionLocale) {
result.extension = locale.slice(noExtensionLocale.length, locale.length);
}
return result;
}
}
result.locale = getDefaultLocale();
return result;
}
@@ -0,0 +1,60 @@
import { Collection, Key, Node, CollectionStateBase, LayoutDelegate, SingleSelection } from "@react-types/shared";
import { MultipleSelectionStateProps, SelectionManager } from "@react-stately/selection";
export class ListCollection<T> implements Collection<Node<T>> {
constructor(nodes: Iterable<Node<T>>);
[Symbol.iterator](): Generator<Node<T>, void, undefined>;
get size(): number;
getKeys(): IterableIterator<Key>;
getKeyBefore(key: Key): Key | null;
getKeyAfter(key: Key): Key | null;
getFirstKey(): Key | null;
getLastKey(): Key | null;
getItem(key: Key): Node<T> | null;
at(idx: number): Node<T> | null;
getChildren(key: Key): Iterable<Node<T>>;
}
export interface ListProps<T> extends CollectionStateBase<T>, MultipleSelectionStateProps {
/** Filter function to generate a filtered list of nodes. */
filter?: (nodes: Iterable<Node<T>>) => Iterable<Node<T>>;
/** @private */
suppressTextValueWarning?: boolean;
/**
* A delegate object that provides layout information for items in the collection.
* This can be used to override the behavior of shift selection.
*/
layoutDelegate?: LayoutDelegate;
}
export interface ListState<T> {
/** A collection of items in the list. */
collection: Collection<Node<T>>;
/** A set of items that are disabled. */
disabledKeys: Set<Key>;
/** A selection manager to read and update multiple selection state. */
selectionManager: SelectionManager;
}
/**
* Provides state management for list-like components. Handles building a collection
* of items from props, and manages multiple selection state.
*/
export function useListState<T extends object>(props: ListProps<T>): ListState<T>;
export interface SingleSelectListProps<T> extends CollectionStateBase<T>, Omit<SingleSelection, 'disallowEmptySelection'> {
/** Filter function to generate a filtered list of nodes. */
filter?: (nodes: Iterable<Node<T>>) => Iterable<Node<T>>;
/** @private */
suppressTextValueWarning?: boolean;
}
export interface SingleSelectListState<T> extends ListState<T> {
/** The key for the currently selected item. */
readonly selectedKey: Key | null;
/** Sets the selected key. */
setSelectedKey(key: Key | null): void;
/** The value of the currently selected item. */
readonly selectedItem: Node<T> | null;
}
/**
* Provides state management for list-like components with single selection.
* Handles building a collection of items from props, and manages selection state.
*/
export function useSingleSelectListState<T extends object>(props: SingleSelectListProps<T>): SingleSelectListState<T>;
//# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,7 @@
"use strict";
const SourceCode = require("./source-code");
module.exports = {
SourceCode,
};
@@ -0,0 +1,144 @@
import { expect, test } from "vitest";
import * as z from "../index.js";
// lt;
test("z.lt", () => {
const a = z.number().check(z.lt(10));
expect(z.safeParse(a, 9).success).toEqual(true);
expect(z.safeParse(a, 9).data).toEqual(9);
expect(z.safeParse(a, 10).success).toEqual(false);
});
// lte;
test("z.lte", () => {
const a = z.number().check(z.lte(10));
expect(z.safeParse(a, 10).success).toEqual(true);
expect(z.safeParse(a, 10).data).toEqual(10);
expect(z.safeParse(a, 11).success).toEqual(false);
});
// min;
test("z.max", () => {
const a = z.number().check(z.maximum(10));
expect(z.safeParse(a, 10).success).toEqual(true);
expect(z.safeParse(a, 10).data).toEqual(10);
expect(z.safeParse(a, 11).success).toEqual(false);
});
// gt;
test("z.gt", () => {
const a = z.number().check(z.gt(10));
expect(z.safeParse(a, 11).success).toEqual(true);
expect(z.safeParse(a, 11).data).toEqual(11);
expect(z.safeParse(a, 10).success).toEqual(false);
});
// gte;
test("z.gte", () => {
const a = z.number().check(z.gte(10));
expect(z.safeParse(a, 10).success).toEqual(true);
expect(z.safeParse(a, 10).data).toEqual(10);
expect(z.safeParse(a, 9).success).toEqual(false);
});
// min;
test("z.min", () => {
const a = z.number().check(z.minimum(10));
expect(z.safeParse(a, 10).success).toEqual(true);
expect(z.safeParse(a, 10).data).toEqual(10);
expect(z.safeParse(a, 9).success).toEqual(false);
});
// maxSize;
test("z.maxLength", () => {
const a = z.array(z.string()).check(z.maxLength(3));
expect(z.safeParse(a, ["a", "b", "c"]).success).toEqual(true);
expect(z.safeParse(a, ["a", "b", "c", "d"]).success).toEqual(false);
});
// minSize;
test("z.minLength", () => {
const a = z.array(z.string()).check(z.minLength(3));
expect(z.safeParse(a, ["a", "b"]).success).toEqual(false);
expect(z.safeParse(a, ["a", "b", "c"]).success).toEqual(true);
});
// size;
test("z.length", () => {
const a = z.array(z.string()).check(z.length(3));
expect(z.safeParse(a, ["a", "b"]).success).toEqual(false);
expect(z.safeParse(a, ["a", "b", "c"]).success).toEqual(true);
expect(z.safeParse(a, ["a", "b", "c", "d"]).success).toEqual(false);
});
// regex;
test("z.regex", () => {
const a = z.string().check(z.regex(/^aaa$/));
expect(z.safeParse(a, "aaa")).toMatchObject({ success: true, data: "aaa" });
expect(z.safeParse(a, "aa")).toMatchObject({ success: false });
});
// includes;
test("z.includes", () => {
const a = z.string().check(z.includes("asdf"));
z.parse(a, "qqqasdfqqq");
z.parse(a, "asdf");
z.parse(a, "qqqasdf");
z.parse(a, "asdfqqq");
expect(z.safeParse(a, "qqq")).toMatchObject({ success: false });
});
// startsWith;
test("z.startsWith", () => {
const a = z.string().check(z.startsWith("asdf"));
z.parse(a, "asdf");
z.parse(a, "asdfqqq");
expect(z.safeParse(a, "qqq")).toMatchObject({ success: false });
});
// endsWith;
test("z.endsWith", () => {
const a = z.string().check(z.endsWith("asdf"));
z.parse(a, "asdf");
z.parse(a, "qqqasdf");
expect(z.safeParse(a, "asdfqqq")).toMatchObject({ success: false });
});
// lowercase;
test("z.lowercase", () => {
const a = z.string().check(z.lowercase());
z.parse(a, "asdf");
expect(z.safeParse(a, "ASDF")).toMatchObject({ success: false });
});
// uppercase;
test("z.uppercase", () => {
const a = z.string().check(z.uppercase());
z.parse(a, "ASDF");
expect(z.safeParse(a, "asdf")).toMatchObject({ success: false });
});
// filename;
// fileType;
// overwrite;
test("z.overwrite", () => {
const a = z.string().check(z.overwrite((val) => val.toUpperCase()));
expect(z.safeParse(a, "asdf")).toMatchObject({ data: "ASDF" });
});
// normalize;
// trim;
// toLowerCase;
// toUpperCase;
// property
test("abort early", () => {
const schema = z.string().check(
z.refine((val) => val.length > 1),
z.refine((val) => val.length > 2, { abort: true }),
z.refine((val) => val.length > 3)
);
const data = "";
const result = z.safeParse(schema, data);
expect(result.error!.issues.length).toEqual(2);
});
@@ -0,0 +1,30 @@
import * as _heroui_system from '@heroui/system';
import { HTMLHeroUIProps } from '@heroui/system';
import { GridNode } from '@react-types/grid';
import { ValuesType } from './use-table.js';
import '@react-types/table';
import 'react';
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 TableSelectAllCheckboxProps<T = object> extends HTMLHeroUIProps<"th"> {
/**
* The table column.
*/
node: GridNode<T>;
slots: ValuesType["slots"];
state: ValuesType["state"];
color: ValuesType["color"];
disableAnimation: ValuesType["disableAnimation"];
checkboxesProps: ValuesType["checkboxesProps"];
selectionMode: ValuesType["selectionMode"];
classNames?: ValuesType["classNames"];
}
declare const TableSelectAllCheckbox: _heroui_system.InternalForwardRefRenderFunction<"th", TableSelectAllCheckboxProps<object>, never>;
export { type TableSelectAllCheckboxProps, TableSelectAllCheckbox as default };
@@ -0,0 +1 @@
{"version":3,"file":"decodeClientDataJSON.d.ts","sourceRoot":"","sources":["../../src/helpers/decodeClientDataJSON.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGzD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,eAAe,GAAG,cAAc,CAK1E;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE;QACb,EAAE,CAAC,EAAE,MAAM,CAAC;QACZ,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,eAAe,CAAC;KACnD,CAAC;CACH,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,8BAA8B;sBACvB,cAAc;CACjC,CAAC"}
@@ -0,0 +1,365 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@typescript-eslint/utils");
const tsutils = __importStar(require("ts-api-utils"));
const util_1 = require("../util");
const promiseUtils_1 = require("../util/promiseUtils");
const messageBase = 'Promises must be awaited, end with a call to .catch, or end with a call to .then with a rejection handler.';
const messageBaseVoid = 'Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler' +
' or be explicitly marked as ignored with the `void` operator.';
const messageRejectionHandler = 'A rejection handler that is not a function will be ignored.';
const messagePromiseArray = "An array of Promises may be unintentional. Consider handling the promises' fulfillment or rejection with Promise.all or similar.";
const messagePromiseArrayVoid = "An array of Promises may be unintentional. Consider handling the promises' fulfillment or rejection with Promise.all or similar," +
' or explicitly marking the expression as ignored with the `void` operator.';
exports.default = (0, util_1.createRule)({
name: 'no-floating-promises',
meta: {
type: 'problem',
docs: {
description: 'Require Promise-like statements to be handled appropriately',
recommended: 'recommended',
requiresTypeChecking: true,
},
hasSuggestions: true,
messages: {
floating: messageBase,
floatingFixAwait: 'Add await operator.',
floatingFixVoid: 'Add void operator to ignore.',
floatingPromiseArray: messagePromiseArray,
floatingPromiseArrayVoid: messagePromiseArrayVoid,
floatingUselessRejectionHandler: `${messageBase} ${messageRejectionHandler}`,
floatingUselessRejectionHandlerVoid: `${messageBaseVoid} ${messageRejectionHandler}`,
floatingVoid: messageBaseVoid,
},
schema: [
{
type: 'object',
additionalProperties: false,
properties: {
allowForKnownSafeCalls: {
...util_1.readonlynessOptionsSchema.properties.allow,
description: 'Type specifiers of functions whose calls are safe to float.',
},
allowForKnownSafePromises: {
...util_1.readonlynessOptionsSchema.properties.allow,
description: 'Type specifiers that are known to be safe to float.',
},
checkThenables: {
type: 'boolean',
description: 'Whether to check all "Thenable"s, not just the built-in Promise type.',
},
ignoreIIFE: {
type: 'boolean',
description: 'Whether to ignore async IIFEs (Immediately Invoked Function Expressions).',
},
ignoreVoid: {
type: 'boolean',
description: 'Whether to ignore `void` expressions.',
},
},
},
],
},
defaultOptions: [
{
allowForKnownSafeCalls: util_1.readonlynessOptionsDefaults.allow,
allowForKnownSafePromises: util_1.readonlynessOptionsDefaults.allow,
checkThenables: false,
ignoreIIFE: false,
ignoreVoid: true,
},
],
create(context, [options]) {
const services = (0, util_1.getParserServices)(context);
const checker = services.program.getTypeChecker();
const { checkThenables } = options;
// TODO: #5439
/* eslint-disable @typescript-eslint/no-non-null-assertion */
const allowForKnownSafePromises = options.allowForKnownSafePromises;
const allowForKnownSafeCalls = options.allowForKnownSafeCalls;
/* eslint-enable @typescript-eslint/no-non-null-assertion */
return {
ExpressionStatement(node) {
if (options.ignoreIIFE && isAsyncIife(node)) {
return;
}
const expression = (0, util_1.skipChainExpression)(node.expression);
if (isKnownSafePromiseCall(expression)) {
return;
}
const { isUnhandled, nonFunctionHandler, promiseArray } = isUnhandledPromise(checker, expression);
if (isUnhandled) {
if (promiseArray) {
context.report({
node,
messageId: options.ignoreVoid
? 'floatingPromiseArrayVoid'
: 'floatingPromiseArray',
});
}
else if (options.ignoreVoid) {
context.report({
node,
messageId: nonFunctionHandler
? 'floatingUselessRejectionHandlerVoid'
: 'floatingVoid',
suggest: [
{
messageId: 'floatingFixVoid',
fix(fixer) {
if ((0, util_1.isParenthesized)(expression, context.sourceCode) ||
(0, util_1.getOperatorPrecedenceForNode)(expression) >
util_1.OperatorPrecedence.Unary) {
return fixer.insertTextBefore(node, 'void ');
}
return [
fixer.insertTextBefore(node, 'void ('),
fixer.insertTextAfterRange([expression.range[1], expression.range[1]], ')'),
];
},
},
{
messageId: 'floatingFixAwait',
fix: (fixer) => addAwait(fixer, expression, node),
},
],
});
}
else {
context.report({
node,
messageId: nonFunctionHandler
? 'floatingUselessRejectionHandler'
: 'floating',
suggest: [
{
messageId: 'floatingFixAwait',
fix: (fixer) => addAwait(fixer, expression, node),
},
],
});
}
}
},
};
function addAwait(fixer, expression, node) {
if (expression.type === utils_1.AST_NODE_TYPES.UnaryExpression &&
expression.operator === 'void') {
return fixer.replaceTextRange([expression.range[0], expression.range[0] + 4], 'await');
}
if ((0, util_1.isParenthesized)(expression, context.sourceCode) ||
(0, util_1.getOperatorPrecedenceForNode)(expression) > util_1.OperatorPrecedence.Unary) {
return fixer.insertTextBefore(node, 'await ');
}
return [
fixer.insertTextBefore(node, 'await ('),
fixer.insertTextAfterRange([expression.range[1], expression.range[1]], ')'),
];
}
function isKnownSafePromiseCall(node) {
if (node.type !== utils_1.AST_NODE_TYPES.CallExpression) {
return false;
}
const type = services.getTypeAtLocation(node.callee);
if ((0, util_1.valueMatchesSomeSpecifier)(node.callee, allowForKnownSafeCalls, services.program, type)) {
return true;
}
return (0, util_1.typeMatchesSomeSpecifier)(type, allowForKnownSafeCalls, services.program);
}
function isAsyncIife(node) {
if (node.expression.type !== utils_1.AST_NODE_TYPES.CallExpression) {
return false;
}
return (node.expression.callee.type ===
utils_1.AST_NODE_TYPES.ArrowFunctionExpression ||
node.expression.callee.type === utils_1.AST_NODE_TYPES.FunctionExpression);
}
function isValidRejectionHandler(rejectionHandler) {
return (services.program
.getTypeChecker()
.getTypeAtLocation(services.esTreeNodeToTSNodeMap.get(rejectionHandler))
.getCallSignatures().length > 0);
}
function isUnhandledPromise(checker, node) {
if (node.type === utils_1.AST_NODE_TYPES.AssignmentExpression) {
return { isUnhandled: false };
}
// First, check expressions whose resulting types may not be promise-like
if (node.type === utils_1.AST_NODE_TYPES.SequenceExpression) {
// Any child in a comma expression could return a potentially unhandled
// promise, so we check them all regardless of whether the final returned
// value is promise-like.
return (node.expressions
.map(item => isUnhandledPromise(checker, item))
.find(result => result.isUnhandled) ?? { isUnhandled: false });
}
if (!options.ignoreVoid &&
node.type === utils_1.AST_NODE_TYPES.UnaryExpression &&
node.operator === 'void') {
// Similarly, a `void` expression always returns undefined, so we need to
// see what's inside it without checking the type of the overall expression.
return isUnhandledPromise(checker, node.argument);
}
const tsNode = services.esTreeNodeToTSNodeMap.get(node);
// Check the type. At this point it can't be unhandled if it isn't a promise
// or array thereof.
if (isPromiseArray(tsNode)) {
return { isUnhandled: true, promiseArray: true };
}
// await expression addresses promises, but not promise arrays.
if (node.type === utils_1.AST_NODE_TYPES.AwaitExpression) {
// you would think this wouldn't be strictly necessary, since we're
// anyway checking the type of the expression, but, unfortunately TS
// reports the result of `await (promise as Promise<number> & number)`
// as `Promise<number> & number` instead of `number`.
return { isUnhandled: false };
}
if (!isPromiseLike(tsNode)) {
return { isUnhandled: false };
}
if (node.type === utils_1.AST_NODE_TYPES.CallExpression) {
// If the outer expression is a call, a `.catch()` or `.then()` with
// rejection handler handles the promise.
const promiseHandlingMethodCall = (0, promiseUtils_1.parseCatchCall)(node, context) ?? (0, promiseUtils_1.parseThenCall)(node, context);
if (promiseHandlingMethodCall != null) {
const onRejected = promiseHandlingMethodCall.onRejected;
if (onRejected != null) {
if (isValidRejectionHandler(onRejected)) {
return { isUnhandled: false };
}
return { isUnhandled: true, nonFunctionHandler: true };
}
return { isUnhandled: true };
}
const promiseFinallyCall = (0, promiseUtils_1.parseFinallyCall)(node, context);
if (promiseFinallyCall != null) {
return isUnhandledPromise(checker, promiseFinallyCall.object);
}
// All other cases are unhandled.
return { isUnhandled: true };
}
if (node.type === utils_1.AST_NODE_TYPES.ConditionalExpression) {
// We must be getting the promise-like value from one of the branches of the
// ternary. Check them directly.
const alternateResult = isUnhandledPromise(checker, node.alternate);
if (alternateResult.isUnhandled) {
return alternateResult;
}
return isUnhandledPromise(checker, node.consequent);
}
if (node.type === utils_1.AST_NODE_TYPES.LogicalExpression) {
const leftResult = isUnhandledPromise(checker, node.left);
if (leftResult.isUnhandled) {
return leftResult;
}
return isUnhandledPromise(checker, node.right);
}
// Anything else is unhandled.
return { isUnhandled: true };
}
function isPromiseArray(node) {
const type = checker.getTypeAtLocation(node);
for (const ty of tsutils
.unionConstituents(type)
.map(t => checker.getApparentType(t))) {
if (checker.isArrayType(ty)) {
const arrayType = checker.getTypeArguments(ty)[0];
if (isPromiseLike(node, arrayType)) {
return true;
}
}
if (checker.isTupleType(ty)) {
for (const tupleElementType of checker.getTypeArguments(ty)) {
if (isPromiseLike(node, tupleElementType)) {
return true;
}
}
}
}
return false;
}
function isPromiseLike(node, type) {
type ??= checker.getTypeAtLocation(node);
// The highest priority is to allow anything allowlisted
if ((0, util_1.typeMatchesSomeSpecifier)(type, allowForKnownSafePromises, services.program)) {
return false;
}
// Otherwise, we always consider the built-in Promise to be Promise-like...
const typeParts = tsutils.unionConstituents(checker.getApparentType(type));
if (typeParts.some(typePart => (0, util_1.isBuiltinSymbolLike)(services.program, typePart, 'Promise'))) {
return true;
}
// ...and only check all Thenables if explicitly told to
if (!checkThenables) {
return false;
}
// Modified from tsutils.isThenable() to only consider thenables which can be
// rejected/caught via a second parameter. Original source (MIT licensed):
//
// https://github.com/ajafff/tsutils/blob/49d0d31050b44b81e918eae4fbaf1dfe7b7286af/util/type.ts#L95-L125
for (const ty of typeParts) {
const then = ty.getProperty('then');
if (then == null) {
continue;
}
const thenType = checker.getTypeOfSymbolAtLocation(then, node);
if (hasMatchingSignature(thenType, signature => signature.parameters.length >= 2 &&
isFunctionParam(checker, signature.parameters[0], node) &&
isFunctionParam(checker, signature.parameters[1], node))) {
return true;
}
}
return false;
}
},
});
function hasMatchingSignature(type, matcher) {
for (const t of tsutils.unionConstituents(type)) {
if (t.getCallSignatures().some(matcher)) {
return true;
}
}
return false;
}
function isFunctionParam(checker, param, node) {
const type = checker.getApparentType(checker.getTypeOfSymbolAtLocation(param, node));
for (const t of tsutils.unionConstituents(type)) {
if (t.getCallSignatures().length !== 0) {
return true;
}
}
return false;
}
@@ -0,0 +1 @@
{"name":"react-dom","version":"19.2.0","requiresBuild":false,"files":{"LICENSE":{"checkedAt":1794532104111,"integrity":"sha512-O4KI5drJltpEvYGw6x2WkFxLkK2RVPPSnQc8lokLdc0oH6A68Ld/Mx2+wjnTQTY7X5syi6/qDUuNCj6QDRUPgA==","mode":420,"size":1088},"client.js":{"checkedAt":1794532104111,"integrity":"sha512-d4wn5f1byiV7ZX9Gl6BQI1u63cTvttFQjnTTqYpDvFR8ExBswoBHSz/dZzzOWbRQqNCnC5oW0lEaF1eqOduA9g==","mode":420,"size":1373},"client.react-server.js":{"checkedAt":1794532104111,"integrity":"sha512-+hpMgbxj9ckf7EhQLfIAiPZi4//L/XxaJQP5ky+Jy3xqMMLYumDSddc58fH1E5B7xQP+9DIvv2GcmDBKfvISvw==","mode":420,"size":101},"index.js":{"checkedAt":1794532104111,"integrity":"sha512-e3jUjb8rboR7W6PaqSLbBEg6bRxQEu8qp79DJ0QdplzEnuXJnI2RQV8LFAvFV+GAeWIBJ5zniAVHGXA6l4Cfxg==","mode":420,"size":1359},"profiling.js":{"checkedAt":1794532104112,"integrity":"sha512-2408ezQSVntK4iIcFz8b1waRS4f/9jW564EDvhR8asXgyw8rUVS6Y3+FoFf8etDlceMZhKW/3fo0+MyuMKzbgQ==","mode":420,"size":1378},"profiling.react-server.js":{"checkedAt":1794532104112,"integrity":"sha512-A/xsanPqgIElklOeF/xFiRfWWKNEXNnM84kbeCNBAnNxeJIn8dAHab6D3LcvQ7kWiMJhUfBR5jAtQItxNzSO5Q==","mode":420,"size":104},"cjs/react-dom-client.development.js":{"checkedAt":1794532104114,"integrity":"sha512-Jl0D0Z4MHZt3QLTqVeu2Q5rl7uZR7Vb2Xf4gOCiWCJUnFmMRW23xnpUy12EWxRmgk3K5/sb1VBgnKIj4lIPTZw==","mode":420,"size":1065698},"cjs/react-dom-client.production.js":{"checkedAt":1794532104116,"integrity":"sha512-Bl/gTTn+S9Mevt7LfqjYvfZPHxC0gjaphNEDrqkzXpZeccsU5PiBj2cyiaKi4JnZpCzbew/4Wj6UytzpF9O8yw==","mode":420,"size":536016},"cjs/react-dom-profiling.development.js":{"checkedAt":1794532104118,"integrity":"sha512-6MYcwNkVRyN8MuI8H8L+2zrheTCMAaE394YVSCFClxJdfmZIydT7zlYZBvefYzIhNNjkTCVaXFdsdXWGYvBrEg==","mode":420,"size":1082082},"cjs/react-dom-profiling.profiling.js":{"checkedAt":1794532104119,"integrity":"sha512-tQjr4ILz3WiohKfbEgOo+VHIQKb4s0wv2fJhhtSlHxgULsMQ+vyjqgky+zkH9OvtOdjNq2LiOfm8Zn5XqhrRPg==","mode":420,"size":607634},"cjs/react-dom-server-legacy.browser.development.js":{"checkedAt":1794532104120,"integrity":"sha512-BFMuHtJ8VZDslMmaIqIo7FImDi+Uo03PIZJE/yMd1l637tjE3yoCflOOpdxJWM/FkW8C18HV82hP5YEi3XuRjA==","mode":420,"size":395197},"cjs/react-dom-server-legacy.browser.production.js":{"checkedAt":1794532104121,"integrity":"sha512-tZ01zFLxx1Vkfg9tHdkVqtxcTvewBneYpH23RQWMcjbnQ9w5kQZX43ydUF9ZXprkM1C6MXNn/kb3OrYNH8r7iw==","mode":420,"size":237937},"cjs/react-dom-server-legacy.node.development.js":{"checkedAt":1794532104122,"integrity":"sha512-S4GV9WINT7JB02lsHRE8s/myqZdLi55MBaZ/Gpc9kBarHojiNelUj7PWLuZLGNZw1Cq9aUrZQnyhN113FpJkkg==","mode":420,"size":395194},"cjs/react-dom-server-legacy.node.production.js":{"checkedAt":1794532104122,"integrity":"sha512-gTX8KBiEZdltRbr2KWWgDv6F2lT1cSc8Jn/aD+4yJNlFi2wYUvY6sZnZrkMKNJyEyrSouw47GgaKPibZTrFAiQ==","mode":420,"size":242793},"cjs/react-dom-server.browser.development.js":{"checkedAt":1794532104124,"integrity":"sha512-C3GS/JWdWRDVms4VxWMkT07UQBaENXXZY2+VhG5IGq322Wgd4kDD7P2gkH+QyEmcjrTEhfZS+TCXjHHeoajbHg==","mode":420,"size":424658},"cjs/react-dom-server.browser.production.js":{"checkedAt":1794532104124,"integrity":"sha512-2+fETw4VITM/k/T7QNcx4VRzW7SnSutd4Wmak1no20DQIFJQgnYV4ro3irITKSGoJKV0FYoQJCDWeADlcWx7Aw==","mode":420,"size":268058},"cjs/react-dom-server.bun.development.js":{"checkedAt":1794532104126,"integrity":"sha512-XQU88ANT8aJ4BJyIs6V0Z71MDU92DIrfz4o9IFT+qDVilH1vj5t/wqIRvQb9IP+cpYUPjHGgNsFFrYNzbyGefA==","mode":420,"size":354659},"cjs/react-dom-server.bun.production.js":{"checkedAt":1794532104127,"integrity":"sha512-630L06mMUMvANI6K9Cx4vE73ZhTRnYZQ+fA6o3hS6ZXJQ8Hm0MGJd0rUfWFHu1gKv0KM664NUvYaOb1sc3MCWg==","mode":420,"size":245324},"cjs/react-dom-server.edge.development.js":{"checkedAt":1794532104129,"integrity":"sha512-IfDJ99MqD1xMd4iEzE46v2E4s7T0p4km4Bt/kSr+SXeHn8KNjnFNe37fw9rWHjZeoxzkLYF9olBLkngfQiFmVg==","mode":420,"size":425439},"cjs/react-dom-server.edge.production.js":{"checkedAt":1794532104130,"integrity":"sha512-p3qFpnq0e9/XQlaosExKHoeD5SKFi/tLzzCxF66MIFipX13YOJbTnWr0Y+gJT8ZYCjICaRRxZxWbv/VYo/jyUw==","mode":420,"size":273614},"cjs/react-dom-server.node.development.js":{"checkedAt":1794532104131,"integrity":"sha512-vDWDxAYH9hkEydp6ApjSsDaoETjs+cFNE6uFYStsgKyzwb4FHueacDaQ0KIk6xWRm1WHnSokmbZXQDcgXIq+WQ==","mode":420,"size":429423},"cjs/react-dom-server.node.production.js":{"checkedAt":1794532104132,"integrity":"sha512-nS+JnIgyVzEoFbg3UI0v4jBrSWX5X5hBCmDerxdXPcDRxp9WnulvBUl438Y5vjpyTBm7WY+Wyjv2bycJOmfVHA==","mode":420,"size":277046},"cjs/react-dom-test-utils.development.js":{"checkedAt":1794532104132,"integrity":"sha512-WXOi4X8urnIYjwhn0/ettuwKqfPkRU/SKLAds31Ovg5w/cL3iy7GWQh8DdbUx1afVOJUwhU48fDqX1prORciCQ==","mode":420,"size":793},"cjs/react-dom-test-utils.production.js":{"checkedAt":1794532104132,"integrity":"sha512-jkoqaAph1QG0Rsi5v6QFKgNiVbYZAAHnJAMKrsaEng593GKYE7QdBtHNvNEnyJXhBy7MahqaZvPLT30h+DAZig==","mode":420,"size":686},"cjs/react-dom.development.js":{"checkedAt":1794532104133,"integrity":"sha512-yQWDtPOwvPd0M4DWdjZPP4JErVWQptYfw2g4YWcfHu9qUr5xYrU0aN7P1fWFG4Ezl5WwwuLine truncated
@@ -0,0 +1 @@
{"version":3,"file":"sortable.cjs.development.js","sources":["../src/utilities/arrayMove.ts","../src/utilities/arraySwap.ts","../src/utilities/getSortedRects.ts","../src/utilities/isValidIndex.ts","../src/utilities/itemsEqual.ts","../src/utilities/normalizeDisabled.ts","../src/strategies/horizontalListSorting.ts","../src/strategies/rectSorting.ts","../src/strategies/rectSwapping.ts","../src/strategies/verticalListSorting.ts","../src/components/SortableContext.tsx","../src/hooks/defaults.ts","../src/hooks/utilities/useDerivedTransform.ts","../src/hooks/useSortable.ts","../src/types/type-guard.ts","../src/sensors/keyboard/sortableKeyboardCoordinates.ts"],"sourcesContent":["/**\n * Move an array item to a different position. Returns a new array with the item moved to the new position.\n */\nexport function arrayMove<T>(array: T[], from: number, to: number): T[] {\n const newArray = array.slice();\n newArray.splice(\n to < 0 ? newArray.length + to : to,\n 0,\n newArray.splice(from, 1)[0]\n );\n\n return newArray;\n}\n","/**\n * Swap an array item to a different position. Returns a new array with the item swapped to the new position.\n */\nexport function arraySwap<T>(array: T[], from: number, to: number): T[] {\n const newArray = array.slice();\n\n newArray[from] = array[to];\n newArray[to] = array[from];\n\n return newArray;\n}\n","import type {\n ClientRect,\n UniqueIdentifier,\n UseDndContextReturnValue,\n} from '@dnd-kit/core';\n\nexport function getSortedRects(\n items: UniqueIdentifier[],\n rects: UseDndContextReturnValue['droppableRects']\n) {\n return items.reduce<ClientRect[]>((accumulator, id, index) => {\n const rect = rects.get(id);\n\n if (rect) {\n accumulator[index] = rect;\n }\n\n return accumulator;\n }, Array(items.length));\n}\n","export function isValidIndex(index: number | null): index is number {\n return index !== null && index >= 0;\n}\n","import type {UniqueIdentifier} from '@dnd-kit/core';\n\nexport function itemsEqual(a: UniqueIdentifier[], b: UniqueIdentifier[]) {\n if (a === b) {\n return true;\n }\n\n if (a.length !== b.length) {\n return false;\n }\n\n for (let i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n\n return true;\n}\n","import type {Disabled} from '../types';\n\nexport function normalizeDisabled(disabled: boolean | Disabled): Disabled {\n if (typeof disabled === 'boolean') {\n return {\n draggable: disabled,\n droppable: disabled,\n };\n }\n\n return disabled;\n}\n","import type {ClientRect} from '@dnd-kit/core';\nimport type {SortingStrategy} from '../types';\n\n// To-do: We should be calculating scale transformation\nconst defaultScale = {\n scaleX: 1,\n scaleY: 1,\n};\n\nexport const horizontalListSortingStrategy: SortingStrategy = ({\n rects,\n activeNodeRect: fallbackActiveRect,\n activeIndex,\n overIndex,\n index,\n}) => {\n const activeNodeRect = rects[activeIndex] ?? fallbackActiveRect;\n\n if (!activeNodeRect) {\n return null;\n }\n\n const itemGap = getItemGap(rects, index, activeIndex);\n\n if (index === activeIndex) {\n const newIndexRect = rects[overIndex];\n\n if (!newIndexRect) {\n return null;\n }\n\n return {\n x:\n activeIndex < overIndex\n ? newIndexRect.left +\n newIndexRect.width -\n (activeNodeRect.left + activeNodeRect.width)\n : newIndexRect.left - activeNodeRect.left,\n y: 0,\n ...defaultScale,\n };\n }\n\n if (index > activeIndex && index <= overIndex) {\n return {\n x: -activeNodeRect.width - itemGap,\n y: 0,\n ...defaultScale,\n };\n }\n\n if (index < activeIndex && index >= overIndex) {\n return {\n x: activeNodeRect.width + itemGap,\n y: 0,\n ...defaultScale,\n };\n }\n\n return {\n x: 0,\n y: 0,\n ...defaultScale,\n };\n};\n\nfunction getItemGap(rects: ClientRect[], index: number, activeIndex: number) {\n const currentRect: ClientRect | undefined = rects[index];\n const previousRect: ClientRect | undefined = rects[index - 1];\n const nextRect: ClientRect | undefined = rects[index + 1];\n\n if (!currentRect || (!previousRect && !nextRect)) {\n return 0;\n }\n\n if (activeIndex < index) {\n return previousRect\n ? currentRect.left - (previousRect.left + previousRect.width)\n : nextRect.left - (currentRect.left + currentRect.width);\n }\n\n return nextRect\n ? nextRect.left - (currentRect.left + currentRect.width)\n : currentRect.left - (previousRect.left + previousRect.width);\n}\n","import {arrayMove} from '../utilities';\nimport type {SortingStrategy} from '../types';\n\nexport const rectSortingStrategy: SortingStrategy = ({\n rects,\n activeIndex,\n overIndex,\n index,\n}) => {\n const newRects = arrayMove(rects, overIndex, activeIndex);\n\n const oldRect = rects[index];\n const newRect = newRects[index];\n\n if (!newRect || !oldRect) {\Line truncated
@@ -0,0 +1,38 @@
import { OneBotAction } from '../../action/OneBotAction';
import { Static } from '@sinclair/typebox';
export declare const GetDoubtFriendsAddRequestPayloadSchema: import("@sinclair/typebox").TObject<{
count: import("@sinclair/typebox").TNumber;
}>;
export type GetDoubtFriendsAddRequestPayload = Static<typeof GetDoubtFriendsAddRequestPayloadSchema>;
export declare class GetDoubtFriendsAddRequest extends OneBotAction<GetDoubtFriendsAddRequestPayload, any> {
actionName: "get_doubt_friends_add_request";
payloadSchema: import("@sinclair/typebox").TObject<{
count: import("@sinclair/typebox").TNumber;
}>;
returnSchema: import("@sinclair/typebox").TAny;
actionSummary: string;
actionDescription: string;
actionTags: string[];
payloadExample: {
count: number;
};
returnExample: {
user_id: number;
nickname: string;
age: number;
sex: string;
reason: string;
flag: string;
}[];
_handle(payload: GetDoubtFriendsAddRequestPayload): Promise<{
flag: string;
uin: string;
nick: string;
source: string;
reason: string;
msg: string;
group_code: string;
time: string;
type: string;
}[]>;
}
@@ -0,0 +1,37 @@
"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/checkbox-group-context.ts
var checkbox_group_context_exports = {};
__export(checkbox_group_context_exports, {
CheckboxGroupProvider: () => CheckboxGroupProvider,
useCheckboxGroupContext: () => useCheckboxGroupContext
});
module.exports = __toCommonJS(checkbox_group_context_exports);
var import_react_utils = require("@heroui/react-utils");
var [CheckboxGroupProvider, useCheckboxGroupContext] = (0, import_react_utils.createContext)({
name: "CheckboxGroupContext",
strict: false
});
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
CheckboxGroupProvider,
useCheckboxGroupContext
});
@@ -0,0 +1,267 @@
'use strict';
module.exports = {
emptyTestCases: [
{
input: '&',
withEmptyKeys: {},
stringifyOutput: {
brackets: '',
indices: '',
repeat: ''
},
noEmptyKeys: {}
},
{
input: '&&',
withEmptyKeys: {},
stringifyOutput: {
brackets: '',
indices: '',
repeat: ''
},
noEmptyKeys: {}
},
{
input: '&=',
withEmptyKeys: { '': '' },
stringifyOutput: {
brackets: '=',
indices: '=',
repeat: '='
},
noEmptyKeys: {}
},
{
input: '&=&',
withEmptyKeys: { '': '' },
stringifyOutput: {
brackets: '=',
indices: '=',
repeat: '='
},
noEmptyKeys: {}
},
{
input: '&=&=',
withEmptyKeys: { '': ['', ''] },
stringifyOutput: {
brackets: '[]=&[]=',
indices: '[0]=&[1]=',
repeat: '=&='
},
noEmptyKeys: {}
},
{
input: '&=&=&',
withEmptyKeys: { '': ['', ''] },
stringifyOutput: {
brackets: '[]=&[]=',
indices: '[0]=&[1]=',
repeat: '=&='
},
noEmptyKeys: {}
},
{
input: '=',
withEmptyKeys: { '': '' },
noEmptyKeys: {},
stringifyOutput: {
brackets: '=',
indices: '=',
repeat: '='
}
},
{
input: '=&',
withEmptyKeys: { '': '' },
stringifyOutput: {
brackets: '=',
indices: '=',
repeat: '='
},
noEmptyKeys: {}
},
{
input: '=&&&',
withEmptyKeys: { '': '' },
stringifyOutput: {
brackets: '=',
indices: '=',
repeat: '='
},
noEmptyKeys: {}
},
{
input: '=&=&=&',
withEmptyKeys: { '': ['', '', ''] },
stringifyOutput: {
brackets: '[]=&[]=&[]=',
indices: '[0]=&[1]=&[2]=',
repeat: '=&=&='
},
noEmptyKeys: {}
},
{
input: '=&a[]=b&a[1]=c',
withEmptyKeys: { '': '', a: ['b', 'c'] },
stringifyOutput: {
brackets: '=&a[]=b&a[]=c',
indices: '=&a[0]=b&a[1]=c',
repeat: '=&a=b&a=c'
},
noEmptyKeys: { a: ['b', 'c'] }
},
{
input: '=a',
withEmptyKeys: { '': 'a' },
noEmptyKeys: {},
stringifyOutput: {
brackets: '=a',
indices: '=a',
repeat: '=a'
}
},
{
input: 'a==a',
withEmptyKeys: { a: '=a' },
noEmptyKeys: { a: '=a' },
stringifyOutput: {
brackets: 'a==a',
indices: 'a==a',
repeat: 'a==a'
}
},
{
input: '=&a[]=b',
withEmptyKeys: { '': '', a: ['b'] },
stringifyOutput: {
brackets: '=&a[]=b',
indices: '=&a[0]=b',
repeat: '=&a=b'
},
noEmptyKeys: { a: ['b'] }
},
{
input: '=&a[]=b&a[]=c&a[2]=d',
withEmptyKeys: { '': '', a: ['b', 'c', 'd'] },
stringifyOutput: {
brackets: '=&a[]=b&a[]=c&a[]=d',
indices: '=&a[0]=b&a[1]=c&a[2]=d',
repeat: '=&a=b&a=c&a=d'
},
noEmptyKeys: { a: ['b', 'c', 'd'] }
},
{
input: '=a&=b',
withEmptyKeys: { '': ['a', 'b'] },
stringifyOutput: {
brackets: '[]=a&[]=b',
indices: '[0]=a&[1]=b',
repeat: '=a&=b'
},
noEmptyKeys: {}
},
{
input: '=a&foo=b',
withEmptyKeys: { '': 'a', foo: 'b' },
noEmptyKeys: { foo: 'b' },
stringifyOutput: {
brackets: '=a&foo=b',
indices: '=a&foo=b',
repeat: '=a&foo=b'
}
},
{
input: 'a[]=b&a=c&=',
withEmptyKeys: { '': '', a: ['b', 'c'] },
stringifyOutput: {
brackets: '=&a[]=b&a[]=c',
indices: '=&a[0]=b&a[1]=c',
repeat: '=&a=b&a=c'
},
noEmptyKeys: { a: ['b', 'c'] }
},
{
input: 'a[]=b&a=c&=',
withEmptyKeys: { '': '', a: ['b', 'c'] },
stringifyOutput: {
brackets: '=&a[]=b&a[]=c',
indices: '=&a[0]=b&a[1]=c',
repeat: '=&a=b&a=c'
},
noEmptyKeys: { a: ['b', 'c'] }
},
{
input: 'a[0]=b&a=c&=',
withEmptyKeys: { '': '', a: ['b', 'c'] },
stringifyOutput: {
brackets: '=&a[]=b&a[]=c',
indices: '=&a[0]=b&a[1]=c',
repeat: '=&a=b&a=c'
},
noEmptyKeys: { a: ['b', 'c'] }
},
{
input: 'a=b&a[]=c&=',
withEmptyKeys: { '': '', a: ['b', 'c'] },
stringifyOutput: {
brackets: '=&a[]=b&a[]=c',
indices: '=&a[0]=b&a[1]=c',
repeat: '=&a=b&a=c'
},
noEmptyKeys: { a: ['b', 'c'] }
},
{
input: 'a=b&a[0]=c&=',
withEmptyKeys: { '': '', a: ['b', 'c'] },
stringifyOutput: {
brackets: '=&a[]=b&a[]=c',
indices: '=&a[0]=b&a[1]=c',
repeat: '=&a=b&a=c'
},
noEmptyKeys: { a: ['b', 'c'] }
},
{
input: '[]=a&[]=b& []=1',
withEmptyKeys: { '': ['a', 'b'], ' ': ['1'] },
stringifyOutput: {
brackets: '[]=a&[]=b& []=1',
indices: '[0]=a&[1]=b& [0]=1',
repeat: '=a&=b& =1'
},
noEmptyKeys: { 0: 'a', 1: 'b', ' ': ['1'] }
},
{
input: '[0]=a&[1]=b&a[0]=1&a[1]=2',
withEmptyKeys: { '': ['a', 'b'], a: ['1', '2'] },
noEmptyKeys: { 0: 'a', 1: 'b', a: ['1', '2'] },
stringifyOutput: {
brackets: '[]=a&[]=b&a[]=1&a[]=2',
indices: '[0]=a&[1]=b&a[0]=1&a[1]=2',
repeat: '=a&=b&a=1&a=2'
}
},
{
input: '[deep]=a&[deep]=2',
withEmptyKeys: { '': { deep: ['a', '2'] }
},
stringifyOutput: {
brackets: '[deep][]=a&[deep][]=2',
indices: '[deep][0]=a&[deep][1]=2',
repeat: '[deep]=a&[deep]=2'
},
noEmptyKeys: { deep: ['a', '2'] }
},
{
input: '%5B0%5D=a&%5B1%5D=b',
withEmptyKeys: { '': ['a', 'b'] },
stringifyOutput: {
brackets: '[]=a&[]=b',
indices: '[0]=a&[1]=b',
repeat: '=a&=b'
},
noEmptyKeys: { 0: 'a', 1: 'b' }
}
]
};
@@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _awaitAsyncGenerator;
var _OverloadYield = require("./OverloadYield.js");
function _awaitAsyncGenerator(value) {
return new _OverloadYield.default(value, 0);
}
//# sourceMappingURL=awaitAsyncGenerator.js.map
@@ -0,0 +1,21 @@
{
"author": "Felix Geisendörfer <felix@debuggable.com> (http://debuggable.com/)",
"name": "stack-trace",
"description": "Get v8 stack traces as an array of CallSite objects.",
"version": "0.0.10",
"homepage": "https://github.com/felixge/node-stack-trace",
"repository": {
"type": "git",
"url": "git://github.com/felixge/node-stack-trace.git"
},
"main": "./lib/stack-trace",
"engines": {
"node": "*"
},
"license": "MIT",
"dependencies": {},
"devDependencies": {
"far": "0.0.3",
"long-stack-traces": "0.1.2"
}
}
@@ -0,0 +1 @@
{"version":3,"file":"InversifyCoreErrorKind.js","sourceRoot":"","sources":["../../../../src/error/models/InversifyCoreErrorKind.ts"],"names":[],"mappings":";;;AAAA,IAAY,sBAMX;AAND,WAAY,sBAAsB;IAChC,+GAA0B,CAAA;IAC1B,6GAAyB,CAAA;IACzB,2EAAQ,CAAA;IACR,+EAAU,CAAA;IACV,yEAAO,CAAA;AACT,CAAC,EANW,sBAAsB,sCAAtB,sBAAsB,QAMjC"}
@@ -0,0 +1 @@
{"version":3,"file":"isCreateContext.d.ts","sourceRoot":"","sources":["isCreateContext.js"],"names":[],"mappings":"AASiB,gCAHN,OAAO,GACL,OAAO,CA8CnB"}
@@ -0,0 +1,61 @@
{
"name": "baseline-browser-mapping",
"main": "./dist/index.cjs",
"version": "2.8.27",
"description": "A library for obtaining browser versions with their maximum supported Baseline feature set and Widely Available status.",
"exports": {
".": {
"require": "./dist/index.cjs",
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./legacy": {
"require": "./dist/index.cjs",
"types": "./dist/index.d.ts"
}
},
"jsdelivr": "./dist/index.js",
"files": [
"dist/*",
"!dist/scripts/*",
"LICENSE.txt",
"README.md"
],
"types": "./dist/index.d.ts",
"type": "module",
"bin": {
"baseline-browser-mapping": "./dist/cli.js"
},
"scripts": {
"fix-cli-permissions": "output=$(npx baseline-browser-mapping 2>&1); path=$(printf '%s\n' \"$output\" | sed -n 's/^sh: \\(.*\\): Permission denied$/\\1/p'); if [ -n \"$path\" ]; then echo \"Permission denied for: $path\"; echo \"Removing $path ...\"; rm -rf \"$path\"; else echo \"$output\"; fi",
"test:format": "npx prettier --check .",
"test:lint": "npx eslint .",
"test:bcb": "mkdir test-bcb && cd test-bcb && npm init -y && npm i ../../baseline-browser-mapping browserslist browserslist-config-baseline &&jq '. += {\"browserslist\":[\"extends browserslist-config-baseline\"]}' package.json >p && mv p package.json && npx browserslist && cd ../ && rm -rf test-bcb",
"test:browserslist": "mkdir test-browserslist && cd test-browserslist && npm init -y && npm i ../../baseline-browser-mapping browserslist &&jq '. += {\"browserslist\":[\"baseline widely available with downstream\"]}' package.json >p && mv p package.json && npx browserslist && cd ../ && rm -rf test-browserslist",
"test:jasmine": "npx jasmine",
"test": "npm run build && npm run fix-cli-permissions && rm -rf test-browserslist test-bcb && npm run test:format && npm run test:lint && npx jasmine && npm run test:browserslist && npm run test:bcb",
"build": "rm -rf dist; npx prettier . --write; rollup -c; rm -rf ./dist/scripts/expose-data.d.ts ./dist/cli.d.ts",
"refresh-downstream": "npx tsx scripts/refresh-downstream.ts",
"refresh-static": "npx tsx scripts/refresh-static.ts",
"update-data-file": "npx tsx scripts/update-data-file.ts; npx prettier ./src/data/data.js --write",
"update-data-dependencies": "npm i @mdn/browser-compat-data@latest web-features@latest -D",
"check-data-changes": "git diff --name-only | grep -q '^src/data/data.js$' && echo 'changes-available=TRUE' || echo 'changes-available=FALSE'"
},
"license": "Apache-2.0",
"devDependencies": {
"@mdn/browser-compat-data": "^7.1.21",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^12.1.3",
"@types/node": "^22.15.17",
"eslint-plugin-new-with-error": "^5.0.0",
"jasmine": "^5.8.0",
"jasmine-spec-reporter": "^7.0.0",
"prettier": "^3.5.3",
"rollup": "^4.44.0",
"tslib": "^2.8.1",
"typescript": "^5.7.2",
"typescript-eslint": "^8.35.0",
"web-features": "^3.9.0"
},
"repository": "git+https://github.com/web-platform-dx/baseline-browser-mapping.git"
}
@@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var AlertDialogRole = {
relatedConcepts: [{
module: 'ARIA',
concept: {
name: 'alertdialog'
}
}],
type: 'window'
};
var _default = AlertDialogRole;
exports.default = _default;
@@ -0,0 +1,33 @@
/**
* @flow
*/
import entries from 'object.entries';
import flatMap from 'array.prototype.flatmap';
import fromEntries from 'object.fromentries';
type ESLintTestRunnerTestCase = {
code: string,
errors: ?Array<{ message: string, type: string }>,
options: ?Array<mixed>,
parserOptions: ?Array<mixed>,
settings?: {[string]: mixed},
};
type RuleOptionsMapperFactoryType = (
params: ESLintTestRunnerTestCase
) => ESLintTestRunnerTestCase;
export default function ruleOptionsMapperFactory(ruleOptions: Array<mixed> = []): RuleOptionsMapperFactoryType {
// eslint-disable-next-line
return ({ code, errors, options, parserOptions, settings }: ESLintTestRunnerTestCase): ESLintTestRunnerTestCase => {
return {
code,
errors,
// Flatten the array of objects in an array of one object.
options: [fromEntries(flatMap((options || []).concat(ruleOptions), (item) => entries(item)))],
parserOptions,
settings,
};
};
}
@@ -0,0 +1,657 @@
import type { ThunkDispatch, UnknownAction } from '@reduxjs/toolkit'
import type { BaseQueryFn, BaseQueryApi } from '@reduxjs/toolkit/query/react'
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'
import {
act,
fireEvent,
render,
renderHook,
screen,
waitFor,
} from '@testing-library/react'
import type { AxiosError, AxiosRequestConfig, AxiosResponse } from 'axios'
import axios from 'axios'
import { HttpResponse, http } from 'msw'
import * as React from 'react'
import { useDispatch } from 'react-redux'
import { hookWaitFor, setupApiStore } from '@internal/tests/utils/helpers'
import { server } from '@internal/query/tests/mocks/server'
const baseQuery = fetchBaseQuery({ baseUrl: 'https://example.com' })
const api = createApi({
baseQuery,
endpoints(build) {
return {
query: build.query({ query: () => '/query' }),
mutation: build.mutation({
query: () => ({ url: '/mutation', method: 'POST' }),
}),
}
},
})
const storeRef = setupApiStore(api)
const failQueryOnce = http.get(
'/query',
() => HttpResponse.json({ value: 'failed' }, { status: 500 }),
{ once: true },
)
describe('fetchBaseQuery', () => {
let commonBaseQueryApiArgs: BaseQueryApi = {} as any
beforeEach(() => {
const abortController = new AbortController()
commonBaseQueryApiArgs = {
signal: abortController.signal,
abort: (reason) =>
//@ts-ignore
abortController.abort(reason),
dispatch: storeRef.store.dispatch,
getState: storeRef.store.getState,
extra: undefined,
type: 'query',
endpoint: 'doesntmatterhere',
}
})
test('success', async () => {
await expect(
baseQuery('/success', commonBaseQueryApiArgs, {}),
).resolves.toEqual({
data: { value: 'success' },
meta: {
request: expect.any(Object),
response: expect.any(Object),
},
})
})
test('error', async () => {
server.use(failQueryOnce)
await expect(
baseQuery('/error', commonBaseQueryApiArgs, {}),
).resolves.toEqual({
error: {
data: { value: 'error' },
status: 500,
},
meta: {
request: expect.any(Object),
response: expect.any(Object),
},
})
})
})
describe('query error handling', () => {
test('success', async () => {
server.use(
http.get('https://example.com/query', () =>
HttpResponse.json({ value: 'success' }),
),
)
const { result } = renderHook(() => api.endpoints.query.useQuery({}), {
wrapper: storeRef.wrapper,
})
await hookWaitFor(() => expect(result.current.isFetching).toBeFalsy())
expect(result.current).toEqual(
expect.objectContaining({
isLoading: false,
isError: false,
isSuccess: true,
data: { value: 'success' },
}),
)
})
test('error', async () => {
server.use(
http.get('https://example.com/query', () =>
HttpResponse.json({ value: 'error' }, { status: 500 }),
),
)
const { result } = renderHook(() => api.endpoints.query.useQuery({}), {
wrapper: storeRef.wrapper,
})
await hookWaitFor(() => expect(result.current.isFetching).toBeFalsy())
expect(result.current).toEqual(
expect.objectContaining({
isLoading: false,
isError: true,
isSuccess: false,
error: {
status: 500,
data: { value: 'error' },
},
}),
)
})
test('success -> error', async () => {
server.use(
http.get('https://example.com/query', () =>
HttpResponse.json({ value: 'success' }),
),
)
const { result } = renderHook(() => api.endpoints.query.useQuery({}), {
wrapper: storeRef.wrapper,
})
await hookWaitFor(() => expect(result.current.isFetching).toBeFalsy())
expect(result.current).toEqual(
expect.objectContaining({
isLoading: false,
isError: false,
isSuccess: true,
data: { value: 'success' },
}),
)
server.use(
http.get(
'https://example.com/query',
() => HttpResponse.json({ value: 'error' }, { status: 500 }),
{ once: true },
),
)
act(() => void result.current.refetch())
await hookWaitFor(() => expect(result.current.isFetching).toBeFalsy())
expect(result.current).toEqual(
expect.objectContaining({
isLoading: false,
isError: true,
isSuccess: false,
error: {
status: 500,
data: { value: 'error' },
},
// last data will stay available
data: { value: 'success' },
}),
)
})
test('error -> success', async () => {
server.use(
http.get('https://example.com/query', () =>
HttpResponse.json({ value: 'success' }),
),
)
server.use(
http.get(
'https://example.com/query',
() => HttpResponse.json({ value: 'error' }, { status: 500 }),
{ once: true },
),
)
const { result } = renderHook(() => api.endpoints.query.useQuery({}), {
wrapper: storeRef.wrapper,
})
await hookWaitFor(() => expect(result.current.isFetching).toBeFalsy())
expect(result.current).toEqual(
expect.objectContaining({
isLoading: false,
isError: true,
isSuccess: false,
error: {
status: 500,
data: { value: 'error' },
},
}),
)
act(() => void result.current.refetch())
await hookWaitFor(() => expect(result.current.isFetching).toBeFalsy())
expect(result.current).toEqual(
expect.objectContaining({
isLoading: false,
isError: false,
isSuccess: true,
data: { value: 'success' },
}),
)
})
})
describe('mutation error handling', () => {
test('success', async () => {
server.use(
http.post('https://example.com/mutation', () =>
HttpResponse.json({ value: 'success' }),
),
)
const { result } = renderHook(() => api.endpoints.mutation.useMutation(), {
wrapper: storeRef.wrapper,
})
const [trigger] = result.current
act(() => void trigger({}))
await hookWaitFor(() => expect(result.current[1].isLoading).toBeFalsy())
expect(result.current[1]).toEqual(
expect.objectContaining({
isLoading: false,
isError: false,
isSuccess: true,
data: { value: 'success' },
}),
)
})
test('error', async () => {
server.use(
http.post('https://example.com/mutation', () =>
HttpResponse.json({ value: 'error' }, { status: 500 }),
),
)
const { result } = renderHook(() => api.endpoints.mutation.useMutation(), {
wrapper: storeRef.wrapper,
})
const [trigger] = result.current
act(() => void trigger({}))
await hookWaitFor(() => expect(result.current[1].isLoading).toBeFalsy())
expect(result.current[1]).toEqual(
expect.objectContaining({
isLoading: false,
isError: true,
isSuccess: false,
error: {
status: 500,
data: { value: 'error' },
},
}),
)
})
test('success -> error', async () => {
server.use(
http.post('https://example.com/mutation', () =>
HttpResponse.json({ value: 'success' }),
),
)
const { result } = renderHook(() => api.endpoints.mutation.useMutation(), {
wrapper: storeRef.wrapper,
})
{
const [trigger] = result.current
act(() => void trigger({}))
await hookWaitFor(() => expect(result.current[1].isLoading).toBeFalsy())
expect(result.current[1]).toEqual(
expect.objectContaining({
isLoading: false,
isError: false,
isSuccess: true,
data: { value: 'success' },
}),
)
}
server.use(
http.post(
'https://example.com/mutation',
() => HttpResponse.json({ value: 'error' }, { status: 500 }),
{ once: true },
),
)
{
const [trigger] = result.current
act(() => void trigger({}))
await hookWaitFor(() => expect(result.current[1].isLoading).toBeFalsy())
expect(result.current[1]).toEqual(
expect.objectContaining({
isLoading: false,
isError: true,
isSuccess: false,
error: {
status: 500,
data: { value: 'error' },
},
}),
)
expect(result.current[1].data).toBeUndefined()
}
})
test('error -> success', async () => {
server.use(
http.post('https://example.com/mutation', () =>
HttpResponse.json({ value: 'success' }),
),
)
server.use(
http.post(
'https://example.com/mutation',
() => HttpResponse.json({ value: 'error' }, { status: 500 }),
{ once: true },
),
)
const { result } = renderHook(() => api.endpoints.mutation.useMutation(), {
wrapper: storeRef.wrapper,
})
{
const [trigger] = result.current
act(() => void trigger({}))
await hookWaitFor(() => expect(result.current[1].isLoading).toBeFalsy())
expect(result.current[1]).toEqual(
expect.objectContaining({
isLoading: false,
isError: true,
isSuccess: false,
error: {
status: 500,
data: { value: 'error' },
},
}),
)
}
{
const [trigger] = result.current
act(() => void trigger({}))
await hookWaitFor(() => expect(result.current[1].isLoading).toBeFalsy())
expect(result.current[1]).toEqual(
expect.objectContaining({
isLoading: false,
isError: false,
isSuccess: true,
}),
)
expect(result.current[1].error).toBeUndefined()
}
})
})
describe('custom axios baseQuery', () => {
const axiosBaseQuery =
(
{ baseUrl }: { baseUrl: string } = { baseUrl: '' },
): BaseQueryFn<
{
url: string
method?: AxiosRequestConfig['method']
data?: AxiosRequestConfig['data']
},
unknown,
unknown,
unknown,
{ response: AxiosResponse; request: AxiosRequestConfig }
> =>
async ({ url, method, data }) => {
const config = { url: baseUrl + url, method, data }
try {
const result = await axios(config)
return {
data: result.data,
meta: { request: config, response: result },
}
} catch (axiosError) {
const err = axiosError as AxiosError
return {
error: {
status: err.response?.status,
data: err.response?.data,
},
meta: { request: config, response: err.response as AxiosResponse },
}
}
}
type SuccessResponse = { value: 'success' }
const api = createApi({
baseQuery: axiosBaseQuery({
baseUrl: 'https://example.com',
}),
endpoints(build) {
return {
query: build.query<SuccessResponse, void>({
query: () => ({ url: '/success', method: 'get' }),
transformResponse: (result: SuccessResponse, meta) => {
return { ...result, metaResponseData: meta?.response.data }
},
}),
mutation: build.mutation<SuccessResponse, any>({
query: () => ({ url: '/success', method: 'post' }),
}),
}
},
})
const storeRef = setupApiStore(api)
test('axiosBaseQuery transformResponse uses its custom meta format', async () => {
const result = await storeRef.store.dispatch(api.endpoints.query.initiate())
expect(result.data).toEqual({
value: 'success',
metaResponseData: { value: 'success' },
})
})
test('axios errors behave as expected', async () => {
server.use(
http.get('https://example.com/success', () =>
HttpResponse.json({ value: 'error' }, { status: 500 }),
),
)
const { result } = renderHook(() => api.endpoints.query.useQuery(), {
wrapper: storeRef.wrapper,
})
await hookWaitFor(() => expect(result.current.isFetching).toBeFalsy())
expect(result.current).toEqual(
expect.objectContaining({
isLoading: false,
isError: true,
isSuccess: false,
error: { status: 500, data: { value: 'error' } },
}),
)
})
})
describe('error handling in a component', () => {
const mockErrorResponse = { value: 'error', very: 'mean' }
const mockSuccessResponse = { value: 'success' }
const api = createApi({
baseQuery: fetchBaseQuery({ baseUrl: 'https://example.com' }),
endpoints: (build) => ({
update: build.mutation<typeof mockSuccessResponse, any>({
query: () => ({ url: 'success' }),
}),
failedUpdate: build.mutation<typeof mockSuccessResponse, any>({
query: () => ({ url: 'error' }),
}),
}),
})
const storeRef = setupApiStore(api)
test('a mutation is unwrappable and has the correct types', async () => {
server.use(
http.get(
'https://example.com/success',
() => HttpResponse.json(mockErrorResponse, { status: 500 }),
{ once: true },
),
)
function User() {
const [manualError, setManualError] = React.useState<any>()
const [update, { isLoading, data, error }] =
api.endpoints.update.useMutation()
return (
<div>
<div data-testid="isLoading">{String(isLoading)}</div>
<div data-testid="data">{JSON.stringify(data)}</div>
<div data-testid="error">{JSON.stringify(error)}</div>
<div data-testid="manuallySetError">
{JSON.stringify(manualError)}
</div>
<button
onClick={() => {
update({ name: 'hello' })
.unwrap()
.then((result) => {
setManualError(undefined)
})
.catch((error) => act(() => setManualError(error)))
}}
>
Update User
</button>
</div>
)
}
render(<User />, { wrapper: storeRef.wrapper })
await waitFor(() =>
expect(screen.getByTestId('isLoading').textContent).toBe('false'),
)
fireEvent.click(screen.getByText('Update User'))
expect(screen.getByTestId('isLoading').textContent).toBe('true')
await waitFor(() =>
expect(screen.getByTestId('isLoading').textContent).toBe('false'),
)
// Make sure the hook and the unwrapped action return the same things in an error state
await waitFor(() =>
expect(screen.getByTestId('error').textContent).toEqual(
screen.getByTestId('manuallySetError').textContent,
),
)
fireEvent.click(screen.getByText('Update User'))
expect(screen.getByTestId('isLoading').textContent).toBe('true')
await waitFor(() =>
expect(screen.getByTestId('isLoading').textContent).toBe('false'),
)
await waitFor(() =>
expect(screen.getByTestId('error').textContent).toBeFalsy(),
)
await waitFor(() =>
expect(screen.getByTestId('manuallySetError').textContent).toBeFalsy(),
)
await waitFor(() =>
expect(screen.getByTestId('data').textContent).toEqual(
JSON.stringify(mockSuccessResponse),
),
)
})
for (const track of [true, false]) {
test(`an un-subscribed mutation will still return something useful (success case, track: ${track})`, async () => {
const hook = renderHook(useDispatch, { wrapper: storeRef.wrapper })
const dispatch = hook.result.current as ThunkDispatch<
any,
any,
UnknownAction
>
let mutationqueryFulfilled: ReturnType<
ReturnType<typeof api.endpoints.update.initiate>
>
act(() => {
mutationqueryFulfilled = dispatch(
api.endpoints.update.initiate({}, { track }),
)
})
const result = await mutationqueryFulfilled!
expect(result).toMatchObject({
data: { value: 'success' },
})
})
test(`an un-subscribed mutation will still return something useful (error case, track: ${track})`, async () => {
const hook = renderHook(useDispatch, { wrapper: storeRef.wrapper })
const dispatch = hook.result.current as ThunkDispatch<
any,
any,
UnknownAction
>
let mutationqueryFulfilled: ReturnType<
ReturnType<typeof api.endpoints.failedUpdate.initiate>
>
act(() => {
mutationqueryFulfilled = dispatch(
api.endpoints.failedUpdate.initiate({}, { track }),
)
})
const result = await mutationqueryFulfilled!
expect(result).toMatchObject({
error: {
status: 500,
data: { value: 'error' },
},
})
})
test(`an un-subscribed mutation will still be unwrappable (success case), track: ${track}`, async () => {
const hook = renderHook(useDispatch, { wrapper: storeRef.wrapper })
const dispatch = hook.result.current as ThunkDispatch<
any,
any,
UnknownAction
>
let mutationqueryFulfilled: ReturnType<
ReturnType<typeof api.endpoints.update.initiate>
>
act(() => {
mutationqueryFulfilled = dispatch(
api.endpoints.update.initiate({}, { track }),
)
})
const result = await mutationqueryFulfilled!.unwrap()
expect(result).toMatchObject({
value: 'success',
})
})
test(`an un-subscribed mutation will still be unwrappable (error case, track: ${track})`, async () => {
const hook = renderHook(useDispatch, { wrapper: storeRef.wrapper })
const dispatch = hook.result.current as ThunkDispatch<
any,
any,
UnknownAction
>
let mutationqueryFulfilled: ReturnType<
ReturnType<typeof api.endpoints.failedUpdate.initiate>
>
act(() => {
mutationqueryFulfilled = dispatch(
api.endpoints.failedUpdate.initiate({}, { track }),
)
})
const unwrappedPromise = mutationqueryFulfilled!.unwrap()
await expect(unwrappedPromise).rejects.toMatchObject({
status: 500,
data: { value: 'error' },
})
})
}
})
@@ -0,0 +1,116 @@
{
"name": "typed-array-byte-offset",
"version": "1.0.4",
"description": "Robustly get the byte offset of a Typed Array",
"main": "index.js",
"exports": {
".": "./index.js",
"./package.json": "./package.json"
},
"types": "./index.d.ts",
"sideEffects": false,
"scripts": {
"prepack": "npmignore --auto --commentLines=autogenerated",
"prepublishOnly": "safe-publish-latest",
"prepublish": "not-in-publish || npm run prepublishOnly",
"pretest": "npm run lint",
"prelint": "evalmd README.md",
"lint": "eslint --ext=js,mjs .",
"postlint": "tsc -p . && attw -P",
"tests-only": "nyc tape 'test/**/*.js'",
"test": "npm run tests-only",
"posttest": "npx npm@'>=10.2' audit --production",
"version": "auto-changelog && git add CHANGELOG.md",
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
},
"repository": {
"type": "git",
"url": "git+https://github.com/inspect-js/typed-array-byte-offset.git"
},
"keywords": [
"typed",
"array",
"byteOffset",
"byte",
"offset",
"robust",
"es",
"Int8Array",
"Uint8Array",
"Uint8ClampedArray",
"Int16Array",
"Uint16Array",
"Int32Array",
"Uint32Array",
"Float32Array",
"Float64Array",
"BigInt64Array",
"BigUint64Array"
],
"author": "Jordan Harband <ljharb@gmail.com>",
"funding": {
"url": "https://github.com/sponsors/ljharb"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/inspect-js/typed-array-byte-offset/issues"
},
"homepage": "https://github.com/inspect-js/typed-array-byte-offset#readme",
"dependencies": {
"available-typed-arrays": "^1.0.7",
"call-bind": "^1.0.8",
"for-each": "^0.3.3",
"gopd": "^1.2.0",
"has-proto": "^1.2.0",
"is-typed-array": "^1.1.15",
"reflect.getprototypeof": "^1.0.9"
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.17.1",
"@ljharb/eslint-config": "^21.1.1",
"@ljharb/tsconfig": "^0.2.2",
"@types/call-bind": "^1.0.5",
"@types/es-abstract": "^1.17.9",
"@types/for-each": "^0.3.3",
"@types/gopd": "^1.0.3",
"@types/is-callable": "^1.1.2",
"@types/make-arrow-function": "^1.2.2",
"@types/make-generator-function": "^2.0.3",
"@types/object-inspect": "^1.13.0",
"@types/tape": "^5.8.0",
"auto-changelog": "^2.5.0",
"eslint": "=8.8.0",
"evalmd": "^0.0.19",
"in-publish": "^2.0.1",
"is-callable": "^1.2.7",
"make-arrow-function": "^1.2.0",
"make-generator-function": "^2.0.0",
"npmignore": "^0.3.1",
"nyc": "^10.3.2",
"object-inspect": "^1.13.3",
"possible-typed-array-names": "^1.0.0",
"safe-publish-latest": "^2.0.0",
"tape": "^5.9.0",
"typescript": "next"
},
"engines": {
"node": ">= 0.4"
},
"auto-changelog": {
"output": "CHANGELOG.md",
"template": "keepachangelog",
"unreleased": false,
"commitLimit": false,
"backfillLimit": false,
"hideCredit": true
},
"testling": {
"files": "test/index.js"
},
"publishConfig": {
"ignore": [
".github/workflows",
"types"
]
}
}
@@ -0,0 +1,10 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ClassElementMetadataKind = void 0;
var ClassElementMetadataKind;
(function (ClassElementMetadataKind) {
ClassElementMetadataKind[ClassElementMetadataKind["multipleInjection"] = 0] = "multipleInjection";
ClassElementMetadataKind[ClassElementMetadataKind["singleInjection"] = 1] = "singleInjection";
ClassElementMetadataKind[ClassElementMetadataKind["unmanaged"] = 2] = "unmanaged";
})(ClassElementMetadataKind || (exports.ClassElementMetadataKind = ClassElementMetadataKind = {}));
//# sourceMappingURL=ClassElementMetadataKind.js.map
@@ -0,0 +1,231 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v3.3.5](https://github.com/jsx-eslint/jsx-ast-utils/compare/v3.3.4...v3.3.5) - 2023-07-28
### Fixed
- [Fix] `extractProp`: support `JSXFragment` [`#132`](https://github.com/jsx-eslint/jsx-ast-utils/issues/132)
### Commits
- [Dev Deps] update `@babel/core`, `@babel/eslint-parser`, `@babel/parser`, `eslint` [`e5555d1`](https://github.com/jsx-eslint/jsx-ast-utils/commit/e5555d152dbe1e85324139756f637e65fe047976)
- [Tests] fix a test [`bde3ba9`](https://github.com/jsx-eslint/jsx-ast-utils/commit/bde3ba9c9dc294d5472eefa0b3f31ab0e1aed739)
## [v3.3.4](https://github.com/jsx-eslint/jsx-ast-utils/compare/v3.3.3...v3.3.4) - 2023-06-28
### Commits
- [Refactor] use `array.prototype.flat` `object.values` over `.reduce` [`bad51d0`](https://github.com/jsx-eslint/jsx-ast-utils/commit/bad51d062000ffdc19d925723a6515458318cf92)
- [meta] add `auto-changelog` [`af1de69`](https://github.com/jsx-eslint/jsx-ast-utils/commit/af1de693d1005144c13a75573631a670fa44547e)
- [Tests] add test for `import.meta` [`1d39f58`](https://github.com/jsx-eslint/jsx-ast-utils/commit/1d39f58c7bc6a89aa936e666b76e355c9436e854)
- [Dev Deps] update `@babel/core`, `@babel/eslint-parser`, `@babel/parser`, `aud`, `eslint`, `eslint-plugin-import` [`3baaf76`](https://github.com/jsx-eslint/jsx-ast-utils/commit/3baaf76c9c48ae85687ed23a3b9894c45927e081)
- [Fix] `TSNonNullExpression`: Handle function calls [`26cc3c4`](https://github.com/jsx-eslint/jsx-ast-utils/commit/26cc3c48165518b9fcdc9c625d918accc3e00107)
- [Dev Deps] update `eslint`, `@babel/core`, `@babel/parser`, `object.entries`, `object.fromentries` [`0e4f80c`](https://github.com/jsx-eslint/jsx-ast-utils/commit/0e4f80c2129c5b5ee50e4df2f25c5fb6728cbe8e)
- [Dev Deps] update `@babel/core`, `@babel/eslint-parser`, `@babel/parser`, `aud` [`b5427a6`](https://github.com/jsx-eslint/jsx-ast-utils/commit/b5427a65fac33e2264461b072b3edb078242dc85)
- [meta] run build in prepack, not prepublish [`a0f4f38`](https://github.com/jsx-eslint/jsx-ast-utils/commit/a0f4f383ddf82cd2914c7e594f356d9a78c80570)
- [Deps] update `array-includes` [`c479841`](https://github.com/jsx-eslint/jsx-ast-utils/commit/c479841d0b65188a3223541e885fa6286756a2c6)
- [Deps] update `object.assign` [`9685dce`](https://github.com/jsx-eslint/jsx-ast-utils/commit/9685dce823d71ac06fccd61d8aa8e13ba3d42f38)
<!-- auto-changelog-above -->
3.3.3 / 2022-08-08
==================
- [Fix] Mark ChainExpression as a noop (#109)
- [Deps] update `object.assign`
- [Dev Deps] update `@babel/core`, `@babel/eslint-parser`, `@babel/parser`, `eslint`
3.3.2 / 2022-07-06
==================
- [Fix] Handle `as` casts in TSNonNullExpression
3.3.1 / 2022-06-22
==================
- [Fix] `ArrayExpression`: handle sparse array (#117)
- [Deps] update `array-includes`
- [meta] move jest config to separate file
- [meta] use `npmignore` to autogenerate an npmignore file
- [Dev Deps] update `@babel/core`, `@babel/eslint-parser`, `@babel/parser`, `eslint`
3.3.0 / 2022-04-30
==================
- [New] add `JSXFragment`, `JSXText`; fix `JSXElement` to handle children
- [Dev Deps] update `@babel/core`, `@babel/parser`, `eslint`, `eslint-plugin-import`
3.2.2 / 2022-03-31
==================
- [Fix] `TSNonNullExpression`: handle computed MemberExpressions (#109)
- [Fix] avoid a crash in ChainExpressions in a TSAsExpression
3.2.1 / 2021-09-16
==================
- [patch] include project name in error logging (#113)
- [readme] update badges, URLs
- [Deps] update `array-includes`
- [meta] don‘t lint coverage results
- [meta] add GitHub org to FUNDING.yml
- [meta] add OpenCollective to FUNDING.yml
- [meta] run `aud` in `posttest`
- [meta] add Automatic Rebase and Require Allow Edits workflows
- [actions] use `node/install` instead of `node/run`; use `codecov` action
- [Tests] unpin `caniuse-lite`, since breaking change is fixed
- [Tests] pin `caniuse-lite`, due to breaking change in patch version
- [Tests] fix linting errors
- [Tests] migrate tests to Github Actions
- [Tests] stop using coveralls
- [Tests] skip failing fragment test in node 4
- [Dev Deps] update `@babel/core`, `@babel/parser`, `aud`, `eslint`, `eslint-plugin-import`, `object.entries`, `object.fromentries`
3.2.0 / 2020-12-16
==================
- [New] add support for fragment syntax (`<>`) (#108)
- [Fix] `TSNonNullExpression`: handle `ThisExpression`s (#108)
- [Deps] update `array-includes`, `object.assign`
- [Dev Deps] update `@babel/core`, `@babel/parser`, `eslint`, `eslint-config-airbnb-base`, `object.entries`, `object.fromentries`
3.1.0 / 2020-10-13
==================
- [New] add `TSNonNullExpression` (#105)
- [New] add `AssignmentExpression` (#106)
- [Dev Deps] update `eslint`
3.0.0 / 2020-10-06
==================
- [Breaking] Don't return node.start & node.end (#100)
- [Breaking] add `ChainExpression`; `CallExpression` now includes arguments (#102)
- [New] add `SequenceExpression` (#101)
- [Deps] update `object.assign`
- [Dev Deps] update `eslint`, `eslint-plugin-import`
- [Dev Deps] update `@babel/core`, `@babel/parser`, `eslint`, `eslint-plugin-import`
- [Tests] use proper `actual, expected` ordering for non-confusing failure messages
2.4.1 / 2020-06-11
==================
- [Fix] `expressions/TemplateLiteral`: use `.range[0]` instead of `.start`
2.4.0 / 2020-06-11
==================
- [New] Provide both range and start & end property on Node, support eslint v7 (#97)
- [Dev Deps] update `@babel/core`, `@babel/parser`, `eslint`, `eslint-config-airbnb-base`, `eslint-plugin-import`, `flow-parser`
- [meta] remove yarn registry from npmrc, so `npm publish` works
2.3.0 / 2020-05-24
==================
- [New] add nullish coalescing (#99)
- [New] add OptionalCallExpression (#99)
- [Deps] update `array-includes`
- [meta] add `safe-publish-latest`
- [Dev Deps] update `@babel/parser`, `babel-eslint`, `coveralls`, `eslint`, `eslint-config-airbnb-base`, `eslint-plugin-import`, `in-publish`, `object.entries`, `object.fromentries`, `rimraf`
- [Tests] on `node` `v14`; test all branches
2.2.3 / 2019-10-24
==================
- (fix) Fix crash on spread (#94)
2.2.2 / 2019-10-24
==================
- (improvement) Add support for retrieving props from a spread with object expression (#93)
2.2.1 / 2019-06-30
==================
- (improvement) Account for TypeCastExpression in the utils
2.2.0 / 2019-06-25
==================
- (fix) Fix getLiteralPropValue for TS-specific node types.
- (chore) upgrade dependencies.
- (improvement) Stop throwing errors when unknown AST nodes are encountered.
- (dev) CI changes.
2.1.0 / 2018-04-19
==================
- Fix undefined bug for template strings. #45
- Adding support for `objectRestSpread` within props #60
- Accommodate ExperimentalSpreadProperty in prop values #75
- Account for SpreadElement AST Nodes #76
- Support OptionalMemberExpression AST nodes #77
- Add support to Typescript's node types #72
2.0.1 / 2017-08-31
==================
- [fix] Add support for BindExpression
2.0.0 / 2017-07-07
==================
- [breaking] Remove undefined return from `propName` so it always returns a value.
1.4.1 / 2017-04-19
==================
- [fix] - Fixing fatal throw in `getPropValue` for `ArrowFunctionExpression`
1.4.0 / 2017-02-02
==================
- [new] Add eventHandlers and eventHandlersByType to API. These are the event names for DOM elements on JSX-using libraries such as React, inferno, and preact.
1.3.5 / 2016-12-14
==================
- [fix] Normalize literals "true" and "false" before converting to boolean in Literal prop value extractor.
1.3.4 / 2016-11-15
==================
- [fix] Recursively resolve JSXMemberExpression names for elementType. (i.e. `<Component.Render.Me />`). Fixes [#9](https://github.com/evcohen/jsx-ast-utils/issues/9)
1.3.3 / 2016-10-28
==================
- [fix] Add support for `ArrayExpression`.
1.3.2 / 2016-10-11
==================
- [fix] Add support for `UpdateExpression`.
1.3.1 / 2016-07-13
==================
- [fix] Add `JSXElement` to expression types to handle recursively extracting prop value.
1.3.0 / 2016-07-12
==================
- [new] Add support for `TaggedTemplateExpression`.
1.2.1 / 2016-06-15
==================
- [fix] Point to `lib` instead of `src` for root exports.
1.2.0 / 2016-06-15
==================
- [new] Export functions from root so they can be imported like the following: `require('jsx-ast-utils/{function}')`.
1.1.1 / 2016-06-12
==================
- [fix] Better support for expressions in `TemplateLiteral` extraction.
1.1.0 / 2016-06-10
==================
- [new] Support for namespaced element names.
- [new] Add `propName` to API to get correct name for prop.
1.0.1 / 2016-06-10
==================
- [fix] Return actual reserved words instead of string representations of them.
1.0.0 / 2016-06-09
==================
- Initial stable release
@@ -0,0 +1 @@
{"version":3,"names":["_semver","data","require","_index","_caching","makeConfigAPI","cache","env","value","using","undefined","envName","assertSimpleType","Array","isArray","some","entry","Error","caller","cb","version","coreVersion","simple","async","assertVersion","makePresetAPI","externalDependencies","targets","JSON","parse","stringify","addExternalDependency","ref","push","Object","assign","makePluginAPI","assumption","name","assumptions","range","Number","isInteger","semver","satisfies","limit","stackTraceLimit","err","code"],"sources":["../../../src/config/helpers/config-api.ts"],"sourcesContent":["import semver from \"semver\";\nimport type { Targets } from \"@babel/helper-compilation-targets\";\n\nimport { version as coreVersion } from \"../../index.ts\";\nimport { assertSimpleType } from \"../caching.ts\";\nimport type {\n CacheConfigurator,\n SimpleCacheConfigurator,\n SimpleType,\n} from \"../caching.ts\";\n\nimport type {\n AssumptionName,\n CallerMetadata,\n InputOptions,\n} from \"../validation/options.ts\";\n\nimport type * as Context from \"../cache-contexts\";\n\ntype EnvName = NonNullable<InputOptions[\"envName\"]>;\ntype EnvFunction = {\n (): string;\n <T extends SimpleType>(extractor: (envName: EnvName) => T): T;\n (envVar: string): boolean;\n (envVars: Array<string>): boolean;\n};\n\ntype CallerFactory = {\n <T extends SimpleType>(\n extractor: (callerMetadata: CallerMetadata | undefined) => T,\n ): T;\n (\n extractor: (callerMetadata: CallerMetadata | undefined) => unknown,\n ): SimpleType;\n};\ntype TargetsFunction = () => Targets;\ntype AssumptionFunction = (name: AssumptionName) => boolean | undefined;\n\nexport type ConfigAPI = {\n version: string;\n cache: SimpleCacheConfigurator;\n env: EnvFunction;\n async: () => boolean;\n assertVersion: typeof assertVersion;\n caller?: CallerFactory;\n};\n\nexport type PresetAPI = {\n targets: TargetsFunction;\n addExternalDependency: (ref: string) => void;\n} & ConfigAPI;\n\nexport type PluginAPI = {\n assumption: AssumptionFunction;\n} & PresetAPI;\n\nexport function makeConfigAPI<SideChannel extends Context.SimpleConfig>(\n cache: CacheConfigurator<SideChannel>,\n): ConfigAPI {\n // TODO(@nicolo-ribaudo): If we remove the explicit type from `value`\n // and the `as any` type cast, TypeScript crashes in an infinite\n // recursion. After upgrading to TS4.7 and finishing the noImplicitAny\n // PR, we should check if it still crashes and report it to the TS team.\n const env: EnvFunction = ((\n value: string | string[] | (<T>(babelEnv: string) => T),\n ) =>\n cache.using(data => {\n if (value === undefined) return data.envName;\n if (typeof value === \"function\") {\n return assertSimpleType(value(data.envName));\n }\n return (Array.isArray(value) ? value : [value]).some(entry => {\n if (typeof entry !== \"string\") {\n throw new Error(\"Unexpected non-string value\");\n }\n return entry === data.envName;\n });\n })) as any;\n\n const caller = (\n cb: (CallerMetadata: CallerMetadata | undefined) => SimpleType,\n ) => cache.using(data => assertSimpleType(cb(data.caller)));\n\n return {\n version: coreVersion,\n cache: cache.simple(),\n // Expose \".env()\" so people can easily get the same env that we expose using the \"env\" key.\n env,\n async: () => false,\n caller,\n assertVersion,\n };\n}\n\nexport function makePresetAPI<SideChannel extends Context.SimplePreset>(\n cache: CacheConfigurator<SideChannel>,\n externalDependencies: Array<string>,\n): PresetAPI {\n const targets = () =>\n // We are using JSON.parse/JSON.stringify because it's only possible to cache\n // primitive values. We can safely stringify the targets object because it\n // only contains strings as its properties.\n // Please make the Record and Tuple proposal happen!\n JSON.parse(cache.using(data => JSON.stringify(data.targets)));\n\n const addExternalDependency = (ref: string) => {\n externalDependencies.push(ref);\n };\n\n return { ...makeConfigAPI(cache), targets, addExternalDependency };\n}\n\nexport function makePluginAPI<SideChannel extends Context.SimplePlugin>(\n cache: CacheConfigurator<SideChannel>,\n externalDependencies: Array<string>,\n): PluginAPI {\n const assumption = (name: string) =>\n cache.using(data => data.assumptions[name]);\n\n return { ...makePresetAPI(cache, externalDependencies), assumption };\n}\n\nfunction assertVersion(range: string | number): void {\n if (typeof range === \"number\") {\n if (!Number.isInteger(range)) {\n throw new Error(\"Expected string or integer value.\");\n }\n range = `^${range}.0.0-0`;\n }\n if (typeof range !== \"string\") {\n throw new Error(\"Expected string or integer value.\");\n }\n\n // We want \"*\" to also allow any pre-release, but we do not pass\n // the includePrerelease option to semver.satisfies because we\n // do notLine truncated
@@ -0,0 +1,415 @@
/**
Basic foreground colors.
[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support)
*/
declare type ForegroundColor =
| 'black'
| 'red'
| 'green'
| 'yellow'
| 'blue'
| 'magenta'
| 'cyan'
| 'white'
| 'gray'
| 'grey'
| 'blackBright'
| 'redBright'
| 'greenBright'
| 'yellowBright'
| 'blueBright'
| 'magentaBright'
| 'cyanBright'
| 'whiteBright';
/**
Basic background colors.
[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support)
*/
declare type BackgroundColor =
| 'bgBlack'
| 'bgRed'
| 'bgGreen'
| 'bgYellow'
| 'bgBlue'
| 'bgMagenta'
| 'bgCyan'
| 'bgWhite'
| 'bgGray'
| 'bgGrey'
| 'bgBlackBright'
| 'bgRedBright'
| 'bgGreenBright'
| 'bgYellowBright'
| 'bgBlueBright'
| 'bgMagentaBright'
| 'bgCyanBright'
| 'bgWhiteBright';
/**
Basic colors.
[More colors here.](https://github.com/chalk/chalk/blob/master/readme.md#256-and-truecolor-color-support)
*/
declare type Color = ForegroundColor | BackgroundColor;
declare type Modifiers =
| 'reset'
| 'bold'
| 'dim'
| 'italic'
| 'underline'
| 'inverse'
| 'hidden'
| 'strikethrough'
| 'visible';
declare namespace chalk {
/**
Levels:
- `0` - All colors disabled.
- `1` - Basic 16 colors support.
- `2` - ANSI 256 colors support.
- `3` - Truecolor 16 million colors support.
*/
type Level = 0 | 1 | 2 | 3;
interface Options {
/**
Specify the color support for Chalk.
By default, color support is automatically detected based on the environment.
Levels:
- `0` - All colors disabled.
- `1` - Basic 16 colors support.
- `2` - ANSI 256 colors support.
- `3` - Truecolor 16 million colors support.
*/
level?: Level;
}
/**
Return a new Chalk instance.
*/
type Instance = new (options?: Options) => Chalk;
/**
Detect whether the terminal supports color.
*/
interface ColorSupport {
/**
The color level used by Chalk.
*/
level: Level;
/**
Return whether Chalk supports basic 16 colors.
*/
hasBasic: boolean;
/**
Return whether Chalk supports ANSI 256 colors.
*/
has256: boolean;
/**
Return whether Chalk supports Truecolor 16 million colors.
*/
has16m: boolean;
}
interface ChalkFunction {
/**
Use a template string.
@remarks Template literals are unsupported for nested calls (see [issue #341](https://github.com/chalk/chalk/issues/341))
@example
```
import chalk = require('chalk');
log(chalk`
CPU: {red ${cpu.totalPercent}%}
RAM: {green ${ram.used / ram.total * 100}%}
DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%}
`);
```
@example
```
import chalk = require('chalk');
log(chalk.red.bgBlack`2 + 3 = {bold ${2 + 3}}`)
```
*/
(text: TemplateStringsArray, ...placeholders: unknown[]): string;
(...text: unknown[]): string;
}
interface Chalk extends ChalkFunction {
/**
Return a new Chalk instance.
*/
Instance: Instance;
/**
The color support for Chalk.
By default, color support is automatically detected based on the environment.
Levels:
- `0` - All colors disabled.
- `1` - Basic 16 colors support.
- `2` - ANSI 256 colors support.
- `3` - Truecolor 16 million colors support.
*/
level: Level;
/**
Use HEX value to set text color.
@param color - Hexadecimal value representing the desired color.
@example
```
import chalk = require('chalk');
chalk.hex('#DEADED');
```
*/
hex(color: string): Chalk;
/**
Use keyword color value to set text color.
@param color - Keyword value representing the desired color.
@example
```
import chalk = require('chalk');
chalk.keyword('orange');
```
*/
keyword(color: string): Chalk;
/**
Use RGB values to set text color.
*/
rgb(red: number, green: number, blue: number): Chalk;
/**
Use HSL values to set text color.
*/
hsl(hue: number, saturation: number, lightness: number): Chalk;
/**
Use HSV values to set text color.
*/
hsv(hue: number, saturation: number, value: number): Chalk;
/**
Use HWB values to set text color.
*/
hwb(hue: number, whiteness: number, blackness: number): Chalk;
/**
Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set text color.
30 <= code && code < 38 || 90 <= code && code < 98
For example, 31 for red, 91 for redBright.
*/
ansi(code: number): Chalk;
/**
Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set text color.
*/
ansi256(index: number): Chalk;
/**
Use HEX value to set background color.
@param color - Hexadecimal value representing the desired color.
@example
```
import chalk = require('chalk');
chalk.bgHex('#DEADED');
```
*/
bgHex(color: string): Chalk;
/**
Use keyword color value to set background color.
@param color - Keyword value representing the desired color.
@example
```
import chalk = require('chalk');
chalk.bgKeyword('orange');
```
*/
bgKeyword(color: string): Chalk;
/**
Use RGB values to set background color.
*/
bgRgb(red: number, green: number, blue: number): Chalk;
/**
Use HSL values to set background color.
*/
bgHsl(hue: number, saturation: number, lightness: number): Chalk;
/**
Use HSV values to set background color.
*/
bgHsv(hue: number, saturation: number, value: number): Chalk;
/**
Use HWB values to set background color.
*/
bgHwb(hue: number, whiteness: number, blackness: number): Chalk;
/**
Use a [Select/Set Graphic Rendition](https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters) (SGR) [color code number](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) to set background color.
30 <= code && code < 38 || 90 <= code && code < 98
For example, 31 for red, 91 for redBright.
Use the foreground code, not the background code (for example, not 41, nor 101).
*/
bgAnsi(code: number): Chalk;
/**
Use a [8-bit unsigned number](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) to set background color.
*/
bgAnsi256(index: number): Chalk;
/**
Modifier: Resets the current color chain.
*/
readonly reset: Chalk;
/**
Modifier: Make text bold.
*/
readonly bold: Chalk;
/**
Modifier: Emitting only a small amount of light.
*/
readonly dim: Chalk;
/**
Modifier: Make text italic. (Not widely supported)
*/
readonly italic: Chalk;
/**
Modifier: Make text underline. (Not widely supported)
*/
readonly underline: Chalk;
/**
Modifier: Inverse background and foreground colors.
*/
readonly inverse: Chalk;
/**
Modifier: Prints the text, but makes it invisible.
*/
readonly hidden: Chalk;
/**
Modifier: Puts a horizontal line through the center of the text. (Not widely supported)
*/
readonly strikethrough: Chalk;
/**
Modifier: Prints the text only when Chalk has a color support level > 0.
Can be useful for things that are purely cosmetic.
*/
readonly visible: Chalk;
readonly black: Chalk;
readonly red: Chalk;
readonly green: Chalk;
readonly yellow: Chalk;
readonly blue: Chalk;
readonly magenta: Chalk;
readonly cyan: Chalk;
readonly white: Chalk;
/*
Alias for `blackBright`.
*/
readonly gray: Chalk;
/*
Alias for `blackBright`.
*/
readonly grey: Chalk;
readonly blackBright: Chalk;
readonly redBright: Chalk;
readonly greenBright: Chalk;
readonly yellowBright: Chalk;
readonly blueBright: Chalk;
readonly magentaBright: Chalk;
readonly cyanBright: Chalk;
readonly whiteBright: Chalk;
readonly bgBlack: Chalk;
readonly bgRed: Chalk;
readonly bgGreen: Chalk;
readonly bgYellow: Chalk;
readonly bgBlue: Chalk;
readonly bgMagenta: Chalk;
readonly bgCyan: Chalk;
readonly bgWhite: Chalk;
/*
Alias for `bgBlackBright`.
*/
readonly bgGray: Chalk;
/*
Alias for `bgBlackBright`.
*/
readonly bgGrey: Chalk;
readonly bgBlackBright: Chalk;
readonly bgRedBright: Chalk;
readonly bgGreenBright: Chalk;
readonly bgYellowBright: Chalk;
readonly bgBlueBright: Chalk;
readonly bgMagentaBright: Chalk;
readonly bgCyanBright: Chalk;
readonly bgWhiteBright: Chalk;
}
}
/**
Main Chalk object that allows to chain styles together.
Call the last one as a method with a string argument.
Order doesn't matter, and later styles take precedent in case of a conflict.
This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`.
*/
declare const chalk: chalk.Chalk & chalk.ChalkFunction & {
supportsColor: chalk.ColorSupport | false;
Level: chalk.Level;
Color: Color;
ForegroundColor: ForegroundColor;
BackgroundColor: BackgroundColor;
Modifiers: Modifiers;
stderr: chalk.Chalk & {supportsColor: chalk.ColorSupport | false};
};
export = chalk;
@@ -0,0 +1,143 @@
'use strict';
var _contextCompat = require('eslint-module-utils/contextCompat');
var _docsUrl = require('../docsUrl');var _docsUrl2 = _interopRequireDefault(_docsUrl);function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { 'default': obj };} /**
* @fileoverview Rule to prefer ES6 to CJS
* @author Jamund Ferguson
*/var EXPORT_MESSAGE = 'Expected "export" or "export default"';var IMPORT_MESSAGE = 'Expected "import" instead of "require()"';
function normalizeLegacyOptions(options) {
if (options.indexOf('allow-primitive-modules') >= 0) {
return { allowPrimitiveModules: true };
}
return options[0] || {};
}
function allowPrimitive(node, options) {
if (!options.allowPrimitiveModules) {return false;}
if (node.parent.type !== 'AssignmentExpression') {return false;}
return node.parent.right.type !== 'ObjectExpression';
}
function allowRequire(node, options) {
return options.allowRequire;
}
function allowConditionalRequire(node, options) {
return options.allowConditionalRequire !== false;
}
function validateScope(scope) {
return scope.variableScope.type === 'module';
}
// https://github.com/estree/estree/blob/HEAD/es5.md
function isConditional(node) {
if (
node.type === 'IfStatement' ||
node.type === 'TryStatement' ||
node.type === 'LogicalExpression' ||
node.type === 'ConditionalExpression')
{
return true;
}
if (node.parent) {return isConditional(node.parent);}
return false;
}
function isLiteralString(node) {
return node.type === 'Literal' && typeof node.value === 'string' ||
node.type === 'TemplateLiteral' && node.expressions.length === 0;
}
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
var schemaString = { 'enum': ['allow-primitive-modules'] };
var schemaObject = {
type: 'object',
properties: {
allowPrimitiveModules: { type: 'boolean' },
allowRequire: { type: 'boolean' },
allowConditionalRequire: { type: 'boolean' } },
additionalProperties: false };
module.exports = {
meta: {
type: 'suggestion',
docs: {
category: 'Module systems',
description: 'Forbid CommonJS `require` calls and `module.exports` or `exports.*`.',
url: (0, _docsUrl2['default'])('no-commonjs') },
schema: {
anyOf: [
{
type: 'array',
items: [schemaString],
additionalItems: false },
{
type: 'array',
items: [schemaObject],
additionalItems: false }] } },
create: function () {function create(context) {
var options = normalizeLegacyOptions(context.options);
return {
MemberExpression: function () {function MemberExpression(node) {
// module.exports
if (node.object.name === 'module' && node.property.name === 'exports') {
if (allowPrimitive(node, options)) {return;}
context.report({ node: node, message: EXPORT_MESSAGE });
}
// exports.
if (node.object.name === 'exports') {
var isInScope = (0, _contextCompat.getScope)(context, node).
variables.
some(function (variable) {return variable.name === 'exports';});
if (!isInScope) {
context.report({ node: node, message: EXPORT_MESSAGE });
}
}
}return MemberExpression;}(),
CallExpression: function () {function CallExpression(call) {
if (!validateScope((0, _contextCompat.getScope)(context, call))) {return;}
if (call.callee.type !== 'Identifier') {return;}
if (call.callee.name !== 'require') {return;}
if (call.arguments.length !== 1) {return;}
if (!isLiteralString(call.arguments[0])) {return;}
if (allowRequire(call, options)) {return;}
if (allowConditionalRequire(call, options) && isConditional(call.parent)) {return;}
// keeping it simple: all 1-string-arg `require` calls are reported
context.report({
node: call.callee,
message: IMPORT_MESSAGE });
}return CallExpression;}() };
}return create;}() };
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ydWxlcy9uby1jb21tb25qcy5qcyJdLCJuYW1lcyI6WyJFWFBPUlRfTUVTU0FHRSIsIklNUE9SVF9NRVNTQUdFIiwibm9ybWFsaXplTGVnYWN5T3B0aW9ucyIsIm9wdGlvbnMiLCJpbmRleE9mIiwiYWxsb3dQcmltaXRpdmVNb2R1bGVzIiwiYWxsb3dQcmltaXRpdmUiLCJub2RlIiwicGFyZW50IiwidHlwZSIsInJpZ2h0IiwiYWxsb3dSZXF1aXJlIiwiYWxsb3dDb25kaXRpb25hbFJlcXVpcmUiLCJ2YWxpZGF0ZVNjb3BlIiwic2NvcGUiLCJ2YXJpYWJsZVNjb3BlIiwiaXNDb25kaXRpb25hbCIsImlzTGl0ZXJhbFN0cmluZyIsInZhbHVlIiwiZXhwcmVzc2lvbnMiLCJsZW5ndGgiLCJzY2hlbWFTdHJpbmciLCJzY2hlbWFPYmplY3QiLCJwcm9wZXJ0aWVzIiwiYWRkaXRpb25hbFByb3BlcnRpZXMiLCJtb2R1bGUiLCJleHBvcnRzIiwibWV0YSIsImRvY3MiLCJjYXRlZ29yeSIsImRlc2NyaXB0aW9uIiwidXJsIiwic2NoZW1hIiwiYW55T2YiLCJpdGVtcyIsImFkZGl0aW9uYWxJdGVtcyIsImNyZWF0ZSIsImNvbnRleHQiLCJNZW1iZXJFeHByZXNzaW9uIiwib2JqZWN0IiwibmFtZSIsInByb3BlcnR5IiwicmVwb3J0IiwibWVzc2FnZSIsImlzSW5TY29wZSIsInZhcmlhYmxlcyIsInNvbWUiLCJ2YXJpYWJsZSIsIkNhbGxFeHByZXNzaW9uIiwiY2FsbCIsImNhbGxlZSIsImFyZ3VtZW50cyJdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFLQTs7QUFFQSxxQyxpSkFQQTs7O3lMQVNBLElBQU1BLGlCQUFpQix1Q0FBdkIsQ0FDQSxJQUFNQyxpQkFBaUIsMENBQXZCOztBQUVBLFNBQVNDLHNCQUFULENBQWdDQyxPQUFoQyxFQUF5QztBQUN2QyxNQUFJQSxRQUFRQyxPQUFSLENBQWdCLHlCQUFoQixLQUE4QyxDQUFsRCxFQUFxRDtBQUNuRCxXQUFPLEVBQUVDLHVCQUF1QixJQUF6QixFQUFQO0FBQ0Q7QUFDRCxTQUFPRixRQUFRLENBQVIsS0FBYyxFQUFyQjtBQUNEOztBQUVELFNBQVNHLGNBQVQsQ0FBd0JDLElBQXhCLEVBQThCSixPQUE5QixFQUF1QztBQUNyQyxNQUFJLENBQUNBLFFBQVFFLHFCQUFiLEVBQW9DLENBQUUsT0FBTyxLQUFQLENBQWU7QUFDckQsTUFBSUUsS0FBS0MsTUFBTCxDQUFZQyxJQUFaLEtBQXFCLHNCQUF6QixFQUFpRCxDQUFFLE9BQU8sS0FBUCxDQUFlO0FBQ2xFLFNBQU9GLEtBQUtDLE1BQUwsQ0FBWUUsS0FBWixDQUFrQkQsSUFBbEIsS0FBMkIsa0JBQWxDO0FBQ0Q7O0FBRUQsU0FBU0UsWUFBVCxDQUFzQkosSUFBdEIsRUFBNEJKLE9BQTVCLEVBQXFDO0FBQ25DLFNBQU9BLFFBQVFRLFlBQWY7QUFDRDs7QUFFRCxTQUFTQyx1QkFBVCxDQUFpQ0wsSUFBakMsRUFBdUNKLE9BQXZDLEVBQWdEO0FBQzlDLFNBQU9BLFFBQVFTLHVCQUFSLEtBQW9DLEtBQTNDO0FBQ0Q7O0FBRUQsU0FBU0MsYUFBVCxDQUF1QkMsS0FBdkIsRUFBOEI7QUFDNUIsU0FBT0EsTUFBTUMsYUFBTixDQUFvQk4sSUFBcEIsS0FBNkIsUUFBcEM7QUFDRDs7QUFFRDtBQUNBLFNBQVNPLGFBQVQsQ0FBdUJULElBQXZCLEVBQTZCO0FBQzNCO0FBQ0VBLE9BQUtFLElBQUwsS0FBYyxhQUFkO0FBQ0dGLE9BQUtFLElBQUwsS0FBYyxjQURqQjtBQUVHRixPQUFLRSxJQUFMLEtBQWMsbUJBRmpCO0FBR0dGLE9BQUtFLElBQUwsS0FBYyx1QkFKbkI7QUFLRTtBQUNBLFdBQU8sSUFBUDtBQUNEO0FBQ0QsTUFBSUYsS0FBS0MsTUFBVCxFQUFpQixDQUFFLE9BQU9RLGNBQWNULEtBQUtDLE1BQW5CLENBQVAsQ0FBb0M7QUFDdkQsU0FBTyxLQUFQO0FBQ0Q7O0FBRUQsU0FBU1MsZUFBVCxDQUF5QlYsSUFBekIsRUFBK0I7QUFDN0IsU0FBT0EsS0FBS0UsSUFBTCxLQUFjLFNBQWQsSUFBMkIsT0FBT0YsS0FBS1csS0FBWixLQUFzQixRQUFqRDtBQUNGWCxPQUFLRSxJQUFMLEtBQWMsaUJBQWQsSUFBbUNGLEtBQUtZLFdBQUwsQ0FBaUJDLE1BQWpCLEtBQTRCLENBRHBFO0FBRUQ7O0FBRUQ7QUFDQTtBQUNBOztBQUVBLElBQU1DLGVBQWUsRUFBRSxRQUFNLENBQUMseUJBQUQsQ0FBUixFQUFyQjtBQUNBLElBQU1DLGVBQWU7QUFDbkJiLFFBQU0sUUFEYTtBQUVuQmMsY0FBWTtBQUNWbEIsMkJBQXVCLEVBQUVJLE1BQU0sU0FBUixFQURiO0FBRVZFLGtCQUFjLEVBQUVGLE1BQU0sU0FBUixFQUZKO0FBR1ZHLDZCQUF5QixFQUFFSCxNQUFNLFNBQVIsRUFIZixFQUZPOztBQU9uQmUsd0JBQXNCLEtBUEgsRUFBckI7OztBQVVBQyxPQUFPQyxPQUFQLEdBQWlCO0FBQ2ZDLFFBQU07QUFDSmxCLFVBQU0sWUFERjtBQUVKbUIsVUFBTTtBQUNKQyxnQkFBVSxnQkFETjtBQUVKQyxtQkFBYSxzRUFGVDtBQUdKQyxXQUFLLDBCQUFRLGFBQVIsQ0FIRCxFQUZGOzs7QUFRSkMsWUFBUTtBQUNOQyxhQUFPO0FBQ0w7QUFDRXhCLGNBQU0sT0FEUjtBQUVFeUIsZUFBTyxDQUFDYixZQUFELENBRlQ7QUFHRWMseUJBQWlCLEtBSG5CLEVBREs7O0FBTUw7QUFDRTFCLGNBQU0sT0FEUjtBQUVFeUIsZUFBTyxDQUFDWixZQUFELENBRlQ7QUFHRWEseUJBQWlCLEtBSG5CLEVBTkssQ0FERCxFQVJKLEVBRFM7Ozs7OztBQXlCZkMsUUF6QmUsK0JBeUJSQyxPQXpCUSxFQXlCQztBQUNkLFVBQU1sQyxVQUFVRCx1QkFBdUJtQyxRQUFRbEMsT0FBL0IsQ0FBaEI7O0FBRUEsYUFBTzs7QUFFTG1DLHdCQUZLLHlDQUVZL0IsSUFGWixFQUVrQjs7QUFFckI7QUFDQSxnQkFBSUEsS0FBS2dDLE1BQUwsQ0FBWUMsSUFBWixLQUFxQixRQUFyQixJQUFpQ2pDLEtBQUtrQyxRQUFMLENBQWNELElBQWQsS0FBdUIsU0FBNUQsRUFBdUU7QUFDckUsa0JBQUlsQyxlQUFlQyxJQUFmLEVBQXFCSixPQUFyQixDQUFKLEVBQW1DLENBQUUsT0FBUztBQUM5Q2tDLHNCQUFRSyxNQUFSLENBQWUsRUFBRW5DLFVBQUYsRUFBUW9DLFNBQVMzQyxjQUFqQixFQUFmO0FBQ0Q7O0FBRUQ7QUFDQSxnQkFBSU8sS0FBS2dDLE1BQUwsQ0FBWUMsSUFBWixLQUFxQixTQUF6QixFQUFvQztBQUNsQyxrQkFBTUksWUFBWSw2QkFBU1AsT0FBVCxFQUFrQjlCLElBQWxCO0FBQ2ZzQyx1QkFEZTtBQUVmQyxrQkFGZSxDQUVWLFVBQUNDLFFBQUQsVUFBY0EsU0FBU1AsSUFBVCxLQUFrQixTQUFoQyxFQUZVLENBQWxCO0FBR0Esa0JBQUksQ0FBQ0ksU0FBTCxFQUFnQjtBQUNkUCx3QkFBUUssTUFBUixDQUFlLEVBQUVuQyxVQUFGLEVBQVFvQyxTQUFTM0MsY0FBakIsRUFBZjtBQUNEO0FBQ0Y7O0FBRUYsV0FwQkk7QUFxQkxnRCxzQkFyQkssdUNBcUJVQyxJQXJCVixFQXFCZ0I7QUFDbkIsZ0JBQUksQ0FBQ3BDLGNBQWMsNkJBQVN3QixPQUFULEVBQWtCWSxJQUFsQixDQUFkLENBQUwsRUFBNkMsQ0FBRSxPQUFTOztBQUV4RCxnQkFBSUEsS0FBS0MsTUFBTCxDQUFZekMsSUFBWixLQUFxQixZQUF6QixFQUF1QyxDQUFFLE9BQVM7QUFDbEQsZ0JBQUl3QyxLQUFLQyxNQUFMLENBQVlWLElBQVosS0FBcUIsU0FBekIsRUFBb0MsQ0FBRSxPQUFTOztBQUUvQyxnQkFBSVMsS0FBS0UsU0FBTCxDQUFlL0IsTUFBZixLQUEwQixDQUE5QixFQUFpQyxDQUFFLE9BQVM7QUFDNUMsZ0JBQUksQ0FBQ0gsZ0JBQWdCZ0MsS0FBS0UsU0FBTCxDQUFlLENBQWYsQ0FBaEIsQ0FBTCxFQUF5QyxDQUFFLE9BQVM7O0FBRXBELGdCQUFJeEMsYUFBYXNDLElBQWIsRUFBbUI5QyxPQUFuQixDQUFKLEVBQWlDLENBQUUsT0FBUzs7QUFFNUMsZ0JBQUlTLHdCQUF3QnFDLElBQXhCLEVBQThCOUMsT0FBOUIsS0FBMENhLGNBQWNpQyxLQUFLekMsTUFBbkIsQ0FBOUMsRUFBMEUsQ0FBRSxPQUFTOztBQUVyRjtBQUNBNkIsb0JBQVFLLE1BQVIsQ0FBZTtLine truncated
@@ -0,0 +1,199 @@
## V8 internals
The hooks to access V8 internals—including GC and statistics—are different across the supported versions of V8, therefore NAN provides its own hooks that call the appropriate V8 methods.
- <a href="#api_nan_gc_callback"><b><code>NAN_GC_CALLBACK()</code></b></a>
- <a href="#api_nan_add_gc_epilogue_callback"><b><code>Nan::AddGCEpilogueCallback()</code></b></a>
- <a href="#api_nan_remove_gc_epilogue_callback"><b><code>Nan::RemoveGCEpilogueCallback()</code></b></a>
- <a href="#api_nan_add_gc_prologue_callback"><b><code>Nan::AddGCPrologueCallback()</code></b></a>
- <a href="#api_nan_remove_gc_prologue_callback"><b><code>Nan::RemoveGCPrologueCallback()</code></b></a>
- <a href="#api_nan_get_heap_statistics"><b><code>Nan::GetHeapStatistics()</code></b></a>
- <a href="#api_nan_set_counter_function"><b><code>Nan::SetCounterFunction()</code></b></a>
- <a href="#api_nan_set_create_histogram_function"><b><code>Nan::SetCreateHistogramFunction()</code></b></a>
- <a href="#api_nan_set_add_histogram_sample_function"><b><code>Nan::SetAddHistogramSampleFunction()</code></b></a>
- <a href="#api_nan_idle_notification"><del><b><code>Nan::IdleNotification()</code></b></del></a>
- <a href="#api_nan_low_memory_notification"><b><code>Nan::LowMemoryNotification()</code></b></a>
- <a href="#api_nan_context_disposed_notification"><b><code>Nan::ContextDisposedNotification()</code></b></a>
- <a href="#api_nan_get_internal_field_pointer"><b><code>Nan::GetInternalFieldPointer()</code></b></a>
- <a href="#api_nan_set_internal_field_pointer"><b><code>Nan::SetInternalFieldPointer()</code></b></a>
- <a href="#api_nan_adjust_external_memory"><b><code>Nan::AdjustExternalMemory()</code></b></a>
<a name="api_nan_gc_callback"></a>
### NAN_GC_CALLBACK(callbackname)
Use `NAN_GC_CALLBACK` to declare your callbacks for `Nan::AddGCPrologueCallback()` and `Nan::AddGCEpilogueCallback()`. Your new method receives the arguments `v8::GCType type` and `v8::GCCallbackFlags flags`.
```c++
static Nan::Persistent<Function> callback;
NAN_GC_CALLBACK(gcPrologueCallback) {
v8::Local<Value> argv[] = { Nan::New("prologue").ToLocalChecked() };
Nan::MakeCallback(Nan::GetCurrentContext()->Global(), Nan::New(callback), 1, argv);
}
NAN_METHOD(Hook) {
callback.Reset(To<Function>(args[0]).ToLocalChecked());
Nan::AddGCPrologueCallback(gcPrologueCallback);
info.GetReturnValue().Set(info.Holder());
}
```
<a name="api_nan_add_gc_epilogue_callback"></a>
### Nan::AddGCEpilogueCallback()
Signature:
```c++
void Nan::AddGCEpilogueCallback(v8::Isolate::GCEpilogueCallback callback, v8::GCType gc_type_filter = v8::kGCTypeAll)
```
Calls V8's [`AddGCEpilogueCallback()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a580f976e4290cead62c2fc4dd396be3e).
<a name="api_nan_remove_gc_epilogue_callback"></a>
### Nan::RemoveGCEpilogueCallback()
Signature:
```c++
void Nan::RemoveGCEpilogueCallback(v8::Isolate::GCEpilogueCallback callback)
```
Calls V8's [`RemoveGCEpilogueCallback()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#adca9294555a3908e9f23c7bb0f0f284c).
<a name="api_nan_add_gc_prologue_callback"></a>
### Nan::AddGCPrologueCallback()
Signature:
```c++
void Nan::AddGCPrologueCallback(v8::Isolate::GCPrologueCallback, v8::GCType gc_type_filter callback)
```
Calls V8's [`AddGCPrologueCallback()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a6dbef303603ebdb03da6998794ea05b8).
<a name="api_nan_remove_gc_prologue_callback"></a>
### Nan::RemoveGCPrologueCallback()
Signature:
```c++
void Nan::RemoveGCPrologueCallback(v8::Isolate::GCPrologueCallback callback)
```
Calls V8's [`RemoveGCPrologueCallback()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a5f72c7cda21415ce062bbe5c58abe09e).
<a name="api_nan_get_heap_statistics"></a>
### Nan::GetHeapStatistics()
Signature:
```c++
void Nan::GetHeapStatistics(v8::HeapStatistics *heap_statistics)
```
Calls V8's [`GetHeapStatistics()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a5593ac74687b713095c38987e5950b34).
<a name="api_nan_set_counter_function"></a>
### Nan::SetCounterFunction()
Signature:
```c++
void Nan::SetCounterFunction(v8::CounterLookupCallback cb)
```
Calls V8's [`SetCounterFunction()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a045d7754e62fa0ec72ae6c259b29af94).
<a name="api_nan_set_create_histogram_function"></a>
### Nan::SetCreateHistogramFunction()
Signature:
```c++
void Nan::SetCreateHistogramFunction(v8::CreateHistogramCallback cb)
```
Calls V8's [`SetCreateHistogramFunction()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a542d67e85089cb3f92aadf032f99e732).
<a name="api_nan_set_add_histogram_sample_function"></a>
### Nan::SetAddHistogramSampleFunction()
Signature:
```c++
void Nan::SetAddHistogramSampleFunction(v8::AddHistogramSampleCallback cb)
```
Calls V8's [`SetAddHistogramSampleFunction()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#aeb420b690bc2c216882d6fdd00ddd3ea).
<a name="api_nan_idle_notification"></a>
### <del>Nan::IdleNotification()</del>
Signature:
```c++
NAN_DEPRECATED bool Nan::IdleNotification(int idle_time_in_ms)
```
Calls V8's [`IdleNotification()` or `IdleNotificationDeadline()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#ad6a2a02657f5425ad460060652a5a118) depending on V8 version. Removed in V8 12.7.41.
<a name="api_nan_low_memory_notification"></a>
### Nan::LowMemoryNotification()
Signature:
```c++
void Nan::LowMemoryNotification()
```
Calls V8's [`LowMemoryNotification()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#a24647f61d6b41f69668094bdcd6ea91f).
<a name="api_nan_context_disposed_notification"></a>
### Nan::ContextDisposedNotification()
Signature:
```c++
void Nan::ContextDisposedNotification()
```
Calls V8's [`ContextDisposedNotification()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#ad7f5dc559866343fe6cd8db1f134d48b).
<a name="api_nan_get_internal_field_pointer"></a>
### Nan::GetInternalFieldPointer()
Gets a pointer to the internal field with at `index` from a V8 `Object` handle.
Signature:
```c++
void* Nan::GetInternalFieldPointer(v8::Local<v8::Object> object, int index)
```
Calls the Object's [`GetAlignedPointerFromInternalField()` or `GetPointerFromInternalField()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#a580ea84afb26c005d6762eeb9e3c308f) depending on the version of V8.
<a name="api_nan_set_internal_field_pointer"></a>
### Nan::SetInternalFieldPointer()
Sets the value of the internal field at `index` on a V8 `Object` handle.
Signature:
```c++
void Nan::SetInternalFieldPointer(v8::Local<v8::Object> object, int index, void* value)
```
Calls the Object's [`SetAlignedPointerInInternalField()` or `SetPointerInInternalField()`](https://v8docs.nodesource.com/node-8.16/db/d85/classv8_1_1_object.html#ab3c57184263cf29963ef0017bec82281) depending on the version of V8.
<a name="api_nan_adjust_external_memory"></a>
### Nan::AdjustExternalMemory()
Signature:
```c++
int Nan::AdjustExternalMemory(int bytesChange)
```
Calls V8's [`AdjustAmountOfExternalAllocatedMemory()`](https://v8docs.nodesource.com/node-8.16/d5/dda/classv8_1_1_isolate.html#ae1a59cac60409d3922582c4af675473e).
@@ -0,0 +1 @@
{"version":3,"file":"MaybeClassElementMetadataKind.js","sourceRoot":"","sources":["../../../../src/metadata/models/MaybeClassElementMetadataKind.ts"],"names":[],"mappings":";;;AAAA,IAAY,6BAEX;AAFD,WAAY,6BAA6B;IACvC,wFAAY,CAAA;AACd,CAAC,EAFW,6BAA6B,6CAA7B,6BAA6B,QAExC"}
@@ -0,0 +1,2 @@
import "./react-textarea-autosize.browser.development.cjs.js";
export { _default as default } from "./react-textarea-autosize.browser.development.cjs.default.js";
@@ -0,0 +1 @@
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;AAaM,SAAS,0CAAgB,GAAuF;IACrH,MAAM,SAAqC,CAAA,GAAA,mBAAK,EAAK;IACrD,MAAM,aAAoD,CAAA,GAAA,mBAAK,EAAE;IAEjE,MAAM,YAAY,CAAA,GAAA,wBAAU,EAC1B,CAAC;QACC,IAAI,OAAO,QAAQ,YAAY;YAC7B,MAAM,cAAc;YACpB,MAAM,aAAa,YAAY;YAC/B,OAAO;gBACL,IAAI,OAAO,eAAe,YACxB;qBAEA,YAAY;YAEhB;QACF,OAAO,IAAI,KAAK;YACd,IAAI,OAAO,GAAG;YACd,OAAO;gBACL,IAAI,OAAO,GAAG;YAChB;QACF;IACF,GACA;QAAC;KAAI;IAGP,OAAO,CAAA,GAAA,oBAAM,EACX,IAAO,CAAA;YACL,IAAI,WAAU;gBACZ,OAAO,OAAO,OAAO;YACvB;YACA,IAAI,SAAQ,MAAO;gBACjB,OAAO,OAAO,GAAG;gBACjB,IAAI,WAAW,OAAO,EAAE;oBACtB,WAAW,OAAO;oBAClB,WAAW,OAAO,GAAG;gBACvB;gBAEA,IAAI,SAAS,MACX,WAAW,OAAO,GAAG,UAAU;YAEnC;QACF,CAAA,GACA;QAAC;KAAU;AAEf","sources":["packages/@react-aria/utils/src/useObjectRef.ts"],"sourcesContent":["/*\n * Copyright 2021 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 {MutableRefObject, useCallback, useMemo, useRef} from 'react';\n\n/**\n * Offers an object ref for a given callback ref or an object ref. Especially\n * helfpul when passing forwarded refs (created using `React.forwardRef`) to\n * React Aria hooks.\n *\n * @param ref The original ref intended to be used.\n * @returns An object ref that updates the given ref.\n * @see https://react.dev/reference/react/forwardRef\n */\nexport function useObjectRef<T>(ref?: ((instance: T | null) => (() => void) | void) | MutableRefObject<T | null> | null): MutableRefObject<T | null> {\n const objRef: MutableRefObject<T | null> = useRef<T>(null);\n const cleanupRef: MutableRefObject<(() => void) | void> = useRef(undefined);\n\n const refEffect = useCallback(\n (instance: T | null) => {\n if (typeof ref === 'function') {\n const refCallback = ref;\n const refCleanup = refCallback(instance);\n return () => {\n if (typeof refCleanup === 'function') {\n refCleanup();\n } else {\n refCallback(null);\n }\n };\n } else if (ref) {\n ref.current = instance;\n return () => {\n ref.current = null;\n };\n }\n },\n [ref]\n );\n\n return useMemo(\n () => ({\n get current() {\n return objRef.current;\n },\n set current(value) {\n objRef.current = value;\n if (cleanupRef.current) {\n cleanupRef.current();\n cleanupRef.current = undefined;\n }\n\n if (value != null) {\n cleanupRef.current = refEffect(value);\n }\n }\n }),\n [refEffect]\n );\n}\n"],"names":[],"version":3,"file":"useObjectRef.main.js.map"}
@@ -0,0 +1,29 @@
/**
* @author Toru Nagashima <https://github.com/mysticatea>
* See LICENSE file in root directory for full license.
*/
"use strict"
module.exports = {
meta: {
docs: {
description: "disallow block-scoped function declarations.",
category: "ES2015",
recommended: false,
url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-block-scoped-functions.html",
},
fixable: null,
messages: {
forbidden: "ES2015 block-scoped functions are forbidden.",
},
schema: [],
type: "problem",
},
create(context) {
return {
":not(:function) > BlockStatement > FunctionDeclaration"(node) {
context.report({ node, messageId: "forbidden" })
},
}
},
}
@@ -0,0 +1,5 @@
/**
* Forked from https://github.com/iendeavor/import-meta-env/tree/main/packages/babel 0.4.2 (MIT License - Copyright (c) 2021 Ernest)
*/
import type { PluginObj } from "@babel/core";
export declare function importMetaEnvPlugin({ template, types }: any): PluginObj;
@@ -0,0 +1,261 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@typescript-eslint/utils");
const tsutils = __importStar(require("ts-api-utils"));
const util_1 = require("../util");
const useUnknownMessageBase = 'Prefer the safe `: unknown` for a `{{method}}`{{append}} callback variable.';
exports.default = (0, util_1.createRule)({
name: 'use-unknown-in-catch-callback-variable',
meta: {
type: 'suggestion',
docs: {
description: 'Enforce typing arguments in Promise rejection callbacks as `unknown`',
recommended: 'strict',
requiresTypeChecking: true,
},
hasSuggestions: true,
messages: {
addUnknownRestTypeAnnotationSuggestion: 'Add an explicit `: [unknown]` type annotation to the rejection callback rest variable.',
addUnknownTypeAnnotationSuggestion: 'Add an explicit `: unknown` type annotation to the rejection callback variable.',
useUnknown: useUnknownMessageBase,
useUnknownArrayDestructuringPattern: `${useUnknownMessageBase} The thrown error may not be iterable.`,
useUnknownObjectDestructuringPattern: `${useUnknownMessageBase} The thrown error may be nullable, or may not have the expected shape.`,
wrongRestTypeAnnotationSuggestion: 'Change existing type annotation to `: [unknown]`.',
wrongTypeAnnotationSuggestion: 'Change existing type annotation to `: unknown`.',
},
schema: [],
},
defaultOptions: [],
create(context) {
const { esTreeNodeToTSNodeMap, program } = (0, util_1.getParserServices)(context);
const checker = program.getTypeChecker();
function isFlaggableHandlerType(type) {
for (const unionPart of tsutils.unionConstituents(type)) {
const callSignatures = tsutils.getCallSignaturesOfType(unionPart);
if (callSignatures.length === 0) {
// Ignore any non-function components to the type. Those are not this rule's problem.
continue;
}
for (const callSignature of callSignatures) {
const firstParam = callSignature.parameters.at(0);
if (!firstParam) {
// it's not an issue if there's no catch variable at all.
continue;
}
let firstParamType = checker.getTypeOfSymbol(firstParam);
const decl = firstParam.valueDeclaration;
if (decl != null && (0, util_1.isRestParameterDeclaration)(decl)) {
if (checker.isArrayType(firstParamType)) {
firstParamType = checker.getTypeArguments(firstParamType)[0];
}
else if (checker.isTupleType(firstParamType)) {
firstParamType = checker.getTypeArguments(firstParamType)[0];
}
else {
// a rest arg that's not an array or tuple should definitely be flagged.
return true;
}
}
if (!tsutils.isIntrinsicUnknownType(firstParamType)) {
return true;
}
}
}
return false;
}
function collectFlaggedNodes(node) {
switch (node.type) {
case utils_1.AST_NODE_TYPES.LogicalExpression:
return [
...collectFlaggedNodes(node.left),
...collectFlaggedNodes(node.right),
];
case utils_1.AST_NODE_TYPES.SequenceExpression:
return collectFlaggedNodes((0, util_1.nullThrows)(node.expressions.at(-1), 'sequence expression must have multiple expressions'));
case utils_1.AST_NODE_TYPES.ConditionalExpression:
return [
...collectFlaggedNodes(node.consequent),
...collectFlaggedNodes(node.alternate),
];
case utils_1.AST_NODE_TYPES.ArrowFunctionExpression:
case utils_1.AST_NODE_TYPES.FunctionExpression:
{
const argument = esTreeNodeToTSNodeMap.get(node);
const typeOfArgument = checker.getTypeAtLocation(argument);
if (isFlaggableHandlerType(typeOfArgument)) {
return [node];
}
}
break;
default:
break;
}
return [];
}
/**
* Analyzes the syntax of the catch argument and makes a best effort to pinpoint
* why it's reporting, and to come up with a suggested fix if possible.
*
* This function is explicitly operating under the assumption that the
* rule _is reporting_, so it is not guaranteed to be sound to call otherwise.
*/
function refineReportIfPossible(argument) {
const catchVariableOuterWithIncorrectTypes = (0, util_1.nullThrows)(argument.params.at(0), 'There should have been at least one parameter for the rule to have flagged.');
// Function expressions can't have parameter properties; those only exist in constructors.
const catchVariableOuter = catchVariableOuterWithIncorrectTypes;
const catchVariableInner = catchVariableOuter.type === utils_1.AST_NODE_TYPES.AssignmentPattern
? catchVariableOuter.left
: catchVariableOuter;
switch (catchVariableInner.type) {
case utils_1.AST_NODE_TYPES.Identifier: {
const catchVariableTypeAnnotation = catchVariableInner.typeAnnotation;
if (catchVariableTypeAnnotation == null) {
return {
node: catchVariableOuter,
suggest: [
{
messageId: 'addUnknownTypeAnnotationSuggestion',
fix: (fixer) => {
if (argument.type ===
utils_1.AST_NODE_TYPES.ArrowFunctionExpression &&
(0, util_1.isParenlessArrowFunction)(argument, context.sourceCode)) {
return [
fixer.insertTextBefore(catchVariableInner, '('),
fixer.insertTextAfter(catchVariableInner, ': unknown)'),
];
}
return [
fixer.insertTextAfter(catchVariableInner, ': unknown'),
];
},
},
],
};
}
return {
node: catchVariableOuter,
suggest: [
{
messageId: 'wrongTypeAnnotationSuggestion',
fix: (fixer) => fixer.replaceText(catchVariableTypeAnnotation, ': unknown'),
},
],
};
}
case utils_1.AST_NODE_TYPES.ArrayPattern: {
return {
node: catchVariableOuter,
messageId: 'useUnknownArrayDestructuringPattern',
};
}
case utils_1.AST_NODE_TYPES.ObjectPattern: {
return {
node: catchVariableOuter,
messageId: 'useUnknownObjectDestructuringPattern',
};
}
case utils_1.AST_NODE_TYPES.RestElement: {
const catchVariableTypeAnnotation = catchVariableInner.typeAnnotation;
if (catchVariableTypeAnnotation == null) {
return {
node: catchVariableOuter,
suggest: [
{
messageId: 'addUnknownRestTypeAnnotationSuggestion',
fix: (fixer) => fixer.insertTextAfter(catchVariableInner, ': [unknown]'),
},
],
};
}
return {
node: catchVariableOuter,
suggest: [
{
messageId: 'wrongRestTypeAnnotationSuggestion',
fix: (fixer) => fixer.replaceText(catchVariableTypeAnnotation, ': [unknown]'),
},
],
};
}
}
}
return {
CallExpression({ arguments: args, callee }) {
if (callee.type !== utils_1.AST_NODE_TYPES.MemberExpression) {
return;
}
const staticMemberAccessKey = (0, util_1.getStaticMemberAccessValue)(callee, context);
if (!staticMemberAccessKey) {
return;
}
const promiseMethodInfo = [
{ append: '', argIndexToCheck: 0, method: 'catch' },
{ append: ' rejection', argIndexToCheck: 1, method: 'then' },
].find(({ method }) => staticMemberAccessKey === method);
if (!promiseMethodInfo) {
return;
}
// Need to be enough args to check
const { argIndexToCheck, ...data } = promiseMethodInfo;
if (args.length < argIndexToCheck + 1) {
return;
}
// Argument to check, and all arguments before it, must be "ordinary" arguments (i.e. no spread arguments)
// promise.catch(f), promise.catch(() => {}), promise.catch(<expression>, <<other-args>>)
const argsToCheck = args.slice(0, argIndexToCheck + 1);
if (argsToCheck.some(({ type }) => type === utils_1.AST_NODE_TYPES.SpreadElement)) {
return;
}
if (!tsutils.isThenableType(checker, esTreeNodeToTSNodeMap.get(callee), checker.getTypeAtLocation(esTreeNodeToTSNodeMap.get(callee.object)))) {
return;
}
// the `some` check above has already excluded `SpreadElement`, so we are safe to assert the same
const argToCheck = argsToCheck[argIndexToCheck];
for (const node of collectFlaggedNodes(argToCheck)) {
// We are now guaranteed to report, but we have a bit of work to do
// to determine exactly where, and whether we can fix it.
const overrides = refineReportIfPossible(node);
context.report({
node,
messageId: 'useUnknown',
data,
...overrides,
});
}
},
};
},
});
@@ -0,0 +1,10 @@
export { As, CapitalizedDOMElements, DOMAttributes, DOMElement, DOMElements, ExtendVariantProps, ExtendVariantWithSlotsProps, ExtendVariants, HTMLHeroUIProps, InternalForwardRefRenderFunction, Merge, MergeWithAs, OmitCommonProps, PropGetter, PropsOf, RightJoinProps, SharedSelection, extendVariants, forwardRef, isHeroUIEl, mapPropsVariants, mapPropsVariantsWithCommon, toIterator } from '@heroui/system-rsc';
export { SupportedCalendars } from './types.js';
export { HeroUIProvider, HeroUIProviderProps } from './provider.js';
export { ProviderContext, ProviderContextProps, useProviderContext } from './provider-context.js';
import '@react-aria/overlays';
import '@react-types/shared';
import '@react-aria/i18n';
import 'react';
import '@internationalized/date';
import '@react-types/datepicker';
@@ -0,0 +1,246 @@
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var _extends = require('@babel/runtime/helpers/extends');
var _objectWithoutPropertiesLoose = require('@babel/runtime/helpers/objectWithoutPropertiesLoose');
var React = require('react');
var useLatest = require('use-latest');
var useComposedRef = require('use-composed-ref');
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
function _interopNamespace(e) {
if (e && e.__esModule) return e;
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n["default"] = e;
return Object.freeze(n);
}
var React__namespace = /*#__PURE__*/_interopNamespace(React);
var useLatest__default = /*#__PURE__*/_interopDefault(useLatest);
var useComposedRef__default = /*#__PURE__*/_interopDefault(useComposedRef);
var HIDDEN_TEXTAREA_STYLE = {
'min-height': '0',
'max-height': 'none',
height: '0',
visibility: 'hidden',
overflow: 'hidden',
position: 'absolute',
'z-index': '-1000',
top: '0',
right: '0',
display: 'block'
};
var forceHiddenStyles = function forceHiddenStyles(node) {
Object.keys(HIDDEN_TEXTAREA_STYLE).forEach(function (key) {
node.style.setProperty(key, HIDDEN_TEXTAREA_STYLE[key], 'important');
});
};
var forceHiddenStyles$1 = forceHiddenStyles;
var hiddenTextarea = null;
var getHeight = function getHeight(node, sizingData) {
var height = node.scrollHeight;
if (sizingData.sizingStyle.boxSizing === 'border-box') {
// border-box: add border, since height = content + padding + border
return height + sizingData.borderSize;
}
// remove padding, since height = content
return height - sizingData.paddingSize;
};
function calculateNodeHeight(sizingData, value, minRows, maxRows) {
if (minRows === void 0) {
minRows = 1;
}
if (maxRows === void 0) {
maxRows = Infinity;
}
if (!hiddenTextarea) {
hiddenTextarea = document.createElement('textarea');
hiddenTextarea.setAttribute('tabindex', '-1');
hiddenTextarea.setAttribute('aria-hidden', 'true');
forceHiddenStyles$1(hiddenTextarea);
}
if (hiddenTextarea.parentNode === null) {
document.body.appendChild(hiddenTextarea);
}
var paddingSize = sizingData.paddingSize,
borderSize = sizingData.borderSize,
sizingStyle = sizingData.sizingStyle;
var boxSizing = sizingStyle.boxSizing;
Object.keys(sizingStyle).forEach(function (_key) {
var key = _key;
hiddenTextarea.style[key] = sizingStyle[key];
});
forceHiddenStyles$1(hiddenTextarea);
hiddenTextarea.value = value;
var height = getHeight(hiddenTextarea, sizingData);
// Double set and calc due to Firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1795904
hiddenTextarea.value = value;
height = getHeight(hiddenTextarea, sizingData);
// measure height of a textarea with a single row
hiddenTextarea.value = 'x';
var rowHeight = hiddenTextarea.scrollHeight - paddingSize;
var minHeight = rowHeight * minRows;
if (boxSizing === 'border-box') {
minHeight = minHeight + paddingSize + borderSize;
}
height = Math.max(minHeight, height);
var maxHeight = rowHeight * maxRows;
if (boxSizing === 'border-box') {
maxHeight = maxHeight + paddingSize + borderSize;
}
height = Math.min(maxHeight, height);
return [height, rowHeight];
}
var noop = function noop() {};
var pick = function pick(props, obj) {
return props.reduce(function (acc, prop) {
acc[prop] = obj[prop];
return acc;
}, {});
};
var SIZING_STYLE = ['borderBottomWidth', 'borderLeftWidth', 'borderRightWidth', 'borderTopWidth', 'boxSizing', 'fontFamily', 'fontSize', 'fontStyle', 'fontWeight', 'letterSpacing', 'lineHeight', 'paddingBottom', 'paddingLeft', 'paddingRight', 'paddingTop',
// non-standard
'tabSize', 'textIndent',
// non-standard
'textRendering', 'textTransform', 'width', 'wordBreak', 'wordSpacing', 'scrollbarGutter'];
var isIE = !!document.documentElement.currentStyle ;
var getSizingData = function getSizingData(node) {
var style = window.getComputedStyle(node);
if (style === null) {
return null;
}
var sizingStyle = pick(SIZING_STYLE, style);
var boxSizing = sizingStyle.boxSizing;
// probably node is detached from DOM, can't read computed dimensions
if (boxSizing === '') {
return null;
}
// IE (Edge has already correct behaviour) returns content width as computed width
// so we need to add manually padding and border widths
if (isIE && boxSizing === 'border-box') {
sizingStyle.width = parseFloat(sizingStyle.width) + parseFloat(sizingStyle.borderRightWidth) + parseFloat(sizingStyle.borderLeftWidth) + parseFloat(sizingStyle.paddingRight) + parseFloat(sizingStyle.paddingLeft) + 'px';
}
var paddingSize = parseFloat(sizingStyle.paddingBottom) + parseFloat(sizingStyle.paddingTop);
var borderSize = parseFloat(sizingStyle.borderBottomWidth) + parseFloat(sizingStyle.borderTopWidth);
return {
sizingStyle: sizingStyle,
paddingSize: paddingSize,
borderSize: borderSize
};
};
var getSizingData$1 = getSizingData;
function useListener(target, type, listener) {
var latestListener = useLatest__default["default"](listener);
React__namespace.useLayoutEffect(function () {
var handler = function handler(ev) {
return latestListener.current(ev);
};
// might happen if document.fonts is not defined, for instance
if (!target) {
return;
}
target.addEventListener(type, handler);
return function () {
return target.removeEventListener(type, handler);
};
}, []);
}
var useFormResetListener = function useFormResetListener(libRef, listener) {
useListener(document.body, 'reset', function (ev) {
if (libRef.current.form === ev.target) {
listener(ev);
}
});
};
var useWindowResizeListener = function useWindowResizeListener(listener) {
useListener(window, 'resize', listener);
};
var useFontsLoadedListener = function useFontsLoadedListener(listener) {
useListener(document.fonts, 'loadingdone', listener);
};
var _excluded = ["cacheMeasurements", "maxRows", "minRows", "onChange", "onHeightChange"];
var TextareaAutosize = function TextareaAutosize(_ref, userRef) {
var cacheMeasurements = _ref.cacheMeasurements,
maxRows = _ref.maxRows,
minRows = _ref.minRows,
_ref$onChange = _ref.onChange,
onChange = _ref$onChange === void 0 ? noop : _ref$onChange,
_ref$onHeightChange = _ref.onHeightChange,
onHeightChange = _ref$onHeightChange === void 0 ? noop : _ref$onHeightChange,
props = _objectWithoutPropertiesLoose(_ref, _excluded);
var isControlled = props.value !== undefined;
var libRef = React__namespace.useRef(null);
var ref = useComposedRef__default["default"](libRef, userRef);
var heightRef = React__namespace.useRef(0);
var measurementsCacheRef = React__namespace.useRef();
var resizeTextarea = function resizeTextarea() {
var node = libRef.current;
var nodeSizingData = cacheMeasurements && measurementsCacheRef.current ? measurementsCacheRef.current : getSizingData$1(node);
if (!nodeSizingData) {
return;
}
measurementsCacheRef.current = nodeSizingData;
var _calculateNodeHeight = calculateNodeHeight(nodeSizingData, node.value || node.placeholder || 'x', minRows, maxRows),
height = _calculateNodeHeight[0],
rowHeight = _calculateNodeHeight[1];
if (heightRef.current !== height) {
heightRef.current = height;
node.style.setProperty('height', height + "px", 'important');
onHeightChange(height, {
rowHeight: rowHeight
});
}
};
var handleChange = function handleChange(event) {
if (!isControlled) {
resizeTextarea();
}
onChange(event);
};
{
React__namespace.useLayoutEffect(resizeTextarea);
useFormResetListener(libRef, function () {
if (!isControlled) {
var currentValue = libRef.current.value;
requestAnimationFrame(function () {
var node = libRef.current;
if (node && currentValue !== node.value) {
resizeTextarea();
}
});
}
});
useWindowResizeListener(resizeTextarea);
useFontsLoadedListener(resizeTextarea);
return /*#__PURE__*/React__namespace.createElement("textarea", _extends({}, props, {
onChange: handleChange,
ref: ref
}));
}
};
var index = /* #__PURE__ */React__namespace.forwardRef(TextareaAutosize);
exports["default"] = index;
@@ -0,0 +1,22 @@
var $e64bc6eb3aa7bd8d$exports = require("./useSwitch.main.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "useSwitch", () => $e64bc6eb3aa7bd8d$exports.useSwitch);
/*
* 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.
*/
//# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"K D E F wC","8":"A B"},B:{"1":"0 1 2 3 4 5 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","578":"C L M G N O P"},C:{"1":"0 1 2 3 4 5 6 7 8 9 P aB AB 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","2":"xC TC 0C 1C","4":"J ZB K D E F A B C L M G N O","194":"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"},D:{"1":"0 1 2 3 4 5 8 9 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","2":"6 7 J ZB K D E F A B C L M G N O P aB"},E:{"2":"J ZB K D E F A B C L M G 2C ZC 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 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","2":"F B C FD GD HD ID NC uC JD OC"},G:{"1":"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:{"2":"hD"},I:{"1":"TC J I iD jD kD lD vC mD nD"},J:{"1":"D A"},K:{"1":"B C H NC uC OC","2":"A"},L:{"1":"I"},M:{"1":"MC"},N:{"8":"A","260":"B"},O:{"1":"PC"},P:{"1":"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:{"1":"2D","2":"1D"}},B:2,C:"Touch events",D:true};
@@ -0,0 +1,158 @@
/**
* @import {Extension, State, TokenizeContext, Tokenizer} from 'micromark-util-types'
*/
import { factorySpace } from 'micromark-factory-space';
import { markdownLineEnding, markdownLineEndingOrSpace, markdownSpace } from 'micromark-util-character';
const tasklistCheck = {
name: 'tasklistCheck',
tokenize: tokenizeTasklistCheck
};
/**
* Create an HTML extension for `micromark` to support GFM task list items
* syntax.
*
* @returns {Extension}
* Extension for `micromark` that can be passed in `htmlExtensions` to
* support GFM task list items when serializing to HTML.
*/
export function gfmTaskListItem() {
return {
text: {
[91]: tasklistCheck
}
};
}
/**
* @this {TokenizeContext}
* @type {Tokenizer}
*/
function tokenizeTasklistCheck(effects, ok, nok) {
const self = this;
return open;
/**
* At start of task list item check.
*
* ```markdown
* > | * [x] y.
* ^
* ```
*
* @type {State}
*/
function open(code) {
if (
// Exit if there’s stuff before.
self.previous !== null ||
// Exit if not in the first content that is the first child of a list
// item.
!self._gfmTasklistFirstContentOfListItem) {
return nok(code);
}
effects.enter('taskListCheck');
effects.enter('taskListCheckMarker');
effects.consume(code);
effects.exit('taskListCheckMarker');
return inside;
}
/**
* In task list item check.
*
* ```markdown
* > | * [x] y.
* ^
* ```
*
* @type {State}
*/
function inside(code) {
// Currently we match how GH works in files.
// To match how GH works in comments, use `markdownSpace` (`[\t ]`) instead
// of `markdownLineEndingOrSpace` (`[\t\n\r ]`).
if (markdownLineEndingOrSpace(code)) {
effects.enter('taskListCheckValueUnchecked');
effects.consume(code);
effects.exit('taskListCheckValueUnchecked');
return close;
}
if (code === 88 || code === 120) {
effects.enter('taskListCheckValueChecked');
effects.consume(code);
effects.exit('taskListCheckValueChecked');
return close;
}
return nok(code);
}
/**
* At close of task list item check.
*
* ```markdown
* > | * [x] y.
* ^
* ```
*
* @type {State}
*/
function close(code) {
if (code === 93) {
effects.enter('taskListCheckMarker');
effects.consume(code);
effects.exit('taskListCheckMarker');
effects.exit('taskListCheck');
return after;
}
return nok(code);
}
/**
* @type {State}
*/
function after(code) {
// EOL in paragraph means there must be something else after it.
if (markdownLineEnding(code)) {
return ok(code);
}
// Space or tab?
// Check what comes after.
if (markdownSpace(code)) {
return effects.check({
tokenize: spaceThenNonSpace
}, ok, nok)(code);
}
// EOF, or non-whitespace, both wrong.
return nok(code);
}
}
/**
* @this {TokenizeContext}
* @type {Tokenizer}
*/
function spaceThenNonSpace(effects, ok, nok) {
return factorySpace(effects, after, "whitespace");
/**
* After whitespace, after task list item check.
*
* ```markdown
* > | * [x] y.
* ^
* ```
*
* @type {State}
*/
function after(code) {
// EOF means there was nothing, so bad.
// EOL means there’s content after it, so good.
// Impossible to have more spaces.
// Anything else is good.
return code === null ? nok(code) : ok(code);
}
}
@@ -0,0 +1 @@
{"name":"@react-aria/overlays","version":"3.30.0","requiresBuild":false,"files":{"LICENSE":{"checkedAt":1794532106367,"integrity":"sha512-cil7stSp3ik41Hdv2Dj+GMcbvUfs1q+MZ2Yte0804py9i6oJJN/diCiIr/brcQOZ5ZqwAI6dgaHA7l8FZheQBw==","mode":420,"size":11335},"dist/ar-AE.main.js":{"checkedAt":1794532106367,"integrity":"sha512-mMhpGfc/dnj4znJjTa51PZCB1nqKXBjtWkBOgGHJFspasUK6Zar9ZrQwFF0vjM+w3CGQgOpfRVHM9Ti1YznQUw==","mode":420,"size":116},"dist/ar-AE.module.js":{"checkedAt":1794532106367,"integrity":"sha512-UzoRVlE6iHG9xtOJS31luLju/mpfv2rb8Aor02/zbnZrfiISiZTLrREioRkEjrv6CkR7M6okeq6B9WMfL+kBTg==","mode":420,"size":212},"dist/ariaHideOutside.main.js":{"checkedAt":1794532106367,"integrity":"sha512-7UHYLgR5o7HDtBhqDxAnaW3KFxccEDXTkJkFCE64sxBOXp+wDBkOSeEXvaYhBZQlOZPxzo/eLzqGw3fXSZjOHw==","mode":420,"size":8000},"dist/ariaHideOutside.module.js":{"checkedAt":1794532106368,"integrity":"sha512-wrcsks35G1WRMJocq6ye+8d6iXWtf1Ncw4L1KtavVWtA2nCdmNkmIvLCSiU4Xc2khA/kT5nu6AtVUHecxvhYmQ==","mode":420,"size":7808},"dist/bg-BG.main.js":{"checkedAt":1794532106368,"integrity":"sha512-D0piHk7W3/W7omgjcsRQnIshXsbuI4PR9WnrRzjRp5NRQXCh3IWOt+wuvQoLVJ689hqWVTZc/MCx06vAkAfLiw==","mode":420,"size":151},"dist/bg-BG.module.js":{"checkedAt":1794532106368,"integrity":"sha512-WPvUlw/T+kJnPna1IBdT/H3ZtATQFcXG8mBkeUEsS0fy4SHkuF5231oTCaS/DZNUjOsnNeXAA5bg3ViN2qTgCQ==","mode":420,"size":247},"dist/calculatePosition.main.js":{"checkedAt":1794532106368,"integrity":"sha512-vw65E9DsDDXYPy/JcxhQPtQOnDL5ePUf+w2I4HrFezCdW53NW9cl9vhMr9UwSpYqgz1MaWVI6wQ+dmWTyHg1/A==","mode":420,"size":29801},"dist/calculatePosition.module.js":{"checkedAt":1794532106368,"integrity":"sha512-idpZV/KWDnFMSflHBHfiSRE8OsGDK8Nrp2PpC3vnZOsr/mRXwzJ0voCjyomeluR4SNuAERwLDZLloIA2ICaYKQ==","mode":420,"size":29647},"dist/cs-CZ.main.js":{"checkedAt":1794532106368,"integrity":"sha512-mxQaXjZQ+3EsEkOuBByINU1l+tpjx6cQSFjBrI13W3Y9ll72yz2oA3WTQnyFk2vxsG1gSMmrDhO/kRCpM5gzuQ==","mode":420,"size":90},"dist/cs-CZ.module.js":{"checkedAt":1794532106369,"integrity":"sha512-ilbXC8mHBu+ej5p6BGttzUwfQNcFS6DBlqmnf/9y34PzDPrwzHUPu+a+seiwyzkCcR4r4r2tVCPtJ6tQYptJhg==","mode":420,"size":186},"dist/da-DK.main.js":{"checkedAt":1794532106369,"integrity":"sha512-M7ipOEcsWIiDI9VYwGlR9l/EQEgcPRYzDUO0gOseLupaoZnzjs69Ng4ifsvlpY1VaVSHXpMUb7AIcwMdXjp87Q==","mode":420,"size":84},"dist/da-DK.module.js":{"checkedAt":1794532106369,"integrity":"sha512-3nMNwo2cWX5zSjPOkoHwJ+17InmwitdK9m5WdcW/JoK8DjPCsuwr5ojr2yDXRnwdQ2Tb5tqlXiIuU4w37pdniw==","mode":420,"size":180},"dist/de-DE.main.js":{"checkedAt":1794532106369,"integrity":"sha512-W5g9r1WUD6Ar75MZWkp2qaaZ8d0ytm78/5SSuYjWdkWN89nVNr71r25MQjo8vdTV9/fQpPQPmeX2JHPmflFxEQ==","mode":420,"size":93},"dist/de-DE.module.js":{"checkedAt":1794532106369,"integrity":"sha512-QCsGzPIMwZattL9hz61oZgZh9yxl9BxadJUg3NfWjszKixPX75UzpDQgiXCYoEtJN2GWl36DzbEOnGBmV0XL4Q==","mode":420,"size":189},"dist/DismissButton.main.js":{"checkedAt":1794532106369,"integrity":"sha512-eI9NZM0+5Ji2af6PQEp4pWym/d7wFrE+SiS//od2QiqG6KNnn893CLy9g86iYqh7dMekRzvHiT03JwR1QzkhlQ==","mode":420,"size":2103},"dist/DismissButton.module.js":{"checkedAt":1794532106369,"integrity":"sha512-DDOReGyZa+KlREykkrU+FSzD6ofPxGeLOlkwBWc0h7MSVYMJlQo2FpFPf0CINZCbHqO+WNuZpnwDOninDF735g==","mode":420,"size":1899},"dist/el-GR.main.js":{"checkedAt":1794532106369,"integrity":"sha512-SdhjwN4Y55++gZTytFF1egs471WKnSHscZiXZzfNtKyG/VXh8qi3YvnXv/EK2kmka7My5QBEaX/5L199zEyIyw==","mode":420,"size":137},"dist/el-GR.module.js":{"checkedAt":1794532106370,"integrity":"sha512-I15Uma8gLSjM7FeeF4ybNdEFQj/2L4XTqA7XCnXZatakTVWIU4X+r7BvgwwkJq65MJ0O2thWVLOb/9dTDNqrUA==","mode":420,"size":233},"dist/en-US.main.js":{"checkedAt":1794532106370,"integrity":"sha512-CKbkKjfECidy2AZsUT7pxVVbY7I+SrnCY1iqHv2ZCpP0tiaYYAoWbdYQGiFmuJjlolYcDvj4EA8ex8JJCORA/w==","mode":420,"size":88},"dist/en-US.module.js":{"checkedAt":1794532106370,"integrity":"sha512-K4IaItaQ8/fP9IfKRJ2i+eWlUZRiseueDVOuN4pTPgh1SCgGKxNwEHMYFqN+RskJi9xqft/CuQ2n6PnLO4ViYQ==","mode":420,"size":184},"dist/es-ES.main.js":{"checkedAt":1794532106370,"integrity":"sha512-YIoUqr5T3mkH+w1VzQNC+NwfiJ7EBsOfd6DbUsGmo25jHqyMwHrhEUIYx/ssu/77hPyOKgYX1zZaIk3QZ4q4BA==","mode":420,"size":90},"dist/es-ES.module.js":{"checkedAt":1794532106370,"integrity":"sha512-YW5bcc+jBM/Z4y6mfC1NqtgsgaJ7Ab1WnSEATQMBIuENCq8GspVH2ZmsDb5TTzNp7uXMmXwoIZfyzyXWJYf5xw==","mode":420,"size":186},"dist/et-EE.main.js":{"checkedAt":1794532106370,"integrity":"sha512-yz0eRoaKw7QU30FF6hcsAIOk+sfzc2E7hy7Ws1YAO1ib+TZD3Bclfu5ASK3gG2NwgwBWGcZKxlyHVzNuN9bQQA==","mode":420,"size":90},"dist/et-EE.module.js":{"checkedAt":1794532106370,"integrity":"sha512-FTUcAjWsP2GFkdLqXU79OtRcrZr8NXUu+O5ZV0cweM6qI9g4seOGXS9jIWEUKXsOWZE1Vp5uXANwUEZMhCHB9A==","mode":420,"size":186},"dist/fi-FI.main.js":{"checkedAt":1794532106370,"integrity":"sha512-YYwlHcN7FKiSXdGf6zV3MBtXgl+gLbrF50H+/Sh9Nuc6EZ+JSDJoOrBSnAyO+Ih5Eso+wkSorgWtFGltkKCj5A==","mode":420,"size":93},"dist/fi-FI.module.js":{"checkedAt":1794532106370,"integrity":"sha512-2hHR+FB3sa50Tyf8GV2SS7hkZPrw1untXcjcr/+QnWeux1+pb6N7NaAiN5bE60IW81Line truncated
@@ -0,0 +1,142 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
const util = __importStar(require("../core/util.cjs"));
const error = () => {
const Sizable = {
string: { unit: "حرف", verb: "أن يحوي" },
file: { unit: "بايت", verb: "أن يحوي" },
array: { unit: "عنصر", verb: "أن يحوي" },
set: { unit: "عنصر", verb: "أن يحوي" },
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const parsedType = (data) => {
const t = typeof data;
switch (t) {
case "number": {
return Number.isNaN(data) ? "NaN" : "number";
}
case "object": {
if (Array.isArray(data)) {
return "array";
}
if (data === null) {
return "null";
}
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
return data.constructor.name;
}
}
}
return t;
};
const Nouns = {
regex: "مدخل",
email: "بريد إلكتروني",
url: "رابط",
emoji: "إيموجي",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "تاريخ ووقت بمعيار ISO",
date: "تاريخ بمعيار ISO",
time: "وقت بمعيار ISO",
duration: "مدة بمعيار ISO",
ipv4: "عنوان IPv4",
ipv6: "عنوان IPv6",
cidrv4: "مدى عناوين بصيغة IPv4",
cidrv6: "مدى عناوين بصيغة IPv6",
base64: "نَص بترميز base64-encoded",
base64url: "نَص بترميز base64url-encoded",
json_string: "نَص على هيئة JSON",
e164: "رقم هاتف بمعيار E.164",
jwt: "JWT",
template_literal: "مدخل",
};
return (issue) => {
switch (issue.code) {
case "invalid_type":
return `مدخلات غير مقبولة: يفترض إدخال ${issue.expected}، ولكن تم إدخال ${parsedType(issue.input)}`;
case "invalid_value":
if (issue.values.length === 1)
return `مدخلات غير مقبولة: يفترض إدخال ${util.stringifyPrimitive(issue.values[0])}`;
return `اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${util.joinValues(issue.values, "|")}`;
case "too_big": {
const adj = issue.inclusive ? "<=" : "<";
const sizing = getSizing(issue.origin);
if (sizing)
return ` أكبر من اللازم: يفترض أن تكون ${issue.origin ?? "القيمة"} ${adj} ${issue.maximum.toString()} ${sizing.unit ?? "عنصر"}`;
return `أكبر من اللازم: يفترض أن تكون ${issue.origin ?? "القيمة"} ${adj} ${issue.maximum.toString()}`;
}
case "too_small": {
const adj = issue.inclusive ? ">=" : ">";
const sizing = getSizing(issue.origin);
if (sizing) {
return `أصغر من اللازم: يفترض لـ ${issue.origin} أن يكون ${adj} ${issue.minimum.toString()} ${sizing.unit}`;
}
return `أصغر من اللازم: يفترض لـ ${issue.origin} أن يكون ${adj} ${issue.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue;
if (_issue.format === "starts_with")
return `نَص غير مقبول: يجب أن يبدأ بـ "${issue.prefix}"`;
if (_issue.format === "ends_with")
return `نَص غير مقبول: يجب أن ينتهي بـ "${_issue.suffix}"`;
if (_issue.format === "includes")
return `نَص غير مقبول: يجب أن يتضمَّن "${_issue.includes}"`;
if (_issue.format === "regex")
return `نَص غير مقبول: يجب أن يطابق النمط ${_issue.pattern}`;
return `${Nouns[_issue.format] ?? issue.format} غير مقبول`;
}
case "not_multiple_of":
return `رقم غير مقبول: يجب أن يكون من مضاعفات ${issue.divisor}`;
case "unrecognized_keys":
return `معرف${issue.keys.length > 1 ? "ات" : ""} غريب${issue.keys.length > 1 ? "ة" : ""}: ${util.joinValues(issue.keys, "، ")}`;
case "invalid_key":
return `معرف غير مقبول في ${issue.origin}`;
case "invalid_union":
return "مدخل غير مقبول";
case "invalid_element":
return `مدخل غير مقبول في ${issue.origin}`;
default:
return "مدخل غير مقبول";
}
};
};
function default_1() {
return {
localeError: error(),
};
}
@@ -0,0 +1,150 @@
# Universal selectors
* {}
div * {}
==>
StyleSheet(
RuleSet(UniversalSelector,Block),
RuleSet(DescendantSelector(TagSelector(TagName),UniversalSelector),Block))
# Type selectors
div, span {}
h1, h2, h3, h4 {}
==>
StyleSheet(
RuleSet(TagSelector(TagName),TagSelector(TagName),Block),
RuleSet(TagSelector(TagName),TagSelector(TagName),TagSelector(TagName),TagSelector(TagName),Block))
# Class selectors
.class-a {}
div.class-b, .class-c.class-d {}
==>
StyleSheet(
RuleSet(ClassSelector(ClassName),Block),
RuleSet(ClassSelector(TagSelector(TagName),ClassName),ClassSelector(ClassSelector(ClassName),ClassName),Block))
# Id selectors
#some-id, a#another-id {}
==>
StyleSheet(RuleSet(IdSelector(IdName),IdSelector(TagSelector(TagName),IdName),Block))
# Attribute selectors
[a] {}
[b=c] {}
[d~=e] {}
a[b] {}
==>
StyleSheet(
RuleSet(AttributeSelector(AttributeName),Block),
RuleSet(AttributeSelector(AttributeName,MatchOp,ValueName),Block),
RuleSet(AttributeSelector(AttributeName,MatchOp,ValueName),Block),
RuleSet(AttributeSelector(TagSelector(TagName),AttributeName),Block))
# Pseudo-class selectors
a:hover {}
:nth-child(2) {}
==>
StyleSheet(
RuleSet(PseudoClassSelector(TagSelector(TagName),":",PseudoClassName),Block),
RuleSet(PseudoClassSelector(":",PseudoClassName,ArgList(NumberLiteral)),Block))
# Pseudo-element selectors
a::first-line {}
==>
StyleSheet(RuleSet(PseudoClassSelector(TagSelector(TagName),"::",PseudoClassName),Block))
# Child selectors
a > b {}
c > d > e {}
==>
StyleSheet(
RuleSet(ChildSelector(TagSelector(TagName),ChildOp,TagSelector(TagName)),Block),
RuleSet(ChildSelector(ChildSelector(TagSelector(TagName),ChildOp,TagSelector(TagName)),ChildOp,TagSelector(TagName)),Block))
# Descendant selectors
a b {}
c d e {}
==>
StyleSheet(
RuleSet(DescendantSelector(TagSelector(TagName),TagSelector(TagName)),Block),
RuleSet(DescendantSelector(DescendantSelector(TagSelector(TagName),TagSelector(TagName)),TagSelector(TagName)),Block))
# Nesting selectors
a {
&.b {}
& c {}
c & {}
& > d {}
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(
RuleSet(ClassSelector(NestingSelector,ClassName),Block),
RuleSet(DescendantSelector(NestingSelector,TagSelector(TagName)),Block),
RuleSet(DescendantSelector(TagSelector(TagName), NestingSelector),Block),
RuleSet(ChildSelector(NestingSelector,ChildOp,TagSelector(TagName)),Block))))
# Relative selectors
a {
p {}
> f {}
+ g {}
}
==>
StyleSheet(RuleSet(TagSelector(TagName),Block(
RuleSet(TagSelector(TagName),Block),
RuleSet(ChildSelector(ChildOp,TagSelector(TagName)),Block),
RuleSet(SiblingSelector(SiblingOp,TagSelector(TagName)),Block))))
# Sibling selectors
a.b ~ c.d {}
.e.f + .g.h {}
==>
StyleSheet(
RuleSet(SiblingSelector(ClassSelector(TagSelector(TagName),ClassName),SiblingOp,ClassSelector(TagSelector(TagName),ClassName)),Block),
RuleSet(SiblingSelector(ClassSelector(ClassSelector(ClassName),ClassName),SiblingOp,ClassSelector(ClassSelector(ClassName),ClassName)),Block))
# The :not selector
a:not(:hover) {}
.b:not(c > .d) {}
==>
StyleSheet(
RuleSet(PseudoClassSelector(TagSelector(TagName),":",PseudoClassName,ArgList(PseudoClassSelector(":",PseudoClassName))),Block),
RuleSet(PseudoClassSelector(ClassSelector(ClassName),":",PseudoClassName,ArgList(ChildSelector(TagSelector(TagName),ChildOp,ClassSelector(ClassName)))),Block))
@@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isAnyAncestorBindingConstraints = isAnyAncestorBindingConstraints;
function isAnyAncestorBindingConstraints(condition) {
return (constraints) => {
for (let ancestorMetadata = constraints.getAncestor(); ancestorMetadata !== undefined; ancestorMetadata = ancestorMetadata.getAncestor()) {
if (condition(ancestorMetadata)) {
return true;
}
}
return false;
};
}
//# sourceMappingURL=isAnyAncestorBindingConstraints.js.map
@@ -0,0 +1,3 @@
declare const _default: (name: string) => string;
export default _default;
//# sourceMappingURL=getNodeParentName.d.ts.map
@@ -0,0 +1,39 @@
const {dirname} = require('path')
const {findMade, findMadeSync} = require('./find-made.js')
const {mkdirpManual, mkdirpManualSync} = require('./mkdirp-manual.js')
const mkdirpNative = (path, opts) => {
opts.recursive = true
const parent = dirname(path)
if (parent === path)
return opts.mkdirAsync(path, opts)
return findMade(opts, path).then(made =>
opts.mkdirAsync(path, opts).then(() => made)
.catch(er => {
if (er.code === 'ENOENT')
return mkdirpManual(path, opts)
else
throw er
}))
}
const mkdirpNativeSync = (path, opts) => {
opts.recursive = true
const parent = dirname(path)
if (parent === path)
return opts.mkdirSync(path, opts)
const made = findMadeSync(opts, path)
try {
opts.mkdirSync(path, opts)
return made
} catch (er) {
if (er.code === 'ENOENT')
return mkdirpManualSync(path, opts)
else
throw er
}
}
module.exports = {mkdirpNative, mkdirpNativeSync}
@@ -0,0 +1,48 @@
'use strict';
var path = require('path');
var fs = require('graceful-fs');
var Vinyl = require('vinyl');
var through = require('through2');
function prepareWrite(folderResolver, optResolver) {
if (!folderResolver) {
throw new Error('Invalid output folder');
}
function normalize(file, enc, cb) {
if (!Vinyl.isVinyl(file)) {
return cb(new Error('Received a non-Vinyl object in `dest()`'));
}
// TODO: Remove this after people upgrade vinyl/transition from gulp-util
if (typeof file.isSymbolic !== 'function') {
file = new Vinyl(file);
}
var outFolderPath = folderResolver.resolve('outFolder', file);
if (!outFolderPath) {
return cb(new Error('Invalid output folder'));
}
var cwd = path.resolve(optResolver.resolve('cwd', file));
var basePath = path.resolve(cwd, outFolderPath);
var writePath = path.resolve(basePath, file.relative);
// Wire up new properties
file.cwd = cwd;
file.base = basePath;
file.path = writePath;
if (!file.isSymbolic()) {
var mode = optResolver.resolve('mode', file);
file.stat = (file.stat || new fs.Stats());
file.stat.mode = mode;
}
cb(null, file);
}
return through.obj(normalize);
}
module.exports = prepareWrite;
@@ -0,0 +1,15 @@
import {
accordion,
accordionItem
} from "../chunk-UGMXQ6TV.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 {
accordion,
accordionItem
};
@@ -0,0 +1,20 @@
'use strict';
var abs = require('./abs');
var floor = require('./floor');
var ToNumber = require('./ToNumber');
var $isNaN = require('math-intrinsics/isNaN');
var $isFinite = require('math-intrinsics/isFinite');
var $sign = require('math-intrinsics/sign');
// https://262.ecma-international.org/12.0/#sec-tointegerorinfinity
module.exports = function ToIntegerOrInfinity(value) {
var number = ToNumber(value);
if ($isNaN(number) || number === 0) { return 0; }
if (!$isFinite(number)) { return number; }
var integer = floor(abs(number));
if (integer === 0) { return 0; }
return $sign(number) * integer;
};
@@ -0,0 +1 @@
{"name":"@types/send","version":"0.17.6","requiresBuild":false,"files":{"LICENSE":{"checkedAt":1794532101848,"integrity":"sha512-HQaIQk9pwOcyKutyDk4o2a87WnotwYuLGYFW43emGm4FvIJFKPyg+OYaw5sTegKAKf+C5SKa1ACjzCLivbaHrQ==","mode":420,"size":1141},"README.md":{"checkedAt":1794532101849,"integrity":"sha512-Nh0xufT6WGuTXxN8zfJaE05BA3RgYvgoOPrzN6mYFDkDnfMK2Y9lyW0UKmUXk71kzipcqgn8NO+UtBs3u4nF2A==","mode":420,"size":677},"index.d.ts":{"checkedAt":1794532101849,"integrity":"sha512-mNkztlKu4naY+OzR4aFII6Sv96GqcTq8FcjxI+AVw/KJc63zng4OjqMpPSEo7wW+GvkVlDv/Z0uJP5cQJoQlEA==","mode":420,"size":7078},"package.json":{"checkedAt":1794532101849,"integrity":"sha512-oXoWpWSgE74rDzyWzJ4UuH62vDWz/jfXyykmyHhv09ScjamN8uKJ2HVK7B6mK/Z+KD+cn5IsqufeG4a15Go6Kw==","mode":420,"size":1197}}}
@@ -0,0 +1,49 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.isSourceFile = isSourceFile;
exports.getCodeText = getCodeText;
const ts = __importStar(require("typescript"));
function isSourceFile(code) {
if (typeof code !== 'object' || code == null) {
return false;
}
const maybeSourceFile = code;
return (maybeSourceFile.kind === ts.SyntaxKind.SourceFile &&
typeof maybeSourceFile.getFullText === 'function');
}
function getCodeText(code) {
return isSourceFile(code) ? code.getFullText(code) : code;
}
@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Recursive = Recursive;
const type_1 = require("../clone/type");
const type_2 = require("../create/type");
const value_1 = require("../guard/value");
const index_1 = require("../symbols/index");
// Auto Tracked For Recursive Types without ID's
let Ordinal = 0;
/** `[Json]` Creates a Recursive type */
function Recursive(callback, options = {}) {
if ((0, value_1.IsUndefined)(options.$id))
options.$id = `T${Ordinal++}`;
const thisType = (0, type_1.CloneType)(callback({ [index_1.Kind]: 'This', $ref: `${options.$id}` }));
thisType.$id = options.$id;
// prettier-ignore
return (0, type_2.CreateType)({ [index_1.Hint]: 'Recursive', ...thisType }, options);
}
@@ -0,0 +1,43 @@
{
"name": "json-stable-stringify-without-jsonify",
"version": "1.0.1",
"description": "deterministic JSON.stringify() with custom sorting to get deterministic hashes from stringified results, with no public domain dependencies",
"main": "index.js",
"dependencies": {
},
"devDependencies": {
"tape": "~1.0.4"
},
"scripts": {
"test": "tape test/*.js"
},
"testling": {
"files": "test/*.js",
"browsers": [
"ie/8..latest",
"ff/5", "ff/latest",
"chrome/15", "chrome/latest",
"safari/latest",
"opera/latest"
]
},
"repository": {
"type": "git",
"url": "git://github.com/samn/json-stable-stringify.git"
},
"homepage": "https://github.com/samn/json-stable-stringify",
"keywords": [
"json",
"stringify",
"deterministic",
"hash",
"sort",
"stable"
],
"author": {
"name": "James Halliday",
"email": "mail@substack.net",
"url": "http://substack.net"
},
"license": "MIT"
}
@@ -0,0 +1,309 @@
# Prettier plugin sort imports
A prettier plugin to sort import declarations by provided Regular Expression order.
**Note: If you are migrating from v2.x.x to v3.x.x, [Please Read Migration Guidelines](./docs/MIGRATION.md)**
### Input
```javascript
import React, {
FC,
useEffect,
useRef,
ChangeEvent,
KeyboardEvent,
} from 'react';
import { logger } from '@core/logger';
import { reduce, debounce } from 'lodash';
import { Message } from '../Message';
import { createServer } from '@server/node';
import { Alert } from '@ui/Alert';
import { repeat, filter, add } from '../utils';
import { initializeApp } from '@core/app';
import { Popup } from '@ui/Popup';
import { createConnection } from '@server/database';
```
### Output
```javascript
import { debounce, reduce } from 'lodash';
import React, {
ChangeEvent,
FC,
KeyboardEvent,
useEffect,
useRef,
} from 'react';
import { createConnection } from '@server/database';
import { createServer } from '@server/node';
import { initializeApp } from '@core/app';
import { logger } from '@core/logger';
import { Alert } from '@ui/Alert';
import { Popup } from '@ui/Popup';
import { Message } from '../Message';
import { add, filter, repeat } from '../utils';
```
### Install
npm
```shell script
npm install --save-dev @trivago/prettier-plugin-sort-imports
```
or, using yarn
```shell script
yarn add --dev @trivago/prettier-plugin-sort-imports
```
**Note: If you are migrating from v2.x.x to v3.x.x, [Please Read Migration Guidelines](./docs/MIGRATION.md)**
**Note: If formatting `.vue` sfc files please install `@vue/compiler-sfc` if not in your dependency tree - this normally is within Vue projects.**
### Usage
Add an order in prettier config file.
```ecmascript 6
module.exports = {
"printWidth": 80,
"tabWidth": 4,
"trailingComma": "all",
"singleQuote": true,
"semi": true,
"importOrder": ["^@core/(.*)$", "^@server/(.*)$", "^@ui/(.*)$", "^[./]"],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true
}
```
**Note: There may be an issue with some package managers, such as `pnpm` or when using `prettier` v3.x. You can solve it by providing additional configuration option in prettier config file.
```js
module.exports = {
...
"plugins": ["@trivago/prettier-plugin-sort-imports"]
}
```
### APIs
#### **`importOrder`**
**type**: `Array<string>`
A collection of Regular expressions in string format.
```
"importOrder": ["^@core/(.*)$", "^@server/(.*)$", "^@ui/(.*)$", "^[./]"],
```
_Default behavior:_ The plugin moves the third party imports to the top which are not part of the `importOrder` list.
To move the third party imports at desired place, you can use `<THIRD_PARTY_MODULES>` to assign third party imports to the appropriate position:
```
"importOrder": ["^@core/(.*)$", "<THIRD_PARTY_MODULES>", "^@server/(.*)$", "^@ui/(.*)$", "^[./]"],
```
#### `importOrderSeparation`
**type**: `boolean`
**default value**: `false`
A boolean value to enable or disable the new line separation
between sorted import declarations group. The separation takes place according to the `importOrder`.
```
"importOrderSeparation": true,
```
#### `importOrderSortSpecifiers`
**type**: `boolean`
**default value:** `false`
A boolean value to enable or disable sorting of the specifiers in an import declarations.
#### `importOrderGroupNamespaceSpecifiers`
**type**: `boolean`
**default value:** `false`
A boolean value to enable or disable sorting the namespace specifiers to the top of the import group.
#### `importOrderCaseInsensitive`
**type**: `boolean`
**default value**: `false`
A boolean value to enable case-insensitivity in the sorting algorithm
used to order imports within each match group.
For example, when false (or not specified):
```ecmascript 6
import ExampleView from './ExampleView';
import ExamplesList from './ExamplesList';
```
compared with `"importOrderCaseInsensitive": true`:
```ecmascript 6
import ExamplesList from './ExamplesList';
import ExampleView from './ExampleView';
```
#### `importOrderParserPlugins`
**type**: `Array<string>`
**default value**: `["typescript", "jsx"]`
Previously known as `experimentalBabelParserPluginsList`.
A collection of plugins for babel parser. The plugin passes this list to babel parser, so it can understand the syntaxes
used in the file being formatted. The plugin uses prettier itself to figure out the parser it needs to use but if that fails,
you can use this field to enforce the usage of the plugins' babel parser needs.
**To pass the plugins to babel parser**:
```
"importOrderParserPlugins" : ["classProperties", "decorators-legacy"]
```
**To pass the options to the babel parser plugins**: Since prettier options are limited to string, you can pass plugins
with options as a JSON string of the plugin array:
`"[\"plugin-name\", { \"pluginOption\": true }]"`.
```
"importOrderParserPlugins" : ["classProperties", "[\"decorators\", { \"decoratorsBeforeExport\": true }]"]
```
**To disable default plugins for babel parser, pass an empty array**:
```
importOrderParserPlugins: []
```
### `importOrderSideEffects`
**type**: `boolean`
**default value**: `true`
By default, the plugin sorts [side effect imports](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#import_a_module_for_its_side_effects_only) like any other imports in the file. If you need to keep side effect imports in the same place but sort all other imports around them, set this option to false.
Example:
Initial file:
```js
import z from 'z'
import a from 'a'
import 'side-effect-lib'
import c from 'c'
import b from 'b'
```
When sorted:
```js
import a from 'a'
import z from 'z'
import 'side-effect-lib'
import b from 'b'
import c from 'c'
```
### Ignoring import ordering
In some cases it's desired to ignore import ordering, specifically if you require to instantiate a common service or polyfill in your application logic before all the other imports. The plugin supports the `// sort-imports-ignore` comment, which will exclude the file from ordering the imports.
```javascript
// sort-imports-ignore
import './polyfills';
import foo from 'foo'
```
#### `importOrderImportAttributesKeyword`
**type**: `'assert' | 'with' | 'with-legacy'`
The import attributes/assertions syntax:
- `with`: `import "..." with { type: "json" }`
- `assert`: `import "..." assert { type: "json" }`
- `with-legacy`: `import "..." with type: "json"`.
```json
"importOrderImportAttributesKeyword": 'with'
```
_Default behavior:_ When not specified, @babel/generator will try to match the style in the input code based on the AST shape.
### How does import sort work ?
The plugin extracts the imports which are defined in `importOrder`. These imports are considered as _local imports_.
The imports which are not part of the `importOrder` is considered as _third party imports_.
After, the plugin sorts the _local imports_ and _third party imports_ using [natural sort algorithm](https://en.wikipedia.org/wiki/Natural_sort_order).
In the end, the plugin returns final imports with _third party imports_ on top and _local imports_ at the end.
The _third party imports_ position (it's top by default) can be overridden using the `<THIRD_PARTY_MODULES>` special word in the `importOrder`.
### FAQ / Troubleshooting
Having some trouble or an issue ? You can check [FAQ / Troubleshooting section](./docs/TROUBLESHOOTING.md).
### Compatibility
| Framework | Supported | Note |
| ---------------------- | ------------------------ | ------------------------------------------------ |
| JS with ES Modules | ✅ Everything | - |
| NodeJS with ES Modules | ✅ Everything | - |
| React | ✅ Everything | - |
| Solid | ✅ Everything | - |
| Angular | ✅ Everything | Supported through `importOrderParserPlugins` API |
| Vue | ✅ Everything | `@vue/compiler-sfc` is required |
| Svelte | ✅ Everything | `prettier-plugin-svelte` is required |
### Used by
Want to highlight your project or company ? Adding your project / company name will help plugin to gain attraction and contribution.
Feel free to make a Pull Request to add your project / company name.
- [trivago](https://company.trivago.com)
- [AuresKonnect](https://aures.com)
- [FactorialHR](https://factorialhr.com)
### Contribution
For more information regarding contribution, please check the [Contributing Guidelines](./CONTRIBUTING.md). If you are trying to
debug some code in the plugin, check [Debugging Guidelines](./docs/DEBUG.md)
### Maintainers
| [Ayush Sharma](https://github.com/ayusharma) | [Behrang Yarahmadi](https://github.com/byara) |
| ------------------------------------------------------------------------ | --------------------------------------------------------------------- |
| ![ayusharma](https://avatars2.githubusercontent.com/u/6918450?s=120&v=4) | ![@byara](https://avatars2.githubusercontent.com/u/6979966?s=120&v=4) |
| [@ayusharma\_](https://twitter.com/ayusharma_) | [@behrang_y](https://twitter.com/behrang_y) |
### Disclaimer
This plugin modifies the AST which is against the rules of prettier.
@@ -0,0 +1,87 @@
"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/base-form.tsx
var base_form_exports = {};
__export(base_form_exports, {
Form: () => Form,
FormContext: () => FormContext
});
module.exports = __toCommonJS(base_form_exports);
var import_form = require("@react-stately/form");
var import_react2 = require("react");
var import_theme = require("@heroui/theme");
// src/utils.ts
var import_react = require("react");
var import_utils = require("@react-aria/utils");
var DEFAULT_SLOT = Symbol("default");
function useSlottedContext(context, slot) {
let ctx = (0, import_react.useContext)(context);
if (slot === null) {
return null;
}
if (ctx && typeof ctx === "object" && "slots" in ctx && ctx.slots) {
let availableSlots = new Intl.ListFormat().format(Object.keys(ctx.slots).map((p) => `"${p}"`));
if (!slot && !ctx.slots[DEFAULT_SLOT]) {
throw new Error(`A slot prop is required. Valid slot names are ${availableSlots}.`);
}
let slotKey = slot || DEFAULT_SLOT;
if (!ctx.slots[slotKey]) {
throw new Error(`Invalid slot "${slot}". Valid slot names are ${availableSlots}.`);
}
return ctx.slots[slotKey];
}
return ctx;
}
function useContextProps(props, ref, context) {
let ctx = useSlottedContext(context, props.slot) || {};
let { ref: contextRef, ...contextProps } = ctx;
let mergedRef = (0, import_utils.useObjectRef)((0, import_react.useMemo)(() => (0, import_utils.mergeRefs)(ref, contextRef), [ref, contextRef]));
let mergedProps = (0, import_utils.mergeProps)(contextProps, props);
if ("style" in contextProps && contextProps.style && "style" in props && props.style) {
if (typeof contextProps.style === "function" || typeof props.style === "function") {
mergedProps.style = (renderProps) => {
let contextStyle = typeof contextProps.style === "function" ? contextProps.style(renderProps) : contextProps.style;
let defaultStyle = { ...renderProps.defaultStyle, ...contextStyle };
let style = typeof props.style === "function" ? props.style({ ...renderProps, defaultStyle }) : props.style;
return { ...defaultStyle, ...style };
};
} else {
mergedProps.style = { ...contextProps.style, ...props.style };
}
}
return [mergedProps, mergedRef];
}
// src/base-form.tsx
var import_jsx_runtime = require("react/jsx-runtime");
var FormContext = (0, import_react2.createContext)(null);
var Form = (0, import_react2.forwardRef)(function Form2(props, ref) {
[props, ref] = useContextProps(props, ref, FormContext);
let { validationErrors, validationBehavior = "native", children, className, ...domProps } = props;
const styles = (0, import_react2.useMemo)(() => (0, import_theme.form)({ className }), [className]);
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("form", { noValidate: validationBehavior !== "native", ...domProps, ref, className: styles, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FormContext.Provider, { value: { ...props, validationBehavior }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form.FormValidationContext.Provider, { value: validationErrors != null ? validationErrors : {}, children }) }) });
});
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Form,
FormContext
});
@@ -0,0 +1,13 @@
import * as _heroui_system_rsc from '@heroui/system-rsc';
import { UseKbdProps } from './use-kbd.js';
import './utils.js';
import 'react';
import 'tailwind-variants';
import '@heroui/theme';
import '@heroui/react-utils';
interface KbdProps extends UseKbdProps {
}
declare const Kbd: _heroui_system_rsc.InternalForwardRefRenderFunction<"kbd", KbdProps, never>;
export { KbdProps, Kbd as default };
@@ -0,0 +1 @@
{"name":"@alloc/quick-lru","version":"5.2.0","requiresBuild":false,"files":{"license":{"checkedAt":1794532093346,"integrity":"sha512-nIst73auX/5NY2Fmv5Y116vWnNrEv4GaIUX3lpZG05rpXJY2S8EX+fpUS5hRjClCM0VdT2Za9DDHXXB5jdSrEw==","mode":420,"size":1109},"index.js":{"checkedAt":1794532105507,"integrity":"sha512-4P+WujxhvVJS4LB8KXg2gFDjb9GtoQYYvo7MrFX8jdjnhm/Hspxhpa1mNvMYRM2I+4qkR54zbPXLk8kICQ9r3w==","mode":420,"size":5347},"package.json":{"checkedAt":1794532105507,"integrity":"sha512-5zGvkmjTnGFtnN5r0i9M+JEG2JpRcCe/KdUS4RMfO6+3/FloQs1NtigNtVCqAxaLAXC6VqGh9n+EDzoXB3C6Qg==","mode":420,"size":747},"readme.md":{"checkedAt":1794532105507,"integrity":"sha512-fkzuB2WqO7Pp+W2GaMEpipARFJfka/PJRwfyqho6Eu8GUggudUVz5kb1d0HDk3D8F0oF+/HJvHPXFCo8PXbXag==","mode":420,"size":3660},"index.d.ts":{"checkedAt":1794532105508,"integrity":"sha512-a0bESo8mcSQa+vfGybcMFOUiiR4jfhWWYfOw73gnlESxoA+Gn2AfdsCf6UEUeA+mR29/55/p+95dOOFWvxWLBw==","mode":420,"size":3236}}}
@@ -0,0 +1,84 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = loadBlockHoistPlugin;
function _traverse() {
const data = require("@babel/traverse");
_traverse = function () {
return data;
};
return data;
}
var _plugin = require("../config/plugin.js");
let LOADED_PLUGIN;
const blockHoistPlugin = {
name: "internal.blockHoist",
visitor: {
Block: {
exit({
node
}) {
node.body = performHoisting(node.body);
}
},
SwitchCase: {
exit({
node
}) {
node.consequent = performHoisting(node.consequent);
}
}
}
};
function performHoisting(body) {
let max = Math.pow(2, 30) - 1;
let hasChange = false;
for (let i = 0; i < body.length; i++) {
const n = body[i];
const p = priority(n);
if (p > max) {
hasChange = true;
break;
}
max = p;
}
if (!hasChange) return body;
return stableSort(body.slice());
}
function loadBlockHoistPlugin() {
if (!LOADED_PLUGIN) {
LOADED_PLUGIN = new _plugin.default(Object.assign({}, blockHoistPlugin, {
visitor: _traverse().default.explode(blockHoistPlugin.visitor)
}), {});
}
return LOADED_PLUGIN;
}
function priority(bodyNode) {
const priority = bodyNode == null ? void 0 : bodyNode._blockHoist;
if (priority == null) return 1;
if (priority === true) return 2;
return priority;
}
function stableSort(body) {
const buckets = Object.create(null);
for (let i = 0; i < body.length; i++) {
const n = body[i];
const p = priority(n);
const bucket = buckets[p] || (buckets[p] = []);
bucket.push(n);
}
const keys = Object.keys(buckets).map(k => +k).sort((a, b) => b - a);
let index = 0;
for (const key of keys) {
const bucket = buckets[key];
for (const n of bucket) {
body[index++] = n;
}
}
return body;
}
0 && 0;
//# sourceMappingURL=block-hoist-plugin.js.map
@@ -0,0 +1,10 @@
import { PluginFunc } from 'dayjs/esm'
declare const plugin: PluginFunc
export = plugin
declare module 'dayjs/esm' {
interface Dayjs {
toArray(): number[]
}
}
@@ -0,0 +1,147 @@
# Changelog
## [0.11.0](https://github.com/pkgjs/parseargs/compare/v0.10.0...v0.11.0) (2022-10-08)
### Features
* add `default` option parameter ([#142](https://github.com/pkgjs/parseargs/issues/142)) ([cd20847](https://github.com/pkgjs/parseargs/commit/cd20847a00b2f556aa9c085ac83b942c60868ec1))
## [0.10.0](https://github.com/pkgjs/parseargs/compare/v0.9.1...v0.10.0) (2022-07-21)
### Features
* add parsed meta-data to returned properties ([#129](https://github.com/pkgjs/parseargs/issues/129)) ([91bfb4d](https://github.com/pkgjs/parseargs/commit/91bfb4d3f7b6937efab1b27c91c45d1205f1497e))
## [0.9.1](https://github.com/pkgjs/parseargs/compare/v0.9.0...v0.9.1) (2022-06-20)
### Bug Fixes
* **runtime:** support node 14+ ([#135](https://github.com/pkgjs/parseargs/issues/135)) ([6a1c5a6](https://github.com/pkgjs/parseargs/commit/6a1c5a6f7cadf2f035e004027e2742e3c4ce554b))
## [0.9.0](https://github.com/pkgjs/parseargs/compare/v0.8.0...v0.9.0) (2022-05-23)
### ⚠ BREAKING CHANGES
* drop handling of electron arguments (#121)
### Code Refactoring
* drop handling of electron arguments ([#121](https://github.com/pkgjs/parseargs/issues/121)) ([a2ffd53](https://github.com/pkgjs/parseargs/commit/a2ffd537c244a062371522b955acb45a404fc9f2))
## [0.8.0](https://github.com/pkgjs/parseargs/compare/v0.7.1...v0.8.0) (2022-05-16)
### ⚠ BREAKING CHANGES
* switch type:string option arguments to greedy, but with error for suspect cases in strict mode (#88)
* positionals now opt-in when strict:true (#116)
* create result.values with null prototype (#111)
### Features
* create result.values with null prototype ([#111](https://github.com/pkgjs/parseargs/issues/111)) ([9d539c3](https://github.com/pkgjs/parseargs/commit/9d539c3d57f269c160e74e0656ad4fa84ff92ec2))
* positionals now opt-in when strict:true ([#116](https://github.com/pkgjs/parseargs/issues/116)) ([3643338](https://github.com/pkgjs/parseargs/commit/364333826b746e8a7dc5505b4b22fd19ac51df3b))
* switch type:string option arguments to greedy, but with error for suspect cases in strict mode ([#88](https://github.com/pkgjs/parseargs/issues/88)) ([c2b5e72](https://github.com/pkgjs/parseargs/commit/c2b5e72161991dfdc535909f1327cc9b970fe7e8))
### [0.7.1](https://github.com/pkgjs/parseargs/compare/v0.7.0...v0.7.1) (2022-04-15)
### Bug Fixes
* resist pollution ([#106](https://github.com/pkgjs/parseargs/issues/106)) ([ecf2dec](https://github.com/pkgjs/parseargs/commit/ecf2dece0a9f2a76d789384d5d71c68ffe64022a))
## [0.7.0](https://github.com/pkgjs/parseargs/compare/v0.6.0...v0.7.0) (2022-04-13)
### Features
* Add strict mode to parser ([#74](https://github.com/pkgjs/parseargs/issues/74)) ([8267d02](https://github.com/pkgjs/parseargs/commit/8267d02083a87b8b8a71fcce08348d1e031ea91c))
## [0.6.0](https://github.com/pkgjs/parseargs/compare/v0.5.0...v0.6.0) (2022-04-11)
### ⚠ BREAKING CHANGES
* rework results to remove redundant `flags` property and store value true for boolean options (#83)
* switch to existing ERR_INVALID_ARG_VALUE (#97)
### Code Refactoring
* rework results to remove redundant `flags` property and store value true for boolean options ([#83](https://github.com/pkgjs/parseargs/issues/83)) ([be153db](https://github.com/pkgjs/parseargs/commit/be153dbed1d488cb7b6e27df92f601ba7337713d))
* switch to existing ERR_INVALID_ARG_VALUE ([#97](https://github.com/pkgjs/parseargs/issues/97)) ([084a23f](https://github.com/pkgjs/parseargs/commit/084a23f9fde2da030b159edb1c2385f24579ce40))
## [0.5.0](https://github.com/pkgjs/parseargs/compare/v0.4.0...v0.5.0) (2022-04-10)
### ⚠ BREAKING CHANGES
* Require type to be specified for each supplied option (#95)
### Features
* Require type to be specified for each supplied option ([#95](https://github.com/pkgjs/parseargs/issues/95)) ([02cd018](https://github.com/pkgjs/parseargs/commit/02cd01885b8aaa59f2db8308f2d4479e64340068))
## [0.4.0](https://github.com/pkgjs/parseargs/compare/v0.3.0...v0.4.0) (2022-03-12)
### ⚠ BREAKING CHANGES
* parsing, revisit short option groups, add support for combined short and value (#75)
* restructure configuration to take options bag (#63)
### Code Refactoring
* parsing, revisit short option groups, add support for combined short and value ([#75](https://github.com/pkgjs/parseargs/issues/75)) ([a92600f](https://github.com/pkgjs/parseargs/commit/a92600fa6c214508ab1e016fa55879a314f541af))
* restructure configuration to take options bag ([#63](https://github.com/pkgjs/parseargs/issues/63)) ([b412095](https://github.com/pkgjs/parseargs/commit/b4120957d90e809ee8b607b06e747d3e6a6b213e))
## [0.3.0](https://github.com/pkgjs/parseargs/compare/v0.2.0...v0.3.0) (2022-02-06)
### Features
* **parser:** support short-option groups ([#59](https://github.com/pkgjs/parseargs/issues/59)) ([882067b](https://github.com/pkgjs/parseargs/commit/882067bc2d7cbc6b796f8e5a079a99bc99d4e6ba))
## [0.2.0](https://github.com/pkgjs/parseargs/compare/v0.1.1...v0.2.0) (2022-02-05)
### Features
* basic support for shorts ([#50](https://github.com/pkgjs/parseargs/issues/50)) ([a2f36d7](https://github.com/pkgjs/parseargs/commit/a2f36d7da4145af1c92f76806b7fe2baf6beeceb))
### Bug Fixes
* always store value for a=b ([#43](https://github.com/pkgjs/parseargs/issues/43)) ([a85e8dc](https://github.com/pkgjs/parseargs/commit/a85e8dc06379fd2696ee195cc625de8fac6aee42))
* support single dash as positional ([#49](https://github.com/pkgjs/parseargs/issues/49)) ([d795bf8](https://github.com/pkgjs/parseargs/commit/d795bf877d068fd67aec381f30b30b63f97109ad))
### [0.1.1](https://github.com/pkgjs/parseargs/compare/v0.1.0...v0.1.1) (2022-01-25)
### Bug Fixes
* only use arrays in results for multiples ([#42](https://github.com/pkgjs/parseargs/issues/42)) ([c357584](https://github.com/pkgjs/parseargs/commit/c357584847912506319ed34a0840080116f4fd65))
## 0.1.0 (2022-01-22)
### Features
* expand scenarios covered by default arguments for environments ([#20](https://github.com/pkgjs/parseargs/issues/20)) ([582ada7](https://github.com/pkgjs/parseargs/commit/582ada7be0eca3a73d6e0bd016e7ace43449fa4c))
* update readme and include contributing guidelines ([8edd6fc](https://github.com/pkgjs/parseargs/commit/8edd6fc863cd705f6fac732724159ebe8065a2b0))
### Bug Fixes
* do not strip excess leading dashes on long option names ([#21](https://github.com/pkgjs/parseargs/issues/21)) ([f848590](https://github.com/pkgjs/parseargs/commit/f848590ebf3249ed5979ff47e003fa6e1a8ec5c0))
* name & readme ([3f057c1](https://github.com/pkgjs/parseargs/commit/3f057c1b158a1bdbe878c64b57460c58e56e465f))
* package.json values ([9bac300](https://github.com/pkgjs/parseargs/commit/9bac300e00cd76c77076bf9e75e44f8929512da9))
* update readme name ([957d8d9](https://github.com/pkgjs/parseargs/commit/957d8d96e1dcb48297c0a14345d44c0123b2883e))
### Build System
* first release as minor ([421c6e2](https://github.com/pkgjs/parseargs/commit/421c6e2569a8668ad14fac5a5af5be60479a7571))
@@ -0,0 +1,493 @@
// src/trace-mapping.ts
import { encode, decode } from "@jridgewell/sourcemap-codec";
// src/resolve.ts
import resolveUri from "@jridgewell/resolve-uri";
// src/strip-filename.ts
function stripFilename(path) {
if (!path) return "";
const index = path.lastIndexOf("/");
return path.slice(0, index + 1);
}
// src/resolve.ts
function resolver(mapUrl, sourceRoot) {
const from = stripFilename(mapUrl);
const prefix = sourceRoot ? sourceRoot + "/" : "";
return (source) => resolveUri(prefix + (source || ""), from);
}
// src/sourcemap-segment.ts
var COLUMN = 0;
var SOURCES_INDEX = 1;
var SOURCE_LINE = 2;
var SOURCE_COLUMN = 3;
var NAMES_INDEX = 4;
var REV_GENERATED_LINE = 1;
var REV_GENERATED_COLUMN = 2;
// src/sort.ts
function maybeSort(mappings, owned) {
const unsortedIndex = nextUnsortedSegmentLine(mappings, 0);
if (unsortedIndex === mappings.length) return mappings;
if (!owned) mappings = mappings.slice();
for (let i = unsortedIndex; i < mappings.length; i = nextUnsortedSegmentLine(mappings, i + 1)) {
mappings[i] = sortSegments(mappings[i], owned);
}
return mappings;
}
function nextUnsortedSegmentLine(mappings, start) {
for (let i = start; i < mappings.length; i++) {
if (!isSorted(mappings[i])) return i;
}
return mappings.length;
}
function isSorted(line) {
for (let j = 1; j < line.length; j++) {
if (line[j][COLUMN] < line[j - 1][COLUMN]) {
return false;
}
}
return true;
}
function sortSegments(line, owned) {
if (!owned) line = line.slice();
return line.sort(sortComparator);
}
function sortComparator(a, b) {
return a[COLUMN] - b[COLUMN];
}
// src/by-source.ts
function buildBySources(decoded, memos) {
const sources = memos.map(() => []);
for (let i = 0; i < decoded.length; i++) {
const line = decoded[i];
for (let j = 0; j < line.length; j++) {
const seg = line[j];
if (seg.length === 1) continue;
const sourceIndex2 = seg[SOURCES_INDEX];
const sourceLine = seg[SOURCE_LINE];
const sourceColumn = seg[SOURCE_COLUMN];
const source = sources[sourceIndex2];
const segs = source[sourceLine] || (source[sourceLine] = []);
segs.push([sourceColumn, i, seg[COLUMN]]);
}
}
for (let i = 0; i < sources.length; i++) {
const source = sources[i];
for (let j = 0; j < source.length; j++) {
const line = source[j];
if (line) line.sort(sortComparator);
}
}
return sources;
}
// src/binary-search.ts
var found = false;
function binarySearch(haystack, needle, low, high) {
while (low <= high) {
const mid = low + (high - low >> 1);
const cmp = haystack[mid][COLUMN] - needle;
if (cmp === 0) {
found = true;
return mid;
}
if (cmp < 0) {
low = mid + 1;
} else {
high = mid - 1;
}
}
found = false;
return low - 1;
}
function upperBound(haystack, needle, index) {
for (let i = index + 1; i < haystack.length; index = i++) {
if (haystack[i][COLUMN] !== needle) break;
}
return index;
}
function lowerBound(haystack, needle, index) {
for (let i = index - 1; i >= 0; index = i--) {
if (haystack[i][COLUMN] !== needle) break;
}
return index;
}
function memoizedState() {
return {
lastKey: -1,
lastNeedle: -1,
lastIndex: -1
};
}
function memoizedBinarySearch(haystack, needle, state, key) {
const { lastKey, lastNeedle, lastIndex } = state;
let low = 0;
let high = haystack.length - 1;
if (key === lastKey) {
if (needle === lastNeedle) {
found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle;
return lastIndex;
}
if (needle >= lastNeedle) {
low = lastIndex === -1 ? 0 : lastIndex;
} else {
high = lastIndex;
}
}
state.lastKey = key;
state.lastNeedle = needle;
return state.lastIndex = binarySearch(haystack, needle, low, high);
}
// src/types.ts
function parse(map) {
return typeof map === "string" ? JSON.parse(map) : map;
}
// src/flatten-map.ts
var FlattenMap = function(map, mapUrl) {
const parsed = parse(map);
if (!("sections" in parsed)) {
return new TraceMap(parsed, mapUrl);
}
const mappings = [];
const sources = [];
const sourcesContent = [];
const names = [];
const ignoreList = [];
recurse(
parsed,
mapUrl,
mappings,
sources,
sourcesContent,
names,
ignoreList,
0,
0,
Infinity,
Infinity
);
const joined = {
version: 3,
file: parsed.file,
names,
sources,
sourcesContent,
mappings,
ignoreList
};
return presortedDecodedMap(joined);
};
function recurse(input, mapUrl, mappings, sources, sourcesContent, names, ignoreList, lineOffset, columnOffset, stopLine, stopColumn) {
const { sections } = input;
for (let i = 0; i < sections.length; i++) {
const { map, offset } = sections[i];
let sl = stopLine;
let sc = stopColumn;
if (i + 1 < sections.length) {
const nextOffset = sections[i + 1].offset;
sl = Math.min(stopLine, lineOffset + nextOffset.line);
if (sl === stopLine) {
sc = Math.min(stopColumn, columnOffset + nextOffset.column);
} else if (sl < stopLine) {
sc = columnOffset + nextOffset.column;
}
}
addSection(
map,
mapUrl,
mappings,
sources,
sourcesContent,
names,
ignoreList,
lineOffset + offset.line,
columnOffset + offset.column,
sl,
sc
);
}
}
function addSection(input, mapUrl, mappings, sources, sourcesContent, names, ignoreList, lineOffset, columnOffset, stopLine, stopColumn) {
const parsed = parse(input);
if ("sections" in parsed) return recurse(...arguments);
const map = new TraceMap(parsed, mapUrl);
const sourcesOffset = sources.length;
const namesOffset = names.length;
const decoded = decodedMappings(map);
const { resolvedSources, sourcesContent: contents, ignoreList: ignores } = map;
append(sources, resolvedSources);
append(names, map.names);
if (contents) append(sourcesContent, contents);
else for (let i = 0; i < resolvedSources.length; i++) sourcesContent.push(null);
if (ignores) for (let i = 0; i < ignores.length; i++) ignoreList.push(ignores[i] + sourcesOffset);
for (let i = 0; i < decoded.length; i++) {
const lineI = lineOffset + i;
if (lineI > stopLine) return;
const out = getLine(mappings, lineI);
const cOffset = i === 0 ? columnOffset : 0;
const line = decoded[i];
for (let j = 0; j < line.length; j++) {
const seg = line[j];
const column = cOffset + seg[COLUMN];
if (lineI === stopLine && column >= stopColumn) return;
if (seg.length === 1) {
out.push([column]);
continue;
}
const sourcesIndex = sourcesOffset + seg[SOURCES_INDEX];
const sourceLine = seg[SOURCE_LINE];
const sourceColumn = seg[SOURCE_COLUMN];
out.push(
seg.length === 4 ? [column, sourcesIndex, sourceLine, sourceColumn] : [column, sourcesIndex, sourceLine, sourceColumn, namesOffset + seg[NAMES_INDEX]]
);
}
}
}
function append(arr, other) {
for (let i = 0; i < other.length; i++) arr.push(other[i]);
}
function getLine(arr, index) {
for (let i = arr.length; i <= index; i++) arr[i] = [];
return arr[index];
}
// src/trace-mapping.ts
var LINE_GTR_ZERO = "`line` must be greater than 0 (lines start at line 1)";
var COL_GTR_EQ_ZERO = "`column` must be greater than or equal to 0 (columns start at column 0)";
var LEAST_UPPER_BOUND = -1;
var GREATEST_LOWER_BOUND = 1;
var TraceMap = class {
constructor(map, mapUrl) {
const isString = typeof map === "string";
if (!isString && map._decodedMemo) return map;
const parsed = parse(map);
const { version, file, names, sourceRoot, sources, sourcesContent } = parsed;
this.version = version;
this.file = file;
this.names = names || [];
this.sourceRoot = sourceRoot;
this.sources = sources;
this.sourcesContent = sourcesContent;
this.ignoreList = parsed.ignoreList || parsed.x_google_ignoreList || void 0;
const resolve = resolver(mapUrl, sourceRoot);
this.resolvedSources = sources.map(resolve);
const { mappings } = parsed;
if (typeof mappings === "string") {
this._encoded = mappings;
this._decoded = void 0;
} else if (Array.isArray(mappings)) {
this._encoded = void 0;
this._decoded = maybeSort(mappings, isString);
} else if (parsed.sections) {
throw new Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`);
} else {
throw new Error(`invalid source map: ${JSON.stringify(parsed)}`);
}
this._decodedMemo = memoizedState();
this._bySources = void 0;
this._bySourceMemos = void 0;
}
};
function cast(map) {
return map;
}
function encodedMappings(map) {
var _a, _b;
return (_b = (_a = cast(map))._encoded) != null ? _b : _a._encoded = encode(cast(map)._decoded);
}
function decodedMappings(map) {
var _a;
return (_a = cast(map))._decoded || (_a._decoded = decode(cast(map)._encoded));
}
function traceSegment(map, line, column) {
const decoded = decodedMappings(map);
if (line >= decoded.length) return null;
const segments = decoded[line];
const index = traceSegmentInternal(
segments,
cast(map)._decodedMemo,
line,
column,
GREATEST_LOWER_BOUND
);
return index === -1 ? null : segments[index];
}
function originalPositionFor(map, needle) {
let { line, column, bias } = needle;
line--;
if (line < 0) throw new Error(LINE_GTR_ZERO);
if (column < 0) throw new Error(COL_GTR_EQ_ZERO);
const decoded = decodedMappings(map);
if (line >= decoded.length) return OMapping(null, null, null, null);
const segments = decoded[line];
const index = traceSegmentInternal(
segments,
cast(map)._decodedMemo,
line,
column,
bias || GREATEST_LOWER_BOUND
);
if (index === -1) return OMapping(null, null, null, null);
const segment = segments[index];
if (segment.length === 1) return OMapping(null, null, null, null);
const { names, resolvedSources } = map;
return OMapping(
resolvedSources[segment[SOURCES_INDEX]],
segment[SOURCE_LINE] + 1,
segment[SOURCE_COLUMN],
segment.length === 5 ? names[segment[NAMES_INDEX]] : null
);
}
function generatedPositionFor(map, needle) {
const { source, line, column, bias } = needle;
return generatedPosition(map, source, line, column, bias || GREATEST_LOWER_BOUND, false);
}
function allGeneratedPositionsFor(map, needle) {
const { source, line, column, bias } = needle;
return generatedPosition(map, source, line, column, bias || LEAST_UPPER_BOUND, true);
}
function eachMapping(map, cb) {
const decoded = decodedMappings(map);
const { names, resolvedSources } = map;
for (let i = 0; i < decoded.length; i++) {
const line = decoded[i];
for (let j = 0; j < line.length; j++) {
const seg = line[j];
const generatedLine = i + 1;
const generatedColumn = seg[0];
let source = null;
let originalLine = null;
let originalColumn = null;
let name = null;
if (seg.length !== 1) {
source = resolvedSources[seg[1]];
originalLine = seg[2] + 1;
originalColumn = seg[3];
}
if (seg.length === 5) name = names[seg[4]];
cb({
generatedLine,
generatedColumn,
source,
originalLine,
originalColumn,
name
});
}
}
}
function sourceIndex(map, source) {
const { sources, resolvedSources } = map;
let index = sources.indexOf(source);
if (index === -1) index = resolvedSources.indexOf(source);
return index;
}
function sourceContentFor(map, source) {
const { sourcesContent } = map;
if (sourcesContent == null) return null;
const index = sourceIndex(map, source);
return index === -1 ? null : sourcesContent[index];
}
function isIgnored(map, source) {
const { ignoreList } = map;
if (ignoreList == null) return false;
const index = sourceIndex(map, source);
return index === -1 ? false : ignoreList.includes(index);
}
function presortedDecodedMap(map, mapUrl) {
const tracer = new TraceMap(clone(map, []), mapUrl);
cast(tracer)._decoded = map.mappings;
return tracer;
}
function decodedMap(map) {
return clone(map, decodedMappings(map));
}
function encodedMap(map) {
return clone(map, encodedMappings(map));
}
function clone(map, mappings) {
return {
version: map.version,
file: map.file,
names: map.names,
sourceRoot: map.sourceRoot,
sources: map.sources,
sourcesContent: map.sourcesContent,
mappings,
ignoreList: map.ignoreList || map.x_google_ignoreList
};
}
function OMapping(source, line, column, name) {
return { source, line, column, name };
}
function GMapping(line, column) {
return { line, column };
}
function traceSegmentInternal(segments, memo, line, column, bias) {
let index = memoizedBinarySearch(segments, column, memo, line);
if (found) {
index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index);
} else if (bias === LEAST_UPPER_BOUND) index++;
if (index === -1 || index === segments.length) return -1;
return index;
}
function sliceGeneratedPositions(segments, memo, line, column, bias) {
let min = traceSegmentInternal(segments, memo, line, column, GREATEST_LOWER_BOUND);
if (!found && bias === LEAST_UPPER_BOUND) min++;
if (min === -1 || min === segments.length) return [];
const matchedColumn = found ? column : segments[min][COLUMN];
if (!found) min = lowerBound(segments, matchedColumn, min);
const max = upperBound(segments, matchedColumn, min);
const result = [];
for (; min <= max; min++) {
const segment = segments[min];
result.push(GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN]));
}
return result;
}
function generatedPosition(map, source, line, column, bias, all) {
var _a, _b;
line--;
if (line < 0) throw new Error(LINE_GTR_ZERO);
if (column < 0) throw new Error(COL_GTR_EQ_ZERO);
const { sources, resolvedSources } = map;
let sourceIndex2 = sources.indexOf(source);
if (sourceIndex2 === -1) sourceIndex2 = resolvedSources.indexOf(source);
if (sourceIndex2 === -1) return all ? [] : GMapping(null, null);
const bySourceMemos = (_a = cast(map))._bySourceMemos || (_a._bySourceMemos = sources.map(memoizedState));
const generated = (_b = cast(map))._bySources || (_b._bySources = buildBySources(decodedMappings(map), bySourceMemos));
const segments = generated[sourceIndex2][line];
if (segments == null) return all ? [] : GMapping(null, null);
const memo = bySourceMemos[sourceIndex2];
if (all) return sliceGeneratedPositions(segments, memo, line, column, bias);
const index = traceSegmentInternal(segments, memo, line, column, bias);
if (index === -1) return GMapping(null, null);
const segment = segments[index];
return GMapping(segment[REV_GENERATED_LINE] + 1, segment[REV_GENERATED_COLUMN]);
}
export {
FlattenMap as AnyMap,
FlattenMap,
GREATEST_LOWER_BOUND,
LEAST_UPPER_BOUND,
TraceMap,
allGeneratedPositionsFor,
decodedMap,
decodedMappings,
eachMapping,
encodedMap,
encodedMappings,
generatedPositionFor,
isIgnored,
originalPositionFor,
presortedDecodedMap,
sourceContentFor,
traceSegment
};
//# sourceMappingURL=trace-mapping.mjs.map
@@ -0,0 +1,41 @@
'use strict';
function noop() {}
var defaultExts = {
create: noop,
before: noop,
after: noop,
error: noop,
};
function defaultExtensions(extensions) {
extensions = extensions || {};
return {
create: extensions.create || defaultExts.create,
before: extensions.before || defaultExts.before,
after: extensions.after || defaultExts.after,
error: extensions.error || defaultExts.error,
};
}
function initializeResults(values) {
var keys = Object.keys(values);
var results = Array.isArray(values) ? [] : {};
var idx = 0;
var length = keys.length;
for (idx = 0; idx < length; idx++) {
var key = keys[idx];
results[key] = undefined;
}
return results;
}
module.exports = {
defaultExtensions: defaultExtensions,
noop: noop,
initializeResults: initializeResults,
};
@@ -0,0 +1,249 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const vitest_1 = require("vitest");
// eslint-disable-next-line vitest/prefer-describe-function-title
(0, vitest_1.describe)('BindToFluentSyntax', () => {
(0, vitest_1.describe)('.toFactory', () => {
let bindToFluentSyntaxMock;
(0, vitest_1.beforeAll)(() => {
bindToFluentSyntaxMock = {
toFactory: vitest_1.vitest.fn(),
};
});
(0, vitest_1.describe)('having an async factory', () => {
let factoryFixture;
(0, vitest_1.beforeAll)(() => {
factoryFixture = async () => async () => undefined;
});
(0, vitest_1.it)('when called, should not throw a syntax error', () => {
(0, vitest_1.expectTypeOf)(bindToFluentSyntaxMock.toFactory(factoryFixture)).toEqualTypeOf();
});
});
});
(0, vitest_1.describe)('.toResolvedValue', () => {
let bindToFluentSyntaxMock;
(0, vitest_1.beforeAll)(() => {
bindToFluentSyntaxMock = {
toResolvedValue: vitest_1.vitest.fn(),
};
});
(0, vitest_1.describe)('having an async factory with no arguments', () => {
let factoryFixture;
(0, vitest_1.beforeAll)(() => {
factoryFixture = async () => undefined;
});
(0, vitest_1.it)('when called, with no inject options, should not throw a syntax error', () => {
(0, vitest_1.expectTypeOf)(bindToFluentSyntaxMock.toResolvedValue(factoryFixture)).toEqualTypeOf();
});
});
(0, vitest_1.describe)('having an async factory with a fixed number of primitive arguments', () => {
let factoryFixture;
(0, vitest_1.beforeAll)(() => {
factoryFixture = async (_arg1, _arg2) => undefined;
});
(0, vitest_1.it)('when called, with as many right service identifier inject options as function parameters, should not throw a syntax error', () => {
const firstServiceIdentifier = Symbol();
const secondServiceIdentifier = Symbol();
(0, vitest_1.expectTypeOf)(bindToFluentSyntaxMock.toResolvedValue(factoryFixture, [
firstServiceIdentifier,
secondServiceIdentifier,
])).toEqualTypeOf();
});
});
(0, vitest_1.describe)('having a factory with a fixed number of primitive arguments', () => {
let factoryFixture;
(0, vitest_1.beforeAll)(() => {
factoryFixture = (arg1, arg2) => {
return { arg1, arg2 };
};
});
(0, vitest_1.it)('when called, with no inject options, should throw a syntax error', () => {
// @ts-expect-error :: Inject options are required
(0, vitest_1.assertType)(bindToFluentSyntaxMock.toResolvedValue(factoryFixture));
});
(0, vitest_1.it)('when called, with less right inject options than function parameters, should throw a syntax error', () => {
const firstServiceIdentifier = Symbol();
(0, vitest_1.assertType)(
// @ts-expect-error :: Too few inject options are provided
bindToFluentSyntaxMock.toResolvedValue(factoryFixture, [
firstServiceIdentifier,
]));
});
(0, vitest_1.it)('when called, with as many right service identifier inject options as function parameters, should not throw a syntax error', () => {
const firstServiceIdentifier = Symbol();
const secondServiceIdentifier = Symbol();
(0, vitest_1.expectTypeOf)(bindToFluentSyntaxMock.toResolvedValue(factoryFixture, [
firstServiceIdentifier,
secondServiceIdentifier,
])).toEqualTypeOf();
});
(0, vitest_1.it)('when called, with as many "wrong" service identifier inject options as function parameters, should throw a syntax error', () => {
const firstServiceIdentifier = Symbol();
const secondServiceIdentifier = Object;
(0, vitest_1.expectTypeOf)(bindToFluentSyntaxMock.toResolvedValue(factoryFixture, [
firstServiceIdentifier,
secondServiceIdentifier,
])).toEqualTypeOf();
});
(0, vitest_1.it)('when called, with more right service identifier inject options than function parameters, should throw a syntax error', () => {
const firstServiceIdentifier = Symbol();
const secondServiceIdentifier = Symbol();
const thirdServiceIdentifier = Symbol();
(0, vitest_1.assertType)(
// @ts-expect-error :: Too many inject options are provided
bindToFluentSyntaxMock.toResolvedValue(factoryFixture, [
firstServiceIdentifier,
secondServiceIdentifier,
thirdServiceIdentifier,
]));
});
(0, vitest_1.it)('when called, with as many "wrong" resolve value inject options as function parameters, should not throw a syntax error', () => {
const firstServiceIdentifier = {
// @ts-expect-error :: Unexpected isMultiple property
isMultiple: true,
serviceIdentifier: Symbol(),
};
const secondServiceIdentifier = {
// @ts-expect-error :: Unexpected optional property
optional: true,
serviceIdentifier: Symbol(),
};
const thirdServiceIdentifier = {
// @ts-expect-error :: Unexpected isMultiple property
isMultiple: true,
// The compiler is not currently failing due to the isMultiple related error
optional: true,
serviceIdentifier: Symbol(),
};
const fourthServiceIdentifier = {
serviceIdentifier: Symbol(),
};
(0, vitest_1.assertType)(bindToFluentSyntaxMock.toResolvedValue(factoryFixture, [
firstServiceIdentifier,
secondServiceIdentifier,
]));
(0, vitest_1.assertType)(bindToFluentSyntaxMock.toResolvedValue(factoryFixture, [
thirdServiceIdentifier,
fourthServiceIdentifier,
]));
});
});
(0, vitest_1.describe)('having a factory with an array argument', () => {
let factoryFixture;
(0, vitest_1.beforeAll)(() => {
factoryFixture = (arg1) => arg1;
});
(0, vitest_1.it)('when called, with as many "wrong" resolve value inject options as function parameters, should not throw a syntax error', () => {
const firstServiceIdentifier = {
isMultiple: true,
serviceIdentifier: Symbol(),
};
const secondServiceIdentifier = {
// @ts-expect-error :: Unexpected optional inject option
optional: true,
serviceIdentifier: Symbol(),
};
const thirdServiceIdentifier = {
isMultiple: true,
// @ts-expect-error :: Unexpected optional inject option
optional: true,
serviceIdentifier: Symbol(),
};
// @ts-expect-error :: Expected isMultiple inject option
const fourthServiceIdentifier = {
serviceIdentifier: Symbol(),
};
(0, vitest_1.assertType)(bindToFluentSyntaxMock.toResolvedValue(factoryFixture, [
firstServiceIdentifier,
]));
(0, vitest_1.assertType)(bindToFluentSyntaxMock.toResolvedValue(factoryFixture, [
secondServiceIdentifier,
]));
(0, vitest_1.assertType)(bindToFluentSyntaxMock.toResolvedValue(factoryFixture, [
thirdServiceIdentifier,
]));
(0, vitest_1.assertType)(bindToFluentSyntaxMock.toResolvedValue(factoryFixture, [
fourthServiceIdentifier,
]));
});
});
(0, vitest_1.describe)('having a factory with an optional argument', () => {
let factoryFixture;
(0, vitest_1.beforeAll)(() => {
factoryFixture = (arg1) => arg1;
});
(0, vitest_1.it)('when called, with as many "wrong" resolve value inject options as function parameters, should not throw a syntax error', () => {
const firstServiceIdentifier = {
// @ts-expect-error :: Unexpected isMultiple inject option
isMultiple: true,
serviceIdentifier: Symbol(),
};
const secondServiceIdentifier = {
optional: true,
serviceIdentifier: Symbol(),
};
const thirdServiceIdentifier = {
// @ts-expect-error :: Unexpected isMultiple inject option
isMultiple: true,
optional: true,
serviceIdentifier: Symbol(),
};
const fourthServiceIdentifier = {
serviceIdentifier: Symbol(),
};
(0, vitest_1.assertType)(bindToFluentSyntaxMock.toResolvedValue(factoryFixture, [
firstServiceIdentifier,
]));
(0, vitest_1.assertType)(bindToFluentSyntaxMock.toResolvedValue(factoryFixture, [
secondServiceIdentifier,
]));
(0, vitest_1.assertType)(bindToFluentSyntaxMock.toResolvedValue(factoryFixture, [
thirdServiceIdentifier,
]));
(0, vitest_1.assertType)(bindToFluentSyntaxMock.toResolvedValue(factoryFixture, [
fourthServiceIdentifier,
]));
});
});
(0, vitest_1.describe)('having a factory with an optional array argument', () => {
let factoryFixture;
(0, vitest_1.beforeAll)(() => {
factoryFixture = (arg1) => arg1;
});
(0, vitest_1.it)('when called, with as many "wrong" resolve value inject options as function parameters, should not throw a syntax error', () => {
// @ts-expect-error :: Expected optional inject option
const firstServiceIdentifier = {
isMultiple: true,
serviceIdentifier: Symbol(),
};
// @ts-expect-error :: Expected isMultiple inject option
const secondServiceIdentifier = {
optional: true,
serviceIdentifier: Symbol(),
};
const thirdServiceIdentifier = {
isMultiple: true,
optional: true,
serviceIdentifier: Symbol(),
};
// @ts-expect-error :: Expected isMultiple and optional inject options
const fourthServiceIdentifier = {
serviceIdentifier: Symbol(),
};
(0, vitest_1.assertType)(bindToFluentSyntaxMock.toResolvedValue(factoryFixture, [
firstServiceIdentifier,
]));
(0, vitest_1.assertType)(bindToFluentSyntaxMock.toResolvedValue(factoryFixture, [
secondServiceIdentifier,
]));
(0, vitest_1.assertType)(bindToFluentSyntaxMock.toResolvedValue(factoryFixture, [
thirdServiceIdentifier,
]));
(0, vitest_1.assertType)(bindToFluentSyntaxMock.toResolvedValue(factoryFixture, [
fourthServiceIdentifier,
]));
});
});
});
});
//# sourceMappingURL=BindingFluentSyntax.spec-d.js.map
@@ -0,0 +1 @@
{"version":3,"file":"getDefaultClassMetadata.js","sourceRoot":"","sources":["../../../../src/metadata/calculations/getDefaultClassMetadata.ts"],"names":[],"mappings":";;AAEA,0DAUC;AAVD,SAAgB,uBAAuB;IACrC,OAAO;QACL,oBAAoB,EAAE,EAAE;QACxB,SAAS,EAAE;YACT,wBAAwB,EAAE,IAAI,GAAG,EAAE;YACnC,qBAAqB,EAAE,IAAI,GAAG,EAAE;SACjC;QACD,UAAU,EAAE,IAAI,GAAG,EAAE;QACrB,KAAK,EAAE,SAAS;KACjB,CAAC;AACJ,CAAC"}
Loaded 100 of 35554 files, more files were not shown because too many files have changed in this diff. Show more