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

View File

@@ -0,0 +1,9 @@
MIT License
Copyright (c) Kevin Mårtensson <kevinmartensson@gmail.com> (github.com/kevva)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -0,0 +1,190 @@
import _default from './colors.mjs';
type ArbitraryUtilityValue = {
kind: 'arbitrary';
/**
* ```
* bg-[color:var(--my-color)]
* ^^^^^
*
* bg-(color:--my-color)
* ^^^^^
* ```
*/
dataType: string | null;
/**
* ```
* bg-[#0088cc]
* ^^^^^^^
*
* bg-[var(--my_variable)]
* ^^^^^^^^^^^^^^^^^^
*
* bg-(--my_variable)
* ^^^^^^^^^^^^^^
* ```
*/
value: string;
};
type NamedUtilityValue = {
kind: 'named';
/**
* ```
* bg-red-500
* ^^^^^^^
*
* w-1/2
* ^
* ```
*/
value: string;
/**
* ```
* w-1/2
* ^^^
* ```
*/
fraction: string | null;
};
type ArbitraryModifier = {
kind: 'arbitrary';
/**
* ```
* bg-red-500/[50%]
* ^^^
* ```
*/
value: string;
};
type NamedModifier = {
kind: 'named';
/**
* ```
* bg-red-500/50
* ^^
* ```
*/
value: string;
};
type ArbitraryVariantValue = {
kind: 'arbitrary';
value: string;
};
type NamedVariantValue = {
kind: 'named';
value: string;
};
type Variant =
/**
* Arbitrary variants are variants that take a selector and generate a variant
* on the fly.
*
* E.g.: `[&_p]`
*/
{
kind: 'arbitrary';
selector: string;
relative: boolean;
}
/**
* Static variants are variants that don't take any arguments.
*
* E.g.: `hover`
*/
| {
kind: 'static';
root: string;
}
/**
* Functional variants are variants that can take an argument. The argument is
* either a named variant value or an arbitrary variant value.
*
* E.g.:
*
* - `aria-disabled`
* - `aria-[disabled]`
* - `@container-size` -> @container, with named value `size`
* - `@container-[inline-size]` -> @container, with arbitrary variant value `inline-size`
* - `@container` -> @container, with no value
*/
| {
kind: 'functional';
root: string;
value: ArbitraryVariantValue | NamedVariantValue | null;
modifier: ArbitraryModifier | NamedModifier | null;
}
/**
* Compound variants are variants that take another variant as an argument.
*
* E.g.:
*
* - `has-[&_p]`
* - `group-*`
* - `peer-*`
*/
| {
kind: 'compound';
root: string;
modifier: ArbitraryModifier | NamedModifier | null;
variant: Variant;
};
type Candidate =
/**
* Arbitrary candidates are candidates that register utilities on the fly with
* a property and a value.
*
* E.g.:
*
* - `[color:red]`
* - `[color:red]/50`
* - `[color:red]/50!`
*/
{
kind: 'arbitrary';
property: string;
value: string;
modifier: ArbitraryModifier | NamedModifier | null;
variants: Variant[];
important: boolean;
raw: string;
}
/**
* Static candidates are candidates that don't take any arguments.
*
* E.g.:
*
* - `underline`
* - `box-border`
*/
| {
kind: 'static';
root: string;
variants: Variant[];
important: boolean;
raw: string;
}
/**
* Functional candidates are candidates that can take an argument.
*
* E.g.:
*
* - `bg-red-500`
* - `bg-[#0088cc]`
* - `w-1/2`
*/
| {
kind: 'functional';
root: string;
value: ArbitraryUtilityValue | NamedUtilityValue | null;
modifier: ArbitraryModifier | NamedModifier | null;
variants: Variant[];
important: boolean;
raw: string;
};
type PluginUtils = {
theme: (keypath: string, defaultValue?: any) => any;
colors: typeof _default;
};
export type { Candidate as C, NamedUtilityValue as N, PluginUtils as P, Variant as V };

View File

