This commit is contained in:
Tomas Mirchev 2025-05-09 05:30:08 +02:00
parent 7bb10e7df4
commit 73367bad9e
5322 changed files with 1266973 additions and 313 deletions

View File

@ -0,0 +1 @@
{"version":3,"names":["_fs","data","require","_gensync","readFile","exports","gensync","sync","fs","readFileSync","errback","stat","statSync"],"sources":["../../src/gensync-utils/fs.ts"],"sourcesContent":["import fs from \"fs\";\nimport gensync from \"gensync\";\n\nexport const readFile = gensync<[filepath: string, encoding: \"utf8\"], string>({\n sync: fs.readFileSync,\n errback: fs.readFile,\n});\n\nexport const stat = gensync({\n sync: fs.statSync,\n errback: fs.stat,\n});\n"],"mappings":";;;;;;AAAA,SAAAA,IAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,GAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,SAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAMG,QAAQ,GAAAC,OAAA,CAAAD,QAAA,GAAGE,SAAMA,CAAC,CAA+C;EAC5EC,IAAI,EAAEC,IAACA,CAAC,CAACC,YAAY;EACrBC,OAAO,EAAEF,IAACA,CAAC,CAACJ;AACd,CAAC,CAAC;AAEK,MAAMO,IAAI,GAAAN,OAAA,CAAAM,IAAA,GAAGL,SAAMA,CAAC,CAAC;EAC1BC,IAAI,EAAEC,IAACA,CAAC,CAACI,QAAQ;EACjBF,OAAO,EAAEF,IAACA,CAAC,CAACG;AACd,CAAC,CAAC;AAAC","ignoreList":[]}

View File

@ -0,0 +1,39 @@
/**
Check if [`argv`](https://nodejs.org/docs/latest/api/process.html#process_process_argv) has a specific flag.
@param flag - CLI flag to look for. The `--` prefix is optional.
@param argv - CLI arguments. Default: `process.argv`.
@returns Whether the flag exists.
@example
```
// $ ts-node foo.ts -f --unicorn --foo=bar -- --rainbow
// foo.ts
import hasFlag = require('has-flag');
hasFlag('unicorn');
//=> true
hasFlag('--unicorn');
//=> true
hasFlag('f');
//=> true
hasFlag('-f');
//=> true
hasFlag('foo=bar');
//=> true
hasFlag('foo');
//=> false
hasFlag('rainbow');
//=> false
```
*/
declare function hasFlag(flag: string, argv?: string[]): boolean;
export = hasFlag;

View File

@ -0,0 +1,59 @@
/**
* @license React
* use-sync-external-store-shim.native.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";
var React = require("react");
function is(x, y) {
return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);
}
var objectIs = "function" === typeof Object.is ? Object.is : is,
useState = React.useState,
useEffect = React.useEffect,
useLayoutEffect = React.useLayoutEffect,
useDebugValue = React.useDebugValue;
function useSyncExternalStore$1(subscribe, getSnapshot) {
var value = getSnapshot(),
_useState = useState({ inst: { value: value, getSnapshot: getSnapshot } }),
inst = _useState[0].inst,
forceUpdate = _useState[1];
useLayoutEffect(
function () {
inst.value = value;
inst.getSnapshot = getSnapshot;
checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
},
[subscribe, value, getSnapshot]
);
useEffect(
function () {
checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
return subscribe(function () {
checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });
});
},
[subscribe]
);
useDebugValue(value);
return value;
}
function checkIfSnapshotChanged(inst) {
var latestGetSnapshot = inst.getSnapshot;
inst = inst.value;
try {
var nextValue = latestGetSnapshot();
return !objectIs(inst, nextValue);
} catch (error) {
return !0;
}
}
exports.useSyncExternalStore =
void 0 !== React.useSyncExternalStore
? React.useSyncExternalStore
: useSyncExternalStore$1;

View File

@ -0,0 +1,35 @@
const unicode = require('../lib/unicode')
module.exports = {
isSpaceSeparator (c) {
return typeof c === 'string' && unicode.Space_Separator.test(c)
},
isIdStartChar (c) {
return typeof c === 'string' && (
(c >= 'a' && c <= 'z') ||
(c >= 'A' && c <= 'Z') ||
(c === '$') || (c === '_') ||
unicode.ID_Start.test(c)
)
},
isIdContinueChar (c) {
return typeof c === 'string' && (
(c >= 'a' && c <= 'z') ||
(c >= 'A' && c <= 'Z') ||
(c >= '0' && c <= '9') ||
(c === '$') || (c === '_') ||
(c === '\u200C') || (c === '\u200D') ||
unicode.ID_Continue.test(c)
)
},
isDigit (c) {
return typeof c === 'string' && /[0-9]/.test(c)
},
isHexDigit (c) {
return typeof c === 'string' && /[0-9A-Fa-f]/.test(c)
},
}

View File

@ -0,0 +1,61 @@
type Pathname = string
interface TestResult {
ignored: boolean
unignored: boolean
}
export interface Ignore {
/**
* Adds one or several rules to the current manager.
* @param {string[]} patterns
* @returns IgnoreBase
*/
add(patterns: string | Ignore | readonly (string | Ignore)[]): this
/**
* Filters the given array of pathnames, and returns the filtered array.
* NOTICE that each path here should be a relative path to the root of your repository.
* @param paths the array of paths to be filtered.
* @returns The filtered array of paths
*/
filter(pathnames: readonly Pathname[]): Pathname[]
/**
* Creates a filter function which could filter
* an array of paths with Array.prototype.filter.
*/
createFilter(): (pathname: Pathname) => boolean
/**
* Returns Boolean whether pathname should be ignored.
* @param {string} pathname a path to check
* @returns boolean
*/
ignores(pathname: Pathname): boolean
/**
* Returns whether pathname should be ignored or unignored
* @param {string} pathname a path to check
* @returns TestResult
*/
test(pathname: Pathname): TestResult
}
export interface Options {
ignorecase?: boolean
// For compatibility
ignoreCase?: boolean
allowRelativePaths?: boolean
}
/**
* Creates new ignore manager.
*/
declare function ignore(options?: Options): Ignore
declare namespace ignore {
export function isPathValid (pathname: string): boolean
}
export default ignore

View File

@ -0,0 +1,52 @@
{
"name": "esrecurse",
"description": "ECMAScript AST recursive visitor",
"homepage": "https://github.com/estools/esrecurse",
"main": "esrecurse.js",
"version": "4.3.0",
"engines": {
"node": ">=4.0"
},
"maintainers": [
{
"name": "Yusuke Suzuki",
"email": "utatane.tea@gmail.com",
"web": "https://github.com/Constellation"
}
],
"repository": {
"type": "git",
"url": "https://github.com/estools/esrecurse.git"
},
"dependencies": {
"estraverse": "^5.2.0"
},
"devDependencies": {
"babel-cli": "^6.24.1",
"babel-eslint": "^7.2.3",
"babel-preset-es2015": "^6.24.1",
"babel-register": "^6.24.1",
"chai": "^4.0.2",
"esprima": "^4.0.0",
"gulp": "^3.9.0",
"gulp-bump": "^2.7.0",
"gulp-eslint": "^4.0.0",
"gulp-filter": "^5.0.0",
"gulp-git": "^2.4.1",
"gulp-mocha": "^4.3.1",
"gulp-tag-version": "^1.2.1",
"jsdoc": "^3.3.0-alpha10",
"minimist": "^1.1.0"
},
"license": "BSD-2-Clause",
"scripts": {
"test": "gulp travis",
"unit-test": "gulp test",
"lint": "gulp lint"
},
"babel": {
"presets": [
"es2015"
]
}
}

View File

@ -0,0 +1,5 @@
'use strict'
module.exports.isClean = Symbol('isClean')
module.exports.my = Symbol('my')

View File

@ -0,0 +1,9 @@
module.exports = {
y: 1 << 0,
n: 1 << 1,
a: 1 << 2,
p: 1 << 3,
u: 1 << 4,
x: 1 << 5,
d: 1 << 6
}

View File

@ -0,0 +1 @@
module.exports={A:{A:{"2":"K D E F A B mC"},B:{"1":"0 9 X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I","2":"C L M G N O P H R S T U V W","16":"Q"},C:{"1":"0 9 T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC","2":"1 2 3 4 5 6 7 8 nC LC J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S qC rC"},D:{"1":"0 9 X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC","2":"1 2 3 4 5 6 7 8 J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R S T U V W"},E:{"1":"F A B C L M G wC TC FC GC xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C","2":"J PB K D E sC SC tC uC vC"},F:{"1":"0 AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z","2":"1 2 3 4 5 6 7 8 F B C G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B 4C 5C 6C 7C FC kC 8C GC"},G:{"1":"ED FD GD HD ID JD KD LD MD ND OD PD QD RD SD UC VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC","2":"E SC 9C lC AD BD CD DD"},H:{"2":"WD"},I:{"1":"I","2":"LC J XD YD ZD aD lC bD cD"},J:{"2":"D A"},K:{"1":"H","2":"A B C FC kC GC"},L:{"1":"I"},M:{"1":"EC"},N:{"2":"A B"},O:{"1":"HC"},P:{"1":"1 2 3 4 5 6 7 8 mD IC JC KC nD","2":"J dD eD fD gD hD TC iD jD kD lD"},Q:{"2":"oD"},R:{"1":"pD"},S:{"1":"rD","2":"qD"}},B:5,C:"selector list argument of :not()",D:true};

View File

@ -0,0 +1 @@
module.exports={A:{A:{"2":"K D E F mC","33":"A B"},B:{"1":"0 9 o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I","33":"C L M G N O P","132":"Q H R S T U V W","260":"X Y Z a b c d e f g h i j k l m n"},C:{"1":"0 9 gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC","2":"nC LC J PB qC rC","33":"1 2 3 4 5 6 7 8 K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB"},D:{"1":"0 9 X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC","2":"1 2 3 4 5 6 7 8 J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB","132":"sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R S T U V W"},E:{"1":"JC bC cC dC eC fC 2C KC gC hC iC jC 3C","2":"J PB sC SC","33":"K D E F A B C L M G tC uC vC wC TC FC GC xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C"},F:{"1":"0 a b c d e f g h i j k l m n o p q r s t u v w x y z","2":"1 2 3 4 5 6 7 8 F B C G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB 4C 5C 6C 7C FC kC 8C GC","132":"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 Q H R OC S T U V W X Y Z"},G:{"1":"JC bC cC dC eC fC VD KC gC hC iC jC","2":"SC 9C","33":"E lC AD BD CD DD ED FD GD HD ID JD KD LD MD ND OD PD QD RD SD UC VC HC TD IC WC XC YC ZC aC UD"},H:{"2":"WD"},I:{"1":"I","2":"LC J XD YD ZD aD lC bD cD"},J:{"2":"D A"},K:{"1":"H","2":"A B C FC kC GC"},L:{"1":"I"},M:{"1":"EC"},N:{"2":"A B"},O:{"1":"HC"},P:{"1":"1 2 3 4 5 6 7 8 eD fD gD hD TC iD jD kD lD mD IC JC KC nD","2":"J","132":"dD"},Q:{"1":"oD"},R:{"1":"pD"},S:{"1":"qD rD"}},B:4,C:"CSS Hyphenation",D:true};

View File

