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

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

No files matched your search

@@ -0,0 +1,17 @@
var baseClamp = require('./_baseClamp'),
copyArray = require('./_copyArray'),
shuffleSelf = require('./_shuffleSelf');
/**
* A specialized version of `_.sampleSize` for arrays.
*
* @private
* @param {Array} array The array to sample.
* @param {number} n The number of elements to sample.
* @returns {Array} Returns the random elements.
*/
function arraySampleSize(array, n) {
return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
}
module.exports = arraySampleSize;
@@ -0,0 +1 @@
{"version":3,"file":"brace-expressions.d.ts","sourceRoot":"","sources":["../../src/brace-expressions.ts"],"names":[],"mappings":"AA+BA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,GAAG,EAAE,MAAM;IACX,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,MAAM;IAChB,QAAQ,EAAE,OAAO;CAClB,CAAA;AAQD,eAAO,MAAM,UAAU,SACf,MAAM,YACF,MAAM,qBA8HjB,CAAA"}
@@ -0,0 +1,5 @@
var convert = require('./convert'),
func = convert('includesFrom', require('../includes'));
func.placeholder = require('./placeholder');
module.exports = func;
@@ -0,0 +1,143 @@
"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) ? "எண் அல்லாதது" : "எண்";
}
case "object": {
if (Array.isArray(data)) {
return "அணி";
}
if (data === null) {
return "வெறுமை";
}
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
return data.constructor.name;
}
}
}
return t;
};
const Nouns = {
regex: "உள்ளீடு",
email: "மின்னஞ்சல் முகவரி",
url: "URL",
emoji: "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: "input",
};
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 ? "கள்" : ""}: ${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,112 @@
# dequal [![CI](https://github.com/lukeed/dequal/workflows/CI/badge.svg)](https://github.com/lukeed/dequal/actions)
> A tiny (304B to 489B) utility to check for deep equality
This module supports comparison of all types, including `Function`, `RegExp`, `Date`, `Set`, `Map`, `TypedArray`s, `DataView`, `null`, `undefined`, and `NaN` values. Complex values (eg, Objects, Arrays, Sets, Maps, etc) are traversed recursively.
> **Important:**
> * key order **within Objects** does not matter
> * value order **within Arrays** _does_ matter
> * values **within Sets and Maps** use value equality
> * keys **within Maps** use value equality
## Install
```
$ npm install --save dequal
```
## Modes
There are two "versions" of `dequal` available:
#### `dequal`
> **Size (gzip):** 489 bytes<br>
> **Availability:** [CommonJS](https://unpkg.com/dequal/dist/index.js), [ES Module](https://unpkg.com/dequal/dist/index.mjs), [UMD](https://unpkg.com/dequal/dist/index.min.js)
#### `dequal/lite`
> **Size (gzip):** 304 bytes<br>
> **Availability:** [CommonJS](https://unpkg.com/dequal/lite/index.js), [ES Module](https://unpkg.com/dequal/lite/index.mjs)
| | IE9+ | Number | String | Date | RegExp | Object | Array | Class | Set | Map | ArrayBuffer | [TypedArray](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray#TypedArray_objects) | [DataView](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) |
|-|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|:-:|
| `dequal` | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| `dequal/lite` | :+1: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: | :x: | :x: | :x: |
> <sup>**Note:** Table scrolls horizontally!</sup>
## Usage
```js
import { dequal } from 'dequal';
dequal(1, 1); //=> true
dequal({}, {}); //=> true
dequal('foo', 'foo'); //=> true
dequal([1, 2, 3], [1, 2, 3]); //=> true
dequal(dequal, dequal); //=> true
dequal(/foo/, /foo/); //=> true
dequal(null, null); //=> true
dequal(NaN, NaN); //=> true
dequal([], []); //=> true
dequal(
[{ a:1 }, [{ b:{ c:[1] } }]],
[{ a:1 }, [{ b:{ c:[1] } }]]
); //=> true
dequal(1, '1'); //=> false
dequal(null, undefined); //=> false
dequal({ a:1, b:[2,3] }, { a:1, b:[2,5] }); //=> false
dequal(/foo/i, /bar/g); //=> false
```
## API
### dequal(foo, bar)
Returns: `Boolean`
Both `foo` and `bar` can be of any type.<br>
A `Boolean` is returned indicating if the two were deeply equal.
## Benchmarks
> Running Node v10.13.0
The benchmarks can be found in the [`/bench`](/bench) directory. They are separated into two categories:
* `basic` – compares an object comprised of `String`, `Number`, `Date`, `Array`, and `Object` values.
* `complex` – like `basic`, but adds `RegExp`, `Map`, `Set`, and `Uint8Array` values.
> **Note:** Only candidates that pass validation step(s) are listed. <br>For example, `fast-deep-equal/es6` handles `Set` and `Map` values, but uses _referential equality_ while those listed use _value equality_.
```
Load times:
assert 0.109ms
util 0.006ms
fast-deep-equal 0.479ms
lodash/isequal 22.826ms
nano-equal 0.417ms
dequal 0.396ms
dequal/lite 0.264ms
Benchmark :: basic
assert.deepStrictEqual x 325,262 ops/sec ±0.57% (94 runs sampled)
util.isDeepStrictEqual x 318,812 ops/sec ±0.87% (94 runs sampled)
fast-deep-equal x 1,332,393 ops/sec ±0.36% (93 runs sampled)
lodash.isEqual x 269,129 ops/sec ±0.59% (95 runs sampled)
nano-equal x 1,122,053 ops/sec ±0.36% (96 runs sampled)
dequal/lite x 1,700,972 ops/sec ±0.31% (94 runs sampled)
dequal x 1,698,972 ops/sec ±0.63% (97 runs sampled)
Benchmark :: complex
assert.deepStrictEqual x 124,518 ops/sec ±0.64% (96 runs sampled)
util.isDeepStrictEqual x 125,113 ops/sec ±0.24% (96 runs sampled)
lodash.isEqual x 58,677 ops/sec ±0.49% (96 runs sampled)
dequal x 345,386 ops/sec ±0.27% (96 runs sampled)
```
## License
MIT © [Luke Edwards](https://lukeed.com)
@@ -0,0 +1,10 @@
'use strict';
var regex = require('unc-path-regex')();
module.exports = function(filepath) {
if (typeof filepath !== 'string') {
throw new TypeError('expected a string');
}
return regex.test(filepath);
};
@@ -0,0 +1 @@
export { _ as default } from "../esm/_tagged_template_literal_loose.js";
@@ -0,0 +1,18 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./clean"), exports);
@@ -0,0 +1,34 @@
{
"name": "safer-buffer",
"version": "2.1.2",
"description": "Modern Buffer API polyfill without footguns",
"main": "safer.js",
"scripts": {
"browserify-test": "browserify --external tape tests.js > browserify-tests.js && tape browserify-tests.js",
"test": "standard && tape tests.js"
},
"author": {
"name": "Nikita Skovoroda",
"email": "chalkerx@gmail.com",
"url": "https://github.com/ChALkeR"
},
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/ChALkeR/safer-buffer.git"
},
"bugs": {
"url": "https://github.com/ChALkeR/safer-buffer/issues"
},
"devDependencies": {
"standard": "^11.0.1",
"tape": "^4.9.0"
},
"files": [
"Porting-Buffer.md",
"Readme.md",
"tests.js",
"dangerous.js",
"safer.js"
]
}
@@ -0,0 +1 @@
module.exports={A:{A:{"1":"E F A B","2":"K D wC"},B:{"2":"0 1 2 3 4 5 C L M G N O P Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I"},C:{"2":"0 1 2 3 4 5 6 7 8 9 xC TC J ZB K D E F A B C L M G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC yC zC 0C 1C"},D:{"1":"6 7 8 9 J ZB K D E F A B C L M G N O P aB AB BB CB DB EB FB bB cB","2":"0 1 2 3 4 5 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"},E:{"1":"ZB K 3C","2":"D E F A B C L M G 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","16":"4C","129":"J 2C ZC"},F:{"1":"F B C G N O P FD GD HD ID NC uC JD OC","2":"0 1 2 3 4 5 6 7 8 9 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"},G:{"1":"KD vC LD MD ND","2":"E 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","129":"ZC"},H:{"1":"hD"},I:{"1":"TC J iD jD kD lD vC mD","2":"I nD"},J:{"1":"D A"},K:{"1":"A B C NC uC OC","2":"H"},L:{"2":"I"},M:{"2":"MC"},N:{"1":"A B"},O:{"2":"PC"},P:{"2":"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:{"2":"zD"},R:{"2":"0D"},S:{"2":"1D 2D"}},B:4,C:"display: run-in",D:true};
@@ -0,0 +1 @@
{"version":3,"file":"resolveFactoryBinding.d.ts","sourceRoot":"","sources":["../../../../src/resolution/actions/resolveFactoryBinding.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAErE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAG9C,eAAO,MAAM,qBAAqB,EAAE,CAAC,UAAU,SAAS,OAAO,CAAC,OAAO,CAAC,EACtE,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,cAAc,CAAC,UAAU,CAAC,KAChC,QAAQ,CAAC,UAAU,CAMQ,CAAC"}
@@ -0,0 +1,8 @@
import type { SourceFile } from 'typescript';
import type { ASTMaps } from './convert';
import type { ParseSettings } from './parseSettings';
import type { TSESTree } from './ts-estree';
export declare function astConverter(ast: SourceFile, parseSettings: ParseSettings, shouldPreserveNodeMaps: boolean): {
astMaps: ASTMaps;
estree: TSESTree.Program;
};
@@ -0,0 +1,104 @@
var makeMiddleware = require('./lib/make-middleware')
var diskStorage = require('./storage/disk')
var memoryStorage = require('./storage/memory')
var MulterError = require('./lib/multer-error')
function allowAll (req, file, cb) {
cb(null, true)
}
function Multer (options) {
if (options.storage) {
this.storage = options.storage
} else if (options.dest) {
this.storage = diskStorage({ destination: options.dest })
} else {
this.storage = memoryStorage()
}
this.limits = options.limits
this.preservePath = options.preservePath
this.fileFilter = options.fileFilter || allowAll
}
Multer.prototype._makeMiddleware = function (fields, fileStrategy) {
function setup () {
var fileFilter = this.fileFilter
var filesLeft = Object.create(null)
fields.forEach(function (field) {
if (typeof field.maxCount === 'number') {
filesLeft[field.name] = field.maxCount
} else {
filesLeft[field.name] = Infinity
}
})
function wrappedFileFilter (req, file, cb) {
if ((filesLeft[file.fieldname] || 0) <= 0) {
return cb(new MulterError('LIMIT_UNEXPECTED_FILE', file.fieldname))
}
filesLeft[file.fieldname] -= 1
fileFilter(req, file, cb)
}
return {
limits: this.limits,
preservePath: this.preservePath,
storage: this.storage,
fileFilter: wrappedFileFilter,
fileStrategy: fileStrategy
}
}
return makeMiddleware(setup.bind(this))
}
Multer.prototype.single = function (name) {
return this._makeMiddleware([{ name: name, maxCount: 1 }], 'VALUE')
}
Multer.prototype.array = function (name, maxCount) {
return this._makeMiddleware([{ name: name, maxCount: maxCount }], 'ARRAY')
}
Multer.prototype.fields = function (fields) {
return this._makeMiddleware(fields, 'OBJECT')
}
Multer.prototype.none = function () {
return this._makeMiddleware([], 'NONE')
}
Multer.prototype.any = function () {
function setup () {
return {
limits: this.limits,
preservePath: this.preservePath,
storage: this.storage,
fileFilter: this.fileFilter,
fileStrategy: 'ARRAY'
}
}
return makeMiddleware(setup.bind(this))
}
function multer (options) {
if (options === undefined) {
return new Multer({})
}
if (typeof options === 'object' && options !== null) {
return new Multer(options)
}
throw new TypeError('Expected object for argument options')
}
module.exports = multer
module.exports.diskStorage = diskStorage
module.exports.memoryStorage = memoryStorage
module.exports.MulterError = MulterError
@@ -0,0 +1 @@
module.exports={A:{A:{"1":"E F A B","2":"wC","8":"K D"},B:{"1":"0 1 2 3 4 5 C L M G N O P Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I"},C:{"1":"0 1 2 3 4 5 6 7 8 9 J ZB K D E F A B C L M G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z GB HB IB JB KB LB MB NB OB PB QB RB SB TB UB VB WB XB YB I XC MC YC yC zC 0C 1C","4":"xC TC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 J ZB K D E F A B C L M G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B UC 4B VC 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R 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"},E:{"1":"J ZB K D E F A B C L M G 3C 4C 5C 6C aC NC OC 7C 8C 9C bC cC PC AD QC dC eC fC gC hC BD RC iC jC kC lC mC CD SC nC oC pC qC rC sC tC DD ED","2":"2C ZC"},F:{"1":"0 1 2 3 4 5 6 7 8 9 B C G N O P aB AB BB CB DB EB FB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC EC FC GC HC IC JC KC LC Q H R WC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z HD ID NC uC JD OC","2":"F FD GD"},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:{"1":"A 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":"1D 2D"}},B:1,C:"Web Storage - name/value pairs",D:true};
@@ -0,0 +1,755 @@
/// <reference types="node" />
/**
* Object interface for constructing new SmartBuffer instances.
*/
interface SmartBufferOptions {
encoding?: BufferEncoding;
size?: number;
buff?: Buffer;
}
declare class SmartBuffer {
length: number;
private _encoding;
private _buff;
private _writeOffset;
private _readOffset;
/**
* Creates a new SmartBuffer instance.
*
* @param options { SmartBufferOptions } The SmartBufferOptions to apply to this instance.
*/
constructor(options?: SmartBufferOptions);
/**
* Creates a new SmartBuffer instance with the provided internal Buffer size and optional encoding.
*
* @param size { Number } The size of the internal Buffer.
* @param encoding { String } The BufferEncoding to use for strings.
*
* @return { SmartBuffer }
*/
static fromSize(size: number, encoding?: BufferEncoding): SmartBuffer;
/**
* Creates a new SmartBuffer instance with the provided Buffer and optional encoding.
*
* @param buffer { Buffer } The Buffer to use as the internal Buffer value.
* @param encoding { String } The BufferEncoding to use for strings.
*
* @return { SmartBuffer }
*/
static fromBuffer(buff: Buffer, encoding?: BufferEncoding): SmartBuffer;
/**
* Creates a new SmartBuffer instance with the provided SmartBufferOptions options.
*
* @param options { SmartBufferOptions } The options to use when creating the SmartBuffer instance.
*/
static fromOptions(options: SmartBufferOptions): SmartBuffer;
/**
* Type checking function that determines if an object is a SmartBufferOptions object.
*/
static isSmartBufferOptions(options: SmartBufferOptions): options is SmartBufferOptions;
/**
* Reads an Int8 value from the current read position or an optionally provided offset.
*
* @param offset { Number } The offset to read data from (optional)
* @return { Number }
*/
readInt8(offset?: number): number;
/**
* Reads an Int16BE value from the current read position or an optionally provided offset.
*
* @param offset { Number } The offset to read data from (optional)
* @return { Number }
*/
readInt16BE(offset?: number): number;
/**
* Reads an Int16LE value from the current read position or an optionally provided offset.
*
* @param offset { Number } The offset to read data from (optional)
* @return { Number }
*/
readInt16LE(offset?: number): number;
/**
* Reads an Int32BE value from the current read position or an optionally provided offset.
*
* @param offset { Number } The offset to read data from (optional)
* @return { Number }
*/
readInt32BE(offset?: number): number;
/**
* Reads an Int32LE value from the current read position or an optionally provided offset.
*
* @param offset { Number } The offset to read data from (optional)
* @return { Number }
*/
readInt32LE(offset?: number): number;
/**
* Reads a BigInt64BE value from the current read position or an optionally provided offset.
*
* @param offset { Number } The offset to read data from (optional)
* @return { BigInt }
*/
readBigInt64BE(offset?: number): bigint;
/**
* Reads a BigInt64LE value from the current read position or an optionally provided offset.
*
* @param offset { Number } The offset to read data from (optional)
* @return { BigInt }
*/
readBigInt64LE(offset?: number): bigint;
/**
* Writes an Int8 value to the current write position (or at optional offset).
*
* @param value { Number } The value to write.
* @param offset { Number } The offset to write the value at.
*
* @return this
*/
writeInt8(value: number, offset?: number): SmartBuffer;
/**
* Inserts an Int8 value at the given offset value.
*
* @param value { Number } The value to insert.
* @param offset { Number } The offset to insert the value at.
*
* @return this
*/
insertInt8(value: number, offset: number): SmartBuffer;
/**
* Writes an Int16BE value to the current write position (or at optional offset).
*
* @param value { Number } The value to write.
* @param offset { Number } The offset to write the value at.
*
* @return this
*/
writeInt16BE(value: number, offset?: number): SmartBuffer;
/**
* Inserts an Int16BE value at the given offset value.
*
* @param value { Number } The value to insert.
* @param offset { Number } The offset to insert the value at.
*
* @return this
*/
insertInt16BE(value: number, offset: number): SmartBuffer;
/**
* Writes an Int16LE value to the current write position (or at optional offset).
*
* @param value { Number } The value to write.
* @param offset { Number } The offset to write the value at.
*
* @return this
*/
writeInt16LE(value: number, offset?: number): SmartBuffer;
/**
* Inserts an Int16LE value at the given offset value.
*
* @param value { Number } The value to insert.
* @param offset { Number } The offset to insert the value at.
*
* @return this
*/
insertInt16LE(value: number, offset: number): SmartBuffer;
/**
* Writes an Int32BE value to the current write position (or at optional offset).
*
* @param value { Number } The value to write.
* @param offset { Number } The offset to write the value at.
*
* @return this
*/
writeInt32BE(value: number, offset?: number): SmartBuffer;
/**
* Inserts an Int32BE value at the given offset value.
*
* @param value { Number } The value to insert.
* @param offset { Number } The offset to insert the value at.
*
* @return this
*/
insertInt32BE(value: number, offset: number): SmartBuffer;
/**
* Writes an Int32LE value to the current write position (or at optional offset).
*
* @param value { Number } The value to write.
* @param offset { Number } The offset to write the value at.
*
* @return this
*/
writeInt32LE(value: number, offset?: number): SmartBuffer;
/**
* Inserts an Int32LE value at the given offset value.
*
* @param value { Number } The value to insert.
* @param offset { Number } The offset to insert the value at.
*
* @return this
*/
insertInt32LE(value: number, offset: number): SmartBuffer;
/**
* Writes a BigInt64BE value to the current write position (or at optional offset).
*
* @param value { BigInt } The value to write.
* @param offset { Number } The offset to write the value at.
*
* @return this
*/
writeBigInt64BE(value: bigint, offset?: number): SmartBuffer;
/**
* Inserts a BigInt64BE value at the given offset value.
*
* @param value { BigInt } The value to insert.
* @param offset { Number } The offset to insert the value at.
*
* @return this
*/
insertBigInt64BE(value: bigint, offset: number): SmartBuffer;
/**
* Writes a BigInt64LE value to the current write position (or at optional offset).
*
* @param value { BigInt } The value to write.
* @param offset { Number } The offset to write the value at.
*
* @return this
*/
writeBigInt64LE(value: bigint, offset?: number): SmartBuffer;
/**
* Inserts a Int64LE value at the given offset value.
*
* @param value { BigInt } The value to insert.
* @param offset { Number } The offset to insert the value at.
*
* @return this
*/
insertBigInt64LE(value: bigint, offset: number): SmartBuffer;
/**
* Reads an UInt8 value from the current read position or an optionally provided offset.
*
* @param offset { Number } The offset to read data from (optional)
* @return { Number }
*/
readUInt8(offset?: number): number;
/**
* Reads an UInt16BE value from the current read position or an optionally provided offset.
*
* @param offset { Number } The offset to read data from (optional)
* @return { Number }
*/
readUInt16BE(offset?: number): number;
/**
* Reads an UInt16LE value from the current read position or an optionally provided offset.
*
* @param offset { Number } The offset to read data from (optional)
* @return { Number }
*/
readUInt16LE(offset?: number): number;
/**
* Reads an UInt32BE value from the current read position or an optionally provided offset.
*
* @param offset { Number } The offset to read data from (optional)
* @return { Number }
*/
readUInt32BE(offset?: number): number;
/**
* Reads an UInt32LE value from the current read position or an optionally provided offset.
*
* @param offset { Number } The offset to read data from (optional)
* @return { Number }
*/
readUInt32LE(offset?: number): number;
/**
* Reads a BigUInt64BE value from the current read position or an optionally provided offset.
*
* @param offset { Number } The offset to read data from (optional)
* @return { BigInt }
*/
readBigUInt64BE(offset?: number): bigint;
/**
* Reads a BigUInt64LE value from the current read position or an optionally provided offset.
*
* @param offset { Number } The offset to read data from (optional)
* @return { BigInt }
*/
readBigUInt64LE(offset?: number): bigint;
/**
* Writes an UInt8 value to the current write position (or at optional offset).
*
* @param value { Number } The value to write.
* @param offset { Number } The offset to write the value at.
*
* @return this
*/
writeUInt8(value: number, offset?: number): SmartBuffer;
/**
* Inserts an UInt8 value at the given offset value.
*
* @param value { Number } The value to insert.
* @param offset { Number } The offset to insert the value at.
*
* @return this
*/
insertUInt8(value: number, offset: number): SmartBuffer;
/**
* Writes an UInt16BE value to the current write position (or at optional offset).
*
* @param value { Number } The value to write.
* @param offset { Number } The offset to write the value at.
*
* @return this
*/
writeUInt16BE(value: number, offset?: number): SmartBuffer;
/**
* Inserts an UInt16BE value at the given offset value.
*
* @param value { Number } The value to insert.
* @param offset { Number } The offset to insert the value at.
*
* @return this
*/
insertUInt16BE(value: number, offset: number): SmartBuffer;
/**
* Writes an UInt16LE value to the current write position (or at optional offset).
*
* @param value { Number } The value to write.
* @param offset { Number } The offset to write the value at.
*
* @return this
*/
writeUInt16LE(value: number, offset?: number): SmartBuffer;
/**
* Inserts an UInt16LE value at the given offset value.
*
* @param value { Number } The value to insert.
* @param offset { Number } The offset to insert the value at.
*
* @return this
*/
insertUInt16LE(value: number, offset: number): SmartBuffer;
/**
* Writes an UInt32BE value to the current write position (or at optional offset).
*
* @param value { Number } The value to write.
* @param offset { Number } The offset to write the value at.
*
* @return this
*/
writeUInt32BE(value: number, offset?: number): SmartBuffer;
/**
* Inserts an UInt32BE value at the given offset value.
*
* @param value { Number } The value to insert.
* @param offset { Number } The offset to insert the value at.
*
* @return this
*/
insertUInt32BE(value: number, offset: number): SmartBuffer;
/**
* Writes an UInt32LE value to the current write position (or at optional offset).
*
* @param value { Number } The value to write.
* @param offset { Number } The offset to write the value at.
*
* @return this
*/
writeUInt32LE(value: number, offset?: number): SmartBuffer;
/**
* Inserts an UInt32LE value at the given offset value.
*
* @param value { Number } The value to insert.
* @param offset { Number } The offset to insert the value at.
*
* @return this
*/
insertUInt32LE(value: number, offset: number): SmartBuffer;
/**
* Writes a BigUInt64BE value to the current write position (or at optional offset).
*
* @param value { Number } The value to write.
* @param offset { Number } The offset to write the value at.
*
* @return this
*/
writeBigUInt64BE(value: bigint, offset?: number): SmartBuffer;
/**
* Inserts a BigUInt64BE value at the given offset value.
*
* @param value { Number } The value to insert.
* @param offset { Number } The offset to insert the value at.
*
* @return this
*/
insertBigUInt64BE(value: bigint, offset: number): SmartBuffer;
/**
* Writes a BigUInt64LE value to the current write position (or at optional offset).
*
* @param value { Number } The value to write.
* @param offset { Number } The offset to write the value at.
*
* @return this
*/
writeBigUInt64LE(value: bigint, offset?: number): SmartBuffer;
/**
* Inserts a BigUInt64LE value at the given offset value.
*
* @param value { Number } The value to insert.
* @param offset { Number } The offset to insert the value at.
*
* @return this
*/
insertBigUInt64LE(value: bigint, offset: number): SmartBuffer;
/**
* Reads an FloatBE value from the current read position or an optionally provided offset.
*
* @param offset { Number } The offset to read data from (optional)
* @return { Number }
*/
readFloatBE(offset?: number): number;
/**
* Reads an FloatLE value from the current read position or an optionally provided offset.
*
* @param offset { Number } The offset to read data from (optional)
* @return { Number }
*/
readFloatLE(offset?: number): number;
/**
* Writes a FloatBE value to the current write position (or at optional offset).
*
* @param value { Number } The value to write.
* @param offset { Number } The offset to write the value at.
*
* @return this
*/
writeFloatBE(value: number, offset?: number): SmartBuffer;
/**
* Inserts a FloatBE value at the given offset value.
*
* @param value { Number } The value to insert.
* @param offset { Number } The offset to insert the value at.
*
* @return this
*/
insertFloatBE(value: number, offset: number): SmartBuffer;
/**
* Writes a FloatLE value to the current write position (or at optional offset).
*
* @param value { Number } The value to write.
* @param offset { Number } The offset to write the value at.
*
* @return this
*/
writeFloatLE(value: number, offset?: number): SmartBuffer;
/**
* Inserts a FloatLE value at the given offset value.
*
* @param value { Number } The value to insert.
* @param offset { Number } The offset to insert the value at.
*
* @return this
*/
insertFloatLE(value: number, offset: number): SmartBuffer;
/**
* Reads an DoublEBE value from the current read position or an optionally provided offset.
*
* @param offset { Number } The offset to read data from (optional)
* @return { Number }
*/
readDoubleBE(offset?: number): number;
/**
* Reads an DoubleLE value from the current read position or an optionally provided offset.
*
* @param offset { Number } The offset to read data from (optional)
* @return { Number }
*/
readDoubleLE(offset?: number): number;
/**
* Writes a DoubleBE value to the current write position (or at optional offset).
*
* @param value { Number } The value to write.
* @param offset { Number } The offset to write the value at.
*
* @return this
*/
writeDoubleBE(value: number, offset?: number): SmartBuffer;
/**
* Inserts a DoubleBE value at the given offset value.
*
* @param value { Number } The value to insert.
* @param offset { Number } The offset to insert the value at.
*
* @return this
*/
insertDoubleBE(value: number, offset: number): SmartBuffer;
/**
* Writes a DoubleLE value to the current write position (or at optional offset).
*
* @param value { Number } The value to write.
* @param offset { Number } The offset to write the value at.
*
* @return this
*/
writeDoubleLE(value: number, offset?: number): SmartBuffer;
/**
* Inserts a DoubleLE value at the given offset value.
*
* @param value { Number } The value to insert.
* @param offset { Number } The offset to insert the value at.
*
* @return this
*/
insertDoubleLE(value: number, offset: number): SmartBuffer;
/**
* Reads a String from the current read position.
*
* @param arg1 { Number | String } The number of bytes to read as a String, or the BufferEncoding to use for
* the string (Defaults to instance level encoding).
* @param encoding { String } The BufferEncoding to use for the string (Defaults to instance level encoding).
*
* @return { String }
*/
readString(arg1?: number | BufferEncoding, encoding?: BufferEncoding): string;
/**
* Inserts a String
*
* @param value { String } The String value to insert.
* @param offset { Number } The offset to insert the string at.
* @param encoding { String } The BufferEncoding to use for writing strings (defaults to instance encoding).
*
* @return this
*/
insertString(value: string, offset: number, encoding?: BufferEncoding): SmartBuffer;
/**
* Writes a String
*
* @param value { String } The String value to write.
* @param arg2 { Number | String } The offset to write the string at, or the BufferEncoding to use.
* @param encoding { String } The BufferEncoding to use for writing strings (defaults to instance encoding).
*
* @return this
*/
writeString(value: string, arg2?: number | BufferEncoding, encoding?: BufferEncoding): SmartBuffer;
/**
* Reads a null-terminated String from the current read position.
*
* @param encoding { String } The BufferEncoding to use for the string (Defaults to instance level encoding).
*
* @return { String }
*/
readStringNT(encoding?: BufferEncoding): string;
/**
* Inserts a null-terminated String.
*
* @param value { String } The String value to write.
* @param arg2 { Number | String } The offset to write the string to, or the BufferEncoding to use.
* @param encoding { String } The BufferEncoding to use for writing strings (defaults to instance encoding).
*
* @return this
*/
insertStringNT(value: string, offset: number, encoding?: BufferEncoding): SmartBuffer;
/**
* Writes a null-terminated String.
*
* @param value { String } The String value to write.
* @param arg2 { Number | String } The offset to write the string to, or the BufferEncoding to use.
* @param encoding { String } The BufferEncoding to use for writing strings (defaults to instance encoding).
*
* @return this
*/
writeStringNT(value: string, arg2?: number | BufferEncoding, encoding?: BufferEncoding): SmartBuffer;
/**
* Reads a Buffer from the internal read position.
*
* @param length { Number } The length of data to read as a Buffer.
*
* @return { Buffer }
*/
readBuffer(length?: number): Buffer;
/**
* Writes a Buffer to the current write position.
*
* @param value { Buffer } The Buffer to write.
* @param offset { Number } The offset to write the Buffer to.
*
* @return this
*/
insertBuffer(value: Buffer, offset: number): SmartBuffer;
/**
* Writes a Buffer to the current write position.
*
* @param value { Buffer } The Buffer to write.
* @param offset { Number } The offset to write the Buffer to.
*
* @return this
*/
writeBuffer(value: Buffer, offset?: number): SmartBuffer;
/**
* Reads a null-terminated Buffer from the current read poisiton.
*
* @return { Buffer }
*/
readBufferNT(): Buffer;
/**
* Inserts a null-terminated Buffer.
*
* @param value { Buffer } The Buffer to write.
* @param offset { Number } The offset to write the Buffer to.
*
* @return this
*/
insertBufferNT(value: Buffer, offset: number): SmartBuffer;
/**
* Writes a null-terminated Buffer.
*
* @param value { Buffer } The Buffer to write.
* @param offset { Number } The offset to write the Buffer to.
*
* @return this
*/
writeBufferNT(value: Buffer, offset?: number): SmartBuffer;
/**
* Clears the SmartBuffer instance to its original empty state.
*/
clear(): SmartBuffer;
/**
* Gets the remaining data left to be read from the SmartBuffer instance.
*
* @return { Number }
*/
remaining(): number;
/**
* Gets the current read offset value of the SmartBuffer instance.
*
* @return { Number }
*/
/**
* Sets the read offset value of the SmartBuffer instance.
*
* @param offset { Number } - The offset value to set.
*/
readOffset: number;
/**
* Gets the current write offset value of the SmartBuffer instance.
*
* @return { Number }
*/
/**
* Sets the write offset value of the SmartBuffer instance.
*
* @param offset { Number } - The offset value to set.
*/
writeOffset: number;
/**
* Gets the currently set string encoding of the SmartBuffer instance.
*
* @return { BufferEncoding } The string Buffer encoding currently set.
*/
/**
* Sets the string encoding of the SmartBuffer instance.
*
* @param encoding { BufferEncoding } The string Buffer encoding to set.
*/
encoding: BufferEncoding;
/**
* Gets the underlying internal Buffer. (This includes unmanaged data in the Buffer)
*
* @return { Buffer } The Buffer value.
*/
readonly internalBuffer: Buffer;
/**
* Gets the value of the internal managed Buffer (Includes managed data only)
*
* @param { Buffer }
*/
toBuffer(): Buffer;
/**
* Gets the String value of the internal managed Buffer
*
* @param encoding { String } The BufferEncoding to display the Buffer as (defaults to instance level encoding).
*/
toString(encoding?: BufferEncoding): string;
/**
* Destroys the SmartBuffer instance.
*/
destroy(): SmartBuffer;
/**
* Handles inserting and writing strings.
*
* @param value { String } The String value to insert.
* @param isInsert { Boolean } True if inserting a string, false if writing.
* @param arg2 { Number | String } The offset to insert the string at, or the BufferEncoding to use.
* @param encoding { String } The BufferEncoding to use for writing strings (defaults to instance encoding).
*/
private _handleString;
/**
* Handles writing or insert of a Buffer.
*
* @param value { Buffer } The Buffer to write.
* @param offset { Number } The offset to write the Buffer to.
*/
private _handleBuffer;
/**
* Ensures that the internal Buffer is large enough to read data.
*
* @param length { Number } The length of the data that needs to be read.
* @param offset { Number } The offset of the data that needs to be read.
*/
private ensureReadable;
/**
* Ensures that the internal Buffer is large enough to insert data.
*
* @param dataLength { Number } The length of the data that needs to be written.
* @param offset { Number } The offset of the data to be written.
*/
private ensureInsertable;
/**
* Ensures that the internal Buffer is large enough to write data.
*
* @param dataLength { Number } The length of the data that needs to be written.
* @param offset { Number } The offset of the data to be written (defaults to writeOffset).
*/
private _ensureWriteable;
/**
* Ensures that the internal Buffer is large enough to write at least the given amount of data.
*
* @param minLength { Number } The minimum length of the data needs to be written.
*/
private _ensureCapacity;
/**
* Reads a numeric number value using the provided function.
*
* @typeparam T { number | bigint } The type of the value to be read
*
* @param func { Function(offset: number) => number } The function to read data on the internal Buffer with.
* @param byteSize { Number } The number of bytes read.
* @param offset { Number } The offset to read from (optional). When this is not provided, the managed readOffset is used instead.
*
* @returns { T } the number value
*/
private _readNumberValue;
/**
* Inserts a numeric number value based on the given offset and value.
*
* @typeparam T { number | bigint } The type of the value to be written
*
* @param func { Function(offset: T, offset?) => number} The function to write data on the internal Buffer with.
* @param byteSize { Number } The number of bytes written.
* @param value { T } The number value to write.
* @param offset { Number } the offset to write the number at (REQUIRED).
*
* @returns SmartBuffer this buffer
*/
private _insertNumberValue;
/**
* Writes a numeric number value based on the given offset and value.
*
* @typeparam T { number | bigint } The type of the value to be written
*
* @param func { Function(offset: T, offset?) => number} The function to write data on the internal Buffer with.
* @param byteSize { Number } The number of bytes written.
* @param value { T } The number value to write.
* @param offset { Number } the offset to write the number at (REQUIRED).
*
* @returns SmartBuffer this buffer
*/
private _writeNumberValue;
}
export { SmartBufferOptions, SmartBuffer };
@@ -0,0 +1,2 @@
declare function useLockFn<P extends any[] = any[], V = any>(fn: (...args: P) => Promise<V>): (...args: P) => Promise<V | undefined>;
export default useLockFn;
@@ -0,0 +1,88 @@
import { PluginFunc } from 'dayjs/esm'
import { OpUnitType, UnitTypeLongPlural } from 'dayjs/esm';
declare const plugin: PluginFunc
export as namespace plugin;
export = plugin
declare namespace plugin {
/**
* @deprecated Please use more strict types
*/
type DurationInputType = string | number | object
/**
* @deprecated Please use more strict types
*/
type DurationAddType = number | object | Duration
type DurationUnitsObjectType = Partial<{
[unit in Exclude<UnitTypeLongPlural, "dates"> | "weeks"]: number
}>;
type DurationUnitType = Exclude<OpUnitType, "date" | "dates">
type CreateDurationType =
((units: DurationUnitsObjectType) => Duration)
& ((time: number, unit?: DurationUnitType) => Duration)
& ((ISO_8601: string) => Duration)
type AddDurationType = CreateDurationType & ((duration: Duration) => Duration)
interface Duration {
new (input: string | number | object, unit?: string, locale?: string): Duration
clone(): Duration
humanize(withSuffix?: boolean): string
milliseconds(): number
asMilliseconds(): number
seconds(): number
asSeconds(): number
minutes(): number
asMinutes(): number
hours(): number
asHours(): number
days(): number
asDays(): number
weeks(): number
asWeeks(): number
months(): number
asMonths(): number
years(): number
asYears(): number
as(unit: DurationUnitType): number
get(unit: DurationUnitType): number
add: AddDurationType
subtract: AddDurationType
toJSON(): string
toISOString(): string
format(formatStr?: string): string
locale(locale: string): Duration
}
}
declare module 'dayjs/esm' {
interface Dayjs {
add(duration: plugin.Duration): Dayjs
subtract(duration: plugin.Duration): Dayjs
}
/**
* @param time If unit is not present, time treated as number of milliseconds
*/
export const duration: plugin.CreateDurationType;
export function isDuration(d: any): d is plugin.Duration
}
@@ -0,0 +1,6 @@
'use strict';
// @ts-ignore
require('core-js');
require('./');
@@ -0,0 +1,42 @@
// src/bold/align-top.tsx
import { jsx, jsxs } from "react/jsx-runtime";
var AlignTopBoldIcon = (props) => /* @__PURE__ */ jsxs(
"svg",
{
"aria-hidden": "true",
fill: "none",
focusable: "false",
height: "1em",
role: "presentation",
viewBox: "0 0 24 24",
width: "1em",
...props,
children: [
/* @__PURE__ */ jsx(
"path",
{
d: "M15.98 19.3789H17.02C18.61 19.3789 19.25 18.7789 19.25 17.2589V5.37891H13.75V17.2589C13.76 18.7789 14.4 19.3789 15.98 19.3789Z",
fill: "currentColor"
}
),
/* @__PURE__ */ jsx(
"path",
{
d: "M7.48 14.3789H8.52C10.11 14.3789 10.75 13.7689 10.75 12.2589V5.37891H5.25V12.2589C5.26 13.7689 5.9 14.3789 7.48 14.3789Z",
fill: "currentColor"
}
),
/* @__PURE__ */ jsx(
"path",
{
d: "M21.25 6.11891H2.75C2.34 6.11891 2 5.78891 2 5.37891C2 4.96891 2.34 4.62891 2.75 4.62891H21.25C21.66 4.62891 22 4.96891 22 5.37891C22 5.78891 21.66 6.11891 21.25 6.11891Z",
fill: "currentColor"
}
)
]
}
);
export {
AlignTopBoldIcon
};
@@ -0,0 +1,125 @@
"use client";
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/use-chip.ts
var use_chip_exports = {};
__export(use_chip_exports, {
useChip: () => useChip
});
module.exports = __toCommonJS(use_chip_exports);
var import_system = require("@heroui/system");
var import_utils = require("@react-aria/utils");
var import_interactions = require("@react-aria/interactions");
var import_focus = require("@react-aria/focus");
var import_theme = require("@heroui/theme");
var import_react_utils = require("@heroui/react-utils");
var import_shared_utils = require("@heroui/shared-utils");
var import_react = require("react");
function useChip(originalProps) {
const [props, variantProps] = (0, import_system.mapPropsVariants)(originalProps, import_theme.chip.variantKeys);
const {
ref,
as,
children,
avatar,
startContent,
endContent,
onClose,
classNames,
className,
...otherProps
} = props;
const Component = as || "div";
const domRef = (0, import_react_utils.useDOMRef)(ref);
const baseStyles = (0, import_shared_utils.clsx)(classNames == null ? void 0 : classNames.base, className);
const isCloseable = !!onClose;
const isDotVariant = originalProps.variant === "dot";
const { focusProps: closeFocusProps, isFocusVisible: isCloseButtonFocusVisible } = (0, import_focus.useFocusRing)();
const isOneChar = (0, import_react.useMemo)(
() => typeof children === "string" && (children == null ? void 0 : children.length) === 1,
[children]
);
const hasStartContent = (0, import_react.useMemo)(() => !!avatar || !!startContent, [avatar, startContent]);
const hasEndContent = (0, import_react.useMemo)(() => !!endContent || isCloseable, [endContent, isCloseable]);
const slots = (0, import_react.useMemo)(
() => (0, import_theme.chip)({
...variantProps,
hasStartContent,
hasEndContent,
isOneChar,
isCloseable,
isCloseButtonFocusVisible
}),
[
(0, import_shared_utils.objectToDeps)(variantProps),
isCloseButtonFocusVisible,
hasStartContent,
hasEndContent,
isOneChar,
isCloseable
]
);
const { pressProps: closePressProps } = (0, import_interactions.usePress)({
isDisabled: !!(originalProps == null ? void 0 : originalProps.isDisabled),
onPress: onClose
});
const getChipProps = () => {
return {
ref: domRef,
className: slots.base({ class: baseStyles }),
...otherProps
};
};
const getCloseButtonProps = () => {
return {
role: "button",
tabIndex: 0,
className: slots.closeButton({ class: classNames == null ? void 0 : classNames.closeButton }),
"aria-label": "close chip",
...(0, import_utils.mergeProps)(closePressProps, closeFocusProps)
};
};
const getAvatarClone = (avatar2) => {
if (!(0, import_react.isValidElement)(avatar2))
return null;
return (0, import_react.cloneElement)(avatar2, {
className: slots.avatar({ class: classNames == null ? void 0 : classNames.avatar })
});
};
const getContentClone = (content) => (0, import_react.isValidElement)(content) ? (0, import_react.cloneElement)(content, {
className: (0, import_shared_utils.clsx)("max-h-[80%]", content.props.className)
}) : null;
return {
Component,
children,
slots,
classNames,
isDot: isDotVariant,
isCloseable,
startContent: getAvatarClone(avatar) || getContentClone(startContent),
endContent: getContentClone(endContent),
getCloseButtonProps,
getChipProps
};
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
useChip
});
@@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.updateMaybeClassMetadataProperty = updateMaybeClassMetadataProperty;
function updateMaybeClassMetadataProperty(updateMetadata, propertyKey) {
return (classMetadata) => {
const propertyMetadata = classMetadata.properties.get(propertyKey);
classMetadata.properties.set(propertyKey, updateMetadata(propertyMetadata));
return classMetadata;
};
}
//# sourceMappingURL=updateMaybeClassMetadataProperty.js.map
@@ -0,0 +1,184 @@
import _typeof from "./typeof.js";
function applyDecs2203Factory() {
function createAddInitializerMethod(e, t) {
return function (r) {
!function (e) {
if (e.v) throw Error("attempted to call addInitializer after decoration was finished");
}(t), assertCallable(r, "An initializer"), e.push(r);
};
}
function memberDec(e, t, r, a, n, i, s, o) {
var c;
switch (n) {
case 1:
c = "accessor";
break;
case 2:
c = "method";
break;
case 3:
c = "getter";
break;
case 4:
c = "setter";
break;
default:
c = "field";
}
var l,
u,
f = {
kind: c,
name: s ? "#" + t : t,
"static": i,
"private": s
},
p = {
v: !1
};
0 !== n && (f.addInitializer = createAddInitializerMethod(a, p)), 0 === n ? s ? (l = r.get, u = r.set) : (l = function l() {
return this[t];
}, u = function u(e) {
this[t] = e;
}) : 2 === n ? l = function l() {
return r.value;
} : (1 !== n && 3 !== n || (l = function l() {
return r.get.call(this);
}), 1 !== n && 4 !== n || (u = function u(e) {
r.set.call(this, e);
})), f.access = l && u ? {
get: l,
set: u
} : l ? {
get: l
} : {
set: u
};
try {
return e(o, f);
} finally {
p.v = !0;
}
}
function assertCallable(e, t) {
if ("function" != typeof e) throw new TypeError(t + " must be a function");
}
function assertValidReturnValue(e, t) {
var r = _typeof(t);
if (1 === e) {
if ("object" !== r || null === t) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
void 0 !== t.get && assertCallable(t.get, "accessor.get"), void 0 !== t.set && assertCallable(t.set, "accessor.set"), void 0 !== t.init && assertCallable(t.init, "accessor.init");
} else if ("function" !== r) throw new TypeError((0 === e ? "field" : 10 === e ? "class" : "method") + " decorators must return a function or void 0");
}
function applyMemberDec(e, t, r, a, n, i, s, o) {
var c,
l,
u,
f,
p,
d,
h = r[0];
if (s ? c = 0 === n || 1 === n ? {
get: r[3],
set: r[4]
} : 3 === n ? {
get: r[3]
} : 4 === n ? {
set: r[3]
} : {
value: r[3]
} : 0 !== n && (c = Object.getOwnPropertyDescriptor(t, a)), 1 === n ? u = {
get: c.get,
set: c.set
} : 2 === n ? u = c.value : 3 === n ? u = c.get : 4 === n && (u = c.set), "function" == typeof h) void 0 !== (f = memberDec(h, a, c, o, n, i, s, u)) && (assertValidReturnValue(n, f), 0 === n ? l = f : 1 === n ? (l = f.init, p = f.get || u.get, d = f.set || u.set, u = {
get: p,
set: d
}) : u = f);else for (var v = h.length - 1; v >= 0; v--) {
var g;
void 0 !== (f = memberDec(h[v], a, c, o, n, i, s, u)) && (assertValidReturnValue(n, f), 0 === n ? g = f : 1 === n ? (g = f.init, p = f.get || u.get, d = f.set || u.set, u = {
get: p,
set: d
}) : u = f, void 0 !== g && (void 0 === l ? l = g : "function" == typeof l ? l = [l, g] : l.push(g)));
}
if (0 === n || 1 === n) {
if (void 0 === l) l = function l(e, t) {
return t;
};else if ("function" != typeof l) {
var y = l;
l = function l(e, t) {
for (var r = t, a = 0; a < y.length; a++) r = y[a].call(e, r);
return r;
};
} else {
var m = l;
l = function l(e, t) {
return m.call(e, t);
};
}
e.push(l);
}
0 !== n && (1 === n ? (c.get = u.get, c.set = u.set) : 2 === n ? c.value = u : 3 === n ? c.get = u : 4 === n && (c.set = u), s ? 1 === n ? (e.push(function (e, t) {
return u.get.call(e, t);
}), e.push(function (e, t) {
return u.set.call(e, t);
})) : 2 === n ? e.push(u) : e.push(function (e, t) {
return u.call(e, t);
}) : Object.defineProperty(t, a, c));
}
function pushInitializers(e, t) {
t && e.push(function (e) {
for (var r = 0; r < t.length; r++) t[r].call(e);
return e;
});
}
return function (e, t, r) {
var a = [];
return function (e, t, r) {
for (var a, n, i = new Map(), s = new Map(), o = 0; o < r.length; o++) {
var c = r[o];
if (Array.isArray(c)) {
var l,
u,
f = c[1],
p = c[2],
d = c.length > 3,
h = f >= 5;
if (h ? (l = t, 0 != (f -= 5) && (u = n = n || [])) : (l = t.prototype, 0 !== f && (u = a = a || [])), 0 !== f && !d) {
var v = h ? s : i,
g = v.get(p) || 0;
if (!0 === g || 3 === g && 4 !== f || 4 === g && 3 !== f) throw Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + p);
!g && f > 2 ? v.set(p, f) : v.set(p, !0);
}
applyMemberDec(e, l, c, p, f, h, d, u);
}
}
pushInitializers(e, a), pushInitializers(e, n);
}(a, e, t), function (e, t, r) {
if (r.length > 0) {
for (var a = [], n = t, i = t.name, s = r.length - 1; s >= 0; s--) {
var o = {
v: !1
};
try {
var c = r[s](n, {
kind: "class",
name: i,
addInitializer: createAddInitializerMethod(a, o)
});
} finally {
o.v = !0;
}
void 0 !== c && (assertValidReturnValue(10, c), n = c);
}
e.push(n, function () {
for (var e = 0; e < a.length; e++) a[e].call(n);
});
}
}(a, e, r), a;
};
}
var applyDecs2203Impl;
function applyDecs2203(e, t, r) {
return (applyDecs2203Impl = applyDecs2203Impl || applyDecs2203Factory())(e, t, r);
}
export { applyDecs2203 as default };
@@ -0,0 +1,18 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./unsafe"), exports);
@@ -0,0 +1,54 @@
'use strict'
const fs = require('graceful-fs')
const path = require('path')
const copySync = require('../copy').copySync
const removeSync = require('../remove').removeSync
const mkdirpSync = require('../mkdirs').mkdirpSync
const stat = require('../util/stat')
function moveSync (src, dest, opts) {
opts = opts || {}
const overwrite = opts.overwrite || opts.clobber || false
const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, 'move', opts)
stat.checkParentPathsSync(src, srcStat, dest, 'move')
if (!isParentRoot(dest)) mkdirpSync(path.dirname(dest))
return doRename(src, dest, overwrite, isChangingCase)
}
function isParentRoot (dest) {
const parent = path.dirname(dest)
const parsedPath = path.parse(parent)
return parsedPath.root === parent
}
function doRename (src, dest, overwrite, isChangingCase) {
if (isChangingCase) return rename(src, dest, overwrite)
if (overwrite) {
removeSync(dest)
return rename(src, dest, overwrite)
}
if (fs.existsSync(dest)) throw new Error('dest already exists.')
return rename(src, dest, overwrite)
}
function rename (src, dest, overwrite) {
try {
fs.renameSync(src, dest)
} catch (err) {
if (err.code !== 'EXDEV') throw err
return moveAcrossDevice(src, dest, overwrite)
}
}
function moveAcrossDevice (src, dest, overwrite) {
const opts = {
overwrite,
errorOnExist: true
}
copySync(src, dest, opts)
return removeSync(src)
}
module.exports = moveSync
@@ -0,0 +1,32 @@
import copyObject from './_copyObject.js';
import keysIn from './keysIn.js';
/**
* Converts `value` to a plain object flattening inherited enumerable string
* keyed properties of `value` to own properties of the plain object.
*
* @static
* @memberOf _
* @since 3.0.0
* @category Lang
* @param {*} value The value to convert.
* @returns {Object} Returns the converted plain object.
* @example
*
* function Foo() {
* this.b = 2;
* }
*
* Foo.prototype.c = 3;
*
* _.assign({ 'a': 1 }, new Foo);
* // => { 'a': 1, 'b': 2 }
*
* _.assign({ 'a': 1 }, _.toPlainObject(new Foo));
* // => { 'a': 1, 'b': 2, 'c': 3 }
*/
function toPlainObject(value) {
return copyObject(value, keysIn(value));
}
export default toPlainObject;
@@ -0,0 +1,78 @@
/// <reference types="node" />
import net from 'net';
import http from 'http';
import https from 'https';
import { Duplex } from 'stream';
import { EventEmitter } from 'events';
declare function createAgent(opts?: createAgent.AgentOptions): createAgent.Agent;
declare function createAgent(callback: createAgent.AgentCallback, opts?: createAgent.AgentOptions): createAgent.Agent;
declare namespace createAgent {
interface ClientRequest extends http.ClientRequest {
_last?: boolean;
_hadError?: boolean;
method: string;
}
interface AgentRequestOptions {
host?: string;
path?: string;
port: number;
}
interface HttpRequestOptions extends AgentRequestOptions, Omit<http.RequestOptions, keyof AgentRequestOptions> {
secureEndpoint: false;
}
interface HttpsRequestOptions extends AgentRequestOptions, Omit<https.RequestOptions, keyof AgentRequestOptions> {
secureEndpoint: true;
}
type RequestOptions = HttpRequestOptions | HttpsRequestOptions;
type AgentLike = Pick<createAgent.Agent, 'addRequest'> | http.Agent;
type AgentCallbackReturn = Duplex | AgentLike;
type AgentCallbackCallback = (err?: Error | null, socket?: createAgent.AgentCallbackReturn) => void;
type AgentCallbackPromise = (req: createAgent.ClientRequest, opts: createAgent.RequestOptions) => createAgent.AgentCallbackReturn | Promise<createAgent.AgentCallbackReturn>;
type AgentCallback = typeof Agent.prototype.callback;
type AgentOptions = {
timeout?: number;
};
/**
* Base `http.Agent` implementation.
* No pooling/keep-alive is implemented by default.
*
* @param {Function} callback
* @api public
*/
class Agent extends EventEmitter {
timeout: number | null;
maxFreeSockets: number;
maxTotalSockets: number;
maxSockets: number;
sockets: {
[key: string]: net.Socket[];
};
freeSockets: {
[key: string]: net.Socket[];
};
requests: {
[key: string]: http.IncomingMessage[];
};
options: https.AgentOptions;
private promisifiedCallback?;
private explicitDefaultPort?;
private explicitProtocol?;
constructor(callback?: createAgent.AgentCallback | createAgent.AgentOptions, _opts?: createAgent.AgentOptions);
get defaultPort(): number;
set defaultPort(v: number);
get protocol(): string;
set protocol(v: string);
callback(req: createAgent.ClientRequest, opts: createAgent.RequestOptions, fn: createAgent.AgentCallbackCallback): void;
callback(req: createAgent.ClientRequest, opts: createAgent.RequestOptions): createAgent.AgentCallbackReturn | Promise<createAgent.AgentCallbackReturn>;
/**
* Called by node-core's "_http_client.js" module when creating
* a new HTTP request with this Agent instance.
*
* @api public
*/
addRequest(req: ClientRequest, _opts: RequestOptions): void;
freeSocket(socket: net.Socket, opts: AgentOptions): void;
destroy(): void;
}
}
export = createAgent;
@@ -0,0 +1,65 @@
# @gar/promisify
### Promisify an entire object or class instance
This module leverages es6 Proxy and Reflect to promisify every function in an
object or class instance.
It assumes the callback that the function is expecting is the last
parameter, and that it is an error-first callback with only one value,
i.e. `(err, value) => ...`. This mirrors node's `util.promisify` method.
In order that you can use it as a one-stop-shop for all your promisify
needs, you can also pass it a function. That function will be
promisified as normal using node's built-in `util.promisify` method.
[node's custom promisified
functions](https://nodejs.org/api/util.html#util_custom_promisified_functions)
will also be mirrored, further allowing this to be a drop-in replacement
for the built-in `util.promisify`.
### Examples
Promisify an entire object
```javascript
const promisify = require('@gar/promisify')
class Foo {
constructor (attr) {
this.attr = attr
}
double (input, cb) {
cb(null, input * 2)
}
const foo = new Foo('baz')
const promisified = promisify(foo)
console.log(promisified.attr)
console.log(await promisified.double(1024))
```
Promisify a function
```javascript
const promisify = require('@gar/promisify')
function foo (a, cb) {
if (a !== 'bad') {
return cb(null, 'ok')
}
return cb('not ok')
}
const promisified = promisify(foo)
// This will resolve to 'ok'
promisified('good')
// this will reject
promisified('bad')
```
@@ -0,0 +1,586 @@
/**
* @license React
* react-refresh-babel.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
"use strict";
module.exports = function (babel) {
function createRegistration(programPath, persistentID) {
var handle = programPath.scope.generateUidIdentifier("c");
registrationsByProgramPath.has(programPath) ||
registrationsByProgramPath.set(programPath, []);
registrationsByProgramPath
.get(programPath)
.push({ handle: handle, persistentID: persistentID });
return handle;
}
function isComponentishName(name) {
return "string" === typeof name && "A" <= name[0] && "Z" >= name[0];
}
function findInnerComponents(inferredName, path, callback) {
var node = path.node;
switch (node.type) {
case "Identifier":
if (!isComponentishName(node.name)) break;
callback(inferredName, node, null);
return !0;
case "FunctionDeclaration":
return callback(inferredName, node.id, null), !0;
case "ArrowFunctionExpression":
if ("ArrowFunctionExpression" === node.body.type) break;
callback(inferredName, node, path);
return !0;
case "FunctionExpression":
return callback(inferredName, node, path), !0;
case "CallExpression":
var argsPath = path.get("arguments");
if (void 0 === argsPath || 0 === argsPath.length) break;
var calleePath = path.get("callee");
switch (calleePath.node.type) {
case "MemberExpression":
case "Identifier":
calleePath = calleePath.getSource();
if (
!findInnerComponents(
inferredName + "$" + calleePath,
argsPath[0],
callback
)
)
return !1;
callback(inferredName, node, path);
return !0;
default:
return !1;
}
case "VariableDeclarator":
if (
((argsPath = node.init),
null !== argsPath &&
((calleePath = node.id.name), isComponentishName(calleePath)))
) {
switch (argsPath.type) {
case "ArrowFunctionExpression":
case "FunctionExpression":
break;
case "CallExpression":
node = argsPath.callee;
var calleeType = node.type;
if (
"Import" === calleeType ||
("Identifier" === calleeType &&
(0 === node.name.indexOf("require") ||
0 === node.name.indexOf("import")))
)
return !1;
break;
case "TaggedTemplateExpression":
break;
default:
return !1;
}
node = path.get("init");
if (findInnerComponents(inferredName, node, callback)) return !0;
calleePath = path.scope.getBinding(calleePath);
if (void 0 === calleePath) return;
path = !1;
calleePath = calleePath.referencePaths;
for (calleeType = 0; calleeType < calleePath.length; calleeType++) {
var ref = calleePath[calleeType];
if (
!ref.node ||
"JSXIdentifier" === ref.node.type ||
"Identifier" === ref.node.type
) {
ref = ref.parent;
if ("JSXOpeningElement" === ref.type) path = !0;
else if ("CallExpression" === ref.type) {
ref = ref.callee;
var fnName = void 0;
switch (ref.type) {
case "Identifier":
fnName = ref.name;
break;
case "MemberExpression":
fnName = ref.property.name;
}
switch (fnName) {
case "createElement":
case "jsx":
case "jsxDEV":
case "jsxs":
path = !0;
}
}
if (path) return callback(inferredName, argsPath, node), !0;
}
}
}
}
return !1;
}
function getHookCallsSignature(functionNode) {
functionNode = hookCalls.get(functionNode);
return void 0 === functionNode
? null
: {
key: functionNode
.map(function (call) {
return call.name + "{" + call.key + "}";
})
.join("\n"),
customHooks: functionNode
.filter(function (call) {
a: switch (call.name) {
case "useState":
case "React.useState":
case "useReducer":
case "React.useReducer":
case "useEffect":
case "React.useEffect":
case "useLayoutEffect":
case "React.useLayoutEffect":
case "useMemo":
case "React.useMemo":
case "useCallback":
case "React.useCallback":
case "useRef":
case "React.useRef":
case "useContext":
case "React.useContext":
case "useImperativeHandle":
case "React.useImperativeHandle":
case "useDebugValue":
case "React.useDebugValue":
case "useId":
case "React.useId":
case "useDeferredValue":
case "React.useDeferredValue":
case "useTransition":
case "React.useTransition":
case "useInsertionEffect":
case "React.useInsertionEffect":
case "useSyncExternalStore":
case "React.useSyncExternalStore":
case "useFormStatus":
case "React.useFormStatus":
case "useFormState":
case "React.useFormState":
case "useActionState":
case "React.useActionState":
case "useOptimistic":
case "React.useOptimistic":
call = !0;
break a;
default:
call = !1;
}
return !call;
})
.map(function (call) {
return t.cloneDeep(call.callee);
})
};
}
function hasForceResetComment(path) {
path = path.hub.file;
var hasForceReset = hasForceResetCommentByFile.get(path);
if (void 0 !== hasForceReset) return hasForceReset;
hasForceReset = !1;
for (var comments = path.ast.comments, i = 0; i < comments.length; i++)
if (-1 !== comments[i].value.indexOf("@refresh reset")) {
hasForceReset = !0;
break;
}
hasForceResetCommentByFile.set(path, hasForceReset);
return hasForceReset;
}
function createArgumentsForSignature(node, signature, scope) {
var key = signature.key;
signature = signature.customHooks;
var forceReset = hasForceResetComment(scope.path),
customHooksInScope = [];
signature.forEach(function (callee) {
switch (callee.type) {
case "MemberExpression":
if ("Identifier" === callee.object.type)
var bindingName = callee.object.name;
break;
case "Identifier":
bindingName = callee.name;
}
scope.hasBinding(bindingName)
? customHooksInScope.push(callee)
: (forceReset = !0);
});
signature = key;
"function" !== typeof require ||
opts.emitFullSignatures ||
(signature = require("crypto")
.createHash("sha1")
.update(key)
.digest("base64"));
node = [node, t.stringLiteral(signature)];
(forceReset || 0 < customHooksInScope.length) &&
node.push(t.booleanLiteral(forceReset));
0 < customHooksInScope.length &&
node.push(
t.functionExpression(
null,
[],
t.blockStatement([
t.returnStatement(t.arrayExpression(customHooksInScope))
])
)
);
return node;
}
function findHOCCallPathsAbove(path) {
for (var calls = []; ; ) {
if (!path) return calls;
var parentPath = path.parentPath;
if (!parentPath) return calls;
if (
"AssignmentExpression" === parentPath.node.type &&
path.node === parentPath.node.right
)
path = parentPath;
else if (
"CallExpression" === parentPath.node.type &&
path.node !== parentPath.node.callee
)
calls.push(parentPath), (path = parentPath);
else return calls;
}
}
var opts =
1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {};
if ("function" === typeof babel.env) {
var env = babel.env();
if ("development" !== env && !opts.skipEnvCheck)
throw Error(
'React Refresh Babel transform should only be enabled in development environment. Instead, the environment is: "' +
env +
'". If you want to override this check, pass {skipEnvCheck: true} as plugin options.'
);
}
var t = babel.types,
refreshReg = t.identifier(opts.refreshReg || "$RefreshReg$"),
refreshSig = t.identifier(opts.refreshSig || "$RefreshSig$"),
registrationsByProgramPath = new Map(),
hasForceResetCommentByFile = new WeakMap(),
seenForRegistration = new WeakSet(),
seenForSignature = new WeakSet(),
seenForOutro = new WeakSet(),
hookCalls = new WeakMap(),
HookCallsVisitor = {
CallExpression: function (path) {
var callee = path.node.callee,
name = null;
switch (callee.type) {
case "Identifier":
name = callee.name;
break;
case "MemberExpression":
name = callee.property.name;
}
if (
null !== name &&
/^use[A-Z]/.test(name) &&
((callee = path.scope.getFunctionParent()), null !== callee)
) {
callee = callee.block;
hookCalls.has(callee) || hookCalls.set(callee, []);
callee = hookCalls.get(callee);
var key = "";
"VariableDeclarator" === path.parent.type &&
(key = path.parentPath.get("id").getSource());
var args = path.get("arguments");
"useState" === name && 0 < args.length
? (key += "(" + args[0].getSource() + ")")
: "useReducer" === name &&
1 < args.length &&
(key += "(" + args[1].getSource() + ")");
callee.push({ callee: path.node.callee, name: name, key: key });
}
}
};
return {
visitor: {
ExportDefaultDeclaration: function (path) {
var node = path.node,
decl = node.declaration,
declPath = path.get("declaration");
if ("CallExpression" === decl.type && !seenForRegistration.has(node)) {
seenForRegistration.add(node);
var programPath = path.parentPath;
findInnerComponents(
"%default%",
declPath,
function (persistentID, targetExpr, targetPath) {
null !== targetPath &&
((persistentID = createRegistration(programPath, persistentID)),
targetPath.replaceWith(
t.assignmentExpression("=", persistentID, targetExpr)
));
}
);
}
},
FunctionDeclaration: {
enter: function (path) {
var node = path.node,
modulePrefix = "";
switch (path.parent.type) {
case "Program":
var insertAfterPath = path;
var programPath = path.parentPath;
break;
case "TSModuleBlock":
insertAfterPath = path;
programPath = insertAfterPath.parentPath.parentPath;
break;
case "ExportNamedDeclaration":
insertAfterPath = path.parentPath;
programPath = insertAfterPath.parentPath;
break;
case "ExportDefaultDeclaration":
insertAfterPath = path.parentPath;
programPath = insertAfterPath.parentPath;
break;
default:
return;
}
if (
"TSModuleBlock" === path.parent.type ||
"ExportNamedDeclaration" === path.parent.type
)
for (; "Program" !== programPath.type; ) {
if ("TSModuleDeclaration" === programPath.type) {
if (
"Program" !== programPath.parentPath.type &&
"ExportNamedDeclaration" !== programPath.parentPath.type
)
return;
modulePrefix = programPath.node.id.name + "$" + modulePrefix;
}
programPath = programPath.parentPath;
}
var id = node.id;
null !== id &&
((id = id.name),
isComponentishName(id) &&
!seenForRegistration.has(node) &&
(seenForRegistration.add(node),
findInnerComponents(
modulePrefix + id,
path,
function (persistentID, targetExpr) {
persistentID = createRegistration(programPath, persistentID);
insertAfterPath.insertAfter(
t.expressionStatement(
t.assignmentExpression("=", persistentID, targetExpr)
)
);
}
)));
},
exit: function (path) {
var node = path.node,
id = node.id;
if (null !== id) {
var signature = getHookCallsSignature(node);
if (null !== signature && !seenForSignature.has(node)) {
seenForSignature.add(node);
node = path.scope.generateUidIdentifier("_s");
path.scope.parent.push({
id: node,
init: t.callExpression(refreshSig, [])
});
path
.get("body")
.unshiftContainer(
"body",
t.expressionStatement(t.callExpression(node, []))
);
var insertAfterPath = null;
path.find(function (p) {
if (p.parentPath.isBlock()) return (insertAfterPath = p), !0;
});
null !== insertAfterPath &&
insertAfterPath.insertAfter(
t.expressionStatement(
t.callExpression(
node,
createArgumentsForSignature(
id,
signature,
insertAfterPath.scope
)
)
)
);
}
}
}
},
"ArrowFunctionExpression|FunctionExpression": {
exit: function (path) {
var node = path.node,
signature = getHookCallsSignature(node);
if (null !== signature && !seenForSignature.has(node)) {
seenForSignature.add(node);
var sigCallID = path.scope.generateUidIdentifier("_s");
path.scope.parent.push({
id: sigCallID,
init: t.callExpression(refreshSig, [])
});
"BlockStatement" !== path.node.body.type &&
(path.node.body = t.blockStatement([
t.returnStatement(path.node.body)
]));
path
.get("body")
.unshiftContainer(
"body",
t.expressionStatement(t.callExpression(sigCallID, []))
);
if ("VariableDeclarator" === path.parent.type) {
var insertAfterPath = null;
path.find(function (p) {
if (p.parentPath.isBlock()) return (insertAfterPath = p), !0;
});
null !== insertAfterPath &&
insertAfterPath.insertAfter(
t.expressionStatement(
t.callExpression(
sigCallID,
createArgumentsForSignature(
path.parent.id,
signature,
insertAfterPath.scope
)
)
)
);
} else
[path].concat(findHOCCallPathsAbove(path)).forEach(function (p) {
p.replaceWith(
t.callExpression(
sigCallID,
createArgumentsForSignature(p.node, signature, p.scope)
)
);
});
}
}
},
VariableDeclaration: function (path) {
var node = path.node,
modulePrefix = "";
switch (path.parent.type) {
case "Program":
var insertAfterPath = path;
var programPath = path.parentPath;
break;
case "TSModuleBlock":
insertAfterPath = path;
programPath = insertAfterPath.parentPath.parentPath;
break;
case "ExportNamedDeclaration":
insertAfterPath = path.parentPath;
programPath = insertAfterPath.parentPath;
break;
case "ExportDefaultDeclaration":
insertAfterPath = path.parentPath;
programPath = insertAfterPath.parentPath;
break;
default:
return;
}
if (
"TSModuleBlock" === path.parent.type ||
"ExportNamedDeclaration" === path.parent.type
)
for (; "Program" !== programPath.type; ) {
if ("TSModuleDeclaration" === programPath.type) {
if (
"Program" !== programPath.parentPath.type &&
"ExportNamedDeclaration" !== programPath.parentPath.type
)
return;
modulePrefix = programPath.node.id.name + "$" + modulePrefix;
}
programPath = programPath.parentPath;
}
if (
!seenForRegistration.has(node) &&
(seenForRegistration.add(node),
(path = path.get("declarations")),
1 === path.length)
) {
var declPath = path[0];
findInnerComponents(
modulePrefix + declPath.node.id.name,
declPath,
function (persistentID, targetExpr, targetPath) {
null !== targetPath &&
((persistentID = createRegistration(programPath, persistentID)),
"VariableDeclarator" === targetPath.parent.type
? insertAfterPath.insertAfter(
t.expressionStatement(
t.assignmentExpression(
"=",
persistentID,
declPath.node.id
)
)
)
: targetPath.replaceWith(
t.assignmentExpression("=", persistentID, targetExpr)
));
}
);
}
},
Program: {
enter: function (path) {
path.traverse(HookCallsVisitor);
},
exit: function (path) {
var registrations = registrationsByProgramPath.get(path);
if (void 0 !== registrations) {
var node = path.node;
if (!seenForOutro.has(node)) {
seenForOutro.add(node);
registrationsByProgramPath.delete(path);
var declarators = [];
path.pushContainer(
"body",
t.variableDeclaration("var", declarators)
);
registrations.forEach(function (_ref) {
var handle = _ref.handle;
path.pushContainer(
"body",
t.expressionStatement(
t.callExpression(refreshReg, [
handle,
t.stringLiteral(_ref.persistentID)
])
)
);
declarators.push(t.variableDeclarator(handle));
});
}
}
}
}
}
};
};
@@ -0,0 +1,105 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@typescript-eslint/utils");
const util_1 = require("../util");
const getESLintCoreRule_1 = require("../util/getESLintCoreRule");
const baseRule = (0, getESLintCoreRule_1.getESLintCoreRule)('init-declarations');
exports.default = (0, util_1.createRule)({
name: 'init-declarations',
meta: {
type: 'suggestion',
// defaultOptions, -- base rule does not use defaultOptions
docs: {
description: 'Require or disallow initialization in variable declarations',
extendsBaseRule: true,
frozen: true,
},
hasSuggestions: baseRule.meta.hasSuggestions,
messages: baseRule.meta.messages,
schema: baseRule.meta.schema,
},
defaultOptions: ['always'],
create(context, [mode]) {
// Make a custom context to adjust the loc of reports where the base
// rule's behavior is a bit too aggressive with TS-specific syntax (namely,
// type annotations).
function getBaseContextOverride() {
const reportOverride = descriptor => {
if ('node' in descriptor && descriptor.loc == null) {
const { node, ...rest } = descriptor;
// We only want to special case the report loc when reporting on
// variables declarations that are not initialized. Declarations that
// _are_ initialized get reported by the base rule due to a setting to
// prohibit initializing variables entirely, in which case underlining
// the whole node including the type annotation and initializer is
// appropriate.
if (node.type === utils_1.AST_NODE_TYPES.VariableDeclarator &&
node.init == null) {
context.report({
...rest,
loc: getReportLoc(node),
});
return;
}
}
context.report(descriptor);
};
// `return { ...context, report: reportOverride }` isn't safe because the
// `context` object has some getters that need to be preserved.
//
// `return new Proxy(context, ...)` doesn't work because `context` has
// non-configurable properties that throw when constructing a Proxy.
//
// So, we'll just use Proxy on a dummy object and use the `get` trap to
// proxy `context`'s properties.
return new Proxy({}, {
get: (target, prop, receiver) => prop === 'report'
? reportOverride
: Reflect.get(context, prop, receiver),
});
}
const rules = baseRule.create(getBaseContextOverride());
return {
'VariableDeclaration:exit'(node) {
if (mode === 'always') {
if (node.declare) {
return;
}
if (isAncestorNamespaceDeclared(node)) {
return;
}
}
rules['VariableDeclaration:exit'](node);
},
};
function isAncestorNamespaceDeclared(node) {
let ancestor = node.parent;
while (ancestor) {
if (ancestor.type === utils_1.AST_NODE_TYPES.TSModuleDeclaration &&
ancestor.declare) {
return true;
}
ancestor = ancestor.parent;
}
return false;
}
},
});
/**
* When reporting an uninitialized variable declarator, get the loc excluding
* the type annotation.
*/
function getReportLoc(node) {
const start = structuredClone(node.loc.start);
const end = {
line: node.loc.start.line,
// `if (id.type === AST_NODE_TYPES.Identifier)` is a condition for
// reporting in the base rule (as opposed to things like destructuring
// assignment), so the type assertion should always be valid.
column: node.loc.start.column + node.id.name.length,
};
return {
start,
end,
};
}
@@ -0,0 +1,42 @@
var $9e20cff0af27e8cc$exports = require("./platform.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, "isCtrlKeyPressed", () => $2308dc377e184bb0$export$16792effe837dba3);
$parcel$export(module.exports, "willOpenKeyboard", () => $2308dc377e184bb0$export$c57958e35f31ed73);
/*
* Copyright 2024 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
function $2308dc377e184bb0$export$16792effe837dba3(e) {
if ((0, $9e20cff0af27e8cc$exports.isMac)()) return e.metaKey;
return e.ctrlKey;
}
// HTML input types that do not cause the software keyboard to appear.
const $2308dc377e184bb0$var$nonTextInputTypes = new Set([
'checkbox',
'radio',
'range',
'color',
'file',
'image',
'button',
'submit',
'reset'
]);
function $2308dc377e184bb0$export$c57958e35f31ed73(target) {
return target instanceof HTMLInputElement && !$2308dc377e184bb0$var$nonTextInputTypes.has(target.type) || target instanceof HTMLTextAreaElement || target instanceof HTMLElement && target.isContentEditable;
}
//# sourceMappingURL=keyboard.main.js.map
@@ -0,0 +1,46 @@
import * as core from "../core/index.js";
import type { ZodType } from "./schemas.js";
export type {
/** @deprecated Use `z.output<T>` instead. */
output as TypeOf,
/** @deprecated Use `z.output<T>` instead. */
output as Infer,
/** @deprecated Use `z.core.$$ZodFirstPartyTypes` instead */
$ZodTypes as ZodFirstPartySchemaTypes, } from "../core/index.js";
/** @deprecated Use the raw string literal codes instead, e.g. "invalid_type". */
export declare const ZodIssueCode: {
readonly invalid_type: "invalid_type";
readonly too_big: "too_big";
readonly too_small: "too_small";
readonly invalid_format: "invalid_format";
readonly not_multiple_of: "not_multiple_of";
readonly unrecognized_keys: "unrecognized_keys";
readonly invalid_union: "invalid_union";
readonly invalid_key: "invalid_key";
readonly invalid_element: "invalid_element";
readonly invalid_value: "invalid_value";
readonly custom: "custom";
};
/** @deprecated Use `z.$ZodFlattenedError` */
export type inferFlattenedErrors<T extends core.$ZodType, U = string> = core.$ZodFlattenedError<core.output<T>, U>;
/** @deprecated Use `z.$ZodFormattedError` */
export type inferFormattedError<T extends core.$ZodType<any, any>, U = string> = core.$ZodFormattedError<core.output<T>, U>;
/** Use `z.$brand` instead */
export type BRAND<T extends string | number | symbol = string | number | symbol> = {
[core.$brand]: {
[k in T]: true;
};
};
export { $brand, config } from "../core/index.js";
/** @deprecated Use `z.config(params)` instead. */
export declare function setErrorMap(map: core.$ZodErrorMap): void;
/** @deprecated Use `z.config()` instead. */
export declare function getErrorMap(): core.$ZodErrorMap<core.$ZodIssue> | undefined;
export type {
/** @deprecated Use z.ZodType (without generics) instead. */
ZodType as ZodTypeAny,
/** @deprecated Use `z.ZodType` */
ZodType as ZodSchema,
/** @deprecated Use `z.ZodType` */
ZodType as Schema, };
export type ZodRawShape = core.$ZodShape;
@@ -0,0 +1,49 @@
/**
* @fileoverview Helpers for severity values (e.g. normalizing different types).
* @author Bryan Mishkin
*/
"use strict";
/**
* Convert severity value of different types to a string.
* @param {string|number} severity severity value
* @throws error if severity is invalid
* @returns {string} severity string
*/
function normalizeSeverityToString(severity) {
if ([2, "2", "error"].includes(severity)) {
return "error";
}
if ([1, "1", "warn"].includes(severity)) {
return "warn";
}
if ([0, "0", "off"].includes(severity)) {
return "off";
}
throw new Error(`Invalid severity value: ${severity}`);
}
/**
* Convert severity value of different types to a number.
* @param {string|number} severity severity value
* @throws error if severity is invalid
* @returns {number} severity number
*/
function normalizeSeverityToNumber(severity) {
if ([2, "2", "error"].includes(severity)) {
return 2;
}
if ([1, "1", "warn"].includes(severity)) {
return 1;
}
if ([0, "0", "off"].includes(severity)) {
return 0;
}
throw new Error(`Invalid severity value: ${severity}`);
}
module.exports = {
normalizeSeverityToString,
normalizeSeverityToNumber,
};
@@ -0,0 +1,116 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.ts
var src_exports = {};
__export(src_exports, {
useAriaButton: () => useAriaButton
});
module.exports = __toCommonJS(src_exports);
var import_shared_utils = require("@heroui/shared-utils");
var import_utils = require("@react-aria/utils");
var import_focus = require("@react-aria/focus");
var import_interactions = require("@react-aria/interactions");
function useAriaButton(props, ref) {
let {
elementType = "button",
isDisabled,
onPress,
onPressStart,
onPressEnd,
onPressChange,
preventFocusOnPress,
allowFocusWhenDisabled,
onClick: deprecatedOnClick,
href,
target,
rel,
type = "button",
allowTextSelectionOnPress
} = props;
let additionalProps;
if (elementType === "button") {
additionalProps = {
type,
disabled: isDisabled
};
} else {
additionalProps = {
role: "button",
tabIndex: isDisabled ? void 0 : 0,
href: elementType === "a" && !isDisabled ? href : void 0,
target: elementType === "a" ? target : void 0,
type: elementType === "input" ? type : void 0,
disabled: elementType === "input" ? isDisabled : void 0,
"aria-disabled": !isDisabled || elementType === "input" ? void 0 : isDisabled,
rel: elementType === "a" ? rel : void 0
};
}
let isMobile = (0, import_utils.isIOS)() || (0, import_utils.isAndroid)();
if (deprecatedOnClick && typeof deprecatedOnClick === "function") {
(0, import_shared_utils.warn)(
"onClick is deprecated, please use onPress instead. See: https://github.com/heroui-inc/heroui/issues/4292",
"useButton"
);
}
const handlePress = (e) => {
if (isMobile) {
deprecatedOnClick == null ? void 0 : deprecatedOnClick(e);
}
onPress == null ? void 0 : onPress(e);
};
let { pressProps, isPressed } = (0, import_interactions.usePress)({
onPressStart,
onPressEnd,
onPressChange,
onPress: handlePress,
isDisabled,
preventFocusOnPress,
allowTextSelectionOnPress,
ref
});
let { focusableProps } = (0, import_focus.useFocusable)(props, ref);
if (allowFocusWhenDisabled) {
focusableProps.tabIndex = isDisabled ? -1 : focusableProps.tabIndex;
}
let buttonProps = (0, import_utils.mergeProps)(
focusableProps,
pressProps,
(0, import_utils.filterDOMProps)(props, { labelable: true })
);
return {
isPressed,
buttonProps: (0, import_utils.mergeProps)(additionalProps, buttonProps, {
"aria-haspopup": props["aria-haspopup"],
"aria-expanded": props["aria-expanded"],
"aria-controls": props["aria-controls"],
"aria-pressed": props["aria-pressed"],
onClick: (e) => {
if (type === "button" && isMobile) {
return;
}
deprecatedOnClick == null ? void 0 : deprecatedOnClick(e);
}
})
};
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
useAriaButton
});
@@ -0,0 +1,12 @@
import { useEffect, useRef } from 'react';
var useUnmountedRef = function () {
var unmountedRef = useRef(false);
useEffect(function () {
unmountedRef.current = false;
return function () {
unmountedRef.current = true;
};
}, []);
return unmountedRef;
};
export default useUnmountedRef;
@@ -0,0 +1,75 @@
var path = require('path');
var test = require('tape');
var resolve = require('../');
var resolverDir = path.join(__dirname, '/pathfilter/deep_ref');
var pathFilterFactory = function (t) {
return function (pkg, x, remainder) {
t.equal(pkg.version, '1.2.3');
t.equal(x, path.join(resolverDir, 'node_modules/deep/ref'));
t.equal(remainder, 'ref');
return 'alt';
};
};
test('#62: deep module references and the pathFilter', function (t) {
t.test('deep/ref.js', function (st) {
st.plan(3);
resolve('deep/ref', { basedir: resolverDir }, function (err, res, pkg) {
if (err) st.fail(err);
st.equal(pkg.version, '1.2.3');
st.equal(res, path.join(resolverDir, 'node_modules/deep/ref.js'));
});
var res = resolve.sync('deep/ref', { basedir: resolverDir });
st.equal(res, path.join(resolverDir, 'node_modules/deep/ref.js'));
});
t.test('deep/deeper/ref', function (st) {
st.plan(4);
resolve(
'deep/deeper/ref',
{ basedir: resolverDir },
function (err, res, pkg) {
if (err) t.fail(err);
st.notEqual(pkg, undefined);
st.equal(pkg.version, '1.2.3');
st.equal(res, path.join(resolverDir, 'node_modules/deep/deeper/ref.js'));
}
);
var res = resolve.sync(
'deep/deeper/ref',
{ basedir: resolverDir }
);
st.equal(res, path.join(resolverDir, 'node_modules/deep/deeper/ref.js'));
});
t.test('deep/ref alt', function (st) {
st.plan(8);
var pathFilter = pathFilterFactory(st);
var res = resolve.sync(
'deep/ref',
{ basedir: resolverDir, pathFilter: pathFilter }
);
st.equal(res, path.join(resolverDir, 'node_modules/deep/alt.js'));
resolve(
'deep/ref',
{ basedir: resolverDir, pathFilter: pathFilter },
function (err, res, pkg) {
if (err) st.fail(err);
st.equal(res, path.join(resolverDir, 'node_modules/deep/alt.js'));
st.end();
}
);
});
t.end();
});
@@ -0,0 +1,237 @@
/**
* @fileoverview Rule to require parens in arrow function arguments.
* @author Jxck
* @deprecated in ESLint v8.53.0
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const astUtils = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
/**
* Determines if the given arrow function has block body.
* @param {ASTNode} node `ArrowFunctionExpression` node.
* @returns {boolean} `true` if the function has block body.
*/
function hasBlockBody(node) {
return node.body.type === "BlockStatement";
}
//------------------------------------------------------------------------------
// 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: "arrow-parens",
url: "https://eslint.style/rules/arrow-parens",
},
},
],
},
type: "layout",
docs: {
description: "Require parentheses around arrow function arguments",
recommended: false,
url: "https://eslint.org/docs/latest/rules/arrow-parens",
},
fixable: "code",
schema: [
{
enum: ["always", "as-needed"],
},
{
type: "object",
properties: {
requireForBlockBody: {
type: "boolean",
default: false,
},
},
additionalProperties: false,
},
],
messages: {
unexpectedParens:
"Unexpected parentheses around single function argument.",
expectedParens:
"Expected parentheses around arrow function argument.",
unexpectedParensInline:
"Unexpected parentheses around single function argument having a body with no curly braces.",
expectedParensBlock:
"Expected parentheses around arrow function argument having a body with curly braces.",
},
},
create(context) {
const asNeeded = context.options[0] === "as-needed";
const requireForBlockBody =
asNeeded &&
context.options[1] &&
context.options[1].requireForBlockBody === true;
const sourceCode = context.sourceCode;
/**
* Finds opening paren of parameters for the given arrow function, if it exists.
* It is assumed that the given arrow function has exactly one parameter.
* @param {ASTNode} node `ArrowFunctionExpression` node.
* @returns {Token|null} the opening paren, or `null` if the given arrow function doesn't have parens of parameters.
*/
function findOpeningParenOfParams(node) {
const tokenBeforeParams = sourceCode.getTokenBefore(node.params[0]);
if (
tokenBeforeParams &&
astUtils.isOpeningParenToken(tokenBeforeParams) &&
node.range[0] <= tokenBeforeParams.range[0]
) {
return tokenBeforeParams;
}
return null;
}
/**
* Finds closing paren of parameters for the given arrow function.
* It is assumed that the given arrow function has parens of parameters and that it has exactly one parameter.
* @param {ASTNode} node `ArrowFunctionExpression` node.
* @returns {Token} the closing paren of parameters.
*/
function getClosingParenOfParams(node) {
return sourceCode.getTokenAfter(
node.params[0],
astUtils.isClosingParenToken,
);
}
/**
* Determines whether the given arrow function has comments inside parens of parameters.
* It is assumed that the given arrow function has parens of parameters.
* @param {ASTNode} node `ArrowFunctionExpression` node.
* @param {Token} openingParen Opening paren of parameters.
* @returns {boolean} `true` if the function has at least one comment inside of parens of parameters.
*/
function hasCommentsInParensOfParams(node, openingParen) {
return sourceCode.commentsExistBetween(
openingParen,
getClosingParenOfParams(node),
);
}
/**
* Determines whether the given arrow function has unexpected tokens before opening paren of parameters,
* in which case it will be assumed that the existing parens of parameters are necessary.
* Only tokens within the range of the arrow function (tokens that are part of the arrow function) are taken into account.
* Example: <T>(a) => b
* @param {ASTNode} node `ArrowFunctionExpression` node.
* @param {Token} openingParen Opening paren of parameters.
* @returns {boolean} `true` if the function has at least one unexpected token.
*/
function hasUnexpectedTokensBeforeOpeningParen(node, openingParen) {
const expectedCount = node.async ? 1 : 0;
return (
sourceCode.getFirstToken(node, { skip: expectedCount }) !==
openingParen
);
}
return {
"ArrowFunctionExpression[params.length=1]"(node) {
const shouldHaveParens =
!asNeeded || (requireForBlockBody && hasBlockBody(node));
const openingParen = findOpeningParenOfParams(node);
const hasParens = openingParen !== null;
const [param] = node.params;
if (shouldHaveParens && !hasParens) {
context.report({
node,
messageId: requireForBlockBody
? "expectedParensBlock"
: "expectedParens",
loc: param.loc,
*fix(fixer) {
yield fixer.insertTextBefore(param, "(");
yield fixer.insertTextAfter(param, ")");
},
});
}
if (
!shouldHaveParens &&
hasParens &&
param.type === "Identifier" &&
!param.typeAnnotation &&
!node.returnType &&
!hasCommentsInParensOfParams(node, openingParen) &&
!hasUnexpectedTokensBeforeOpeningParen(node, openingParen)
) {
context.report({
node,
messageId: requireForBlockBody
? "unexpectedParensInline"
: "unexpectedParens",
loc: param.loc,
*fix(fixer) {
const tokenBeforeOpeningParen =
sourceCode.getTokenBefore(openingParen);
const closingParen = getClosingParenOfParams(node);
if (
tokenBeforeOpeningParen &&
tokenBeforeOpeningParen.range[1] ===
openingParen.range[0] &&
!astUtils.canTokensBeAdjacent(
tokenBeforeOpeningParen,
sourceCode.getFirstToken(param),
)
) {
yield fixer.insertTextBefore(openingParen, " ");
}
// remove parens, whitespace inside parens, and possible trailing comma
yield fixer.removeRange([
openingParen.range[0],
param.range[0],
]);
yield fixer.removeRange([
param.range[1],
closingParen.range[1],
]);
},
});
}
},
};
},
};
@@ -0,0 +1,261 @@
/**
* @import {Nodes, Parents, PhrasingContent, Root, Text} from 'mdast'
* @import {BuildVisitor, Test, VisitorResult} from 'unist-util-visit-parents'
*/
/**
* @typedef RegExpMatchObject
* Info on the match.
* @property {number} index
* The index of the search at which the result was found.
* @property {string} input
* A copy of the search string in the text node.
* @property {[...Array<Parents>, Text]} stack
* All ancestors of the text node, where the last node is the text itself.
*
* @typedef {RegExp | string} Find
* Pattern to find.
*
* Strings are escaped and then turned into global expressions.
*
* @typedef {Array<FindAndReplaceTuple>} FindAndReplaceList
* Several find and replaces, in array form.
*
* @typedef {[Find, Replace?]} FindAndReplaceTuple
* Find and replace in tuple form.
*
* @typedef {ReplaceFunction | string | null | undefined} Replace
* Thing to replace with.
*
* @callback ReplaceFunction
* Callback called when a search matches.
* @param {...any} parameters
* The parameters are the result of corresponding search expression:
*
* * `value` (`string`) — whole match
* * `...capture` (`Array<string>`) — matches from regex capture groups
* * `match` (`RegExpMatchObject`) — info on the match
* @returns {Array<PhrasingContent> | PhrasingContent | string | false | null | undefined}
* Thing to replace with.
*
* * when `null`, `undefined`, `''`, remove the match
* * …or when `false`, do not replace at all
* * …or when `string`, replace with a text node of that value
* * …or when `Node` or `Array<Node>`, replace with those nodes
*
* @typedef {[RegExp, ReplaceFunction]} Pair
* Normalized find and replace.
*
* @typedef {Array<Pair>} Pairs
* All find and replaced.
*
* @typedef Options
* Configuration.
* @property {Test | null | undefined} [ignore]
* Test for which nodes to ignore (optional).
*/
import escape from 'escape-string-regexp'
import {visitParents} from 'unist-util-visit-parents'
import {convert} from 'unist-util-is'
/**
* Find patterns in a tree and replace them.
*
* The algorithm searches the tree in *preorder* for complete values in `Text`
* nodes.
* Partial matches are not supported.
*
* @param {Nodes} tree
* Tree to change.
* @param {FindAndReplaceList | FindAndReplaceTuple} list
* Patterns to find.
* @param {Options | null | undefined} [options]
* Configuration (when `find` is not `Find`).
* @returns {undefined}
* Nothing.
*/
export function findAndReplace(tree, list, options) {
const settings = options || {}
const ignored = convert(settings.ignore || [])
const pairs = toPairs(list)
let pairIndex = -1
while (++pairIndex < pairs.length) {
visitParents(tree, 'text', visitor)
}
/** @type {BuildVisitor<Root, 'text'>} */
function visitor(node, parents) {
let index = -1
/** @type {Parents | undefined} */
let grandparent
while (++index < parents.length) {
const parent = parents[index]
/** @type {Array<Nodes> | undefined} */
const siblings = grandparent ? grandparent.children : undefined
if (
ignored(
parent,
siblings ? siblings.indexOf(parent) : undefined,
grandparent
)
) {
return
}
grandparent = parent
}
if (grandparent) {
return handler(node, parents)
}
}
/**
* Handle a text node which is not in an ignored parent.
*
* @param {Text} node
* Text node.
* @param {Array<Parents>} parents
* Parents.
* @returns {VisitorResult}
* Result.
*/
function handler(node, parents) {
const parent = parents[parents.length - 1]
const find = pairs[pairIndex][0]
const replace = pairs[pairIndex][1]
let start = 0
/** @type {Array<Nodes>} */
const siblings = parent.children
const index = siblings.indexOf(node)
let change = false
/** @type {Array<PhrasingContent>} */
let nodes = []
find.lastIndex = 0
let match = find.exec(node.value)
while (match) {
const position = match.index
/** @type {RegExpMatchObject} */
const matchObject = {
index: match.index,
input: match.input,
stack: [...parents, node]
}
let value = replace(...match, matchObject)
if (typeof value === 'string') {
value = value.length > 0 ? {type: 'text', value} : undefined
}
// It wasn’t a match after all.
if (value === false) {
// False acts as if there was no match.
// So we need to reset `lastIndex`, which currently being at the end of
// the current match, to the beginning.
find.lastIndex = position + 1
} else {
if (start !== position) {
nodes.push({
type: 'text',
value: node.value.slice(start, position)
})
}
if (Array.isArray(value)) {
nodes.push(...value)
} else if (value) {
nodes.push(value)
}
start = position + match[0].length
change = true
}
if (!find.global) {
break
}
match = find.exec(node.value)
}
if (change) {
if (start < node.value.length) {
nodes.push({type: 'text', value: node.value.slice(start)})
}
parent.children.splice(index, 1, ...nodes)
} else {
nodes = [node]
}
return index + nodes.length
}
}
/**
* Turn a tuple or a list of tuples into pairs.
*
* @param {FindAndReplaceList | FindAndReplaceTuple} tupleOrList
* Schema.
* @returns {Pairs}
* Clean pairs.
*/
function toPairs(tupleOrList) {
/** @type {Pairs} */
const result = []
if (!Array.isArray(tupleOrList)) {
throw new TypeError('Expected find and replace tuple or list of tuples')
}
/** @type {FindAndReplaceList} */
// @ts-expect-error: correct.
const list =
!tupleOrList[0] || Array.isArray(tupleOrList[0])
? tupleOrList
: [tupleOrList]
let index = -1
while (++index < list.length) {
const tuple = list[index]
result.push([toExpression(tuple[0]), toFunction(tuple[1])])
}
return result
}
/**
* Turn a find into an expression.
*
* @param {Find} find
* Find.
* @returns {RegExp}
* Expression.
*/
function toExpression(find) {
return typeof find === 'string' ? new RegExp(escape(find), 'g') : find
}
/**
* Turn a replace into a function.
*
* @param {Replace} replace
* Replace.
* @returns {ReplaceFunction}
* Function.
*/
function toFunction(replace) {
return typeof replace === 'function'
? replace
: function () {
return replace
}
}
@@ -0,0 +1,3 @@
# @react-stately/slider
This package is part of [react-spectrum](https://github.com/adobe/react-spectrum). See the repo for more details.
@@ -0,0 +1,29 @@
import { __read } from "tslib";
import ResizeObserver from 'resize-observer-polyfill';
import useRafState from '../useRafState';
import { getTargetElement } from '../utils/domTarget';
import useIsomorphicLayoutEffectWithTarget from '../utils/useIsomorphicLayoutEffectWithTarget';
function useSize(target) {
var _a = __read(useRafState(function () {
var el = getTargetElement(target);
return el ? { width: el.clientWidth, height: el.clientHeight } : undefined;
}), 2), state = _a[0], setState = _a[1];
useIsomorphicLayoutEffectWithTarget(function () {
var el = getTargetElement(target);
if (!el) {
return;
}
var resizeObserver = new ResizeObserver(function (entries) {
entries.forEach(function (entry) {
var _a = entry.target, clientWidth = _a.clientWidth, clientHeight = _a.clientHeight;
setState({ width: clientWidth, height: clientHeight });
});
});
resizeObserver.observe(el);
return function () {
resizeObserver.disconnect();
};
}, [], target);
return state;
}
export default useSize;
@@ -0,0 +1,8 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.NEGATIVE_ZERO = exports.ZERO = exports.TEN = void 0;
var tslib_1 = require("tslib");
var decimal_js_1 = tslib_1.__importDefault(require("decimal.js"));
exports.TEN = new decimal_js_1.default(10);
exports.ZERO = new decimal_js_1.default(0);
exports.NEGATIVE_ZERO = new decimal_js_1.default(-0);
@@ -0,0 +1,877 @@
'use strict';
var eslintVisitorKeys = require('eslint-visitor-keys');
var espree = require('espree');
var estraverse = require('estraverse');
function createAllConfigs(plugin, name, flat, filter) {
const rules = Object.fromEntries(
Object.entries(plugin.rules).filter(
([key, rule]) => (
// Only include fixable rules
rule.meta.fixable && !rule.meta.deprecated && key === rule.meta.docs.url.split("/").pop() && (!filter || filter(key, rule))
)
).map(([key]) => [`${name}/${key}`, 2])
);
if (flat) {
return {
plugins: {
[name]: plugin
},
rules
};
} else {
return {
plugins: [name],
rules
};
}
}
const anyFunctionPattern = /^(?:Function(?:Declaration|Expression)|ArrowFunctionExpression)$/u;
const COMMENTS_IGNORE_PATTERN = /^\s*(?:eslint|jshint\s+|jslint\s+|istanbul\s+|globals?\s+|exported\s+|jscs)/u;
const LINEBREAKS = /* @__PURE__ */ new Set(["\r\n", "\r", "\n", "\u2028", "\u2029"]);
const LINEBREAK_MATCHER = /\r\n|[\r\n\u2028\u2029]/u;
const STATEMENT_LIST_PARENTS = /* @__PURE__ */ new Set(["Program", "BlockStatement", "StaticBlock", "SwitchCase"]);
const DECIMAL_INTEGER_PATTERN = /^(?:0|0[0-7]*[89]\d*|[1-9](?:_?\d)*)$/u;
const OCTAL_OR_NON_OCTAL_DECIMAL_ESCAPE_PATTERN = /^(?:[^\\]|\\.)*\\(?:[1-9]|0\d)/su;
function createGlobalLinebreakMatcher() {
return new RegExp(LINEBREAK_MATCHER.source, "gu");
}
function getUpperFunction(node) {
for (let currentNode = node; currentNode; currentNode = currentNode.parent) {
if (anyFunctionPattern.test(currentNode.type))
return currentNode;
}
return null;
}
function isFunction(node) {
return Boolean(node && anyFunctionPattern.test(node.type));
}
function isNullLiteral(node) {
return node.type === "Literal" && node.value === null && !("regex" in node) && !("bigint" in node);
}
function getStaticStringValue(node) {
switch (node.type) {
case "Literal":
if (node.value === null) {
if (isNullLiteral(node))
return String(node.value);
if ("regex" in node && node.regex)
return `/${node.regex.pattern}/${node.regex.flags}`;
if ("bigint" in node && node.bigint)
return node.bigint;
} else {
return String(node.value);
}
break;
case "TemplateLiteral":
if (node.expressions.length === 0 && node.quasis.length === 1)
return node.quasis[0].value.cooked;
break;
}
return null;
}
function getStaticPropertyName(node) {
let prop;
if (node) {
switch (node.type) {
case "ChainExpression":
return getStaticPropertyName(node.expression);
case "Property":
case "PropertyDefinition":
case "MethodDefinition":
case "ImportAttribute":
prop = node.key;
break;
case "MemberExpression":
prop = node.property;
break;
}
}
if (prop) {
if (prop.type === "Identifier" && !("computed" in node && node.computed))
return prop.name;
return getStaticStringValue(prop);
}
return null;
}
function skipChainExpression(node) {
return node && node.type === "ChainExpression" ? node.expression : node;
}
function negate(f) {
return (token) => !f(token);
}
function isParenthesised(sourceCode, node) {
const previousToken = sourceCode.getTokenBefore(node);
const nextToken = sourceCode.getTokenAfter(node);
return !!previousToken && !!nextToken && previousToken.value === "(" && previousToken.range[1] <= node.range[0] && nextToken.value === ")" && nextToken.range[0] >= node.range[1];
}
function isEqToken(token) {
return token.value === "=" && token.type === "Punctuator";
}
function isArrowToken(token) {
return token.value === "=>" && token.type === "Punctuator";
}
function isCommaToken(token) {
return token.value === "," && token.type === "Punctuator";
}
function isQuestionDotToken(token) {
return token.value === "?." && token.type === "Punctuator";
}
function isSemicolonToken(token) {
return token.value === ";" && token.type === "Punctuator";
}
function isColonToken(token) {
return token.value === ":" && token.type === "Punctuator";
}
function isOpeningParenToken(token) {
return token.value === "(" && token.type === "Punctuator";
}
function isClosingParenToken(token) {
return token.value === ")" && token.type === "Punctuator";
}
function isOpeningBracketToken(token) {
return token.value === "[" && token.type === "Punctuator";
}
function isClosingBracketToken(token) {
return token.value === "]" && token.type === "Punctuator";
}
function isOpeningBraceToken(token) {
return token.value === "{" && token.type === "Punctuator";
}
function isClosingBraceToken(token) {
return token.value === "}" && token.type === "Punctuator";
}
function isCommentToken(token) {
if (!token)
return false;
return token.type === "Line" || token.type === "Block" || token.type === "Shebang";
}
function isKeywordToken(token) {
return token.type === "Keyword";
}
function isLogicalExpression(node) {
return node.type === "LogicalExpression" && (node.operator === "&&" || node.operator === "||");
}
function isCoalesceExpression(node) {
return node.type === "LogicalExpression" && node.operator === "??";
}
function isMixedLogicalAndCoalesceExpressions(left, right) {
return isLogicalExpression(left) && isCoalesceExpression(right) || isCoalesceExpression(left) && isLogicalExpression(right);
}
function getSwitchCaseColonToken(node, sourceCode) {
if ("test" in node && node.test)
return sourceCode.getTokenAfter(node.test, (token) => isColonToken(token));
return sourceCode.getFirstToken(node, 1);
}
function isTopLevelExpressionStatement(node) {
if (node.type !== "ExpressionStatement")
return false;
const parent = node.parent;
return parent.type === "Program" || parent.type === "BlockStatement" && isFunction(parent.parent);
}
function isTokenOnSameLine(left, right) {
return left?.loc?.end.line === right?.loc?.start.line;
}
const isNotClosingParenToken = /* @__PURE__ */ negate(isClosingParenToken);
const isNotCommaToken = /* @__PURE__ */ negate(isCommaToken);
const isNotOpeningParenToken = /* @__PURE__ */ negate(isOpeningParenToken);
const isNotSemicolonToken = /* @__PURE__ */ negate(isSemicolonToken);
function isStringLiteral(node) {
return node.type === "Literal" && typeof node.value === "string" || node.type === "TemplateLiteral";
}
function isSurroundedBy(val, character) {
return val[0] === character && val[val.length - 1] === character;
}
function getPrecedence(node) {
switch (node.type) {
case "SequenceExpression":
return 0;
case "AssignmentExpression":
case "ArrowFunctionExpression":
case "YieldExpression":
return 1;
case "ConditionalExpression":
return 3;
case "LogicalExpression":
switch (node.operator) {
case "||":
case "??":
return 4;
case "&&":
return 5;
}
/* falls through */
case "BinaryExpression":
switch (node.operator) {
case "|":
return 6;
case "^":
return 7;
case "&":
return 8;
case "==":
case "!=":
case "===":
case "!==":
return 9;
case "<":
case "<=":
case ">":
case ">=":
case "in":
case "instanceof":
return 10;
case "<<":
case ">>":
case ">>>":
return 11;
case "+":
case "-":
return 12;
case "*":
case "/":
case "%":
return 13;
case "**":
return 15;
}
/* falls through */
case "UnaryExpression":
case "AwaitExpression":
return 16;
case "UpdateExpression":
return 17;
case "CallExpression":
case "ChainExpression":
case "ImportExpression":
return 18;
case "NewExpression":
return 19;
default:
if (node.type in eslintVisitorKeys.KEYS)
return 20;
return -1;
}
}
function isDecimalInteger(node) {
return node.type === "Literal" && typeof node.value === "number" && DECIMAL_INTEGER_PATTERN.test(node.raw);
}
function isDecimalIntegerNumericToken(token) {
return token.type === "Numeric" && DECIMAL_INTEGER_PATTERN.test(token.value);
}
function getNextLocation(sourceCode, { column, line }) {
if (column < sourceCode.lines[line - 1].length) {
return {
column: column + 1,
line
};
}
if (line < sourceCode.lines.length) {
return {
column: 0,
line: line + 1
};
}
return null;
}
function isNumericLiteral(node) {
return node.type === "Literal" && (typeof node.value === "number" || Boolean("bigint" in node && node.bigint));
}
function canTokensBeAdjacent(leftValue, rightValue) {
const espreeOptions = {
comment: true,
ecmaVersion: espree.latestEcmaVersion,
range: true
};
let leftToken;
if (typeof leftValue === "string") {
let tokens;
try {
tokens = espree.tokenize(leftValue, espreeOptions);
} catch {
return false;
}
const comments = tokens.comments;
leftToken = tokens[tokens.length - 1];
if (comments.length) {
const lastComment = comments[comments.length - 1];
if (!leftToken || lastComment.range[0] > leftToken.range[0])
leftToken = lastComment;
}
} else {
leftToken = leftValue;
}
if (leftToken.type === "Shebang" || leftToken.type === "Hashbang")
return false;
let rightToken;
if (typeof rightValue === "string") {
let tokens;
try {
tokens = espree.tokenize(rightValue, espreeOptions);
} catch {
return false;
}
const comments = tokens.comments;
rightToken = tokens[0];
if (comments.length) {
const firstComment = comments[0];
if (!rightToken || firstComment.range[0] < rightToken.range[0])
rightToken = firstComment;
}
} else {
rightToken = rightValue;
}
if (leftToken.type === "Punctuator" || rightToken.type === "Punctuator") {
if (leftToken.type === "Punctuator" && rightToken.type === "Punctuator") {
const PLUS_TOKENS = /* @__PURE__ */ new Set(["+", "++"]);
const MINUS_TOKENS = /* @__PURE__ */ new Set(["-", "--"]);
return !(PLUS_TOKENS.has(leftToken.value) && PLUS_TOKENS.has(rightToken.value) || MINUS_TOKENS.has(leftToken.value) && MINUS_TOKENS.has(rightToken.value));
}
if (leftToken.type === "Punctuator" && leftToken.value === "/")
return !["Block", "Line", "RegularExpression"].includes(rightToken.type);
return true;
}
if (leftToken.type === "String" || rightToken.type === "String" || leftToken.type === "Template" || rightToken.type === "Template")
return true;
if (leftToken.type !== "Numeric" && rightToken.type === "Numeric" && rightToken.value.startsWith("."))
return true;
if (leftToken.type === "Block" || rightToken.type === "Block" || rightToken.type === "Line")
return true;
if (rightToken.type === "PrivateIdentifier")
return true;
return false;
}
function hasOctalOrNonOctalDecimalEscapeSequence(rawString) {
return OCTAL_OR_NON_OCTAL_DECIMAL_ESCAPE_PATTERN.test(rawString);
}
function getFirstNodeInLine(context, node) {
const sourceCode = context.sourceCode;
let token = node;
let lines = null;
do {
token = sourceCode.getTokenBefore(token);
lines = token.type === "JSXText" ? token.value.split("\n") : null;
} while (token.type === "JSXText" && lines && /^\s*$/.test(lines[lines.length - 1]));
return token;
}
function isNodeFirstInLine(context, node) {
const token = getFirstNodeInLine(context, node);
const startLine = node.loc.start.line;
const endLine = token ? token.loc.end.line : -1;
return startLine !== endLine;
}
function getTokenBeforeClosingBracket(node) {
const attributes = "attributes" in node && node.attributes;
if (!attributes || attributes.length === 0)
return node.name;
return attributes[attributes.length - 1];
}
function getParentSyntaxParen(node, sourceCode) {
const parent = node.parent;
if (!parent)
return null;
switch (parent.type) {
case "CallExpression":
case "NewExpression":
if (parent.arguments.length === 1 && parent.arguments[0] === node) {
return sourceCode.getTokenAfter(
parent.callee,
isOpeningParenToken
);
}
return null;
case "DoWhileStatement":
if (parent.test === node) {
return sourceCode.getTokenAfter(
parent.body,
isOpeningParenToken
);
}
return null;
case "IfStatement":
case "WhileStatement":
if (parent.test === node) {
return sourceCode.getFirstToken(parent, 1);
}
return null;
case "ImportExpression":
if (parent.source === node) {
return sourceCode.getFirstToken(parent, 1);
}
return null;
case "SwitchStatement":
if (parent.discriminant === node) {
return sourceCode.getFirstToken(parent, 1);
}
return null;
case "WithStatement":
if (parent.object === node) {
return sourceCode.getFirstToken(parent, 1);
}
return null;
default:
return null;
}
}
function isParenthesized(node, sourceCode, times = 1) {
let maybeLeftParen, maybeRightParen;
if (node == null || node.parent == null || node.parent.type === "CatchClause" && node.parent.param === node) {
return false;
}
maybeLeftParen = maybeRightParen = node;
do {
maybeLeftParen = sourceCode.getTokenBefore(maybeLeftParen);
maybeRightParen = sourceCode.getTokenAfter(maybeRightParen);
} while (maybeLeftParen != null && maybeRightParen != null && (maybeLeftParen.type === "Punctuator" && maybeLeftParen.value === "(") && (maybeRightParen.type === "Punctuator" && maybeRightParen.value === ")") && maybeLeftParen !== getParentSyntaxParen(node, sourceCode) && --times > 0);
return times === 0;
}
function isObjectNotArray(obj) {
return typeof obj === "object" && obj != null && !Array.isArray(obj);
}
function deepMerge(first = {}, second = {}) {
const keys = new Set(Object.keys(first).concat(Object.keys(second)));
return Array.from(keys).reduce((acc, key) => {
const firstHasKey = key in first;
const secondHasKey = key in second;
const firstValue = first[key];
const secondValue = second[key];
if (firstHasKey && secondHasKey) {
if (isObjectNotArray(firstValue) && isObjectNotArray(secondValue)) {
acc[key] = deepMerge(firstValue, secondValue);
} else {
acc[key] = secondValue;
}
} else if (firstHasKey) {
acc[key] = firstValue;
} else {
acc[key] = secondValue;
}
return acc;
}, {});
}
function createRule({
name,
package: pkg,
create,
defaultOptions = [],
meta
}) {
return {
create: (context) => {
const optionsCount = Math.max(context.options.length, defaultOptions.length);
const optionsWithDefault = Array.from(
{ length: optionsCount },
(_, i) => {
if (isObjectNotArray(context.options[i]) && isObjectNotArray(defaultOptions[i])) {
return deepMerge(defaultOptions[i], context.options[i]);
}
return context.options[i] ?? defaultOptions[i];
}
);
return create(context, optionsWithDefault);
},
defaultOptions,
meta: {
...meta,
docs: {
...meta.docs,
url: `https://eslint.style/rules/${pkg}/${name}`
}
}
};
}
function castRuleModule(rule) {
return rule;
}
function traverse(ASTnode, visitor) {
const opts = Object.assign({}, {
fallback(node) {
return Object.keys(node).filter((key) => key === "children" || key === "argument");
}
}, visitor);
opts.keys = Object.assign({}, visitor.keys, {
JSXElement: ["children"],
JSXFragment: ["children"]
});
estraverse.traverse(ASTnode, opts);
}
function traverseReturns(ASTNode, onReturn) {
const nodeType = ASTNode.type;
if (nodeType === "ReturnStatement") {
onReturn(ASTNode.argument, () => {
});
return;
}
if (nodeType === "ArrowFunctionExpression" && ASTNode.expression) {
onReturn(ASTNode.body, () => {
});
return;
}
if (nodeType !== "FunctionExpression" && nodeType !== "FunctionDeclaration" && nodeType !== "ArrowFunctionExpression" && nodeType !== "MethodDefinition") {
return;
}
traverse(ASTNode.body, {
enter(node) {
const breakTraverse = () => {
this.break();
};
switch (node.type) {
case "ReturnStatement":
this.skip();
onReturn(node.argument, breakTraverse);
return;
case "BlockStatement":
case "IfStatement":
case "ForStatement":
case "WhileStatement":
case "SwitchStatement":
case "SwitchCase":
return;
default:
this.skip();
}
}
});
}
function getVariable(variables, name) {
return variables.find((variable) => variable.name === name);
}
function variablesInScope(context) {
let scope = context.getScope();
let variables = scope.variables;
while (scope.type !== "global") {
scope = scope.upper;
variables = scope.variables.concat(variables);
}
if (scope.childScopes.length) {
variables = scope.childScopes[0].variables.concat(variables);
if (scope.childScopes[0].childScopes.length)
variables = scope.childScopes[0].childScopes[0].variables.concat(variables);
}
variables.reverse();
return variables;
}
function findVariableByName(context, name) {
const variable = getVariable(variablesInScope(context), name);
if (!variable || !variable.defs[0] || !variable.defs[0].node)
return null;
if (variable.defs[0].node.type === "TypeAlias")
return variable.defs[0].node.right;
if (variable.defs[0].type === "ImportBinding")
return variable.defs[0].node;
return variable.defs[0].node.init;
}
const COMPAT_TAG_REGEX = /^[a-z]/;
function isDOMComponent(node) {
const name = getElementType(node);
return COMPAT_TAG_REGEX.test(name);
}
function isJSX(node) {
return node && ["JSXElement", "JSXFragment"].includes(node.type);
}
function isWhiteSpaces(value) {
return typeof value === "string" ? /^\s*$/.test(value) : false;
}
function isReturningJSX(ASTnode, context, strict = false, ignoreNull = false) {
const isJSXValue = (node) => {
if (!node)
return false;
switch (node.type) {
case "ConditionalExpression":
if (strict)
return isJSXValue(node.consequent) && isJSXValue(node.alternate);
return isJSXValue(node.consequent) || isJSXValue(node.alternate);
case "LogicalExpression":
if (strict)
return isJSXValue(node.left) && isJSXValue(node.right);
return isJSXValue(node.left) || isJSXValue(node.right);
case "SequenceExpression":
return isJSXValue(node.expressions[node.expressions.length - 1]);
case "JSXElement":
case "JSXFragment":
return true;
case "Literal":
if (!ignoreNull && node.value === null)
return true;
return false;
case "Identifier": {
const variable = findVariableByName(context, node.name);
return isJSX(variable);
}
default:
return false;
}
};
let found = false;
traverseReturns(
ASTnode,
(node, breakTraverse) => {
if (isJSXValue(node)) {
found = true;
breakTraverse();
}
}
);
return found;
}
function getPropName(prop) {
if (!prop.type || prop.type !== "JSXAttribute")
throw new Error("The prop must be a JSXAttribute collected by the AST parser.");
if (prop.name.type === "JSXNamespacedName")
return `${prop.name.namespace.name}:${prop.name.name.name}`;
return prop.name.name;
}
function resolveMemberExpressions(object, property) {
if (object.type === "JSXMemberExpression")
return `${resolveMemberExpressions(object.object, object.property)}.${property.name}`;
return `${object.name}.${property.name}`;
}
function getElementType(node) {
if (node.type === "JSXOpeningFragment")
return "<>";
const { name } = node;
if (!name)
throw new Error("The argument provided is not a JSXElement node.");
if (name.type === "JSXMemberExpression") {
const { object, property } = name;
return resolveMemberExpressions(object, property);
}
if (name.type === "JSXNamespacedName")
return `${name.namespace.name}:${name.name.name}`;
return node.name.name;
}
let segmenter;
function isASCII(value) {
return /^[\u0020-\u007F]*$/u.test(value);
}
function getStringLength(value) {
if (isASCII(value))
return value.length;
segmenter ?? (segmenter = new Intl.Segmenter());
return [...segmenter.segment(value)].length;
}
const NullThrowsReasons = {
MissingParent: "Expected node to have a parent.",
MissingToken: (token, thing) => `Expected to find a ${token} for the ${thing}.`
};
function nullThrows(value, message) {
if (value == null) {
throw new Error(`Non-null Assertion Failed: ${message}`);
}
return value;
}
const KEYWORDS_JS = [
"abstract",
"boolean",
"break",
"byte",
"case",
"catch",
"char",
"class",
"const",
"continue",
"debugger",
"default",
"delete",
"do",
"double",
"else",
"enum",
"export",
"extends",
"false",
"final",
"finally",
"float",
"for",
"function",
"goto",
"if",
"implements",
"import",
"in",
"instanceof",
"int",
"interface",
"long",
"native",
"new",
"null",
"package",
"private",
"protected",
"public",
"return",
"short",
"static",
"super",
"switch",
"synchronized",
"this",
"throw",
"throws",
"transient",
"true",
"try",
"typeof",
"var",
"void",
"volatile",
"while",
"with"
];
var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
class FixTracker {
/**
* Create a new FixTracker.
* @param fixer A ruleFixer instance.
* @param sourceCode A SourceCode object for the current code.
*/
constructor(fixer, sourceCode) {
this.fixer = fixer;
this.sourceCode = sourceCode;
__publicField(this, "retainedRange");
this.retainedRange = null;
}
/**
* Mark the given range as "retained", meaning that other fixes may not
* may not modify this region in the same pass.
* @param range The range to retain.
* @returns The same RuleFixer, for chained calls.
*/
retainRange(range) {
this.retainedRange = range;
return this;
}
/**
* Given a node, find the function containing it (or the entire program) and
* mark it as retained, meaning that other fixes may not modify it in this
* pass. This is useful for avoiding conflicts in fixes that modify control
* flow.
* @param node The node to use as a starting point.
* @returns The same RuleFixer, for chained calls.
*/
retainEnclosingFunction(node) {
const functionNode = getUpperFunction(node);
return this.retainRange(functionNode ? functionNode.range : this.sourceCode.ast.range);
}
/**
* Given a node or token, find the token before and afterward, and mark that
* range as retained, meaning that other fixes may not modify it in this
* pass. This is useful for avoiding conflicts in fixes that make a small
* change to the code where the AST should not be changed.
* @param nodeOrToken The node or token to use as a starting
* point. The token to the left and right are use in the range.
* @returns The same RuleFixer, for chained calls.
*/
retainSurroundingTokens(nodeOrToken) {
const tokenBefore = this.sourceCode.getTokenBefore(nodeOrToken) || nodeOrToken;
const tokenAfter = this.sourceCode.getTokenAfter(nodeOrToken) || nodeOrToken;
return this.retainRange([tokenBefore.range[0], tokenAfter.range[1]]);
}
/**
* Create a fix command that replaces the given range with the given text,
* accounting for any retained ranges.
* @param range The range to remove in the fix.
* @param text The text to insert in place of the range.
* @returns The fix command.
*/
replaceTextRange(range, text) {
let actualRange;
if (this.retainedRange) {
actualRange = [
Math.min(this.retainedRange[0], range[0]),
Math.max(this.retainedRange[1], range[1])
];
} else {
actualRange = range;
}
return this.fixer.replaceTextRange(
actualRange,
this.sourceCode.text.slice(actualRange[0], range[0]) + text + this.sourceCode.text.slice(range[1], actualRange[1])
);
}
/**
* Create a fix command that removes the given node or token, accounting for
* any retained ranges.
* @param nodeOrToken The node or token to remove.
* @returns The fix command.
*/
remove(nodeOrToken) {
return this.replaceTextRange(nodeOrToken.range, "");
}
}
exports.COMMENTS_IGNORE_PATTERN = COMMENTS_IGNORE_PATTERN;
exports.FixTracker = FixTracker;
exports.KEYWORDS_JS = KEYWORDS_JS;
exports.LINEBREAKS = LINEBREAKS;
exports.LINEBREAK_MATCHER = LINEBREAK_MATCHER;
exports.NullThrowsReasons = NullThrowsReasons;
exports.STATEMENT_LIST_PARENTS = STATEMENT_LIST_PARENTS;
exports.canTokensBeAdjacent = canTokensBeAdjacent;
exports.castRuleModule = castRuleModule;
exports.createAllConfigs = createAllConfigs;
exports.createGlobalLinebreakMatcher = createGlobalLinebreakMatcher;
exports.createRule = createRule;
exports.deepMerge = deepMerge;
exports.getElementType = getElementType;
exports.getFirstNodeInLine = getFirstNodeInLine;
exports.getNextLocation = getNextLocation;
exports.getPrecedence = getPrecedence;
exports.getPropName = getPropName;
exports.getStaticPropertyName = getStaticPropertyName;
exports.getStringLength = getStringLength;
exports.getSwitchCaseColonToken = getSwitchCaseColonToken;
exports.getTokenBeforeClosingBracket = getTokenBeforeClosingBracket;
exports.hasOctalOrNonOctalDecimalEscapeSequence = hasOctalOrNonOctalDecimalEscapeSequence;
exports.isArrowToken = isArrowToken;
exports.isClosingBraceToken = isClosingBraceToken;
exports.isClosingBracketToken = isClosingBracketToken;
exports.isClosingParenToken = isClosingParenToken;
exports.isColonToken = isColonToken;
exports.isCommaToken = isCommaToken;
exports.isCommentToken = isCommentToken;
exports.isDOMComponent = isDOMComponent;
exports.isDecimalInteger = isDecimalInteger;
exports.isDecimalIntegerNumericToken = isDecimalIntegerNumericToken;
exports.isEqToken = isEqToken;
exports.isFunction = isFunction;
exports.isJSX = isJSX;
exports.isKeywordToken = isKeywordToken;
exports.isMixedLogicalAndCoalesceExpressions = isMixedLogicalAndCoalesceExpressions;
exports.isNodeFirstInLine = isNodeFirstInLine;
exports.isNotClosingParenToken = isNotClosingParenToken;
exports.isNotCommaToken = isNotCommaToken;
exports.isNotOpeningParenToken = isNotOpeningParenToken;
exports.isNotSemicolonToken = isNotSemicolonToken;
exports.isNumericLiteral = isNumericLiteral;
exports.isOpeningBraceToken = isOpeningBraceToken;
exports.isOpeningBracketToken = isOpeningBracketToken;
exports.isOpeningParenToken = isOpeningParenToken;
exports.isParenthesised = isParenthesised;
exports.isParenthesized = isParenthesized;
exports.isQuestionDotToken = isQuestionDotToken;
exports.isReturningJSX = isReturningJSX;
exports.isSemicolonToken = isSemicolonToken;
exports.isStringLiteral = isStringLiteral;
exports.isSurroundedBy = isSurroundedBy;
exports.isTokenOnSameLine = isTokenOnSameLine;
exports.isTopLevelExpressionStatement = isTopLevelExpressionStatement;
exports.isWhiteSpaces = isWhiteSpaces;
exports.nullThrows = nullThrows;
exports.skipChainExpression = skipChainExpression;
@@ -0,0 +1,9 @@
/**
* The smallest way to encode a character.
*
* @param {number} code
* @returns {string}
*/
export function formatBasic(code) {
return '&#x' + code.toString(16).toUpperCase() + ';'
}
@@ -0,0 +1,84 @@
import log from '../util/log'
export default function normalizeTailwindDirectives(root) {
let tailwindDirectives = new Set()
let layerDirectives = new Set()
let applyDirectives = new Set()
root.walkAtRules((atRule) => {
if (atRule.name === 'apply') {
applyDirectives.add(atRule)
}
if (atRule.name === 'import') {
if (atRule.params === '"tailwindcss/base"' || atRule.params === "'tailwindcss/base'") {
atRule.name = 'tailwind'
atRule.params = 'base'
} else if (
atRule.params === '"tailwindcss/components"' ||
atRule.params === "'tailwindcss/components'"
) {
atRule.name = 'tailwind'
atRule.params = 'components'
} else if (
atRule.params === '"tailwindcss/utilities"' ||
atRule.params === "'tailwindcss/utilities'"
) {
atRule.name = 'tailwind'
atRule.params = 'utilities'
} else if (
atRule.params === '"tailwindcss/screens"' ||
atRule.params === "'tailwindcss/screens'" ||
atRule.params === '"tailwindcss/variants"' ||
atRule.params === "'tailwindcss/variants'"
) {
atRule.name = 'tailwind'
atRule.params = 'variants'
}
}
if (atRule.name === 'tailwind') {
if (atRule.params === 'screens') {
atRule.params = 'variants'
}
tailwindDirectives.add(atRule.params)
}
if (['layer', 'responsive', 'variants'].includes(atRule.name)) {
if (['responsive', 'variants'].includes(atRule.name)) {
log.warn(`${atRule.name}-at-rule-deprecated`, [
`The \`@${atRule.name}\` directive has been deprecated in Tailwind CSS v3.0.`,
`Use \`@layer utilities\` or \`@layer components\` instead.`,
'https://tailwindcss.com/docs/upgrade-guide#replace-variants-with-layer',
])
}
layerDirectives.add(atRule)
}
})
if (
!tailwindDirectives.has('base') ||
!tailwindDirectives.has('components') ||
!tailwindDirectives.has('utilities')
) {
for (let rule of layerDirectives) {
if (rule.name === 'layer' && ['base', 'components', 'utilities'].includes(rule.params)) {
if (!tailwindDirectives.has(rule.params)) {
throw rule.error(
`\`@layer ${rule.params}\` is used but no matching \`@tailwind ${rule.params}\` directive is present.`
)
}
} else if (rule.name === 'responsive') {
if (!tailwindDirectives.has('utilities')) {
throw rule.error('`@responsive` is used but `@tailwind utilities` is missing.')
}
} else if (rule.name === 'variants') {
if (!tailwindDirectives.has('utilities')) {
throw rule.error('`@variants` is used but `@tailwind utilities` is missing.')
}
}
}
}
return { tailwindDirectives, applyDirectives }
}
@@ -0,0 +1,924 @@
flf2a$ 9 3 15 0 5 0 64 0
Font Author: pC wIZARd
Font modified by patorjk to add X character
FIGFont created by patorjk.com's FIGFont Editor: http://patorjk.com/figfont-editor
$   $@
$   $@
$   $@
$   $@
$   $@
$   $@
$   $@
$   $@
$ $@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
.______  @
:      \ @
|   .   |@
|   :   |@
|___|   |@
    |___|@
@
@
@@
._______ @
: __   / @
|  |>  \ @
|  |>   \@
|_______/@
         @
@
@
@@
._______ @
:_.  ___\@
|  : |/\ @
|    /  \@
|. _____/@
 :/      @
 :       @
@
@@
.______  @
:_ _   \ @
|   |   |@
| . |   |@
|. ____/ @
 :/      @
 :       @
@
@@
._______@
: .____/@
| : _/\ @
|   /  \@
|_.: __/@
   :/   @
        @
@
@@
._______@
:_ ____/@
|   _/  @
|   |   @
|_. |   @
  :/    @
  :     @
@
@@
._____  @
:_ ___\ @
|   |___@
|   /  |@
|. __  |@
 :/ |. |@
 :   :/ @
     : @
@@
.___.__  @
:   |  \ @
|   :   |@
|   .   |@
|___|   |@
    |___|@
@
@
@@
.___ @
: __|@
| : |@
|   |@
|   |@
|___|@
@
@
@@
.________ @
:____.   \@
 __|  :/ |@
|     :  |@
 \__. __/ @
    :/    @
    :     @
@
@@
.____/\ @
:   /  \@
|.  ___/@
|     \ @
|      \@
|___\  /@
     \/ @
@
@@
.___    @
|   |   @
|   |   @
|   |/\ @
|   /  \@
|______/@
        @
@
@@
._____.___ @
:         |@
|   \  /  |@
|   |\/   |@
|___| |   |@
      |___|@
           @
@
@@
.______  @
:      \ @
|       |@
|   |   |@
|___|   |@
    |___|@
         @
@
@@
._______  @
: .___  \ @
| :   |  |@
|     :  |@
 \_. ___/ @
   :/     @
   :      @
@
@@
._______ @
: ____  |@
|    :  |@
|   |___|@
|___|    @
         @
         @
@
@@
._______ @
: .___  \ @
| :   |  |@
|     :  |@
 \_____. :@
       :/ @
       : @
@
@@
.______  @
: __   \ @
|  \____|@
|   :  \ @
|   |___\@
|___|    @
@
@
@@
.________@
|    ___/@
|___    \@
|       /@
|__:___/ @
   :     @
@
@
@@
_____._@
\__ _:|@
  |  :|@
  |   |@
  |   |@
  |___|@
       @
@
@@
.____     @
|    |___ @
|    |   |@
|    :   |@
|        |@
|. _____/ @
 :/       @
 :        @
@@
.___     @
|   |___ @
|   |   |@
|   :   |@
 \      |@
  \____/ @
         @
@
@@
         ___ @
.___    |   |@
:   | /\|   |@
|   |/  :   |@
|   /       |@
|______/|___|@
        : @
        : @
@@
 ____   ____@
 \   \_/   /@
  \___ ___/ @
  /   _   \ @
 /___/ \___\@
         @
@
@
@@
 ____   ____@
 \   \_/   /@
  \___ ___/ @
    |   | @
    |___| @
@
@
@
@@
.______ @
\____  |@
/  ____|@
\      |@
 \__:__|@
    :   @
    •   @
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
.______  @
:      \ @
|   .   |@
|   :   |@
|___|   |@
    |___|@
@
@
@@
._______ @
: __   / @
|  |>  \ @
|  |>   \@
|_______/@
         @
@
@
@@
._______ @
:_.  ___\@
|  : |/\ @
|    /  \@
|. _____/@
 :/      @
 :       @
@
@@
.______  @
:_ _   \ @
|   |   |@
| . |   |@
|. ____/ @
 :/      @
 :       @
@
@@
._______@
: .____/@
| : _/\ @
|   /  \@
|_.: __/@
   :/   @
        @
@
@@
._______@
:_ ____/@
|   _/  @
|   |   @
|_. |   @
  :/    @
  :     @
@
@@
._____  @
:_ ___\ @
|   |___@
|   /  |@
|. __  |@
 :/ |. |@
 :   :/ @
     : @
@@
.___.__  @
:   |  \ @
|   :   |@
|   .   |@
|___|   |@
    |___|@
@
@
@@
.___ @
: __|@
| : |@
|   |@
|   |@
|___|@
@
@
@@
.________ @
:____.   \@
 __|  :/ |@
|     :  |@
 \__. __/ @
    :/    @
    :     @
@
@@
.____/\ @
:   /  \@
|.  ___/@
|     \ @
|      \@
|___\  /@
     \/ @
@
@@
.___    @
|   |   @
|   |   @
|   |/\ @
|   /  \@
|______/@
        @
@
@@
._____.___ @
:         |@
|   \  /  |@
|   |\/   |@
|___| |   |@
      |___|@
           @
@
@@
.______  @
:      \ @
|       |@
|   |   |@
|___|   |@
    |___|@
         @
@
@@
._______  @
: .___  \ @
| :   |  |@
|     :  |@
 \_. ___/ @
   :/     @
   :      @
@
@@
._______ @
: ____  |@
|    :  |@
|   |___|@
|___|    @
         @
         @
@
@@
._______ @
: .___  \ @
| :   |  |@
|     :  |@
 \_____. :@
       :/ @
       : @
@
@@
.______  @
: __   \ @
|  \____|@
|   :  \ @
|   |___\@
|___|    @
@
@
@@
.________@
|    ___/@
|___    \@
|       /@
|__:___/ @
   :     @
@
@
@@
_____._@
\__ _:|@
  |  :|@
  |   |@
  |   |@
  |___|@
       @
@
@@
.____     @
|    |___ @
|    |   |@
|    :   |@
|        |@
|. _____/ @
 :/       @
 :        @
@@
.___     @
|   |___ @
|   |   |@
|   :   |@
 \      |@
  \____/ @
         @
@
@@
         ___ @
.___    |   |@
:   | /\|   |@
|   |/  :   |@
|   /       |@
|______/|___|@
        : @
        : @
@@
 ____   ____@
 \   \_/   /@
  \___ ___/ @
  /   _   \ @
 /___/ \___\@
         @
@
@
@@
 ____   ____@
 \   \_/   /@
  \___ ___/ @
    |   | @
    |___| @
@
@
@
@@
.______ @
\____  |@
/  ____|@
\      |@
 \__:__|@
    :   @
    •   @
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@
@
@
@
@
@
@
@
@@
@@ -0,0 +1 @@
{"version":3,"names":["_cloneNode","require","cloneDeep","node","cloneNode"],"sources":["../../src/clone/cloneDeep.ts"],"sourcesContent":["import cloneNode from \"./cloneNode.ts\";\nimport type * as t from \"../index.ts\";\n\n/**\n * Create a deep clone of a `node` and all of it's child nodes\n * including only properties belonging to the node.\n * @deprecated Use t.cloneNode instead.\n */\nexport default function cloneDeep<T extends t.Node>(node: T): T {\n return cloneNode(node);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAQe,SAASC,SAASA,CAAmBC,IAAO,EAAK;EAC9D,OAAO,IAAAC,kBAAS,EAACD,IAAI,CAAC;AACxB","ignoreList":[]}
@@ -0,0 +1,58 @@
'use strict';
var tape = require('tape');
var path = require('../');
tape('path.posix.dirname', function (t) {
t.strictEqual(path.posix.dirname('/a/b/'), '/a');
t.strictEqual(path.posix.dirname('/a/b'), '/a');
t.strictEqual(path.posix.dirname('/a'), '/');
t.strictEqual(path.posix.dirname(''), '.');
t.strictEqual(path.posix.dirname('/'), '/');
t.strictEqual(path.posix.dirname('////'), '/');
t.strictEqual(path.posix.dirname('//a'), '//');
t.strictEqual(path.posix.dirname('foo'), '.');
t.end();
});
tape('path.win32.dirname', { skip: true }, function (t) {
t.strictEqual(path.win32.dirname('c:\\'), 'c:\\');
t.strictEqual(path.win32.dirname('c:\\foo'), 'c:\\');
t.strictEqual(path.win32.dirname('c:\\foo\\'), 'c:\\');
t.strictEqual(path.win32.dirname('c:\\foo\\bar'), 'c:\\foo');
t.strictEqual(path.win32.dirname('c:\\foo\\bar\\'), 'c:\\foo');
t.strictEqual(path.win32.dirname('c:\\foo\\bar\\baz'), 'c:\\foo\\bar');
t.strictEqual(path.win32.dirname('\\'), '\\');
t.strictEqual(path.win32.dirname('\\foo'), '\\');
t.strictEqual(path.win32.dirname('\\foo\\'), '\\');
t.strictEqual(path.win32.dirname('\\foo\\bar'), '\\foo');
t.strictEqual(path.win32.dirname('\\foo\\bar\\'), '\\foo');
t.strictEqual(path.win32.dirname('\\foo\\bar\\baz'), '\\foo\\bar');
t.strictEqual(path.win32.dirname('c:'), 'c:');
t.strictEqual(path.win32.dirname('c:foo'), 'c:');
t.strictEqual(path.win32.dirname('c:foo\\'), 'c:');
t.strictEqual(path.win32.dirname('c:foo\\bar'), 'c:foo');
t.strictEqual(path.win32.dirname('c:foo\\bar\\'), 'c:foo');
t.strictEqual(path.win32.dirname('c:foo\\bar\\baz'), 'c:foo\\bar');
t.strictEqual(path.win32.dirname('file:stream'), '.');
t.strictEqual(path.win32.dirname('dir\\file:stream'), 'dir');
t.strictEqual(path.win32.dirname('\\\\unc\\share'),
'\\\\unc\\share');
t.strictEqual(path.win32.dirname('\\\\unc\\share\\foo'),
'\\\\unc\\share\\');
t.strictEqual(path.win32.dirname('\\\\unc\\share\\foo\\'),
'\\\\unc\\share\\');
t.strictEqual(path.win32.dirname('\\\\unc\\share\\foo\\bar'),
'\\\\unc\\share\\foo');
t.strictEqual(path.win32.dirname('\\\\unc\\share\\foo\\bar\\'),
'\\\\unc\\share\\foo');
t.strictEqual(path.win32.dirname('\\\\unc\\share\\foo\\bar\\baz'),
'\\\\unc\\share\\foo\\bar');
t.strictEqual(path.win32.dirname('/a/b/'), '/a');
t.strictEqual(path.win32.dirname('/a/b'), '/a');
t.strictEqual(path.win32.dirname('/a'), '/');
t.strictEqual(path.win32.dirname(''), '.');
t.strictEqual(path.win32.dirname('/'), '/');
t.strictEqual(path.win32.dirname('////'), '/');
t.strictEqual(path.win32.dirname('foo'), '.');
t.end();
});
@@ -0,0 +1,36 @@
"use strict"
const {
definePrototypeMethodHandler,
} = require("../util/define-prototype-method-handler")
module.exports = {
meta: {
docs: {
description:
"disallow the `NumberFormat.prototype.formatToParts` method.",
category: "ES2018-Intl-API",
recommended: false,
url: "http://eslint-community.github.io/eslint-plugin-es-x/rules/no-intl-numberformat-prototype-formattoparts.html",
},
fixable: null,
messages: {
forbidden: "ES2018 Intl API '{{name}}' method is forbidden.",
},
schema: [
{
type: "object",
properties: {
aggressive: { type: "boolean" },
},
additionalProperties: false,
},
],
type: "problem",
},
create(context) {
return definePrototypeMethodHandler(context, {
"Intl.NumberFormat": ["formatToParts"],
})
},
}
@@ -0,0 +1,46 @@
import { expect, expectTypeOf, test } from "vitest";
import * as z from "zod/v3";
test("test", () => {
expect(true).toBe(true);
});
test("test2", () => {
expect(() => z.string().parse(234)).toThrowErrorMatchingInlineSnapshot(`
[ZodError: [
{
"code": "invalid_type",
"expected": "string",
"received": "number",
"path": [],
"message": "Expected string, received number"
}
]]
`);
});
test("async validation", async () => {
const testTuple = z
.tuple([z.string().refine(async () => true), z.number().refine(async () => true)])
.refine(async () => true);
expectTypeOf<typeof testTuple._output>().toEqualTypeOf<[string, number]>();
const val = await testTuple.parseAsync(["asdf", 1234]);
expect(val).toEqual(val);
const r1 = await testTuple.safeParseAsync(["asdf", "asdf"]);
expect(r1.success).toEqual(false);
expect(r1.error!).toMatchInlineSnapshot(`
[ZodError: [
{
"code": "invalid_type",
"expected": "number",
"received": "string",
"path": [
1
],
"message": "Expected number, received string"
}
]]
`);
});
@@ -0,0 +1,45 @@
If you're still using class components, you can use the [`<Dropzone>`](https://react-dropzone.js.org/#components) component provided by the lib:
```jsx harmony
import React, {Component} from 'react';
import Dropzone from 'react-dropzone';
class Basic extends Component {
constructor() {
super();
this.onDrop = (files) => {
this.setState({files})
};
this.state = {
files: []
};
}
render() {
const files = this.state.files.map(file => (
<li key={file.name}>
{file.name} - {file.size} bytes
</li>
));
return (
<Dropzone onDrop={this.onDrop}>
{({getRootProps, getInputProps}) => (
<section className="container">
<div {...getRootProps({className: 'dropzone'})}>
<input {...getInputProps()} />
<p>Drag 'n' drop some files here, or click to select files</p>
</div>
<aside>
<h4>Files</h4>
<ul>{files}</ul>
</aside>
</section>
)}
</Dropzone>
);
}
}
<Basic />
```
@@ -0,0 +1 @@
{"name":"data-view-buffer","version":"1.0.2","requiresBuild":false,"files":{".eslintrc":{"checkedAt":1794532096471,"integrity":"sha512-4L4Jg1xOyPbrv+Ytqq0LWlt3eZC+Z2Ay+tjYeHuUp/rCwcsVyc1GweZApqIFLp/Z1gqBbS6958FBH76WtyaucQ==","mode":420,"size":184},".nycrc":{"checkedAt":1794532096600,"integrity":"sha512-42sgwWzusJB1Dzhl78jX/Zg65Oi0HDDMOGXS/Uklv1kCYn4fHtRsD/JFPwdu+d40vome9XdUspzRWEQAcTGEeQ==","mode":420,"size":216},"LICENSE":{"checkedAt":1794532096600,"integrity":"sha512-9CCWKHOyAcobQT+fPtmiq2F2+xkrIWD+4MQshpA5agEGKdLA+jCQ3LpOf7KqU2TmrzLa8AoocMeOs+/AxmpiBQ==","mode":420,"size":1071},"index.js":{"checkedAt":1794532096600,"integrity":"sha512-CyU38VC6R8J81370pnmlQbsFednt3bXnqbXfz2+09ymCC/ki/6+rRAtbTpNqsa7t+CT5Tgzvu27ff8PxuXsB5Q==","mode":420,"size":485},"test/index.js":{"checkedAt":1794532096600,"integrity":"sha512-ar5kXJ7WphNstRBf/Yv/FNeQ6hGP/talEKe6L2ysyueVt5t1NrJ0kStXE6TazvZIVMrvQodAkN571eYT4aKBjQ==","mode":420,"size":959},"package.json":{"checkedAt":1794532096600,"integrity":"sha512-lgIwppKhp0Yy+jk3+ei0gUuEJUQOm7HWDiZEpXhi8qadzUDx4uIKrA8Af6b3nu6DD1BYPXJFb3+M4bI9SyRxBA==","mode":420,"size":2352},"tsconfig.json":{"checkedAt":1794532096600,"integrity":"sha512-uV1qsEcdBJF9nBhwvyNFvCs76VYVcvkjBntJU8ghm+pFvMXY6UVDG73Y45A2uTL3JTNhGWnXaxXuOpo9yVymEw==","mode":420,"size":264},"CHANGELOG.md":{"checkedAt":1794532096601,"integrity":"sha512-dt0ntlKM3sCmqGivHtcXYbyB+sTjG4pwxvh1NeJyKEsQQEWfmawy49g2CFVjaWl1IdiXS4rshqtfntQEMkFcNA==","mode":420,"size":3108},"README.md":{"checkedAt":1794532096601,"integrity":"sha512-Ns3K4tm8+X2rvkCejY0YyYNrZPT+c4mh94WbwwPAnNQmBHdZ/3uWUVGs1N/q8w0i9rmgboquS4Qt0/ewO6/zIA==","mode":420,"size":1978},"index.d.ts":{"checkedAt":1794532096601,"integrity":"sha512-TKzlV27rtt+eDCVT3hHIciz6vaAtyIv8Z0nbF9frdj2sOyo5SifUElTmosLHL6LA+Gkqj66gVBUr0IZh6/YF+Q==","mode":420,"size":144},".github/FUNDING.yml":{"checkedAt":1794532096601,"integrity":"sha512-RCT1cNUTwaptuuVJtbor8yZlFG1AEahsVVEBbFYegs+6nqRA2D8B91WseaKd9AT/xq0iMbr2JLCPZyxT9PNyCQ==","mode":420,"size":562}}}
@@ -0,0 +1,37 @@
{
"name": "indent-string",
"version": "4.0.0",
"description": "Indent each line in a string",
"license": "MIT",
"repository": "sindresorhus/indent-string",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=8"
},
"scripts": {
"test": "xo && ava && tsd"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"indent",
"string",
"pad",
"align",
"line",
"text",
"each",
"every"
],
"devDependencies": {
"ava": "^1.4.1",
"tsd": "^0.7.2",
"xo": "^0.24.0"
}
}
@@ -0,0 +1,126 @@
import type { $ZodStringFormats } from "../core/checks.js";
import type * as errors from "../core/errors.js";
import * as util from "../core/util.js";
const error: () => errors.$ZodErrorMap = () => {
const Sizable: Record<string, { unit: string; verb: string }> = {
string: { unit: "karakter", verb: "legyen" },
file: { unit: "byte", verb: "legyen" },
array: { unit: "elem", verb: "legyen" },
set: { unit: "elem", verb: "legyen" },
};
function getSizing(origin: string): { unit: string; verb: string } | null {
return Sizable[origin] ?? null;
}
const parsedType = (data: any): string => {
const t = typeof data;
switch (t) {
case "number": {
return Number.isNaN(data) ? "NaN" : "szám";
}
case "object": {
if (Array.isArray(data)) {
return "tömb";
}
if (data === null) {
return "null";
}
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
return data.constructor.name;
}
}
}
return t;
};
const Nouns: {
[k in $ZodStringFormats | (string & {})]?: string;
} = {
regex: "bemenet",
email: "email cím",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "ISO időbélyeg",
date: "ISO dátum",
time: "ISO idő",
duration: "ISO időintervallum",
ipv4: "IPv4 cím",
ipv6: "IPv6 cím",
cidrv4: "IPv4 tartomány",
cidrv6: "IPv6 tartomány",
base64: "base64-kódolt string",
base64url: "base64url-kódolt string",
json_string: "JSON string",
e164: "E.164 szám",
jwt: "JWT",
template_literal: "bemenet",
};
return (issue) => {
switch (issue.code) {
case "invalid_type":
return `Érvénytelen bemenet: a várt érték ${issue.expected}, a kapott érték ${parsedType(issue.input)}`;
// return `Invalid input: expected ${issue.expected}, received ${util.getParsedType(issue.input)}`;
case "invalid_value":
if (issue.values.length === 1)
return `Érvénytelen bemenet: a várt érték ${util.stringifyPrimitive(issue.values[0])}`;
return `Érvénytelen opció: valamelyik érték várt ${util.joinValues(issue.values, "|")}`;
case "too_big": {
const adj = issue.inclusive ? "<=" : "<";
const sizing = getSizing(issue.origin);
if (sizing)
return `Túl nagy: ${issue.origin ?? "érték"} mérete túl nagy ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elem"}`;
return `Túl nagy: a bemeneti érték ${issue.origin ?? "érték"} túl nagy: ${adj}${issue.maximum.toString()}`;
}
case "too_small": {
const adj = issue.inclusive ? ">=" : ">";
const sizing = getSizing(issue.origin);
if (sizing) {
return `Túl kicsi: a bemeneti érték ${issue.origin} mérete túl kicsi ${adj}${issue.minimum.toString()} ${sizing.unit}`;
}
return `Túl kicsi: a bemeneti érték ${issue.origin} túl kicsi ${adj}${issue.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue as errors.$ZodStringFormatIssues;
if (_issue.format === "starts_with") return `Érvénytelen string: "${_issue.prefix}" értékkel kell kezdődnie`;
if (_issue.format === "ends_with") return `Érvénytelen string: "${_issue.suffix}" értékkel kell végződnie`;
if (_issue.format === "includes") return `Érvénytelen string: "${_issue.includes}" értéket kell tartalmaznia`;
if (_issue.format === "regex") return `Érvénytelen string: ${_issue.pattern} mintának kell megfelelnie`;
return `Érvénytelen ${Nouns[_issue.format] ?? issue.format}`;
}
case "not_multiple_of":
return `Érvénytelen szám: ${issue.divisor} többszörösének kell lennie`;
case "unrecognized_keys":
return `Ismeretlen kulcs${issue.keys.length > 1 ? "s" : ""}: ${util.joinValues(issue.keys, ", ")}`;
case "invalid_key":
return `Érvénytelen kulcs ${issue.origin}`;
case "invalid_union":
return "Érvénytelen bemenet";
case "invalid_element":
return `Érvénytelen érték: ${issue.origin}`;
default:
return `Érvénytelen bemenet`;
}
};
};
export default function (): { localeError: errors.$ZodErrorMap } {
return {
localeError: error(),
};
}
@@ -0,0 +1 @@
!function(e,a){"object"==typeof exports&&"undefined"!=typeof module?module.exports=a(require("dayjs")):"function"==typeof define&&define.amd?define(["dayjs"],a):(e="undefined"!=typeof globalThis?globalThis:e||self).dayjs_locale_en_ca=a(e.dayjs)}(this,(function(e){"use strict";function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var _=a(e),t={name:"en-ca",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),ordinal:function(e){return e},formats:{LT:"h:mm A",LTS:"h:mm:ss A",L:"YYYY-MM-DD",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"}};return _.default.locale(t,null,!0),t}));
@@ -0,0 +1,44 @@
{
"name": "@react-aria/toggle",
"version": "3.12.2",
"description": "Spectrum UI components in React",
"license": "Apache-2.0",
"main": "dist/main.js",
"module": "dist/module.js",
"exports": {
"source": "./src/index.ts",
"types": [
"./dist/types.d.ts",
"./src/index.ts"
],
"import": "./dist/import.mjs",
"require": "./dist/main.js"
},
"types": "dist/types.d.ts",
"source": "src/index.ts",
"files": [
"dist",
"src"
],
"sideEffects": false,
"repository": {
"type": "git",
"url": "https://github.com/adobe/react-spectrum"
},
"dependencies": {
"@react-aria/interactions": "^3.25.6",
"@react-aria/utils": "^3.31.0",
"@react-stately/toggle": "^3.9.2",
"@react-types/checkbox": "^3.10.2",
"@react-types/shared": "^3.32.1",
"@swc/helpers": "^0.5.0"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
},
"publishConfig": {
"access": "public"
},
"gitHead": "0bda51183baa23306342af32a82012ea0fe0f2dc"
}
@@ -0,0 +1,2 @@
import type { LibDefinition } from '../variable';
export declare const es2024_collection: LibDefinition;
@@ -0,0 +1,38 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.clear = clear;
exports.clearPath = clearPath;
exports.clearScope = clearScope;
exports.getCachedPaths = getCachedPaths;
exports.getOrCreateCachedPaths = getOrCreateCachedPaths;
exports.scope = exports.path = void 0;
let pathsCache = exports.path = new WeakMap();
let scope = exports.scope = new WeakMap();
function clear() {
clearPath();
clearScope();
}
function clearPath() {
exports.path = pathsCache = new WeakMap();
}
function clearScope() {
exports.scope = scope = new WeakMap();
}
function getCachedPaths(path) {
const {
parent,
parentPath
} = path;
return pathsCache.get(parent);
}
function getOrCreateCachedPaths(node, parentPath) {
;
let paths = pathsCache.get(node);
if (!paths) pathsCache.set(node, paths = new Map());
return paths;
}
//# sourceMappingURL=cache.js.map
@@ -0,0 +1,20 @@
import React from "react";
import Dropzone from "../../";
export const dropzone = (
<Dropzone
onDrop={(files) => console.log(files)}
onFileDialogCancel={() => console.log("onFileDialogCancel invoked")}
onFileDialogOpen={() => console.log("onFileDialogOpen invoked")}
>
{({ getRootProps, getInputProps, open }) => (
<div {...getRootProps()}>
<input {...getInputProps()} />
<p>Drop some files here.</p>
<button type="button" onClick={open}>
Open file dialog
</button>
</div>
)}
</Dropzone>
);
@@ -0,0 +1,3 @@
import type { Plugin } from '../types';
declare const useThrottlePlugin: Plugin<any, any[]>;
export default useThrottlePlugin;
@@ -0,0 +1 @@
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("dayjs")):"function"==typeof define&&define.amd?define(["dayjs"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).dayjs_locale_sv=t(e.dayjs)}(this,(function(e){"use strict";function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=t(e),d={name:"sv",weekdays:"söndag_måndag_tisdag_onsdag_torsdag_fredag_lördag".split("_"),weekdaysShort:"sön_mån_tis_ons_tor_fre_lör".split("_"),weekdaysMin:"sö_må_ti_on_to_fr_lö".split("_"),months:"januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december".split("_"),monthsShort:"jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec".split("_"),weekStart:1,yearStart:4,ordinal:function(e){var t=e%10;return"["+e+(1===t||2===t?"a":"e")+"]"},formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY [kl.] HH:mm",LLLL:"dddd D MMMM YYYY [kl.] HH:mm",lll:"D MMM YYYY HH:mm",llll:"ddd D MMM YYYY HH:mm"},relativeTime:{future:"om %s",past:"för %s sedan",s:"några sekunder",m:"en minut",mm:"%d minuter",h:"en timme",hh:"%d timmar",d:"en dag",dd:"%d dagar",M:"en månad",MM:"%d månader",y:"ett år",yy:"%d år"}};return a.default.locale(d,null,!0),d}));
@@ -0,0 +1 @@
export { _ as default } from "../esm/_skip_first_generator_next.js";
@@ -0,0 +1,44 @@
'use strict'
// map types from key to human-friendly name
exports.name = new Map([
['0', 'File'],
// same as File
['', 'OldFile'],
['1', 'Link'],
['2', 'SymbolicLink'],
// Devices and FIFOs aren't fully supported
// they are parsed, but skipped when unpacking
['3', 'CharacterDevice'],
['4', 'BlockDevice'],
['5', 'Directory'],
['6', 'FIFO'],
// same as File
['7', 'ContiguousFile'],
// pax headers
['g', 'GlobalExtendedHeader'],
['x', 'ExtendedHeader'],
// vendor-specific stuff
// skip
['A', 'SolarisACL'],
// like 5, but with data, which should be skipped
['D', 'GNUDumpDir'],
// metadata only, skip
['I', 'Inode'],
// data = link path of next file
['K', 'NextFileHasLongLinkpath'],
// data = path of next file
['L', 'NextFileHasLongPath'],
// skip
['M', 'ContinuationFile'],
// like L
['N', 'OldGnuLongPath'],
// skip
['S', 'SparseFile'],
// skip
['V', 'TapeVolumeHeader'],
// like x
['X', 'OldExtendedHeader'],
])
// map the other direction
exports.code = new Map(Array.from(exports.name).map(kv => [kv[1], kv[0]]))
@@ -0,0 +1,10 @@
/**
* @fileoverview exports for browsers
* @author 唯然<weiran.zsd@outlook.com>
*/
"use strict";
const { Linter } = require("./linter/linter");
module.exports = { Linter };
@@ -0,0 +1,31 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var scrollbarRole = {
abstract: false,
accessibleNameRequired: false,
baseConcepts: [],
childrenPresentational: true,
nameFrom: ['author'],
prohibitedProps: [],
props: {
'aria-disabled': null,
'aria-valuetext': null,
'aria-orientation': 'vertical',
'aria-valuemax': '100',
'aria-valuemin': '0'
},
relatedConcepts: [],
requireContextRole: [],
requiredContextRole: [],
requiredOwnedElements: [],
requiredProps: {
'aria-controls': null,
'aria-valuenow': null
},
superClass: [['roletype', 'structure', 'range'], ['roletype', 'widget']]
};
var _default = exports.default = scrollbarRole;
@@ -0,0 +1,478 @@
import { isPrimitive, notNullish } from './helpers.js';
import { r as resolve } from './chunk-pathe.M-eThtNZ.js';
import './constants.js';
// src/vlq.ts
var comma = ",".charCodeAt(0);
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var intToChar = new Uint8Array(64);
var charToInt = new Uint8Array(128);
for (let i = 0; i < chars.length; i++) {
const c = chars.charCodeAt(i);
intToChar[i] = c;
charToInt[c] = i;
}
function decodeInteger(reader, relative) {
let value = 0;
let shift = 0;
let integer = 0;
do {
const c = reader.next();
integer = charToInt[c];
value |= (integer & 31) << shift;
shift += 5;
} while (integer & 32);
const shouldNegate = value & 1;
value >>>= 1;
if (shouldNegate) {
value = -2147483648 | -value;
}
return relative + value;
}
function hasMoreVlq(reader, max) {
if (reader.pos >= max) return false;
return reader.peek() !== comma;
}
var StringReader = class {
constructor(buffer) {
this.pos = 0;
this.buffer = buffer;
}
next() {
return this.buffer.charCodeAt(this.pos++);
}
peek() {
return this.buffer.charCodeAt(this.pos);
}
indexOf(char) {
const { buffer, pos } = this;
const idx = buffer.indexOf(char, pos);
return idx === -1 ? buffer.length : idx;
}
};
// src/sourcemap-codec.ts
function decode(mappings) {
const { length } = mappings;
const reader = new StringReader(mappings);
const decoded = [];
let genColumn = 0;
let sourcesIndex = 0;
let sourceLine = 0;
let sourceColumn = 0;
let namesIndex = 0;
do {
const semi = reader.indexOf(";");
const line = [];
let sorted = true;
let lastCol = 0;
genColumn = 0;
while (reader.pos < semi) {
let seg;
genColumn = decodeInteger(reader, genColumn);
if (genColumn < lastCol) sorted = false;
lastCol = genColumn;
if (hasMoreVlq(reader, semi)) {
sourcesIndex = decodeInteger(reader, sourcesIndex);
sourceLine = decodeInteger(reader, sourceLine);
sourceColumn = decodeInteger(reader, sourceColumn);
if (hasMoreVlq(reader, semi)) {
namesIndex = decodeInteger(reader, namesIndex);
seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];
} else {
seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];
}
} else {
seg = [genColumn];
}
line.push(seg);
reader.pos++;
}
if (!sorted) sort(line);
decoded.push(line);
reader.pos = semi + 1;
} while (reader.pos <= length);
return decoded;
}
function sort(line) {
line.sort(sortComparator);
}
function sortComparator(a, b) {
return a[0] - b[0];
}
// src/trace-mapping.ts
// src/sourcemap-segment.ts
var COLUMN = 0;
var SOURCES_INDEX = 1;
var SOURCE_LINE = 2;
var SOURCE_COLUMN = 3;
var NAMES_INDEX = 4;
// 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 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/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;
function cast(map) {
return map;
}
function decodedMappings(map) {
var _a;
return (_a = cast(map))._decoded || (_a._decoded = decode(cast(map)._encoded));
}
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 OMapping(source, line, column, name) {
return { source, line, column, name };
}
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;
}
const CHROME_IE_STACK_REGEXP = /^\s*at .*(?:\S:\d+|\(native\))/m;
const SAFARI_NATIVE_CODE_REGEXP = /^(?:eval@)?(?:\[native code\])?$/;
const stackIgnorePatterns = [
"node:internal",
/\/packages\/\w+\/dist\//,
/\/@vitest\/\w+\/dist\//,
"/vitest/dist/",
"/vitest/src/",
"/node_modules/chai/",
"/node_modules/tinyspy/",
"/vite/dist/node/module-runner",
"/rolldown-vite/dist/node/module-runner",
"/deps/chunk-",
"/deps/@vitest",
"/deps/loupe",
"/deps/chai",
"/browser-playwright/dist/locators.js",
"/browser-webdriverio/dist/locators.js",
"/browser-preview/dist/locators.js",
/node:\w+/,
/__vitest_test__/,
/__vitest_browser__/,
/\/deps\/vitest_/
];
function extractLocation(urlLike) {
// Fail-fast but return locations like "(native)"
if (!urlLike.includes(":")) {
return [urlLike];
}
const regExp = /(.+?)(?::(\d+))?(?::(\d+))?$/;
const parts = regExp.exec(urlLike.replace(/^\(|\)$/g, ""));
if (!parts) {
return [urlLike];
}
let url = parts[1];
if (url.startsWith("async ")) {
url = url.slice(6);
}
if (url.startsWith("http:") || url.startsWith("https:")) {
const urlObj = new URL(url);
urlObj.searchParams.delete("import");
urlObj.searchParams.delete("browserv");
url = urlObj.pathname + urlObj.hash + urlObj.search;
}
if (url.startsWith("/@fs/")) {
const isWindows = /^\/@fs\/[a-zA-Z]:\//.test(url);
url = url.slice(isWindows ? 5 : 4);
}
return [
url,
parts[2] || undefined,
parts[3] || undefined
];
}
function parseSingleFFOrSafariStack(raw) {
let line = raw.trim();
if (SAFARI_NATIVE_CODE_REGEXP.test(line)) {
return null;
}
if (line.includes(" > eval")) {
line = line.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ":$1");
}
// Early return for lines that don't look like Firefox/Safari stack traces
// Firefox/Safari stack traces must contain '@' and should have location info after it
if (!line.includes("@")) {
return null;
}
// Find the correct @ that separates function name from location
// For cases like '@https://@fs/path' or 'functionName@https://@fs/path'
// we need to find the first @ that precedes a valid location (containing :)
let atIndex = -1;
let locationPart = "";
let functionName;
// Try each @ from left to right to find the one that gives us a valid location
for (let i = 0; i < line.length; i++) {
if (line[i] === "@") {
const candidateLocation = line.slice(i + 1);
// Minimum length 3 for valid location: 1 for filename + 1 for colon + 1 for line number (e.g., "a:1")
if (candidateLocation.includes(":") && candidateLocation.length >= 3) {
atIndex = i;
locationPart = candidateLocation;
functionName = i > 0 ? line.slice(0, i) : undefined;
break;
}
}
}
// Validate we found a valid location with minimum length (filename:line format)
if (atIndex === -1 || !locationPart.includes(":") || locationPart.length < 3) {
return null;
}
const [url, lineNumber, columnNumber] = extractLocation(locationPart);
if (!url || !lineNumber || !columnNumber) {
return null;
}
return {
file: url,
method: functionName || "",
line: Number.parseInt(lineNumber),
column: Number.parseInt(columnNumber)
};
}
function parseSingleStack(raw) {
const line = raw.trim();
if (!CHROME_IE_STACK_REGEXP.test(line)) {
return parseSingleFFOrSafariStack(line);
}
return parseSingleV8Stack(line);
}
// Based on https://github.com/stacktracejs/error-stack-parser
// Credit to stacktracejs
function parseSingleV8Stack(raw) {
let line = raw.trim();
if (!CHROME_IE_STACK_REGEXP.test(line)) {
return null;
}
if (line.includes("(eval ")) {
line = line.replace(/eval code/g, "eval").replace(/(\(eval at [^()]*)|(,.*$)/g, "");
}
let sanitizedLine = line.replace(/^\s+/, "").replace(/\(eval code/g, "(").replace(/^.*?\s+/, "");
// capture and preserve the parenthesized location "(/foo/my bar.js:12:87)" in
// case it has spaces in it, as the string is split on \s+ later on
const location = sanitizedLine.match(/ (\(.+\)$)/);
// remove the parenthesized location from the line, if it was matched
sanitizedLine = location ? sanitizedLine.replace(location[0], "") : sanitizedLine;
// if a location was matched, pass it to extractLocation() otherwise pass all sanitizedLine
// because this line doesn't have function name
const [url, lineNumber, columnNumber] = extractLocation(location ? location[1] : sanitizedLine);
let method = location && sanitizedLine || "";
let file = url && ["eval", "<anonymous>"].includes(url) ? undefined : url;
if (!file || !lineNumber || !columnNumber) {
return null;
}
if (method.startsWith("async ")) {
method = method.slice(6);
}
if (file.startsWith("file://")) {
file = file.slice(7);
}
// normalize Windows path (\ -> /)
file = file.startsWith("node:") || file.startsWith("internal:") ? file : resolve(file);
if (method) {
method = method.replace(/__vite_ssr_import_\d+__\./g, "").replace(/(Object\.)?__vite_ssr_export_default__\s?/g, "");
}
return {
method,
file,
line: Number.parseInt(lineNumber),
column: Number.parseInt(columnNumber)
};
}
function createStackString(stacks) {
return stacks.map((stack) => {
const line = `${stack.file}:${stack.line}:${stack.column}`;
if (stack.method) {
return ` at ${stack.method}(${line})`;
}
return ` at ${line}`;
}).join("\n");
}
function parseStacktrace(stack, options = {}) {
const { ignoreStackEntries = stackIgnorePatterns } = options;
const stacks = !CHROME_IE_STACK_REGEXP.test(stack) ? parseFFOrSafariStackTrace(stack) : parseV8Stacktrace(stack);
return stacks.map((stack) => {
var _options$getSourceMap;
if (options.getUrlId) {
stack.file = options.getUrlId(stack.file);
}
const map = (_options$getSourceMap = options.getSourceMap) === null || _options$getSourceMap === void 0 ? void 0 : _options$getSourceMap.call(options, stack.file);
if (!map || typeof map !== "object" || !map.version) {
return shouldFilter(ignoreStackEntries, stack.file) ? null : stack;
}
const traceMap = new DecodedMap(map, stack.file);
const position = getOriginalPosition(traceMap, stack);
if (!position) {
return stack;
}
const { line, column, source, name } = position;
let file = source || stack.file;
if (file.match(/\/\w:\//)) {
file = file.slice(1);
}
if (shouldFilter(ignoreStackEntries, file)) {
return null;
}
if (line != null && column != null) {
return {
line,
column,
file,
method: name || stack.method
};
}
return stack;
}).filter((s) => s != null);
}
function shouldFilter(ignoreStackEntries, file) {
return ignoreStackEntries.some((p) => file.match(p));
}
function parseFFOrSafariStackTrace(stack) {
return stack.split("\n").map((line) => parseSingleFFOrSafariStack(line)).filter(notNullish);
}
function parseV8Stacktrace(stack) {
return stack.split("\n").map((line) => parseSingleV8Stack(line)).filter(notNullish);
}
function parseErrorStacktrace(e, options = {}) {
if (!e || isPrimitive(e)) {
return [];
}
if ("stacks" in e && e.stacks) {
return e.stacks;
}
const stackStr = e.stack || "";
// if "stack" property was overwritten at runtime to be something else,
// ignore the value because we don't know how to process it
let stackFrames = typeof stackStr === "string" ? parseStacktrace(stackStr, options) : [];
if (!stackFrames.length) {
const e_ = e;
if (e_.fileName != null && e_.lineNumber != null && e_.columnNumber != null) {
stackFrames = parseStacktrace(`${e_.fileName}:${e_.lineNumber}:${e_.columnNumber}`, options);
}
if (e_.sourceURL != null && e_.line != null && e_._column != null) {
stackFrames = parseStacktrace(`${e_.sourceURL}:${e_.line}:${e_.column}`, options);
}
}
if (options.frameFilter) {
stackFrames = stackFrames.filter((f) => options.frameFilter(e, f) !== false);
}
e.stacks = stackFrames;
return stackFrames;
}
class DecodedMap {
_encoded;
_decoded;
_decodedMemo;
url;
version;
names = [];
resolvedSources;
constructor(map, from) {
this.map = map;
const { mappings, names, sources } = map;
this.version = map.version;
this.names = names || [];
this._encoded = mappings || "";
this._decodedMemo = memoizedState();
this.url = from;
this.resolvedSources = (sources || []).map((s) => resolve(s || "", from));
}
}
function memoizedState() {
return {
lastKey: -1,
lastNeedle: -1,
lastIndex: -1
};
}
function getOriginalPosition(map, needle) {
const result = originalPositionFor(map, needle);
if (result.column == null) {
return null;
}
return result;
}
export { DecodedMap, createStackString, stackIgnorePatterns as defaultStackIgnorePatterns, getOriginalPosition, parseErrorStacktrace, parseSingleFFOrSafariStack, parseSingleStack, parseSingleV8Stack, parseStacktrace };
@@ -0,0 +1,29 @@
import baseRest from './_baseRest.js';
import pullAll from './pullAll.js';
/**
* Removes all given values from `array` using
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons.
*
* **Note:** Unlike `_.without`, this method mutates `array`. Use `_.remove`
* to remove elements from an array by predicate.
*
* @static
* @memberOf _
* @since 2.0.0
* @category Array
* @param {Array} array The array to modify.
* @param {...*} [values] The values to remove.
* @returns {Array} Returns `array`.
* @example
*
* var array = ['a', 'b', 'c', 'a', 'b', 'c'];
*
* _.pull(array, 'a', 'c');
* console.log(array);
* // => ['b', 'b']
*/
var pull = baseRest(pullAll);
export default pull;
@@ -0,0 +1,3 @@
# @react-stately/utils
This package is part of [react-spectrum](https://github.com/adobe/react-spectrum). See the repo for more details.
@@ -0,0 +1 @@
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AA6BM,SAAS,0CAAU,KAAsB,EAAE,KAAkB,EAAE,GAAuC;IAC3G,IAAI,cACF,aAAa,mBACb,aAAa,cACb,KAAK,QACL,IAAI,QACJ,IAAI,YACJ,QAAQ,EACR,cAAc,SAAS,EACvB,mBAAmB,cAAc,mBACjC,kBAAkB,oBAClB,SAAS,gBACT,YAAY,cACZ,UAAU,iBACV,aAAa,WACb,OAAO,aACP,SAAS,WACT,OAAO,EACR,GAAG;IAEJ,IAAI,WAAW,CAAC;QACd,iFAAiF;QACjF,wEAAwE;QACxE,EAAE,eAAe;QACjB,MAAM,WAAW,CAAC,EAAE,MAAM,CAAC,OAAO;IACpC;IAEA,IAAI,cAAc,YAAY;IAC9B,IAAI,eAAe,aAAa,QAAQ,kBAAkB;IAC1D,IAAI,CAAC,eAAe,CAAC,gBAAgB,QAAQ,GAAG,CAAC,QAAQ,KAAK,cAC5D,QAAQ,IAAI,CAAC;IAGf,uFAAuF;IACvF,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,qCAAO,EAAE;sBACrC;oBACA;uBACA;iBACA;mBACA;iBACA;oBACA;IACF;IAEA,mCAAmC;IACnC,IAAI,EAAC,YAAY,UAAU,EAAE,WAAW,cAAc,EAAC,GAAG,CAAA,GAAA,qCAAO,EAAE;sBACjE;oBACA;uBACA;mBACA;iBACA;QACA,SAAQ,CAAC;gBAGP;YAFA,oBAAA,8BAAA,QAAU;YACV,MAAM,MAAM;aACZ,eAAA,IAAI,OAAO,cAAX,mCAAA,aAAa,KAAK;QACpB;QACA,YAAY,cAAc;IAC5B;IAEA,IAAI,kBAAC,cAAc,EAAC,GAAG,CAAA,GAAA,yCAAW,EAAE,OAAO;IAC3C,IAAI,eAAe,CAAA,GAAA,gCAAS,EAAE,YAAY;IAC1C,IAAI,WAAW,CAAA,GAAA,oCAAa,EAAE,OAAO;QAAC,WAAW;IAAI;IAErD,CAAA,GAAA,kCAAW,EAAE,KAAK,MAAM,eAAe,EAAE,MAAM,WAAW;IAE1D,OAAO;QACL,YAAY,CAAA,GAAA,gCAAS,EAAE,YAAY;YAAC,SAAS,CAAA,IAAK,EAAE,cAAc;QAAE;QACpE,YAAY,CAAA,GAAA,gCAAS,EAAE,UAAU;YAC/B,gBAAgB,aAAa,oBAAoB,aAAa;YAC9D,qBAAqB,KAAK,CAAC,oBAAoB;YAC/C,iBAAiB,KAAK,CAAC,gBAAgB;YACvC,iBAAiB,cAAc;sBAC/B;YACA,UAAU;YACV,GAAI,SAAS,OAAO,CAAC,IAAI;uBAAC;YAAK,CAAC;kBAChC;kBACA;YACA,MAAM;YACN,GAAG,YAAY;QACjB;QACA,YAAY,MAAM,UAAU;QAC5B,WAAW,aAAa;oBACxB;oBACA;QACA,WAAW,aAAa,oBAAoB;IAC9C;AACF","sources":["packages/@react-aria/toggle/src/useToggle.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaToggleProps} from '@react-types/checkbox';\nimport {filterDOMProps, mergeProps, useFormReset} from '@react-aria/utils';\nimport {InputHTMLAttributes, LabelHTMLAttributes} from 'react';\nimport {RefObject} from '@react-types/shared';\nimport {ToggleState} from '@react-stately/toggle';\nimport {useFocusable, usePress} from '@react-aria/interactions';\n\nexport interface ToggleAria {\n /** Props to be spread on the label element. */\n labelProps: LabelHTMLAttributes<HTMLLabelElement>,\n /** Props to be spread on the input element. */\n inputProps: InputHTMLAttributes<HTMLInputElement>,\n /** Whether the toggle is selected. */\n isSelected: boolean,\n /** Whether the toggle is in a pressed state. */\n isPressed: boolean,\n /** Whether the toggle is disabled. */\n isDisabled: boolean,\n /** Whether the toggle is read only. */\n isReadOnly: boolean,\n /** Whether the toggle is invalid. */\n isInvalid: boolean\n}\n\n/**\n * Handles interactions for toggle elements, e.g. Checkboxes and Switches.\n */\nexport function useToggle(props: AriaToggleProps, state: ToggleState, ref: RefObject<HTMLInputElement | null>): ToggleAria {\n let {\n isDisabled = false,\n isReadOnly = false,\n value,\n name,\n form,\n children,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n validationState = 'valid',\n isInvalid,\n onPressStart,\n onPressEnd,\n onPressChange,\n onPress,\n onPressUp,\n onClick\n } = props;\n\n let onChange = (e) => {\n // since we spread props on label, onChange will end up there as well as in here.\n // so we have to stop propagation at the lowest level that we care about\n e.stopPropagation();\n state.setSelected(e.target.checked);\n };\n\n let hasChildren = children != null;\n let hasAriaLabel = ariaLabel != null || ariaLabelledby != null;\n if (!hasChildren && !hasAriaLabel && process.env.NODE_ENV !== 'production') {\n console.warn('If you do not provide children, you must specify an aria-label for accessibility');\n }\n\n // Handle press state for keyboard interactions and cases where labelProps is not used.\n let {pressProps, isPressed} = usePress({\n onPressStart,\n onPressEnd,\n onPressChange,\n onPress,\n onPressUp,\n onClick,\n isDisabled\n });\n\n // Handle press state on the label.\n let {pressProps: labelProps, isPressed: isLabelPressed} = usePress({\n onPressStart,\n onPressEnd,\n onPressChange,\n onPressUp,\n onClick,\n onPress(e) {\n onPress?.(e);\n state.toggle();\n ref.current?.focus();\n },\n isDisabled: isDisabled || isReadOnly\n });\n\n let {focusableProps} = useFocusable(props, ref);\n let interactions = mergeProps(preLine truncated
@@ -0,0 +1,14 @@
var identity = require('./identity');
/**
* Casts `value` to `identity` if it's not a function.
*
* @private
* @param {*} value The value to inspect.
* @returns {Function} Returns cast function.
*/
function castFunction(value) {
return typeof value == 'function' ? value : identity;
}
module.exports = castFunction;
@@ -0,0 +1,18 @@
var baseGetTag = require('./_baseGetTag'),
isObjectLike = require('./isObjectLike');
/** `Object#toString` result references. */
var regexpTag = '[object RegExp]';
/**
* The base implementation of `_.isRegExp` without Node.js optimizations.
*
* @private
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a regexp, else `false`.
*/
function baseIsRegExp(value) {
return isObjectLike(value) && baseGetTag(value) == regexpTag;
}
module.exports = baseIsRegExp;
@@ -0,0 +1,14 @@
import { GeneralNames, GeneralName } from "@peculiar/asn1-x509";
/**
* ```asn1
* RoleSyntax ::= SEQUENCE {
* roleAuthority [0] GeneralNames OPTIONAL,
* roleName [1] GeneralName
* }
* ```
*/
export declare class RoleSyntax {
roleAuthority?: GeneralNames;
roleName?: GeneralName;
constructor(params?: Partial<RoleSyntax>);
}
@@ -0,0 +1,23 @@
var root = require('./_root');
/**
* Gets the timestamp of the number of milliseconds that have elapsed since
* the Unix epoch (1 January 1970 00:00:00 UTC).
*
* @static
* @memberOf _
* @since 2.4.0
* @category Date
* @returns {number} Returns the timestamp.
* @example
*
* _.defer(function(stamp) {
* console.log(_.now() - stamp);
* }, _.now());
* // => Logs the number of milliseconds it took for the deferred invocation.
*/
var now = function() {
return root.Date.now();
};
module.exports = now;
@@ -0,0 +1,5 @@
var convert = require('./convert'),
func = convert('range', require('../range'));
func.placeholder = require('./placeholder');
module.exports = func;
@@ -0,0 +1,23 @@
import arrayAggregator from './_arrayAggregator.js';
import baseAggregator from './_baseAggregator.js';
import baseIteratee from './_baseIteratee.js';
import isArray from './isArray.js';
/**
* Creates a function like `_.groupBy`.
*
* @private
* @param {Function} setter The function to set accumulator values.
* @param {Function} [initializer] The accumulator object initializer.
* @returns {Function} Returns the new aggregator function.
*/
function createAggregator(setter, initializer) {
return function(collection, iteratee) {
var func = isArray(collection) ? arrayAggregator : baseAggregator,
accumulator = initializer ? initializer() : {};
return func(collection, setter, baseIteratee(iteratee, 2), accumulator);
};
}
export default createAggregator;
@@ -0,0 +1 @@
{"version":3,"file":"svg.d.ts","sourceRoot":"","sources":["svg.js"],"names":[],"mappings":"AAUA,oDA4iBE"}
@@ -0,0 +1,22 @@
import getMapData from './_getMapData.js';
/**
* Sets the map `key` to `value`.
*
* @private
* @name set
* @memberOf MapCache
* @param {string} key The key of the value to set.
* @param {*} value The value to set.
* @returns {Object} Returns the map cache instance.
*/
function mapCacheSet(key, value) {
var data = getMapData(this, key),
size = data.size;
data.set(key, value);
this.size += data.size == size ? 0 : 1;
return this;
}
export default mapCacheSet;
@@ -0,0 +1 @@
{"mappings":"AAAA;;;;;;;;;;CAUC,GAED,8CAA8C;AAC9C,MAAM,oCAAc,IAAI,IAAI;IAAC;IAAQ;IAAQ;IAAQ;IAAQ;IAAQ;IAAQ;IAAQ;IAAQ;IAAQ;CAAO;AAC5G,MAAM,kCAAY,IAAI,IAAI;IAAC;IAAM;IAAM;IAAO;IAAO;IAAO;IAAO;IAAM;IAAM;IAAO;IAAM;IAAM;IAAO;IAAO;IAAO;IAAM;IAAM;IAAM;IAAM;CAAK;AAK7I,SAAS,0CAAM,YAAoB;IACxC,kFAAkF;IAClF,IAAI,KAAK,MAAM,EAAE;QACf,IAAI,SAAS,IAAI,KAAK,MAAM,CAAC,cAAc,QAAQ;QAEnD,6DAA6D;QAC7D,6GAA6G;QAC7G,2GAA2G;QAC3G,IAAI,WAAW,OAAO,OAAO,WAAW,KAAK,aAAa,OAAO,WAAW,KAAK,OAAO,QAAQ;QAChG,IAAI,UACF,OAAO,SAAS,SAAS,KAAK;QAGhC,oCAAoC;QACpC,uGAAuG;QACvG,IAAI,OAAO,MAAM,EACf,OAAO,kCAAY,GAAG,CAAC,OAAO,MAAM;IAExC;IAEA,gEAAgE;IAChE,IAAI,OAAO,aAAa,KAAK,CAAC,IAAI,CAAC,EAAE;IACrC,OAAO,gCAAU,GAAG,CAAC;AACvB","sources":["packages/@react-aria/i18n/src/utils.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// https://en.wikipedia.org/wiki/Right-to-left\nconst RTL_SCRIPTS = new Set(['Arab', 'Syrc', 'Samr', 'Mand', 'Thaa', 'Mend', 'Nkoo', 'Adlm', 'Rohg', 'Hebr']);\nconst RTL_LANGS = new Set(['ae', 'ar', 'arc', 'bcc', 'bqi', 'ckb', 'dv', 'fa', 'glk', 'he', 'ku', 'mzn', 'nqo', 'pnb', 'ps', 'sd', 'ug', 'ur', 'yi']);\n\n/**\n * Determines if a locale is read right to left using [Intl.Locale]{@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale}.\n */\nexport function isRTL(localeString: string): boolean {\n // If the Intl.Locale API is available, use it to get the locale's text direction.\n if (Intl.Locale) {\n let locale = new Intl.Locale(localeString).maximize();\n\n // Use the text info object to get the direction if possible.\n // @ts-ignore - this was implemented as a property by some browsers before it was standardized as a function.\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getTextInfo\n let textInfo = typeof locale.getTextInfo === 'function' ? locale.getTextInfo() : locale.textInfo;\n if (textInfo) {\n return textInfo.direction === 'rtl';\n }\n\n // Fallback: guess using the script.\n // This is more accurate than guessing by language, since languages can be written in multiple scripts.\n if (locale.script) {\n return RTL_SCRIPTS.has(locale.script);\n }\n }\n\n // If not, just guess by the language (first part of the locale)\n let lang = localeString.split('-')[0];\n return RTL_LANGS.has(lang);\n}\n"],"names":[],"version":3,"file":"utils.module.js.map"}
@@ -0,0 +1,8 @@
import type { FlatConfig } from '@typescript-eslint/utils/ts-eslint';
/**
* A minimal ruleset that sets only the required parser and plugin options needed to run typescript-eslint.
* We don't recommend using this directly; instead, extend from an earlier recommended rule.
* @see {@link https://typescript-eslint.io/users/configs#base}
*/
declare const _default: (plugin: FlatConfig.Plugin, parser: FlatConfig.Parser) => FlatConfig.Config;
export default _default;
@@ -0,0 +1,2 @@
import type { LibDefinition } from '../variable';
export declare const esnext_full: LibDefinition;
@@ -0,0 +1,82 @@
import { GroupEssenceMsgRet, InstanceContext, WebApiGroupMember, WebApiGroupNoticeRet, WebHonorType, NapCatCore } from '../index';
export interface SetNoticeRetSuccess {
ec: number;
em: string;
id: number;
ltsm: number;
new_fid: string;
read_only: number;
role: number;
srv_code: number;
}
export declare class NTQQWebApi {
context: InstanceContext;
core: NapCatCore;
constructor(context: InstanceContext, core: NapCatCore);
shareDigest(groupCode: string, msgSeq: string, msgRandom: string, targetGroupCode: string): Promise<string | undefined>;
getGroupEssenceMsgAll(GroupCode: string): Promise<GroupEssenceMsgRet[]>;
getGroupEssenceMsg(GroupCode: string, page_start?: number, page_limit?: number): Promise<GroupEssenceMsgRet | undefined>;
getGroupMembers(GroupCode: string): Promise<WebApiGroupMember[]>;
setGroupNotice(GroupCode: string, Content: string, pinned?: number, type?: number, is_show_edit_card?: number, tip_window_type?: number, confirm_required?: number, picId?: string, imgWidth?: number, imgHeight?: number): Promise<SetNoticeRetSuccess | undefined>;
getGroupNotice(GroupCode: string): Promise<undefined | WebApiGroupNoticeRet>;
private getDataInternal;
private getHonorList;
getGroupHonorInfo(groupCode: string, getType: WebHonorType): Promise<{
group_id: number;
current_talkative: {};
talkative_list: never[];
performer_list: never[];
legend_list: never[];
emotion_list: never[];
strong_newbie_list: never[];
}>;
private cookieToString;
getBknFromCookie(cookieObject: {
[key: string]: string;
}): string;
getBknFromSKey(sKey: string): string;
getAlbumListByNTQQ(gc: string): Promise<{
response: {
seq: number;
result: number;
errMs: string;
trace_id: string;
is_from_cache: boolean;
request_time_line: unknown;
album_list: Array<{
name: string;
album_id: string;
}>;
attach_info: string;
has_more: boolean;
right: unknown;
banner: unknown;
};
}>;
getAlbumList(gc: string): Promise<{
id: string;
title: string;
}[]>;
createQunAlbumSession(gc: string, sAlbumID: string, sAlbumName: string, path: string, skey: string, pskey: string, img_md5: string, uin: string): Promise<{
data: {
session: string;
};
ret: number;
msg: string;
}>;
uploadQunAlbumSlice(path: string, session: string, skey: string, pskey: string, uin: string, slice_size: number): Promise<{
success: boolean;
message: string;
}>;
uploadImageToQunAlbum(gc: string, sAlbumID: string, sAlbumName: string, path: string): Promise<void>;
getAlbumMediaListByNTQQ(gc: string, albumId: string, attach_info?: string): Promise<{
seq: number;
result: number;
errMs: string;
trace_id: string;
request_time_line: unknown;
}>;
doAlbumMediaPlainCommentByNTQQ(qunId: string, albumId: string, lloc: string, content: string): Promise<unknown>;
deleteAlbumMediaByNTQQ(qunId: string, albumId: string, lloc: string): Promise<unknown>;
doAlbumMediaLikeByNTQQ(qunId: string, albumId: string, lloc: string, id: string): Promise<unknown>;
}
@@ -0,0 +1,34 @@
/**
* This config:
* 1) adds `.jsx`, `.ts`, `.cts`, `.mts`, and `.tsx` as an extension
* 2) enables JSX/TSX parsing
*/
// Omit `.d.ts` because 1) TypeScript compilation already confirms that
// types are resolved, and 2) it would mask an unresolved
// `.ts`/`.tsx`/`.js`/`.jsx` implementation.
const typeScriptExtensions = ['.ts', '.cts', '.mts', '.tsx'];
const allExtensions = [...typeScriptExtensions, '.js', '.jsx', '.mjs', '.cjs'];
module.exports = {
settings: {
'import/extensions': allExtensions,
'import/external-module-folders': ['node_modules', 'node_modules/@types'],
'import/parsers': {
'@typescript-eslint/parser': typeScriptExtensions,
},
'import/resolver': {
node: {
extensions: allExtensions,
},
},
},
rules: {
// analysis/correctness
// TypeScript compilation already ensures that named imports exist in the referenced module
'import/named': 'off',
},
};
@@ -0,0 +1,48 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = getAssignmentIdentifiers;
function getAssignmentIdentifiers(node) {
const search = [].concat(node);
const ids = Object.create(null);
while (search.length) {
const id = search.pop();
if (!id) continue;
switch (id.type) {
case "ArrayPattern":
search.push(...id.elements);
break;
case "AssignmentExpression":
case "AssignmentPattern":
case "ForInStatement":
case "ForOfStatement":
search.push(id.left);
break;
case "ObjectPattern":
search.push(...id.properties);
break;
case "ObjectProperty":
search.push(id.value);
break;
case "RestElement":
case "UpdateExpression":
search.push(id.argument);
break;
case "UnaryExpression":
if (id.operator === "delete") {
search.push(id.argument);
}
break;
case "Identifier":
ids[id.name] = id;
break;
default:
break;
}
}
return ids;
}
//# sourceMappingURL=getAssignmentIdentifiers.js.map
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2020 Jordan Harband
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@@ -0,0 +1,44 @@
# `append-field`
A [W3C HTML JSON forms spec](http://www.w3.org/TR/html-json-forms/) compliant
field appender (for lack of a better name). Useful for people implementing
`application/x-www-form-urlencoded` and `multipart/form-data` parsers.
It works best on objects created with `Object.create(null)`. Otherwise it might
conflict with variables from the prototype (e.g. `hasOwnProperty`).
## Installation
```sh
npm install --save append-field
```
## Usage
```javascript
var appendField = require('append-field')
var obj = Object.create(null)
appendField(obj, 'pets[0][species]', 'Dahut')
appendField(obj, 'pets[0][name]', 'Hypatia')
appendField(obj, 'pets[1][species]', 'Felis Stultus')
appendField(obj, 'pets[1][name]', 'Billie')
console.log(obj)
```
```text
{ pets:
[ { species: 'Dahut', name: 'Hypatia' },
{ species: 'Felis Stultus', name: 'Billie' } ] }
```
## API
### `appendField(store, key, value)`
Adds the field named `key` with the value `value` to the object `store`.
## License
MIT
@@ -0,0 +1,39 @@
var apply = require('./_apply'),
arrayMap = require('./_arrayMap'),
unzip = require('./unzip');
/**
* This method is like `_.unzip` except that it accepts `iteratee` to specify
* how regrouped values should be combined. The iteratee is invoked with the
* elements of each group: (...group).
*
* @static
* @memberOf _
* @since 3.8.0
* @category Array
* @param {Array} array The array of grouped elements to process.
* @param {Function} [iteratee=_.identity] The function to combine
* regrouped values.
* @returns {Array} Returns the new array of regrouped elements.
* @example
*
* var zipped = _.zip([1, 2], [10, 20], [100, 200]);
* // => [[1, 10, 100], [2, 20, 200]]
*
* _.unzipWith(zipped, _.add);
* // => [3, 30, 300]
*/
function unzipWith(array, iteratee) {
if (!(array && array.length)) {
return [];
}
var result = unzip(array);
if (iteratee == null) {
return result;
}
return arrayMap(result, function(group) {
return apply(iteratee, undefined, group);
});
}
module.exports = unzipWith;
@@ -0,0 +1 @@
{"version":3,"file":"decodeAuthenticatorExtensions.d.ts","sourceRoot":"","sources":["../../src/helpers/decodeAuthenticatorExtensions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;GAIG;AACH,wBAAgB,6BAA6B,CAC3C,aAAa,EAAE,WAAW,GACzB,4CAA4C,GAAG,SAAS,CAU1D;AAED;;GAEG;AACH,MAAM,MAAM,4CAA4C,GAAG,OAAO,CAAC"}
@@ -0,0 +1 @@
!function(a,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("dayjs")):"function"==typeof define&&define.amd?define(["dayjs"],e):(a="undefined"!=typeof globalThis?globalThis:a||self).dayjs_locale_eu=e(a.dayjs)}(this,(function(a){"use strict";function e(a){return a&&"object"==typeof a&&"default"in a?a:{default:a}}var t=e(a),l={name:"eu",weekdays:"igandea_astelehena_asteartea_asteazkena_osteguna_ostirala_larunbata".split("_"),months:"urtarrila_otsaila_martxoa_apirila_maiatza_ekaina_uztaila_abuztua_iraila_urria_azaroa_abendua".split("_"),weekStart:1,weekdaysShort:"ig._al._ar._az._og._ol._lr.".split("_"),monthsShort:"urt._ots._mar._api._mai._eka._uzt._abu._ira._urr._aza._abe.".split("_"),weekdaysMin:"ig_al_ar_az_og_ol_lr".split("_"),ordinal:function(a){return a},formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"YYYY-MM-DD",LL:"YYYY[ko] MMMM[ren] D[a]",LLL:"YYYY[ko] MMMM[ren] D[a] HH:mm",LLLL:"dddd, YYYY[ko] MMMM[ren] D[a] HH:mm",l:"YYYY-M-D",ll:"YYYY[ko] MMM D[a]",lll:"YYYY[ko] MMM D[a] HH:mm",llll:"ddd, YYYY[ko] MMM D[a] HH:mm"},relativeTime:{future:"%s barru",past:"duela %s",s:"segundo batzuk",m:"minutu bat",mm:"%d minutu",h:"ordu bat",hh:"%d ordu",d:"egun bat",dd:"%d egun",M:"hilabete bat",MM:"%d hilabete",y:"urte bat",yy:"%d urte"}};return t.default.locale(l,null,!0),l}));
@@ -0,0 +1,14 @@
import {
commonColors
} from "../chunk-IAS3SFA4.mjs";
import "../chunk-JUEOCLA3.mjs";
import "../chunk-3LKKH4AR.mjs";
import "../chunk-T3GWIVAM.mjs";
import "../chunk-OR5PUD24.mjs";
import "../chunk-DCEG5LGX.mjs";
import "../chunk-L2OL7R23.mjs";
import "../chunk-YZYGFPNK.mjs";
import "../chunk-GHZ36ATJ.mjs";
export {
commonColors
};
@@ -0,0 +1,21 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.curryLazyBuildPlanServiceNodeFromResolvedValueElementMetadata = curryLazyBuildPlanServiceNodeFromResolvedValueElementMetadata;
const InversifyCoreError_1 = require("../../error/models/InversifyCoreError");
const InversifyCoreErrorKind_1 = require("../../error/models/InversifyCoreErrorKind");
const curryBuildPlanServiceNodeFromResolvedValueElementMetadata_1 = require("./curryBuildPlanServiceNodeFromResolvedValueElementMetadata");
function curryLazyBuildPlanServiceNodeFromResolvedValueElementMetadata(buildServiceNodeBindings) {
const buildPlanServiceNodeFromResolvedValueElementMetadata = (0, curryBuildPlanServiceNodeFromResolvedValueElementMetadata_1.curryBuildPlanServiceNodeFromResolvedValueElementMetadata)(buildServiceNodeBindings);
return (params, bindingConstraintsList, elementMetadata) => {
try {
return buildPlanServiceNodeFromResolvedValueElementMetadata(params, bindingConstraintsList, elementMetadata);
}
catch (error) {
if (InversifyCoreError_1.InversifyCoreError.isErrorOfKind(error, InversifyCoreErrorKind_1.InversifyCoreErrorKind.planning)) {
return undefined;
}
throw error;
}
};
}
//# sourceMappingURL=curryLazyBuildPlanServiceNodeFromResolvedValueElementMetadata.js.map
@@ -0,0 +1 @@
{"version":3,"names":["_temporalUndefined"],"sources":["../../src/helpers/temporalUndefined.ts"],"sourcesContent":["/* @minVersion 7.0.0-beta.0 */\n\n// This function isn't mean to be called, but to be used as a reference.\n// We can't use a normal object because it isn't hoisted.\nexport default function _temporalUndefined(this: never): void {}\n"],"mappings":";;;;;;AAIe,SAASA,kBAAkBA,CAAA,EAAoB,CAAC","ignoreList":[]}
@@ -0,0 +1 @@
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/visually-hidden/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport {useVisuallyHidden, VisuallyHidden} from './VisuallyHidden';\nexport type {VisuallyHiddenAria, VisuallyHiddenProps} from './VisuallyHidden';\n"],"names":[],"version":3,"file":"main.js.map"}
@@ -0,0 +1,22 @@
import createCaseFirst from './_createCaseFirst.js';
/**
* Converts the first character of `string` to upper case.
*
* @static
* @memberOf _
* @since 4.0.0
* @category String
* @param {string} [string=''] The string to convert.
* @returns {string} Returns the converted string.
* @example
*
* _.upperFirst('fred');
* // => 'Fred'
*
* _.upperFirst('FRED');
* // => 'FRED'
*/
var upperFirst = createCaseFirst('toUpperCase');
export default upperFirst;
@@ -0,0 +1 @@
{"name":"@eslint-community/regexpp","version":"4.12.2","requiresBuild":false,"files":{"LICENSE":{"checkedAt":1794532092579,"integrity":"sha512-mU2zG37iToppUpJAeVzAygm/RjK7uiIHsBwn5ymHYdwCyKfYX1/ZNQTRdjEbLPtQXuiXKulo9U8sJqWe6Y7Iug==","mode":420,"size":1071},"index.js":{"checkedAt":1794532092644,"integrity":"sha512-dsX/6gXOor9i5t4W2wYT7Qg2tzowEWrg5MwIbfWdc+LiBXT52PJLKyOoO6NTPqhs2nitfVs+URvFpsBINmagfQ==","mode":420,"size":109704},"package.json":{"checkedAt":1794532092644,"integrity":"sha512-nSIK2lNhrVDgFu1MMUcHUvd4S37jsVtb+eyNxMNeqY8H6dPM2cIZnFPSU4zTlQtkFMm0Y4+FVvKGozM2TiP1XA==","mode":420,"size":2783},"index.js.map":{"checkedAt":1794532092645,"integrity":"sha512-AchwJPKbCFT9ExubxmVEC6+t+Z8QsgKLj/30BS8Kc5A9vR4NYOK7cyDMxNAMYsLsp70InIeBdnTFl7ZIbeeQCA==","mode":420,"size":103754},"index.mjs.map":{"checkedAt":1794532092645,"integrity":"sha512-xuut8qfB/EDD36hPWqSsalBXxLH2HAiCcwzgyCR4F8UVEclbwzYDUwOZmDbqwwOVrLJadKVKSaVM8kHeytEC4Q==","mode":420,"size":103745},"README.md":{"checkedAt":1794532092645,"integrity":"sha512-o948YWTz13rpnhtr5Pv9bn0w6WPHHN1hauapU5NjjwNCCvLepeqey7AVA/Yskqfzyx385wh3+R+412KcqIQszA==","mode":420,"size":5663},"index.mjs":{"checkedAt":1794532092646,"integrity":"sha512-HkdHEo0SEAENHsm7G7PPkSX98iQt3KravCSs1xfUmGLCY4cCwIwbqDl1h22WKa40V37mG76ezq40V8CbQIeeWQ==","mode":420,"size":109467},"index.d.ts":{"checkedAt":1794532092646,"integrity":"sha512-/9NvJEMMuVhA25Kh0gyiJf4SDhz5DUabtpeLMluxHgpWN7Coifm4rKUfLBCtwF4YF4ev2t5AxHfARoMpHuyRww==","mode":420,"size":37807}}}
@@ -0,0 +1,738 @@
<h1 align="center">Picomatch</h1>
<p align="center">
<a href="https://npmjs.org/package/picomatch">
<img src="https://img.shields.io/npm/v/picomatch.svg" alt="version">
</a>
<a href="https://github.com/micromatch/picomatch/actions?workflow=Tests">
<img src="https://github.com/micromatch/picomatch/workflows/Tests/badge.svg" alt="test status">
</a>
<a href="https://coveralls.io/github/micromatch/picomatch">
<img src="https://img.shields.io/coveralls/github/micromatch/picomatch/master.svg" alt="coverage status">
</a>
<a href="https://npmjs.org/package/picomatch">
<img src="https://img.shields.io/npm/dm/picomatch.svg" alt="downloads">
</a>
</p>
<br>
<br>
<p align="center">
<strong>Blazing fast and accurate glob matcher written in JavaScript.</strong></br>
<em>No dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions.</em>
</p>
<br>
<br>
## Why picomatch?
* **Lightweight** - No dependencies
* **Minimal** - Tiny API surface. Main export is a function that takes a glob pattern and returns a matcher function.
* **Fast** - Loads in about 2ms (that's several times faster than a [single frame of a HD movie](http://www.endmemo.com/sconvert/framespersecondframespermillisecond.php) at 60fps)
* **Performant** - Use the returned matcher function to speed up repeat matching (like when watching files)
* **Accurate matching** - Using wildcards (`*` and `?`), globstars (`**`) for nested directories, [advanced globbing](#advanced-globbing) with extglobs, braces, and POSIX brackets, and support for escaping special characters with `\` or quotes.
* **Well tested** - Thousands of unit tests
See the [library comparison](#library-comparisons) to other libraries.
<br>
<br>
## Table of Contents
<details><summary> Click to expand </summary>
- [Install](#install)
- [Usage](#usage)
- [API](#api)
* [picomatch](#picomatch)
* [.test](#test)
* [.matchBase](#matchbase)
* [.isMatch](#ismatch)
* [.parse](#parse)
* [.scan](#scan)
* [.compileRe](#compilere)
* [.makeRe](#makere)
* [.toRegex](#toregex)
- [Options](#options)
* [Picomatch options](#picomatch-options)
* [Scan Options](#scan-options)
* [Options Examples](#options-examples)
- [Globbing features](#globbing-features)
* [Basic globbing](#basic-globbing)
* [Advanced globbing](#advanced-globbing)
* [Braces](#braces)
* [Matching special characters as literals](#matching-special-characters-as-literals)
- [Library Comparisons](#library-comparisons)
- [Benchmarks](#benchmarks)
- [Philosophies](#philosophies)
- [About](#about)
* [Author](#author)
* [License](#license)
_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_
</details>
<br>
<br>
## Install
Install with [npm](https://www.npmjs.com/):
```sh
npm install --save picomatch
```
<br>
## Usage
The main export is a function that takes a glob pattern and an options object and returns a function for matching strings.
```js
const pm = require('picomatch');
const isMatch = pm('*.js');
console.log(isMatch('abcd')); //=> false
console.log(isMatch('a.js')); //=> true
console.log(isMatch('a.md')); //=> false
console.log(isMatch('a/b.js')); //=> false
```
<br>
## API
### [picomatch](lib/picomatch.js#L31)
Creates a matcher function from one or more glob patterns. The returned function takes a string to match as its first argument, and returns true if the string is a match. The returned matcher function also takes a boolean as the second argument that, when true, returns an object with additional information.
**Params**
* `globs` **{String|Array}**: One or more glob patterns.
* `options` **{Object=}**
* `returns` **{Function=}**: Returns a matcher function.
**Example**
```js
const picomatch = require('picomatch');
// picomatch(glob[, options]);
const isMatch = picomatch('*.!(*a)');
console.log(isMatch('a.a')); //=> false
console.log(isMatch('a.b')); //=> true
```
**Example without node.js**
For environments without `node.js`, `picomatch/posix` provides you a dependency-free matcher, without automatic OS detection.
```js
const picomatch = require('picomatch/posix');
// the same API, defaulting to posix paths
const isMatch = picomatch('a/*');
console.log(isMatch('a\\b')); //=> false
console.log(isMatch('a/b')); //=> true
// you can still configure the matcher function to accept windows paths
const isMatch = picomatch('a/*', { options: windows });
console.log(isMatch('a\\b')); //=> true
console.log(isMatch('a/b')); //=> true
```
### [.test](lib/picomatch.js#L116)
Test `input` with the given `regex`. This is used by the main `picomatch()` function to test the input string.
**Params**
* `input` **{String}**: String to test.
* `regex` **{RegExp}**
* `returns` **{Object}**: Returns an object with matching info.
**Example**
```js
const picomatch = require('picomatch');
// picomatch.test(input, regex[, options]);
console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
// { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
```
### [.matchBase](lib/picomatch.js#L160)
Match the basename of a filepath.
**Params**
* `input` **{String}**: String to test.
* `glob` **{RegExp|String}**: Glob pattern or regex created by [.makeRe](#makeRe).
* `returns` **{Boolean}**
**Example**
```js
const picomatch = require('picomatch');
// picomatch.matchBase(input, glob[, options]);
console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
```
### [.isMatch](lib/picomatch.js#L182)
Returns true if **any** of the given glob `patterns` match the specified `string`.
**Params**
* **{String|Array}**: str The string to test.
* **{String|Array}**: patterns One or more glob patterns to use for matching.
* **{Object}**: See available [options](#options).
* `returns` **{Boolean}**: Returns true if any patterns match `str`
**Example**
```js
const picomatch = require('picomatch');
// picomatch.isMatch(string, patterns[, options]);
console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
```
### [.parse](lib/picomatch.js#L198)
Parse a glob pattern to create the source string for a regular expression.
**Params**
* `pattern` **{String}**
* `options` **{Object}**
* `returns` **{Object}**: Returns an object with useful properties and output to be used as a regex source string.
**Example**
```js
const picomatch = require('picomatch');
const result = picomatch.parse(pattern[, options]);
```
### [.scan](lib/picomatch.js#L230)
Scan a glob pattern to separate the pattern into segments.
**Params**
* `input` **{String}**: Glob pattern to scan.
* `options` **{Object}**
* `returns` **{Object}**: Returns an object with
**Example**
```js
const picomatch = require('picomatch');
// picomatch.scan(input[, options]);
const result = picomatch.scan('!./foo/*.js');
console.log(result);
{ prefix: '!./',
input: '!./foo/*.js',
start: 3,
base: 'foo',
glob: '*.js',
isBrace: false,
isBracket: false,
isGlob: true,
isExtglob: false,
isGlobstar: false,
negated: true }
```
### [.compileRe](lib/picomatch.js#L244)
Compile a regular expression from the `state` object returned by the
[parse()](#parse) method.
**Params**
* `state` **{Object}**
* `options` **{Object}**
* `returnOutput` **{Boolean}**: Intended for implementors, this argument allows you to return the raw output from the parser.
* `returnState` **{Boolean}**: Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
* `returns` **{RegExp}**
### [.makeRe](lib/picomatch.js#L285)
Create a regular expression from a parsed glob pattern.
**Params**
* `state` **{String}**: The object returned from the `.parse` method.
* `options` **{Object}**
* `returnOutput` **{Boolean}**: Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result.
* `returnState` **{Boolean}**: Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
* `returns` **{RegExp}**: Returns a regex created from the given pattern.
**Example**
```js
const picomatch = require('picomatch');
const state = picomatch.parse('*.js');
// picomatch.compileRe(state[, options]);
console.log(picomatch.compileRe(state));
//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
```
### [.toRegex](lib/picomatch.js#L320)
Create a regular expression from the given regex source string.
**Params**
* `source` **{String}**: Regular expression source string.
* `options` **{Object}**
* `returns` **{RegExp}**
**Example**
```js
const picomatch = require('picomatch');
// picomatch.toRegex(source[, options]);
const { output } = picomatch.parse('*.js');
console.log(picomatch.toRegex(output));
//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
```
<br>
## Options
### Picomatch options
The following options may be used with the main `picomatch()` function or any of the methods on the picomatch API.
| **Option** | **Type** | **Default value** | **Description** |
| --- | --- | --- | --- |
| `basename` | `boolean` | `false` | If set, then patterns without slashes will be matched against the basename of the path if it contains slashes. For example, `a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. |
| `bash` | `boolean` | `false` | Follow bash matching rules more strictly - disallows backslashes as escape characters, and treats single stars as globstars (`**`). |
| `capture` | `boolean` | `undefined` | Return regex matches in supporting methods. |
| `contains` | `boolean` | `undefined` | Allows glob to match any part of the given string(s). |
| `cwd` | `string` | `process.cwd()` | Current working directory. Used by `picomatch.split()` |
| `debug` | `boolean` | `undefined` | Debug regular expressions when an error is thrown. |
| `dot` | `boolean` | `false` | Enable dotfile matching. By default, dotfiles are ignored unless a `.` is explicitly defined in the pattern, or `options.dot` is true |
| `expandRange` | `function` | `undefined` | Custom function for expanding ranges in brace patterns, such as `{a..z}`. The function receives the range values as two arguments, and it must return a string to be used in the generated regex. It's recommended that returned strings be wrapped in parentheses. |
| `failglob` | `boolean` | `false` | Throws an error if no matches are found. Based on the bash option of the same name. |
| `fastpaths` | `boolean` | `true` | To speed up processing, full parsing is skipped for a handful common glob patterns. Disable this behavior by setting this option to `false`. |
| `flags` | `string` | `undefined` | Regex flags to use in the generated regex. If defined, the `nocase` option will be overridden. |
| [format](#optionsformat) | `function` | `undefined` | Custom function for formatting the returned string. This is useful for removing leading slashes, converting Windows paths to Posix paths, etc. |
| `ignore` | `array\|string` | `undefined` | One or more glob patterns for excluding strings that should not be matched from the result. |
| `keepQuotes` | `boolean` | `false` | Retain quotes in the generated regex, since quotes may also be used as an alternative to backslashes. |
| `literalBrackets` | `boolean` | `undefined` | When `true`, brackets in the glob pattern will be escaped so that only literal brackets will be matched. |
| `matchBase` | `boolean` | `false` | Alias for `basename` |
| `maxLength` | `number` | `65536` | Limit the max length of the input string. An error is thrown if the input string is longer than this value. |
| `nobrace` | `boolean` | `false` | Disable brace matching, so that `{a,b}` and `{1..3}` would be treated as literal characters. |
| `nobracket` | `boolean` | `undefined` | Disable matching with regex brackets. |
| `nocase` | `boolean` | `false` | Make matching case-insensitive. Equivalent to the regex `i` flag. Note that this option is overridden by the `flags` option. |
| `nodupes` | `boolean` | `true` | Deprecated, use `nounique` instead. This option will be removed in a future major release. By default duplicates are removed. Disable uniquification by setting this option to false. |
| `noext` | `boolean` | `false` | Alias for `noextglob` |
| `noextglob` | `boolean` | `false` | Disable support for matching with extglobs (like `+(a\|b)`) |
| `noglobstar` | `boolean` | `false` | Disable support for matching nested directories with globstars (`**`) |
| `nonegate` | `boolean` | `false` | Disable support for negating with leading `!` |
| `noquantifiers` | `boolean` | `false` | Disable support for regex quantifiers (like `a{1,2}`) and treat them as brace patterns to be expanded. |
| [onIgnore](#optionsonIgnore) | `function` | `undefined` | Function to be called on ignored items. |
| [onMatch](#optionsonMatch) | `function` | `undefined` | Function to be called on matched items. |
| [onResult](#optionsonResult) | `function` | `undefined` | Function to be called on all items, regardless of whether or not they are matched or ignored. |
| `posix` | `boolean` | `false` | Support POSIX character classes ("posix brackets"). |
| `posixSlashes` | `boolean` | `undefined` | Convert all slashes in file paths to forward slashes. This does not convert slashes in the glob pattern itself |
| `prepend` | `boolean` | `undefined` | String to prepend to the generated regex used for matching. |
| `regex` | `boolean` | `false` | Use regular expression rules for `+` (instead of matching literal `+`), and for stars that follow closing parentheses or brackets (as in `)*` and `]*`). |
| `strictBrackets` | `boolean` | `undefined` | Throw an error if brackets, braces, or parens are imbalanced. |
| `strictSlashes` | `boolean` | `undefined` | When true, picomatch won't match trailing slashes with single stars. |
| `unescape` | `boolean` | `undefined` | Remove backslashes preceding escaped characters in the glob pattern. By default, backslashes are retained. |
| `unixify` | `boolean` | `undefined` | Alias for `posixSlashes`, for backwards compatibility. |
| `windows` | `boolean` | `false` | Also accept backslashes as the path separator. |
### Scan Options
In addition to the main [picomatch options](#picomatch-options), the following options may also be used with the [.scan](#scan) method.
| **Option** | **Type** | **Default value** | **Description** |
| --- | --- | --- | --- |
| `tokens` | `boolean` | `false` | When `true`, the returned object will include an array of tokens (objects), representing each path "segment" in the scanned glob pattern |
| `parts` | `boolean` | `false` | When `true`, the returned object will include an array of strings representing each path "segment" in the scanned glob pattern. This is automatically enabled when `options.tokens` is true |
**Example**
```js
const picomatch = require('picomatch');
const result = picomatch.scan('!./foo/*.js', { tokens: true });
console.log(result);
// {
// prefix: '!./',
// input: '!./foo/*.js',
// start: 3,
// base: 'foo',
// glob: '*.js',
// isBrace: false,
// isBracket: false,
// isGlob: true,
// isExtglob: false,
// isGlobstar: false,
// negated: true,
// maxDepth: 2,
// tokens: [
// { value: '!./', depth: 0, isGlob: false, negated: true, isPrefix: true },
// { value: 'foo', depth: 1, isGlob: false },
// { value: '*.js', depth: 1, isGlob: true }
// ],
// slashes: [ 2, 6 ],
// parts: [ 'foo', '*.js' ]
// }
```
<br>
### Options Examples
#### options.expandRange
**Type**: `function`
**Default**: `undefined`
Custom function for expanding ranges in brace patterns. The [fill-range](https://github.com/jonschlinkert/fill-range) library is ideal for this purpose, or you can use custom code to do whatever you need.
**Example**
The following example shows how to create a glob that matches a folder
```js
const fill = require('fill-range');
const regex = pm.makeRe('foo/{01..25}/bar', {
expandRange(a, b) {
return `(${fill(a, b, { toRegex: true })})`;
}
});
console.log(regex);
//=> /^(?:foo\/((?:0[1-9]|1[0-9]|2[0-5]))\/bar)$/
console.log(regex.test('foo/00/bar')) // false
console.log(regex.test('foo/01/bar')) // true
console.log(regex.test('foo/10/bar')) // true
console.log(regex.test('foo/22/bar')) // true
console.log(regex.test('foo/25/bar')) // true
console.log(regex.test('foo/26/bar')) // false
```
#### options.format
**Type**: `function`
**Default**: `undefined`
Custom function for formatting strings before they're matched.
**Example**
```js
// strip leading './' from strings
const format = str => str.replace(/^\.\//, '');
const isMatch = picomatch('foo/*.js', { format });
console.log(isMatch('./foo/bar.js')); //=> true
```
#### options.onMatch
```js
const onMatch = ({ glob, regex, input, output }) => {
console.log({ glob, regex, input, output });
};
const isMatch = picomatch('*', { onMatch });
isMatch('foo');
isMatch('bar');
isMatch('baz');
```
#### options.onIgnore
```js
const onIgnore = ({ glob, regex, input, output }) => {
console.log({ glob, regex, input, output });
};
const isMatch = picomatch('*', { onIgnore, ignore: 'f*' });
isMatch('foo');
isMatch('bar');
isMatch('baz');
```
#### options.onResult
```js
const onResult = ({ glob, regex, input, output }) => {
console.log({ glob, regex, input, output });
};
const isMatch = picomatch('*', { onResult, ignore: 'f*' });
isMatch('foo');
isMatch('bar');
isMatch('baz');
```
<br>
<br>
## Globbing features
* [Basic globbing](#basic-globbing) (Wildcard matching)
* [Advanced globbing](#advanced-globbing) (extglobs, posix brackets, brace matching)
### Basic globbing
| **Character** | **Description** |
| --- | --- |
| `*` | Matches any character zero or more times, excluding path separators. Does _not match_ path separators or hidden files or directories ("dotfiles"), unless explicitly enabled by setting the `dot` option to `true`. |
| `**` | Matches any character zero or more times, including path separators. Note that `**` will only match path separators (`/`, and `\\` with the `windows` option) when they are the only characters in a path segment. Thus, `foo**/bar` is equivalent to `foo*/bar`, and `foo/a**b/bar` is equivalent to `foo/a*b/bar`, and _more than two_ consecutive stars in a glob path segment are regarded as _a single star_. Thus, `foo/***/bar` is equivalent to `foo/*/bar`. |
| `?` | Matches any character excluding path separators one time. Does _not match_ path separators or leading dots. |
| `[abc]` | Matches any characters inside the brackets. For example, `[abc]` would match the characters `a`, `b` or `c`, and nothing else. |
#### Matching behavior vs. Bash
Picomatch's matching features and expected results in unit tests are based on Bash's unit tests and the Bash 4.3 specification, with the following exceptions:
* Bash will match `foo/bar/baz` with `*`. Picomatch only matches nested directories with `**`.
* Bash greedily matches with negated extglobs. For example, Bash 4.3 says that `!(foo)*` should match `foo` and `foobar`, since the trailing `*` bracktracks to match the preceding pattern. This is very memory-inefficient, and IMHO, also incorrect. Picomatch would return `false` for both `foo` and `foobar`.
<br>
### Advanced globbing
* [extglobs](#extglobs)
* [POSIX brackets](#posix-brackets)
* [Braces](#brace-expansion)
#### Extglobs
| **Pattern** | **Description** |
| --- | --- |
| `@(pattern)` | Match _only one_ consecutive occurrence of `pattern` |
| `*(pattern)` | Match _zero or more_ consecutive occurrences of `pattern` |
| `+(pattern)` | Match _one or more_ consecutive occurrences of `pattern` |
| `?(pattern)` | Match _zero or **one**_ consecutive occurrences of `pattern` |
| `!(pattern)` | Match _anything but_ `pattern` |
**Examples**
```js
const pm = require('picomatch');
// *(pattern) matches ZERO or more of "pattern"
console.log(pm.isMatch('a', 'a*(z)')); // true
console.log(pm.isMatch('az', 'a*(z)')); // true
console.log(pm.isMatch('azzz', 'a*(z)')); // true
// +(pattern) matches ONE or more of "pattern"
console.log(pm.isMatch('a', 'a+(z)')); // false
console.log(pm.isMatch('az', 'a+(z)')); // true
console.log(pm.isMatch('azzz', 'a+(z)')); // true
// supports multiple extglobs
console.log(pm.isMatch('foo.bar', '!(foo).!(bar)')); // false
// supports nested extglobs
console.log(pm.isMatch('foo.bar', '!(!(foo)).!(!(bar))')); // true
```
#### POSIX brackets
POSIX classes are disabled by default. Enable this feature by setting the `posix` option to true.
**Enable POSIX bracket support**
```js
console.log(pm.makeRe('[[:word:]]+', { posix: true }));
//=> /^(?:(?=.)[A-Za-z0-9_]+\/?)$/
```
**Supported POSIX classes**
The following named POSIX bracket expressions are supported:
* `[:alnum:]` - Alphanumeric characters, equ `[a-zA-Z0-9]`
* `[:alpha:]` - Alphabetical characters, equivalent to `[a-zA-Z]`.
* `[:ascii:]` - ASCII characters, equivalent to `[\\x00-\\x7F]`.
* `[:blank:]` - Space and tab characters, equivalent to `[ \\t]`.
* `[:cntrl:]` - Control characters, equivalent to `[\\x00-\\x1F\\x7F]`.
* `[:digit:]` - Numerical digits, equivalent to `[0-9]`.
* `[:graph:]` - Graph characters, equivalent to `[\\x21-\\x7E]`.
* `[:lower:]` - Lowercase letters, equivalent to `[a-z]`.
* `[:print:]` - Print characters, equivalent to `[\\x20-\\x7E ]`.
* `[:punct:]` - Punctuation and symbols, equivalent to `[\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~]`.
* `[:space:]` - Extended space characters, equivalent to `[ \\t\\r\\n\\v\\f]`.
* `[:upper:]` - Uppercase letters, equivalent to `[A-Z]`.
* `[:word:]` - Word characters (letters, numbers and underscores), equivalent to `[A-Za-z0-9_]`.
* `[:xdigit:]` - Hexadecimal digits, equivalent to `[A-Fa-f0-9]`.
See the [Bash Reference Manual](https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html) for more information.
### Braces
Picomatch does not do brace expansion. For [brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html) and advanced matching with braces, use [micromatch](https://github.com/micromatch/micromatch) instead. Picomatch has very basic support for braces.
### Matching special characters as literals
If you wish to match the following special characters in a filepath, and you want to use these characters in your glob pattern, they must be escaped with backslashes or quotes:
**Special Characters**
Some characters that are used for matching in regular expressions are also regarded as valid file path characters on some platforms.
To match any of the following characters as literals: `$^*+?()[]
Examples:
```js
console.log(pm.makeRe('foo/bar \\(1\\)'));
console.log(pm.makeRe('foo/bar \\(1\\)'));
```
<br>
<br>
## Library Comparisons
The following table shows which features are supported by [minimatch](https://github.com/isaacs/minimatch), [micromatch](https://github.com/micromatch/micromatch), [picomatch](https://github.com/micromatch/picomatch), [nanomatch](https://github.com/micromatch/nanomatch), [extglob](https://github.com/micromatch/extglob), [braces](https://github.com/micromatch/braces), and [expand-brackets](https://github.com/micromatch/expand-brackets).
| **Feature** | `minimatch` | `micromatch` | `picomatch` | `nanomatch` | `extglob` | `braces` | `expand-brackets` |
| --- | --- | --- | --- | --- | --- | --- | --- |
| Wildcard matching (`*?+`) | ✔ | ✔ | ✔ | ✔ | - | - | - |
| Advancing globbing | ✔ | ✔ | ✔ | - | - | - | - |
| Brace _matching_ | ✔ | ✔ | ✔ | - | - | ✔ | - |
| Brace _expansion_ | ✔ | ✔ | - | - | - | ✔ | - |
| Extglobs | partial | ✔ | ✔ | - | ✔ | - | - |
| Posix brackets | - | ✔ | ✔ | - | - | - | ✔ |
| Regular expression syntax | - | ✔ | ✔ | ✔ | ✔ | - | ✔ |
| File system operations | - | - | - | - | - | - | - |
<br>
<br>
## Benchmarks
Performance comparison of picomatch and minimatch.
_(Pay special attention to the last three benchmarks. Minimatch freezes on long ranges.)_
```
# .makeRe star (*)
picomatch x 4,449,159 ops/sec ±0.24% (97 runs sampled)
minimatch x 632,772 ops/sec ±0.14% (98 runs sampled)
# .makeRe star; dot=true (*)
picomatch x 3,500,079 ops/sec ±0.26% (99 runs sampled)
minimatch x 564,916 ops/sec ±0.23% (96 runs sampled)
# .makeRe globstar (**)
picomatch x 3,261,000 ops/sec ±0.27% (98 runs sampled)
minimatch x 1,664,766 ops/sec ±0.20% (100 runs sampled)
# .makeRe globstars (**/**/**)
picomatch x 3,284,469 ops/sec ±0.18% (97 runs sampled)
minimatch x 1,435,880 ops/sec ±0.34% (95 runs sampled)
# .makeRe with leading star (*.txt)
picomatch x 3,100,197 ops/sec ±0.35% (99 runs sampled)
minimatch x 428,347 ops/sec ±0.42% (94 runs sampled)
# .makeRe - basic braces ({a,b,c}*.txt)
picomatch x 443,578 ops/sec ±1.33% (89 runs sampled)
minimatch x 107,143 ops/sec ±0.35% (94 runs sampled)
# .makeRe - short ranges ({a..z}*.txt)
picomatch x 415,484 ops/sec ±0.76% (96 runs sampled)
minimatch x 14,299 ops/sec ±0.26% (96 runs sampled)
# .makeRe - medium ranges ({1..100000}*.txt)
picomatch x 395,020 ops/sec ±0.87% (89 runs sampled)
minimatch x 2 ops/sec ±4.59% (10 runs sampled)
# .makeRe - long ranges ({1..10000000}*.txt)
picomatch x 400,036 ops/sec ±0.83% (90 runs sampled)
minimatch (FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory)
```
<br>
<br>
## Philosophies
The goal of this library is to be blazing fast, without compromising on accuracy.
**Accuracy**
The number one of goal of this library is accuracy. However, it's not unusual for different glob implementations to have different rules for matching behavior, even with simple wildcard matching. It gets increasingly more complicated when combinations of different features are combined, like when extglobs are combined with globstars, braces, slashes, and so on: `!(**/{a,b,*/c})`.
Thus, given that there is no canonical glob specification to use as a single source of truth when differences of opinion arise regarding behavior, sometimes we have to implement our best judgement and rely on feedback from users to make improvements.
**Performance**
Although this library performs well in benchmarks, and in most cases it's faster than other popular libraries we benchmarked against, we will always choose accuracy over performance. It's not helpful to anyone if our library is faster at returning the wrong answer.
<br>
<br>
## About
<details>
<summary><strong>Contributing</strong></summary>
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
Please read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards.
</details>
<details>
<summary><strong>Running Tests</strong></summary>
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
```sh
npm install && npm test
```
</details>
<details>
<summary><strong>Building docs</strong></summary>
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
To generate the readme, run the following command:
```sh
npm install -g verbose/verb#dev verb-generate-readme && verb
```
</details>
### Author
**Jon Schlinkert**
* [GitHub Profile](https://github.com/jonschlinkert)
* [Twitter Profile](https://twitter.com/jonschlinkert)
* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)
### License
Copyright © 2017-present, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT License](LICENSE).
@@ -0,0 +1,39 @@
/**
* Tracks newlines during parsing in order to provide an efficient API for
* determining the one-indexed `{ line, col }` position for any offset
* within the input.
*/
class LineCounter {
constructor() {
this.lineStarts = [];
/**
* Should be called in ascending order. Otherwise, call
* `lineCounter.lineStarts.sort()` before calling `linePos()`.
*/
this.addNewLine = (offset) => this.lineStarts.push(offset);
/**
* Performs a binary search and returns the 1-indexed { line, col }
* position of `offset`. If `line === 0`, `addNewLine` has never been
* called or `offset` is before the first known newline.
*/
this.linePos = (offset) => {
let low = 0;
let high = this.lineStarts.length;
while (low < high) {
const mid = (low + high) >> 1; // Math.floor((low + high) / 2)
if (this.lineStarts[mid] < offset)
low = mid + 1;
else
high = mid;
}
if (this.lineStarts[low] === offset)
return { line: low + 1, col: 1 };
if (low === 0)
return { line: 0, col: offset };
const start = this.lineStarts[low - 1];
return { line: low, col: offset - start + 1 };
};
}
}
export { LineCounter };
@@ -0,0 +1,14 @@
'use strict';
var s;
if (process.env.NODE_ENV === 'production') {
s = require('./cjs/react-dom-server.node.production.js');
} else {
s = require('./cjs/react-dom-server.node.development.js');
}
exports.version = s.version;
exports.prerenderToNodeStream = s.prerenderToNodeStream;
exports.prerender = s.prerender;
exports.resumeAndPrerenderToNodeStream = s.resumeAndPrerenderToNodeStream;
exports.resumeAndPrerender = s.resumeAndPrerender;
@@ -0,0 +1 @@
{"version":3,"file":"inversify-InversifyJs-issue-1864-unbindCallShouldNotTrowPlanningErrorsint.spec.d.ts","sourceRoot":"","sources":["../../../src/issues/inversify-InversifyJs-issue-1864-unbindCallShouldNotTrowPlanningErrorsint.spec.ts"],"names":[],"mappings":"AAEA,OAAO,kBAAkB,CAAC"}
@@ -0,0 +1,16 @@
import type { TSchema, SchemaOptions } from '../schema/index';
import type { Static } from '../static/index';
import { type TUnion } from '../union/index';
import { TMappedKey, TMappedResult } from '../mapped/index';
import { UnionToTuple } from '../helpers/index';
import { type TExtendsFromMappedKey } from './extends-from-mapped-key';
import { type TExtendsFromMappedResult } from './extends-from-mapped-result';
type TExtendsResolve<L extends TSchema, R extends TSchema, T extends TSchema, U extends TSchema> = ((Static<L> extends Static<R> ? T : U) extends infer O extends TSchema ? UnionToTuple<O> extends [infer X extends TSchema, infer Y extends TSchema] ? TUnion<[X, Y]> : O : never);
export type TExtends<L extends TSchema, R extends TSchema, T extends TSchema, F extends TSchema> = TExtendsResolve<L, R, T, F>;
/** `[Json]` Creates a Conditional type */
export declare function Extends<L extends TMappedResult, R extends TSchema, T extends TSchema, F extends TSchema>(L: L, R: R, T: T, F: F, options?: SchemaOptions): TExtendsFromMappedResult<L, R, T, F>;
/** `[Json]` Creates a Conditional type */
export declare function Extends<L extends TMappedKey, R extends TSchema, T extends TSchema, F extends TSchema>(L: L, R: R, T: T, F: F, options?: SchemaOptions): TExtendsFromMappedKey<L, R, T, F>;
/** `[Json]` Creates a Conditional type */
export declare function Extends<L extends TSchema, R extends TSchema, T extends TSchema, F extends TSchema>(L: L, R: R, T: T, F: F, options?: SchemaOptions): TExtends<L, R, T, F>;
export {};
Loaded 100 of 35554 files, more files were not shown because too many files have changed in this diff. Show more