@@ -0,0 +1,119 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.TokenContext = void 0;
exports.isLastChild = isLastChild;
exports.needsParens = needsParens;
exports.needsWhitespace = needsWhitespace;
exports.needsWhitespaceAfter = needsWhitespaceAfter;
exports.needsWhitespaceBefore = needsWhitespaceBefore;
var whitespace = require("./whitespace.js");
var parens = require("./parentheses.js");
var _t = require("@babel/types");
const {
FLIPPED_ALIAS_KEYS,
VISITOR_KEYS,
isCallExpression,
isDecorator,
isExpressionStatement,
isMemberExpression,
isNewExpression,
isParenthesizedExpression
} = _t;
const TokenContext = exports.TokenContext = {
expressionStatement: 1,
arrowBody: 2,
exportDefault: 4,
forHead: 8,
forInHead: 16,
forOfHead: 32,
arrowFlowReturnType: 64
};
function expandAliases(obj) {
const map = new Map();
function add(type, func) {
const fn = map.get(type);
map.set(type, fn ? function (node, parent, stack, inForInit, getRawIdentifier) {
var _fn;
return (_fn = fn(node, parent, stack, inForInit, getRawIdentifier)) != null ? _fn : func(node, parent, stack, inForInit, getRawIdentifier);
} : func);
}
for (const type of Object.keys(obj)) {
const aliases = FLIPPED_ALIAS_KEYS[type];
if (aliases) {
for (const alias of aliases) {
add(alias, obj[type]);
}
} else {
add(type, obj[type]);
}
}
return map;
}
const expandedParens = expandAliases(parens);
const expandedWhitespaceNodes = expandAliases(whitespace.nodes);
function isOrHasCallExpression(node) {
if (isCallExpression(node)) {
return true;
}
return isMemberExpression(node) && isOrHasCallExpression(node.object);
}
function needsWhitespace(node, parent, type) {
var _expandedWhitespaceNo;
if (!node) return false;
if (isExpressionStatement(node)) {
node = node.expression;
}
const flag = (_expandedWhitespaceNo = expandedWhitespaceNodes.get(node.type)) == null ? void 0 : _expandedWhitespaceNo(node, parent);
if (typeof flag === "number") {
return (flag & type) !== 0;
}
return false;
}
function needsWhitespaceBefore(node, parent) {
return needsWhitespace(node, parent, 1);
}
function needsWhitespaceAfter(node, parent) {
return needsWhitespace(node, parent, 2);
}
function needsParens(node, parent, tokenContext, inForInit, getRawIdentifier) {
var _expandedParens$get;
if (!parent) return false;
if (isNewExpression(parent) && parent.callee === node) {
if (isOrHasCallExpression(node)) return true;
}
if (isDecorator(parent)) {
return !isDecoratorMemberExpression(node) && !(isCallExpression(node) && isDecoratorMemberExpression(node.callee)) && !isParenthesizedExpression(node);
}
return (_expandedParens$get = expandedParens.get(node.type)) == null ? void 0 : _expandedParens$get(node, parent, tokenContext, inForInit, getRawIdentifier);
}
function isDecoratorMemberExpression(node) {
switch (node.type) {
case "Identifier":
return true;
case "MemberExpression":
return !node.computed && node.property.type === "Identifier" && isDecoratorMemberExpression(node.object);
default:
return false;
}
}
function isLastChild(parent, child) {
const visitorKeys = VISITOR_KEYS[parent.type];
for (let i = visitorKeys.length - 1; i >= 0; i--) {
const val = parent[visitorKeys[i]];
if (val === child) {
return true;
} else if (Array.isArray(val)) {
let j = val.length - 1;
while (j >= 0 && val[j] === null) j--;
return j >= 0 && val[j] === child;
} else if (val) {
return false;
}
}
return false;
}
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1,550 @@
'use strict'
let Container = require('./container')
let Document = require('./document')
let MapGenerator = require('./map-generator')
let parse = require('./parse')
let Result = require('./result')
let Root = require('./root')
let stringify = require('./stringify')
let { isClean, my } = require('./symbols')
let warnOnce = require('./warn-once')
const TYPE_TO_CLASS_NAME = {
atrule: 'AtRule',
comment: 'Comment',
decl: 'Declaration',
document: 'Document',
root: 'Root',
rule: 'Rule'
}
const PLUGIN_PROPS = {
AtRule: true,
AtRuleExit: true,
Comment: true,
CommentExit: true,
Declaration: true,
DeclarationExit: true,
Document: true,
DocumentExit: true,
Once: true,
OnceExit: true,
postcssPlugin: true,
prepare: true,
Root: true,
RootExit: true,
Rule: true,
RuleExit: true
}
const NOT_VISITORS = {
Once: true,
postcssPlugin: true,
prepare: true
}
const CHILDREN = 0
function isPromise(obj) {
return typeof obj === 'object' && typeof obj.then === 'function'
}
function getEvents(node) {
let key = false
let type = TYPE_TO_CLASS_NAME[node.type]
if (node.type === 'decl') {
key = node.prop.toLowerCase()
} else if (node.type === 'atrule') {
key = node.name.toLowerCase()
}
if (key && node.append) {
return [
type,
type + '-' + key,
CHILDREN,
type + 'Exit',
type + 'Exit-' + key
]
} else if (key) {
return [type, type + '-' + key, type + 'Exit', type + 'Exit-' + key]
} else if (node.append) {
return [type, CHILDREN, type + 'Exit']
} else {
return [type, type + 'Exit']
}
}
function toStack(node) {
let events
if (node.type === 'document') {
events = ['Document', CHILDREN, 'DocumentExit']
} else if (node.type === 'root') {
events = ['Root', CHILDREN, 'RootExit']
} else {
events = getEvents(node)
}
return {
eventIndex: 0,
events,
iterator: 0,
node,
visitorIndex: 0,
visitors: []
}
}
function cleanMarks(node) {
node[isClean] = false
if (node.nodes) node.nodes.forEach(i => cleanMarks(i))
return node
}
let postcss = {}
class LazyResult {
get content() {
return this.stringify().content
}
get css() {
return this.stringify().css
}
get map() {
return this.stringify().map
}
get messages() {
return this.sync().messages
}
get opts() {
return this.result.opts
}
get processor() {
return this.result.processor
}
get root() {
return this.sync().root
}
get [Symbol.toStringTag]() {
return 'LazyResult'
}
constructor(processor, css, opts) {
this.stringified = false
this.processed = false
let root
if (
typeof css === 'object' &&
css !== null &&
(css.type === 'root' || css.type === 'document')
) {
root = cleanMarks(css)
} else if (css instanceof LazyResult || css instanceof Result) {
root = cleanMarks(css.root)
if (css.map) {
if (typeof opts.map === 'undefined') opts.map = {}
if (!opts.map.inline) opts.map.inline = false
opts.map.prev = css.map
}
} else {
let parser = parse
if (opts.syntax) parser = opts.syntax.parse
if (opts.parser) parser = opts.parser
if (parser.parse) parser = parser.parse
try {
root = parser(css, opts)
} catch (error) {
this.processed = true
this.error = error
}
if (root && !root[my]) {
/* c8 ignore next 2 */
Container.rebuild(root)
}
}
this.result = new Result(processor, root, opts)
this.helpers = { ...postcss, postcss, result: this.result }
this.plugins = this.processor.plugins.map(plugin => {
if (typeof plugin === 'object' && plugin.prepare) {
return { ...plugin, ...plugin.prepare(this.result) }
} else {
return plugin
}
})
}
async() {
if (this.error) return Promise.reject(this.error)
if (this.processed) return Promise.resolve(this.result)
if (!this.processing) {
this.processing = this.runAsync()
}
return this.processing
}
catch(onRejected) {
return this.async().catch(onRejected)
}
finally(onFinally) {
return this.async().then(onFinally, onFinally)
}
getAsyncError() {
throw new Error('Use process(css).then(cb) to work with async plugins')
}
handleError(error, node) {
let plugin = this.result.lastPlugin
try {
if (node) node.addToError(error)
this.error = error
if (error.name === 'CssSyntaxError' && !error.plugin) {
error.plugin = plugin.postcssPlugin
error.setMessage()
} else if (plugin.postcssVersion) {
if (process.env.NODE_ENV !== 'production') {
let pluginName = plugin.postcssPlugin
let pluginVer = plugin.postcssVersion
let runtimeVer = this.result.processor.version
let a = pluginVer.split('.')
let b = runtimeVer.split('.')
if (a[0] !== b[0] || parseInt(a[1]) > parseInt(b[1])) {
// eslint-disable-next-line no-console
console.error(
'Unknown error from PostCSS plugin. Your current PostCSS ' +
'version is ' +
runtimeVer +
', but ' +
pluginName +
' uses ' +
pluginVer +
'. Perhaps this is the source of the error below.'
)
}
}
}
} catch (err) {
/* c8 ignore next 3 */
// eslint-disable-next-line no-console
if (console && console.error) console.error(err)
}
return error
}
prepareVisitors() {
this.listeners = {}
let add = (plugin, type, cb) => {
if (!this.listeners[type]) this.listeners[type] = []
this.listeners[type].push([plugin, cb])
}
for (let plugin of this.plugins) {
if (typeof plugin === 'object') {
for (let event in plugin) {
if (!PLUGIN_PROPS[event] && /^[A-Z]/.test(event)) {
throw new Error(
`Unknown event ${event} in ${plugin.postcssPlugin}. ` +
`Try to update PostCSS (${this.processor.version} now).`
)
}
if (!NOT_VISITORS[event]) {
if (typeof plugin[event] === 'object') {
for (let filter in plugin[event]) {
if (filter === '*') {
add(plugin, event, plugin[event][filter])
} else {
add(
plugin,
event + '-' + filter.toLowerCase(),
plugin[event][filter]
)
}
}
} else if (typeof plugin[event] === 'function') {
add(plugin, event, plugin[event])
}
}
}
}
}
this.hasListener = Object.keys(this.listeners).length > 0
}
async runAsync() {
this.plugin = 0
for (let i = 0; i < this.plugins.length; i++) {
let plugin = this.plugins[i]
let promise = this.runOnRoot(plugin)
if (isPromise(promise)) {
try {
await promise
} catch (error) {
throw this.handleError(error)
}
}
}
this.prepareVisitors()
if (this.hasListener) {
let root = this.result.root
while (!root[isClean]) {
root[isClean] = true
let stack = [toStack(root)]
while (stack.length > 0) {
let promise = this.visitTick(stack)
if (isPromise(promise)) {
try {
await promise
} catch (e) {
let node = stack[stack.length - 1].node
throw this.handleError(e, node)
}
}
}
}
if (this.listeners.OnceExit) {
for (let [plugin, visitor] of this.listeners.OnceExit) {
this.result.lastPlugin = plugin
try {
if (root.type === 'document') {
let roots = root.nodes.map(subRoot =>
visitor(subRoot, this.helpers)
)
await Promise.all(roots)
} else {
await visitor(root, this.helpers)
}
} catch (e) {
throw this.handleError(e)
}
}
}
}
this.processed = true
return this.stringify()
}
runOnRoot(plugin) {
this.result.lastPlugin = plugin
try {
if (typeof plugin === 'object' && plugin.Once) {
if (this.result.root.type === 'document') {
let roots = this.result.root.nodes.map(root =>
plugin.Once(root, this.helpers)
)
if (isPromise(roots[0])) {
return Promise.all(roots)
}
return roots
}
return plugin.Once(this.result.root, this.helpers)
} else if (typeof plugin === 'function') {
return plugin(this.result.root, this.result)
}
} catch (error) {
throw this.handleError(error)
}
}
stringify() {
if (this.error) throw this.error
if (this.stringified) return this.result
this.stringified = true
this.sync()
let opts = this.result.opts
let str = stringify
if (opts.syntax) str = opts.syntax.stringify
if (opts.stringifier) str = opts.stringifier
if (str.stringify) str = str.stringify
let map = new MapGenerator(str, this.result.root, this.result.opts)
let data = map.generate()
this.result.css = data[0]
this.result.map = data[1]
return this.result
}
sync() {
if (this.error) throw this.error
if (this.processed) return this.result
this.processed = true
if (this.processing) {
throw this.getAsyncError()
}
for (let plugin of this.plugins) {
let promise = this.runOnRoot(plugin)
if (isPromise(promise)) {
throw this.getAsyncError()
}
}
this.prepareVisitors()
if (this.hasListener) {
let root = this.result.root
while (!root[isClean]) {
root[isClean] = true
this.walkSync(root)
}
if (this.listeners.OnceExit) {
if (root.type === 'document') {
for (let subRoot of root.nodes) {
this.visitSync(this.listeners.OnceExit, subRoot)
}
} else {
this.visitSync(this.listeners.OnceExit, root)
}
}
}
return this.result
}
then(onFulfilled, onRejected) {
if (process.env.NODE_ENV !== 'production') {
if (!('from' in this.opts)) {
warnOnce(
'Without `from` option PostCSS could generate wrong source map ' +
'and will not find Browserslist config. Set it to CSS file path ' +
'or to `undefined` to prevent this warning.'
)
}
}
return this.async().then(onFulfilled, onRejected)
}
toString() {
return this.css
}
visitSync(visitors, node) {
for (let [plugin, visitor] of visitors) {
this.result.lastPlugin = plugin
let promise
try {
promise = visitor(node, this.helpers)
} catch (e) {
throw this.handleError(e, node.proxyOf)
}
if (node.type !== 'root' && node.type !== 'document' && !node.parent) {
return true
}
if (isPromise(promise)) {
throw this.getAsyncError()
}
}
}
visitTick(stack) {
let visit = stack[stack.length - 1]
let { node, visitors } = visit
if (node.type !== 'root' && node.type !== 'document' && !node.parent) {
stack.pop()
return
}
if (visitors.length > 0 && visit.visitorIndex < visitors.length) {
let [plugin, visitor] = visitors[visit.visitorIndex]
visit.visitorIndex += 1
if (visit.visitorIndex === visitors.length) {
visit.visitors = []
visit.visitorIndex = 0
}
this.result.lastPlugin = plugin
try {
return visitor(node.toProxy(), this.helpers)
} catch (e) {
throw this.handleError(e, node)
}
}
if (visit.iterator !== 0) {
let iterator = visit.iterator
let child
while ((child = node.nodes[node.indexes[iterator]])) {
node.indexes[iterator] += 1
if (!child[isClean]) {
child[isClean] = true
stack.push(toStack(child))
return
}
}
visit.iterator = 0
delete node.indexes[iterator]
}
let events = visit.events
while (visit.eventIndex < events.length) {
let event = events[visit.eventIndex]
visit.eventIndex += 1
if (event === CHILDREN) {
if (node.nodes && node.nodes.length) {
node[isClean] = true
visit.iterator = node.getIterator()
}
return
} else if (this.listeners[event]) {
visit.visitors = this.listeners[event]
return
}
}
stack.pop()
}
walkSync(node) {
node[isClean] = true
let events = getEvents(node)
for (let event of events) {
if (event === CHILDREN) {
if (node.nodes) {
node.each(child => {
if (!child[isClean]) this.walkSync(child)
})
}
} else {
let visitors = this.listeners[event]
if (visitors) {
if (this.visitSync(visitors, node.toProxy())) return
}
}
}
}
warnings() {
return this.sync().warnings()
}
}
LazyResult.registerPostcss = dependant => {
postcss = dependant
}
module.exports = LazyResult
LazyResult.default = LazyResult
Root.registerLazyResult(LazyResult)
Document.registerLazyResult(LazyResult)

View File

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

View File