@ -0,0 +1,97 @@
# @eslint/config-helpers
## Description
Helper utilities for creating ESLint configuration.
## Installation
For Node.js and compatible runtimes:
```shell
npm install @eslint/config-helpers
# or
yarn add @eslint/config-helpers
# or
pnpm install @eslint/config-helpers
# or
bun install @eslint/config-helpers
```
For Deno:
```shell
deno add @eslint/config-helpers
```
## Usage
### `defineConfig()`
The `defineConfig()` function allows you to specify an ESLint configuration with full type checking and additional capabilities, such as `extends`. Here's an example:
```js
// eslint.config.js
import { defineConfig } from "@eslint/config-helpers";
import js from "@eslint/js";
export default defineConfig([
{
files: ["src/**/*.js"],
plugins: { js },
extends: ["js/recommended"],
rules: {
semi: "error",
"prefer-const": "error",
},
},
{
files: ["test/**/*.js"],
rules: {
"no-console": "off",
},
},
]);
```
### `globalIgnores()`
The `globalIgnores()` function allows you to specify patterns for files and directories that should be globally ignored by ESLint. This is useful for excluding files that you don't want to lint, such as build directories or third-party libraries. Here's an example:
```js
// eslint.config.js
import { defineConfig, globalIgnores } from "@eslint/config-helpers";
export default defineConfig([
{
files: ["src/**/*.js"],
rules: {
semi: "error",
"prefer-const": "error",
},
},
globalIgnores(["node_modules/", "dist/", "coverage/"]),
]);
```
## License
Apache 2.0
<!-- NOTE: This section is autogenerated. Do not manually edit.-->
<!--sponsorsstart-->
## Sponsors
The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. [Become a Sponsor](https://eslint.org/donate)
to get your logo on our READMEs and [website](https://eslint.org/sponsors).
<h3>Platinum Sponsors</h3>
<p><a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="128"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="128"></a></p><h3>Gold Sponsors</h3>
<p><a href="https://qlty.sh/"><img src="https://images.opencollective.com/qltysh/33d157d/logo.png" alt="Qlty Software" height="96"></a> <a href="https://trunk.io/"><img src="https://images.opencollective.com/trunkio/fb92d60/avatar.png" alt="trunk.io" height="96"></a></p><h3>Silver Sponsors</h3>
<p><a href="https://vite.dev/"><img src="https://images.opencollective.com/vite/e6d15e1/logo.png" alt="Vite" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://stackblitz.com"><img src="https://avatars.githubusercontent.com/u/28635252" alt="StackBlitz" height="64"></a></p><h3>Bronze Sponsors</h3>
<p><a href="https://cybozu.co.jp/"><img src="https://images.opencollective.com/cybozu/933e46d/logo.png" alt="Cybozu" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.gitbook.com"><img src="https://avatars.githubusercontent.com/u/7111340" alt="GitBook" height="32"></a> <a href="https://nolebase.ayaka.io"><img src="https://avatars.githubusercontent.com/u/11081491" alt="Neko" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104" alt="Nx" height="32"></a> <a href="https://opensource.mercedes-benz.com/"><img src="https://avatars.githubusercontent.com/u/34240465" alt="Mercedes-Benz Group" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774" alt="HeroCoders" height="32"></a> <a href="https://www.lambdatest.com"><img src="https://avatars.githubusercontent.com/u/171592363" alt="LambdaTest" height="32"></a></p>
<h3>Technology Sponsors</h3>
Technology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work.
<p><a href="https://netlify.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/netlify-icon.svg" alt="Netlify" height="32"></a> <a href="https://algolia.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/algolia-icon.svg" alt="Algolia" height="32"></a> <a href="https://1password.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/1password-icon.svg" alt="1Password" height="32"></a></p>
<!--sponsorsend-->

View File

@ -0,0 +1,89 @@
# has-flag [![Build Status](https://travis-ci.org/sindresorhus/has-flag.svg?branch=master)](https://travis-ci.org/sindresorhus/has-flag)
> Check if [`argv`](https://nodejs.org/docs/latest/api/process.html#process_process_argv) has a specific flag
Correctly stops looking after an `--` argument terminator.
---
<div align="center">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-has-flag?utm_source=npm-has-flag&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
</b>
<br>
<sub>
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
</sub>
</div>
---
## Install
```
$ npm install has-flag
```
## Usage
```js
// foo.js
const hasFlag = require('has-flag');
hasFlag('unicorn');
//=> true
hasFlag('--unicorn');
//=> true
hasFlag('f');
//=> true
hasFlag('-f');
//=> true
hasFlag('foo=bar');
//=> true
hasFlag('foo');
//=> false
hasFlag('rainbow');
//=> false
```
```
$ node foo.js -f --unicorn --foo=bar -- --rainbow
```
## API
### hasFlag(flag, [argv])
Returns a boolean for whether the flag exists.
#### flag
Type: `string`
CLI flag to look for. The `--` prefix is optional.
#### argv
Type: `string[]`<br>
Default: `process.argv`
CLI arguments.
## Security
To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)

View File

@ -0,0 +1,42 @@
{
"name": "cookie",
"version": "1.0.2",
"description": "HTTP server cookie parsing and serialization",
"keywords": [
"cookie",
"cookies"
],
"repository": "jshttp/cookie",
"license": "MIT",
"author": "Roman Shtylman <shtylman@gmail.com>",
"contributors": [
"Douglas Christopher Wilson <doug@somethingdoug.com>"
],
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist/"
],
"scripts": {
"bench": "vitest bench",
"build": "ts-scripts build",
"format": "ts-scripts format",
"prepare": "ts-scripts install",
"prepublishOnly": "npm run build",
"specs": "ts-scripts specs",
"test": "ts-scripts test"
},
"devDependencies": {
"@borderless/ts-scripts": "^0.15.0",
"@vitest/coverage-v8": "^2.1.2",
"top-sites": "1.1.194",
"typescript": "^5.6.2",
"vitest": "^2.1.2"
},
"engines": {
"node": ">=18"
},
"ts-scripts": {
"project": "tsconfig.build.json"
}
}

View File

@ -0,0 +1,396 @@
'use strict';
/* eslint-disable jsdoc/valid-types -- doesn't allow `readonly`.
TODO: remove eslint-disable when https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/164 is fixed
*/
/**
* @typedef {{ readonly [type: string]: ReadonlyArray<string> }} VisitorKeys
*/
/* eslint-enable jsdoc/valid-types -- doesn't allow `readonly string[]`. TODO: check why */
/**
* @type {VisitorKeys}
*/
const KEYS = {
ArrayExpression: [
"elements"
],
ArrayPattern: [
"elements"
],
ArrowFunctionExpression: [
"params",
"body"
],
AssignmentExpression: [
"left",
"right"
],
AssignmentPattern: [
"left",
"right"
],
AwaitExpression: [
"argument"
],
BinaryExpression: [
"left",
"right"
],
BlockStatement: [
"body"
],
BreakStatement: [
"label"
],
CallExpression: [
"callee",
"arguments"
],
CatchClause: [
"param",
"body"
],
ChainExpression: [
"expression"
],
ClassBody: [
"body"
],
ClassDeclaration: [
"id",
"superClass",
"body"
],
ClassExpression: [
"id",
"superClass",
"body"
],
ConditionalExpression: [
"test",
"consequent",
"alternate"
],
ContinueStatement: [
"label"
],
DebuggerStatement: [],
DoWhileStatement: [
"body",
"test"
],
EmptyStatement: [],
ExperimentalRestProperty: [
"argument"
],
ExperimentalSpreadProperty: [
"argument"
],
ExportAllDeclaration: [
"exported",
"source",
"attributes"
],
ExportDefaultDeclaration: [
"declaration"
],
ExportNamedDeclaration: [
"declaration",
"specifiers",
"source",
"attributes"
],
ExportSpecifier: [
"exported",
"local"
],
ExpressionStatement: [
"expression"
],
ForInStatement: [
"left",
"right",
"body"
],
ForOfStatement: [
"left",
"right",
"body"
],
ForStatement: [
"init",
"test",
"update",
"body"
],
FunctionDeclaration: [
"id",
"params",
"body"
],
FunctionExpression: [
"id",
"params",
"body"
],
Identifier: [],
IfStatement: [
"test",
"consequent",
"alternate"
],
ImportAttribute: [
"key",
"value"
],
ImportDeclaration: [
"specifiers",
"source",
"attributes"
],
ImportDefaultSpecifier: [
"local"
],
ImportExpression: [
"source",
"options"
],
ImportNamespaceSpecifier: [
"local"
],
ImportSpecifier: [
"imported",
"local"
],
JSXAttribute: [
"name",
"value"
],
JSXClosingElement: [
"name"
],
JSXClosingFragment: [],
JSXElement: [
"openingElement",
"children",
"closingElement"
],
JSXEmptyExpression: [],
JSXExpressionContainer: [
"expression"
],
JSXFragment: [
"openingFragment",
"children",
"closingFragment"
],
JSXIdentifier: [],
JSXMemberExpression: [
"object",
"property"
],
JSXNamespacedName: [
"namespace",
"name"
],
JSXOpeningElement: [
"name",
"attributes"
],
JSXOpeningFragment: [],
JSXSpreadAttribute: [
"argument"
],
JSXSpreadChild: [
"expression"
],
JSXText: [],
LabeledStatement: [
"label",
"body"
],
Literal: [],
LogicalExpression: [
"left",
"right"
],
MemberExpression: [
"object",
"property"
],
MetaProperty: [
"meta",
"property"
],
MethodDefinition: [
"key",
"value"
],
NewExpression: [
"callee",
"arguments"
],
ObjectExpression: [
"properties"
],
ObjectPattern: [
"properties"
],
PrivateIdentifier: [],
Program: [
"body"
],
Property: [
"key",
"value"
],
PropertyDefinition: [
"key",
"value"
],
RestElement: [
"argument"
],
ReturnStatement: [
"argument"
],
SequenceExpression: [
"expressions"
],
SpreadElement: [
"argument"
],
StaticBlock: [
"body"
],
Super: [],
SwitchCase: [
"test",
"consequent"
],
SwitchStatement: [
"discriminant",
"cases"
],
TaggedTemplateExpression: [
"tag",
"quasi"
],
TemplateElement: [],
TemplateLiteral: [
"quasis",
"expressions"
],
ThisExpression: [],
ThrowStatement: [
"argument"
],
TryStatement: [
"block",
"handler",
"finalizer"
],
UnaryExpression: [
"argument"
],
UpdateExpression: [
"argument"
],
VariableDeclaration: [
"declarations"
],
VariableDeclarator: [
"id",
"init"
],
WhileStatement: [
"test",
"body"
],
WithStatement: [
"object",
"body"
],
YieldExpression: [
"argument"
]
};
// Types.
const NODE_TYPES = Object.keys(KEYS);
// Freeze the keys.
for (const type of NODE_TYPES) {
Object.freeze(KEYS[type]);
}
Object.freeze(KEYS);
/**
* @author Toru Nagashima <https://github.com/mysticatea>
* See LICENSE file in root directory for full license.
*/
/**
* @typedef {import('./visitor-keys.js').VisitorKeys} VisitorKeys
*/
// List to ignore keys.
const KEY_BLACKLIST = new Set([
"parent",
"leadingComments",
"trailingComments"
]);
/**
* Check whether a given key should be used or not.
* @param {string} key The key to check.
* @returns {boolean} `true` if the key should be used.
*/
function filterKey(key) {
return !KEY_BLACKLIST.has(key) && key[0] !== "_";
}
/* eslint-disable jsdoc/valid-types -- doesn't allow `readonly`.
TODO: remove eslint-disable when https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/164 is fixed
*/
/**
* Get visitor keys of a given node.
* @param {Object} node The AST node to get keys.
* @returns {readonly string[]} Visitor keys of the node.
*/
function getKeys(node) {
return Object.keys(node).filter(filterKey);
}
/* eslint-enable jsdoc/valid-types -- doesn't allow `readonly` */
/**
* Make the union set with `KEYS` and given keys.
* @param {VisitorKeys} additionalKeys The additional keys.
* @returns {VisitorKeys} The union set.
*/
function unionWith(additionalKeys) {
const retv = /** @type {{ [type: string]: ReadonlyArray<string> }} */
(Object.assign({}, KEYS));
for (const type of Object.keys(additionalKeys)) {
if (Object.hasOwn(retv, type)) {
const keys = new Set(additionalKeys[type]);
for (const key of retv[type]) {
keys.add(key);
}
retv[type] = Object.freeze(Array.from(keys));
} else {
retv[type] = Object.freeze(Array.from(additionalKeys[type]));
}
}
return Object.freeze(retv);
}
exports.KEYS = KEYS;
exports.getKeys = getKeys;
exports.unionWith = unionWith;

View File

@ -0,0 +1 @@
module.exports={C:{"135":0.04712,"136":0.11781,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 137 138 139 140 3.5 3.6"},D:{"43":0.04712,"48":0.02356,"51":0.02356,"122":0.04712,"132":0.1885,"133":1.34089,"134":4.89661,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 44 45 46 47 49 50 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 123 124 125 126 127 128 129 130 131 135 136 137 138"},F:{"85":0.02356,"117":0.09425,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"118":0.14137,"131":0.04712,"132":0.84823,"133":0.61261,"134":1.48226,_:"12 13 14 15 16 17 18 79 80 81 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 119 120 121 122 123 124 125 126 127 128 129 130"},E:{_:"0 4 5 6 7 8 9 10 11 12 13 14 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 11.1 12.1 13.1 14.1 15.1 15.2-15.3 15.4 15.5 15.6 16.0 16.1 16.2 16.3 16.4 16.5 17.0 17.1 17.2 17.3 17.4 17.5 17.6 18.0 18.2 18.4","16.6":0.44768,"18.1":0.07069,"18.3":0.23562},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00121,"5.0-5.1":0,"6.0-6.1":0.00364,"7.0-7.1":0.00242,"8.1-8.4":0,"9.0-9.2":0.00182,"9.3":0.00848,"10.0-10.2":0.00061,"10.3":0.01393,"11.0-11.2":0.06422,"11.3-11.4":0.00424,"12.0-12.1":0.00242,"12.2-12.5":0.05998,"13.0-13.1":0.00121,"13.2":0.00182,"13.3":0.00242,"13.4-13.7":0.00848,"14.0-14.4":0.0212,"14.5-14.8":0.02545,"15.0-15.1":0.01393,"15.2-15.3":0.01393,"15.4":0.01696,"15.5":0.01939,"15.6-15.8":0.23871,"16.0":0.03393,"16.1":0.06967,"16.2":0.03635,"16.3":0.06301,"16.4":0.01393,"16.5":0.02605,"16.6-16.7":0.28293,"17.0":0.01696,"17.1":0.03029,"17.2":0.02302,"17.3":0.03211,"17.4":0.06422,"17.5":0.14298,"17.6-17.7":0.41501,"18.0":0.11632,"18.1":0.38047,"18.2":0.17024,"18.3":3.55817,"18.4":0.05271},P:{"23":0.05071,"24":0.02028,"25":0.09127,"26":0.02028,"27":1.00401,_:"4 20 21 22 5.0-5.4 6.2-6.4 7.2-7.4 8.2 9.2 10.1 11.1-11.2 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0"},I:{"0":0.11762,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.00004,"4.4":0,"4.4.3-4.4.4":0.00013},K:{"0":0.33004,_:"10 11 12 11.1 11.5 12.1"},A:{_:"6 7 8 9 10 11 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{_:"0"},Q:{_:"14.9"},O:{"0":0.07072},H:{"0":0},L:{"0":80.52874}};

View File

@ -0,0 +1,32 @@
export type Manifest = {
routes: Record<
string,
{
filePath?: string
preloads?: Array<string>
assets?: Array<RouterManagedTag>
}
>
}
export type RouterManagedTag =
| {
tag: 'title'
attrs?: Record<string, any>
children: string
}
| {
tag: 'meta' | 'link'
attrs?: Record<string, any>
children?: never
}
| {
tag: 'script'
attrs?: Record<string, any>
children?: string
}
| {
tag: 'style'
attrs?: Record<string, any>
children?: string
}

View File

@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright 2022 Andrey Sitnik <andrey@sitnik.ru> and other contributors
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.

View File

@ -0,0 +1 @@
{"version":3,"names":["_importDeferProxy","init","ns","constValue","v","proxy","run","_target","p","receiver","Proxy","defineProperty","deleteProperty","get","Reflect","getOwnPropertyDescriptor","getPrototypeOf","isExtensible","has","ownKeys","preventExtensions","set","setPrototypeOf"],"sources":["../../src/helpers/importDeferProxy.ts"],"sourcesContent":["/* @minVersion 7.23.0 */\n\nexport default function _importDeferProxy<T extends object>(\n init: () => T,\n): ProxyHandler<T> {\n var ns: T | null = null;\n\n var constValue = function <V extends boolean | null>(v: V) {\n return function (): V {\n return v;\n };\n };\n\n var proxy = function (run: Function) {\n return function (_target: T, p?: string | symbol, receiver?: any) {\n if (ns === null) ns = init();\n return run(ns, p, receiver);\n };\n };\n\n return new Proxy(\n {},\n {\n defineProperty: constValue(false),\n deleteProperty: constValue(false),\n get: proxy(Reflect.get),\n getOwnPropertyDescriptor: proxy(Reflect.getOwnPropertyDescriptor),\n getPrototypeOf: constValue(null),\n isExtensible: constValue(false),\n has: proxy(Reflect.has),\n ownKeys: proxy(Reflect.ownKeys),\n preventExtensions: constValue(true),\n set: constValue(false),\n setPrototypeOf: constValue(false),\n },\n );\n}\n"],"mappings":";;;;;;AAEe,SAASA,iBAAiBA,CACvCC,IAAa,EACI;EACjB,IAAIC,EAAY,GAAG,IAAI;EAEvB,IAAIC,UAAU,GAAG,SAAAA,CAAoCC,CAAI,EAAE;IACzD,OAAO,YAAe;MACpB,OAAOA,CAAC;IACV,CAAC;EACH,CAAC;EAED,IAAIC,KAAK,GAAG,SAAAA,CAAUC,GAAa,EAAE;IACnC,OAAO,UAAUC,OAAU,EAAEC,CAAmB,EAAEC,QAAc,EAAE;MAChE,IAAIP,EAAE,KAAK,IAAI,EAAEA,EAAE,GAAGD,IAAI,CAAC,CAAC;MAC5B,OAAOK,GAAG,CAACJ,EAAE,EAAEM,CAAC,EAAEC,QAAQ,CAAC;IAC7B,CAAC;EACH,CAAC;EAED,OAAO,IAAIC,KAAK,CACd,CAAC,CAAC,EACF;IACEC,cAAc,EAAER,UAAU,CAAC,KAAK,CAAC;IACjCS,cAAc,EAAET,UAAU,CAAC,KAAK,CAAC;IACjCU,GAAG,EAAER,KAAK,CAACS,OAAO,CAACD,GAAG,CAAC;IACvBE,wBAAwB,EAAEV,KAAK,CAACS,OAAO,CAACC,wBAAwB,CAAC;IACjEC,cAAc,EAAEb,UAAU,CAAC,IAAI,CAAC;IAChCc,YAAY,EAAEd,UAAU,CAAC,KAAK,CAAC;IAC/Be,GAAG,EAAEb,KAAK,CAACS,OAAO,CAACI,GAAG,CAAC;IACvBC,OAAO,EAAEd,KAAK,CAACS,OAAO,CAACK,OAAO,CAAC;IAC/BC,iBAAiB,EAAEjB,UAAU,CAAC,IAAI,CAAC;IACnCkB,GAAG,EAAElB,UAAU,CAAC,KAAK,CAAC;IACtBmB,cAAc,EAAEnB,UAAU,CAAC,KAAK;EAClC,CACF,CAAC;AACH","ignoreList":[]}

View File

@ -0,0 +1 @@
module.exports={A:{A:{"1":"D E F A B","2":"mC","8":"K"},B:{"1":"0 9 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 AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I"},C:{"1":"0 1 2 3 4 5 6 7 8 9 nC LC J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC qC rC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC"},E:{"1":"J PB K D E F A B C L M G sC SC tC uC vC TC FC GC xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C","1025":"wC"},F:{"1":"0 1 2 3 4 5 6 7 8 F B C G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z 4C 5C 6C 7C FC kC 8C GC"},G:{"1":"E DD ED FD GD HD ID JD KD LD MD ND OD PD QD RD SD UC VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC","2":"SC 9C lC","132":"AD BD CD"},H:{"2":"WD"},I:{"1":"LC I bD cD","260":"XD YD ZD","513":"J aD lC"},J:{"1":"D A"},K:{"1":"A B C H FC kC GC"},L:{"1":"I"},M:{"1":"EC"},N:{"1":"A B"},O:{"1":"HC"},P:{"1":"1 2 3 4 5 6 7 8 J dD eD fD gD hD TC iD jD kD lD mD IC JC KC nD"},Q:{"1":"oD"},R:{"1":"pD"},S:{"1":"qD rD"}},B:2,C:"CSS position:fixed",D:true};

View File

@ -0,0 +1,125 @@
/**
* @fileoverview enforce the location of arrow function bodies
* @author Sharmila Jesupaul
* @deprecated in ESLint v8.53.0
*/
"use strict";
const { isCommentToken, isNotOpeningParenToken } = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../shared/types').Rule} */
module.exports = {
meta: {
deprecated: {
message: "Formatting rules are being moved out of ESLint core.",
url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
deprecatedSince: "8.53.0",
availableUntil: "10.0.0",
replacedBy: [
{
message:
"ESLint Stylistic now maintains deprecated stylistic core rules.",
url: "https://eslint.style/guide/migration",
plugin: {
name: "@stylistic/eslint-plugin-js",
url: "https://eslint.style/packages/js",
},
rule: {
name: "implicit-arrow-linebreak",
url: "https://eslint.style/rules/js/implicit-arrow-linebreak",
},
},
],
},
type: "layout",
docs: {
description: "Enforce the location of arrow function bodies",
recommended: false,
url: "https://eslint.org/docs/latest/rules/implicit-arrow-linebreak",
},
fixable: "whitespace",
schema: [
{
enum: ["beside", "below"],
},
],
messages: {
expected: "Expected a linebreak before this expression.",
unexpected: "Expected no linebreak before this expression.",
},
},
create(context) {
const sourceCode = context.sourceCode;
const option = context.options[0] || "beside";
/**
* Validates the location of an arrow function body
* @param {ASTNode} node The arrow function body
* @returns {void}
*/
function validateExpression(node) {
if (node.body.type === "BlockStatement") {
return;
}
const arrowToken = sourceCode.getTokenBefore(
node.body,
isNotOpeningParenToken,
);
const firstTokenOfBody = sourceCode.getTokenAfter(arrowToken);
if (
arrowToken.loc.end.line === firstTokenOfBody.loc.start.line &&
option === "below"
) {
context.report({
node: firstTokenOfBody,
messageId: "expected",
fix: fixer =>
fixer.insertTextBefore(firstTokenOfBody, "\n"),
});
} else if (
arrowToken.loc.end.line !== firstTokenOfBody.loc.start.line &&
option === "beside"
) {
context.report({
node: firstTokenOfBody,
messageId: "unexpected",
fix(fixer) {
if (
sourceCode.getFirstTokenBetween(
arrowToken,
firstTokenOfBody,
{
includeComments: true,
filter: isCommentToken,
},
)
) {
return null;
}
return fixer.replaceTextRange(
[arrowToken.range[1], firstTokenOfBody.range[0]],
" ",
);
},
});
}
}
//----------------------------------------------------------------------
// Public
//----------------------------------------------------------------------
return {
ArrowFunctionExpression: node => validateExpression(node),
};
},
};

View File

@ -0,0 +1,120 @@
/**
* @fileoverview Define 2 token factories; forward and backward.
* @author Toru Nagashima
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const BackwardTokenCommentCursor = require("./backward-token-comment-cursor");
const BackwardTokenCursor = require("./backward-token-cursor");
const FilterCursor = require("./filter-cursor");
const ForwardTokenCommentCursor = require("./forward-token-comment-cursor");
const ForwardTokenCursor = require("./forward-token-cursor");
const LimitCursor = require("./limit-cursor");
const SkipCursor = require("./skip-cursor");
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
/**
* The cursor factory.
* @private
*/
class CursorFactory {
/**
* Initializes this cursor.
* @param {Function} TokenCursor The class of the cursor which iterates tokens only.
* @param {Function} TokenCommentCursor The class of the cursor which iterates the mix of tokens and comments.
*/
constructor(TokenCursor, TokenCommentCursor) {
this.TokenCursor = TokenCursor;
this.TokenCommentCursor = TokenCommentCursor;
}
/**
* Creates a base cursor instance that can be decorated by createCursor.
* @param {Token[]} tokens The array of tokens.
* @param {Comment[]} comments The array of comments.
* @param {Object} indexMap The map from locations to indices in `tokens`.
* @param {number} startLoc The start location of the iteration range.
* @param {number} endLoc The end location of the iteration range.
* @param {boolean} includeComments The flag to iterate comments as well.
* @returns {Cursor} The created base cursor.
*/
createBaseCursor(
tokens,
comments,
indexMap,
startLoc,
endLoc,
includeComments,
) {
const Cursor = includeComments
? this.TokenCommentCursor
: this.TokenCursor;
return new Cursor(tokens, comments, indexMap, startLoc, endLoc);
}
/**
* Creates a cursor that iterates tokens with normalized options.
* @param {Token[]} tokens The array of tokens.
* @param {Comment[]} comments The array of comments.
* @param {Object} indexMap The map from locations to indices in `tokens`.
* @param {number} startLoc The start location of the iteration range.
* @param {number} endLoc The end location of the iteration range.
* @param {boolean} includeComments The flag to iterate comments as well.
* @param {Function|null} filter The predicate function to choose tokens.
* @param {number} skip The count of tokens the cursor skips.
* @param {number} count The maximum count of tokens the cursor iterates. Zero is no iteration for backward compatibility.
* @returns {Cursor} The created cursor.
*/
createCursor(
tokens,
comments,
indexMap,
startLoc,
endLoc,
includeComments,
filter,
skip,
count,
) {
let cursor = this.createBaseCursor(
tokens,
comments,
indexMap,
startLoc,
endLoc,
includeComments,
);
if (filter) {
cursor = new FilterCursor(cursor, filter);
}
if (skip >= 1) {
cursor = new SkipCursor(cursor, skip);
}
if (count >= 0) {
cursor = new LimitCursor(cursor, count);
}
return cursor;
}
}
//------------------------------------------------------------------------------
// Exports
//------------------------------------------------------------------------------
module.exports = {
forward: new CursorFactory(ForwardTokenCursor, ForwardTokenCommentCursor),
backward: new CursorFactory(
BackwardTokenCursor,
BackwardTokenCommentCursor,
),
};

View File

@ -0,0 +1,137 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = populatePlaceholders;
var _t = require("@babel/types");
const {
blockStatement,
cloneNode,
emptyStatement,
expressionStatement,
identifier,
isStatement,
isStringLiteral,
stringLiteral,
validate
} = _t;
function populatePlaceholders(metadata, replacements) {
const ast = cloneNode(metadata.ast);
if (replacements) {
metadata.placeholders.forEach(placeholder => {
if (!hasOwnProperty.call(replacements, placeholder.name)) {
const placeholderName = placeholder.name;
throw new Error(`Error: No substitution given for "${placeholderName}". If this is not meant to be a
placeholder you may want to consider passing one of the following options to @babel/template:
- { placeholderPattern: false, placeholderWhitelist: new Set(['${placeholderName}'])}
- { placeholderPattern: /^${placeholderName}$/ }`);
}
});
Object.keys(replacements).forEach(key => {
if (!metadata.placeholderNames.has(key)) {
throw new Error(`Unknown substitution "${key}" given`);
}
});
}
metadata.placeholders.slice().reverse().forEach(placeholder => {
try {
applyReplacement(placeholder, ast, replacements && replacements[placeholder.name] || null);
} catch (e) {
e.message = `@babel/template placeholder "${placeholder.name}": ${e.message}`;
throw e;
}
});
return ast;
}
function applyReplacement(placeholder, ast, replacement) {
if (placeholder.isDuplicate) {
if (Array.isArray(replacement)) {
replacement = replacement.map(node => cloneNode(node));
} else if (typeof replacement === "object") {
replacement = cloneNode(replacement);
}
}
const {
parent,
key,
index
} = placeholder.resolve(ast);
if (placeholder.type === "string") {
if (typeof replacement === "string") {
replacement = stringLiteral(replacement);
}
if (!replacement || !isStringLiteral(replacement)) {
throw new Error("Expected string substitution");
}
} else if (placeholder.type === "statement") {
if (index === undefined) {
if (!replacement) {
replacement = emptyStatement();
} else if (Array.isArray(replacement)) {
replacement = blockStatement(replacement);
} else if (typeof replacement === "string") {
replacement = expressionStatement(identifier(replacement));
} else if (!isStatement(replacement)) {
replacement = expressionStatement(replacement);
}
} else {
if (replacement && !Array.isArray(replacement)) {
if (typeof replacement === "string") {
replacement = identifier(replacement);
}
if (!isStatement(replacement)) {
replacement = expressionStatement(replacement);
}
}
}
} else if (placeholder.type === "param") {
if (typeof replacement === "string") {
replacement = identifier(replacement);
}
if (index === undefined) throw new Error("Assertion failure.");
} else {
if (typeof replacement === "string") {
replacement = identifier(replacement);
}
if (Array.isArray(replacement)) {
throw new Error("Cannot replace single expression with an array.");
}
}
function set(parent, key, value) {
const node = parent[key];
parent[key] = value;
if (node.type === "Identifier" || node.type === "Placeholder") {
if (node.typeAnnotation) {
value.typeAnnotation = node.typeAnnotation;
}
if (node.optional) {
value.optional = node.optional;
}
if (node.decorators) {
value.decorators = node.decorators;
}
}
}
if (index === undefined) {
validate(parent, key, replacement);
set(parent, key, replacement);
} else {
const items = parent[key].slice();
if (placeholder.type === "statement" || placeholder.type === "param") {
if (replacement == null) {
items.splice(index, 1);
} else if (Array.isArray(replacement)) {
items.splice(index, 1, ...replacement);
} else {
set(items, index, replacement);
}
} else {
set(items, index, replacement);
}
validate(parent, key, items);
parent[key] = items;
}
}
//# sourceMappingURL=populate.js.map

View File

@ -0,0 +1,37 @@
{
"name": "gensync",
"version": "1.0.0-beta.2",
"license": "MIT",
"description": "Allows users to use generators in order to write common functions that can be both sync or async.",
"main": "index.js",
"author": "Logan Smyth <loganfsmyth@gmail.com>",
"homepage": "https://github.com/loganfsmyth/gensync",
"repository": {
"type": "git",
"url": "https://github.com/loganfsmyth/gensync.git"
},
"scripts": {
"test": "jest"
},
"engines": {
"node": ">=6.9.0"
},
"keywords": [
"async",
"sync",
"generators",
"async-await",
"callbacks"
],
"devDependencies": {
"babel-core": "^6.26.3",
"babel-preset-env": "^1.6.1",
"eslint": "^4.19.1",
"eslint-config-prettier": "^2.9.0",
"eslint-plugin-node": "^6.0.1",
"eslint-plugin-prettier": "^2.6.0",
"flow-bin": "^0.71.0",
"jest": "^22.4.3",
"prettier": "^1.12.1"
}
}

View File

@ -0,0 +1 @@
module.exports={A:{A:{"2":"K D E F A B mC"},B:{"2":"0 9 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 AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I"},C:{"1":"2 3 4 5 6 7 8 RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB","2":"0 1 9 nC LC J PB K D E F A B C L M G N O P QB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC qC rC","322":"sB tB uB vB MC wB"},D:{"2":"0 9 J PB K D E F A B C L M G N O P QB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC","194":"1 2 3 4 5 6 7 8 RB SB TB UB VB WB XB YB ZB"},E:{"2":"J PB K D E F A B C L M G sC SC tC uC vC wC TC FC GC xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C"},F:{"2":"0 1 2 3 4 5 6 7 8 F B C G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z 4C 5C 6C 7C FC kC 8C GC"},G:{"2":"E SC 9C lC AD BD CD DD ED FD GD HD ID JD KD LD MD ND OD PD QD RD SD UC VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC"},H:{"2":"WD"},I:{"2":"LC J I XD YD ZD aD lC bD cD"},J:{"2":"D A"},K:{"2":"A B C H FC kC GC"},L:{"2":"I"},M:{"2":"EC"},N:{"2":"A B"},O:{"2":"HC"},P:{"2":"1 2 3 4 5 6 7 8 J dD eD fD gD hD TC iD jD kD lD mD IC JC KC nD"},Q:{"2":"oD"},R:{"2":"pD"},S:{"1":"qD","2":"rD"}},B:7,C:"Scoped attribute",D:true};

View File

@ -0,0 +1,32 @@
{
"name": "lru-cache",
"description": "A cache object that deletes the least-recently-used items.",
"version": "5.1.1",
"author": "Isaac Z. Schlueter <i@izs.me>",
"keywords": [
"mru",
"lru",
"cache"
],
"scripts": {
"test": "tap test/*.js --100 -J",
"snap": "TAP_SNAPSHOT=1 tap test/*.js -J",
"coveragerport": "tap --coverage-report=html",
"preversion": "npm test",
"postversion": "npm publish",
"postpublish": "git push origin --all; git push origin --tags"
},
"main": "index.js",
"repository": "git://github.com/isaacs/node-lru-cache.git",
"devDependencies": {
"benchmark": "^2.1.4",
"tap": "^12.1.0"
},
"license": "ISC",
"dependencies": {
"yallist": "^3.0.2"
},
"files": [
"index.js"
]
}

View File

@ -0,0 +1,12 @@
import React from 'react';
import { shallow } from 'zustand/vanilla/shallow';
function useShallow(selector) {
const prev = React.useRef(undefined);
return (state) => {
const next = selector(state);
return shallow(prev.current, next) ? prev.current : prev.current = next;
};
}
export { useShallow };

View File

@ -0,0 +1,129 @@
# brace-expansion
[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html),
as known from sh/bash, in JavaScript.
[![build status](https://secure.travis-ci.org/juliangruber/brace-expansion.svg)](http://travis-ci.org/juliangruber/brace-expansion)
[![downloads](https://img.shields.io/npm/dm/brace-expansion.svg)](https://www.npmjs.org/package/brace-expansion)
[![Greenkeeper badge](https://badges.greenkeeper.io/juliangruber/brace-expansion.svg)](https://greenkeeper.io/)
[![testling badge](https://ci.testling.com/juliangruber/brace-expansion.png)](https://ci.testling.com/juliangruber/brace-expansion)
## Example
```js
var expand = require('brace-expansion');
expand('file-{a,b,c}.jpg')
// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
expand('-v{,,}')
// => ['-v', '-v', '-v']
expand('file{0..2}.jpg')
// => ['file0.jpg', 'file1.jpg', 'file2.jpg']
expand('file-{a..c}.jpg')
// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg']
expand('file{2..0}.jpg')
// => ['file2.jpg', 'file1.jpg', 'file0.jpg']
expand('file{0..4..2}.jpg')
// => ['file0.jpg', 'file2.jpg', 'file4.jpg']
expand('file-{a..e..2}.jpg')
// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg']
expand('file{00..10..5}.jpg')
// => ['file00.jpg', 'file05.jpg', 'file10.jpg']
expand('{{A..C},{a..c}}')
// => ['A', 'B', 'C', 'a', 'b', 'c']
expand('ppp{,config,oe{,conf}}')
// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf']
```
## API
```js
var expand = require('brace-expansion');
```
### var expanded = expand(str)
Return an array of all possible and valid expansions of `str`. If none are
found, `[str]` is returned.
Valid expansions are:
```js
/^(.*,)+(.+)?$/
// {a,b,...}
```
A comma separated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`.
```js
/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
// {x..y[..incr]}
```
A numeric sequence from `x` to `y` inclusive, with optional increment.
If `x` or `y` start with a leading `0`, all the numbers will be padded
to have equal length. Negative numbers and backwards iteration work too.
```js
/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/
// {x..y[..incr]}
```
An alphabetic sequence from `x` to `y` inclusive, with optional increment.
`x` and `y` must be exactly one character, and if given, `incr` must be a
number.
For compatibility reasons, the string `${` is not eligible for brace expansion.
## Installation
With [npm](https://npmjs.org) do:
```bash
npm install brace-expansion
```
## Contributors
- [Julian Gruber](https://github.com/juliangruber)
- [Isaac Z. Schlueter](https://github.com/isaacs)
## Sponsors
This module is proudly supported by my [Sponsors](https://github.com/juliangruber/sponsors)!
Do you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my [Patreon](https://www.patreon.com/juliangruber). Not sure how much of my modules you're using? Try [feross/thanks](https://github.com/feross/thanks)!
## License
(MIT)
Copyright (c) 2013 Julian Gruber &lt;julian@juliangruber.com&gt;
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.

View File

@ -0,0 +1,23 @@
const numeric = /^[0-9]+$/
const compareIdentifiers = (a, b) => {
const anum = numeric.test(a)
const bnum = numeric.test(b)
if (anum && bnum) {
a = +a
b = +b
}
return a === b ? 0
: (anum && !bnum) ? -1
: (bnum && !anum) ? 1
: a < b ? -1
: 1
}
const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a)
module.exports = {
compareIdentifiers,
rcompareIdentifiers,
}

View File

@ -0,0 +1,63 @@
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
/** @typedef {import("./Resolver")} Resolver */
/** @typedef {import("./Resolver").ResolveStepHook} ResolveStepHook */
module.exports = class DirectoryExistsPlugin {
/**
* @param {string | ResolveStepHook} source source
* @param {string | ResolveStepHook} target target
*/
constructor(source, target) {
this.source = source;
this.target = target;
}
/**
* @param {Resolver} resolver the resolver
* @returns {void}
*/
apply(resolver) {
const target = resolver.ensureHook(this.target);
resolver
.getHook(this.source)
.tapAsync(
"DirectoryExistsPlugin",
(request, resolveContext, callback) => {
const fs = resolver.fileSystem;
const directory = request.path;
if (!directory) return callback();
fs.stat(directory, (err, stat) => {
if (err || !stat) {
if (resolveContext.missingDependencies)
resolveContext.missingDependencies.add(directory);
if (resolveContext.log)
resolveContext.log(directory + " doesn't exist");
return callback();
}
if (!stat.isDirectory()) {
if (resolveContext.missingDependencies)
resolveContext.missingDependencies.add(directory);
if (resolveContext.log)
resolveContext.log(directory + " is not a directory");
return callback();
}
if (resolveContext.fileDependencies)
resolveContext.fileDependencies.add(directory);
resolver.doResolve(
target,
request,
`existing directory ${directory}`,
resolveContext,
callback
);
});
}
);
}
};

View File

@ -0,0 +1,4 @@
import index from './index.js';
const { transform, transformStyleAttribute, bundle, bundleAsync, browserslistToTargets, composeVisitors, Features } = index;
export { transform, transformStyleAttribute, bundle, bundleAsync, browserslistToTargets, composeVisitors, Features };

View File

@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _rewriteStackTrace = require("./rewrite-stack-trace.js");
class ConfigError extends Error {
constructor(message, filename) {
super(message);
(0, _rewriteStackTrace.expectedError)(this);
if (filename) (0, _rewriteStackTrace.injectVirtualStackFrame)(this, filename);
}
}
exports.default = ConfigError;
0 && 0;
//# sourceMappingURL=config-error.js.map

View File

@ -0,0 +1 @@
{"version":3,"names":["_findSuggestion","require","OptionValidator","constructor","descriptor","validateTopLevelOptions","options","TopLevelOptionShape","validOptionNames","Object","keys","option","includes","Error","formatMessage","findSuggestion","validateBooleanOption","name","value","defaultValue","undefined","invariant","validateStringOption","condition","message","exports"],"sources":["../src/validator.ts"],"sourcesContent":["import { findSuggestion } from \"./find-suggestion.ts\";\n\nexport class OptionValidator {\n declare descriptor: string;\n constructor(descriptor: string) {\n this.descriptor = descriptor;\n }\n\n /**\n * Validate if the given `options` follow the name of keys defined in the `TopLevelOptionShape`\n *\n * @param {Object} options\n * @param {Object} TopLevelOptionShape\n * An object with all the valid key names that `options` should be allowed to have\n * The property values of `TopLevelOptionShape` can be arbitrary\n * @memberof OptionValidator\n */\n validateTopLevelOptions(options: object, TopLevelOptionShape: object): void {\n const validOptionNames = Object.keys(TopLevelOptionShape);\n for (const option of Object.keys(options)) {\n if (!validOptionNames.includes(option)) {\n throw new Error(\n this.formatMessage(`'${option}' is not a valid top-level option.\n- Did you mean '${findSuggestion(option, validOptionNames)}'?`),\n );\n }\n }\n }\n\n // note: we do not consider rewrite them to high order functions\n // until we have to support `validateNumberOption`.\n validateBooleanOption<T extends boolean>(\n name: string,\n value?: boolean,\n defaultValue?: T,\n ): boolean | T {\n if (value === undefined) {\n return defaultValue;\n } else {\n this.invariant(\n typeof value === \"boolean\",\n `'${name}' option must be a boolean.`,\n );\n }\n return value;\n }\n\n validateStringOption<T extends string>(\n name: string,\n value?: string,\n defaultValue?: T,\n ): string | T {\n if (value === undefined) {\n return defaultValue;\n } else {\n this.invariant(\n typeof value === \"string\",\n `'${name}' option must be a string.`,\n );\n }\n return value;\n }\n /**\n * A helper interface copied from the `invariant` npm package.\n * It throws given `message` when `condition` is not met\n *\n * @param {boolean} condition\n * @param {string} message\n * @memberof OptionValidator\n */\n invariant(condition: boolean, message: string): void {\n if (!condition) {\n throw new Error(this.formatMessage(message));\n }\n }\n\n formatMessage(message: string): string {\n return `${this.descriptor}: ${message}`;\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AAEO,MAAMC,eAAe,CAAC;EAE3BC,WAAWA,CAACC,UAAkB,EAAE;IAC9B,IAAI,CAACA,UAAU,GAAGA,UAAU;EAC9B;EAWAC,uBAAuBA,CAACC,OAAe,EAAEC,mBAA2B,EAAQ;IAC1E,MAAMC,gBAAgB,GAAGC,MAAM,CAACC,IAAI,CAACH,mBAAmB,CAAC;IACzD,KAAK,MAAMI,MAAM,IAAIF,MAAM,CAACC,IAAI,CAACJ,OAAO,CAAC,EAAE;MACzC,IAAI,CAACE,gBAAgB,CAACI,QAAQ,CAACD,MAAM,CAAC,EAAE;QACtC,MAAM,IAAIE,KAAK,CACb,IAAI,CAACC,aAAa,CAAC,IAAIH,MAAM;AACvC,kBAAkB,IAAAI,8BAAc,EAACJ,MAAM,EAAEH,gBAAgB,CAAC,IAAI,CACtD,CAAC;MACH;IACF;EACF;EAIAQ,qBAAqBA,CACnBC,IAAY,EACZC,KAAe,EACfC,YAAgB,EACH;IACb,IAAID,KAAK,KAAKE,SAAS,EAAE;MACvB,OAAOD,YAAY;IACrB,CAAC,MAAM;MACL,IAAI,CAACE,SAAS,CACZ,OAAOH,KAAK,KAAK,SAAS,EAC1B,IAAID,IAAI,6BACV,CAAC;IACH;IACA,OAAOC,KAAK;EACd;EAEAI,oBAAoBA,CAClBL,IAAY,EACZC,KAAc,EACdC,YAAgB,EACJ;IACZ,IAAID,KAAK,KAAKE,SAAS,EAAE;MACvB,OAAOD,YAAY;IACrB,CAAC,MAAM;MACL,IAAI,CAACE,SAAS,CACZ,OAAOH,KAAK,KAAK,QAAQ,EACzB,IAAID,IAAI,4BACV,CAAC;IACH;IACA,OAAOC,KAAK;EACd;EASAG,SAASA,CAACE,SAAkB,EAAEC,OAAe,EAAQ;IACnD,IAAI,CAACD,SAAS,EAAE;MACd,MAAM,IAAIV,KAAK,CAAC,IAAI,CAACC,aAAa,CAACU,OAAO,CAAC,CAAC;IAC9C;EACF;EAEAV,aAAaA,CAACU,OAAe,EAAU;IACrC,OAAO,GAAG,IAAI,CAACpB,UAAU,KAAKoB,OAAO,EAAE;EACzC;AACF;AAACC,OAAA,CAAAvB,eAAA,GAAAA,eAAA","ignoreList":[]}

View File

@ -0,0 +1 @@
module.exports={C:{"52":0.01428,"54":0.00476,"78":0.01904,"82":0.00476,"88":0.01904,"102":0.00476,"103":0.00476,"109":0.00476,"115":0.15229,"123":0.00476,"125":0.00952,"127":0.00476,"128":0.04759,"130":0.00476,"131":0.00952,"132":0.00952,"133":0.03807,"134":0.02855,"135":0.44735,"136":1.26589,"137":0.00476,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 53 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 79 80 81 83 84 85 86 87 89 90 91 92 93 94 95 96 97 98 99 100 101 104 105 106 107 108 110 111 112 113 114 116 117 118 119 120 121 122 124 126 129 138 139 140 3.5 3.6"},D:{"25":0.03807,"26":0.00476,"34":0.00952,"38":0.05711,"39":0.0238,"40":0.0238,"41":0.02855,"42":0.0238,"43":0.02855,"44":0.0238,"45":0.0238,"46":0.02855,"47":0.02855,"48":0.02855,"49":0.03331,"50":0.0238,"51":0.0238,"52":0.02855,"53":0.02855,"54":0.02855,"55":0.02855,"56":0.02855,"57":0.02855,"58":0.02855,"59":0.02855,"60":0.02855,"66":0.00476,"73":0.00476,"74":0.00476,"76":0.00476,"78":0.00476,"79":0.05235,"80":0.00952,"81":0.03807,"85":0.0238,"86":0.00952,"87":0.04283,"88":0.02855,"89":0.00476,"90":0.00476,"91":0.00476,"92":0.00476,"93":0.00476,"94":0.00476,"97":0.00476,"98":0.00952,"99":0.00476,"100":0.00476,"101":0.00476,"102":0.00476,"103":0.0809,"104":0.0238,"105":0.00476,"106":0.00476,"107":0.01428,"108":0.03807,"109":0.42831,"110":0.00952,"111":0.03807,"112":0.01428,"113":0.01904,"114":0.04283,"115":0.00952,"116":0.19988,"117":0.01428,"118":0.00952,"119":0.02855,"120":0.03807,"121":0.05711,"122":0.09042,"123":0.07139,"124":0.08566,"125":0.17608,"126":0.11898,"127":0.09994,"128":0.22367,"129":0.09518,"130":0.16657,"131":0.98035,"132":1.05174,"133":8.50433,"134":13.6964,"135":0.01904,"136":0.01904,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 27 28 29 30 31 32 33 35 36 37 61 62 63 64 65 67 68 69 70 71 72 75 77 83 84 95 96 137 138"},F:{"46":0.01428,"87":0.00476,"95":0.00952,"114":0.00952,"115":0.00476,"116":0.28554,"117":0.65674,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 88 89 90 91 92 93 94 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"12":0.00952,"17":0.00476,"18":0.00952,"85":0.00952,"92":0.00476,"109":0.03807,"110":0.00476,"111":0.00476,"112":0.00476,"113":0.00952,"114":0.00952,"115":0.00476,"117":0.00476,"119":0.00476,"120":0.00952,"121":0.00476,"122":0.00952,"123":0.00476,"124":0.00476,"125":0.00952,"126":0.01428,"127":0.00952,"128":0.01428,"129":0.01904,"130":0.03331,"131":0.07614,"132":0.11422,"133":2.17486,"134":4.62099,_:"13 14 15 16 79 80 81 83 84 86 87 88 89 90 91 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 116 118"},E:{"13":0.00476,"14":0.04283,"15":0.00476,_:"0 4 5 6 7 8 9 10 11 12 3.1 3.2 5.1 6.1 7.1 9.1 10.1","11.1":0.00476,"12.1":0.01904,"13.1":0.08566,"14.1":0.13325,"15.1":0.01428,"15.2-15.3":0.01428,"15.4":0.03331,"15.5":0.04759,"15.6":0.46162,"16.0":0.06187,"16.1":0.0809,"16.2":0.05235,"16.3":0.12849,"16.4":0.04283,"16.5":0.05711,"16.6":0.5568,"17.0":0.01428,"17.1":0.41879,"17.2":0.04759,"17.3":0.05711,"17.4":0.14753,"17.5":0.24271,"17.6":0.6853,"18.0":0.07614,"18.1":0.32361,"18.2":0.13801,"18.3":3.81196,"18.4":0.04283},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00456,"5.0-5.1":0,"6.0-6.1":0.01369,"7.0-7.1":0.00913,"8.1-8.4":0,"9.0-9.2":0.00685,"9.3":0.03195,"10.0-10.2":0.00228,"10.3":0.05248,"11.0-11.2":0.24188,"11.3-11.4":0.01597,"12.0-12.1":0.00913,"12.2-12.5":0.22591,"13.0-13.1":0.00456,"13.2":0.00685,"13.3":0.00913,"13.4-13.7":0.03195,"14.0-14.4":0.07987,"14.5-14.8":0.09584,"15.0-15.1":0.05248,"15.2-15.3":0.05248,"15.4":0.06389,"15.5":0.07302,"15.6-15.8":0.89908,"16.0":0.12779,"16.1":0.26242,"16.2":0.13692,"16.3":0.23732,"16.4":0.05248,"16.5":0.09812,"16.6-16.7":1.06566,"17.0":0.06389,"17.1":0.1141,"17.2":0.08671,"17.3":0.12094,"17.4":0.24188,"17.5":0.53854,"17.6-17.7":1.56312,"18.0":0.43813,"18.1":1.43305,"18.2":0.64122,"18.3":13.40178,"18.4":0.19853},P:{"4":0.09767,"20":0.01085,"21":0.03256,"22":0.01085,"23":0.0217,"24":0.03256,"25":0.03256,"26":0.07597,"27":2.7131,"5.0-5.4":0.01085,"6.2-6.4":0.01085,"7.2-7.4":0.01085,_:"8.2 9.2 10.1 11.1-11.2 12.0 13.0 14.0 15.0 16.0 17.0 18.0","19.0":0.01085},I:{"0":0.02092,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.00001,"4.4":0,"4.4.3-4.4.4":0.00002},K:{"0":0.14151,_:"10 11 12 11.1 11.5 12.1"},A:{"9":0.03127,"11":0.07818,_:"6 7 8 10 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{"0":0.56079},Q:{"14.9":0.01048},O:{"0":0.04717},H:{"0":0},L:{"0":26.14679}};

View File

@ -0,0 +1,101 @@
// Copyright (c) 2010 LearnBoost <tj@learnboost.com>
#pragma once
struct Closure;
#include "backend/Backend.h"
#include "closure.h"
#include <cairo.h>
#include "dll_visibility.h"
#include <napi.h>
#include <pango/pangocairo.h>
#include <vector>
#include <cstddef>
/*
* FontFace describes a font file in terms of one PangoFontDescription that
* will resolve to it and one that the user describes it as (like @font-face)
*/
class FontFace {
public:
PangoFontDescription *sys_desc = nullptr;
PangoFontDescription *user_desc = nullptr;
unsigned char file_path[1024];
};
enum text_baseline_t : uint8_t {
TEXT_BASELINE_ALPHABETIC = 0,
TEXT_BASELINE_TOP = 1,
TEXT_BASELINE_BOTTOM = 2,
TEXT_BASELINE_MIDDLE = 3,
TEXT_BASELINE_IDEOGRAPHIC = 4,
TEXT_BASELINE_HANGING = 5
};
enum text_align_t : int8_t {
TEXT_ALIGNMENT_LEFT = -1,
TEXT_ALIGNMENT_CENTER = 0,
TEXT_ALIGNMENT_RIGHT = 1,
TEXT_ALIGNMENT_START = -2,
TEXT_ALIGNMENT_END = 2
};
enum canvas_draw_mode_t : uint8_t {
TEXT_DRAW_PATHS,
TEXT_DRAW_GLYPHS
};
/*
* Canvas.
*/
class Canvas : public Napi::ObjectWrap<Canvas> {
public:
Canvas(const Napi::CallbackInfo& info);
static void Initialize(Napi::Env& env, Napi::Object& target);
Napi::Value ToBuffer(const Napi::CallbackInfo& info);
Napi::Value GetType(const Napi::CallbackInfo& info);
Napi::Value GetStride(const Napi::CallbackInfo& info);
Napi::Value GetWidth(const Napi::CallbackInfo& info);
Napi::Value GetHeight(const Napi::CallbackInfo& info);
void SetWidth(const Napi::CallbackInfo& info, const Napi::Value& value);
void SetHeight(const Napi::CallbackInfo& info, const Napi::Value& value);
void StreamPNGSync(const Napi::CallbackInfo& info);
void StreamPDFSync(const Napi::CallbackInfo& info);
void StreamJPEGSync(const Napi::CallbackInfo& info);
static void RegisterFont(const Napi::CallbackInfo& info);
static void DeregisterAllFonts(const Napi::CallbackInfo& info);
static Napi::Value ParseFont(const Napi::CallbackInfo& info);
Napi::Error CairoError(cairo_status_t status);
static void ToPngBufferAsync(Closure* closure);
static void ToJpegBufferAsync(Closure* closure);
static PangoWeight GetWeightFromCSSString(const char *weight);
static PangoStyle GetStyleFromCSSString(const char *style);
static PangoFontDescription *ResolveFontDescription(const PangoFontDescription *desc);
DLL_PUBLIC inline Backend* backend() { return _backend; }
DLL_PUBLIC inline cairo_surface_t* surface(){ return backend()->getSurface(); }
cairo_t* createCairoContext();
DLL_PUBLIC inline uint8_t *data(){ return cairo_image_surface_get_data(surface()); }
DLL_PUBLIC inline int stride(){ return cairo_image_surface_get_stride(surface()); }
DLL_PUBLIC inline std::size_t nBytes(){
return static_cast<std::size_t>(backend()->getHeight()) * stride();
}
DLL_PUBLIC inline int getWidth() { return backend()->getWidth(); }
DLL_PUBLIC inline int getHeight() { return backend()->getHeight(); }
void resurface(Napi::Object This);
Napi::Env env;
static int fontSerial;
private:
Backend* _backend;
Napi::ObjectReference _jsBackend;
Napi::FunctionReference ctor;
static std::vector<FontFace> font_face_list;
};

View File

@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _classPrivateFieldSet2;
var _assertClassBrand = require("./assertClassBrand.js");
function _classPrivateFieldSet2(privateMap, receiver, value) {
privateMap.set((0, _assertClassBrand.default)(privateMap, receiver), value);
return value;
}
//# sourceMappingURL=classPrivateFieldSet2.js.map

View File

@ -0,0 +1,5 @@
{
presets: [
["env", { targets: { node: "current" }}],
],
}

View File

@ -0,0 +1,7 @@
import { Parser } from "../index.js";
export declare const parsers: {
markdown: Parser;
mdx: Parser;
remark: Parser;
};

View File

@ -0,0 +1,56 @@
{
"name": "decompress-response",
"version": "6.0.0",
"description": "Decompress a HTTP response if needed",
"license": "MIT",
"repository": "sindresorhus/decompress-response",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "https://sindresorhus.com"
},
"engines": {
"node": ">=10"
},
"scripts": {
"test": "xo && ava && tsd"
},
"files": [
"index.js",
"index.d.ts"
],
"keywords": [
"decompress",
"response",
"http",
"https",
"zlib",
"gzip",
"zip",
"deflate",
"unzip",
"ungzip",
"incoming",
"message",
"stream",
"compressed",
"brotli"
],
"dependencies": {
"mimic-response": "^3.1.0"
},
"devDependencies": {
"@types/node": "^14.0.1",
"ava": "^2.2.0",
"get-stream": "^5.0.0",
"pify": "^5.0.0",
"tsd": "^0.11.0",
"xo": "^0.30.0"
},
"xo": {
"rules": {
"@typescript-eslint/prefer-readonly-parameter-types": "off"
}
}
}

View File

@ -0,0 +1 @@
export let nanoid=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce(((t,e)=>t+=(e&=63)<36?e.toString(36):e<62?(e-26).toString(36).toUpperCase():e<63?"_":"-"),"");

View File

@ -0,0 +1,27 @@
{
"name": "@babel/helper-validator-option",
"version": "7.25.9",
"description": "Validate plugin/preset options",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel.git",
"directory": "packages/babel-helper-validator-option"
},
"license": "MIT",
"publishConfig": {
"access": "public"
},
"main": "./lib/index.js",
"exports": {
".": {
"types": "./lib/index.d.ts",
"default": "./lib/index.js"
},
"./package.json": "./package.json"
},
"engines": {
"node": ">=6.9.0"
},
"author": "The Babel Team (https://babel.dev/team)",
"type": "commonjs"
}

View File

@ -0,0 +1 @@
module.exports={A:{A:{"1":"A B","2":"K D E F mC"},B:{"1":"0 9 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 AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I"},C:{"1":"0 1 2 3 4 5 6 7 8 9 LC J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC qC rC","2":"nC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC","2":"J","4":"PB K D"},E:{"1":"K D E F A B C L M G uC vC wC TC FC GC xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC eC fC 2C KC gC hC iC jC 3C","2":"J PB sC SC tC"},F:{"1":"0 1 2 3 4 5 6 7 8 F B C G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z 4C 5C 6C 7C FC kC 8C GC"},G:{"1":"E BD CD DD ED FD GD HD ID JD KD LD MD ND OD PD QD RD SD UC VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC","2":"SC 9C lC AD"},H:{"1":"WD"},I:{"1":"I bD cD","2":"LC J XD YD ZD aD lC"},J:{"1":"A","2":"D"},K:{"1":"A B C H FC kC GC"},L:{"1":"I"},M:{"1":"EC"},N:{"1":"A B"},O:{"1":"HC"},P:{"1":"1 2 3 4 5 6 7 8 J dD eD fD gD hD TC iD jD kD lD mD IC JC KC nD"},Q:{"1":"oD"},R:{"1":"pD"},S:{"1":"qD rD"}},B:2,C:"SVG filters",D:true};

View File

@ -0,0 +1,61 @@
'use strict';
var fs = require('fs')
, path = require('path')
, browserify = require('browserify')
, uglify = require('uglify-js');
var pkg = process.argv[2]
, standalone = process.argv[3]
, compress = process.argv[4];
var packageDir = path.join(__dirname, '..');
if (pkg != '.') packageDir = path.join(packageDir, 'node_modules', pkg);
var json = require(path.join(packageDir, 'package.json'));
var distDir = path.join(__dirname, '..', 'dist');
if (!fs.existsSync(distDir)) fs.mkdirSync(distDir);
var bOpts = {};
if (standalone) bOpts.standalone = standalone;
browserify(bOpts)
.require(path.join(packageDir, json.main), {expose: json.name})
.bundle(function (err, buf) {
if (err) {
console.error('browserify error:', err);
process.exit(1);
}
var outputFile = path.join(distDir, json.name);
var uglifyOpts = {
warnings: true,
compress: {},
output: {
preamble: '/* ' + json.name + ' ' + json.version + ': ' + json.description + ' */'
}
};
if (compress) {
var compressOpts = compress.split(',');
for (var i=0, il = compressOpts.length; i<il; ++i) {
var pair = compressOpts[i].split('=');
uglifyOpts.compress[pair[0]] = pair.length < 1 || pair[1] != 'false';
}
}
if (standalone) {
uglifyOpts.sourceMap = {
filename: json.name + '.min.js',
url: json.name + '.min.js.map'
};
}
var result = uglify.minify(buf.toString(), uglifyOpts);
fs.writeFileSync(outputFile + '.min.js', result.code);
if (result.map) fs.writeFileSync(outputFile + '.min.js.map', result.map);
if (standalone) fs.writeFileSync(outputFile + '.bundle.js', buf);
if (result.warnings) {
for (var j=0, jl = result.warnings.length; j<jl; ++j)
console.warn('UglifyJS warning:', result.warnings[j]);
}
});

View File

@ -0,0 +1 @@
{"version":3,"names":["_index","require","isType","nodeType","targetType","ALIAS_KEYS","aliases","FLIPPED_ALIAS_KEYS","includes"],"sources":["../../src/validators/isType.ts"],"sourcesContent":["import { FLIPPED_ALIAS_KEYS, ALIAS_KEYS } from \"../definitions/index.ts\";\nimport type * as t from \"../index.ts\";\n\nexport default function isType<T extends t.Node[\"type\"]>(\n nodeType: string,\n targetType: T,\n): nodeType is T;\n\nexport default function isType(\n nodeType: string | null | undefined,\n targetType: string,\n): boolean;\n\n/**\n * Test if a `nodeType` is a `targetType` or if `targetType` is an alias of `nodeType`.\n */\nexport default function isType(nodeType: string, targetType: string): boolean {\n if (nodeType === targetType) return true;\n\n // If nodeType is nullish, it can't be an alias of targetType.\n if (nodeType == null) return false;\n\n // This is a fast-path. If the test above failed, but an alias key is found, then the\n // targetType was a primary node type, so there's no need to check the aliases.\n // @ts-expect-error targetType may not index ALIAS_KEYS\n if (ALIAS_KEYS[targetType]) return false;\n\n const aliases: Array<string> | undefined = FLIPPED_ALIAS_KEYS[targetType];\n if (aliases?.includes(nodeType)) return true;\n\n return false;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAgBe,SAASC,MAAMA,CAACC,QAAgB,EAAEC,UAAkB,EAAW;EAC5E,IAAID,QAAQ,KAAKC,UAAU,EAAE,OAAO,IAAI;EAGxC,IAAID,QAAQ,IAAI,IAAI,EAAE,OAAO,KAAK;EAKlC,IAAIE,iBAAU,CAACD,UAAU,CAAC,EAAE,OAAO,KAAK;EAExC,MAAME,OAAkC,GAAGC,yBAAkB,CAACH,UAAU,CAAC;EACzE,IAAIE,OAAO,YAAPA,OAAO,CAAEE,QAAQ,CAACL,QAAQ,CAAC,EAAE,OAAO,IAAI;EAE5C,OAAO,KAAK;AACd","ignoreList":[]}

View File

@ -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('../shared/types').Rule} */
module.exports = {
meta: {
deprecated: {
message: "Formatting rules are being moved out of ESLint core.",
url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
deprecatedSince: "8.53.0",
availableUntil: "10.0.0",
replacedBy: [
{
message:
"ESLint Stylistic now maintains deprecated stylistic core rules.",
url: "https://eslint.style/guide/migration",
plugin: {
name: "@stylistic/eslint-plugin-js",
url: "https://eslint.style/packages/js",
},
rule: {
name: "arrow-parens",
url: "https://eslint.style/rules/js/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],
]);
},
});
}
},
};
},
};

View File

@ -0,0 +1,15 @@
# Installation
> `npm install --save @types/babel__generator`
# Summary
This package contains type definitions for @babel/generator (https://github.com/babel/babel/tree/master/packages/babel-generator).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/babel__generator.
### Additional Details
* Last updated: Thu, 03 Apr 2025 16:02:41 GMT
* Dependencies: [@babel/types](https://npmjs.com/package/@babel/types)
# Credits
These definitions were written by [Troy Gerwien](https://github.com/yortus), [Melvin Groenhoff](https://github.com/mgroenhoff), [Cameron Yan](https://github.com/khell), and [Lyanbin](https://github.com/Lyanbin).

View File

@ -0,0 +1,30 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">
<style>
@media not (prefers-reduced-motion) {
@keyframes loadingRotate {
from { rotate: 0; } to { rotate: 360deg }
}
#circle-arrows {
animation: loadingRotate 1.8s linear infinite;
transform-origin: 50% 50%;
}
#hourglass {
display: none;
}
}
@media (prefers-reduced-motion) {
#circle-arrows {
display: none;
}
}
</style>
<path id="circle-arrows" d="M9 5.528c0 .42.508.63.804.333l2.528-2.528a.47.47 0 0 0 0-.666L9.805.14A.471.471 0 0 0 9 .472v1.866A5.756 5.756 0 0 0 2.25 8c0 .942.232 1.83.635 2.615l1.143-1.143A4.208 4.208 0 0 1 3.75 8 4.254 4.254 0 0 1 8 3.75c.345 0 .68.042 1 .122v1.656zM7 10.472v1.656c.32.08.655.122 1 .122A4.254 4.254 0 0 0 12.25 8c0-.52-.107-1.013-.279-1.474l1.143-1.143c.404.786.636 1.674.636 2.617A5.756 5.756 0 0 1 7 13.662v1.866a.47.47 0 0 1-.804.333l-2.528-2.528a.47.47 0 0 1 0-.666l2.528-2.528a.47.47 0 0 1 .804.333z"/>
<g id="hourglass">
<path d="M13,1 C13.5522847,1 14,1.44771525 14,2 C14,2.55228475 13.5522847,3 13,3 L12.9854217,2.99990801 C12.9950817,3.16495885 13,3.33173274 13,3.5 C13,5.24679885 10.9877318,6.01090495 10.9877318,8.0017538 C10.9877318,9.99260264 13,10.7536922 13,12.5 C13,12.6686079 12.9950617,12.8357163 12.985363,13.0010943 L13,13 C13.5522847,13 14,13.4477153 14,14 C14,14.5522847 13.5522847,15 13,15 L3,15 C2.44771525,15 2,14.5522847 2,14 C2,13.4477153 2.44771525,13 3,13 L3.01463704,13.0010943 C3.00493827,12.8357163 3,12.6686079 3,12.5 C3,10.7536922 4.9877318,9.99260264 5,8.0017538 C5.0122682,6.01090495 3,5.24679885 3,3.5 C3,3.33173274 3.00491834,3.16495885 3.01457832,2.99990801 L3,3 C2.44771525,3 2,2.55228475 2,2 C2,1.44771525 2.44771525,1 3,1 L13,1 Z M10.987,3 L5.012,3 L5.00308914,3.24815712 C5.00103707,3.33163368 5,3.4155948 5,3.5 C5,5.36125069 6.99153646,6.01774089 6.99153646,8.0017538 C6.99153646,9.98576671 5,10.6393737 5,12.5 L5.00307746,12.7513676 L5.01222201,12.9998392 L5.60191711,12.9988344 L6.0425138,12.2959826 C7.02362731,10.7653275 7.67612271,10 8,10 C8.37014547,10 9.16950644,10.9996115 10.3980829,12.9988344 L10.987778,12.9998392 C10.9958674,12.8352104 11,12.66849 11,12.5 C11,10.6393737 8.98689779,10.0147381 8.98689779,8.0017538 C8.98689779,5.98876953 11,5.36125069 11,3.5 L10.9969109,3.24815712 L10.987,3 Z"/>
<path d="M6,4 L10,4 C8.95166016,6 8.28499349,7 8,7 C7.71500651,7 7.04833984,6 6,4 Z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -0,0 +1,96 @@
/**
* @fileoverview Rule to flag variable leak in CatchClauses in IE 8 and earlier
* @author Ian Christian Myers
* @deprecated in ESLint v5.1.0
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const astUtils = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../shared/types').Rule} */
module.exports = {
meta: {
type: "suggestion",
docs: {
description:
"Disallow `catch` clause parameters from shadowing variables in the outer scope",
recommended: false,
url: "https://eslint.org/docs/latest/rules/no-catch-shadow",
},
deprecated: {
message: "This rule was renamed.",
url: "https://eslint.org/blog/2018/07/eslint-v5.1.0-released/",
deprecatedSince: "5.1.0",
availableUntil: null,
replacedBy: [
{
rule: {
name: "no-shadow",
url: "https://eslint.org/docs/rules/no-shadow",
},
},
],
},
schema: [],
messages: {
mutable:
"Value of '{{name}}' may be overwritten in IE 8 and earlier.",
},
},
create(context) {
const sourceCode = context.sourceCode;
//--------------------------------------------------------------------------
// Helpers
//--------------------------------------------------------------------------
/**
* Check if the parameters are been shadowed
* @param {Object} scope current scope
* @param {string} name parameter name
* @returns {boolean} True is its been shadowed
*/
function paramIsShadowing(scope, name) {
return astUtils.getVariableByName(scope, name) !== null;
}
//--------------------------------------------------------------------------
// Public API
//--------------------------------------------------------------------------
return {
"CatchClause[param!=null]"(node) {
let scope = sourceCode.getScope(node);
/*
* When ecmaVersion >= 6, CatchClause creates its own scope
* so start from one upper scope to exclude the current node
*/
if (scope.block === node) {
scope = scope.upper;
}
if (paramIsShadowing(scope, node.param.name)) {
context.report({
node,
messageId: "mutable",
data: { name: node.param.name },
});
}
},
};
},
};

View File

@ -0,0 +1,23 @@
var test = require('tape');
var equal = require('../');
test('equal', function (t) {
t.ok(equal(
{ a : [ 2, 3 ], b : [ 4 ] },
{ a : [ 2, 3 ], b : [ 4 ] }
));
t.end();
});
test('not equal', function (t) {
t.notOk(equal(
{ x : 5, y : [6] },
{ x : 5, y : 6 }
));
t.end();
});
test('nested nulls', function (t) {
t.ok(equal([ null, null, null ], [ null, null, null ]));
t.end();
});

View File

@ -0,0 +1 @@
module.exports={C:{"49":0.00165,"64":0.00165,"81":0.00165,"84":0.0033,"94":0.00165,"112":0.0033,"115":0.02803,"127":0.00165,"128":0.01814,"133":0.00165,"134":0.00495,"135":0.20118,"136":0.54912,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 50 51 52 53 54 55 56 57 58 59 60 61 62 63 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 82 83 85 86 87 88 89 90 91 92 93 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 113 114 116 117 118 119 120 121 122 123 124 125 126 129 130 131 132 137 138 139 140 3.5 3.6"},D:{"22":0.0033,"37":0.00165,"39":0.00165,"42":0.00165,"44":0.00165,"46":0.00825,"47":0.00825,"59":0.00165,"64":0.01154,"65":0.00165,"67":0.00989,"68":0.02803,"69":0.00165,"73":0.00165,"74":0.00165,"75":0.00165,"76":0.00825,"79":0.00165,"80":0.00495,"81":0.00165,"83":0.00165,"84":0.00165,"86":0.0033,"87":0.00989,"88":0.00495,"89":0.00165,"90":0.0066,"92":0.01484,"93":0.01649,"94":0.0066,"96":0.00165,"97":0.00165,"98":0.00165,"100":0.00165,"102":0.00989,"103":0.02968,"104":0.00165,"105":0.00495,"106":0.00165,"108":0.00495,"109":0.16325,"111":0.03463,"114":0.01814,"115":0.00495,"116":0.01814,"117":0.00495,"118":0.01814,"119":0.0033,"120":0.00825,"121":0.00495,"122":0.02474,"123":0.00825,"124":0.01814,"125":0.01814,"126":0.03463,"127":0.01814,"128":0.03133,"129":0.01649,"130":0.02474,"131":0.18964,"132":0.10059,"133":1.27303,"134":2.3086,"135":0.00495,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 23 24 25 26 27 28 29 30 31 32 33 34 35 36 38 40 41 43 45 48 49 50 51 52 53 54 55 56 57 58 60 61 62 63 66 70 71 72 77 78 85 91 95 99 101 107 110 112 113 136 137 138"},F:{"35":0.00495,"36":0.00825,"40":0.00165,"46":0.0033,"86":0.00165,"87":0.0907,"88":0.00165,"95":0.0066,"99":0.0033,"101":0.00165,"112":0.00165,"113":0.00165,"114":0.0033,"115":0.0033,"116":0.01814,"117":0.36938,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 37 38 39 41 42 43 44 45 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 89 90 91 92 93 94 96 97 98 100 102 103 104 105 106 107 108 109 110 111 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"12":0.01979,"13":0.0066,"14":0.0066,"15":0.00165,"16":0.0033,"17":0.00165,"18":0.05112,"84":0.0066,"89":0.00989,"90":0.01154,"91":0.00165,"92":0.06101,"99":0.00825,"100":0.01154,"102":0.00825,"107":0.00165,"108":0.00165,"109":0.0033,"110":0.00165,"111":0.00165,"112":0.00165,"114":0.00165,"118":0.00165,"119":0.00825,"120":0.03793,"122":0.00825,"123":0.0033,"124":0.0066,"125":0.00165,"126":0.00495,"127":0.0066,"128":0.04782,"129":0.02144,"130":0.02968,"131":0.10883,"132":0.04452,"133":0.6662,"134":1.09659,_:"79 80 81 83 85 86 87 88 93 94 95 96 97 98 101 103 104 105 106 113 115 116 117 121"},E:{"10":0.00165,"11":0.00495,"13":0.0066,_:"0 4 5 6 7 8 9 12 14 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 12.1 15.1 15.2-15.3 15.4 15.5 16.2 17.0 17.3","11.1":0.0033,"13.1":0.01814,"14.1":0.01154,"15.6":0.01319,"16.0":0.00165,"16.1":0.00165,"16.3":0.0033,"16.4":0.00165,"16.5":0.00989,"16.6":0.01649,"17.1":0.01154,"17.2":0.0033,"17.4":0.00825,"17.5":0.01319,"17.6":0.11543,"18.0":0.0066,"18.1":0.00495,"18.2":0.00495,"18.3":0.09564,"18.4":0.00165},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.0011,"5.0-5.1":0,"6.0-6.1":0.0033,"7.0-7.1":0.0022,"8.1-8.4":0,"9.0-9.2":0.00165,"9.3":0.0077,"10.0-10.2":0.00055,"10.3":0.01266,"11.0-11.2":0.05834,"11.3-11.4":0.00385,"12.0-12.1":0.0022,"12.2-12.5":0.05448,"13.0-13.1":0.0011,"13.2":0.00165,"13.3":0.0022,"13.4-13.7":0.0077,"14.0-14.4":0.01926,"14.5-14.8":0.02311,"15.0-15.1":0.01266,"15.2-15.3":0.01266,"15.4":0.01541,"15.5":0.01761,"15.6-15.8":0.21683,"16.0":0.03082,"16.1":0.06329,"16.2":0.03302,"16.3":0.05723,"16.4":0.01266,"16.5":0.02366,"16.6-16.7":0.257,"17.0":0.01541,"17.1":0.02752,"17.2":0.02091,"17.3":0.02917,"17.4":0.05834,"17.5":0.12988,"17.6-17.7":0.37698,"18.0":0.10566,"18.1":0.34561,"18.2":0.15464,"18.3":3.23209,"18.4":0.04788},P:{"4":0.04002,"20":0.01,"21":0.01,"22":0.06002,"23":0.04002,"24":0.11004,"25":0.10004,"26":0.09003,"27":0.40015,_:"5.0-5.4 8.2 10.1 12.0 14.0 15.0 17.0 18.0","6.2-6.4":0.01,"7.2-7.4":0.02001,"9.2":0.01,"11.1-11.2":0.02001,"13.0":0.01,"16.0":0.02001,"19.0":0.01},I:{"0":0.04167,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.00001,"4.4":0,"4.4.3-4.4.4":0.00005},K:{"0":3.04601,_:"10 11 12 11.1 11.5 12.1"},A:{"10":0.00406,"11":0.02232,_:"6 7 8 9 5.5"},S:{"2.5":0.00835,_:"3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{"0":0.07516},Q:{"14.9":0.05011},O:{"0":0.48436},H:{"0":4.52},L:{"0":76.33148}};

View File

@ -0,0 +1,3 @@
import type { OutlineContextType } from './shared/types.js';
declare const outlineContext: React.Context<OutlineContextType>;
export default outlineContext;

View File

@ -0,0 +1 @@
{"version":3,"names":["_iterableToArrayLimit","arr","i","iterator","Symbol","_arr","iteratorNormalCompletion","didIteratorError","step","iteratorError","next","_return","call","Object","done","push","value","length","err"],"sources":["../../src/helpers/iterableToArrayLimit.ts"],"sourcesContent":["/* @minVersion 7.0.0-beta.0 */\n\nexport default function _iterableToArrayLimit<T>(arr: Iterable<T>, i: number) {\n // this is an expanded form of \\`for...of\\` that properly supports abrupt completions of\n // iterators etc.\n\n var iterator: Iterator<T> =\n arr == null\n ? null\n : (typeof Symbol !== \"undefined\" && arr[Symbol.iterator]) ||\n (arr as any)[\"@@iterator\"];\n if (iterator == null) return;\n\n var _arr: T[] = [];\n var iteratorNormalCompletion = true;\n var didIteratorError = false;\n var step, iteratorError, next, _return;\n try {\n next = (iterator = (iterator as unknown as Function).call(arr)).next;\n if (i === 0) {\n if (Object(iterator) !== iterator) return;\n iteratorNormalCompletion = false;\n } else {\n for (\n ;\n !(iteratorNormalCompletion = (step = next.call(iterator)).done);\n iteratorNormalCompletion = true\n ) {\n _arr.push(step.value);\n if (_arr.length === i) break;\n }\n }\n } catch (err) {\n didIteratorError = true;\n iteratorError = err;\n } finally {\n try {\n if (!iteratorNormalCompletion && iterator[\"return\"] != null) {\n _return = iterator[\"return\"]();\n // eslint-disable-next-line no-unsafe-finally\n if (Object(_return) !== _return) return;\n }\n } finally {\n // eslint-disable-next-line no-unsafe-finally\n if (didIteratorError) throw iteratorError;\n }\n }\n return _arr;\n}\n"],"mappings":";;;;;;AAEe,SAASA,qBAAqBA,CAAIC,GAAgB,EAAEC,CAAS,EAAE;EAI5E,IAAIC,QAAqB,GACvBF,GAAG,IAAI,IAAI,GACP,IAAI,GACH,OAAOG,MAAM,KAAK,WAAW,IAAIH,GAAG,CAACG,MAAM,CAACD,QAAQ,CAAC,IACrDF,GAAG,CAAS,YAAY,CAAC;EAChC,IAAIE,QAAQ,IAAI,IAAI,EAAE;EAEtB,IAAIE,IAAS,GAAG,EAAE;EAClB,IAAIC,wBAAwB,GAAG,IAAI;EACnC,IAAIC,gBAAgB,GAAG,KAAK;EAC5B,IAAIC,IAAI,EAAEC,aAAa,EAAEC,IAAI,EAAEC,OAAO;EACtC,IAAI;IACFD,IAAI,GAAG,CAACP,QAAQ,GAAIA,QAAQ,CAAyBS,IAAI,CAACX,GAAG,CAAC,EAAES,IAAI;IACpE,IAAIR,CAAC,KAAK,CAAC,EAAE;MACX,IAAIW,MAAM,CAACV,QAAQ,CAAC,KAAKA,QAAQ,EAAE;MACnCG,wBAAwB,GAAG,KAAK;IAClC,CAAC,MAAM;MACL,OAEE,EAAEA,wBAAwB,GAAG,CAACE,IAAI,GAAGE,IAAI,CAACE,IAAI,CAACT,QAAQ,CAAC,EAAEW,IAAI,CAAC,EAC/DR,wBAAwB,GAAG,IAAI,EAC/B;QACAD,IAAI,CAACU,IAAI,CAACP,IAAI,CAACQ,KAAK,CAAC;QACrB,IAAIX,IAAI,CAACY,MAAM,KAAKf,CAAC,EAAE;MACzB;IACF;EACF,CAAC,CAAC,OAAOgB,GAAG,EAAE;IACZX,gBAAgB,GAAG,IAAI;IACvBE,aAAa,GAAGS,GAAG;EACrB,CAAC,SAAS;IACR,IAAI;MACF,IAAI,CAACZ,wBAAwB,IAAIH,QAAQ,CAAC,QAAQ,CAAC,IAAI,IAAI,EAAE;QAC3DQ,OAAO,GAAGR,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;QAE9B,IAAIU,MAAM,CAACF,OAAO,CAAC,KAAKA,OAAO,EAAE;MACnC;IACF,CAAC,SAAS;MAER,IAAIJ,gBAAgB,EAAE,MAAME,aAAa;IAC3C;EACF;EACA,OAAOJ,IAAI;AACb","ignoreList":[]}

View File

@ -0,0 +1,22 @@
{
"name": "@rollup/rollup-linux-arm64-gnu",
"version": "4.39.0",
"os": [
"linux"
],
"cpu": [
"arm64"
],
"files": [
"rollup.linux-arm64-gnu.node"
],
"description": "Native bindings for Rollup",
"author": "Lukas Taegert-Atkinson",
"homepage": "https://rollupjs.org/",
"license": "MIT",
"repository": "rollup/rollup",
"libc": [
"glibc"
],
"main": "./rollup.linux-arm64-gnu.node"
}

View File

@ -0,0 +1,249 @@
/**
* @fileoverview Require or disallow newlines around directives.
* @author Kai Cataldo
* @deprecated in ESLint v4.0.0
*/
"use strict";
const astUtils = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../shared/types').Rule} */
module.exports = {
meta: {
type: "layout",
docs: {
description: "Require or disallow newlines around directives",
recommended: false,
url: "https://eslint.org/docs/latest/rules/lines-around-directive",
},
schema: [
{
oneOf: [
{
enum: ["always", "never"],
},
{
type: "object",
properties: {
before: {
enum: ["always", "never"],
},
after: {
enum: ["always", "never"],
},
},
additionalProperties: false,
minProperties: 2,
},
],
},
],
fixable: "whitespace",
messages: {
expected: 'Expected newline {{location}} "{{value}}" directive.',
unexpected:
'Unexpected newline {{location}} "{{value}}" directive.',
},
deprecated: {
message: "The rule was replaced with a more general rule.",
url: "https://eslint.org/blog/2017/06/eslint-v4.0.0-released/",
deprecatedSince: "4.0.0",
availableUntil: null,
replacedBy: [
{
message: "The new rule moved to a plugin.",
url: "https://eslint.org/docs/latest/rules/padding-line-between-statements#examples",
plugin: {
name: "@stylistic/eslint-plugin-js",
url: "https://eslint.style/packages/js",
},
rule: {
name: "padding-line-between-statements",
url: "https://eslint.style/rules/js/padding-line-between-statements",
},
},
],
},
},
create(context) {
const sourceCode = context.sourceCode;
const config = context.options[0] || "always";
const expectLineBefore =
typeof config === "string" ? config : config.before;
const expectLineAfter =
typeof config === "string" ? config : config.after;
//--------------------------------------------------------------------------
// Helpers
//--------------------------------------------------------------------------
/**
* Check if node is preceded by a blank newline.
* @param {ASTNode} node Node to check.
* @returns {boolean} Whether or not the passed in node is preceded by a blank newline.
*/
function hasNewlineBefore(node) {
const tokenBefore = sourceCode.getTokenBefore(node, {
includeComments: true,
});
const tokenLineBefore = tokenBefore ? tokenBefore.loc.end.line : 0;
return node.loc.start.line - tokenLineBefore >= 2;
}
/**
* Gets the last token of a node that is on the same line as the rest of the node.
* This will usually be the last token of the node, but it will be the second-to-last token if the node has a trailing
* semicolon on a different line.
* @param {ASTNode} node A directive node
* @returns {Token} The last token of the node on the line
*/
function getLastTokenOnLine(node) {
const lastToken = sourceCode.getLastToken(node);
const secondToLastToken = sourceCode.getTokenBefore(lastToken);
return astUtils.isSemicolonToken(lastToken) &&
lastToken.loc.start.line > secondToLastToken.loc.end.line
? secondToLastToken
: lastToken;
}
/**
* Check if node is followed by a blank newline.
* @param {ASTNode} node Node to check.
* @returns {boolean} Whether or not the passed in node is followed by a blank newline.
*/
function hasNewlineAfter(node) {
const lastToken = getLastTokenOnLine(node);
const tokenAfter = sourceCode.getTokenAfter(lastToken, {
includeComments: true,
});
return tokenAfter.loc.start.line - lastToken.loc.end.line >= 2;
}
/**
* Report errors for newlines around directives.
* @param {ASTNode} node Node to check.
* @param {string} location Whether the error was found before or after the directive.
* @param {boolean} expected Whether or not a newline was expected or unexpected.
* @returns {void}
*/
function reportError(node, location, expected) {
context.report({
node,
messageId: expected ? "expected" : "unexpected",
data: {
value: node.expression.value,
location,
},
fix(fixer) {
const lastToken = getLastTokenOnLine(node);
if (expected) {
return location === "before"
? fixer.insertTextBefore(node, "\n")
: fixer.insertTextAfter(lastToken, "\n");
}
return fixer.removeRange(
location === "before"
? [node.range[0] - 1, node.range[0]]
: [lastToken.range[1], lastToken.range[1] + 1],
);
},
});
}
/**
* Check lines around directives in node
* @param {ASTNode} node node to check
* @returns {void}
*/
function checkDirectives(node) {
const directives = astUtils.getDirectivePrologue(node);
if (!directives.length) {
return;
}
const firstDirective = directives[0];
const leadingComments =
sourceCode.getCommentsBefore(firstDirective);
/*
* Only check before the first directive if it is preceded by a comment or if it is at the top of
* the file and expectLineBefore is set to "never". This is to not force a newline at the top of
* the file if there are no comments as well as for compatibility with padded-blocks.
*/
if (leadingComments.length) {
if (
expectLineBefore === "always" &&
!hasNewlineBefore(firstDirective)
) {
reportError(firstDirective, "before", true);
}
if (
expectLineBefore === "never" &&
hasNewlineBefore(firstDirective)
) {
reportError(firstDirective, "before", false);
}
} else if (
node.type === "Program" &&
expectLineBefore === "never" &&
!leadingComments.length &&
hasNewlineBefore(firstDirective)
) {
reportError(firstDirective, "before", false);
}
const lastDirective = directives.at(-1);
const statements =
node.type === "Program" ? node.body : node.body.body;
/*
* Do not check after the last directive if the body only
* contains a directive prologue and isn't followed by a comment to ensure
* this rule behaves well with padded-blocks.
*/
if (
lastDirective === statements.at(-1) &&
!lastDirective.trailingComments
) {
return;
}
if (
expectLineAfter === "always" &&
!hasNewlineAfter(lastDirective)
) {
reportError(lastDirective, "after", true);
}
if (expectLineAfter === "never" && hasNewlineAfter(lastDirective)) {
reportError(lastDirective, "after", false);
}
}
//--------------------------------------------------------------------------
// Public
//--------------------------------------------------------------------------
return {
Program: checkDirectives,
FunctionDeclaration: checkDirectives,
FunctionExpression: checkDirectives,
ArrowFunctionExpression: checkDirectives,
};
},
};

View File

@ -0,0 +1,216 @@
/**
* @fileoverview Enforce return after a callback.
* @author Jamund Ferguson
* @deprecated in ESLint v7.0.0
*/
"use strict";
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../shared/types').Rule} */
module.exports = {
meta: {
deprecated: {
message: "Node.js rules were moved out of ESLint core.",
url: "https://eslint.org/docs/latest/use/migrating-to-7.0.0#deprecate-node-rules",
deprecatedSince: "7.0.0",
availableUntil: null,
replacedBy: [
{
message:
"eslint-plugin-n now maintains deprecated Node.js-related rules.",
plugin: {
name: "eslint-plugin-n",
url: "https://github.com/eslint-community/eslint-plugin-n",
},
rule: {
name: "callback-return",
url: "https://github.com/eslint-community/eslint-plugin-n/tree/master/docs/rules/callback-return.md",
},
},
],
},
type: "suggestion",
docs: {
description: "Require `return` statements after callbacks",
recommended: false,
url: "https://eslint.org/docs/latest/rules/callback-return",
},
schema: [
{
type: "array",
items: { type: "string" },
},
],
messages: {
missingReturn: "Expected return with your callback function.",
},
},
create(context) {
const callbacks = context.options[0] || ["callback", "cb", "next"],
sourceCode = context.sourceCode;
//--------------------------------------------------------------------------
// Helpers
//--------------------------------------------------------------------------
/**
* Find the closest parent matching a list of types.
* @param {ASTNode} node The node whose parents we are searching
* @param {Array} types The node types to match
* @returns {ASTNode} The matched node or undefined.
*/
function findClosestParentOfType(node, types) {
if (!node.parent) {
return null;
}
if (!types.includes(node.parent.type)) {
return findClosestParentOfType(node.parent, types);
}
return node.parent;
}
/**
* Check to see if a node contains only identifiers
* @param {ASTNode} node The node to check
* @returns {boolean} Whether or not the node contains only identifiers
*/
function containsOnlyIdentifiers(node) {
if (node.type === "Identifier") {
return true;
}
if (node.type === "MemberExpression") {
if (node.object.type === "Identifier") {
return true;
}
if (node.object.type === "MemberExpression") {
return containsOnlyIdentifiers(node.object);
}
}
return false;
}
/**
* Check to see if a CallExpression is in our callback list.
* @param {ASTNode} node The node to check against our callback names list.
* @returns {boolean} Whether or not this function matches our callback name.
*/
function isCallback(node) {
return (
containsOnlyIdentifiers(node.callee) &&
callbacks.includes(sourceCode.getText(node.callee))
);
}
/**
* Determines whether or not the callback is part of a callback expression.
* @param {ASTNode} node The callback node
* @param {ASTNode} parentNode The expression node
* @returns {boolean} Whether or not this is part of a callback expression
*/
function isCallbackExpression(node, parentNode) {
// ensure the parent node exists and is an expression
if (!parentNode || parentNode.type !== "ExpressionStatement") {
return false;
}
// cb()
if (parentNode.expression === node) {
return true;
}
// special case for cb && cb() and similar
if (
parentNode.expression.type === "BinaryExpression" ||
parentNode.expression.type === "LogicalExpression"
) {
if (parentNode.expression.right === node) {
return true;
}
}
return false;
}
//--------------------------------------------------------------------------
// Public
//--------------------------------------------------------------------------
return {
CallExpression(node) {
// if we're not a callback we can return
if (!isCallback(node)) {
return;
}
// find the closest block, return or loop
const closestBlock =
findClosestParentOfType(node, [
"BlockStatement",
"ReturnStatement",
"ArrowFunctionExpression",
]) || {};
// if our parent is a return we know we're ok
if (closestBlock.type === "ReturnStatement") {
return;
}
// arrow functions don't always have blocks and implicitly return
if (closestBlock.type === "ArrowFunctionExpression") {
return;
}
// block statements are part of functions and most if statements
if (closestBlock.type === "BlockStatement") {
// find the last item in the block
const lastItem = closestBlock.body.at(-1);
// if the callback is the last thing in a block that might be ok
if (isCallbackExpression(node, lastItem)) {
const parentType = closestBlock.parent.type;
// but only if the block is part of a function
if (
parentType === "FunctionExpression" ||
parentType === "FunctionDeclaration" ||
parentType === "ArrowFunctionExpression"
) {
return;
}
}
// ending a block with a return is also ok
if (lastItem.type === "ReturnStatement") {
// but only if the callback is immediately before
if (
isCallbackExpression(node, closestBlock.body.at(-2))
) {
return;
}
}
}
// as long as you're the child of a function at this point you should be asked to return
if (
findClosestParentOfType(node, [
"FunctionDeclaration",
"FunctionExpression",
"ArrowFunctionExpression",
])
) {
context.report({ node, messageId: "missingReturn" });
}
},
};
},
};

View File

@ -0,0 +1,29 @@
export class BaseFilterFactory {
addFilter(maps: any): string;
addHCMFilter(fgColor: any, bgColor: any): string;
addAlphaFilter(map: any): string;
addLuminosityFilter(map: any): string;
addHighlightHCMFilter(filterName: any, fgColor: any, bgColor: any, newFgColor: any, newBgColor: any): string;
destroy(keepHCM?: boolean): void;
}
/**
* FilterFactory aims to create some SVG filters we can use when drawing an
* image (or whatever) on a canvas.
* Filters aren't applied with ctx.putImageData because it just overwrites the
* underlying pixels.
* With these filters, it's possible for example to apply some transfer maps on
* an image without the need to apply them on the pixel arrays: the renderer
* does the magic for us.
*/
export class DOMFilterFactory extends BaseFilterFactory {
constructor({ docId, ownerDocument }: {
docId: any;
ownerDocument?: Document | undefined;
});
addFilter(maps: any): any;
addHCMFilter(fgColor: any, bgColor: any): any;
addAlphaFilter(map: any): any;
addLuminosityFilter(map: any): any;
addHighlightHCMFilter(filterName: any, fgColor: any, bgColor: any, newFgColor: any, newBgColor: any): any;
#private;
}

View File

@ -0,0 +1,74 @@
/**
* @fileoverview Rule to flag use of certain node types
* @author Burak Yigit Kaya
*/
"use strict";
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../shared/types').Rule} */
module.exports = {
meta: {
type: "suggestion",
docs: {
description: "Disallow specified syntax",
recommended: false,
url: "https://eslint.org/docs/latest/rules/no-restricted-syntax",
},
schema: {
type: "array",
items: {
oneOf: [
{
type: "string",
},
{
type: "object",
properties: {
selector: { type: "string" },
message: { type: "string" },
},
required: ["selector"],
additionalProperties: false,
},
],
},
uniqueItems: true,
minItems: 0,
},
messages: {
// eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period
restrictedSyntax: "{{message}}",
},
},
create(context) {
return context.options.reduce((result, selectorOrObject) => {
const isStringFormat = typeof selectorOrObject === "string";
const hasCustomMessage =
!isStringFormat && Boolean(selectorOrObject.message);
const selector = isStringFormat
? selectorOrObject
: selectorOrObject.selector;
const message = hasCustomMessage
? selectorOrObject.message
: `Using '${selector}' is not allowed.`;
return Object.assign(result, {
[selector](node) {
context.report({
node,
messageId: "restrictedSyntax",
data: { message },
});
},
});
}, {});
},
};

View File

@ -0,0 +1,25 @@
"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const router = require("./router.cjs");
const TSR_DEFERRED_PROMISE = Symbol.for("TSR_DEFERRED_PROMISE");
function defer(_promise, options) {
const promise = _promise;
if (promise[TSR_DEFERRED_PROMISE]) {
return promise;
}
promise[TSR_DEFERRED_PROMISE] = { status: "pending" };
promise.then((data) => {
promise[TSR_DEFERRED_PROMISE].status = "success";
promise[TSR_DEFERRED_PROMISE].data = data;
}).catch((error) => {
promise[TSR_DEFERRED_PROMISE].status = "error";
promise[TSR_DEFERRED_PROMISE].error = {
data: ((options == null ? void 0 : options.serializeError) ?? router.defaultSerializeError)(error),
__isServerError: true
};
});
return promise;
}
exports.TSR_DEFERRED_PROMISE = TSR_DEFERRED_PROMISE;
exports.defer = defer;
//# sourceMappingURL=defer.cjs.map

View File

@ -0,0 +1,286 @@
export type VisitTraversalStep = import("@eslint/core").VisitTraversalStep;
export type CallTraversalStep = import("@eslint/core").CallTraversalStep;
export type TextSourceCode = import("@eslint/core").TextSourceCode;
export type TraversalStep = import("@eslint/core").TraversalStep;
export type SourceLocation = import("@eslint/core").SourceLocation;
export type SourceLocationWithOffset = import("@eslint/core").SourceLocationWithOffset;
export type SourceRange = import("@eslint/core").SourceRange;
export type IDirective = import("@eslint/core").Directive;
export type DirectiveType = import("@eslint/core").DirectiveType;
export type RuleConfig = import("@eslint/core").RuleConfig;
export type RulesConfig = import("@eslint/core").RulesConfig;
export type StringConfig = import("./types.ts").StringConfig;
export type BooleanConfig = import("./types.ts").BooleanConfig;
/**
* A class to represent a step in the traversal process where a
* method is called.
* @implements {CallTraversalStep}
*/
export class CallMethodStep implements CallTraversalStep {
/**
* Creates a new instance.
* @param {Object} options The options for the step.
* @param {string} options.target The target of the step.
* @param {Array<any>} options.args The arguments of the step.
*/
constructor({ target, args }: {
target: string;
args: Array<any>;
});
/**
* The type of the step.
* @type {"call"}
* @readonly
*/
readonly type: "call";
/**
* The kind of the step. Represents the same data as the `type` property
* but it's a number for performance.
* @type {2}
* @readonly
*/
readonly kind: 2;
/**
* The name of the method to call.
* @type {string}
*/
target: string;
/**
* The arguments to pass to the method.
* @type {Array<any>}
*/
args: Array<any>;
}
/**
* Object to parse ESLint configuration comments.
*/
export class ConfigCommentParser {
/**
* Parses a list of "name:string_value" or/and "name" options divided by comma or
* whitespace. Used for "global" comments.
* @param {string} string The string to parse.
* @returns {StringConfig} Result map object of names and string values, or null values if no value was provided.
*/
parseStringConfig(string: string): StringConfig;
/**
* Parses a JSON-like config.
* @param {string} string The string to parse.
* @returns {({ok: true, config: RulesConfig}|{ok: false, error: {message: string}})} Result map object
*/
parseJSONLikeConfig(string: string): ({
ok: true;
config: RulesConfig;
} | {
ok: false;
error: {
message: string;
};
});
/**
* Parses a config of values separated by comma.
* @param {string} string The string to parse.
* @returns {BooleanConfig} Result map of values and true values
*/
parseListConfig(string: string): BooleanConfig;
/**
* Parses a directive comment into directive text and value.
* @param {string} string The string with the directive to be parsed.
* @returns {DirectiveComment|undefined} The parsed directive or `undefined` if the directive is invalid.
*/
parseDirective(string: string): DirectiveComment | undefined;
#private;
}
/**
* A class to represent a directive comment.
* @implements {IDirective}
*/
export class Directive implements IDirective {
/**
* Creates a new instance.
* @param {Object} options The options for the directive.
* @param {"disable"|"enable"|"disable-next-line"|"disable-line"} options.type The type of directive.
* @param {unknown} options.node The node representing the directive.
* @param {string} options.value The value of the directive.
* @param {string} options.justification The justification for the directive.
*/
constructor({ type, node, value, justification }: {
type: "disable" | "enable" | "disable-next-line" | "disable-line";
node: unknown;
value: string;
justification: string;
});
/**
* The type of directive.
* @type {DirectiveType}
* @readonly
*/
readonly type: DirectiveType;
/**
* The node representing the directive.
* @type {unknown}
* @readonly
*/
readonly node: unknown;
/**
* Everything after the "eslint-disable" portion of the directive,
* but before the "--" that indicates the justification.
* @type {string}
* @readonly
*/
readonly value: string;
/**
* The justification for the directive.
* @type {string}
* @readonly
*/
readonly justification: string;
}
/**
* Source Code Base Object
* @implements {TextSourceCode}
*/
export class TextSourceCodeBase implements TextSourceCode {
/**
* Creates a new instance.
* @param {Object} options The options for the instance.
* @param {string} options.text The source code text.
* @param {object} options.ast The root AST node.
* @param {RegExp} [options.lineEndingPattern] The pattern to match lineEndings in the source code.
*/
constructor({ text, ast, lineEndingPattern }: {
text: string;
ast: object;
lineEndingPattern?: RegExp;
});
/**
* The AST of the source code.
* @type {object}
*/
ast: object;
/**
* The text of the source code.
* @type {string}
*/
text: string;
/**
* Returns the loc information for the given node or token.
* @param {object} nodeOrToken The node or token to get the loc information for.
* @returns {SourceLocation} The loc information for the node or token.
*/
getLoc(nodeOrToken: object): SourceLocation;
/**
* Returns the range information for the given node or token.
* @param {object} nodeOrToken The node or token to get the range information for.
* @returns {SourceRange} The range information for the node or token.
*/
getRange(nodeOrToken: object): SourceRange;
/**
* Returns the parent of the given node.
* @param {object} node The node to get the parent of.
* @returns {object|undefined} The parent of the node.
*/
getParent(node: object): object | undefined;
/**
* Gets all the ancestors of a given node
* @param {object} node The node
* @returns {Array<object>} All the ancestor nodes in the AST, not including the provided node, starting
* from the root node at index 0 and going inwards to the parent node.
* @throws {TypeError} When `node` is missing.
*/
getAncestors(node: object): Array<object>;
/**
* Gets the source code for the given node.
* @param {object} [node] The AST node to get the text for.
* @param {number} [beforeCount] The number of characters before the node to retrieve.
* @param {number} [afterCount] The number of characters after the node to retrieve.
* @returns {string} The text representing the AST node.
* @public
*/
public getText(node?: object, beforeCount?: number, afterCount?: number): string;
/**
* Gets the entire source text split into an array of lines.
* @returns {Array<string>} The source text as an array of lines.
* @public
*/
public get lines(): Array<string>;
/**
* Traverse the source code and return the steps that were taken.
* @returns {Iterable<TraversalStep>} The steps that were taken while traversing the source code.
*/
traverse(): Iterable<TraversalStep>;
#private;
}
/**
* A class to represent a step in the traversal process where a node is visited.
* @implements {VisitTraversalStep}
*/
export class VisitNodeStep implements VisitTraversalStep {
/**
* Creates a new instance.
* @param {Object} options The options for the step.
* @param {object} options.target The target of the step.
* @param {1|2} options.phase The phase of the step.
* @param {Array<any>} options.args The arguments of the step.
*/
constructor({ target, phase, args }: {
target: object;
phase: 1 | 2;
args: Array<any>;
});
/**
* The type of the step.
* @type {"visit"}
* @readonly
*/
readonly type: "visit";
/**
* The kind of the step. Represents the same data as the `type` property
* but it's a number for performance.
* @type {1}
* @readonly
*/
readonly kind: 1;
/**
* The target of the step.
* @type {object}
*/
target: object;
/**
* The phase of the step.
* @type {1|2}
*/
phase: 1 | 2;
/**
* The arguments of the step.
* @type {Array<any>}
*/
args: Array<any>;
}
/**
* Represents a directive comment.
*/
declare class DirectiveComment {
/**
* Creates a new directive comment.
* @param {string} label The label of the directive.
* @param {string} value The value of the directive.
* @param {string} justification The justification of the directive.
*/
constructor(label: string, value: string, justification: string);
/**
* The label of the directive, such as "eslint", "eslint-disable", etc.
* @type {string}
*/
label: string;
/**
* The value of the directive (the string after the label).
* @type {string}
*/
value: string;
/**
* The justification of the directive (the string after the --).
* @type {string}
*/
justification: string;
}
export {};

View File

@ -0,0 +1,34 @@
// This alphabet uses `A-Za-z0-9_-` symbols.
// The order of characters is optimized for better gzip and brotli compression.
// References to the same file (works both for gzip and brotli):
// `'use`, `andom`, and `rict'`
// References to the brotli default dictionary:
// `-26T`, `1983`, `40px`, `75px`, `bush`, `jack`, `mind`, `very`, and `wolf`
let urlAlphabet =
'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'
let customAlphabet = (alphabet, defaultSize = 21) => {
return (size = defaultSize) => {
let id = ''
// A compact alternative for `for (var i = 0; i < step; i++)`.
let i = size | 0
while (i--) {
// `| 0` is more compact and faster than `Math.floor()`.
id += alphabet[(Math.random() * alphabet.length) | 0]
}
return id
}
}
let nanoid = (size = 21) => {
let id = ''
// A compact alternative for `for (var i = 0; i < step; i++)`.
let i = size | 0
while (i--) {
// `| 0` is more compact and faster than `Math.floor()`.
id += urlAlphabet[(Math.random() * 64) | 0]
}
return id
}
module.exports = { nanoid, customAlphabet }

View File

@ -0,0 +1,96 @@
"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
const React = require("react");
const Match = require("./Match.cjs");
function _interopNamespaceDefault(e) {
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
if (e) {
for (const k in e) {
if (k !== "default") {
const d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: () => e[k]
});
}
}
}
n.default = e;
return Object.freeze(n);
}
const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
function isModuleNotFoundError(error) {
if (typeof (error == null ? void 0 : error.message) !== "string") return false;
return error.message.startsWith("Failed to fetch dynamically imported module") || error.message.startsWith("error loading dynamically imported module") || error.message.startsWith("Importing a module script failed");
}
function ClientOnly({
children,
fallback = null
}) {
return useHydrated() ? /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: fallback });
}
function subscribe() {
return () => {
};
}
function useHydrated() {
return React__namespace.useSyncExternalStore(
subscribe,
() => true,
() => false
);
}
function lazyRouteComponent(importer, exportName, ssr) {
let loadPromise;
let comp;
let error;
let reload;
const load = () => {
if (typeof document === "undefined" && (ssr == null ? void 0 : ssr()) === false) {
comp = () => null;
return Promise.resolve();
}
if (!loadPromise) {
loadPromise = importer().then((res) => {
loadPromise = void 0;
comp = res[exportName ?? "default"];
}).catch((err) => {
error = err;
if (isModuleNotFoundError(error)) {
if (error instanceof Error && typeof window !== "undefined" && typeof sessionStorage !== "undefined") {
const storageKey = `tanstack_router_reload:${error.message}`;
if (!sessionStorage.getItem(storageKey)) {
sessionStorage.setItem(storageKey, "1");
reload = true;
}
}
}
});
}
return loadPromise;
};
const lazyComp = function Lazy(props) {
if (reload) {
window.location.reload();
throw new Promise(() => {
});
}
if (error) {
throw error;
}
if (!comp) {
throw load();
}
if ((ssr == null ? void 0 : ssr()) === false) {
return /* @__PURE__ */ jsxRuntime.jsx(ClientOnly, { fallback: /* @__PURE__ */ jsxRuntime.jsx(Match.Outlet, {}), children: React__namespace.createElement(comp, props) });
}
return React__namespace.createElement(comp, props);
};
lazyComp.preload = load;
return lazyComp;
}
exports.ClientOnly = ClientOnly;
exports.lazyRouteComponent = lazyRouteComponent;
exports.useHydrated = useHydrated;
//# sourceMappingURL=lazyRouteComponent.cjs.map

View File

@ -0,0 +1,20 @@
/*!
* is-extglob <https://github.com/jonschlinkert/is-extglob>
*
* Copyright (c) 2014-2016, Jon Schlinkert.
* Licensed under the MIT License.
*/
module.exports = function isExtglob(str) {
if (typeof str !== 'string' || str === '') {
return false;
}
var match;
while ((match = /(\\).|([@?!+*]\(.*\))/g.exec(str))) {
if (match[2]) return true;
str = str.slice(match.index + match[0].length);
}
return false;
};

View File

@ -0,0 +1,360 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = rewriteLiveReferences;
var _core = require("@babel/core");
function isInType(path) {
do {
switch (path.parent.type) {
case "TSTypeAnnotation":
case "TSTypeAliasDeclaration":
case "TSTypeReference":
case "TypeAnnotation":
case "TypeAlias":
return true;
case "ExportSpecifier":
return path.parentPath.parent.exportKind === "type";
default:
if (path.parentPath.isStatement() || path.parentPath.isExpression()) {
return false;
}
}
} while (path = path.parentPath);
}
function rewriteLiveReferences(programPath, metadata, wrapReference) {
const imported = new Map();
const exported = new Map();
const requeueInParent = path => {
programPath.requeue(path);
};
for (const [source, data] of metadata.source) {
for (const [localName, importName] of data.imports) {
imported.set(localName, [source, importName, null]);
}
for (const localName of data.importsNamespace) {
imported.set(localName, [source, null, localName]);
}
}
for (const [local, data] of metadata.local) {
let exportMeta = exported.get(local);
if (!exportMeta) {
exportMeta = [];
exported.set(local, exportMeta);
}
exportMeta.push(...data.names);
}
const rewriteBindingInitVisitorState = {
metadata,
requeueInParent,
scope: programPath.scope,
exported
};
programPath.traverse(rewriteBindingInitVisitor, rewriteBindingInitVisitorState);
const rewriteReferencesVisitorState = {
seen: new WeakSet(),
metadata,
requeueInParent,
scope: programPath.scope,
imported,
exported,
buildImportReference([source, importName, localName], identNode) {
const meta = metadata.source.get(source);
meta.referenced = true;
if (localName) {
if (meta.wrap) {
var _wrapReference;
identNode = (_wrapReference = wrapReference(identNode, meta.wrap)) != null ? _wrapReference : identNode;
}
return identNode;
}
let namespace = _core.types.identifier(meta.name);
if (meta.wrap) {
var _wrapReference2;
namespace = (_wrapReference2 = wrapReference(namespace, meta.wrap)) != null ? _wrapReference2 : namespace;
}
if (importName === "default" && meta.interop === "node-default") {
return namespace;
}
const computed = metadata.stringSpecifiers.has(importName);
return _core.types.memberExpression(namespace, computed ? _core.types.stringLiteral(importName) : _core.types.identifier(importName), computed);
}
};
programPath.traverse(rewriteReferencesVisitor, rewriteReferencesVisitorState);
}
const rewriteBindingInitVisitor = {
Scope(path) {
path.skip();
},
ClassDeclaration(path) {
const {
requeueInParent,
exported,
metadata
} = this;
const {
id
} = path.node;
if (!id) throw new Error("Expected class to have a name");
const localName = id.name;
const exportNames = exported.get(localName) || [];
if (exportNames.length > 0) {
const statement = _core.types.expressionStatement(buildBindingExportAssignmentExpression(metadata, exportNames, _core.types.identifier(localName), path.scope));
statement._blockHoist = path.node._blockHoist;
requeueInParent(path.insertAfter(statement)[0]);
}
},
VariableDeclaration(path) {
const {
requeueInParent,
exported,
metadata
} = this;
const isVar = path.node.kind === "var";
for (const decl of path.get("declarations")) {
const {
id
} = decl.node;
let {
init
} = decl.node;
if (_core.types.isIdentifier(id) && exported.has(id.name) && !_core.types.isArrowFunctionExpression(init) && (!_core.types.isFunctionExpression(init) || init.id) && (!_core.types.isClassExpression(init) || init.id)) {
if (!init) {
if (isVar) {
continue;
} else {
init = path.scope.buildUndefinedNode();
}
}
decl.node.init = buildBindingExportAssignmentExpression(metadata, exported.get(id.name), init, path.scope);
requeueInParent(decl.get("init"));
} else {
for (const localName of Object.keys(decl.getOuterBindingIdentifiers())) {
if (exported.has(localName)) {
const statement = _core.types.expressionStatement(buildBindingExportAssignmentExpression(metadata, exported.get(localName), _core.types.identifier(localName), path.scope));
statement._blockHoist = path.node._blockHoist;
requeueInParent(path.insertAfter(statement)[0]);
}
}
}
}
}
};
const buildBindingExportAssignmentExpression = (metadata, exportNames, localExpr, scope) => {
const exportsObjectName = metadata.exportName;
for (let currentScope = scope; currentScope != null; currentScope = currentScope.parent) {
if (currentScope.hasOwnBinding(exportsObjectName)) {
currentScope.rename(exportsObjectName);
}
}
return (exportNames || []).reduce((expr, exportName) => {
const {
stringSpecifiers
} = metadata;
const computed = stringSpecifiers.has(exportName);
return _core.types.assignmentExpression("=", _core.types.memberExpression(_core.types.identifier(exportsObjectName), computed ? _core.types.stringLiteral(exportName) : _core.types.identifier(exportName), computed), expr);
}, localExpr);
};
const buildImportThrow = localName => {
return _core.template.expression.ast`
(function() {
throw new Error('"' + '${localName}' + '" is read-only.');
})()
`;
};
const rewriteReferencesVisitor = {
ReferencedIdentifier(path) {
const {
seen,
buildImportReference,
scope,
imported,
requeueInParent
} = this;
if (seen.has(path.node)) return;
seen.add(path.node);
const localName = path.node.name;
const importData = imported.get(localName);
if (importData) {
if (isInType(path)) {
throw path.buildCodeFrameError(`Cannot transform the imported binding "${localName}" since it's also used in a type annotation. ` + `Please strip type annotations using @babel/preset-typescript or @babel/preset-flow.`);
}
const localBinding = path.scope.getBinding(localName);
const rootBinding = scope.getBinding(localName);
if (rootBinding !== localBinding) return;
const ref = buildImportReference(importData, path.node);
ref.loc = path.node.loc;
if ((path.parentPath.isCallExpression({
callee: path.node
}) || path.parentPath.isOptionalCallExpression({
callee: path.node
}) || path.parentPath.isTaggedTemplateExpression({
tag: path.node
})) && _core.types.isMemberExpression(ref)) {
path.replaceWith(_core.types.sequenceExpression([_core.types.numericLiteral(0), ref]));
} else if (path.isJSXIdentifier() && _core.types.isMemberExpression(ref)) {
const {
object,
property
} = ref;
path.replaceWith(_core.types.jsxMemberExpression(_core.types.jsxIdentifier(object.name), _core.types.jsxIdentifier(property.name)));
} else {
path.replaceWith(ref);
}
requeueInParent(path);
path.skip();
}
},
UpdateExpression(path) {
const {
scope,
seen,
imported,
exported,
requeueInParent,
buildImportReference
} = this;
if (seen.has(path.node)) return;
seen.add(path.node);
const arg = path.get("argument");
if (arg.isMemberExpression()) return;
const update = path.node;
if (arg.isIdentifier()) {
const localName = arg.node.name;
if (scope.getBinding(localName) !== path.scope.getBinding(localName)) {
return;
}
const exportedNames = exported.get(localName);
const importData = imported.get(localName);
if ((exportedNames == null ? void 0 : exportedNames.length) > 0 || importData) {
if (importData) {
path.replaceWith(_core.types.assignmentExpression(update.operator[0] + "=", buildImportReference(importData, arg.node), buildImportThrow(localName)));
} else if (update.prefix) {
path.replaceWith(buildBindingExportAssignmentExpression(this.metadata, exportedNames, _core.types.cloneNode(update), path.scope));
} else {
const ref = scope.generateDeclaredUidIdentifier(localName);
path.replaceWith(_core.types.sequenceExpression([_core.types.assignmentExpression("=", _core.types.cloneNode(ref), _core.types.cloneNode(update)), buildBindingExportAssignmentExpression(this.metadata, exportedNames, _core.types.identifier(localName), path.scope), _core.types.cloneNode(ref)]));
}
}
}
requeueInParent(path);
path.skip();
},
AssignmentExpression: {
exit(path) {
const {
scope,
seen,
imported,
exported,
requeueInParent,
buildImportReference
} = this;
if (seen.has(path.node)) return;
seen.add(path.node);
const left = path.get("left");
if (left.isMemberExpression()) return;
if (left.isIdentifier()) {
const localName = left.node.name;
if (scope.getBinding(localName) !== path.scope.getBinding(localName)) {
return;
}
const exportedNames = exported.get(localName);
const importData = imported.get(localName);
if ((exportedNames == null ? void 0 : exportedNames.length) > 0 || importData) {
const assignment = path.node;
if (importData) {
assignment.left = buildImportReference(importData, left.node);
assignment.right = _core.types.sequenceExpression([assignment.right, buildImportThrow(localName)]);
}
const {
operator
} = assignment;
let newExpr;
if (operator === "=") {
newExpr = assignment;
} else if (operator === "&&=" || operator === "||=" || operator === "??=") {
newExpr = _core.types.assignmentExpression("=", assignment.left, _core.types.logicalExpression(operator.slice(0, -1), _core.types.cloneNode(assignment.left), assignment.right));
} else {
newExpr = _core.types.assignmentExpression("=", assignment.left, _core.types.binaryExpression(operator.slice(0, -1), _core.types.cloneNode(assignment.left), assignment.right));
}
path.replaceWith(buildBindingExportAssignmentExpression(this.metadata, exportedNames, newExpr, path.scope));
requeueInParent(path);
path.skip();
}
} else {
const ids = left.getOuterBindingIdentifiers();
const programScopeIds = Object.keys(ids).filter(localName => scope.getBinding(localName) === path.scope.getBinding(localName));
const id = programScopeIds.find(localName => imported.has(localName));
if (id) {
path.node.right = _core.types.sequenceExpression([path.node.right, buildImportThrow(id)]);
}
const items = [];
programScopeIds.forEach(localName => {
const exportedNames = exported.get(localName) || [];
if (exportedNames.length > 0) {
items.push(buildBindingExportAssignmentExpression(this.metadata, exportedNames, _core.types.identifier(localName), path.scope));
}
});
if (items.length > 0) {
let node = _core.types.sequenceExpression(items);
if (path.parentPath.isExpressionStatement()) {
node = _core.types.expressionStatement(node);
node._blockHoist = path.parentPath.node._blockHoist;
}
const statement = path.insertAfter(node)[0];
requeueInParent(statement);
}
}
}
},
ForXStatement(path) {
const {
scope,
node
} = path;
const {
left
} = node;
const {
exported,
imported,
scope: programScope
} = this;
if (!_core.types.isVariableDeclaration(left)) {
let didTransformExport = false,
importConstViolationName;
const loopBodyScope = path.get("body").scope;
for (const name of Object.keys(_core.types.getOuterBindingIdentifiers(left))) {
if (programScope.getBinding(name) === scope.getBinding(name)) {
if (exported.has(name)) {
didTransformExport = true;
if (loopBodyScope.hasOwnBinding(name)) {
loopBodyScope.rename(name);
}
}
if (imported.has(name) && !importConstViolationName) {
importConstViolationName = name;
}
}
}
if (!didTransformExport && !importConstViolationName) {
return;
}
path.ensureBlock();
const bodyPath = path.get("body");
const newLoopId = scope.generateUidIdentifierBasedOnNode(left);
path.get("left").replaceWith(_core.types.variableDeclaration("let", [_core.types.variableDeclarator(_core.types.cloneNode(newLoopId))]));
scope.registerDeclaration(path.get("left"));
if (didTransformExport) {
bodyPath.unshiftContainer("body", _core.types.expressionStatement(_core.types.assignmentExpression("=", left, newLoopId)));
}
if (importConstViolationName) {
bodyPath.unshiftContainer("body", _core.types.expressionStatement(buildImportThrow(importConstViolationName)));
}
}
}
};
//# sourceMappingURL=rewrite-live-references.js.map

View File

@ -0,0 +1,110 @@
/**
* @fileoverview Rule to check for tabs inside a file
* @author Gyandeep Singh
* @deprecated in ESLint v8.53.0
*/
"use strict";
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
const tabRegex = /\t+/gu;
const anyNonWhitespaceRegex = /\S/u;
//------------------------------------------------------------------------------
// Public Interface
//------------------------------------------------------------------------------
/** @type {import('../shared/types').Rule} */
module.exports = {
meta: {
deprecated: {
message: "Formatting rules are being moved out of ESLint core.",
url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
deprecatedSince: "8.53.0",
availableUntil: "10.0.0",
replacedBy: [
{
message:
"ESLint Stylistic now maintains deprecated stylistic core rules.",
url: "https://eslint.style/guide/migration",
plugin: {
name: "@stylistic/eslint-plugin-js",
url: "https://eslint.style/packages/js",
},
rule: {
name: "no-tabs",
url: "https://eslint.style/rules/js/no-tabs",
},
},
],
},
type: "layout",
docs: {
description: "Disallow all tabs",
recommended: false,
url: "https://eslint.org/docs/latest/rules/no-tabs",
},
schema: [
{
type: "object",
properties: {
allowIndentationTabs: {
type: "boolean",
default: false,
},
},
additionalProperties: false,
},
],
messages: {
unexpectedTab: "Unexpected tab character.",
},
},
create(context) {
const sourceCode = context.sourceCode;
const allowIndentationTabs =
context.options &&
context.options[0] &&
context.options[0].allowIndentationTabs;
return {
Program(node) {
sourceCode.getLines().forEach((line, index) => {
let match;
while ((match = tabRegex.exec(line)) !== null) {
if (
allowIndentationTabs &&
!anyNonWhitespaceRegex.test(
line.slice(0, match.index),
)
) {
continue;
}
context.report({
node,
loc: {
start: {
line: index + 1,
column: match.index,
},
end: {
line: index + 1,
column: match.index + match[0].length,
},
},
messageId: "unexpectedTab",
});
}
});
},
};
},
};

View File

@ -0,0 +1,53 @@
declare namespace pLocate {
interface Options {
/**
Number of concurrently pending promises returned by `tester`. Minimum: `1`.
@default Infinity
*/
readonly concurrency?: number;
/**
Preserve `input` order when searching.
Disable this to improve performance if you don't care about the order.
@default true
*/
readonly preserveOrder?: boolean;
}
}
/**
Get the first fulfilled promise that satisfies the provided testing function.
@param input - An iterable of promises/values to test.
@param tester - This function will receive resolved values from `input` and is expected to return a `Promise<boolean>` or `boolean`.
@returns A `Promise` that is fulfilled when `tester` resolves to `true` or the iterable is done, or rejects if any of the promises reject. The fulfilled value is the current iterable value or `undefined` if `tester` never resolved to `true`.
@example
```
import pathExists = require('path-exists');
import pLocate = require('p-locate');
const files = [
'unicorn.png',
'rainbow.png', // Only this one actually exists on disk
'pony.png'
];
(async () => {
const foundPath = await pLocate(files, file => pathExists(file));
console.log(foundPath);
//=> 'rainbow'
})();
```
*/
declare function pLocate<ValueType>(
input: Iterable<PromiseLike<ValueType> | ValueType>,
tester: (element: ValueType) => PromiseLike<boolean> | boolean,
options?: pLocate.Options
): Promise<ValueType | undefined>;
export = pLocate;

View File

@ -0,0 +1,19 @@
# @babel/helper-string-parser
> A utility package to parse strings
See our website [@babel/helper-string-parser](https://babeljs.io/docs/babel-helper-string-parser) for more information.
## Install
Using npm:
```sh
npm install --save @babel/helper-string-parser
```
or using yarn:
```sh
yarn add @babel/helper-string-parser
```

View File

@ -0,0 +1,5 @@
'use strict';
throw new Error(
'react-dom/profiling is not supported in React Server Components.'
);

View File

@ -0,0 +1,242 @@
/**
* @fileoverview Enforces that a return statement is present in property getters.
* @author Aladdin-ADD(hh_2013@foxmail.com)
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const astUtils = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
const TARGET_NODE_TYPE = /^(?:Arrow)?FunctionExpression$/u;
/**
* Checks all segments in a set and returns true if any are reachable.
* @param {Set<CodePathSegment>} segments The segments to check.
* @returns {boolean} True if any segment is reachable; false otherwise.
*/
function isAnySegmentReachable(segments) {
for (const segment of segments) {
if (segment.reachable) {
return true;
}
}
return false;
}
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../shared/types').Rule} */
module.exports = {
meta: {
type: "problem",
defaultOptions: [
{
allowImplicit: false,
},
],
docs: {
description: "Enforce `return` statements in getters",
recommended: true,
url: "https://eslint.org/docs/latest/rules/getter-return",
},
fixable: null,
schema: [
{
type: "object",
properties: {
allowImplicit: {
type: "boolean",
},
},
additionalProperties: false,
},
],
messages: {
expected: "Expected to return a value in {{name}}.",
expectedAlways: "Expected {{name}} to always return a value.",
},
},
create(context) {
const [{ allowImplicit }] = context.options;
const sourceCode = context.sourceCode;
let funcInfo = {
upper: null,
codePath: null,
hasReturn: false,
shouldCheck: false,
node: null,
currentSegments: [],
};
/**
* Checks whether or not the last code path segment is reachable.
* Then reports this function if the segment is reachable.
*
* If the last code path segment is reachable, there are paths which are not
* returned or thrown.
* @param {ASTNode} node A node to check.
* @returns {void}
*/
function checkLastSegment(node) {
if (
funcInfo.shouldCheck &&
isAnySegmentReachable(funcInfo.currentSegments)
) {
context.report({
node,
loc: astUtils.getFunctionHeadLoc(node, sourceCode),
messageId: funcInfo.hasReturn
? "expectedAlways"
: "expected",
data: {
name: astUtils.getFunctionNameWithKind(funcInfo.node),
},
});
}
}
/**
* Checks whether a node means a getter function.
* @param {ASTNode} node a node to check.
* @returns {boolean} if node means a getter, return true; else return false.
*/
function isGetter(node) {
const parent = node.parent;
if (
TARGET_NODE_TYPE.test(node.type) &&
node.body.type === "BlockStatement"
) {
if (parent.kind === "get") {
return true;
}
if (
parent.type === "Property" &&
astUtils.getStaticPropertyName(parent) === "get" &&
parent.parent.type === "ObjectExpression"
) {
// Object.defineProperty() or Reflect.defineProperty()
if (parent.parent.parent.type === "CallExpression") {
const callNode = parent.parent.parent.callee;
if (
astUtils.isSpecificMemberAccess(
callNode,
"Object",
"defineProperty",
) ||
astUtils.isSpecificMemberAccess(
callNode,
"Reflect",
"defineProperty",
)
) {
return true;
}
}
// Object.defineProperties() or Object.create()
if (
parent.parent.parent.type === "Property" &&
parent.parent.parent.parent.type ===
"ObjectExpression" &&
parent.parent.parent.parent.parent.type ===
"CallExpression"
) {
const callNode =
parent.parent.parent.parent.parent.callee;
return (
astUtils.isSpecificMemberAccess(
callNode,
"Object",
"defineProperties",
) ||
astUtils.isSpecificMemberAccess(
callNode,
"Object",
"create",
)
);
}
}
}
return false;
}
return {
// Stacks this function's information.
onCodePathStart(codePath, node) {
funcInfo = {
upper: funcInfo,
codePath,
hasReturn: false,
shouldCheck: isGetter(node),
node,
currentSegments: new Set(),
};
},
// Pops this function's information.
onCodePathEnd() {
funcInfo = funcInfo.upper;
},
onUnreachableCodePathSegmentStart(segment) {
funcInfo.currentSegments.add(segment);
},
onUnreachableCodePathSegmentEnd(segment) {
funcInfo.currentSegments.delete(segment);
},
onCodePathSegmentStart(segment) {
funcInfo.currentSegments.add(segment);
},
onCodePathSegmentEnd(segment) {
funcInfo.currentSegments.delete(segment);
},
// Checks the return statement is valid.
ReturnStatement(node) {
if (funcInfo.shouldCheck) {
funcInfo.hasReturn = true;
// if allowImplicit: false, should also check node.argument
if (!allowImplicit && !node.argument) {
context.report({
node,
messageId: "expected",
data: {
name: astUtils.getFunctionNameWithKind(
funcInfo.node,
),
},
});
}
}
},
// Reports a given function if the last path is reachable.
"FunctionExpression:exit": checkLastSegment,
"ArrowFunctionExpression:exit": checkLastSegment,
};
},
};

View File

@ -0,0 +1,581 @@
/**
* @fileoverview Enforces empty lines around comments.
* @author Jamund Ferguson
* @deprecated in ESLint v8.53.0
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const astUtils = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
/**
* Return an array with any line numbers that are empty.
* @param {Array} lines An array of each line of the file.
* @returns {Array} An array of line numbers.
*/
function getEmptyLineNums(lines) {
const emptyLines = lines
.map((line, i) => ({
code: line.trim(),
num: i + 1,
}))
.filter(line => !line.code)
.map(line => line.num);
return emptyLines;
}
/**
* Return an array with any line numbers that contain comments.
* @param {Array} comments An array of comment tokens.
* @returns {Array} An array of line numbers.
*/
function getCommentLineNums(comments) {
const lines = [];
comments.forEach(token => {
const start = token.loc.start.line;
const end = token.loc.end.line;
lines.push(start, end);
});
return lines;
}
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../shared/types').Rule} */
module.exports = {
meta: {
deprecated: {
message: "Formatting rules are being moved out of ESLint core.",
url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
deprecatedSince: "8.53.0",
availableUntil: "10.0.0",
replacedBy: [
{
message:
"ESLint Stylistic now maintains deprecated stylistic core rules.",
url: "https://eslint.style/guide/migration",
plugin: {
name: "@stylistic/eslint-plugin-js",
url: "https://eslint.style/packages/js",
},
rule: {
name: "lines-around-comment",
url: "https://eslint.style/rules/js/lines-around-comment",
},
},
],
},
type: "layout",
docs: {
description: "Require empty lines around comments",
recommended: false,
url: "https://eslint.org/docs/latest/rules/lines-around-comment",
},
fixable: "whitespace",
schema: [
{
type: "object",
properties: {
beforeBlockComment: {
type: "boolean",
default: true,
},
afterBlockComment: {
type: "boolean",
default: false,
},
beforeLineComment: {
type: "boolean",
default: false,
},
afterLineComment: {
type: "boolean",
default: false,
},
allowBlockStart: {
type: "boolean",
default: false,
},
allowBlockEnd: {
type: "boolean",
default: false,
},
allowClassStart: {
type: "boolean",
},
allowClassEnd: {
type: "boolean",
},
allowObjectStart: {
type: "boolean",
},
allowObjectEnd: {
type: "boolean",
},
allowArrayStart: {
type: "boolean",
},
allowArrayEnd: {
type: "boolean",
},
ignorePattern: {
type: "string",
},
applyDefaultIgnorePatterns: {
type: "boolean",
},
afterHashbangComment: {
type: "boolean",
default: false,
},
},
additionalProperties: false,
},
],
messages: {
after: "Expected line after comment.",
before: "Expected line before comment.",
},
},
create(context) {
const options = Object.assign({}, context.options[0]);
const ignorePattern = options.ignorePattern;
const defaultIgnoreRegExp = astUtils.COMMENTS_IGNORE_PATTERN;
const customIgnoreRegExp = new RegExp(ignorePattern, "u");
const applyDefaultIgnorePatterns =
options.applyDefaultIgnorePatterns !== false;
options.beforeBlockComment =
typeof options.beforeBlockComment !== "undefined"
? options.beforeBlockComment
: true;
const sourceCode = context.sourceCode;
const lines = sourceCode.lines,
numLines = lines.length + 1,
comments = sourceCode.getAllComments(),
commentLines = getCommentLineNums(comments),
emptyLines = getEmptyLineNums(lines),
commentAndEmptyLines = new Set(commentLines.concat(emptyLines));
/**
* Returns whether or not comments are on lines starting with or ending with code
* @param {token} token The comment token to check.
* @returns {boolean} True if the comment is not alone.
*/
function codeAroundComment(token) {
let currentToken = token;
do {
currentToken = sourceCode.getTokenBefore(currentToken, {
includeComments: true,
});
} while (currentToken && astUtils.isCommentToken(currentToken));
if (
currentToken &&
astUtils.isTokenOnSameLine(currentToken, token)
) {
return true;
}
currentToken = token;
do {
currentToken = sourceCode.getTokenAfter(currentToken, {
includeComments: true,
});
} while (currentToken && astUtils.isCommentToken(currentToken));
if (
currentToken &&
astUtils.isTokenOnSameLine(token, currentToken)
) {
return true;
}
return false;
}
/**
* Returns whether or not comments are inside a node type or not.
* @param {ASTNode} parent The Comment parent node.
* @param {string} nodeType The parent type to check against.
* @returns {boolean} True if the comment is inside nodeType.
*/
function isParentNodeType(parent, nodeType) {
return (
parent.type === nodeType ||
(parent.body && parent.body.type === nodeType) ||
(parent.consequent && parent.consequent.type === nodeType)
);
}
/**
* Returns the parent node that contains the given token.
* @param {token} token The token to check.
* @returns {ASTNode|null} The parent node that contains the given token.
*/
function getParentNodeOfToken(token) {
const node = sourceCode.getNodeByRangeIndex(token.range[0]);
/*
* For the purpose of this rule, the comment token is in a `StaticBlock` node only
* if it's inside the braces of that `StaticBlock` node.
*
* Example where this function returns `null`:
*
* static
* // comment
* {
* }
*
* Example where this function returns `StaticBlock` node:
*
* static
* {
* // comment
* }
*
*/
if (node && node.type === "StaticBlock") {
const openingBrace = sourceCode.getFirstToken(node, {
skip: 1,
}); // skip the `static` token
return token.range[0] >= openingBrace.range[0] ? node : null;
}
return node;
}
/**
* Returns whether or not comments are at the parent start or not.
* @param {token} token The Comment token.
* @param {string} nodeType The parent type to check against.
* @returns {boolean} True if the comment is at parent start.
*/
function isCommentAtParentStart(token, nodeType) {
const parent = getParentNodeOfToken(token);
if (parent && isParentNodeType(parent, nodeType)) {
let parentStartNodeOrToken = parent;
if (parent.type === "StaticBlock") {
parentStartNodeOrToken = sourceCode.getFirstToken(parent, {
skip: 1,
}); // opening brace of the static block
} else if (parent.type === "SwitchStatement") {
parentStartNodeOrToken = sourceCode.getTokenAfter(
parent.discriminant,
{
filter: astUtils.isOpeningBraceToken,
},
); // opening brace of the switch statement
}
return (
token.loc.start.line -
parentStartNodeOrToken.loc.start.line ===
1
);
}
return false;
}
/**
* Returns whether or not comments are at the parent end or not.
* @param {token} token The Comment token.
* @param {string} nodeType The parent type to check against.
* @returns {boolean} True if the comment is at parent end.
*/
function isCommentAtParentEnd(token, nodeType) {
const parent = getParentNodeOfToken(token);
return (
!!parent &&
isParentNodeType(parent, nodeType) &&
parent.loc.end.line - token.loc.end.line === 1
);
}
/**
* Returns whether or not comments are at the block start or not.
* @param {token} token The Comment token.
* @returns {boolean} True if the comment is at block start.
*/
function isCommentAtBlockStart(token) {
return (
isCommentAtParentStart(token, "ClassBody") ||
isCommentAtParentStart(token, "BlockStatement") ||
isCommentAtParentStart(token, "StaticBlock") ||
isCommentAtParentStart(token, "SwitchCase") ||
isCommentAtParentStart(token, "SwitchStatement")
);
}
/**
* Returns whether or not comments are at the block end or not.
* @param {token} token The Comment token.
* @returns {boolean} True if the comment is at block end.
*/
function isCommentAtBlockEnd(token) {
return (
isCommentAtParentEnd(token, "ClassBody") ||
isCommentAtParentEnd(token, "BlockStatement") ||
isCommentAtParentEnd(token, "StaticBlock") ||
isCommentAtParentEnd(token, "SwitchCase") ||
isCommentAtParentEnd(token, "SwitchStatement")
);
}
/**
* Returns whether or not comments are at the class start or not.
* @param {token} token The Comment token.
* @returns {boolean} True if the comment is at class start.
*/
function isCommentAtClassStart(token) {
return isCommentAtParentStart(token, "ClassBody");
}
/**
* Returns whether or not comments are at the class end or not.
* @param {token} token The Comment token.
* @returns {boolean} True if the comment is at class end.
*/
function isCommentAtClassEnd(token) {
return isCommentAtParentEnd(token, "ClassBody");
}
/**
* Returns whether or not comments are at the object start or not.
* @param {token} token The Comment token.
* @returns {boolean} True if the comment is at object start.
*/
function isCommentAtObjectStart(token) {
return (
isCommentAtParentStart(token, "ObjectExpression") ||
isCommentAtParentStart(token, "ObjectPattern")
);
}
/**
* Returns whether or not comments are at the object end or not.
* @param {token} token The Comment token.
* @returns {boolean} True if the comment is at object end.
*/
function isCommentAtObjectEnd(token) {
return (
isCommentAtParentEnd(token, "ObjectExpression") ||
isCommentAtParentEnd(token, "ObjectPattern")
);
}
/**
* Returns whether or not comments are at the array start or not.
* @param {token} token The Comment token.
* @returns {boolean} True if the comment is at array start.
*/
function isCommentAtArrayStart(token) {
return (
isCommentAtParentStart(token, "ArrayExpression") ||
isCommentAtParentStart(token, "ArrayPattern")
);
}
/**
* Returns whether or not comments are at the array end or not.
* @param {token} token The Comment token.
* @returns {boolean} True if the comment is at array end.
*/
function isCommentAtArrayEnd(token) {
return (
isCommentAtParentEnd(token, "ArrayExpression") ||
isCommentAtParentEnd(token, "ArrayPattern")
);
}
/**
* Checks if a comment token has lines around it (ignores inline comments)
* @param {token} token The Comment token.
* @param {Object} opts Options to determine the newline.
* @param {boolean} opts.after Should have a newline after this line.
* @param {boolean} opts.before Should have a newline before this line.
* @returns {void}
*/
function checkForEmptyLine(token, opts) {
if (
applyDefaultIgnorePatterns &&
defaultIgnoreRegExp.test(token.value)
) {
return;
}
if (ignorePattern && customIgnoreRegExp.test(token.value)) {
return;
}
let after = opts.after,
before = opts.before;
const prevLineNum = token.loc.start.line - 1,
nextLineNum = token.loc.end.line + 1,
commentIsNotAlone = codeAroundComment(token);
const blockStartAllowed =
options.allowBlockStart &&
isCommentAtBlockStart(token) &&
!(
options.allowClassStart === false &&
isCommentAtClassStart(token)
),
blockEndAllowed =
options.allowBlockEnd &&
isCommentAtBlockEnd(token) &&
!(
options.allowClassEnd === false &&
isCommentAtClassEnd(token)
),
classStartAllowed =
options.allowClassStart && isCommentAtClassStart(token),
classEndAllowed =
options.allowClassEnd && isCommentAtClassEnd(token),
objectStartAllowed =
options.allowObjectStart && isCommentAtObjectStart(token),
objectEndAllowed =
options.allowObjectEnd && isCommentAtObjectEnd(token),
arrayStartAllowed =
options.allowArrayStart && isCommentAtArrayStart(token),
arrayEndAllowed =
options.allowArrayEnd && isCommentAtArrayEnd(token);
const exceptionStartAllowed =
blockStartAllowed ||
classStartAllowed ||
objectStartAllowed ||
arrayStartAllowed;
const exceptionEndAllowed =
blockEndAllowed ||
classEndAllowed ||
objectEndAllowed ||
arrayEndAllowed;
// ignore top of the file and bottom of the file
if (prevLineNum < 1) {
before = false;
}
if (nextLineNum >= numLines) {
after = false;
}
// we ignore all inline comments
if (commentIsNotAlone) {
return;
}
const previousTokenOrComment = sourceCode.getTokenBefore(token, {
includeComments: true,
});
const nextTokenOrComment = sourceCode.getTokenAfter(token, {
includeComments: true,
});
// check for newline before
if (
!exceptionStartAllowed &&
before &&
!commentAndEmptyLines.has(prevLineNum) &&
!(
astUtils.isCommentToken(previousTokenOrComment) &&
astUtils.isTokenOnSameLine(previousTokenOrComment, token)
)
) {
const lineStart = token.range[0] - token.loc.start.column;
const range = [lineStart, lineStart];
context.report({
node: token,
messageId: "before",
fix(fixer) {
return fixer.insertTextBeforeRange(range, "\n");
},
});
}
// check for newline after
if (
!exceptionEndAllowed &&
after &&
!commentAndEmptyLines.has(nextLineNum) &&
!(
astUtils.isCommentToken(nextTokenOrComment) &&
astUtils.isTokenOnSameLine(token, nextTokenOrComment)
)
) {
context.report({
node: token,
messageId: "after",
fix(fixer) {
return fixer.insertTextAfter(token, "\n");
},
});
}
}
//--------------------------------------------------------------------------
// Public
//--------------------------------------------------------------------------
return {
Program() {
comments.forEach(token => {
if (token.type === "Line") {
if (
options.beforeLineComment ||
options.afterLineComment
) {
checkForEmptyLine(token, {
after: options.afterLineComment,
before: options.beforeLineComment,
});
}
} else if (token.type === "Block") {
if (
options.beforeBlockComment ||
options.afterBlockComment
) {
checkForEmptyLine(token, {
after: options.afterBlockComment,
before: options.beforeBlockComment,
});
}
} else if (token.type === "Shebang") {
if (options.afterHashbangComment) {
checkForEmptyLine(token, {
after: options.afterHashbangComment,
before: false,
});
}
}
});
},
};
},
};

View File

@ -0,0 +1,58 @@
import { useMatch } from './useMatch'
import type {
StructuralSharingOption,
ValidateSelected,
} from './structuralSharing'
import type {
AnyRouter,
RegisteredRouter,
ResolveUseLoaderDeps,
StrictOrFrom,
UseLoaderDepsResult,
} from '@tanstack/router-core'
export interface UseLoaderDepsBaseOptions<
TRouter extends AnyRouter,
TFrom,
TSelected,
TStructuralSharing,
> {
select?: (
deps: ResolveUseLoaderDeps<TRouter, TFrom>,
) => ValidateSelected<TRouter, TSelected, TStructuralSharing>
}
export type UseLoaderDepsOptions<
TRouter extends AnyRouter,
TFrom extends string | undefined,
TSelected,
TStructuralSharing,
> = StrictOrFrom<TRouter, TFrom> &
UseLoaderDepsBaseOptions<TRouter, TFrom, TSelected, TStructuralSharing> &
StructuralSharingOption<TRouter, TSelected, TStructuralSharing>
export type UseLoaderDepsRoute<out TId> = <
TRouter extends AnyRouter = RegisteredRouter,
TSelected = unknown,
TStructuralSharing extends boolean = boolean,
>(
opts?: UseLoaderDepsBaseOptions<TRouter, TId, TSelected, TStructuralSharing> &
StructuralSharingOption<TRouter, TSelected, false>,
) => UseLoaderDepsResult<TRouter, TId, TSelected>
export function useLoaderDeps<
TRouter extends AnyRouter = RegisteredRouter,
const TFrom extends string | undefined = undefined,
TSelected = unknown,
TStructuralSharing extends boolean = boolean,
>(
opts: UseLoaderDepsOptions<TRouter, TFrom, TSelected, TStructuralSharing>,
): UseLoaderDepsResult<TRouter, TFrom, TSelected> {
const { select, ...rest } = opts
return useMatch({
...rest,
select: (s) => {
return select ? select(s.loaderDeps) : s.loaderDeps
},
}) as UseLoaderDepsResult<TRouter, TFrom, TSelected>
}

View File

@ -0,0 +1,22 @@
/**
Regular expression for matching a [shebang](https://en.wikipedia.org/wiki/Shebang_(Unix)) line.
@example
```
import shebangRegex = require('shebang-regex');
const string = '#!/usr/bin/env node\nconsole.log("unicorns");';
shebangRegex.test(string);
//=> true
shebangRegex.exec(string)[0];
//=> '#!/usr/bin/env node'
shebangRegex.exec(string)[1];
//=> '/usr/bin/env node'
```
*/
declare const shebangRegex: RegExp;
export = shebangRegex;

View File

@ -0,0 +1 @@
module.exports={C:{"109":0.00479,"115":0.22532,"118":0.00959,"128":0.05273,"132":0.00479,"134":0.00479,"135":1.86007,"136":7.85257,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 110 111 112 113 114 116 117 119 120 121 122 123 124 125 126 127 129 130 131 133 137 138 139 140 3.5 3.6"},D:{"39":0.00479,"40":0.00479,"41":0.00479,"42":0.00959,"43":0.00479,"44":0.00479,"45":0.03835,"46":0.00479,"47":0.00479,"48":0.00479,"49":0.00479,"51":0.00479,"52":0.00479,"53":0.00479,"54":0.00479,"55":0.00479,"56":0.00479,"57":0.00479,"58":0.00479,"59":0.00479,"60":0.00479,"79":0.00479,"88":0.00479,"94":0.00479,"99":0.01438,"101":0.00959,"102":0.00479,"103":0.08629,"104":0.00959,"105":0.16779,"108":0.02397,"109":0.16779,"111":0.00479,"112":0.01438,"116":0.12464,"117":0.01438,"119":0.01918,"120":0.02397,"122":0.00479,"123":0.00479,"124":0.02876,"125":0.02876,"126":0.60404,"127":0.08629,"128":0.06712,"129":0.01918,"130":0.06232,"131":0.28764,"132":0.69034,"133":6.90815,"134":8.8689,"135":0.00959,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 50 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 80 81 83 84 85 86 87 89 90 91 92 93 95 96 97 98 100 106 107 110 113 114 115 118 121 136 137 138"},F:{"95":0.02876,"116":0.12944,"117":0.27805,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"92":0.02397,"100":0.01438,"104":0.14382,"107":0.03356,"109":0.09588,"110":0.00959,"114":0.00479,"115":0.03835,"116":0.00959,"120":0.00479,"121":0.00479,"122":0.01438,"123":0.00479,"126":0.02397,"127":0.00959,"128":0.01918,"129":0.01918,"130":0.02876,"131":0.05273,"132":0.12464,"133":2.84764,"134":6.34726,_:"12 13 14 15 16 17 18 79 80 81 83 84 85 86 87 88 89 90 91 93 94 95 96 97 98 99 101 102 103 105 106 108 111 112 113 117 118 119 124 125"},E:{"13":0.0815,_:"0 4 5 6 7 8 9 10 11 12 14 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 11.1 12.1 15.2-15.3","13.1":0.02876,"14.1":0.10067,"15.1":0.00479,"15.4":0.00959,"15.5":0.00479,"15.6":0.62322,"16.0":0.18697,"16.1":0.04315,"16.2":0.00479,"16.3":0.02397,"16.4":0.07191,"16.5":0.11026,"16.6":0.73828,"17.0":0.00479,"17.1":0.64719,"17.2":0.04315,"17.3":0.25888,"17.4":0.10067,"17.5":0.12944,"17.6":0.51296,"18.0":0.06712,"18.1":0.52255,"18.2":0.10547,"18.3":3.55715,"18.4":0.00959},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00587,"5.0-5.1":0,"6.0-6.1":0.0176,"7.0-7.1":0.01174,"8.1-8.4":0,"9.0-9.2":0.0088,"9.3":0.04108,"10.0-10.2":0.00293,"10.3":0.06749,"11.0-11.2":0.31102,"11.3-11.4":0.02054,"12.0-12.1":0.01174,"12.2-12.5":0.29048,"13.0-13.1":0.00587,"13.2":0.0088,"13.3":0.01174,"13.4-13.7":0.04108,"14.0-14.4":0.1027,"14.5-14.8":0.12323,"15.0-15.1":0.06749,"15.2-15.3":0.06749,"15.4":0.08216,"15.5":0.09389,"15.6-15.8":1.15605,"16.0":0.16431,"16.1":0.33743,"16.2":0.17605,"16.3":0.30515,"16.4":0.06749,"16.5":0.12617,"16.6-16.7":1.37025,"17.0":0.08216,"17.1":0.14671,"17.2":0.1115,"17.3":0.15551,"17.4":0.31102,"17.5":0.69246,"17.6-17.7":2.00989,"18.0":0.56336,"18.1":1.84264,"18.2":0.82449,"18.3":17.23223,"18.4":0.25527},P:{"4":0.02168,"22":0.02168,"27":1.76697,_:"20 21 23 24 25 26 5.0-5.4 6.2-6.4 8.2 9.2 10.1 11.1-11.2 12.0 13.0 14.0 15.0 16.0 17.0 18.0","7.2-7.4":0.01084,"19.0":0.03252},I:{"0":0.03118,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.00001,"4.4":0,"4.4.3-4.4.4":0.00003},K:{"0":0.05728,_:"10 11 12 11.1 11.5 12.1"},A:{"11":0.05753,_:"6 7 8 9 10 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{"0":0.61443},Q:{_:"14.9"},O:{"0":0.00521},H:{"0":0},L:{"0":20.54603}};

View File

@ -0,0 +1,201 @@
var concatMap = require('concat-map');
var balanced = require('balanced-match');
module.exports = expandTop;
var escSlash = '\0SLASH'+Math.random()+'\0';
var escOpen = '\0OPEN'+Math.random()+'\0';
var escClose = '\0CLOSE'+Math.random()+'\0';
var escComma = '\0COMMA'+Math.random()+'\0';
var escPeriod = '\0PERIOD'+Math.random()+'\0';
function numeric(str) {
return parseInt(str, 10) == str
? parseInt(str, 10)
: str.charCodeAt(0);
}
function escapeBraces(str) {
return str.split('\\\\').join(escSlash)
.split('\\{').join(escOpen)
.split('\\}').join(escClose)
.split('\\,').join(escComma)
.split('\\.').join(escPeriod);
}
function unescapeBraces(str) {
return str.split(escSlash).join('\\')
.split(escOpen).join('{')
.split(escClose).join('}')
.split(escComma).join(',')
.split(escPeriod).join('.');
}
// Basically just str.split(","), but handling cases
// where we have nested braced sections, which should be
// treated as individual members, like {a,{b,c},d}
function parseCommaParts(str) {
if (!str)
return [''];
var parts = [];
var m = balanced('{', '}', str);
if (!m)
return str.split(',');
var pre = m.pre;
var body = m.body;
var post = m.post;
var p = pre.split(',');
p[p.length-1] += '{' + body + '}';
var postParts = parseCommaParts(post);
if (post.length) {
p[p.length-1] += postParts.shift();
p.push.apply(p, postParts);
}
parts.push.apply(parts, p);
return parts;
}
function expandTop(str) {
if (!str)
return [];
// I don't know why Bash 4.3 does this, but it does.
// Anything starting with {} will have the first two bytes preserved
// but *only* at the top level, so {},a}b will not expand to anything,
// but a{},b}c will be expanded to [a}c,abc].
// One could argue that this is a bug in Bash, but since the goal of
// this module is to match Bash's rules, we escape a leading {}
if (str.substr(0, 2) === '{}') {
str = '\\{\\}' + str.substr(2);
}
return expand(escapeBraces(str), true).map(unescapeBraces);
}
function identity(e) {
return e;
}
function embrace(str) {
return '{' + str + '}';
}
function isPadded(el) {
return /^-?0\d/.test(el);
}
function lte(i, y) {
return i <= y;
}
function gte(i, y) {
return i >= y;
}
function expand(str, isTop) {
var expansions = [];
var m = balanced('{', '}', str);
if (!m || /\$$/.test(m.pre)) return [str];
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
var isSequence = isNumericSequence || isAlphaSequence;
var isOptions = m.body.indexOf(',') >= 0;
if (!isSequence && !isOptions) {
// {a},b}
if (m.post.match(/,.*\}/)) {
str = m.pre + '{' + m.body + escClose + m.post;
return expand(str);
}
return [str];
}
var n;
if (isSequence) {
n = m.body.split(/\.\./);
} else {
n = parseCommaParts(m.body);
if (n.length === 1) {
// x{{a,b}}y ==> x{a}y x{b}y
n = expand(n[0], false).map(embrace);
if (n.length === 1) {
var post = m.post.length
? expand(m.post, false)
: [''];
return post.map(function(p) {
return m.pre + n[0] + p;
});
}
}
}
// at this point, n is the parts, and we know it's not a comma set
// with a single entry.
// no need to expand pre, since it is guaranteed to be free of brace-sets
var pre = m.pre;
var post = m.post.length
? expand(m.post, false)
: [''];
var N;
if (isSequence) {
var x = numeric(n[0]);
var y = numeric(n[1]);
var width = Math.max(n[0].length, n[1].length)
var incr = n.length == 3
? Math.abs(numeric(n[2]))
: 1;
var test = lte;
var reverse = y < x;
if (reverse) {
incr *= -1;
test = gte;
}
var pad = n.some(isPadded);
N = [];
for (var i = x; test(i, y); i += incr) {
var c;
if (isAlphaSequence) {
c = String.fromCharCode(i);
if (c === '\\')
c = '';
} else {
c = String(i);
if (pad) {
var need = width - c.length;
if (need > 0) {
var z = new Array(need + 1).join('0');
if (i < 0)
c = '-' + z + c.slice(1);
else
c = z + c;
}
}
}
N.push(c);
}
} else {
N = concatMap(n, function(el) { return expand(el, false) });
}
for (var j = 0; j < N.length; j++) {
for (var k = 0; k < post.length; k++) {
var expansion = pre + N[j] + post[k];
if (!isTop || isSequence || expansion)
expansions.push(expansion);
}
}
return expansions;
}

View File

@ -0,0 +1,2 @@
import { type ThisEncode } from "./utils.js";
export declare function flatten(this: ThisEncode, input: unknown): number | [number];

View File

@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _classPrivateFieldGet2;
var _assertClassBrand = require("./assertClassBrand.js");
function _classPrivateFieldGet2(privateMap, receiver) {
return privateMap.get((0, _assertClassBrand.default)(privateMap, receiver));
}
//# sourceMappingURL=classPrivateFieldGet2.js.map

View File

@ -0,0 +1 @@
{"version":3,"names":["_index","require","_index2","toBlock","node","parent","isBlockStatement","blockNodes","isEmptyStatement","isStatement","isFunction","returnStatement","expressionStatement","blockStatement"],"sources":["../../src/converters/toBlock.ts"],"sourcesContent":["import {\n isBlockStatement,\n isFunction,\n isEmptyStatement,\n isStatement,\n} from \"../validators/generated/index.ts\";\nimport {\n returnStatement,\n expressionStatement,\n blockStatement,\n} from \"../builders/generated/index.ts\";\nimport type * as t from \"../index.ts\";\n\nexport default function toBlock(\n node: t.Statement | t.Expression,\n parent?: t.Node,\n): t.BlockStatement {\n if (isBlockStatement(node)) {\n return node;\n }\n\n let blockNodes: t.Statement[] = [];\n\n if (isEmptyStatement(node)) {\n blockNodes = [];\n } else {\n if (!isStatement(node)) {\n if (isFunction(parent)) {\n node = returnStatement(node);\n } else {\n node = expressionStatement(node);\n }\n }\n\n blockNodes = [node];\n }\n\n return blockStatement(blockNodes);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAMA,IAAAC,OAAA,GAAAD,OAAA;AAOe,SAASE,OAAOA,CAC7BC,IAAgC,EAChCC,MAAe,EACG;EAClB,IAAI,IAAAC,uBAAgB,EAACF,IAAI,CAAC,EAAE;IAC1B,OAAOA,IAAI;EACb;EAEA,IAAIG,UAAyB,GAAG,EAAE;EAElC,IAAI,IAAAC,uBAAgB,EAACJ,IAAI,CAAC,EAAE;IAC1BG,UAAU,GAAG,EAAE;EACjB,CAAC,MAAM;IACL,IAAI,CAAC,IAAAE,kBAAW,EAACL,IAAI,CAAC,EAAE;MACtB,IAAI,IAAAM,iBAAU,EAACL,MAAM,CAAC,EAAE;QACtBD,IAAI,GAAG,IAAAO,uBAAe,EAACP,IAAI,CAAC;MAC9B,CAAC,MAAM;QACLA,IAAI,GAAG,IAAAQ,2BAAmB,EAACR,IAAI,CAAC;MAClC;IACF;IAEAG,UAAU,GAAG,CAACH,IAAI,CAAC;EACrB;EAEA,OAAO,IAAAS,sBAAc,EAACN,UAAU,CAAC;AACnC","ignoreList":[]}

View File

@ -0,0 +1,163 @@
/**
* @fileoverview Disallows unnecessary `return await`
* @author Jordan Harband
* @deprecated in ESLint v8.46.0
*/
"use strict";
const astUtils = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../shared/types').Rule} */
module.exports = {
meta: {
hasSuggestions: true,
type: "suggestion",
docs: {
description: "Disallow unnecessary `return await`",
recommended: false,
url: "https://eslint.org/docs/latest/rules/no-return-await",
},
fixable: null,
deprecated: {
message:
"The original assumption of the rule no longer holds true because of engine optimization.",
url: "https://eslint.org/docs/latest/rules/no-return-await",
deprecatedSince: "8.46.0",
availableUntil: null,
replacedBy: [],
},
schema: [],
messages: {
removeAwait: "Remove redundant `await`.",
redundantUseOfAwait: "Redundant use of `await` on a return value.",
},
},
create(context) {
/**
* Reports a found unnecessary `await` expression.
* @param {ASTNode} node The node representing the `await` expression to report
* @returns {void}
*/
function reportUnnecessaryAwait(node) {
context.report({
node: context.sourceCode.getFirstToken(node),
loc: node.loc,
messageId: "redundantUseOfAwait",
suggest: [
{
messageId: "removeAwait",
fix(fixer) {
const sourceCode = context.sourceCode;
const [awaitToken, tokenAfterAwait] =
sourceCode.getFirstTokens(node, 2);
const areAwaitAndAwaitedExpressionOnTheSameLine =
awaitToken.loc.start.line ===
tokenAfterAwait.loc.start.line;
if (!areAwaitAndAwaitedExpressionOnTheSameLine) {
return null;
}
const [startOfAwait, endOfAwait] = awaitToken.range;
const characterAfterAwait =
sourceCode.text[endOfAwait];
const trimLength =
characterAfterAwait === " " ? 1 : 0;
const range = [
startOfAwait,
endOfAwait + trimLength,
];
return fixer.removeRange(range);
},
},
],
});
}
/**
* Determines whether a thrown error from this node will be caught/handled within this function rather than immediately halting
* this function. For example, a statement in a `try` block will always have an error handler. A statement in
* a `catch` block will only have an error handler if there is also a `finally` block.
* @param {ASTNode} node A node representing a location where an could be thrown
* @returns {boolean} `true` if a thrown error will be caught/handled in this function
*/
function hasErrorHandler(node) {
let ancestor = node;
while (
!astUtils.isFunction(ancestor) &&
ancestor.type !== "Program"
) {
if (
ancestor.parent.type === "TryStatement" &&
(ancestor === ancestor.parent.block ||
(ancestor === ancestor.parent.handler &&
ancestor.parent.finalizer))
) {
return true;
}
ancestor = ancestor.parent;
}
return false;
}
/**
* Checks if a node is placed in tail call position. Once `return` arguments (or arrow function expressions) can be a complex expression,
* an `await` expression could or could not be unnecessary by the definition of this rule. So we're looking for `await` expressions that are in tail position.
* @param {ASTNode} node A node representing the `await` expression to check
* @returns {boolean} The checking result
*/
function isInTailCallPosition(node) {
if (node.parent.type === "ArrowFunctionExpression") {
return true;
}
if (node.parent.type === "ReturnStatement") {
return !hasErrorHandler(node.parent);
}
if (
node.parent.type === "ConditionalExpression" &&
(node === node.parent.consequent ||
node === node.parent.alternate)
) {
return isInTailCallPosition(node.parent);
}
if (
node.parent.type === "LogicalExpression" &&
node === node.parent.right
) {
return isInTailCallPosition(node.parent);
}
if (
node.parent.type === "SequenceExpression" &&
node === node.parent.expressions.at(-1)
) {
return isInTailCallPosition(node.parent);
}
return false;
}
return {
AwaitExpression(node) {
if (isInTailCallPosition(node) && !hasErrorHandler(node)) {
reportUnnecessaryAwait(node);
}
},
};
},
};

View File

@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _newArrowCheck;
function _newArrowCheck(innerThis, boundThis) {
if (innerThis !== boundThis) {
throw new TypeError("Cannot instantiate an arrow function");
}
}
//# sourceMappingURL=newArrowCheck.js.map

View File

@ -0,0 +1 @@
{"version":3,"file":"ScriptOnce.js","sources":["../../src/ScriptOnce.tsx"],"sourcesContent":["import jsesc from 'jsesc'\n\nexport function ScriptOnce({\n children,\n log,\n}: {\n children: string\n log?: boolean\n sync?: boolean\n}) {\n if (typeof document !== 'undefined') {\n return null\n }\n\n return (\n <script\n className=\"tsr-once\"\n dangerouslySetInnerHTML={{\n __html: [\n children,\n (log ?? true) && process.env.NODE_ENV === 'development'\n ? `console.info(\\`Injected From Server:\n${jsesc(children.toString(), { quotes: 'backtick' })}\\`)`\n : '',\n 'if (typeof __TSR_SSR__ !== \"undefined\") __TSR_SSR__.cleanScripts()',\n ]\n .filter(Boolean)\n .join('\\n'),\n }}\n />\n )\n}\n"],"names":[],"mappings":";;AAEO,SAAS,WAAW;AAAA,EACzB;AAAA,EACA;AACF,GAIG;AACG,MAAA,OAAO,aAAa,aAAa;AAC5B,WAAA;AAAA,EAAA;AAIP,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAU;AAAA,MACV,yBAAyB;AAAA,QACvB,QAAQ;AAAA,UACN;AAAA,WACC,OAAO,SAAS,QAAQ,IAAI,aAAa,gBACtC;AAAA,EACZ,MAAM,SAAS,YAAY,EAAE,QAAQ,WAAY,CAAA,CAAC,QACtC;AAAA,UACJ;AAAA,QAEC,EAAA,OAAO,OAAO,EACd,KAAK,IAAI;AAAA,MAAA;AAAA,IACd;AAAA,EACF;AAEJ;"}

View File

@ -0,0 +1,422 @@
# jsesc
Given some data, _jsesc_ returns a stringified representation of that data. jsesc is similar to `JSON.stringify()` except:
1. it outputs JavaScript instead of JSON [by default](#json), enabling support for data structures like ES6 maps and sets;
2. it offers [many options](#api) to customize the output;
3. its output is ASCII-safe [by default](#minimal), thanks to its use of [escape sequences](https://mathiasbynens.be/notes/javascript-escapes) where needed.
For any input, jsesc generates the shortest possible valid printable-ASCII-only output. [Heres an online demo.](https://mothereff.in/js-escapes)
jsescs output can be used instead of `JSON.stringify`s to avoid [mojibake](https://en.wikipedia.org/wiki/Mojibake) and other encoding issues, or even to [avoid errors](https://twitter.com/annevk/status/380000829643571200) when passing JSON-formatted data (which may contain U+2028 LINE SEPARATOR, U+2029 PARAGRAPH SEPARATOR, or [lone surrogates](https://esdiscuss.org/topic/code-points-vs-unicode-scalar-values#content-14)) to a JavaScript parser or an UTF-8 encoder.
## Installation
Via [npm](https://www.npmjs.com/):
```bash
npm install jsesc
```
In [Node.js](https://nodejs.org/):
```js
const jsesc = require('jsesc');
```
## API
### `jsesc(value, options)`
This function takes a value and returns an escaped version of the value where any characters that are not printable ASCII symbols are escaped using the shortest possible (but valid) [escape sequences for use in JavaScript strings](https://mathiasbynens.be/notes/javascript-escapes). The first supported value type is strings:
```js
jsesc('Ich ♥ Bücher');
// → 'Ich \\u2665 B\\xFCcher'
jsesc('foo 𝌆 bar');
// → 'foo \\uD834\\uDF06 bar'
```
Instead of a string, the `value` can also be an array, an object, a map, a set, or a buffer. In such cases, `jsesc` returns a stringified version of the value where any characters that are not printable ASCII symbols are escaped in the same way.
```js
// Escaping an array
jsesc([
'Ich ♥ Bücher', 'foo 𝌆 bar'
]);
// → '[\'Ich \\u2665 B\\xFCcher\',\'foo \\uD834\\uDF06 bar\']'
// Escaping an object
jsesc({
'Ich ♥ Bücher': 'foo 𝌆 bar'
});
// → '{\'Ich \\u2665 B\\xFCcher\':\'foo \\uD834\\uDF06 bar\'}'
```
The optional `options` argument accepts an object with the following options:
#### `quotes`
The default value for the `quotes` option is `'single'`. This means that any occurrences of `'` in the input string are escaped as `\'`, so that the output can be used in a string literal wrapped in single quotes.
```js
jsesc('`Lorem` ipsum "dolor" sit \'amet\' etc.');
// → 'Lorem ipsum "dolor" sit \\\'amet\\\' etc.'
jsesc('`Lorem` ipsum "dolor" sit \'amet\' etc.', {
'quotes': 'single'
});
// → '`Lorem` ipsum "dolor" sit \\\'amet\\\' etc.'
// → "`Lorem` ipsum \"dolor\" sit \\'amet\\' etc."
```
If you want to use the output as part of a string literal wrapped in double quotes, set the `quotes` option to `'double'`.
```js
jsesc('`Lorem` ipsum "dolor" sit \'amet\' etc.', {
'quotes': 'double'
});
// → '`Lorem` ipsum \\"dolor\\" sit \'amet\' etc.'
// → "`Lorem` ipsum \\\"dolor\\\" sit 'amet' etc."
```
If you want to use the output as part of a template literal (i.e. wrapped in backticks), set the `quotes` option to `'backtick'`.
```js
jsesc('`Lorem` ipsum "dolor" sit \'amet\' etc.', {
'quotes': 'backtick'
});
// → '\\`Lorem\\` ipsum "dolor" sit \'amet\' etc.'
// → "\\`Lorem\\` ipsum \"dolor\" sit 'amet' etc."
// → `\\\`Lorem\\\` ipsum "dolor" sit 'amet' etc.`
```
This setting also affects the output for arrays and objects:
```js
jsesc({ 'Ich ♥ Bücher': 'foo 𝌆 bar' }, {
'quotes': 'double'
});
// → '{"Ich \\u2665 B\\xFCcher":"foo \\uD834\\uDF06 bar"}'
jsesc([ 'Ich ♥ Bücher', 'foo 𝌆 bar' ], {
'quotes': 'double'
});
// → '["Ich \\u2665 B\\xFCcher","foo \\uD834\\uDF06 bar"]'
```
#### `numbers`
The default value for the `numbers` option is `'decimal'`. This means that any numeric values are represented using decimal integer literals. Other valid options are `binary`, `octal`, and `hexadecimal`, which result in binary integer literals, octal integer literals, and hexadecimal integer literals, respectively.
```js
jsesc(42, {
'numbers': 'binary'
});
// → '0b101010'
jsesc(42, {
'numbers': 'octal'
});
// → '0o52'
jsesc(42, {
'numbers': 'decimal'
});
// → '42'
jsesc(42, {
'numbers': 'hexadecimal'
});
// → '0x2A'
```
#### `wrap`
The `wrap` option takes a boolean value (`true` or `false`), and defaults to `false` (disabled). When enabled, the output is a valid JavaScript string literal wrapped in quotes. The type of quotes can be specified through the `quotes` setting.
```js
jsesc('Lorem ipsum "dolor" sit \'amet\' etc.', {
'quotes': 'single',
'wrap': true
});
// → '\'Lorem ipsum "dolor" sit \\\'amet\\\' etc.\''
// → "\'Lorem ipsum \"dolor\" sit \\\'amet\\\' etc.\'"
jsesc('Lorem ipsum "dolor" sit \'amet\' etc.', {
'quotes': 'double',
'wrap': true
});
// → '"Lorem ipsum \\"dolor\\" sit \'amet\' etc."'
// → "\"Lorem ipsum \\\"dolor\\\" sit \'amet\' etc.\""
```
#### `es6`
The `es6` option takes a boolean value (`true` or `false`), and defaults to `false` (disabled). When enabled, any astral Unicode symbols in the input are escaped using [ECMAScript 6 Unicode code point escape sequences](https://mathiasbynens.be/notes/javascript-escapes#unicode-code-point) instead of using separate escape sequences for each surrogate half. If backwards compatibility with ES5 environments is a concern, dont enable this setting. If the `json` setting is enabled, the value for the `es6` setting is ignored (as if it was `false`).
```js
// By default, the `es6` option is disabled:
jsesc('foo 𝌆 bar 💩 baz');
// → 'foo \\uD834\\uDF06 bar \\uD83D\\uDCA9 baz'
// To explicitly disable it:
jsesc('foo 𝌆 bar 💩 baz', {
'es6': false
});
// → 'foo \\uD834\\uDF06 bar \\uD83D\\uDCA9 baz'
// To enable it:
jsesc('foo 𝌆 bar 💩 baz', {
'es6': true
});
// → 'foo \\u{1D306} bar \\u{1F4A9} baz'
```
#### `escapeEverything`
The `escapeEverything` option takes a boolean value (`true` or `false`), and defaults to `false` (disabled). When enabled, all the symbols in the output are escaped — even printable ASCII symbols.
```js
jsesc('lolwat"foo\'bar', {
'escapeEverything': true
});
// → '\\x6C\\x6F\\x6C\\x77\\x61\\x74\\"\\x66\\x6F\\x6F\\\'\\x62\\x61\\x72'
// → "\\x6C\\x6F\\x6C\\x77\\x61\\x74\\\"\\x66\\x6F\\x6F\\'\\x62\\x61\\x72"
```
This setting also affects the output for string literals within arrays and objects.
#### `minimal`
The `minimal` option takes a boolean value (`true` or `false`), and defaults to `false` (disabled). When enabled, only a limited set of symbols in the output are escaped:
* U+0000 `\0`
* U+0008 `\b`
* U+0009 `\t`
* U+000A `\n`
* U+000C `\f`
* U+000D `\r`
* U+005C `\\`
* U+2028 `\u2028`
* U+2029 `\u2029`
* whatever symbol is being used for wrapping string literals (based on [the `quotes` option](#quotes))
* [lone surrogates](https://esdiscuss.org/topic/code-points-vs-unicode-scalar-values#content-14)
Note: with this option enabled, jsesc output is no longer guaranteed to be ASCII-safe.
```js
jsesc('foo\u2029bar\nbaz©qux𝌆flops', {
'minimal': false
});
// → 'foo\\u2029bar\\nbaz©qux𝌆flops'
```
#### `isScriptContext`
The `isScriptContext` option takes a boolean value (`true` or `false`), and defaults to `false` (disabled). When enabled, occurrences of [`</script` and `</style`](https://mathiasbynens.be/notes/etago) in the output are escaped as `<\/script` and `<\/style`, and [`<!--`](https://mathiasbynens.be/notes/etago#comment-8) is escaped as `\x3C!--` (or `\u003C!--` when the `json` option is enabled). This setting is useful when jsescs output ends up as part of a `<script>` or `<style>` element in an HTML document.
```js
jsesc('foo</script>bar', {
'isScriptContext': true
});
// → 'foo<\\/script>bar'
```
#### `compact`
The `compact` option takes a boolean value (`true` or `false`), and defaults to `true` (enabled). When enabled, the output for arrays and objects is as compact as possible; its not formatted nicely.
```js
jsesc({ 'Ich ♥ Bücher': 'foo 𝌆 bar' }, {
'compact': true // this is the default
});
// → '{\'Ich \u2665 B\xFCcher\':\'foo \uD834\uDF06 bar\'}'
jsesc({ 'Ich ♥ Bücher': 'foo 𝌆 bar' }, {
'compact': false
});
// → '{\n\t\'Ich \u2665 B\xFCcher\': \'foo \uD834\uDF06 bar\'\n}'
jsesc([ 'Ich ♥ Bücher', 'foo 𝌆 bar' ], {
'compact': false
});
// → '[\n\t\'Ich \u2665 B\xFCcher\',\n\t\'foo \uD834\uDF06 bar\'\n]'
```
This setting has no effect on the output for strings.
#### `indent`
The `indent` option takes a string value, and defaults to `'\t'`. When the `compact` setting is disabled (`false`), the value of the `indent` option is used to format the output for arrays and objects.
```js
jsesc({ 'Ich ♥ Bücher': 'foo 𝌆 bar' }, {
'compact': false,
'indent': '\t' // this is the default
});
// → '{\n\t\'Ich \u2665 B\xFCcher\': \'foo \uD834\uDF06 bar\'\n}'
jsesc({ 'Ich ♥ Bücher': 'foo 𝌆 bar' }, {
'compact': false,
'indent': ' '
});
// → '{\n \'Ich \u2665 B\xFCcher\': \'foo \uD834\uDF06 bar\'\n}'
jsesc([ 'Ich ♥ Bücher', 'foo 𝌆 bar' ], {
'compact': false,
'indent': ' '
});
// → '[\n \'Ich \u2665 B\xFCcher\',\n\ t\'foo \uD834\uDF06 bar\'\n]'
```
This setting has no effect on the output for strings.
#### `indentLevel`
The `indentLevel` option takes a numeric value, and defaults to `0`. It represents the current indentation level, i.e. the number of times the value of [the `indent` option](#indent) is repeated.
```js
jsesc(['a', 'b', 'c'], {
'compact': false,
'indentLevel': 1
});
// → '[\n\t\t\'a\',\n\t\t\'b\',\n\t\t\'c\'\n\t]'
jsesc(['a', 'b', 'c'], {
'compact': false,
'indentLevel': 2
});
// → '[\n\t\t\t\'a\',\n\t\t\t\'b\',\n\t\t\t\'c\'\n\t\t]'
```
#### `json`
The `json` option takes a boolean value (`true` or `false`), and defaults to `false` (disabled). When enabled, the output is valid JSON. [Hexadecimal character escape sequences](https://mathiasbynens.be/notes/javascript-escapes#hexadecimal) and [the `\v` or `\0` escape sequences](https://mathiasbynens.be/notes/javascript-escapes#single) are not used. Setting `json: true` implies `quotes: 'double', wrap: true, es6: false`, although these values can still be overridden if needed — but in such cases, the output wont be valid JSON anymore.
```js
jsesc('foo\x00bar\xFF\uFFFDbaz', {
'json': true
});
// → '"foo\\u0000bar\\u00FF\\uFFFDbaz"'
jsesc({ 'foo\x00bar\xFF\uFFFDbaz': 'foo\x00bar\xFF\uFFFDbaz' }, {
'json': true
});
// → '{"foo\\u0000bar\\u00FF\\uFFFDbaz":"foo\\u0000bar\\u00FF\\uFFFDbaz"}'
jsesc([ 'foo\x00bar\xFF\uFFFDbaz', 'foo\x00bar\xFF\uFFFDbaz' ], {
'json': true
});
// → '["foo\\u0000bar\\u00FF\\uFFFDbaz","foo\\u0000bar\\u00FF\\uFFFDbaz"]'
// Values that are acceptable in JSON but arent strings, arrays, or object
// literals cant be escaped, so theyll just be preserved:
jsesc([ 'foo\x00bar', [1, '©', { 'foo': true, 'qux': null }], 42 ], {
'json': true
});
// → '["foo\\u0000bar",[1,"\\u00A9",{"foo":true,"qux":null}],42]'
// Values that arent allowed in JSON are run through `JSON.stringify()`:
jsesc([ undefined, -Infinity ], {
'json': true
});
// → '[null,null]'
```
**Note:** Using this option on objects or arrays that contain non-string values relies on `JSON.stringify()`. For legacy environments like IE ≤ 7, use [a `JSON` polyfill](http://bestiejs.github.io/json3/).
#### `lowercaseHex`
The `lowercaseHex` option takes a boolean value (`true` or `false`), and defaults to `false` (disabled). When enabled, any alphabetical hexadecimal digits in escape sequences as well as any hexadecimal integer literals (see [the `numbers` option](#numbers)) in the output are in lowercase.
```js
jsesc('Ich ♥ Bücher', {
'lowercaseHex': true
});
// → 'Ich \\u2665 B\\xfccher'
// ^^
jsesc(42, {
'numbers': 'hexadecimal',
'lowercaseHex': true
});
// → '0x2a'
// ^^
```
### `jsesc.version`
A string representing the semantic version number.
### Using the `jsesc` binary
To use the `jsesc` binary in your shell, simply install jsesc globally using npm:
```bash
npm install -g jsesc
```
After that youre able to escape strings from the command line:
```bash
$ jsesc 'föo ♥ bår 𝌆 baz'
f\xF6o \u2665 b\xE5r \uD834\uDF06 baz
```
To escape arrays or objects containing string values, use the `-o`/`--object` option:
```bash
$ jsesc --object '{ "föo": "♥", "bår": "𝌆 baz" }'
{'f\xF6o':'\u2665','b\xE5r':'\uD834\uDF06 baz'}
```
To prettify the output in such cases, use the `-p`/`--pretty` option:
```bash
$ jsesc --pretty '{ "föo": "♥", "bår": "𝌆 baz" }'
{
'f\xF6o': '\u2665',
'b\xE5r': '\uD834\uDF06 baz'
}
```
For valid JSON output, use the `-j`/`--json` option:
```bash
$ jsesc --json --pretty '{ "föo": "♥", "bår": "𝌆 baz" }'
{
"f\u00F6o": "\u2665",
"b\u00E5r": "\uD834\uDF06 baz"
}
```
Read a local JSON file, escape any non-ASCII symbols, and save the result to a new file:
```bash
$ jsesc --json --object < data-raw.json > data-escaped.json
```
Or do the same with an online JSON file:
```bash
$ curl -sL "http://git.io/aorKgQ" | jsesc --json --object > data-escaped.json
```
See `jsesc --help` for the full list of options.
## Support
As of v3.0.0, jsesc supports Node.js v6+ only.
Older versions (up to jsesc v1.3.0) support Chrome 27, Firefox 3, Safari 4, Opera 10, IE 6, Node.js v6.0.0, Narwhal 0.3.2, RingoJS 0.8-0.11, PhantomJS 1.9.0, and Rhino 1.7RC4. **Note:** Using the `json` option on objects or arrays that contain non-string values relies on `JSON.parse()`. For legacy environments like IE ≤ 7, use [a `JSON` polyfill](https://bestiejs.github.io/json3/).
## Author
| [![twitter/mathias](https://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") |
|---|
| [Mathias Bynens](https://mathiasbynens.be/) |
## License
This library is available under the [MIT](https://mths.be/mit) license.

View File

@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _checkInRHS;
function _checkInRHS(value) {
if (Object(value) !== value) {
throw TypeError("right-hand side of 'in' should be an object, got " + (value !== null ? typeof value : "null"));
}
return value;
}
//# sourceMappingURL=checkInRHS.js.map

View File

@ -0,0 +1,85 @@
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
exports.read = function (buffer, offset, isLE, mLen, nBytes) {
var e, m
var eLen = (nBytes * 8) - mLen - 1
var eMax = (1 << eLen) - 1
var eBias = eMax >> 1
var nBits = -7
var i = isLE ? (nBytes - 1) : 0
var d = isLE ? -1 : 1
var s = buffer[offset + i]
i += d
e = s & ((1 << (-nBits)) - 1)
s >>= (-nBits)
nBits += eLen
for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
m = e & ((1 << (-nBits)) - 1)
e >>= (-nBits)
nBits += mLen
for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
if (e === 0) {
e = 1 - eBias
} else if (e === eMax) {
return m ? NaN : ((s ? -1 : 1) * Infinity)
} else {
m = m + Math.pow(2, mLen)
e = e - eBias
}
return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
}
exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
var e, m, c
var eLen = (nBytes * 8) - mLen - 1
var eMax = (1 << eLen) - 1
var eBias = eMax >> 1
var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
var i = isLE ? 0 : (nBytes - 1)
var d = isLE ? 1 : -1
var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
value = Math.abs(value)
if (isNaN(value) || value === Infinity) {
m = isNaN(value) ? 1 : 0
e = eMax
} else {
e = Math.floor(Math.log(value) / Math.LN2)
if (value * (c = Math.pow(2, -e)) < 1) {
e--
c *= 2
}
if (e + eBias >= 1) {
value += rt / c
} else {
value += rt * Math.pow(2, 1 - eBias)
}
if (value * c >= 2) {
e++
c /= 2
}
if (e + eBias >= eMax) {
m = 0
e = eMax
} else if (e + eBias >= 1) {
m = ((value * c) - 1) * Math.pow(2, mLen)
e = e + eBias
} else {
m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
e = 0
}
}
for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
e = (e << mLen) | m
eLen += mLen
for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
buffer[offset + i - d] |= s * 128
}

View File

@ -0,0 +1,327 @@
/* eslint-disable jsdoc/valid-types -- doesn't allow `readonly`.
TODO: remove eslint-disable when https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/164 is fixed
*/
/**
* @typedef {{ readonly [type: string]: ReadonlyArray<string> }} VisitorKeys
*/
/* eslint-enable jsdoc/valid-types -- doesn't allow `readonly string[]`. TODO: check why */
/**
* @type {VisitorKeys}
*/
const KEYS = {
ArrayExpression: [
"elements"
],
ArrayPattern: [
"elements"
],
ArrowFunctionExpression: [
"params",
"body"
],
AssignmentExpression: [
"left",
"right"
],
AssignmentPattern: [
"left",
"right"
],
AwaitExpression: [
"argument"
],
BinaryExpression: [
"left",
"right"
],
BlockStatement: [
"body"
],
BreakStatement: [
"label"
],
CallExpression: [
"callee",
"arguments"
],
CatchClause: [
"param",
"body"
],
ChainExpression: [
"expression"
],
ClassBody: [
"body"
],
ClassDeclaration: [
"id",
"superClass",
"body"
],
ClassExpression: [
"id",
"superClass",
"body"
],
ConditionalExpression: [
"test",
"consequent",
"alternate"
],
ContinueStatement: [
"label"
],
DebuggerStatement: [],
DoWhileStatement: [
"body",
"test"
],
EmptyStatement: [],
ExperimentalRestProperty: [
"argument"
],
ExperimentalSpreadProperty: [
"argument"
],
ExportAllDeclaration: [
"exported",
"source",
"attributes"
],
ExportDefaultDeclaration: [
"declaration"
],
ExportNamedDeclaration: [
"declaration",
"specifiers",
"source",
"attributes"
],
ExportSpecifier: [
"exported",
"local"
],
ExpressionStatement: [
"expression"
],
ForInStatement: [
"left",
"right",
"body"
],
ForOfStatement: [
"left",
"right",
"body"
],
ForStatement: [
"init",
"test",
"update",
"body"
],
FunctionDeclaration: [
"id",
"params",
"body"
],
FunctionExpression: [
"id",
"params",
"body"
],
Identifier: [],
IfStatement: [
"test",
"consequent",
"alternate"
],
ImportAttribute: [
"key",
"value"
],
ImportDeclaration: [
"specifiers",
"source",
"attributes"
],
ImportDefaultSpecifier: [
"local"
],
ImportExpression: [
"source",
"options"
],
ImportNamespaceSpecifier: [
"local"
],
ImportSpecifier: [
"imported",
"local"
],
JSXAttribute: [
"name",
"value"
],
JSXClosingElement: [
"name"
],
JSXClosingFragment: [],
JSXElement: [
"openingElement",
"children",
"closingElement"
],
JSXEmptyExpression: [],
JSXExpressionContainer: [
"expression"
],
JSXFragment: [
"openingFragment",
"children",
"closingFragment"
],
JSXIdentifier: [],
JSXMemberExpression: [
"object",
"property"
],
JSXNamespacedName: [
"namespace",
"name"
],
JSXOpeningElement: [
"name",
"attributes"
],
JSXOpeningFragment: [],
JSXSpreadAttribute: [
"argument"
],
JSXSpreadChild: [
"expression"
],
JSXText: [],
LabeledStatement: [
"label",
"body"
],
Literal: [],
LogicalExpression: [
"left",
"right"
],
MemberExpression: [
"object",
"property"
],
MetaProperty: [
"meta",
"property"
],
MethodDefinition: [
"key",
"value"
],
NewExpression: [
"callee",
"arguments"
],
ObjectExpression: [
"properties"
],
ObjectPattern: [
"properties"
],
PrivateIdentifier: [],
Program: [
"body"
],
Property: [
"key",
"value"
],
PropertyDefinition: [
"key",
"value"
],
RestElement: [
"argument"
],
ReturnStatement: [
"argument"
],
SequenceExpression: [
"expressions"
],
SpreadElement: [
"argument"
],
StaticBlock: [
"body"
],
Super: [],
SwitchCase: [
"test",
"consequent"
],
SwitchStatement: [
"discriminant",
"cases"
],
TaggedTemplateExpression: [
"tag",
"quasi"
],
TemplateElement: [],
TemplateLiteral: [
"quasis",
"expressions"
],
ThisExpression: [],
ThrowStatement: [
"argument"
],
TryStatement: [
"block",
"handler",
"finalizer"
],
UnaryExpression: [
"argument"
],
UpdateExpression: [
"argument"
],
VariableDeclaration: [
"declarations"
],
VariableDeclarator: [
"id",
"init"
],
WhileStatement: [
"test",
"body"
],
WithStatement: [
"object",
"body"
],
YieldExpression: [
"argument"
]
};
// Types.
const NODE_TYPES = Object.keys(KEYS);
// Freeze the keys.
for (const type of NODE_TYPES) {
Object.freeze(KEYS[type]);
}
Object.freeze(KEYS);
export default KEYS;

View File

@ -0,0 +1 @@
{"version":3,"file":"searchParams.cjs","sources":["../../src/searchParams.ts"],"sourcesContent":["import { decode, encode } from './qss'\nimport type { AnySchema } from './validators'\n\nexport const defaultParseSearch = parseSearchWith(JSON.parse)\nexport const defaultStringifySearch = stringifySearchWith(\n JSON.stringify,\n JSON.parse,\n)\n\nexport function parseSearchWith(parser: (str: string) => any) {\n return (searchStr: string): AnySchema => {\n if (searchStr.substring(0, 1) === '?') {\n searchStr = searchStr.substring(1)\n }\n\n const query: Record<string, unknown> = decode(searchStr)\n\n // Try to parse any query params that might be json\n for (const key in query) {\n const value = query[key]\n if (typeof value === 'string') {\n try {\n query[key] = parser(value)\n } catch (err) {\n //\n }\n }\n }\n\n return query\n }\n}\n\nexport function stringifySearchWith(\n stringify: (search: any) => string,\n parser?: (str: string) => any,\n) {\n function stringifyValue(val: any) {\n if (typeof val === 'object' && val !== null) {\n try {\n return stringify(val)\n } catch (err) {\n // silent\n }\n } else if (typeof val === 'string' && typeof parser === 'function') {\n try {\n // Check if it's a valid parseable string.\n // If it is, then stringify it again.\n parser(val)\n return stringify(val)\n } catch (err) {\n // silent\n }\n }\n return val\n }\n\n return (search: Record<string, any>) => {\n search = { ...search }\n\n Object.keys(search).forEach((key) => {\n const val = search[key]\n if (typeof val === 'undefined' || val === undefined) {\n delete search[key]\n } else {\n search[key] = stringifyValue(val)\n }\n })\n\n const searchStr = encode(search as Record<string, string>).toString()\n\n return searchStr ? `?${searchStr}` : ''\n }\n}\n\nexport type SearchSerializer = (searchObj: Record<string, any>) => string\nexport type SearchParser = (searchStr: string) => Record<string, any>\n"],"names":["decode","encode"],"mappings":";;;AAGa,MAAA,qBAAqB,gBAAgB,KAAK,KAAK;AACrD,MAAM,yBAAyB;AAAA,EACpC,KAAK;AAAA,EACL,KAAK;AACP;AAEO,SAAS,gBAAgB,QAA8B;AAC5D,SAAO,CAAC,cAAiC;AACvC,QAAI,UAAU,UAAU,GAAG,CAAC,MAAM,KAAK;AACzB,kBAAA,UAAU,UAAU,CAAC;AAAA,IAAA;AAG7B,UAAA,QAAiCA,WAAO,SAAS;AAGvD,eAAW,OAAO,OAAO;AACjB,YAAA,QAAQ,MAAM,GAAG;AACnB,UAAA,OAAO,UAAU,UAAU;AACzB,YAAA;AACI,gBAAA,GAAG,IAAI,OAAO,KAAK;AAAA,iBAClB,KAAK;AAAA,QAAA;AAAA,MAEd;AAAA,IACF;AAGK,WAAA;AAAA,EACT;AACF;AAEgB,SAAA,oBACd,WACA,QACA;AACA,WAAS,eAAe,KAAU;AAChC,QAAI,OAAO,QAAQ,YAAY,QAAQ,MAAM;AACvC,UAAA;AACF,eAAO,UAAU,GAAG;AAAA,eACb,KAAK;AAAA,MAAA;AAAA,eAGL,OAAO,QAAQ,YAAY,OAAO,WAAW,YAAY;AAC9D,UAAA;AAGF,eAAO,GAAG;AACV,eAAO,UAAU,GAAG;AAAA,eACb,KAAK;AAAA,MAAA;AAAA,IAEd;AAEK,WAAA;AAAA,EAAA;AAGT,SAAO,CAAC,WAAgC;AAC7B,aAAA,EAAE,GAAG,OAAO;AAErB,WAAO,KAAK,MAAM,EAAE,QAAQ,CAAC,QAAQ;AAC7B,YAAA,MAAM,OAAO,GAAG;AACtB,UAAI,OAAO,QAAQ,eAAe,QAAQ,QAAW;AACnD,eAAO,OAAO,GAAG;AAAA,MAAA,OACZ;AACE,eAAA,GAAG,IAAI,eAAe,GAAG;AAAA,MAAA;AAAA,IAClC,CACD;AAED,UAAM,YAAYC,IAAAA,OAAO,MAAgC,EAAE,SAAS;AAE7D,WAAA,YAAY,IAAI,SAAS,KAAK;AAAA,EACvC;AACF;;;;;"}

View File

@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = isValidIdentifier;
var _helperValidatorIdentifier = require("@babel/helper-validator-identifier");
function isValidIdentifier(name, reserved = true) {
if (typeof name !== "string") return false;
if (reserved) {
if ((0, _helperValidatorIdentifier.isKeyword)(name) || (0, _helperValidatorIdentifier.isStrictReservedWord)(name, true)) {
return false;
}
}
return (0, _helperValidatorIdentifier.isIdentifierName)(name);
}
//# sourceMappingURL=isValidIdentifier.js.map

View File

@ -0,0 +1,14 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _assertThisInitialized;
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
//# sourceMappingURL=assertThisInitialized.js.map

View File

@ -0,0 +1,100 @@
/**
* @fileoverview Rule to disallow a negated condition
* @author Alberto Rodríguez
*/
"use strict";
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../shared/types').Rule} */
module.exports = {
meta: {
type: "suggestion",
docs: {
description: "Disallow negated conditions",
recommended: false,
frozen: true,
url: "https://eslint.org/docs/latest/rules/no-negated-condition",
},
schema: [],
messages: {
unexpectedNegated: "Unexpected negated condition.",
},
},
create(context) {
/**
* Determines if a given node is an if-else without a condition on the else
* @param {ASTNode} node The node to check.
* @returns {boolean} True if the node has an else without an if.
* @private
*/
function hasElseWithoutCondition(node) {
return node.alternate && node.alternate.type !== "IfStatement";
}
/**
* Determines if a given node is a negated unary expression
* @param {Object} test The test object to check.
* @returns {boolean} True if the node is a negated unary expression.
* @private
*/
function isNegatedUnaryExpression(test) {
return test.type === "UnaryExpression" && test.operator === "!";
}
/**
* Determines if a given node is a negated binary expression
* @param {Test} test The test to check.
* @returns {boolean} True if the node is a negated binary expression.
* @private
*/
function isNegatedBinaryExpression(test) {
return (
test.type === "BinaryExpression" &&
(test.operator === "!=" || test.operator === "!==")
);
}
/**
* Determines if a given node has a negated if expression
* @param {ASTNode} node The node to check.
* @returns {boolean} True if the node has a negated if expression.
* @private
*/
function isNegatedIf(node) {
return (
isNegatedUnaryExpression(node.test) ||
isNegatedBinaryExpression(node.test)
);
}
return {
IfStatement(node) {
if (!hasElseWithoutCondition(node)) {
return;
}
if (isNegatedIf(node)) {
context.report({
node,
messageId: "unexpectedNegated",
});
}
},
ConditionalExpression(node) {
if (isNegatedIf(node)) {
context.report({
node,
messageId: "unexpectedNegated",
});
}
},
};
},
};

Some files were not shown because too many files have changed in this diff Show More