update
This commit is contained in:
@@ -0,0 +1,341 @@
|
||||
<h1 align="center">
|
||||
<br>
|
||||
<br>
|
||||
<img width="320" src="media/logo.svg" alt="Chalk">
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
</h1>
|
||||
|
||||
> Terminal string styling done right
|
||||
|
||||
[](https://travis-ci.org/chalk/chalk) [](https://coveralls.io/github/chalk/chalk?branch=master) [](https://www.npmjs.com/package/chalk?activeTab=dependents) [](https://www.npmjs.com/package/chalk) [](https://www.youtube.com/watch?v=9auOCbH5Ns4) [](https://github.com/xojs/xo)  [](https://repl.it/github/chalk/chalk)
|
||||
|
||||
<img src="https://cdn.jsdelivr.net/gh/chalk/ansi-styles@8261697c95bf34b6c7767e2cbe9941a851d59385/screenshot.svg" width="900">
|
||||
|
||||
<br>
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<p>
|
||||
<p>
|
||||
<sup>
|
||||
Sindre Sorhus' open source work is supported by the community on <a href="https://github.com/sponsors/sindresorhus">GitHub Sponsors</a> and <a href="https://stakes.social/0x44d871aebF0126Bf646753E2C976Aa7e68A66c15">Dev</a>
|
||||
</sup>
|
||||
</p>
|
||||
<sup>Special thanks to:</sup>
|
||||
<br>
|
||||
<br>
|
||||
<a href="https://standardresume.co/tech">
|
||||
<img src="https://sindresorhus.com/assets/thanks/standard-resume-logo.svg" width="160"/>
|
||||
</a>
|
||||
<br>
|
||||
<br>
|
||||
<a href="https://retool.com/?utm_campaign=sindresorhus">
|
||||
<img src="https://sindresorhus.com/assets/thanks/retool-logo.svg" width="230"/>
|
||||
</a>
|
||||
<br>
|
||||
<br>
|
||||
<a href="https://doppler.com/?utm_campaign=github_repo&utm_medium=referral&utm_content=chalk&utm_source=github">
|
||||
<div>
|
||||
<img src="https://dashboard.doppler.com/imgs/logo-long.svg" width="240" alt="Doppler">
|
||||
</div>
|
||||
<b>All your environment variables, in one place</b>
|
||||
<div>
|
||||
<span>Stop struggling with scattered API keys, hacking together home-brewed tools,</span>
|
||||
<br>
|
||||
<span>and avoiding access controls. Keep your team and servers in sync with Doppler.</span>
|
||||
</div>
|
||||
</a>
|
||||
<br>
|
||||
<a href="https://uibakery.io/?utm_source=chalk&utm_medium=sponsor&utm_campaign=github">
|
||||
<div>
|
||||
<img src="https://sindresorhus.com/assets/thanks/uibakery-logo.jpg" width="270" alt="UI Bakery">
|
||||
</div>
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
---
|
||||
|
||||
<br>
|
||||
|
||||
## Highlights
|
||||
|
||||
- Expressive API
|
||||
- Highly performant
|
||||
- Ability to nest styles
|
||||
- [256/Truecolor color support](#256-and-truecolor-color-support)
|
||||
- Auto-detects color support
|
||||
- Doesn't extend `String.prototype`
|
||||
- Clean and focused
|
||||
- Actively maintained
|
||||
- [Used by ~50,000 packages](https://www.npmjs.com/browse/depended/chalk) as of January 1, 2020
|
||||
|
||||
## Install
|
||||
|
||||
```console
|
||||
$ npm install chalk
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const chalk = require('chalk');
|
||||
|
||||
console.log(chalk.blue('Hello world!'));
|
||||
```
|
||||
|
||||
Chalk comes with an easy to use composable API where you just chain and nest the styles you want.
|
||||
|
||||
```js
|
||||
const chalk = require('chalk');
|
||||
const log = console.log;
|
||||
|
||||
// Combine styled and normal strings
|
||||
log(chalk.blue('Hello') + ' World' + chalk.red('!'));
|
||||
|
||||
// Compose multiple styles using the chainable API
|
||||
log(chalk.blue.bgRed.bold('Hello world!'));
|
||||
|
||||
// Pass in multiple arguments
|
||||
log(chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz'));
|
||||
|
||||
// Nest styles
|
||||
log(chalk.red('Hello', chalk.underline.bgBlue('world') + '!'));
|
||||
|
||||
// Nest styles of the same type even (color, underline, background)
|
||||
log(chalk.green(
|
||||
'I am a green line ' +
|
||||
chalk.blue.underline.bold('with a blue substring') +
|
||||
' that becomes green again!'
|
||||
));
|
||||
|
||||
// ES2015 template literal
|
||||
log(`
|
||||
CPU: ${chalk.red('90%')}
|
||||
RAM: ${chalk.green('40%')}
|
||||
DISK: ${chalk.yellow('70%')}
|
||||
`);
|
||||
|
||||
// ES2015 tagged template literal
|
||||
log(chalk`
|
||||
CPU: {red ${cpu.totalPercent}%}
|
||||
RAM: {green ${ram.used / ram.total * 100}%}
|
||||
DISK: {rgb(255,131,0) ${disk.used / disk.total * 100}%}
|
||||
`);
|
||||
|
||||
// Use RGB colors in terminal emulators that support it.
|
||||
log(chalk.keyword('orange')('Yay for orange colored text!'));
|
||||
log(chalk.rgb(123, 45, 67).underline('Underlined reddish color'));
|
||||
log(chalk.hex('#DEADED').bold('Bold gray!'));
|
||||
```
|
||||
|
||||
Easily define your own themes:
|
||||
|
||||
```js
|
||||
const chalk = require('chalk');
|
||||
|
||||
const error = chalk.bold.red;
|
||||
const warning = chalk.keyword('orange');
|
||||
|
||||
console.log(error('Error!'));
|
||||
console.log(warning('Warning!'));
|
||||
```
|
||||
|
||||
Take advantage of console.log [string substitution](https://nodejs.org/docs/latest/api/console.html#console_console_log_data_args):
|
||||
|
||||
```js
|
||||
const name = 'Sindre';
|
||||
console.log(chalk.green('Hello %s'), name);
|
||||
//=> 'Hello Sindre'
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### chalk.`<style>[.<style>...](string, [string...])`
|
||||
|
||||
Example: `chalk.red.bold.underline('Hello', 'world');`
|
||||
|
||||
Chain [styles](#styles) and call the last one as a method with a string argument. Order doesn't matter, and later styles take precedent in case of a conflict. This simply means that `chalk.red.yellow.green` is equivalent to `chalk.green`.
|
||||
|
||||
Multiple arguments will be separated by space.
|
||||
|
||||
### chalk.level
|
||||
|
||||
Specifies the level of color support.
|
||||
|
||||
Color support is automatically detected, but you can override it by setting the `level` property. You should however only do this in your own code as it applies globally to all Chalk consumers.
|
||||
|
||||
If you need to change this in a reusable module, create a new instance:
|
||||
|
||||
```js
|
||||
const ctx = new chalk.Instance({level: 0});
|
||||
```
|
||||
|
||||
| Level | Description |
|
||||
| :---: | :--- |
|
||||
| `0` | All colors disabled |
|
||||
| `1` | Basic color support (16 colors) |
|
||||
| `2` | 256 color support |
|
||||
| `3` | Truecolor support (16 million colors) |
|
||||
|
||||
### chalk.supportsColor
|
||||
|
||||
Detect whether the terminal [supports color](https://github.com/chalk/supports-color). Used internally and handled for you, but exposed for convenience.
|
||||
|
||||
Can be overridden by the user with the flags `--color` and `--no-color`. For situations where using `--color` is not possible, use the environment variable `FORCE_COLOR=1` (level 1), `FORCE_COLOR=2` (level 2), or `FORCE_COLOR=3` (level 3) to forcefully enable color, or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks.
|
||||
|
||||
Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively.
|
||||
|
||||
### chalk.stderr and chalk.stderr.supportsColor
|
||||
|
||||
`chalk.stderr` contains a separate instance configured with color support detected for `stderr` stream instead of `stdout`. Override rules from `chalk.supportsColor` apply to this too. `chalk.stderr.supportsColor` is exposed for convenience.
|
||||
|
||||
## Styles
|
||||
|
||||
### Modifiers
|
||||
|
||||
- `reset` - Resets the current color chain.
|
||||
- `bold` - Make text bold.
|
||||
- `dim` - Emitting only a small amount of light.
|
||||
- `italic` - Make text italic. *(Not widely supported)*
|
||||
- `underline` - Make text underline. *(Not widely supported)*
|
||||
- `inverse`- Inverse background and foreground colors.
|
||||
- `hidden` - Prints the text, but makes it invisible.
|
||||
- `strikethrough` - Puts a horizontal line through the center of the text. *(Not widely supported)*
|
||||
- `visible`- Prints the text only when Chalk has a color level > 0. Can be useful for things that are purely cosmetic.
|
||||
|
||||
### Colors
|
||||
|
||||
- `black`
|
||||
- `red`
|
||||
- `green`
|
||||
- `yellow`
|
||||
- `blue`
|
||||
- `magenta`
|
||||
- `cyan`
|
||||
- `white`
|
||||
- `blackBright` (alias: `gray`, `grey`)
|
||||
- `redBright`
|
||||
- `greenBright`
|
||||
- `yellowBright`
|
||||
- `blueBright`
|
||||
- `magentaBright`
|
||||
- `cyanBright`
|
||||
- `whiteBright`
|
||||
|
||||
### Background colors
|
||||
|
||||
- `bgBlack`
|
||||
- `bgRed`
|
||||
- `bgGreen`
|
||||
- `bgYellow`
|
||||
- `bgBlue`
|
||||
- `bgMagenta`
|
||||
- `bgCyan`
|
||||
- `bgWhite`
|
||||
- `bgBlackBright` (alias: `bgGray`, `bgGrey`)
|
||||
- `bgRedBright`
|
||||
- `bgGreenBright`
|
||||
- `bgYellowBright`
|
||||
- `bgBlueBright`
|
||||
- `bgMagentaBright`
|
||||
- `bgCyanBright`
|
||||
- `bgWhiteBright`
|
||||
|
||||
## Tagged template literal
|
||||
|
||||
Chalk can be used as a [tagged template literal](https://exploringjs.com/es6/ch_template-literals.html#_tagged-template-literals).
|
||||
|
||||
```js
|
||||
const chalk = require('chalk');
|
||||
|
||||
const miles = 18;
|
||||
const calculateFeet = miles => miles * 5280;
|
||||
|
||||
console.log(chalk`
|
||||
There are {bold 5280 feet} in a mile.
|
||||
In {bold ${miles} miles}, there are {green.bold ${calculateFeet(miles)} feet}.
|
||||
`);
|
||||
```
|
||||
|
||||
Blocks are delimited by an opening curly brace (`{`), a style, some content, and a closing curly brace (`}`).
|
||||
|
||||
Template styles are chained exactly like normal Chalk styles. The following three statements are equivalent:
|
||||
|
||||
```js
|
||||
console.log(chalk.bold.rgb(10, 100, 200)('Hello!'));
|
||||
console.log(chalk.bold.rgb(10, 100, 200)`Hello!`);
|
||||
console.log(chalk`{bold.rgb(10,100,200) Hello!}`);
|
||||
```
|
||||
|
||||
Note that function styles (`rgb()`, `hsl()`, `keyword()`, etc.) may not contain spaces between parameters.
|
||||
|
||||
All interpolated values (`` chalk`${foo}` ``) are converted to strings via the `.toString()` method. All curly braces (`{` and `}`) in interpolated value strings are escaped.
|
||||
|
||||
## 256 and Truecolor color support
|
||||
|
||||
Chalk supports 256 colors and [Truecolor](https://gist.github.com/XVilka/8346728) (16 million colors) on supported terminal apps.
|
||||
|
||||
Colors are downsampled from 16 million RGB values to an ANSI color format that is supported by the terminal emulator (or by specifying `{level: n}` as a Chalk option). For example, Chalk configured to run at level 1 (basic color support) will downsample an RGB value of #FF0000 (red) to 31 (ANSI escape for red).
|
||||
|
||||
Examples:
|
||||
|
||||
- `chalk.hex('#DEADED').underline('Hello, world!')`
|
||||
- `chalk.keyword('orange')('Some orange text')`
|
||||
- `chalk.rgb(15, 100, 204).inverse('Hello!')`
|
||||
|
||||
Background versions of these models are prefixed with `bg` and the first level of the module capitalized (e.g. `keyword` for foreground colors and `bgKeyword` for background colors).
|
||||
|
||||
- `chalk.bgHex('#DEADED').underline('Hello, world!')`
|
||||
- `chalk.bgKeyword('orange')('Some orange text')`
|
||||
- `chalk.bgRgb(15, 100, 204).inverse('Hello!')`
|
||||
|
||||
The following color models can be used:
|
||||
|
||||
- [`rgb`](https://en.wikipedia.org/wiki/RGB_color_model) - Example: `chalk.rgb(255, 136, 0).bold('Orange!')`
|
||||
- [`hex`](https://en.wikipedia.org/wiki/Web_colors#Hex_triplet) - Example: `chalk.hex('#FF8800').bold('Orange!')`
|
||||
- [`keyword`](https://www.w3.org/wiki/CSS/Properties/color/keywords) (CSS keywords) - Example: `chalk.keyword('orange').bold('Orange!')`
|
||||
- [`hsl`](https://en.wikipedia.org/wiki/HSL_and_HSV) - Example: `chalk.hsl(32, 100, 50).bold('Orange!')`
|
||||
- [`hsv`](https://en.wikipedia.org/wiki/HSL_and_HSV) - Example: `chalk.hsv(32, 100, 100).bold('Orange!')`
|
||||
- [`hwb`](https://en.wikipedia.org/wiki/HWB_color_model) - Example: `chalk.hwb(32, 0, 50).bold('Orange!')`
|
||||
- [`ansi`](https://en.wikipedia.org/wiki/ANSI_escape_code#3/4_bit) - Example: `chalk.ansi(31).bgAnsi(93)('red on yellowBright')`
|
||||
- [`ansi256`](https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit) - Example: `chalk.bgAnsi256(194)('Honeydew, more or less')`
|
||||
|
||||
## Windows
|
||||
|
||||
If you're on Windows, do yourself a favor and use [Windows Terminal](https://github.com/microsoft/terminal) instead of `cmd.exe`.
|
||||
|
||||
## Origin story
|
||||
|
||||
[colors.js](https://github.com/Marak/colors.js) used to be the most popular string styling module, but it has serious deficiencies like extending `String.prototype` which causes all kinds of [problems](https://github.com/yeoman/yo/issues/68) and the package is unmaintained. Although there are other packages, they either do too much or not enough. Chalk is a clean and focused alternative.
|
||||
|
||||
## chalk for enterprise
|
||||
|
||||
Available as part of the Tidelift Subscription.
|
||||
|
||||
The maintainers of chalk and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-chalk?utm_source=npm-chalk&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
|
||||
|
||||
## Related
|
||||
|
||||
- [chalk-cli](https://github.com/chalk/chalk-cli) - CLI for this module
|
||||
- [ansi-styles](https://github.com/chalk/ansi-styles) - ANSI escape codes for styling strings in the terminal
|
||||
- [supports-color](https://github.com/chalk/supports-color) - Detect whether a terminal supports color
|
||||
- [strip-ansi](https://github.com/chalk/strip-ansi) - Strip ANSI escape codes
|
||||
- [strip-ansi-stream](https://github.com/chalk/strip-ansi-stream) - Strip ANSI escape codes from a stream
|
||||
- [has-ansi](https://github.com/chalk/has-ansi) - Check if a string has ANSI escape codes
|
||||
- [ansi-regex](https://github.com/chalk/ansi-regex) - Regular expression for matching ANSI escape codes
|
||||
- [wrap-ansi](https://github.com/chalk/wrap-ansi) - Wordwrap a string with ANSI escape codes
|
||||
- [slice-ansi](https://github.com/chalk/slice-ansi) - Slice a string with ANSI escape codes
|
||||
- [color-convert](https://github.com/qix-/color-convert) - Converts colors between different models
|
||||
- [chalk-animation](https://github.com/bokub/chalk-animation) - Animate strings in the terminal
|
||||
- [gradient-string](https://github.com/bokub/gradient-string) - Apply color gradients to strings
|
||||
- [chalk-pipe](https://github.com/LitoMore/chalk-pipe) - Create chalk style schemes with simpler style strings
|
||||
- [terminal-link](https://github.com/sindresorhus/terminal-link) - Create clickable links in the terminal
|
||||
|
||||
## Maintainers
|
||||
|
||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||
- [Josh Junon](https://github.com/qix-)
|
||||
@@ -0,0 +1,6 @@
|
||||
/**
|
||||
* @deprecated The CJS build of Vite's Node API is deprecated. See https://vite.dev/guide/troubleshooting.html#vite-cjs-node-api-deprecated for more details.
|
||||
*/
|
||||
declare const module: any
|
||||
|
||||
export = module
|
||||
@@ -0,0 +1,5 @@
|
||||
type CanvasProps = {
|
||||
canvasRef?: React.Ref<HTMLCanvasElement>;
|
||||
};
|
||||
export default function Canvas(props: CanvasProps): React.ReactElement;
|
||||
export {};
|
||||
@@ -0,0 +1,546 @@
|
||||
/**
|
||||
* @license React
|
||||
* react.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_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
|
||||
REACT_PORTAL_TYPE = Symbol.for("react.portal"),
|
||||
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
|
||||
REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
|
||||
REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
|
||||
REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
|
||||
REACT_CONTEXT_TYPE = Symbol.for("react.context"),
|
||||
REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
|
||||
REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
|
||||
REACT_MEMO_TYPE = Symbol.for("react.memo"),
|
||||
REACT_LAZY_TYPE = Symbol.for("react.lazy"),
|
||||
MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
|
||||
function getIteratorFn(maybeIterable) {
|
||||
if (null === maybeIterable || "object" !== typeof maybeIterable) return null;
|
||||
maybeIterable =
|
||||
(MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) ||
|
||||
maybeIterable["@@iterator"];
|
||||
return "function" === typeof maybeIterable ? maybeIterable : null;
|
||||
}
|
||||
var ReactNoopUpdateQueue = {
|
||||
isMounted: function () {
|
||||
return !1;
|
||||
},
|
||||
enqueueForceUpdate: function () {},
|
||||
enqueueReplaceState: function () {},
|
||||
enqueueSetState: function () {}
|
||||
},
|
||||
assign = Object.assign,
|
||||
emptyObject = {};
|
||||
function Component(props, context, updater) {
|
||||
this.props = props;
|
||||
this.context = context;
|
||||
this.refs = emptyObject;
|
||||
this.updater = updater || ReactNoopUpdateQueue;
|
||||
}
|
||||
Component.prototype.isReactComponent = {};
|
||||
Component.prototype.setState = function (partialState, callback) {
|
||||
if (
|
||||
"object" !== typeof partialState &&
|
||||
"function" !== typeof partialState &&
|
||||
null != partialState
|
||||
)
|
||||
throw Error(
|
||||
"takes an object of state variables to update or a function which returns an object of state variables."
|
||||
);
|
||||
this.updater.enqueueSetState(this, partialState, callback, "setState");
|
||||
};
|
||||
Component.prototype.forceUpdate = function (callback) {
|
||||
this.updater.enqueueForceUpdate(this, callback, "forceUpdate");
|
||||
};
|
||||
function ComponentDummy() {}
|
||||
ComponentDummy.prototype = Component.prototype;
|
||||
function PureComponent(props, context, updater) {
|
||||
this.props = props;
|
||||
this.context = context;
|
||||
this.refs = emptyObject;
|
||||
this.updater = updater || ReactNoopUpdateQueue;
|
||||
}
|
||||
var pureComponentPrototype = (PureComponent.prototype = new ComponentDummy());
|
||||
pureComponentPrototype.constructor = PureComponent;
|
||||
assign(pureComponentPrototype, Component.prototype);
|
||||
pureComponentPrototype.isPureReactComponent = !0;
|
||||
var isArrayImpl = Array.isArray,
|
||||
ReactSharedInternals = { H: null, A: null, T: null, S: null, V: null },
|
||||
hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
function ReactElement(type, key, self, source, owner, props) {
|
||||
self = props.ref;
|
||||
return {
|
||||
$$typeof: REACT_ELEMENT_TYPE,
|
||||
type: type,
|
||||
key: key,
|
||||
ref: void 0 !== self ? self : null,
|
||||
props: props
|
||||
};
|
||||
}
|
||||
function cloneAndReplaceKey(oldElement, newKey) {
|
||||
return ReactElement(
|
||||
oldElement.type,
|
||||
newKey,
|
||||
void 0,
|
||||
void 0,
|
||||
void 0,
|
||||
oldElement.props
|
||||
);
|
||||
}
|
||||
function isValidElement(object) {
|
||||
return (
|
||||
"object" === typeof object &&
|
||||
null !== object &&
|
||||
object.$$typeof === REACT_ELEMENT_TYPE
|
||||
);
|
||||
}
|
||||
function escape(key) {
|
||||
var escaperLookup = { "=": "=0", ":": "=2" };
|
||||
return (
|
||||
"$" +
|
||||
key.replace(/[=:]/g, function (match) {
|
||||
return escaperLookup[match];
|
||||
})
|
||||
);
|
||||
}
|
||||
var userProvidedKeyEscapeRegex = /\/+/g;
|
||||
function getElementKey(element, index) {
|
||||
return "object" === typeof element && null !== element && null != element.key
|
||||
? escape("" + element.key)
|
||||
: index.toString(36);
|
||||
}
|
||||
function noop$1() {}
|
||||
function resolveThenable(thenable) {
|
||||
switch (thenable.status) {
|
||||
case "fulfilled":
|
||||
return thenable.value;
|
||||
case "rejected":
|
||||
throw thenable.reason;
|
||||
default:
|
||||
switch (
|
||||
("string" === typeof thenable.status
|
||||
? thenable.then(noop$1, noop$1)
|
||||
: ((thenable.status = "pending"),
|
||||
thenable.then(
|
||||
function (fulfilledValue) {
|
||||
"pending" === thenable.status &&
|
||||
((thenable.status = "fulfilled"),
|
||||
(thenable.value = fulfilledValue));
|
||||
},
|
||||
function (error) {
|
||||
"pending" === thenable.status &&
|
||||
((thenable.status = "rejected"), (thenable.reason = error));
|
||||
}
|
||||
)),
|
||||
thenable.status)
|
||||
) {
|
||||
case "fulfilled":
|
||||
return thenable.value;
|
||||
case "rejected":
|
||||
throw thenable.reason;
|
||||
}
|
||||
}
|
||||
throw thenable;
|
||||
}
|
||||
function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
|
||||
var type = typeof children;
|
||||
if ("undefined" === type || "boolean" === type) children = null;
|
||||
var invokeCallback = !1;
|
||||
if (null === children) invokeCallback = !0;
|
||||
else
|
||||
switch (type) {
|
||||
case "bigint":
|
||||
case "string":
|
||||
case "number":
|
||||
invokeCallback = !0;
|
||||
break;
|
||||
case "object":
|
||||
switch (children.$$typeof) {
|
||||
case REACT_ELEMENT_TYPE:
|
||||
case REACT_PORTAL_TYPE:
|
||||
invokeCallback = !0;
|
||||
break;
|
||||
case REACT_LAZY_TYPE:
|
||||
return (
|
||||
(invokeCallback = children._init),
|
||||
mapIntoArray(
|
||||
invokeCallback(children._payload),
|
||||
array,
|
||||
escapedPrefix,
|
||||
nameSoFar,
|
||||
callback
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
if (invokeCallback)
|
||||
return (
|
||||
(callback = callback(children)),
|
||||
(invokeCallback =
|
||||
"" === nameSoFar ? "." + getElementKey(children, 0) : nameSoFar),
|
||||
isArrayImpl(callback)
|
||||
? ((escapedPrefix = ""),
|
||||
null != invokeCallback &&
|
||||
(escapedPrefix =
|
||||
invokeCallback.replace(userProvidedKeyEscapeRegex, "$&/") + "/"),
|
||||
mapIntoArray(callback, array, escapedPrefix, "", function (c) {
|
||||
return c;
|
||||
}))
|
||||
: null != callback &&
|
||||
(isValidElement(callback) &&
|
||||
(callback = cloneAndReplaceKey(
|
||||
callback,
|
||||
escapedPrefix +
|
||||
(null == callback.key ||
|
||||
(children && children.key === callback.key)
|
||||
? ""
|
||||
: ("" + callback.key).replace(
|
||||
userProvidedKeyEscapeRegex,
|
||||
"$&/"
|
||||
) + "/") +
|
||||
invokeCallback
|
||||
)),
|
||||
array.push(callback)),
|
||||
1
|
||||
);
|
||||
invokeCallback = 0;
|
||||
var nextNamePrefix = "" === nameSoFar ? "." : nameSoFar + ":";
|
||||
if (isArrayImpl(children))
|
||||
for (var i = 0; i < children.length; i++)
|
||||
(nameSoFar = children[i]),
|
||||
(type = nextNamePrefix + getElementKey(nameSoFar, i)),
|
||||
(invokeCallback += mapIntoArray(
|
||||
nameSoFar,
|
||||
array,
|
||||
escapedPrefix,
|
||||
type,
|
||||
callback
|
||||
));
|
||||
else if (((i = getIteratorFn(children)), "function" === typeof i))
|
||||
for (
|
||||
children = i.call(children), i = 0;
|
||||
!(nameSoFar = children.next()).done;
|
||||
|
||||
)
|
||||
(nameSoFar = nameSoFar.value),
|
||||
(type = nextNamePrefix + getElementKey(nameSoFar, i++)),
|
||||
(invokeCallback += mapIntoArray(
|
||||
nameSoFar,
|
||||
array,
|
||||
escapedPrefix,
|
||||
type,
|
||||
callback
|
||||
));
|
||||
else if ("object" === type) {
|
||||
if ("function" === typeof children.then)
|
||||
return mapIntoArray(
|
||||
resolveThenable(children),
|
||||
array,
|
||||
escapedPrefix,
|
||||
nameSoFar,
|
||||
callback
|
||||
);
|
||||
array = String(children);
|
||||
throw Error(
|
||||
"Objects are not valid as a React child (found: " +
|
||||
("[object Object]" === array
|
||||
? "object with keys {" + Object.keys(children).join(", ") + "}"
|
||||
: array) +
|
||||
"). If you meant to render a collection of children, use an array instead."
|
||||
);
|
||||
}
|
||||
return invokeCallback;
|
||||
}
|
||||
function mapChildren(children, func, context) {
|
||||
if (null == children) return children;
|
||||
var result = [],
|
||||
count = 0;
|
||||
mapIntoArray(children, result, "", "", function (child) {
|
||||
return func.call(context, child, count++);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
function lazyInitializer(payload) {
|
||||
if (-1 === payload._status) {
|
||||
var ctor = payload._result;
|
||||
ctor = ctor();
|
||||
ctor.then(
|
||||
function (moduleObject) {
|
||||
if (0 === payload._status || -1 === payload._status)
|
||||
(payload._status = 1), (payload._result = moduleObject);
|
||||
},
|
||||
function (error) {
|
||||
if (0 === payload._status || -1 === payload._status)
|
||||
(payload._status = 2), (payload._result = error);
|
||||
}
|
||||
);
|
||||
-1 === payload._status && ((payload._status = 0), (payload._result = ctor));
|
||||
}
|
||||
if (1 === payload._status) return payload._result.default;
|
||||
throw payload._result;
|
||||
}
|
||||
var reportGlobalError =
|
||||
"function" === typeof reportError
|
||||
? reportError
|
||||
: function (error) {
|
||||
if (
|
||||
"object" === typeof window &&
|
||||
"function" === typeof window.ErrorEvent
|
||||
) {
|
||||
var event = new window.ErrorEvent("error", {
|
||||
bubbles: !0,
|
||||
cancelable: !0,
|
||||
message:
|
||||
"object" === typeof error &&
|
||||
null !== error &&
|
||||
"string" === typeof error.message
|
||||
? String(error.message)
|
||||
: String(error),
|
||||
error: error
|
||||
});
|
||||
if (!window.dispatchEvent(event)) return;
|
||||
} else if (
|
||||
"object" === typeof process &&
|
||||
"function" === typeof process.emit
|
||||
) {
|
||||
process.emit("uncaughtException", error);
|
||||
return;
|
||||
}
|
||||
console.error(error);
|
||||
};
|
||||
function noop() {}
|
||||
exports.Children = {
|
||||
map: mapChildren,
|
||||
forEach: function (children, forEachFunc, forEachContext) {
|
||||
mapChildren(
|
||||
children,
|
||||
function () {
|
||||
forEachFunc.apply(this, arguments);
|
||||
},
|
||||
forEachContext
|
||||
);
|
||||
},
|
||||
count: function (children) {
|
||||
var n = 0;
|
||||
mapChildren(children, function () {
|
||||
n++;
|
||||
});
|
||||
return n;
|
||||
},
|
||||
toArray: function (children) {
|
||||
return (
|
||||
mapChildren(children, function (child) {
|
||||
return child;
|
||||
}) || []
|
||||
);
|
||||
},
|
||||
only: function (children) {
|
||||
if (!isValidElement(children))
|
||||
throw Error(
|
||||
"React.Children.only expected to receive a single React element child."
|
||||
);
|
||||
return children;
|
||||
}
|
||||
};
|
||||
exports.Component = Component;
|
||||
exports.Fragment = REACT_FRAGMENT_TYPE;
|
||||
exports.Profiler = REACT_PROFILER_TYPE;
|
||||
exports.PureComponent = PureComponent;
|
||||
exports.StrictMode = REACT_STRICT_MODE_TYPE;
|
||||
exports.Suspense = REACT_SUSPENSE_TYPE;
|
||||
exports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE =
|
||||
ReactSharedInternals;
|
||||
exports.__COMPILER_RUNTIME = {
|
||||
__proto__: null,
|
||||
c: function (size) {
|
||||
return ReactSharedInternals.H.useMemoCache(size);
|
||||
}
|
||||
};
|
||||
exports.cache = function (fn) {
|
||||
return function () {
|
||||
return fn.apply(null, arguments);
|
||||
};
|
||||
};
|
||||
exports.cloneElement = function (element, config, children) {
|
||||
if (null === element || void 0 === element)
|
||||
throw Error(
|
||||
"The argument must be a React element, but you passed " + element + "."
|
||||
);
|
||||
var props = assign({}, element.props),
|
||||
key = element.key,
|
||||
owner = void 0;
|
||||
if (null != config)
|
||||
for (propName in (void 0 !== config.ref && (owner = void 0),
|
||||
void 0 !== config.key && (key = "" + config.key),
|
||||
config))
|
||||
!hasOwnProperty.call(config, propName) ||
|
||||
"key" === propName ||
|
||||
"__self" === propName ||
|
||||
"__source" === propName ||
|
||||
("ref" === propName && void 0 === config.ref) ||
|
||||
(props[propName] = config[propName]);
|
||||
var propName = arguments.length - 2;
|
||||
if (1 === propName) props.children = children;
|
||||
else if (1 < propName) {
|
||||
for (var childArray = Array(propName), i = 0; i < propName; i++)
|
||||
childArray[i] = arguments[i + 2];
|
||||
props.children = childArray;
|
||||
}
|
||||
return ReactElement(element.type, key, void 0, void 0, owner, props);
|
||||
};
|
||||
exports.createContext = function (defaultValue) {
|
||||
defaultValue = {
|
||||
$$typeof: REACT_CONTEXT_TYPE,
|
||||
_currentValue: defaultValue,
|
||||
_currentValue2: defaultValue,
|
||||
_threadCount: 0,
|
||||
Provider: null,
|
||||
Consumer: null
|
||||
};
|
||||
defaultValue.Provider = defaultValue;
|
||||
defaultValue.Consumer = {
|
||||
$$typeof: REACT_CONSUMER_TYPE,
|
||||
_context: defaultValue
|
||||
};
|
||||
return defaultValue;
|
||||
};
|
||||
exports.createElement = function (type, config, children) {
|
||||
var propName,
|
||||
props = {},
|
||||
key = null;
|
||||
if (null != config)
|
||||
for (propName in (void 0 !== config.key && (key = "" + config.key), config))
|
||||
hasOwnProperty.call(config, propName) &&
|
||||
"key" !== propName &&
|
||||
"__self" !== propName &&
|
||||
"__source" !== propName &&
|
||||
(props[propName] = config[propName]);
|
||||
var childrenLength = arguments.length - 2;
|
||||
if (1 === childrenLength) props.children = children;
|
||||
else if (1 < childrenLength) {
|
||||
for (var childArray = Array(childrenLength), i = 0; i < childrenLength; i++)
|
||||
childArray[i] = arguments[i + 2];
|
||||
props.children = childArray;
|
||||
}
|
||||
if (type && type.defaultProps)
|
||||
for (propName in ((childrenLength = type.defaultProps), childrenLength))
|
||||
void 0 === props[propName] &&
|
||||
(props[propName] = childrenLength[propName]);
|
||||
return ReactElement(type, key, void 0, void 0, null, props);
|
||||
};
|
||||
exports.createRef = function () {
|
||||
return { current: null };
|
||||
};
|
||||
exports.forwardRef = function (render) {
|
||||
return { $$typeof: REACT_FORWARD_REF_TYPE, render: render };
|
||||
};
|
||||
exports.isValidElement = isValidElement;
|
||||
exports.lazy = function (ctor) {
|
||||
return {
|
||||
$$typeof: REACT_LAZY_TYPE,
|
||||
_payload: { _status: -1, _result: ctor },
|
||||
_init: lazyInitializer
|
||||
};
|
||||
};
|
||||
exports.memo = function (type, compare) {
|
||||
return {
|
||||
$$typeof: REACT_MEMO_TYPE,
|
||||
type: type,
|
||||
compare: void 0 === compare ? null : compare
|
||||
};
|
||||
};
|
||||
exports.startTransition = function (scope) {
|
||||
var prevTransition = ReactSharedInternals.T,
|
||||
currentTransition = {};
|
||||
ReactSharedInternals.T = currentTransition;
|
||||
try {
|
||||
var returnValue = scope(),
|
||||
onStartTransitionFinish = ReactSharedInternals.S;
|
||||
null !== onStartTransitionFinish &&
|
||||
onStartTransitionFinish(currentTransition, returnValue);
|
||||
"object" === typeof returnValue &&
|
||||
null !== returnValue &&
|
||||
"function" === typeof returnValue.then &&
|
||||
returnValue.then(noop, reportGlobalError);
|
||||
} catch (error) {
|
||||
reportGlobalError(error);
|
||||
} finally {
|
||||
ReactSharedInternals.T = prevTransition;
|
||||
}
|
||||
};
|
||||
exports.unstable_useCacheRefresh = function () {
|
||||
return ReactSharedInternals.H.useCacheRefresh();
|
||||
};
|
||||
exports.use = function (usable) {
|
||||
return ReactSharedInternals.H.use(usable);
|
||||
};
|
||||
exports.useActionState = function (action, initialState, permalink) {
|
||||
return ReactSharedInternals.H.useActionState(action, initialState, permalink);
|
||||
};
|
||||
exports.useCallback = function (callback, deps) {
|
||||
return ReactSharedInternals.H.useCallback(callback, deps);
|
||||
};
|
||||
exports.useContext = function (Context) {
|
||||
return ReactSharedInternals.H.useContext(Context);
|
||||
};
|
||||
exports.useDebugValue = function () {};
|
||||
exports.useDeferredValue = function (value, initialValue) {
|
||||
return ReactSharedInternals.H.useDeferredValue(value, initialValue);
|
||||
};
|
||||
exports.useEffect = function (create, createDeps, update) {
|
||||
var dispatcher = ReactSharedInternals.H;
|
||||
if ("function" === typeof update)
|
||||
throw Error(
|
||||
"useEffect CRUD overload is not enabled in this build of React."
|
||||
);
|
||||
return dispatcher.useEffect(create, createDeps);
|
||||
};
|
||||
exports.useId = function () {
|
||||
return ReactSharedInternals.H.useId();
|
||||
};
|
||||
exports.useImperativeHandle = function (ref, create, deps) {
|
||||
return ReactSharedInternals.H.useImperativeHandle(ref, create, deps);
|
||||
};
|
||||
exports.useInsertionEffect = function (create, deps) {
|
||||
return ReactSharedInternals.H.useInsertionEffect(create, deps);
|
||||
};
|
||||
exports.useLayoutEffect = function (create, deps) {
|
||||
return ReactSharedInternals.H.useLayoutEffect(create, deps);
|
||||
};
|
||||
exports.useMemo = function (create, deps) {
|
||||
return ReactSharedInternals.H.useMemo(create, deps);
|
||||
};
|
||||
exports.useOptimistic = function (passthrough, reducer) {
|
||||
return ReactSharedInternals.H.useOptimistic(passthrough, reducer);
|
||||
};
|
||||
exports.useReducer = function (reducer, initialArg, init) {
|
||||
return ReactSharedInternals.H.useReducer(reducer, initialArg, init);
|
||||
};
|
||||
exports.useRef = function (initialValue) {
|
||||
return ReactSharedInternals.H.useRef(initialValue);
|
||||
};
|
||||
exports.useState = function (initialState) {
|
||||
return ReactSharedInternals.H.useState(initialState);
|
||||
};
|
||||
exports.useSyncExternalStore = function (
|
||||
subscribe,
|
||||
getSnapshot,
|
||||
getServerSnapshot
|
||||
) {
|
||||
return ReactSharedInternals.H.useSyncExternalStore(
|
||||
subscribe,
|
||||
getSnapshot,
|
||||
getServerSnapshot
|
||||
);
|
||||
};
|
||||
exports.useTransition = function () {
|
||||
return ReactSharedInternals.H.useTransition();
|
||||
};
|
||||
exports.version = "19.1.0";
|
||||
@@ -0,0 +1,8 @@
|
||||
import { AnyRouter, RegisteredRouter, RouterState } from '@tanstack/router-core';
|
||||
import { StructuralSharingOption, ValidateSelected } from './structuralSharing.js';
|
||||
export type UseRouterStateOptions<TRouter extends AnyRouter, TSelected, TStructuralSharing> = {
|
||||
router?: TRouter;
|
||||
select?: (state: RouterState<TRouter['routeTree']>) => ValidateSelected<TRouter, TSelected, TStructuralSharing>;
|
||||
} & StructuralSharingOption<TRouter, TSelected, TStructuralSharing>;
|
||||
export type UseRouterStateResult<TRouter extends AnyRouter, TSelected> = unknown extends TSelected ? RouterState<TRouter['routeTree']> : TSelected;
|
||||
export declare function useRouterState<TRouter extends AnyRouter = RegisteredRouter, TSelected = unknown, TStructuralSharing extends boolean = boolean>(opts?: UseRouterStateOptions<TRouter, TSelected, TStructuralSharing>): UseRouterStateResult<TRouter, TSelected>;
|
||||
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
* @fileoverview Default configuration
|
||||
* @author Nicholas C. Zakas
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
const Rules = require("../rules");
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
const sharedDefaultConfig = [
|
||||
// intentionally empty config to ensure these files are globbed by default
|
||||
{
|
||||
files: ["**/*.js", "**/*.mjs"],
|
||||
},
|
||||
{
|
||||
files: ["**/*.cjs"],
|
||||
languageOptions: {
|
||||
sourceType: "commonjs",
|
||||
ecmaVersion: "latest",
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
exports.defaultConfig = Object.freeze([
|
||||
{
|
||||
plugins: {
|
||||
"@": {
|
||||
languages: {
|
||||
js: require("../languages/js"),
|
||||
},
|
||||
|
||||
/*
|
||||
* Because we try to delay loading rules until absolutely
|
||||
* necessary, a proxy allows us to hook into the lazy-loading
|
||||
* aspect of the rules map while still keeping all of the
|
||||
* relevant configuration inside of the config array.
|
||||
*/
|
||||
rules: new Proxy(
|
||||
{},
|
||||
{
|
||||
get(target, property) {
|
||||
return Rules.get(property);
|
||||
},
|
||||
|
||||
has(target, property) {
|
||||
return Rules.has(property);
|
||||
},
|
||||
},
|
||||
),
|
||||
},
|
||||
},
|
||||
language: "@/js",
|
||||
linterOptions: {
|
||||
reportUnusedDisableDirectives: 1,
|
||||
},
|
||||
},
|
||||
|
||||
// default ignores are listed here
|
||||
{
|
||||
ignores: ["**/node_modules/", ".git/"],
|
||||
},
|
||||
|
||||
...sharedDefaultConfig,
|
||||
]);
|
||||
|
||||
exports.defaultRuleTesterConfig = Object.freeze([
|
||||
{ files: ["**"] }, // Make sure the default config matches for all files
|
||||
|
||||
...sharedDefaultConfig,
|
||||
]);
|
||||
@@ -0,0 +1,121 @@
|
||||
/**
|
||||
* @fileoverview disallow unnecessary concatenation of template strings
|
||||
* @author Henry Zhu
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const astUtils = require("./utils/ast-utils");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Checks whether or not a given node is a concatenation.
|
||||
* @param {ASTNode} node A node to check.
|
||||
* @returns {boolean} `true` if the node is a concatenation.
|
||||
*/
|
||||
function isConcatenation(node) {
|
||||
return node.type === "BinaryExpression" && node.operator === "+";
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given token is a `+` token or not.
|
||||
* @param {Token} token The token to check.
|
||||
* @returns {boolean} `true` if the token is a `+` token.
|
||||
*/
|
||||
function isConcatOperatorToken(token) {
|
||||
return token.value === "+" && token.type === "Punctuator";
|
||||
}
|
||||
|
||||
/**
|
||||
* Get's the right most node on the left side of a BinaryExpression with + operator.
|
||||
* @param {ASTNode} node A BinaryExpression node to check.
|
||||
* @returns {ASTNode} node
|
||||
*/
|
||||
function getLeft(node) {
|
||||
let left = node.left;
|
||||
|
||||
while (isConcatenation(left)) {
|
||||
left = left.right;
|
||||
}
|
||||
return left;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get's the left most node on the right side of a BinaryExpression with + operator.
|
||||
* @param {ASTNode} node A BinaryExpression node to check.
|
||||
* @returns {ASTNode} node
|
||||
*/
|
||||
function getRight(node) {
|
||||
let right = node.right;
|
||||
|
||||
while (isConcatenation(right)) {
|
||||
right = right.left;
|
||||
}
|
||||
return right;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "suggestion",
|
||||
|
||||
docs: {
|
||||
description:
|
||||
"Disallow unnecessary concatenation of literals or template literals",
|
||||
recommended: false,
|
||||
frozen: true,
|
||||
url: "https://eslint.org/docs/latest/rules/no-useless-concat",
|
||||
},
|
||||
|
||||
schema: [],
|
||||
|
||||
messages: {
|
||||
unexpectedConcat: "Unexpected string concatenation of literals.",
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const sourceCode = context.sourceCode;
|
||||
|
||||
return {
|
||||
BinaryExpression(node) {
|
||||
// check if not concatenation
|
||||
if (node.operator !== "+") {
|
||||
return;
|
||||
}
|
||||
|
||||
// account for the `foo + "a" + "b"` case
|
||||
const left = getLeft(node);
|
||||
const right = getRight(node);
|
||||
|
||||
if (
|
||||
astUtils.isStringLiteral(left) &&
|
||||
astUtils.isStringLiteral(right) &&
|
||||
astUtils.isTokenOnSameLine(left, right)
|
||||
) {
|
||||
const operatorToken = sourceCode.getFirstTokenBetween(
|
||||
left,
|
||||
right,
|
||||
isConcatOperatorToken,
|
||||
);
|
||||
|
||||
context.report({
|
||||
node,
|
||||
loc: operatorToken.loc,
|
||||
messageId: "unexpectedConcat",
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,96 @@
|
||||
/**
|
||||
* Program uses a modified version of the `qss` package:
|
||||
* Copyright (c) Luke Edwards luke.edwards05@gmail.com, MIT License
|
||||
* https://github.com/lukeed/qss/blob/master/license.md
|
||||
*/
|
||||
|
||||
import { hasUriEncodedChars } from './utils'
|
||||
|
||||
/**
|
||||
* Encodes an object into a query string.
|
||||
* @param obj - The object to encode into a query string.
|
||||
* @param [pfx] - An optional prefix to add before the query string.
|
||||
* @returns The encoded query string.
|
||||
* @example
|
||||
* ```
|
||||
* // Example input: encode({ token: 'foo', key: 'value' })
|
||||
* // Expected output: "token=foo&key=value"
|
||||
* ```
|
||||
*/
|
||||
export function encode(obj: any, pfx?: string) {
|
||||
let k,
|
||||
i,
|
||||
tmp,
|
||||
str = ''
|
||||
|
||||
for (k in obj) {
|
||||
if ((tmp = obj[k]) !== void 0) {
|
||||
if (Array.isArray(tmp)) {
|
||||
for (i = 0; i < tmp.length; i++) {
|
||||
str && (str += '&')
|
||||
str += encodeURIComponent(k) + '=' + encodeURIComponent(tmp[i])
|
||||
}
|
||||
} else {
|
||||
str && (str += '&')
|
||||
str += encodeURIComponent(k) + '=' + encodeURIComponent(tmp)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (pfx || '') + str
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a string value to its appropriate type (string, number, boolean).
|
||||
* @param mix - The string value to convert.
|
||||
* @returns The converted value.
|
||||
* @example
|
||||
* // Example input: toValue("123")
|
||||
* // Expected output: 123
|
||||
*/
|
||||
function toValue(mix: any) {
|
||||
if (!mix) return ''
|
||||
const str = hasUriEncodedChars(mix)
|
||||
? decodeURIComponent(mix)
|
||||
: decodeURIComponent(encodeURIComponent(mix))
|
||||
|
||||
if (str === 'false') return false
|
||||
if (str === 'true') return true
|
||||
return +str * 0 === 0 && +str + '' === str ? +str : str
|
||||
}
|
||||
|
||||
/**
|
||||
* Decodes a query string into an object.
|
||||
* @param str - The query string to decode.
|
||||
* @param [pfx] - An optional prefix to filter out from the query string.
|
||||
* @returns The decoded key-value pairs in an object format.
|
||||
* @example
|
||||
* // Example input: decode("token=foo&key=value")
|
||||
* // Expected output: { "token": "foo", "key": "value" }
|
||||
*/
|
||||
export function decode(str: any, pfx?: string) {
|
||||
let tmp, k
|
||||
const out: any = {},
|
||||
arr = (pfx ? str.substr(pfx.length) : str).split('&')
|
||||
|
||||
while ((tmp = arr.shift())) {
|
||||
const equalIndex = tmp.indexOf('=')
|
||||
if (equalIndex !== -1) {
|
||||
k = tmp.slice(0, equalIndex)
|
||||
k = decodeURIComponent(k)
|
||||
const value = tmp.slice(equalIndex + 1)
|
||||
if (out[k] !== void 0) {
|
||||
// @ts-expect-error
|
||||
out[k] = [].concat(out[k], toValue(value))
|
||||
} else {
|
||||
out[k] = toValue(value)
|
||||
}
|
||||
} else {
|
||||
k = tmp
|
||||
k = decodeURIComponent(k)
|
||||
out[k] = ''
|
||||
}
|
||||
}
|
||||
|
||||
return out
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"K D E F A mC","132":"B"},B:{"1":"0 9 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","132":"C L M G N O P","513":"Q H R S T"},C:{"1":"W X Y Z a","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 qC rC","513":"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","2049":"0 9 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"},D:{"1":"0 9 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":"1 J PB K D E F A B C L M G N O P QB","260":"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 sB tB uB vB MC wB","513":"NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R S T"},E:{"2":"J PB K D sC SC tC uC","132":"E F A B vC wC TC","513":"C FC GC","1025":"G 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","1537":"L M xC yC"},F:{"1":"0 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","2":"F B C 4C 5C 6C 7C FC kC 8C GC","513":"1 2 3 4 5 6 7 8 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"},G:{"2":"SC 9C lC AD BD CD","132":"E DD ED FD GD HD ID JD","513":"KD LD MD ND","1025":"SD UC VC HC TD IC WC XC YC ZC aC UD JC bC cC dC eC fC VD KC gC hC iC jC","1537":"OD PD QD RD"},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:{"2049":"EC"},N:{"2":"A B"},O:{"1":"HC"},P:{"1":"1 2 3 4 5 6 7 8 lD mD IC JC KC nD","2":"J","513":"dD eD fD gD hD TC iD jD kD"},Q:{"1":"oD"},R:{"1":"pD"},S:{"513":"qD rD"}},B:4,C:"Referrer Policy",D:true};
|
||||
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* @fileoverview Types for object-schema package.
|
||||
*/
|
||||
/**
|
||||
* Built-in validation strategies.
|
||||
*/
|
||||
export type BuiltInValidationStrategy = "array" | "boolean" | "number" | "object" | "object?" | "string" | "string!";
|
||||
/**
|
||||
* Built-in merge strategies.
|
||||
*/
|
||||
export type BuiltInMergeStrategy = "assign" | "overwrite" | "replace";
|
||||
/**
|
||||
* Property definition.
|
||||
*/
|
||||
export interface PropertyDefinition {
|
||||
/**
|
||||
* Indicates if the property is required.
|
||||
*/
|
||||
required: boolean;
|
||||
/**
|
||||
* The other properties that must be present when this property is used.
|
||||
*/
|
||||
requires?: string[];
|
||||
/**
|
||||
* The strategy to merge the property.
|
||||
*/
|
||||
merge: BuiltInMergeStrategy | ((target: any, source: any) => any);
|
||||
/**
|
||||
* The strategy to validate the property.
|
||||
*/
|
||||
validate: BuiltInValidationStrategy | ((value: any) => void);
|
||||
/**
|
||||
* The schema for the object value of this property.
|
||||
*/
|
||||
schema?: ObjectDefinition;
|
||||
}
|
||||
/**
|
||||
* Object definition.
|
||||
*/
|
||||
export type ObjectDefinition = Record<string, PropertyDefinition>;
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"names":["_addComments","require","addComment","node","type","content","line","addComments","value"],"sources":["../../src/comments/addComment.ts"],"sourcesContent":["import addComments from \"./addComments.ts\";\nimport type * as t from \"../index.ts\";\n\n/**\n * Add comment of certain type to a node.\n */\nexport default function addComment<T extends t.Node>(\n node: T,\n type: t.CommentTypeShorthand,\n content: string,\n line?: boolean,\n): T {\n return addComments(node, type, [\n {\n type: line ? \"CommentLine\" : \"CommentBlock\",\n value: content,\n } as t.Comment,\n ]);\n}\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAMe,SAASC,UAAUA,CAChCC,IAAO,EACPC,IAA4B,EAC5BC,OAAe,EACfC,IAAc,EACX;EACH,OAAO,IAAAC,oBAAW,EAACJ,IAAI,EAAEC,IAAI,EAAE,CAC7B;IACEA,IAAI,EAAEE,IAAI,GAAG,aAAa,GAAG,cAAc;IAC3CE,KAAK,EAAEH;EACT,CAAC,CACF,CAAC;AACJ","ignoreList":[]}
|
||||
Binary file not shown.
@@ -0,0 +1,47 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
||||
const React = require("react");
|
||||
const invariant = require("tiny-invariant");
|
||||
const useRouterState = require("./useRouterState.cjs");
|
||||
const matchContext = require("./matchContext.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 useMatch(opts) {
|
||||
const nearestMatchId = React__namespace.useContext(
|
||||
opts.from ? matchContext.dummyMatchContext : matchContext.matchContext
|
||||
);
|
||||
const matchSelection = useRouterState.useRouterState({
|
||||
select: (state) => {
|
||||
const match = state.matches.find(
|
||||
(d) => opts.from ? opts.from === d.routeId : d.id === nearestMatchId
|
||||
);
|
||||
invariant(
|
||||
!((opts.shouldThrow ?? true) && !match),
|
||||
`Could not find ${opts.from ? `an active match from "${opts.from}"` : "a nearest match!"}`
|
||||
);
|
||||
if (match === void 0) {
|
||||
return void 0;
|
||||
}
|
||||
return opts.select ? opts.select(match) : match;
|
||||
},
|
||||
structuralSharing: opts.structuralSharing
|
||||
});
|
||||
return matchSelection;
|
||||
}
|
||||
exports.useMatch = useMatch;
|
||||
//# sourceMappingURL=useMatch.cjs.map
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -0,0 +1,268 @@
|
||||
/**
|
||||
* @fileoverview Rule to flag comparisons to the value NaN
|
||||
* @author James Allardice
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const astUtils = require("./utils/ast-utils");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Determines if the given node is a NaN `Identifier` node.
|
||||
* @param {ASTNode|null} node The node to check.
|
||||
* @returns {boolean} `true` if the node is 'NaN' identifier.
|
||||
*/
|
||||
function isNaNIdentifier(node) {
|
||||
if (!node) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const nodeToCheck =
|
||||
node.type === "SequenceExpression" ? node.expressions.at(-1) : node;
|
||||
|
||||
return (
|
||||
astUtils.isSpecificId(nodeToCheck, "NaN") ||
|
||||
astUtils.isSpecificMemberAccess(nodeToCheck, "Number", "NaN")
|
||||
);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
hasSuggestions: true,
|
||||
type: "problem",
|
||||
|
||||
docs: {
|
||||
description: "Require calls to `isNaN()` when checking for `NaN`",
|
||||
recommended: true,
|
||||
url: "https://eslint.org/docs/latest/rules/use-isnan",
|
||||
},
|
||||
|
||||
schema: [
|
||||
{
|
||||
type: "object",
|
||||
properties: {
|
||||
enforceForSwitchCase: {
|
||||
type: "boolean",
|
||||
},
|
||||
enforceForIndexOf: {
|
||||
type: "boolean",
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
|
||||
defaultOptions: [
|
||||
{
|
||||
enforceForIndexOf: false,
|
||||
enforceForSwitchCase: true,
|
||||
},
|
||||
],
|
||||
|
||||
messages: {
|
||||
comparisonWithNaN: "Use the isNaN function to compare with NaN.",
|
||||
switchNaN:
|
||||
"'switch(NaN)' can never match a case clause. Use Number.isNaN instead of the switch.",
|
||||
caseNaN:
|
||||
"'case NaN' can never match. Use Number.isNaN before the switch.",
|
||||
indexOfNaN:
|
||||
"Array prototype method '{{ methodName }}' cannot find NaN.",
|
||||
replaceWithIsNaN: "Replace with Number.isNaN.",
|
||||
replaceWithCastingAndIsNaN:
|
||||
"Replace with Number.isNaN and cast to a Number.",
|
||||
replaceWithFindIndex:
|
||||
"Replace with Array.prototype.{{ methodName }}.",
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const [{ enforceForIndexOf, enforceForSwitchCase }] = context.options;
|
||||
const sourceCode = context.sourceCode;
|
||||
|
||||
const fixableOperators = new Set(["==", "===", "!=", "!=="]);
|
||||
const castableOperators = new Set(["==", "!="]);
|
||||
|
||||
/**
|
||||
* Get a fixer for a binary expression that compares to NaN.
|
||||
* @param {ASTNode} node The node to fix.
|
||||
* @param {function(string): string} wrapValue A function that wraps the compared value with a fix.
|
||||
* @returns {function(Fixer): Fix} The fixer function.
|
||||
*/
|
||||
function getBinaryExpressionFixer(node, wrapValue) {
|
||||
return fixer => {
|
||||
const comparedValue = isNaNIdentifier(node.left)
|
||||
? node.right
|
||||
: node.left;
|
||||
const shouldWrap = comparedValue.type === "SequenceExpression";
|
||||
const shouldNegate = node.operator[0] === "!";
|
||||
|
||||
const negation = shouldNegate ? "!" : "";
|
||||
let comparedValueText = sourceCode.getText(comparedValue);
|
||||
|
||||
if (shouldWrap) {
|
||||
comparedValueText = `(${comparedValueText})`;
|
||||
}
|
||||
|
||||
const fixedValue = wrapValue(comparedValueText);
|
||||
|
||||
return fixer.replaceText(node, `${negation}${fixedValue}`);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the given `BinaryExpression` node for `foo === NaN` and other comparisons.
|
||||
* @param {ASTNode} node The node to check.
|
||||
* @returns {void}
|
||||
*/
|
||||
function checkBinaryExpression(node) {
|
||||
if (
|
||||
/^(?:[<>]|[!=]=)=?$/u.test(node.operator) &&
|
||||
(isNaNIdentifier(node.left) || isNaNIdentifier(node.right))
|
||||
) {
|
||||
const suggestedFixes = [];
|
||||
const NaNNode = isNaNIdentifier(node.left)
|
||||
? node.left
|
||||
: node.right;
|
||||
|
||||
const isSequenceExpression =
|
||||
NaNNode.type === "SequenceExpression";
|
||||
const isSuggestable =
|
||||
fixableOperators.has(node.operator) &&
|
||||
!isSequenceExpression;
|
||||
const isCastable = castableOperators.has(node.operator);
|
||||
|
||||
if (isSuggestable) {
|
||||
suggestedFixes.push({
|
||||
messageId: "replaceWithIsNaN",
|
||||
fix: getBinaryExpressionFixer(
|
||||
node,
|
||||
value => `Number.isNaN(${value})`,
|
||||
),
|
||||
});
|
||||
|
||||
if (isCastable) {
|
||||
suggestedFixes.push({
|
||||
messageId: "replaceWithCastingAndIsNaN",
|
||||
fix: getBinaryExpressionFixer(
|
||||
node,
|
||||
value => `Number.isNaN(Number(${value}))`,
|
||||
),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
context.report({
|
||||
node,
|
||||
messageId: "comparisonWithNaN",
|
||||
suggest: suggestedFixes,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the discriminant and all case clauses of the given `SwitchStatement` node for `switch(NaN)` and `case NaN:`
|
||||
* @param {ASTNode} node The node to check.
|
||||
* @returns {void}
|
||||
*/
|
||||
function checkSwitchStatement(node) {
|
||||
if (isNaNIdentifier(node.discriminant)) {
|
||||
context.report({ node, messageId: "switchNaN" });
|
||||
}
|
||||
|
||||
for (const switchCase of node.cases) {
|
||||
if (isNaNIdentifier(switchCase.test)) {
|
||||
context.report({ node: switchCase, messageId: "caseNaN" });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the given `CallExpression` node for `.indexOf(NaN)` and `.lastIndexOf(NaN)`.
|
||||
* @param {ASTNode} node The node to check.
|
||||
* @returns {void}
|
||||
*/
|
||||
function checkCallExpression(node) {
|
||||
const callee = astUtils.skipChainExpression(node.callee);
|
||||
|
||||
if (callee.type === "MemberExpression") {
|
||||
const methodName = astUtils.getStaticPropertyName(callee);
|
||||
|
||||
if (
|
||||
(methodName === "indexOf" ||
|
||||
methodName === "lastIndexOf") &&
|
||||
node.arguments.length <= 2 &&
|
||||
isNaNIdentifier(node.arguments[0])
|
||||
) {
|
||||
/*
|
||||
* To retain side effects, it's essential to address `NaN` beforehand, which
|
||||
* is not possible with fixes like `arr.findIndex(Number.isNaN)`.
|
||||
*/
|
||||
const isSuggestable =
|
||||
node.arguments[0].type !== "SequenceExpression" &&
|
||||
!node.arguments[1];
|
||||
const suggestedFixes = [];
|
||||
|
||||
if (isSuggestable) {
|
||||
const shouldWrap = callee.computed;
|
||||
const findIndexMethod =
|
||||
methodName === "indexOf"
|
||||
? "findIndex"
|
||||
: "findLastIndex";
|
||||
const propertyName = shouldWrap
|
||||
? `"${findIndexMethod}"`
|
||||
: findIndexMethod;
|
||||
|
||||
suggestedFixes.push({
|
||||
messageId: "replaceWithFindIndex",
|
||||
data: { methodName: findIndexMethod },
|
||||
fix: fixer => [
|
||||
fixer.replaceText(
|
||||
callee.property,
|
||||
propertyName,
|
||||
),
|
||||
fixer.replaceText(
|
||||
node.arguments[0],
|
||||
"Number.isNaN",
|
||||
),
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
context.report({
|
||||
node,
|
||||
messageId: "indexOfNaN",
|
||||
data: { methodName },
|
||||
suggest: suggestedFixes,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const listeners = {
|
||||
BinaryExpression: checkBinaryExpression,
|
||||
};
|
||||
|
||||
if (enforceForSwitchCase) {
|
||||
listeners.SwitchStatement = checkSwitchStatement;
|
||||
}
|
||||
|
||||
if (enforceForIndexOf) {
|
||||
listeners.CallExpression = checkCallExpression;
|
||||
}
|
||||
|
||||
return listeners;
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,636 @@
|
||||
// A simple implementation of make-array
|
||||
function makeArray (subject) {
|
||||
return Array.isArray(subject)
|
||||
? subject
|
||||
: [subject]
|
||||
}
|
||||
|
||||
const EMPTY = ''
|
||||
const SPACE = ' '
|
||||
const ESCAPE = '\\'
|
||||
const REGEX_TEST_BLANK_LINE = /^\s+$/
|
||||
const REGEX_INVALID_TRAILING_BACKSLASH = /(?:[^\\]|^)\\$/
|
||||
const REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\!/
|
||||
const REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\#/
|
||||
const REGEX_SPLITALL_CRLF = /\r?\n/g
|
||||
// /foo,
|
||||
// ./foo,
|
||||
// ../foo,
|
||||
// .
|
||||
// ..
|
||||
const REGEX_TEST_INVALID_PATH = /^\.*\/|^\.+$/
|
||||
|
||||
const SLASH = '/'
|
||||
|
||||
// Do not use ternary expression here, since "istanbul ignore next" is buggy
|
||||
let TMP_KEY_IGNORE = 'node-ignore'
|
||||
/* istanbul ignore else */
|
||||
if (typeof Symbol !== 'undefined') {
|
||||
TMP_KEY_IGNORE = Symbol.for('node-ignore')
|
||||
}
|
||||
const KEY_IGNORE = TMP_KEY_IGNORE
|
||||
|
||||
const define = (object, key, value) =>
|
||||
Object.defineProperty(object, key, {value})
|
||||
|
||||
const REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g
|
||||
|
||||
const RETURN_FALSE = () => false
|
||||
|
||||
// Sanitize the range of a regular expression
|
||||
// The cases are complicated, see test cases for details
|
||||
const sanitizeRange = range => range.replace(
|
||||
REGEX_REGEXP_RANGE,
|
||||
(match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0)
|
||||
? match
|
||||
// Invalid range (out of order) which is ok for gitignore rules but
|
||||
// fatal for JavaScript regular expression, so eliminate it.
|
||||
: EMPTY
|
||||
)
|
||||
|
||||
// See fixtures #59
|
||||
const cleanRangeBackSlash = slashes => {
|
||||
const {length} = slashes
|
||||
return slashes.slice(0, length - length % 2)
|
||||
}
|
||||
|
||||
// > If the pattern ends with a slash,
|
||||
// > it is removed for the purpose of the following description,
|
||||
// > but it would only find a match with a directory.
|
||||
// > In other words, foo/ will match a directory foo and paths underneath it,
|
||||
// > but will not match a regular file or a symbolic link foo
|
||||
// > (this is consistent with the way how pathspec works in general in Git).
|
||||
// '`foo/`' will not match regular file '`foo`' or symbolic link '`foo`'
|
||||
// -> ignore-rules will not deal with it, because it costs extra `fs.stat` call
|
||||
// you could use option `mark: true` with `glob`
|
||||
|
||||
// '`foo/`' should not continue with the '`..`'
|
||||
const REPLACERS = [
|
||||
|
||||
[
|
||||
// remove BOM
|
||||
// TODO:
|
||||
// Other similar zero-width characters?
|
||||
/^\uFEFF/,
|
||||
() => EMPTY
|
||||
],
|
||||
|
||||
// > Trailing spaces are ignored unless they are quoted with backslash ("\")
|
||||
[
|
||||
// (a\ ) -> (a )
|
||||
// (a ) -> (a)
|
||||
// (a ) -> (a)
|
||||
// (a \ ) -> (a )
|
||||
/((?:\\\\)*?)(\\?\s+)$/,
|
||||
(_, m1, m2) => m1 + (
|
||||
m2.indexOf('\\') === 0
|
||||
? SPACE
|
||||
: EMPTY
|
||||
)
|
||||
],
|
||||
|
||||
// replace (\ ) with ' '
|
||||
// (\ ) -> ' '
|
||||
// (\\ ) -> '\\ '
|
||||
// (\\\ ) -> '\\ '
|
||||
[
|
||||
/(\\+?)\s/g,
|
||||
(_, m1) => {
|
||||
const {length} = m1
|
||||
return m1.slice(0, length - length % 2) + SPACE
|
||||
}
|
||||
],
|
||||
|
||||
// Escape metacharacters
|
||||
// which is written down by users but means special for regular expressions.
|
||||
|
||||
// > There are 12 characters with special meanings:
|
||||
// > - the backslash \,
|
||||
// > - the caret ^,
|
||||
// > - the dollar sign $,
|
||||
// > - the period or dot .,
|
||||
// > - the vertical bar or pipe symbol |,
|
||||
// > - the question mark ?,
|
||||
// > - the asterisk or star *,
|
||||
// > - the plus sign +,
|
||||
// > - the opening parenthesis (,
|
||||
// > - the closing parenthesis ),
|
||||
// > - and the opening square bracket [,
|
||||
// > - the opening curly brace {,
|
||||
// > These special characters are often called "metacharacters".
|
||||
[
|
||||
/[\\$.|*+(){^]/g,
|
||||
match => `\\${match}`
|
||||
],
|
||||
|
||||
[
|
||||
// > a question mark (?) matches a single character
|
||||
/(?!\\)\?/g,
|
||||
() => '[^/]'
|
||||
],
|
||||
|
||||
// leading slash
|
||||
[
|
||||
|
||||
// > A leading slash matches the beginning of the pathname.
|
||||
// > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".
|
||||
// A leading slash matches the beginning of the pathname
|
||||
/^\//,
|
||||
() => '^'
|
||||
],
|
||||
|
||||
// replace special metacharacter slash after the leading slash
|
||||
[
|
||||
/\//g,
|
||||
() => '\\/'
|
||||
],
|
||||
|
||||
[
|
||||
// > A leading "**" followed by a slash means match in all directories.
|
||||
// > For example, "**/foo" matches file or directory "foo" anywhere,
|
||||
// > the same as pattern "foo".
|
||||
// > "**/foo/bar" matches file or directory "bar" anywhere that is directly
|
||||
// > under directory "foo".
|
||||
// Notice that the '*'s have been replaced as '\\*'
|
||||
/^\^*\\\*\\\*\\\//,
|
||||
|
||||
// '**/foo' <-> 'foo'
|
||||
() => '^(?:.*\\/)?'
|
||||
],
|
||||
|
||||
// starting
|
||||
[
|
||||
// there will be no leading '/'
|
||||
// (which has been replaced by section "leading slash")
|
||||
// If starts with '**', adding a '^' to the regular expression also works
|
||||
/^(?=[^^])/,
|
||||
function startingReplacer () {
|
||||
// If has a slash `/` at the beginning or middle
|
||||
return !/\/(?!$)/.test(this)
|
||||
// > Prior to 2.22.1
|
||||
// > If the pattern does not contain a slash /,
|
||||
// > Git treats it as a shell glob pattern
|
||||
// Actually, if there is only a trailing slash,
|
||||
// git also treats it as a shell glob pattern
|
||||
|
||||
// After 2.22.1 (compatible but clearer)
|
||||
// > If there is a separator at the beginning or middle (or both)
|
||||
// > of the pattern, then the pattern is relative to the directory
|
||||
// > level of the particular .gitignore file itself.
|
||||
// > Otherwise the pattern may also match at any level below
|
||||
// > the .gitignore level.
|
||||
? '(?:^|\\/)'
|
||||
|
||||
// > Otherwise, Git treats the pattern as a shell glob suitable for
|
||||
// > consumption by fnmatch(3)
|
||||
: '^'
|
||||
}
|
||||
],
|
||||
|
||||
// two globstars
|
||||
[
|
||||
// Use lookahead assertions so that we could match more than one `'/**'`
|
||||
/\\\/\\\*\\\*(?=\\\/|$)/g,
|
||||
|
||||
// Zero, one or several directories
|
||||
// should not use '*', or it will be replaced by the next replacer
|
||||
|
||||
// Check if it is not the last `'/**'`
|
||||
(_, index, str) => index + 6 < str.length
|
||||
|
||||
// case: /**/
|
||||
// > A slash followed by two consecutive asterisks then a slash matches
|
||||
// > zero or more directories.
|
||||
// > For example, "a/**/b" matches "a/b", "a/x/b", "a/x/y/b" and so on.
|
||||
// '/**/'
|
||||
? '(?:\\/[^\\/]+)*'
|
||||
|
||||
// case: /**
|
||||
// > A trailing `"/**"` matches everything inside.
|
||||
|
||||
// #21: everything inside but it should not include the current folder
|
||||
: '\\/.+'
|
||||
],
|
||||
|
||||
// normal intermediate wildcards
|
||||
[
|
||||
// Never replace escaped '*'
|
||||
// ignore rule '\*' will match the path '*'
|
||||
|
||||
// 'abc.*/' -> go
|
||||
// 'abc.*' -> skip this rule,
|
||||
// coz trailing single wildcard will be handed by [trailing wildcard]
|
||||
/(^|[^\\]+)(\\\*)+(?=.+)/g,
|
||||
|
||||
// '*.js' matches '.js'
|
||||
// '*.js' doesn't match 'abc'
|
||||
(_, p1, p2) => {
|
||||
// 1.
|
||||
// > An asterisk "*" matches anything except a slash.
|
||||
// 2.
|
||||
// > Other consecutive asterisks are considered regular asterisks
|
||||
// > and will match according to the previous rules.
|
||||
const unescaped = p2.replace(/\\\*/g, '[^\\/]*')
|
||||
return p1 + unescaped
|
||||
}
|
||||
],
|
||||
|
||||
[
|
||||
// unescape, revert step 3 except for back slash
|
||||
// For example, if a user escape a '\\*',
|
||||
// after step 3, the result will be '\\\\\\*'
|
||||
/\\\\\\(?=[$.|*+(){^])/g,
|
||||
() => ESCAPE
|
||||
],
|
||||
|
||||
[
|
||||
// '\\\\' -> '\\'
|
||||
/\\\\/g,
|
||||
() => ESCAPE
|
||||
],
|
||||
|
||||
[
|
||||
// > The range notation, e.g. [a-zA-Z],
|
||||
// > can be used to match one of the characters in a range.
|
||||
|
||||
// `\` is escaped by step 3
|
||||
/(\\)?\[([^\]/]*?)(\\*)($|\])/g,
|
||||
(match, leadEscape, range, endEscape, close) => leadEscape === ESCAPE
|
||||
// '\\[bar]' -> '\\\\[bar\\]'
|
||||
? `\\[${range}${cleanRangeBackSlash(endEscape)}${close}`
|
||||
: close === ']'
|
||||
? endEscape.length % 2 === 0
|
||||
// A normal case, and it is a range notation
|
||||
// '[bar]'
|
||||
// '[bar\\\\]'
|
||||
? `[${sanitizeRange(range)}${endEscape}]`
|
||||
// Invalid range notaton
|
||||
// '[bar\\]' -> '[bar\\\\]'
|
||||
: '[]'
|
||||
: '[]'
|
||||
],
|
||||
|
||||
// ending
|
||||
[
|
||||
// 'js' will not match 'js.'
|
||||
// 'ab' will not match 'abc'
|
||||
/(?:[^*])$/,
|
||||
|
||||
// WTF!
|
||||
// https://git-scm.com/docs/gitignore
|
||||
// changes in [2.22.1](https://git-scm.com/docs/gitignore/2.22.1)
|
||||
// which re-fixes #24, #38
|
||||
|
||||
// > If there is a separator at the end of the pattern then the pattern
|
||||
// > will only match directories, otherwise the pattern can match both
|
||||
// > files and directories.
|
||||
|
||||
// 'js*' will not match 'a.js'
|
||||
// 'js/' will not match 'a.js'
|
||||
// 'js' will match 'a.js' and 'a.js/'
|
||||
match => /\/$/.test(match)
|
||||
// foo/ will not match 'foo'
|
||||
? `${match}$`
|
||||
// foo matches 'foo' and 'foo/'
|
||||
: `${match}(?=$|\\/$)`
|
||||
],
|
||||
|
||||
// trailing wildcard
|
||||
[
|
||||
/(\^|\\\/)?\\\*$/,
|
||||
(_, p1) => {
|
||||
const prefix = p1
|
||||
// '\^':
|
||||
// '/*' does not match EMPTY
|
||||
// '/*' does not match everything
|
||||
|
||||
// '\\\/':
|
||||
// 'abc/*' does not match 'abc/'
|
||||
? `${p1}[^/]+`
|
||||
|
||||
// 'a*' matches 'a'
|
||||
// 'a*' matches 'aa'
|
||||
: '[^/]*'
|
||||
|
||||
return `${prefix}(?=$|\\/$)`
|
||||
}
|
||||
],
|
||||
]
|
||||
|
||||
// A simple cache, because an ignore rule only has only one certain meaning
|
||||
const regexCache = Object.create(null)
|
||||
|
||||
// @param {pattern}
|
||||
const makeRegex = (pattern, ignoreCase) => {
|
||||
let source = regexCache[pattern]
|
||||
|
||||
if (!source) {
|
||||
source = REPLACERS.reduce(
|
||||
(prev, [matcher, replacer]) =>
|
||||
prev.replace(matcher, replacer.bind(pattern)),
|
||||
pattern
|
||||
)
|
||||
regexCache[pattern] = source
|
||||
}
|
||||
|
||||
return ignoreCase
|
||||
? new RegExp(source, 'i')
|
||||
: new RegExp(source)
|
||||
}
|
||||
|
||||
const isString = subject => typeof subject === 'string'
|
||||
|
||||
// > A blank line matches no files, so it can serve as a separator for readability.
|
||||
const checkPattern = pattern => pattern
|
||||
&& isString(pattern)
|
||||
&& !REGEX_TEST_BLANK_LINE.test(pattern)
|
||||
&& !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern)
|
||||
|
||||
// > A line starting with # serves as a comment.
|
||||
&& pattern.indexOf('#') !== 0
|
||||
|
||||
const splitPattern = pattern => pattern.split(REGEX_SPLITALL_CRLF)
|
||||
|
||||
class IgnoreRule {
|
||||
constructor (
|
||||
origin,
|
||||
pattern,
|
||||
negative,
|
||||
regex
|
||||
) {
|
||||
this.origin = origin
|
||||
this.pattern = pattern
|
||||
this.negative = negative
|
||||
this.regex = regex
|
||||
}
|
||||
}
|
||||
|
||||
const createRule = (pattern, ignoreCase) => {
|
||||
const origin = pattern
|
||||
let negative = false
|
||||
|
||||
// > An optional prefix "!" which negates the pattern;
|
||||
if (pattern.indexOf('!') === 0) {
|
||||
negative = true
|
||||
pattern = pattern.substr(1)
|
||||
}
|
||||
|
||||
pattern = pattern
|
||||
// > Put a backslash ("\") in front of the first "!" for patterns that
|
||||
// > begin with a literal "!", for example, `"\!important!.txt"`.
|
||||
.replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, '!')
|
||||
// > Put a backslash ("\") in front of the first hash for patterns that
|
||||
// > begin with a hash.
|
||||
.replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, '#')
|
||||
|
||||
const regex = makeRegex(pattern, ignoreCase)
|
||||
|
||||
return new IgnoreRule(
|
||||
origin,
|
||||
pattern,
|
||||
negative,
|
||||
regex
|
||||
)
|
||||
}
|
||||
|
||||
const throwError = (message, Ctor) => {
|
||||
throw new Ctor(message)
|
||||
}
|
||||
|
||||
const checkPath = (path, originalPath, doThrow) => {
|
||||
if (!isString(path)) {
|
||||
return doThrow(
|
||||
`path must be a string, but got \`${originalPath}\``,
|
||||
TypeError
|
||||
)
|
||||
}
|
||||
|
||||
// We don't know if we should ignore EMPTY, so throw
|
||||
if (!path) {
|
||||
return doThrow(`path must not be empty`, TypeError)
|
||||
}
|
||||
|
||||
// Check if it is a relative path
|
||||
if (checkPath.isNotRelative(path)) {
|
||||
const r = '`path.relative()`d'
|
||||
return doThrow(
|
||||
`path should be a ${r} string, but got "${originalPath}"`,
|
||||
RangeError
|
||||
)
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
const isNotRelative = path => REGEX_TEST_INVALID_PATH.test(path)
|
||||
|
||||
checkPath.isNotRelative = isNotRelative
|
||||
checkPath.convert = p => p
|
||||
|
||||
class Ignore {
|
||||
constructor ({
|
||||
ignorecase = true,
|
||||
ignoreCase = ignorecase,
|
||||
allowRelativePaths = false
|
||||
} = {}) {
|
||||
define(this, KEY_IGNORE, true)
|
||||
|
||||
this._rules = []
|
||||
this._ignoreCase = ignoreCase
|
||||
this._allowRelativePaths = allowRelativePaths
|
||||
this._initCache()
|
||||
}
|
||||
|
||||
_initCache () {
|
||||
this._ignoreCache = Object.create(null)
|
||||
this._testCache = Object.create(null)
|
||||
}
|
||||
|
||||
_addPattern (pattern) {
|
||||
// #32
|
||||
if (pattern && pattern[KEY_IGNORE]) {
|
||||
this._rules = this._rules.concat(pattern._rules)
|
||||
this._added = true
|
||||
return
|
||||
}
|
||||
|
||||
if (checkPattern(pattern)) {
|
||||
const rule = createRule(pattern, this._ignoreCase)
|
||||
this._added = true
|
||||
this._rules.push(rule)
|
||||
}
|
||||
}
|
||||
|
||||
// @param {Array<string> | string | Ignore} pattern
|
||||
add (pattern) {
|
||||
this._added = false
|
||||
|
||||
makeArray(
|
||||
isString(pattern)
|
||||
? splitPattern(pattern)
|
||||
: pattern
|
||||
).forEach(this._addPattern, this)
|
||||
|
||||
// Some rules have just added to the ignore,
|
||||
// making the behavior changed.
|
||||
if (this._added) {
|
||||
this._initCache()
|
||||
}
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
// legacy
|
||||
addPattern (pattern) {
|
||||
return this.add(pattern)
|
||||
}
|
||||
|
||||
// | ignored : unignored
|
||||
// negative | 0:0 | 0:1 | 1:0 | 1:1
|
||||
// -------- | ------- | ------- | ------- | --------
|
||||
// 0 | TEST | TEST | SKIP | X
|
||||
// 1 | TESTIF | SKIP | TEST | X
|
||||
|
||||
// - SKIP: always skip
|
||||
// - TEST: always test
|
||||
// - TESTIF: only test if checkUnignored
|
||||
// - X: that never happen
|
||||
|
||||
// @param {boolean} whether should check if the path is unignored,
|
||||
// setting `checkUnignored` to `false` could reduce additional
|
||||
// path matching.
|
||||
|
||||
// @returns {TestResult} true if a file is ignored
|
||||
_testOne (path, checkUnignored) {
|
||||
let ignored = false
|
||||
let unignored = false
|
||||
|
||||
this._rules.forEach(rule => {
|
||||
const {negative} = rule
|
||||
if (
|
||||
unignored === negative && ignored !== unignored
|
||||
|| negative && !ignored && !unignored && !checkUnignored
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
const matched = rule.regex.test(path)
|
||||
|
||||
if (matched) {
|
||||
ignored = !negative
|
||||
unignored = negative
|
||||
}
|
||||
})
|
||||
|
||||
return {
|
||||
ignored,
|
||||
unignored
|
||||
}
|
||||
}
|
||||
|
||||
// @returns {TestResult}
|
||||
_test (originalPath, cache, checkUnignored, slices) {
|
||||
const path = originalPath
|
||||
// Supports nullable path
|
||||
&& checkPath.convert(originalPath)
|
||||
|
||||
checkPath(
|
||||
path,
|
||||
originalPath,
|
||||
this._allowRelativePaths
|
||||
? RETURN_FALSE
|
||||
: throwError
|
||||
)
|
||||
|
||||
return this._t(path, cache, checkUnignored, slices)
|
||||
}
|
||||
|
||||
_t (path, cache, checkUnignored, slices) {
|
||||
if (path in cache) {
|
||||
return cache[path]
|
||||
}
|
||||
|
||||
if (!slices) {
|
||||
// path/to/a.js
|
||||
// ['path', 'to', 'a.js']
|
||||
slices = path.split(SLASH)
|
||||
}
|
||||
|
||||
slices.pop()
|
||||
|
||||
// If the path has no parent directory, just test it
|
||||
if (!slices.length) {
|
||||
return cache[path] = this._testOne(path, checkUnignored)
|
||||
}
|
||||
|
||||
const parent = this._t(
|
||||
slices.join(SLASH) + SLASH,
|
||||
cache,
|
||||
checkUnignored,
|
||||
slices
|
||||
)
|
||||
|
||||
// If the path contains a parent directory, check the parent first
|
||||
return cache[path] = parent.ignored
|
||||
// > It is not possible to re-include a file if a parent directory of
|
||||
// > that file is excluded.
|
||||
? parent
|
||||
: this._testOne(path, checkUnignored)
|
||||
}
|
||||
|
||||
ignores (path) {
|
||||
return this._test(path, this._ignoreCache, false).ignored
|
||||
}
|
||||
|
||||
createFilter () {
|
||||
return path => !this.ignores(path)
|
||||
}
|
||||
|
||||
filter (paths) {
|
||||
return makeArray(paths).filter(this.createFilter())
|
||||
}
|
||||
|
||||
// @returns {TestResult}
|
||||
test (path) {
|
||||
return this._test(path, this._testCache, true)
|
||||
}
|
||||
}
|
||||
|
||||
const factory = options => new Ignore(options)
|
||||
|
||||
const isPathValid = path =>
|
||||
checkPath(path && checkPath.convert(path), path, RETURN_FALSE)
|
||||
|
||||
factory.isPathValid = isPathValid
|
||||
|
||||
// Fixes typescript
|
||||
factory.default = factory
|
||||
|
||||
module.exports = factory
|
||||
|
||||
// Windows
|
||||
// --------------------------------------------------------------
|
||||
/* istanbul ignore if */
|
||||
if (
|
||||
// Detect `process` so that it can run in browsers.
|
||||
typeof process !== 'undefined'
|
||||
&& (
|
||||
process.env && process.env.IGNORE_TEST_WIN32
|
||||
|| process.platform === 'win32'
|
||||
)
|
||||
) {
|
||||
/* eslint no-control-regex: "off" */
|
||||
const makePosix = str => /^\\\\\?\\/.test(str)
|
||||
|| /["<>|\u0000-\u001F]+/u.test(str)
|
||||
? str
|
||||
: str.replace(/\\/g, '/')
|
||||
|
||||
checkPath.convert = makePosix
|
||||
|
||||
// 'C:\\foo' <- 'C:\\foo' has been converted to 'C:/'
|
||||
// 'd:\\foo'
|
||||
const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i
|
||||
checkPath.isNotRelative = path =>
|
||||
REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path)
|
||||
|| isNotRelative(path)
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
# once
|
||||
|
||||
Only call a function once.
|
||||
|
||||
## usage
|
||||
|
||||
```javascript
|
||||
var once = require('once')
|
||||
|
||||
function load (file, cb) {
|
||||
cb = once(cb)
|
||||
loader.load('file')
|
||||
loader.once('load', cb)
|
||||
loader.once('error', cb)
|
||||
}
|
||||
```
|
||||
|
||||
Or add to the Function.prototype in a responsible way:
|
||||
|
||||
```javascript
|
||||
// only has to be done once
|
||||
require('once').proto()
|
||||
|
||||
function load (file, cb) {
|
||||
cb = cb.once()
|
||||
loader.load('file')
|
||||
loader.once('load', cb)
|
||||
loader.once('error', cb)
|
||||
}
|
||||
```
|
||||
|
||||
Ironically, the prototype feature makes this module twice as
|
||||
complicated as necessary.
|
||||
|
||||
To check whether you function has been called, use `fn.called`. Once the
|
||||
function is called for the first time the return value of the original
|
||||
function is saved in `fn.value` and subsequent calls will continue to
|
||||
return this value.
|
||||
|
||||
```javascript
|
||||
var once = require('once')
|
||||
|
||||
function load (cb) {
|
||||
cb = once(cb)
|
||||
var stream = createStream()
|
||||
stream.once('data', cb)
|
||||
stream.once('end', function () {
|
||||
if (!cb.called) cb(new Error('not found'))
|
||||
})
|
||||
}
|
||||
```
|
||||
|
||||
## `once.strict(func)`
|
||||
|
||||
Throw an error if the function is called twice.
|
||||
|
||||
Some functions are expected to be called only once. Using `once` for them would
|
||||
potentially hide logical errors.
|
||||
|
||||
In the example below, the `greet` function has to call the callback only once:
|
||||
|
||||
```javascript
|
||||
function greet (name, cb) {
|
||||
// return is missing from the if statement
|
||||
// when no name is passed, the callback is called twice
|
||||
if (!name) cb('Hello anonymous')
|
||||
cb('Hello ' + name)
|
||||
}
|
||||
|
||||
function log (msg) {
|
||||
console.log(msg)
|
||||
}
|
||||
|
||||
// this will print 'Hello anonymous' but the logical error will be missed
|
||||
greet(null, once(msg))
|
||||
|
||||
// once.strict will print 'Hello anonymous' and throw an error when the callback will be called the second time
|
||||
greet(null, once.strict(msg))
|
||||
```
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,457 @@
|
||||
var feature = require('caniuse-lite/dist/unpacker/feature').default
|
||||
var region = require('caniuse-lite/dist/unpacker/region').default
|
||||
var fs = require('fs')
|
||||
var path = require('path')
|
||||
|
||||
var BrowserslistError = require('./error')
|
||||
|
||||
var IS_SECTION = /^\s*\[(.+)]\s*$/
|
||||
var CONFIG_PATTERN = /^browserslist-config-/
|
||||
var SCOPED_CONFIG__PATTERN = /@[^/]+(?:\/[^/]+)?\/browserslist-config(?:-|$|\/)/
|
||||
var FORMAT =
|
||||
'Browserslist config should be a string or an array ' +
|
||||
'of strings with browser queries'
|
||||
|
||||
var dataTimeChecked = false
|
||||
var statCache = {}
|
||||
var configPathCache = {}
|
||||
var parseConfigCache = {}
|
||||
|
||||
function checkExtend(name) {
|
||||
var use = ' Use `dangerousExtend` option to disable.'
|
||||
if (!CONFIG_PATTERN.test(name) && !SCOPED_CONFIG__PATTERN.test(name)) {
|
||||
throw new BrowserslistError(
|
||||
'Browserslist config needs `browserslist-config-` prefix. ' + use
|
||||
)
|
||||
}
|
||||
if (name.replace(/^@[^/]+\//, '').indexOf('.') !== -1) {
|
||||
throw new BrowserslistError(
|
||||
'`.` not allowed in Browserslist config name. ' + use
|
||||
)
|
||||
}
|
||||
if (name.indexOf('node_modules') !== -1) {
|
||||
throw new BrowserslistError(
|
||||
'`node_modules` not allowed in Browserslist config.' + use
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function isFile(file) {
|
||||
return fs.existsSync(file) && fs.statSync(file).isFile()
|
||||
}
|
||||
function isDirectory(dir) {
|
||||
return fs.existsSync(dir) && fs.statSync(dir).isDirectory()
|
||||
}
|
||||
|
||||
function eachParent(file, callback, cache) {
|
||||
var loc = path.resolve(file)
|
||||
var pathsForCacheResult = []
|
||||
var result
|
||||
do {
|
||||
if (!pathInRoot(loc)) {
|
||||
break
|
||||
}
|
||||
if (cache && (loc in cache)) {
|
||||
result = cache[loc]
|
||||
break
|
||||
}
|
||||
pathsForCacheResult.push(loc)
|
||||
|
||||
if (!isDirectory(loc)) {
|
||||
continue
|
||||
}
|
||||
|
||||
var locResult = callback(loc)
|
||||
if (typeof locResult !== 'undefined') {
|
||||
result = locResult
|
||||
break
|
||||
}
|
||||
} while (loc !== (loc = path.dirname(loc)))
|
||||
|
||||
if (cache && !process.env.BROWSERSLIST_DISABLE_CACHE) {
|
||||
pathsForCacheResult.forEach(function (cachePath) {
|
||||
cache[cachePath] = result
|
||||
})
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
function pathInRoot(p) {
|
||||
if (!process.env.BROWSERSLIST_ROOT_PATH) return true
|
||||
var rootPath = path.resolve(process.env.BROWSERSLIST_ROOT_PATH)
|
||||
if (path.relative(rootPath, p).substring(0, 2) === '..') {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
function check(section) {
|
||||
if (Array.isArray(section)) {
|
||||
for (var i = 0; i < section.length; i++) {
|
||||
if (typeof section[i] !== 'string') {
|
||||
throw new BrowserslistError(FORMAT)
|
||||
}
|
||||
}
|
||||
} else if (typeof section !== 'string') {
|
||||
throw new BrowserslistError(FORMAT)
|
||||
}
|
||||
}
|
||||
|
||||
function pickEnv(config, opts) {
|
||||
if (typeof config !== 'object') return config
|
||||
|
||||
var name
|
||||
if (typeof opts.env === 'string') {
|
||||
name = opts.env
|
||||
} else if (process.env.BROWSERSLIST_ENV) {
|
||||
name = process.env.BROWSERSLIST_ENV
|
||||
} else if (process.env.NODE_ENV) {
|
||||
name = process.env.NODE_ENV
|
||||
} else {
|
||||
name = 'production'
|
||||
}
|
||||
|
||||
if (opts.throwOnMissing) {
|
||||
if (name && name !== 'defaults' && !config[name]) {
|
||||
throw new BrowserslistError(
|
||||
'Missing config for Browserslist environment `' + name + '`'
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return config[name] || config.defaults
|
||||
}
|
||||
|
||||
function parsePackage(file) {
|
||||
var text = fs
|
||||
.readFileSync(file)
|
||||
.toString()
|
||||
.replace(/^\uFEFF/m, '')
|
||||
var list
|
||||
if (text.indexOf('"browserslist"') >= 0) {
|
||||
list = JSON.parse(text).browserslist
|
||||
} else if (text.indexOf('"browserlist"') >= 0) {
|
||||
var config = JSON.parse(text)
|
||||
if (config.browserlist && !config.browserslist) {
|
||||
throw new BrowserslistError(
|
||||
'`browserlist` key instead of `browserslist` in ' + file
|
||||
)
|
||||
}
|
||||
}
|
||||
if (Array.isArray(list) || typeof list === 'string') {
|
||||
list = { defaults: list }
|
||||
}
|
||||
for (var i in list) {
|
||||
check(list[i])
|
||||
}
|
||||
|
||||
return list
|
||||
}
|
||||
|
||||
function parsePackageOrReadConfig(file) {
|
||||
if (file in parseConfigCache) {
|
||||
return parseConfigCache[file]
|
||||
}
|
||||
|
||||
var isPackage = path.basename(file) === 'package.json'
|
||||
var result = isPackage ? parsePackage(file) : module.exports.readConfig(file)
|
||||
|
||||
if (!process.env.BROWSERSLIST_DISABLE_CACHE) {
|
||||
parseConfigCache[file] = result
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
function latestReleaseTime(agents) {
|
||||
var latest = 0
|
||||
for (var name in agents) {
|
||||
var dates = agents[name].releaseDate || {}
|
||||
for (var key in dates) {
|
||||
if (latest < dates[key]) {
|
||||
latest = dates[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
return latest * 1000
|
||||
}
|
||||
|
||||
function getMonthsPassed(date) {
|
||||
var now = new Date()
|
||||
var past = new Date(date)
|
||||
|
||||
var years = now.getFullYear() - past.getFullYear()
|
||||
var months = now.getMonth() - past.getMonth()
|
||||
|
||||
return years * 12 + months
|
||||
}
|
||||
|
||||
function normalizeStats(data, stats) {
|
||||
if (!data) {
|
||||
data = {}
|
||||
}
|
||||
if (stats && 'dataByBrowser' in stats) {
|
||||
stats = stats.dataByBrowser
|
||||
}
|
||||
|
||||
if (typeof stats !== 'object') return undefined
|
||||
|
||||
var normalized = {}
|
||||
for (var i in stats) {
|
||||
var versions = Object.keys(stats[i])
|
||||
if (versions.length === 1 && data[i] && data[i].versions.length === 1) {
|
||||
var normal = data[i].versions[0]
|
||||
normalized[i] = {}
|
||||
normalized[i][normal] = stats[i][versions[0]]
|
||||
} else {
|
||||
normalized[i] = stats[i]
|
||||
}
|
||||
}
|
||||
|
||||
return normalized
|
||||
}
|
||||
|
||||
function normalizeUsageData(usageData, data) {
|
||||
for (var browser in usageData) {
|
||||
var browserUsage = usageData[browser]
|
||||
// https://github.com/browserslist/browserslist/issues/431#issuecomment-565230615
|
||||
// caniuse-db returns { 0: "percentage" } for `and_*` regional stats
|
||||
if ('0' in browserUsage) {
|
||||
var versions = data[browser].versions
|
||||
browserUsage[versions[versions.length - 1]] = browserUsage[0]
|
||||
delete browserUsage[0]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
loadQueries: function loadQueries(ctx, name) {
|
||||
if (!ctx.dangerousExtend && !process.env.BROWSERSLIST_DANGEROUS_EXTEND) {
|
||||
checkExtend(name)
|
||||
}
|
||||
var queries = require(require.resolve(name, { paths: ['.', ctx.path] }))
|
||||
if (queries) {
|
||||
if (Array.isArray(queries)) {
|
||||
return queries
|
||||
} else if (typeof queries === 'object') {
|
||||
if (!queries.defaults) queries.defaults = []
|
||||
return pickEnv(queries, ctx, name)
|
||||
}
|
||||
}
|
||||
throw new BrowserslistError(
|
||||
'`' +
|
||||
name +
|
||||
'` config exports not an array of queries' +
|
||||
' or an object of envs'
|
||||
)
|
||||
},
|
||||
|
||||
loadStat: function loadStat(ctx, name, data) {
|
||||
if (!ctx.dangerousExtend && !process.env.BROWSERSLIST_DANGEROUS_EXTEND) {
|
||||
checkExtend(name)
|
||||
}
|
||||
var stats = require(require.resolve(
|
||||
path.join(name, 'browserslist-stats.json'),
|
||||
{ paths: ['.'] }
|
||||
))
|
||||
return normalizeStats(data, stats)
|
||||
},
|
||||
|
||||
getStat: function getStat(opts, data) {
|
||||
var stats
|
||||
if (opts.stats) {
|
||||
stats = opts.stats
|
||||
} else if (process.env.BROWSERSLIST_STATS) {
|
||||
stats = process.env.BROWSERSLIST_STATS
|
||||
} else if (opts.path && path.resolve && fs.existsSync) {
|
||||
stats = eachParent(opts.path, function (dir) {
|
||||
var file = path.join(dir, 'browserslist-stats.json')
|
||||
return isFile(file) ? file : undefined
|
||||
}, statCache)
|
||||
}
|
||||
if (typeof stats === 'string') {
|
||||
try {
|
||||
stats = JSON.parse(fs.readFileSync(stats))
|
||||
} catch (e) {
|
||||
throw new BrowserslistError("Can't read " + stats)
|
||||
}
|
||||
}
|
||||
return normalizeStats(data, stats)
|
||||
},
|
||||
|
||||
loadConfig: function loadConfig(opts) {
|
||||
if (process.env.BROWSERSLIST) {
|
||||
return process.env.BROWSERSLIST
|
||||
} else if (opts.config || process.env.BROWSERSLIST_CONFIG) {
|
||||
var file = opts.config || process.env.BROWSERSLIST_CONFIG
|
||||
return pickEnv(parsePackageOrReadConfig(file), opts)
|
||||
} else if (opts.path) {
|
||||
return pickEnv(module.exports.findConfig(opts.path), opts)
|
||||
} else {
|
||||
return undefined
|
||||
}
|
||||
},
|
||||
|
||||
loadCountry: function loadCountry(usage, country, data) {
|
||||
var code = country.replace(/[^\w-]/g, '')
|
||||
if (!usage[code]) {
|
||||
var compressed
|
||||
try {
|
||||
compressed = require('caniuse-lite/data/regions/' + code + '.js')
|
||||
} catch (e) {
|
||||
throw new BrowserslistError('Unknown region name `' + code + '`.')
|
||||
}
|
||||
var usageData = region(compressed)
|
||||
normalizeUsageData(usageData, data)
|
||||
usage[country] = {}
|
||||
for (var i in usageData) {
|
||||
for (var j in usageData[i]) {
|
||||
usage[country][i + ' ' + j] = usageData[i][j]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
loadFeature: function loadFeature(features, name) {
|
||||
name = name.replace(/[^\w-]/g, '')
|
||||
if (features[name]) return
|
||||
var compressed
|
||||
try {
|
||||
compressed = require('caniuse-lite/data/features/' + name + '.js')
|
||||
} catch (e) {
|
||||
throw new BrowserslistError('Unknown feature name `' + name + '`.')
|
||||
}
|
||||
var stats = feature(compressed).stats
|
||||
features[name] = {}
|
||||
for (var i in stats) {
|
||||
features[name][i] = {}
|
||||
for (var j in stats[i]) {
|
||||
features[name][i][j] = stats[i][j]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
parseConfig: function parseConfig(string) {
|
||||
var result = { defaults: [] }
|
||||
var sections = ['defaults']
|
||||
|
||||
string
|
||||
.toString()
|
||||
.replace(/#[^\n]*/g, '')
|
||||
.split(/\n|,/)
|
||||
.map(function (line) {
|
||||
return line.trim()
|
||||
})
|
||||
.filter(function (line) {
|
||||
return line !== ''
|
||||
})
|
||||
.forEach(function (line) {
|
||||
if (IS_SECTION.test(line)) {
|
||||
sections = line.match(IS_SECTION)[1].trim().split(' ')
|
||||
sections.forEach(function (section) {
|
||||
if (result[section]) {
|
||||
throw new BrowserslistError(
|
||||
'Duplicate section ' + section + ' in Browserslist config'
|
||||
)
|
||||
}
|
||||
result[section] = []
|
||||
})
|
||||
} else {
|
||||
sections.forEach(function (section) {
|
||||
result[section].push(line)
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
return result
|
||||
},
|
||||
|
||||
readConfig: function readConfig(file) {
|
||||
if (!isFile(file)) {
|
||||
throw new BrowserslistError("Can't read " + file + ' config')
|
||||
}
|
||||
|
||||
return module.exports.parseConfig(fs.readFileSync(file))
|
||||
},
|
||||
|
||||
findConfigFile: function findConfigFile(from) {
|
||||
return eachParent(from, function (dir) {
|
||||
var config = path.join(dir, 'browserslist')
|
||||
var pkg = path.join(dir, 'package.json')
|
||||
var rc = path.join(dir, '.browserslistrc')
|
||||
|
||||
var pkgBrowserslist
|
||||
if (isFile(pkg)) {
|
||||
try {
|
||||
pkgBrowserslist = parsePackage(pkg)
|
||||
} catch (e) {
|
||||
if (e.name === 'BrowserslistError') throw e
|
||||
console.warn(
|
||||
'[Browserslist] Could not parse ' + pkg + '. Ignoring it.'
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
if (isFile(config) && pkgBrowserslist) {
|
||||
throw new BrowserslistError(
|
||||
dir + ' contains both browserslist and package.json with browsers'
|
||||
)
|
||||
} else if (isFile(rc) && pkgBrowserslist) {
|
||||
throw new BrowserslistError(
|
||||
dir + ' contains both .browserslistrc and package.json with browsers'
|
||||
)
|
||||
} else if (isFile(config) && isFile(rc)) {
|
||||
throw new BrowserslistError(
|
||||
dir + ' contains both .browserslistrc and browserslist'
|
||||
)
|
||||
} else if (isFile(config)) {
|
||||
return config
|
||||
} else if (isFile(rc)) {
|
||||
return rc
|
||||
} else if (pkgBrowserslist) {
|
||||
return pkg
|
||||
}
|
||||
}, configPathCache)
|
||||
},
|
||||
|
||||
findConfig: function findConfig(from) {
|
||||
var configFile = this.findConfigFile(from)
|
||||
|
||||
return configFile ? parsePackageOrReadConfig(configFile) : undefined
|
||||
},
|
||||
|
||||
clearCaches: function clearCaches() {
|
||||
dataTimeChecked = false
|
||||
statCache = {}
|
||||
configPathCache = {}
|
||||
parseConfigCache = {}
|
||||
|
||||
this.cache = {}
|
||||
},
|
||||
|
||||
oldDataWarning: function oldDataWarning(agentsObj) {
|
||||
if (dataTimeChecked) return
|
||||
dataTimeChecked = true
|
||||
if (process.env.BROWSERSLIST_IGNORE_OLD_DATA) return
|
||||
|
||||
var latest = latestReleaseTime(agentsObj)
|
||||
var monthsPassed = getMonthsPassed(latest)
|
||||
|
||||
if (latest !== 0 && monthsPassed >= 6) {
|
||||
var months = monthsPassed + ' ' + (monthsPassed > 1 ? 'months' : 'month')
|
||||
console.warn(
|
||||
'Browserslist: browsers data (caniuse-lite) is ' +
|
||||
months +
|
||||
' old. Please run:\n' +
|
||||
' npx update-browserslist-db@latest\n' +
|
||||
' Why you should do it regularly: ' +
|
||||
'https://github.com/browserslist/update-db#readme'
|
||||
)
|
||||
}
|
||||
},
|
||||
|
||||
currentNode: function currentNode() {
|
||||
return 'node ' + process.versions.node
|
||||
},
|
||||
|
||||
env: process.env
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
// This file is autogenerated by build-prefixes.js. DO NOT EDIT!
|
||||
|
||||
exports.Features = {
|
||||
Nesting: 1,
|
||||
NotSelectorList: 2,
|
||||
DirSelector: 4,
|
||||
LangSelectorList: 8,
|
||||
IsSelector: 16,
|
||||
TextDecorationThicknessPercent: 32,
|
||||
MediaIntervalSyntax: 64,
|
||||
MediaRangeSyntax: 128,
|
||||
CustomMediaQueries: 256,
|
||||
ClampFunction: 512,
|
||||
ColorFunction: 1024,
|
||||
OklabColors: 2048,
|
||||
LabColors: 4096,
|
||||
P3Colors: 8192,
|
||||
HexAlphaColors: 16384,
|
||||
SpaceSeparatedColorNotation: 32768,
|
||||
FontFamilySystemUi: 65536,
|
||||
DoublePositionGradients: 131072,
|
||||
VendorPrefixes: 262144,
|
||||
LogicalProperties: 524288,
|
||||
LightDark: 1048576,
|
||||
Selectors: 31,
|
||||
MediaQueries: 448,
|
||||
Colors: 1113088,
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"name": "@eslint/js",
|
||||
"version": "9.23.0",
|
||||
"description": "ESLint JavaScript language implementation",
|
||||
"main": "./src/index.js",
|
||||
"types": "./types/index.d.ts",
|
||||
"scripts": {
|
||||
"test:types": "tsc -p tests/types/tsconfig.json"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
"src",
|
||||
"types"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/eslint/eslint.git",
|
||||
"directory": "packages/js"
|
||||
},
|
||||
"homepage": "https://eslint.org",
|
||||
"bugs": "https://github.com/eslint/eslint/issues/",
|
||||
"keywords": [
|
||||
"javascript",
|
||||
"eslint-plugin",
|
||||
"eslint"
|
||||
],
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"48":0.00445,"52":0.02668,"62":0.00445,"65":0.00889,"71":0.00889,"101":0.00445,"113":0.02224,"115":0.29795,"117":0.00445,"123":0.00445,"125":0.00445,"127":0.00445,"128":0.07115,"130":0.00889,"131":0.00445,"132":0.00445,"133":0.08449,"134":0.01334,"135":0.25793,"136":1.0406,"137":0.01779,_:"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 49 50 51 53 54 55 56 57 58 59 60 61 63 64 66 67 68 69 70 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 102 103 104 105 106 107 108 109 110 111 112 114 116 118 119 120 121 122 124 126 129 138 139 140 3.5 3.6"},D:{"38":0.00445,"39":0.00889,"40":0.00889,"41":0.00889,"42":0.00889,"43":0.00889,"44":0.00889,"45":0.00889,"46":0.00889,"47":0.00889,"48":0.00889,"49":0.01779,"50":0.00889,"51":0.00889,"52":0.00889,"53":0.01334,"54":0.00889,"55":0.00889,"56":0.00889,"57":0.00889,"58":0.04892,"59":0.00889,"60":0.00889,"74":0.00445,"79":0.02224,"80":0.00445,"87":0.04002,"90":0.00445,"91":0.00889,"94":0.01779,"96":0.00445,"97":0.00445,"98":0.00445,"99":0.00889,"100":0.03113,"101":0.00889,"102":0.01334,"103":0.04892,"104":0.09339,"105":0.00445,"106":0.13341,"107":0.00889,"108":0.03558,"109":2.57926,"110":0.00889,"111":0.01334,"112":0.03113,"113":0.00445,"114":0.01334,"115":0.00445,"116":0.08449,"117":0.00445,"118":0.0756,"119":0.04447,"120":0.08449,"121":0.04892,"122":0.09339,"123":0.03558,"124":0.1512,"125":0.16899,"126":0.05336,"127":0.02224,"128":0.08449,"129":0.04892,"130":0.06226,"131":0.27571,"132":0.44025,"133":6.76833,"134":13.41215,"135":0.03113,"136":0.00445,_:"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 61 62 63 64 65 66 67 68 69 70 71 72 73 75 76 77 78 81 83 84 85 86 88 89 92 93 95 137 138"},F:{"36":0.01334,"38":0.00445,"56":0.01334,"70":0.00445,"73":0.02224,"75":0.00445,"76":0.00445,"79":0.02224,"80":0.01334,"85":0.04892,"86":0.00889,"87":0.04447,"88":0.02224,"95":0.36021,"102":0.00445,"107":0.00445,"114":0.00889,"115":0.00445,"116":0.24459,"117":1.93889,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 37 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 57 58 60 62 63 64 65 66 67 68 69 71 72 74 77 78 81 82 83 84 89 90 91 92 93 94 96 97 98 99 100 101 103 104 105 106 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:{"18":0.00889,"92":0.01779,"100":0.00445,"108":0.00445,"109":0.02224,"110":0.00445,"114":0.01334,"118":0.00445,"122":0.00445,"126":0.00889,"127":0.00445,"128":0.00445,"129":0.00445,"130":0.00889,"131":0.04447,"132":0.05336,"133":1.1073,"134":2.47253,_:"12 13 14 15 16 17 79 80 81 83 84 85 86 87 88 89 90 91 93 94 95 96 97 98 99 101 102 103 104 105 106 107 111 112 113 115 116 117 119 120 121 123 124 125"},E:{"14":0.01779,_:"0 4 5 6 7 8 9 10 11 12 13 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.01334,"14.1":0.00889,"15.1":0.01779,"15.4":0.0756,"15.5":0.00889,"15.6":0.2179,"16.0":0.00445,"16.1":0.04002,"16.2":0.01779,"16.3":0.03113,"16.4":0.01779,"16.5":0.04892,"16.6":0.12007,"17.0":0.00889,"17.1":0.10228,"17.2":0.01779,"17.3":0.04447,"17.4":0.07115,"17.5":0.09783,"17.6":0.18677,"18.0":0.08449,"18.1":0.17343,"18.2":0.10228,"18.3":1.42304,"18.4":0.00889},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00367,"5.0-5.1":0,"6.0-6.1":0.011,"7.0-7.1":0.00734,"8.1-8.4":0,"9.0-9.2":0.0055,"9.3":0.02568,"10.0-10.2":0.00183,"10.3":0.04219,"11.0-11.2":0.19442,"11.3-11.4":0.01284,"12.0-12.1":0.00734,"12.2-12.5":0.18158,"13.0-13.1":0.00367,"13.2":0.0055,"13.3":0.00734,"13.4-13.7":0.02568,"14.0-14.4":0.0642,"14.5-14.8":0.07703,"15.0-15.1":0.04219,"15.2-15.3":0.04219,"15.4":0.05136,"15.5":0.05869,"15.6-15.8":0.72266,"16.0":0.10271,"16.1":0.21093,"16.2":0.11005,"16.3":0.19075,"16.4":0.04219,"16.5":0.07887,"16.6-16.7":0.85655,"17.0":0.05136,"17.1":0.09171,"17.2":0.0697,"17.3":0.09721,"17.4":0.19442,"17.5":0.43286,"17.6-17.7":1.2564,"18.0":0.35216,"18.1":1.15185,"18.2":0.5154,"18.3":10.772,"18.4":0.15957},P:{"4":0.08303,"20":0.01038,"21":0.02076,"22":0.03114,"23":0.07265,"24":0.04152,"25":0.06228,"26":0.10379,"27":1.46346,_:"5.0-5.4 8.2 9.2 10.1 12.0 14.0 15.0 16.0 17.0","6.2-6.4":0.01038,"7.2-7.4":0.03114,"11.1-11.2":0.01038,"13.0":0.01038,"18.0":0.01038,"19.0":0.01038},I:{"0":0.01108,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0,"4.4":0,"4.4.3-4.4.4":0.00001},K:{"0":0.38871,_:"10 11 12 11.1 11.5 12.1"},A:{"6":0.00985,"8":0.00985,"11":0.11816,_:"7 9 10 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{"0":0.11661},Q:{"14.9":0.01111},O:{"0":0.28876},H:{"0":0},L:{"0":32.50827}};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"K D E F A B mC"},B:{"1":"0 9 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","2":"C L M G N O P"},C:{"1":"0 9 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":"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 qC rC"},D:{"1":"0 9 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":"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"},E:{"1":"B C L M G 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 F A sC SC tC uC vC wC"},F:{"1":"0 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","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 4C 5C 6C 7C FC kC 8C GC"},G:{"1":"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 ED FD GD"},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 dD eD fD gD hD TC iD jD kD lD mD IC JC KC nD","2":"J"},Q:{"1":"oD"},R:{"1":"pD"},S:{"1":"rD","2":"qD"}},B:1,C:"rel=noopener",D:true};
|
||||
@@ -0,0 +1,3 @@
|
||||
<svg width="12" height="13" viewBox="0 0 12 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M6 0.5C5.21207 0.5 4.43185 0.655195 3.7039 0.956723C2.97595 1.25825 2.31451 1.70021 1.75736 2.25736C1.20021 2.81451 0.758251 3.47595 0.456723 4.2039C0.155195 4.93185 0 5.71207 0 6.5C0 7.28793 0.155195 8.06815 0.456723 8.7961C0.758251 9.52405 1.20021 10.1855 1.75736 10.7426C2.31451 11.2998 2.97595 11.7417 3.7039 12.0433C4.43185 12.3448 5.21207 12.5 6 12.5C7.5913 12.5 9.11742 11.8679 10.2426 10.7426C11.3679 9.61742 12 8.0913 12 6.5C12 4.9087 11.3679 3.38258 10.2426 2.25736C9.11742 1.13214 7.5913 0.5 6 0.5ZM5.06 8.9L2.9464 6.7856C2.85273 6.69171 2.80018 6.56446 2.80033 6.43183C2.80048 6.29921 2.85331 6.17207 2.9472 6.0784C3.04109 5.98473 3.16834 5.93218 3.30097 5.93233C3.43359 5.93248 3.56073 5.98531 3.6544 6.0792L5.3112 7.7368L8.3464 4.7008C8.44109 4.6109 8.56715 4.56153 8.69771 4.56322C8.82827 4.56492 8.95301 4.61754 9.04534 4.70986C9.13766 4.80219 9.19028 4.92693 9.19198 5.05749C9.19367 5.18805 9.1443 5.31411 9.0544 5.4088L5.5624 8.9H5.06Z" fill="#FBFBFE"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -0,0 +1 @@
|
||||
module.exports={C:{"78":0.00434,"115":0.00434,"128":0.16492,"130":0.00434,"131":0.00434,"134":0.09548,"135":0.1302,"136":0.9548,_:"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 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 116 117 118 119 120 121 122 123 124 125 126 127 129 132 133 137 138 139 140 3.5 3.6"},D:{"36":0.00434,"39":0.00434,"40":0.00434,"41":0.00434,"42":0.00434,"43":0.00434,"44":0.00434,"45":0.00434,"46":0.00434,"47":0.00434,"48":0.00434,"49":0.00434,"50":0.00434,"51":0.00434,"52":0.00434,"53":0.00434,"55":0.00434,"56":0.00434,"57":0.00434,"58":0.00434,"59":0.00434,"60":0.00434,"73":0.00434,"75":0.00434,"76":0.00434,"79":0.01736,"87":0.04774,"92":0.00434,"93":0.00868,"94":0.00434,"98":0.02604,"99":0.00868,"102":0.00434,"103":0.0434,"108":0.0217,"109":0.12586,"111":0.00434,"112":0.01736,"115":0.00868,"116":0.16926,"117":0.00434,"120":0.00434,"121":0.0217,"122":0.16492,"123":0.00868,"124":0.32984,"125":0.00434,"126":0.0217,"127":0.01736,"128":0.08246,"129":0.01736,"130":0.06944,"131":0.61628,"132":0.82026,"133":7.08288,"134":11.63988,"135":0.01302,_:"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 37 38 54 61 62 63 64 65 66 67 68 69 70 71 72 74 77 78 80 81 83 84 85 86 88 89 90 91 95 96 97 100 101 104 105 106 107 110 113 114 118 119 136 137 138"},F:{"88":0.00434,"114":0.00868,"116":0.32116,"117":0.81158,_:"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 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 115 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"98":0.00434,"106":0.00434,"109":0.05208,"110":0.03472,"112":0.00868,"122":0.00434,"128":0.0217,"129":0.01302,"130":0.00434,"131":0.03472,"132":0.05642,"133":2.76892,"134":4.89118,_:"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 99 100 101 102 103 104 105 107 108 111 113 114 115 116 117 118 119 120 121 123 124 125 126 127"},E:{"14":0.00434,"15":0.00434,_:"0 4 5 6 7 8 9 10 11 12 13 3.1 3.2 5.1 6.1 7.1 9.1 11.1 12.1 15.5","10.1":0.00434,"13.1":0.02604,"14.1":0.09114,"15.1":0.00434,"15.2-15.3":0.19964,"15.4":0.00434,"15.6":0.18228,"16.0":0.03038,"16.1":0.02604,"16.2":0.04774,"16.3":0.0434,"16.4":0.06076,"16.5":0.01302,"16.6":0.37758,"17.0":0.0217,"17.1":0.07378,"17.2":0.0217,"17.3":0.01302,"17.4":0.1085,"17.5":0.07812,"17.6":0.37758,"18.0":0.05208,"18.1":1.07198,"18.2":0.1302,"18.3":3.86694,"18.4":0.01736},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00489,"5.0-5.1":0,"6.0-6.1":0.01467,"7.0-7.1":0.00978,"8.1-8.4":0,"9.0-9.2":0.00734,"9.3":0.03424,"10.0-10.2":0.00245,"10.3":0.05625,"11.0-11.2":0.25924,"11.3-11.4":0.01712,"12.0-12.1":0.00978,"12.2-12.5":0.24212,"13.0-13.1":0.00489,"13.2":0.00734,"13.3":0.00978,"13.4-13.7":0.03424,"14.0-14.4":0.0856,"14.5-14.8":0.10272,"15.0-15.1":0.05625,"15.2-15.3":0.05625,"15.4":0.06848,"15.5":0.07826,"15.6-15.8":0.9636,"16.0":0.13696,"16.1":0.28125,"16.2":0.14674,"16.3":0.25435,"16.4":0.05625,"16.5":0.10516,"16.6-16.7":1.14214,"17.0":0.06848,"17.1":0.12228,"17.2":0.09294,"17.3":0.12962,"17.4":0.25924,"17.5":0.57718,"17.6-17.7":1.67529,"18.0":0.46957,"18.1":1.53589,"18.2":0.68724,"18.3":14.36351,"18.4":0.21277},P:{"4":0.03126,"22":0.01042,"24":0.05211,"25":0.01042,"26":0.1459,"27":4.68963,_:"20 21 23 5.0-5.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","6.2-6.4":0.08337,"7.2-7.4":0.03126},I:{"0":0.00565,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0,"4.4":0,"4.4.3-4.4.4":0.00001},K:{"0":0.67354,_:"10 11 12 11.1 11.5 12.1"},A:{"11":0.01736,_:"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.61128},Q:{_:"14.9"},O:{"0":0.0283},H:{"0":0},L:{"0":26.48216}};
|
||||
Reference in New Issue
Block a user