@@ -0,0 +1,584 @@
# safe-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url]
[travis-image]: https://img.shields.io/travis/feross/safe-buffer/master.svg
[travis-url]: https://travis-ci.org/feross/safe-buffer
[npm-image]: https://img.shields.io/npm/v/safe-buffer.svg
[npm-url]: https://npmjs.org/package/safe-buffer
[downloads-image]: https://img.shields.io/npm/dm/safe-buffer.svg
[downloads-url]: https://npmjs.org/package/safe-buffer
[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg
[standard-url]: https://standardjs.com
#### Safer Node.js Buffer API
**Use the new Node.js Buffer APIs (`Buffer.from`, `Buffer.alloc`,
`Buffer.allocUnsafe`, `Buffer.allocUnsafeSlow`) in all versions of Node.js.**
**Uses the built-in implementation when available.**
## install
```
npm install safe-buffer
```
## usage
The goal of this package is to provide a safe replacement for the node.js `Buffer`.
It's a drop-in replacement for `Buffer`. You can use it by adding one `require` line to
the top of your node.js modules:
```js
var Buffer = require('safe-buffer').Buffer
// Existing buffer code will continue to work without issues:
new Buffer('hey', 'utf8')
new Buffer([1, 2, 3], 'utf8')
new Buffer(obj)
new Buffer(16) // create an uninitialized buffer (potentially unsafe)
// But you can use these new explicit APIs to make clear what you want:
Buffer.from('hey', 'utf8') // convert from many types to a Buffer
Buffer.alloc(16) // create a zero-filled buffer (safe)
Buffer.allocUnsafe(16) // create an uninitialized buffer (potentially unsafe)
```
## api
### Class Method: Buffer.from(array)
<!-- YAML
added: v3.0.0
-->
* `array` {Array}
Allocates a new `Buffer` using an `array` of octets.
```js
const buf = Buffer.from([0x62,0x75,0x66,0x66,0x65,0x72]);
// creates a new Buffer containing ASCII bytes
// ['b','u','f','f','e','r']
```
A `TypeError` will be thrown if `array` is not an `Array`.
### Class Method: Buffer.from(arrayBuffer[, byteOffset[, length]])
<!-- YAML
added: v5.10.0
-->
* `arrayBuffer` {ArrayBuffer} The `.buffer` property of a `TypedArray` or
a `new ArrayBuffer()`
* `byteOffset` {Number} Default: `0`
* `length` {Number} Default: `arrayBuffer.length - byteOffset`
When passed a reference to the `.buffer` property of a `TypedArray` instance,
the newly created `Buffer` will share the same allocated memory as the
TypedArray.
```js
const arr = new Uint16Array(2);
arr[0] = 5000;
arr[1] = 4000;
const buf = Buffer.from(arr.buffer); // shares the memory with arr;
console.log(buf);
// Prints: <Buffer 88 13 a0 0f>
// changing the TypedArray changes the Buffer also
arr[1] = 6000;
console.log(buf);
// Prints: <Buffer 88 13 70 17>
```
The optional `byteOffset` and `length` arguments specify a memory range within
the `arrayBuffer` that will be shared by the `Buffer`.
```js
const ab = new ArrayBuffer(10);
const buf = Buffer.from(ab, 0, 2);
console.log(buf.length);
// Prints: 2
```
A `TypeError` will be thrown if `arrayBuffer` is not an `ArrayBuffer`.
### Class Method: Buffer.from(buffer)
<!-- YAML
added: v3.0.0
-->
* `buffer` {Buffer}
Copies the passed `buffer` data onto a new `Buffer` instance.
```js
const buf1 = Buffer.from('buffer');
const buf2 = Buffer.from(buf1);
buf1[0] = 0x61;
console.log(buf1.toString());
// 'auffer'
console.log(buf2.toString());
// 'buffer' (copy is not changed)
```
A `TypeError` will be thrown if `buffer` is not a `Buffer`.
### Class Method: Buffer.from(str[, encoding])
<!-- YAML
added: v5.10.0
-->
* `str` {String} String to encode.
* `encoding` {String} Encoding to use, Default: `'utf8'`
Creates a new `Buffer` containing the given JavaScript string `str`. If
provided, the `encoding` parameter identifies the character encoding.
If not provided, `encoding` defaults to `'utf8'`.
```js
const buf1 = Buffer.from('this is a tést');
console.log(buf1.toString());
// prints: this is a tést
console.log(buf1.toString('ascii'));
// prints: this is a tC)st
const buf2 = Buffer.from('7468697320697320612074c3a97374', 'hex');
console.log(buf2.toString());
// prints: this is a tést
```
A `TypeError` will be thrown if `str` is not a string.
### Class Method: Buffer.alloc(size[, fill[, encoding]])
<!-- YAML
added: v5.10.0
-->
* `size` {Number}
* `fill` {Value} Default: `undefined`
* `encoding` {String} Default: `utf8`
Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the
`Buffer` will be *zero-filled*.
```js
const buf = Buffer.alloc(5);
console.log(buf);
// <Buffer 00 00 00 00 00>
```
The `size` must be less than or equal to the value of
`require('buffer').kMaxLength` (on 64-bit architectures, `kMaxLength` is
`(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. A zero-length Buffer will
be created if a `size` less than or equal to 0 is specified.
If `fill` is specified, the allocated `Buffer` will be initialized by calling
`buf.fill(fill)`. See [`buf.fill()`][] for more information.
```js
const buf = Buffer.alloc(5, 'a');
console.log(buf);
// <Buffer 61 61 61 61 61>
```
If both `fill` and `encoding` are specified, the allocated `Buffer` will be
initialized by calling `buf.fill(fill, encoding)`. For example:
```js
const buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64');
console.log(buf);
// <Buffer 68 65 6c 6c 6f 20 77 6f 72 6c 64>
```
Calling `Buffer.alloc(size)` can be significantly slower than the alternative
`Buffer.allocUnsafe(size)` but ensures that the newly created `Buffer` instance
contents will *never contain sensitive data*.
A `TypeError` will be thrown if `size` is not a number.
### Class Method: Buffer.allocUnsafe(size)
<!-- YAML
added: v5.10.0
-->
* `size` {Number}
Allocates a new *non-zero-filled* `Buffer` of `size` bytes. The `size` must
be less than or equal to the value of `require('buffer').kMaxLength` (on 64-bit
architectures, `kMaxLength` is `(2^31)-1`). Otherwise, a [`RangeError`][] is
thrown. A zero-length Buffer will be created if a `size` less than or equal to
0 is specified.
The underlying memory for `Buffer` instances created in this way is *not
initialized*. The contents of the newly created `Buffer` are unknown and
*may contain sensitive data*. Use [`buf.fill(0)`][] to initialize such
`Buffer` instances to zeroes.
```js
const buf = Buffer.allocUnsafe(5);
console.log(buf);
// <Buffer 78 e0 82 02 01>
// (octets will be different, every time)
buf.fill(0);
console.log(buf);
// <Buffer 00 00 00 00 00>
```
A `TypeError` will be thrown if `size` is not a number.
Note that the `Buffer` module pre-allocates an internal `Buffer` instance of
size `Buffer.poolSize` that is used as a pool for the fast allocation of new
`Buffer` instances created using `Buffer.allocUnsafe(size)` (and the deprecated
`new Buffer(size)` constructor) only when `size` is less than or equal to
`Buffer.poolSize >> 1` (floor of `Buffer.poolSize` divided by two). The default
value of `Buffer.poolSize` is `8192` but can be modified.
Use of this pre-allocated internal memory pool is a key difference between
calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`.
Specifically, `Buffer.alloc(size, fill)` will *never* use the internal Buffer
pool, while `Buffer.allocUnsafe(size).fill(fill)` *will* use the internal
Buffer pool if `size` is less than or equal to half `Buffer.poolSize`. The
difference is subtle but can be important when an application requires the
additional performance that `Buffer.allocUnsafe(size)` provides.
### Class Method: Buffer.allocUnsafeSlow(size)
<!-- YAML
added: v5.10.0
-->
* `size` {Number}
Allocates a new *non-zero-filled* and non-pooled `Buffer` of `size` bytes. The
`size` must be less than or equal to the value of
`require('buffer').kMaxLength` (on 64-bit architectures, `kMaxLength` is
`(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. A zero-length Buffer will
be created if a `size` less than or equal to 0 is specified.
The underlying memory for `Buffer` instances created in this way is *not
initialized*. The contents of the newly created `Buffer` are unknown and
*may contain sensitive data*. Use [`buf.fill(0)`][] to initialize such
`Buffer` instances to zeroes.
When using `Buffer.allocUnsafe()` to allocate new `Buffer` instances,
allocations under 4KB are, by default, sliced from a single pre-allocated
`Buffer`. This allows applications to avoid the garbage collection overhead of
creating many individually allocated Buffers. This approach improves both
performance and memory usage by eliminating the need to track and cleanup as
many `Persistent` objects.
However, in the case where a developer may need to retain a small chunk of
memory from a pool for an indeterminate amount of time, it may be appropriate
to create an un-pooled Buffer instance using `Buffer.allocUnsafeSlow()` then
copy out the relevant bits.
```js
// need to keep around a few small chunks of memory
const store = [];
socket.on('readable', () => {
const data = socket.read();
// allocate for retained data
const sb = Buffer.allocUnsafeSlow(10);
// copy the data into the new allocation
data.copy(sb, 0, 0, 10);
store.push(sb);
});
```
Use of `Buffer.allocUnsafeSlow()` should be used only as a last resort *after*
a developer has observed undue memory retention in their applications.
A `TypeError` will be thrown if `size` is not a number.
### All the Rest
The rest of the `Buffer` API is exactly the same as in node.js.
[See the docs](https://nodejs.org/api/buffer.html).
## Related links
- [Node.js issue: Buffer(number) is unsafe](https://github.com/nodejs/node/issues/4660)
- [Node.js Enhancement Proposal: Buffer.from/Buffer.alloc/Buffer.zalloc/Buffer() soft-deprecate](https://github.com/nodejs/node-eps/pull/4)
## Why is `Buffer` unsafe?
Today, the node.js `Buffer` constructor is overloaded to handle many different argument
types like `String`, `Array`, `Object`, `TypedArrayView` (`Uint8Array`, etc.),
`ArrayBuffer`, and also `Number`.
The API is optimized for convenience: you can throw any type at it, and it will try to do
what you want.
Because the Buffer constructor is so powerful, you often see code like this:
```js
// Convert UTF-8 strings to hex
function toHex (str) {
return new Buffer(str).toString('hex')
}
```
***But what happens if `toHex` is called with a `Number` argument?***
### Remote Memory Disclosure
If an attacker can make your program call the `Buffer` constructor with a `Number`
argument, then they can make it allocate uninitialized memory from the node.js process.
This could potentially disclose TLS private keys, user data, or database passwords.
When the `Buffer` constructor is passed a `Number` argument, it returns an
**UNINITIALIZED** block of memory of the specified `size`. When you create a `Buffer` like
this, you **MUST** overwrite the contents before returning it to the user.
From the [node.js docs](https://nodejs.org/api/buffer.html#buffer_new_buffer_size):
> `new Buffer(size)`
>
> - `size` Number
>
> The underlying memory for `Buffer` instances created in this way is not initialized.
> **The contents of a newly created `Buffer` are unknown and could contain sensitive
> data.** Use `buf.fill(0)` to initialize a Buffer to zeroes.
(Emphasis our own.)
Whenever the programmer intended to create an uninitialized `Buffer` you often see code
like this:
```js
var buf = new Buffer(16)
// Immediately overwrite the uninitialized buffer with data from another buffer
for (var i = 0; i < buf.length; i++) {
buf[i] = otherBuf[i]
}
```
### Would this ever be a problem in real code?
Yes. It's surprisingly common to forget to check the type of your variables in a
dynamically-typed language like JavaScript.
Usually the consequences of assuming the wrong type is that your program crashes with an
uncaught exception. But the failure mode for forgetting to check the type of arguments to
the `Buffer` constructor is more catastrophic.
Here's an example of a vulnerable service that takes a JSON payload and converts it to
hex:
```js
// Take a JSON payload {str: "some string"} and convert it to hex
var server = http.createServer(function (req, res) {
var data = ''
req.setEncoding('utf8')
req.on('data', function (chunk) {
data += chunk
})
req.on('end', function () {
var body = JSON.parse(data)
res.end(new Buffer(body.str).toString('hex'))
})
})
server.listen(8080)
```
In this example, an http client just has to send:
```json
{
"str": 1000
}
```
and it will get back 1,000 bytes of uninitialized memory from the server.
This is a very serious bug. It's similar in severity to the
[the Heartbleed bug](http://heartbleed.com/) that allowed disclosure of OpenSSL process
memory by remote attackers.
### Which real-world packages were vulnerable?
#### [`bittorrent-dht`](https://www.npmjs.com/package/bittorrent-dht)
[Mathias Buus](https://github.com/mafintosh) and I
([Feross Aboukhadijeh](http://feross.org/)) found this issue in one of our own packages,
[`bittorrent-dht`](https://www.npmjs.com/package/bittorrent-dht). The bug would allow
anyone on the internet to send a series of messages to a user of `bittorrent-dht` and get
them to reveal 20 bytes at a time of uninitialized memory from the node.js process.
Here's
[the commit](https://github.com/feross/bittorrent-dht/commit/6c7da04025d5633699800a99ec3fbadf70ad35b8)
that fixed it. We released a new fixed version, created a
[Node Security Project disclosure](https://nodesecurity.io/advisories/68), and deprecated all
vulnerable versions on npm so users will get a warning to upgrade to a newer version.
#### [`ws`](https://www.npmjs.com/package/ws)
That got us wondering if there were other vulnerable packages. Sure enough, within a short
period of time, we found the same issue in [`ws`](https://www.npmjs.com/package/ws), the
most popular WebSocket implementation in node.js.
If certain APIs were called with `Number` parameters instead of `String` or `Buffer` as
expected, then uninitialized server memory would be disclosed to the remote peer.
These were the vulnerable methods:
```js
socket.send(number)
socket.ping(number)
socket.pong(number)
```
Here's a vulnerable socket server with some echo functionality:
```js
server.on('connection', function (socket) {
socket.on('message', function (message) {
message = JSON.parse(message)
if (message.type === 'echo') {
socket.send(message.data) // send back the user's message
}
})
})
```
`socket.send(number)` called on the server, will disclose server memory.
Here's [the release](https://github.com/websockets/ws/releases/tag/1.0.1) where the issue
was fixed, with a more detailed explanation. Props to
[Arnout Kazemier](https://github.com/3rd-Eden) for the quick fix. Here's the
[Node Security Project disclosure](https://nodesecurity.io/advisories/67).
### What's the solution?
It's important that node.js offers a fast way to get memory otherwise performance-critical
applications would needlessly get a lot slower.
But we need a better way to *signal our intent* as programmers. **When we want
uninitialized memory, we should request it explicitly.**
Sensitive functionality should not be packed into a developer-friendly API that loosely
accepts many different types. This type of API encourages the lazy practice of passing
variables in without checking the type very carefully.
#### A new API: `Buffer.allocUnsafe(number)`
The functionality of creating buffers with uninitialized memory should be part of another
API. We propose `Buffer.allocUnsafe(number)`. This way, it's not part of an API that
frequently gets user input of all sorts of different types passed into it.
```js
var buf = Buffer.allocUnsafe(16) // careful, uninitialized memory!
// Immediately overwrite the uninitialized buffer with data from another buffer
for (var i = 0; i < buf.length; i++) {
buf[i] = otherBuf[i]
}
```
### How do we fix node.js core?
We sent [a PR to node.js core](https://github.com/nodejs/node/pull/4514) (merged as
`semver-major`) which defends against one case:
```js
var str = 16
new Buffer(str, 'utf8')
```
In this situation, it's implied that the programmer intended the first argument to be a
string, since they passed an encoding as a second argument. Today, node.js will allocate
uninitialized memory in the case of `new Buffer(number, encoding)`, which is probably not
what the programmer intended.
But this is only a partial solution, since if the programmer does `new Buffer(variable)`
(without an `encoding` parameter) there's no way to know what they intended. If `variable`
is sometimes a number, then uninitialized memory will sometimes be returned.
### What's the real long-term fix?
We could deprecate and remove `new Buffer(number)` and use `Buffer.allocUnsafe(number)` when
we need uninitialized memory. But that would break 1000s of packages.
~~We believe the best solution is to:~~
~~1. Change `new Buffer(number)` to return safe, zeroed-out memory~~
~~2. Create a new API for creating uninitialized Buffers. We propose: `Buffer.allocUnsafe(number)`~~
#### Update
We now support adding three new APIs:
- `Buffer.from(value)` - convert from any type to a buffer
- `Buffer.alloc(size)` - create a zero-filled buffer
- `Buffer.allocUnsafe(size)` - create an uninitialized buffer with given size
This solves the core problem that affected `ws` and `bittorrent-dht` which is
`Buffer(variable)` getting tricked into taking a number argument.
This way, existing code continues working and the impact on the npm ecosystem will be
minimal. Over time, npm maintainers can migrate performance-critical code to use
`Buffer.allocUnsafe(number)` instead of `new Buffer(number)`.
### Conclusion
We think there's a serious design issue with the `Buffer` API as it exists today. It
promotes insecure software by putting high-risk functionality into a convenient API
with friendly "developer ergonomics".
This wasn't merely a theoretical exercise because we found the issue in some of the
most popular npm packages.
Fortunately, there's an easy fix that can be applied today. Use `safe-buffer` in place of
`buffer`.
```js
var Buffer = require('safe-buffer').Buffer
```
Eventually, we hope that node.js core can switch to this new, safer behavior. We believe
the impact on the ecosystem would be minimal since it's not a breaking change.
Well-maintained, popular packages would be updated to use `Buffer.alloc` quickly, while
older, insecure packages would magically become safe from this attack vector.
## links
- [Node.js PR: buffer: throw if both length and enc are passed](https://github.com/nodejs/node/pull/4514)
- [Node Security Project disclosure for `ws`](https://nodesecurity.io/advisories/67)
- [Node Security Project disclosure for`bittorrent-dht`](https://nodesecurity.io/advisories/68)
## credit
The original issues in `bittorrent-dht`
([disclosure](https://nodesecurity.io/advisories/68)) and
`ws` ([disclosure](https://nodesecurity.io/advisories/67)) were discovered by
[Mathias Buus](https://github.com/mafintosh) and
[Feross Aboukhadijeh](http://feross.org/).
Thanks to [Adam Baldwin](https://github.com/evilpacket) for helping disclose these issues
and for his work running the [Node Security Project](https://nodesecurity.io/).
Thanks to [John Hiesey](https://github.com/jhiesey) for proofreading this README and
auditing the code.
## license
MIT. Copyright (C) [Feross Aboukhadijeh](http://feross.org)

View File

@@ -0,0 +1 @@
module.exports={C:{"135":0.01071,"136":0.01428,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 137 138 139 140 3.5 3.6"},D:{"79":0.00357,"93":0.11784,"103":0.00714,"105":0.00357,"109":0.01071,"113":0.01071,"116":0.01071,"122":0.00357,"124":0.00357,"126":0.01071,"127":0.00357,"128":0.01428,"130":0.00357,"131":0.01428,"132":0.23212,"133":0.84633,"134":0.50351,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 80 81 83 84 85 86 87 88 89 90 91 92 94 95 96 97 98 99 100 101 102 104 106 107 108 110 111 112 114 115 117 118 119 120 121 123 125 129 135 136 137 138"},F:{"116":0.00714,"117":0.01071,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"126":0.00357,"131":0.00357,"132":0.00714,"133":0.06785,"134":0.28568,_:"12 13 14 15 16 17 18 79 80 81 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 127 128 129 130"},E:{_:"0 4 5 6 7 8 9 10 11 12 13 14 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 11.1 12.1 13.1","14.1":0.00357,"15.1":0.01786,"15.2-15.3":0.04999,"15.4":0.06428,"15.5":0.04285,"15.6":1.29627,"16.0":0.00357,"16.1":0.37496,"16.2":0.1107,"16.3":0.29282,"16.4":0.4928,"16.5":0.17141,"16.6":2.19259,"17.0":0.20712,"17.1":2.7461,"17.2":0.04285,"17.3":0.26783,"17.4":0.27854,"17.5":0.9856,"17.6":2.96393,"18.0":0.46066,"18.1":1.16415,"18.2":0.69992,"18.3":16.99439,"18.4":0.13213},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.01247,"5.0-5.1":0,"6.0-6.1":0.0374,"7.0-7.1":0.02493,"8.1-8.4":0,"9.0-9.2":0.0187,"9.3":0.08726,"10.0-10.2":0.00623,"10.3":0.14335,"11.0-11.2":0.66066,"11.3-11.4":0.04363,"12.0-12.1":0.02493,"12.2-12.5":0.61703,"13.0-13.1":0.01247,"13.2":0.0187,"13.3":0.02493,"13.4-13.7":0.08726,"14.0-14.4":0.21814,"14.5-14.8":0.26177,"15.0-15.1":0.14335,"15.2-15.3":0.14335,"15.4":0.17451,"15.5":0.19944,"15.6-15.8":2.45564,"16.0":0.34903,"16.1":0.71675,"16.2":0.37396,"16.3":0.64819,"16.4":0.14335,"16.5":0.268,"16.6-16.7":2.91062,"17.0":0.17451,"17.1":0.31163,"17.2":0.23684,"17.3":0.33033,"17.4":0.66066,"17.5":1.47089,"17.6-17.7":4.26933,"18.0":1.19666,"18.1":3.91407,"18.2":1.75136,"18.3":36.60405,"18.4":0.54224},P:{"25":0.01179,"27":0.05894,_:"4 20 21 22 23 24 26 5.0-5.4 6.2-6.4 7.2-7.4 8.2 9.2 10.1 11.1-11.2 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0"},I:{"0":0,"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},K:{"0":0,_:"10 11 12 11.1 11.5 12.1"},A:{_:"6 7 8 9 10 11 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{"0":0.00643},Q:{_:"14.9"},O:{"0":0.05144},H:{"0":0},L:{"0":2.25606}};

View File

@@ -0,0 +1 @@
module.exports={C:{"48":0.00548,"52":0.03837,"53":0.00548,"56":0.00548,"60":0.02741,"75":0.00548,"78":0.03289,"91":0.00548,"102":0.00548,"103":0.00548,"104":0.00548,"112":0.00548,"115":0.67429,"123":0.00548,"124":0.01645,"125":0.00548,"126":0.01096,"127":0.0603,"128":0.65784,"129":0.01096,"130":0.00548,"131":0.02193,"132":0.01096,"133":0.04934,"134":0.0603,"135":1.26086,"136":4.265,"137":0.01096,_:"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 54 55 57 58 59 61 62 63 64 65 66 67 68 69 70 71 72 73 74 76 77 79 80 81 82 83 84 85 86 87 88 89 90 92 93 94 95 96 97 98 99 100 101 105 106 107 108 109 110 111 113 114 116 117 118 119 120 121 122 138 139 140 3.5 3.6"},D:{"38":0.00548,"42":0.01645,"47":0.00548,"49":0.01096,"69":0.00548,"70":0.00548,"77":0.01645,"79":0.09319,"80":0.02193,"81":0.00548,"85":0.00548,"87":0.0603,"88":0.01096,"90":0.01096,"93":0.00548,"94":0.01096,"100":6.14532,"102":0.00548,"103":0.03289,"104":0.04934,"105":0.00548,"106":0.00548,"107":0.01096,"108":0.03837,"109":0.58109,"110":0.01096,"111":0.01645,"112":0.01645,"113":0.02741,"114":0.05482,"115":0.02741,"116":0.07127,"117":0.01096,"118":0.12609,"119":0.02193,"120":0.03289,"121":0.02193,"122":0.09868,"123":0.02741,"124":0.12609,"125":0.64139,"126":0.1206,"127":0.09319,"128":0.19735,"129":0.07675,"130":0.08771,"131":1.08544,"132":1.35954,"133":6.47972,"134":10.97496,"135":0.00548,"136":0.00548,_:"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 39 40 41 43 44 45 46 48 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 71 72 73 74 75 76 78 83 84 86 89 91 92 95 96 97 98 99 101 137 138"},F:{"46":0.02741,"79":0.00548,"85":0.02193,"87":0.02193,"88":0.01096,"95":0.02741,"96":0.00548,"102":0.00548,"114":0.02193,"115":0.00548,"116":0.60302,"117":2.12702,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 80 81 82 83 84 86 89 90 91 92 93 94 97 98 99 100 101 103 104 105 106 107 108 109 110 111 112 113 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"18":0.00548,"92":0.00548,"108":0.00548,"109":0.07127,"114":0.00548,"117":0.00548,"119":0.00548,"120":0.00548,"121":0.00548,"122":0.00548,"123":0.00548,"124":0.01645,"125":0.00548,"126":0.01645,"127":0.00548,"128":0.00548,"129":0.01096,"130":0.01645,"131":0.04934,"132":0.14253,"133":2.65329,"134":5.78899,_:"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 100 101 102 103 104 105 106 107 110 111 112 113 115 116 118"},E:{"13":0.00548,"14":0.01645,"15":0.01096,_:"0 4 5 6 7 8 9 10 11 12 3.1 3.2 5.1 6.1 7.1 9.1 10.1 11.1","12.1":0.01645,"13.1":0.03837,"14.1":0.05482,"15.1":0.01645,"15.2-15.3":0.01645,"15.4":0.01096,"15.5":0.02193,"15.6":0.24121,"16.0":0.10416,"16.1":0.02193,"16.2":0.03837,"16.3":0.06578,"16.4":0.03837,"16.5":0.02193,"16.6":0.34537,"17.0":0.01645,"17.1":0.18091,"17.2":0.03837,"17.3":0.05482,"17.4":0.07675,"17.5":0.14253,"17.6":0.38374,"18.0":0.05482,"18.1":0.21928,"18.2":0.09319,"18.3":2.48883,"18.4":0.03837},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00335,"5.0-5.1":0,"6.0-6.1":0.01006,"7.0-7.1":0.0067,"8.1-8.4":0,"9.0-9.2":0.00503,"9.3":0.02347,"10.0-10.2":0.00168,"10.3":0.03855,"11.0-11.2":0.17767,"11.3-11.4":0.01173,"12.0-12.1":0.0067,"12.2-12.5":0.16593,"13.0-13.1":0.00335,"13.2":0.00503,"13.3":0.0067,"13.4-13.7":0.02347,"14.0-14.4":0.05866,"14.5-14.8":0.0704,"15.0-15.1":0.03855,"15.2-15.3":0.03855,"15.4":0.04693,"15.5":0.05364,"15.6-15.8":0.66038,"16.0":0.09386,"16.1":0.19275,"16.2":0.10057,"16.3":0.17431,"16.4":0.03855,"16.5":0.07207,"16.6-16.7":0.78274,"17.0":0.04693,"17.1":0.0838,"17.2":0.06369,"17.3":0.08883,"17.4":0.17767,"17.5":0.39556,"17.6-17.7":1.14813,"18.0":0.32181,"18.1":1.05259,"18.2":0.47098,"18.3":9.84372,"18.4":0.14582},P:{"4":0.11508,"20":0.02092,"21":0.02092,"22":0.02092,"23":0.02092,"24":0.02092,"25":0.03139,"26":0.10462,"27":3.57799,"5.0-5.4":0.02092,"6.2-6.4":0.01046,"7.2-7.4":0.03139,_:"8.2 9.2 10.1 11.1-11.2 12.0 13.0 14.0 15.0 17.0 18.0","16.0":0.01046,"19.0":0.01046},I:{"0":0.04059,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.00001,"4.4":0,"4.4.3-4.4.4":0.00004},K:{"0":0.34344,_:"10 11 12 11.1 11.5 12.1"},A:{"11":0.03837,_:"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.91736},Q:{_:"14.9"},O:{"0":0.04971},H:{"0":0},L:{"0":23.2858}};

View File

@@ -0,0 +1,14 @@
import type * as React from 'react';
/**
* A function that merges React refs into one.
* Supports both functions and ref objects created using createRef() and useRef().
*
* Usage:
* ```tsx
* <div ref={mergeRefs(ref1, ref2, ref3)} />
* ```
*
* @param {(React.Ref<T> | undefined)[]} inputRefs Array of refs
* @returns {React.Ref<T> | React.RefCallback<T>} Merged refs
*/
export default function mergeRefs<T>(...inputRefs: (React.Ref<T> | undefined)[]): React.Ref<T> | React.RefCallback<T>;

View File

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

View File

@@ -0,0 +1 @@
module.exports={C:{"102":0.00391,"106":0.00391,"109":0.00391,"110":0.00391,"113":0.01956,"115":0.02738,"117":0.00391,"122":0.00391,"123":0.00391,"128":0.01956,"132":0.00391,"133":0.00391,"134":0.46553,"135":0.36382,"136":1.01712,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 103 104 105 107 108 111 112 114 116 118 119 120 121 124 125 126 127 129 130 131 137 138 139 140 3.5 3.6"},D:{"39":0.00391,"42":0.00391,"49":0.00391,"57":0.23081,"58":0.01565,"68":0.00391,"69":0.00391,"70":0.10171,"71":0.00391,"72":0.00782,"73":0.00391,"74":0.00782,"75":0.00391,"76":0.00391,"77":0.00391,"79":0.01174,"80":0.00391,"81":0.00391,"83":0.00391,"84":0.00782,"85":0.00391,"86":0.00782,"87":0.00782,"88":0.66895,"89":0.00782,"90":0.01565,"103":0.02738,"104":0.00782,"106":0.00391,"107":0.21125,"108":0.00391,"109":0.08215,"110":0.01565,"111":0.20342,"112":0.39902,"114":0.01565,"115":0.01565,"116":0.05477,"117":0.01174,"118":0.00782,"119":0.01565,"120":0.07433,"121":0.05086,"122":0.06259,"123":0.10562,"124":0.06259,"125":0.06259,"126":0.09389,"127":0.10171,"128":0.19951,"129":0.10171,"130":6.14966,"131":0.38338,"132":0.57115,"133":4.36579,"134":10.01081,"135":0.01565,"136":0.00391,_:"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 40 41 43 44 45 46 47 48 50 51 52 53 54 55 56 59 60 61 62 63 64 65 66 67 78 91 92 93 94 95 96 97 98 99 100 101 102 105 113 137 138"},F:{"53":0.00782,"54":0.00391,"55":0.00391,"64":0.00391,"66":0.00391,"75":0.00391,"76":0.00391,"77":0.00391,"87":0.00782,"88":0.01174,"101":0.00391,"102":0.01565,"105":0.00391,"106":0.00782,"107":0.00391,"108":0.00391,"109":0.00391,"110":0.00391,"111":0.00391,"112":0.00391,"113":0.00391,"114":0.00782,"115":0.0665,"116":0.18386,"117":0.7159,_:"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 56 57 58 60 62 63 65 67 68 69 70 71 72 73 74 78 79 80 81 82 83 84 85 86 89 90 91 92 93 94 95 96 97 98 99 100 103 104 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"80":0.00391,"81":0.00391,"83":0.00391,"84":0.00391,"85":0.00391,"86":0.00391,"87":0.00391,"88":0.00782,"89":0.00391,"91":0.00391,"92":0.01174,"109":0.00391,"111":0.00391,"115":0.00391,"116":0.00391,"119":0.00391,"120":0.01956,"121":0.01565,"122":0.01174,"123":0.00782,"124":0.01565,"125":0.00782,"126":0.00782,"127":0.00782,"128":0.00391,"129":0.00782,"130":0.01174,"131":0.14474,"132":0.01174,"133":1.18925,"134":2.69537,_:"12 13 14 15 16 17 18 79 90 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 110 112 113 114 117 118"},E:{"12":0.00782,"14":0.03521,"15":0.01956,_:"0 4 5 6 7 8 9 10 11 13 3.1 3.2 6.1 7.1 10.1 11.1 12.1 15.1","5.1":0.00391,"9.1":0.02347,"13.1":0.02738,"14.1":0.02347,"15.2-15.3":0.00782,"15.4":0.00782,"15.5":0.01956,"15.6":0.10562,"16.0":0.01174,"16.1":0.00782,"16.2":0.01956,"16.3":0.04694,"16.4":0.01565,"16.5":0.0313,"16.6":0.14866,"17.0":0.08606,"17.1":0.33252,"17.2":0.01956,"17.3":0.02738,"17.4":0.04303,"17.5":0.17213,"17.6":0.38338,"18.0":0.02738,"18.1":0.15257,"18.2":0.08215,"18.3":1.33008,"18.4":0.00782},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00291,"5.0-5.1":0,"6.0-6.1":0.00874,"7.0-7.1":0.00583,"8.1-8.4":0,"9.0-9.2":0.00437,"9.3":0.0204,"10.0-10.2":0.00146,"10.3":0.03352,"11.0-11.2":0.15449,"11.3-11.4":0.0102,"12.0-12.1":0.00583,"12.2-12.5":0.14429,"13.0-13.1":0.00291,"13.2":0.00437,"13.3":0.00583,"13.4-13.7":0.0204,"14.0-14.4":0.05101,"14.5-14.8":0.06121,"15.0-15.1":0.03352,"15.2-15.3":0.03352,"15.4":0.04081,"15.5":0.04664,"15.6-15.8":0.57424,"16.0":0.08162,"16.1":0.16761,"16.2":0.08745,"16.3":0.15158,"16.4":0.03352,"16.5":0.06267,"16.6-16.7":0.68064,"17.0":0.04081,"17.1":0.07287,"17.2":0.05538,"17.3":0.07725,"17.4":0.15449,"17.5":0.34396,"17.6-17.7":0.99837,"18.0":0.27983,"18.1":0.91529,"18.2":0.40955,"18.3":8.5597,"18.4":0.1268},P:{"20":0.0514,"21":0.02056,"22":0.08224,"23":0.1028,"24":0.1028,"25":0.14392,"26":0.09252,"27":2.63161,_:"4 5.0-5.4 6.2-6.4 8.2 9.2 10.1","7.2-7.4":0.09252,"11.1-11.2":0.01028,"12.0":0.01028,"13.0":0.12336,"14.0":0.16448,"15.0":0.01028,"16.0":0.01028,"17.0":0.08224,"18.0":0.01028,"19.0":0.01028},I:{"0":0.00608,"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":1.06758,_:"10 11 12 11.1 11.5 12.1"},A:{"11":0.03912,_:"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.84014},Q:{"14.9":0.07306},O:{"0":0.22526},H:{"0":0.01},L:{"0":40.85411}};

View File

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

View File

@@ -0,0 +1,103 @@
import { RouteIds } from './routeInfo.js';
import { AnyRouter } from './router.js';
export type NoInfer<T> = [T][T extends any ? 0 : never];
export type IsAny<TValue, TYesResult, TNoResult = TValue> = 1 extends 0 & TValue ? TYesResult : TNoResult;
export type PickAsRequired<TValue, TKey extends keyof TValue> = Omit<TValue, TKey> & Required<Pick<TValue, TKey>>;
export type PickRequired<T> = {
[K in keyof T as undefined extends T[K] ? never : K]: T[K];
};
export type PickOptional<T> = {
[K in keyof T as undefined extends T[K] ? K : never]: T[K];
};
export type WithoutEmpty<T> = T extends any ? ({} extends T ? never : T) : never;
export type Expand<T> = T extends object ? T extends infer O ? O extends Function ? O : {
[K in keyof O]: O[K];
} : never : T;
export type DeepPartial<T> = T extends object ? {
[P in keyof T]?: DeepPartial<T[P]>;
} : T;
export type MakeDifferenceOptional<TLeft, TRight> = Omit<TRight, keyof TLeft> & {
[K in keyof TLeft & keyof TRight]?: TRight[K];
};
export type IsUnion<T, U extends T = T> = (T extends any ? (U extends T ? false : true) : never) extends false ? false : true;
export type IsNonEmptyObject<T> = T extends object ? keyof T extends never ? false : true : false;
export type Assign<TLeft, TRight> = TLeft extends any ? TRight extends any ? IsNonEmptyObject<TLeft> extends false ? TRight : IsNonEmptyObject<TRight> extends false ? TLeft : keyof TLeft & keyof TRight extends never ? TLeft & TRight : Omit<TLeft, keyof TRight> & TRight : never : never;
export type IntersectAssign<TLeft, TRight> = TLeft extends any ? TRight extends any ? IsNonEmptyObject<TLeft> extends false ? TRight : IsNonEmptyObject<TRight> extends false ? TLeft : TRight & TLeft : never : never;
export type Timeout = ReturnType<typeof setTimeout>;
export type Updater<TPrevious, TResult = TPrevious> = TResult | ((prev?: TPrevious) => TResult);
export type NonNullableUpdater<TPrevious, TResult = TPrevious> = TResult | ((prev: TPrevious) => TResult);
export type ExtractObjects<TUnion> = TUnion extends MergeAllPrimitive ? never : TUnion;
export type PartialMergeAllObject<TUnion> = ExtractObjects<TUnion> extends infer TObj ? [TObj] extends [never] ? never : {
[TKey in TObj extends any ? keyof TObj : never]?: TObj extends any ? TKey extends keyof TObj ? TObj[TKey] : never : never;
} : never;
export type MergeAllPrimitive = ReadonlyArray<any> | number | string | bigint | boolean | symbol | undefined | null;
export type ExtractPrimitives<TUnion> = TUnion extends MergeAllPrimitive ? TUnion : TUnion extends object ? never : TUnion;
export type PartialMergeAll<TUnion> = ExtractPrimitives<TUnion> | PartialMergeAllObject<TUnion>;
export type Constrain<T, TConstraint, TDefault = TConstraint> = (T extends TConstraint ? T : never) | TDefault;
export type ConstrainLiteral<T, TConstraint, TDefault = TConstraint> = (T & TConstraint) | TDefault;
/**
* To be added to router types
*/
export type UnionToIntersection<T> = (T extends any ? (arg: T) => any : never) extends (arg: infer T) => any ? T : never;
/**
* Merges everything in a union into one object.
* This mapped type is homomorphic which means it preserves stuff! :)
*/
export type MergeAllObjects<TUnion, TIntersected = UnionToIntersection<ExtractObjects<TUnion>>> = [keyof TIntersected] extends [never] ? never : {
[TKey in keyof TIntersected]: TUnion extends any ? TUnion[TKey & keyof TUnion] : never;
};
export type MergeAll<TUnion> = MergeAllObjects<TUnion> | ExtractPrimitives<TUnion>;
export type ValidateJSON<T> = ((...args: Array<any>) => any) extends T ? unknown extends T ? never : 'Function is not serializable' : {
[K in keyof T]: ValidateJSON<T[K]>;
};
export declare function last<T>(arr: Array<T>): T | undefined;
export declare function functionalUpdate<TPrevious, TResult = TPrevious>(updater: Updater<TPrevious, TResult> | NonNullableUpdater<TPrevious, TResult>, previous: TPrevious): TResult;
export declare function pick<TValue, TKey extends keyof TValue>(parent: TValue, keys: Array<TKey>): Pick<TValue, TKey>;
/**
* This function returns `prev` if `_next` is deeply equal.
* If not, it will replace any deeply equal children of `b` with those of `a`.
* This can be used for structural sharing between immutable JSON values for example.
* Do not use this with signals
*/
export declare function replaceEqualDeep<T>(prev: any, _next: T): T;
export declare function isPlainObject(o: any): boolean;
export declare function isPlainArray(value: unknown): value is Array<unknown>;
export declare function deepEqual(a: any, b: any, opts?: {
partial?: boolean;
ignoreUndefined?: boolean;
}): boolean;
export type StringLiteral<T> = T extends string ? string extends T ? string : T : never;
export type ThrowOrOptional<T, TThrow extends boolean> = TThrow extends true ? T : T | undefined;
export type StrictOrFrom<TRouter extends AnyRouter, TFrom, TStrict extends boolean = true> = TStrict extends false ? {
from?: never;
strict: TStrict;
} : {
from: ConstrainLiteral<TFrom, RouteIds<TRouter['routeTree']>>;
strict?: TStrict;
};
export type ThrowConstraint<TStrict extends boolean, TThrow extends boolean> = TStrict extends false ? (TThrow extends true ? never : TThrow) : TThrow;
export type ControlledPromise<T> = Promise<T> & {
resolve: (value: T) => void;
reject: (value: any) => void;
status: 'pending' | 'resolved' | 'rejected';
value?: T;
};
export declare function createControlledPromise<T>(onResolve?: (value: T) => void): ControlledPromise<T>;
/**
*
* @deprecated use `jsesc` instead
*/
export declare function escapeJSON(jsonString: string): string;
export declare function shallow<T>(objA: T, objB: T): boolean;
/**
* Checks if a string contains URI-encoded special characters (e.g., %3F, %20).
*
* @param {string} inputString The string to check.
* @returns {boolean} True if the string contains URI-encoded characters, false otherwise.
* @example
* ```typescript
* const str1 = "foo%3Fbar";
* const hasEncodedChars = hasUriEncodedChars(str1); // returns true
* ```
*/
export declare function hasUriEncodedChars(inputString: string): boolean;

View File

@@ -0,0 +1,190 @@
/**
* @fileoverview Rule to disallow loops with a body that allows only one iteration
* @author Milos Djermanovic
*/
"use strict";
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
const allLoopTypes = [
"WhileStatement",
"DoWhileStatement",
"ForStatement",
"ForInStatement",
"ForOfStatement",
];
/**
* Checks all segments in a set and returns true if any are reachable.
* @param {Set<CodePathSegment>} segments The segments to check.
* @returns {boolean} True if any segment is reachable; false otherwise.
*/
function isAnySegmentReachable(segments) {
for (const segment of segments) {
if (segment.reachable) {
return true;
}
}
return false;
}
/**
* Determines whether the given node is the first node in the code path to which a loop statement
* 'loops' for the next iteration.
* @param {ASTNode} node The node to check.
* @returns {boolean} `true` if the node is a looping target.
*/
function isLoopingTarget(node) {
const parent = node.parent;
if (parent) {
switch (parent.type) {
case "WhileStatement":
return node === parent.test;
case "DoWhileStatement":
return node === parent.body;
case "ForStatement":
return node === (parent.update || parent.test || parent.body);
case "ForInStatement":
case "ForOfStatement":
return node === parent.left;
// no default
}
}
return false;
}
/**
* Creates an array with elements from the first given array that are not included in the second given array.
* @param {Array} arrA The array to compare from.
* @param {Array} arrB The array to compare against.
* @returns {Array} a new array that represents `arrA \ arrB`.
*/
function getDifference(arrA, arrB) {
return arrA.filter(a => !arrB.includes(a));
}
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../shared/types').Rule} */
module.exports = {
meta: {
type: "problem",
defaultOptions: [{ ignore: [] }],
docs: {
description:
"Disallow loops with a body that allows only one iteration",
recommended: false,
url: "https://eslint.org/docs/latest/rules/no-unreachable-loop",
},
schema: [
{
type: "object",
properties: {
ignore: {
type: "array",
items: {
enum: allLoopTypes,
},
uniqueItems: true,
},
},
additionalProperties: false,
},
],
messages: {
invalid: "Invalid loop. Its body allows only one iteration.",
},
},
create(context) {
const [{ ignore: ignoredLoopTypes }] = context.options;
const loopTypesToCheck = getDifference(allLoopTypes, ignoredLoopTypes),
loopSelector = loopTypesToCheck.join(","),
loopsByTargetSegments = new Map(),
loopsToReport = new Set();
const codePathSegments = [];
let currentCodePathSegments = new Set();
return {
onCodePathStart() {
codePathSegments.push(currentCodePathSegments);
currentCodePathSegments = new Set();
},
onCodePathEnd() {
currentCodePathSegments = codePathSegments.pop();
},
onUnreachableCodePathSegmentStart(segment) {
currentCodePathSegments.add(segment);
},
onUnreachableCodePathSegmentEnd(segment) {
currentCodePathSegments.delete(segment);
},
onCodePathSegmentEnd(segment) {
currentCodePathSegments.delete(segment);
},
onCodePathSegmentStart(segment, node) {
currentCodePathSegments.add(segment);
if (isLoopingTarget(node)) {
const loop = node.parent;
loopsByTargetSegments.set(segment, loop);
}
},
onCodePathSegmentLoop(_, toSegment, node) {
const loop = loopsByTargetSegments.get(toSegment);
/**
* The second iteration is reachable, meaning that the loop is valid by the logic of this rule,
* only if there is at least one loop event with the appropriate target (which has been already
* determined in the `loopsByTargetSegments` map), raised from either:
*
* - the end of the loop's body (in which case `node === loop`)
* - a `continue` statement
*
* This condition skips loop events raised from `ForInStatement > .right` and `ForOfStatement > .right` nodes.
*/
if (node === loop || node.type === "ContinueStatement") {
// Removes loop if it exists in the set. Otherwise, `Set#delete` has no effect and doesn't throw.
loopsToReport.delete(loop);
}
},
[loopSelector](node) {
/**
* Ignore unreachable loop statements to avoid unnecessary complexity in the implementation, or false positives otherwise.
* For unreachable segments, the code path analysis does not raise events required for this implementation.
*/
if (isAnySegmentReachable(currentCodePathSegments)) {
loopsToReport.add(node);
}
},
"Program:exit"() {
loopsToReport.forEach(node =>
context.report({ node, messageId: "invalid" }),
);
},
};
},
};

View File

@@ -0,0 +1,171 @@
'use strict';
var traverse = require('../index');
var assert = require('assert');
describe('json-schema-traverse', function() {
var calls;
beforeEach(function() {
calls = [];
});
it('should traverse all keywords containing schemas recursively', function() {
var schema = require('./fixtures/schema').schema;
var expectedCalls = require('./fixtures/schema').expectedCalls;
traverse(schema, {cb: callback});
assert.deepStrictEqual(calls, expectedCalls);
});
describe('Legacy v0.3.1 API', function() {
it('should traverse all keywords containing schemas recursively', function() {
var schema = require('./fixtures/schema').schema;
var expectedCalls = require('./fixtures/schema').expectedCalls;
traverse(schema, callback);
assert.deepStrictEqual(calls, expectedCalls);
});
it('should work when an options object is provided', function() {
// schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex
var schema = require('./fixtures/schema').schema;
var expectedCalls = require('./fixtures/schema').expectedCalls;
traverse(schema, {}, callback);
assert.deepStrictEqual(calls, expectedCalls);
});
});
describe('allKeys option', function() {
var schema = {
someObject: {
minimum: 1,
maximum: 2
}
};
it('should traverse objects with allKeys: true option', function() {
// schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex
var expectedCalls = [
[schema, '', schema, undefined, undefined, undefined, undefined],
[schema.someObject, '/someObject', schema, '', 'someObject', schema, undefined]
];
traverse(schema, {allKeys: true, cb: callback});
assert.deepStrictEqual(calls, expectedCalls);
});
it('should NOT traverse objects with allKeys: false option', function() {
// schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex
var expectedCalls = [
[schema, '', schema, undefined, undefined, undefined, undefined]
];
traverse(schema, {allKeys: false, cb: callback});
assert.deepStrictEqual(calls, expectedCalls);
});
it('should NOT traverse objects without allKeys option', function() {
// schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex
var expectedCalls = [
[schema, '', schema, undefined, undefined, undefined, undefined]
];
traverse(schema, {cb: callback});
assert.deepStrictEqual(calls, expectedCalls);
});
it('should NOT travers objects in standard keywords which value is not a schema', function() {
var schema2 = {
const: {foo: 'bar'},
enum: ['a', 'b'],
required: ['foo'],
another: {
},
patternProperties: {}, // will not traverse - no properties
dependencies: true, // will not traverse - invalid
properties: {
smaller: {
type: 'number'
},
larger: {
type: 'number',
minimum: {$data: '1/smaller'}
}
}
};
// schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex
var expectedCalls = [
[schema2, '', schema2, undefined, undefined, undefined, undefined],
[schema2.another, '/another', schema2, '', 'another', schema2, undefined],
[schema2.properties.smaller, '/properties/smaller', schema2, '', 'properties', schema2, 'smaller'],
[schema2.properties.larger, '/properties/larger', schema2, '', 'properties', schema2, 'larger'],
];
traverse(schema2, {allKeys: true, cb: callback});
assert.deepStrictEqual(calls, expectedCalls);
});
});
describe('pre and post', function() {
var schema = {
type: 'object',
properties: {
name: {type: 'string'},
age: {type: 'number'}
}
};
it('should traverse schema in pre-order', function() {
traverse(schema, {cb: {pre}});
var expectedCalls = [
['pre', schema, '', schema, undefined, undefined, undefined, undefined],
['pre', schema.properties.name, '/properties/name', schema, '', 'properties', schema, 'name'],
['pre', schema.properties.age, '/properties/age', schema, '', 'properties', schema, 'age'],
];
assert.deepStrictEqual(calls, expectedCalls);
});
it('should traverse schema in post-order', function() {
traverse(schema, {cb: {post}});
var expectedCalls = [
['post', schema.properties.name, '/properties/name', schema, '', 'properties', schema, 'name'],
['post', schema.properties.age, '/properties/age', schema, '', 'properties', schema, 'age'],
['post', schema, '', schema, undefined, undefined, undefined, undefined],
];
assert.deepStrictEqual(calls, expectedCalls);
});
it('should traverse schema in pre- and post-order at the same time', function() {
traverse(schema, {cb: {pre, post}});
var expectedCalls = [
['pre', schema, '', schema, undefined, undefined, undefined, undefined],
['pre', schema.properties.name, '/properties/name', schema, '', 'properties', schema, 'name'],
['post', schema.properties.name, '/properties/name', schema, '', 'properties', schema, 'name'],
['pre', schema.properties.age, '/properties/age', schema, '', 'properties', schema, 'age'],
['post', schema.properties.age, '/properties/age', schema, '', 'properties', schema, 'age'],
['post', schema, '', schema, undefined, undefined, undefined, undefined],
];
assert.deepStrictEqual(calls, expectedCalls);
});
});
function callback() {
calls.push(Array.prototype.slice.call(arguments));
}
function pre() {
calls.push(['pre'].concat(Array.prototype.slice.call(arguments)));
}
function post() {
calls.push(['post'].concat(Array.prototype.slice.call(arguments)));
}
});

View File

@@ -0,0 +1,292 @@
#pragma once
#include <cairo.h>
#include "closure.h"
#include <cmath> // round
#include <cstdlib>
#include <cstring>
#include <png.h>
#include <pngconf.h>
#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__)
#define likely(expr) (__builtin_expect (!!(expr), 1))
#define unlikely(expr) (__builtin_expect (!!(expr), 0))
#else
#define likely(expr) (expr)
#define unlikely(expr) (expr)
#endif
static void canvas_png_flush(png_structp png_ptr) {
/* Do nothing; fflush() is said to be just a waste of energy. */
(void) png_ptr; /* Stifle compiler warning */
}
/* Converts native endian xRGB => RGBx bytes */
static void canvas_convert_data_to_bytes(png_structp png, png_row_infop row_info, png_bytep data) {
unsigned int i;
for (i = 0; i < row_info->rowbytes; i += 4) {
uint8_t *b = &data[i];
uint32_t pixel;
memcpy(&pixel, b, sizeof (uint32_t));
b[0] = (pixel & 0xff0000) >> 16;
b[1] = (pixel & 0x00ff00) >> 8;
b[2] = (pixel & 0x0000ff) >> 0;
b[3] = 0;
}
}
/* Unpremultiplies data and converts native endian ARGB => RGBA bytes */
static void canvas_unpremultiply_data(png_structp png, png_row_infop row_info, png_bytep data) {
unsigned int i;
for (i = 0; i < row_info->rowbytes; i += 4) {
uint8_t *b = &data[i];
uint32_t pixel;
uint8_t alpha;
memcpy(&pixel, b, sizeof (uint32_t));
alpha = (pixel & 0xff000000) >> 24;
if (alpha == 0) {
b[0] = b[1] = b[2] = b[3] = 0;
} else {
b[0] = (((pixel & 0xff0000) >> 16) * 255 + alpha / 2) / alpha;
b[1] = (((pixel & 0x00ff00) >> 8) * 255 + alpha / 2) / alpha;
b[2] = (((pixel & 0x0000ff) >> 0) * 255 + alpha / 2) / alpha;
b[3] = alpha;
}
}
}
/* Converts RGB16_565 format data to RGBA32 */
static void canvas_convert_565_to_888(png_structp png, png_row_infop row_info, png_bytep data) {
// Loop in reverse to unpack in-place.
for (ptrdiff_t col = row_info->width - 1; col >= 0; col--) {
uint8_t* src = &data[col * sizeof(uint16_t)];
uint8_t* dst = &data[col * 3];
uint16_t pixel;
memcpy(&pixel, src, sizeof(uint16_t));
// Convert and rescale to the full 0-255 range
// See http://stackoverflow.com/a/29326693
const uint8_t red5 = (pixel & 0xF800) >> 11;
const uint8_t green6 = (pixel & 0x7E0) >> 5;
const uint8_t blue5 = (pixel & 0x001F);
dst[0] = ((red5 * 255 + 15) / 31);
dst[1] = ((green6 * 255 + 31) / 63);
dst[2] = ((blue5 * 255 + 15) / 31);
}
}
struct canvas_png_write_closure_t {
cairo_write_func_t write_func;
PngClosure* closure;
};
#ifdef PNG_SETJMP_SUPPORTED
bool setjmp_wrapper(png_structp png) {
return setjmp(png_jmpbuf(png));
}
#endif
static cairo_status_t canvas_write_png(cairo_surface_t *surface, png_rw_ptr write_func, canvas_png_write_closure_t *closure) {
unsigned int i;
cairo_status_t status = CAIRO_STATUS_SUCCESS;
uint8_t *data;
png_structp png;
png_infop info;
png_bytep *volatile rows = NULL;
png_color_16 white;
int png_color_type;
int bpc;
unsigned int width = cairo_image_surface_get_width(surface);
unsigned int height = cairo_image_surface_get_height(surface);
data = cairo_image_surface_get_data(surface);
if (data == NULL) {
status = CAIRO_STATUS_SURFACE_TYPE_MISMATCH;
return status;
}
cairo_surface_flush(surface);
if (width == 0 || height == 0) {
status = CAIRO_STATUS_WRITE_ERROR;
return status;
}
rows = (png_bytep *) malloc(height * sizeof (png_byte*));
if (unlikely(rows == NULL)) {
status = CAIRO_STATUS_NO_MEMORY;
return status;
}
int stride = cairo_image_surface_get_stride(surface);
for (i = 0; i < height; i++) {
rows[i] = (png_byte *) data + i * stride;
}
#ifdef PNG_USER_MEM_SUPPORTED
png = png_create_write_struct_2(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL, NULL, NULL, NULL);
#else
png = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
#endif
if (unlikely(png == NULL)) {
status = CAIRO_STATUS_NO_MEMORY;
free(rows);
return status;
}
info = png_create_info_struct (png);
if (unlikely(info == NULL)) {
status = CAIRO_STATUS_NO_MEMORY;
png_destroy_write_struct(&png, &info);
free(rows);
return status;
}
#ifdef PNG_SETJMP_SUPPORTED
if (setjmp_wrapper(png)) {
png_destroy_write_struct(&png, &info);
free(rows);
return status;
}
#endif
png_set_write_fn(png, closure, write_func, canvas_png_flush);
png_set_compression_level(png, closure->closure->compressionLevel);
png_set_filter(png, 0, closure->closure->filters);
if (closure->closure->resolution != 0) {
uint32_t res = static_cast<uint32_t>(round(static_cast<double>(closure->closure->resolution) * 39.3701));
png_set_pHYs(png, info, res, res, PNG_RESOLUTION_METER);
}
cairo_format_t format = cairo_image_surface_get_format(surface);
switch (format) {
case CAIRO_FORMAT_ARGB32:
bpc = 8;
png_color_type = PNG_COLOR_TYPE_RGB_ALPHA;
break;
#ifdef CAIRO_FORMAT_RGB30
case CAIRO_FORMAT_RGB30:
bpc = 10;
png_color_type = PNG_COLOR_TYPE_RGB;
break;
#endif
case CAIRO_FORMAT_RGB24:
bpc = 8;
png_color_type = PNG_COLOR_TYPE_RGB;
break;
case CAIRO_FORMAT_A8:
bpc = 8;
png_color_type = PNG_COLOR_TYPE_GRAY;
break;
case CAIRO_FORMAT_A1:
bpc = 1;
png_color_type = PNG_COLOR_TYPE_GRAY;
#ifndef WORDS_BIGENDIAN
png_set_packswap(png);
#endif
break;
case CAIRO_FORMAT_RGB16_565:
bpc = 8; // 565 gets upconverted to 888
png_color_type = PNG_COLOR_TYPE_RGB;
break;
case CAIRO_FORMAT_INVALID:
default:
status = CAIRO_STATUS_INVALID_FORMAT;
png_destroy_write_struct(&png, &info);
free(rows);
return status;
}
if ((format == CAIRO_FORMAT_A8 || format == CAIRO_FORMAT_A1) &&
closure->closure->palette != NULL) {
png_color_type = PNG_COLOR_TYPE_PALETTE;
}
png_set_IHDR(png, info, width, height, bpc, png_color_type, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
if (png_color_type == PNG_COLOR_TYPE_PALETTE) {
size_t nColors = closure->closure->nPaletteColors;
uint8_t* colors = closure->closure->palette;
uint8_t backgroundIndex = closure->closure->backgroundIndex;
png_colorp pngPalette = (png_colorp)png_malloc(png, nColors * sizeof(png_colorp));
png_bytep transparency = (png_bytep)png_malloc(png, nColors * sizeof(png_bytep));
for (i = 0; i < nColors; i++) {
pngPalette[i].red = colors[4 * i];
pngPalette[i].green = colors[4 * i + 1];
pngPalette[i].blue = colors[4 * i + 2];
transparency[i] = colors[4 * i + 3];
}
png_set_PLTE(png, info, pngPalette, nColors);
png_set_tRNS(png, info, transparency, nColors, NULL);
png_set_packing(png); // pack pixels
// have libpng free palette and trans:
png_data_freer(png, info, PNG_DESTROY_WILL_FREE_DATA, PNG_FREE_PLTE | PNG_FREE_TRNS);
png_color_16 bkg;
bkg.index = backgroundIndex;
png_set_bKGD(png, info, &bkg);
}
if (png_color_type != PNG_COLOR_TYPE_PALETTE) {
white.gray = (1 << bpc) - 1;
white.red = white.blue = white.green = white.gray;
png_set_bKGD(png, info, &white);
}
/* We have to call png_write_info() before setting up the write
* transformation, since it stores data internally in 'png'
* that is needed for the write transformation functions to work.
*/
png_write_info(png, info);
if (png_color_type == PNG_COLOR_TYPE_RGB_ALPHA) {
png_set_write_user_transform_fn(png, canvas_unpremultiply_data);
} else if (format == CAIRO_FORMAT_RGB16_565) {
png_set_write_user_transform_fn(png, canvas_convert_565_to_888);
} else if (png_color_type == PNG_COLOR_TYPE_RGB) {
png_set_write_user_transform_fn(png, canvas_convert_data_to_bytes);
png_set_filler(png, 0, PNG_FILLER_AFTER);
}
png_write_image(png, rows);
png_write_end(png, info);
png_destroy_write_struct(&png, &info);
free(rows);
return status;
}
static void canvas_stream_write_func(png_structp png, png_bytep data, png_size_t size) {
cairo_status_t status;
struct canvas_png_write_closure_t *png_closure;
png_closure = (struct canvas_png_write_closure_t *) png_get_io_ptr(png);
status = png_closure->write_func(png_closure->closure, data, size);
if (unlikely(status)) {
cairo_status_t *error = (cairo_status_t *) png_get_error_ptr(png);
if (*error == CAIRO_STATUS_SUCCESS) {
*error = status;
}
png_error(png, NULL);
}
}
static cairo_status_t canvas_write_to_png_stream(cairo_surface_t *surface, cairo_write_func_t write_func, PngClosure* closure) {
struct canvas_png_write_closure_t png_closure;
if (cairo_surface_status(surface)) {
return cairo_surface_status(surface);
}
png_closure.write_func = write_func;
png_closure.closure = closure;
return canvas_write_png(surface, canvas_stream_write_func, &png_closure);
}

View File

@@ -0,0 +1,74 @@
{
"name": "eslint-visitor-keys",
"version": "3.4.3",
"description": "Constants and utilities about visitor keys to traverse AST.",
"type": "module",
"main": "dist/eslint-visitor-keys.cjs",
"types": "./dist/index.d.ts",
"exports": {
".": [
{
"import": "./lib/index.js",
"require": "./dist/eslint-visitor-keys.cjs"
},
"./dist/eslint-visitor-keys.cjs"
],
"./package.json": "./package.json"
},
"files": [
"dist/index.d.ts",
"dist/visitor-keys.d.ts",
"dist/eslint-visitor-keys.cjs",
"dist/eslint-visitor-keys.d.cts",
"lib"
],
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
},
"devDependencies": {
"@types/estree": "^0.0.51",
"@types/estree-jsx": "^0.0.1",
"@typescript-eslint/parser": "^5.14.0",
"c8": "^7.11.0",
"chai": "^4.3.6",
"eslint": "^7.29.0",
"eslint-config-eslint": "^7.0.0",
"eslint-plugin-jsdoc": "^35.4.0",
"eslint-plugin-node": "^11.1.0",
"eslint-release": "^3.2.0",
"esquery": "^1.4.0",
"json-diff": "^0.7.3",
"mocha": "^9.2.1",
"opener": "^1.5.2",
"rollup": "^2.70.0",
"rollup-plugin-dts": "^4.2.3",
"tsd": "^0.19.1",
"typescript": "^4.6.2"
},
"scripts": {
"build": "npm run build:cjs && npm run build:types",
"build:cjs": "rollup -c",
"build:debug": "npm run build:cjs -- -m && npm run build:types",
"build:keys": "node tools/build-keys-from-ts",
"build:types": "tsc",
"lint": "eslint .",
"prepare": "npm run build",
"release:generate:latest": "eslint-generate-release",
"release:generate:alpha": "eslint-generate-prerelease alpha",
"release:generate:beta": "eslint-generate-prerelease beta",
"release:generate:rc": "eslint-generate-prerelease rc",
"release:publish": "eslint-publish-release",
"test": "mocha tests/lib/**/*.cjs && c8 mocha tests/lib/**/*.js && npm run test:types",
"test:open-coverage": "c8 report --reporter lcov && opener coverage/lcov-report/index.html",
"test:types": "tsd"
},
"repository": "eslint/eslint-visitor-keys",
"funding": "https://opencollective.com/eslint",
"keywords": [],
"author": "Toru Nagashima (https://github.com/mysticatea)",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/eslint/eslint-visitor-keys/issues"
},
"homepage": "https://github.com/eslint/eslint-visitor-keys#readme"
}

View File

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