update
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
height="40"
|
||||
width="40"
|
||||
viewBox="0 0 40 40">
|
||||
<rect
|
||||
style="fill:#ffff00;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||
width="33.76017"
|
||||
height="33.76017"
|
||||
x="3.119915"
|
||||
y="3.119915" />
|
||||
<path
|
||||
d="m 20.677967,8.54499 c -7.342801,0 -13.295293,4.954293 -13.295293,11.065751 0,2.088793 0.3647173,3.484376 1.575539,5.150563 L 6.0267418,31.45501 13.560595,29.011117 c 2.221262,1.387962 4.125932,1.665377 7.117372,1.665377 7.3428,0 13.295291,-4.954295 13.295291,-11.065753 0,-6.111458 -5.952491,-11.065751 -13.295291,-11.065751 z"
|
||||
style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:0.93031836;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 883 B |
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"K D E F A mC","388":"B"},B:{"1":"P Q H R S T U","2":"C L M G","129":"N O","513":"0 9 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 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 pB qB rB sB tB uB vB MC qC rC"},D:{"1":"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","2":"1 2 3 4 5 6 7 8 J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB","513":"0 9 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":"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","2":"J PB K D E F A B sC SC tC uC vC wC TC FC","2052":"M yC","3076":"C L GC xC"},F:{"1":"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","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 4C 5C 6C 7C FC kC 8C GC","513":"0 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:{"1":"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 HD ID JD","2052":"KD LD"},H:{"2":"WD"},I:{"1":"I","2":"LC J XD YD ZD aD lC bD cD"},J:{"2":"D A"},K:{"2":"A B C FC kC GC","513":"H"},L:{"513":"I"},M:{"1":"EC"},N:{"2":"A B"},O:{"2":"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:{"16":"oD"},R:{"513":"pD"},S:{"1":"rD","2":"qD"}},B:6,C:"'SameSite' cookie attribute",D:true};
|
||||
Binary file not shown.
@@ -0,0 +1,19 @@
|
||||
# @babel/helper-validator-identifier
|
||||
|
||||
> Validate identifier/keywords name
|
||||
|
||||
See our website [@babel/helper-validator-identifier](https://babeljs.io/docs/babel-helper-validator-identifier) for more information.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save @babel/helper-validator-identifier
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/helper-validator-identifier
|
||||
```
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"2":"K D E F A B mC"},B:{"1":"9 AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I","2":"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","194":"0 n o p q r s t u v w x y z"},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 RC oC pC qC rC"},D:{"1":"9 AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC","2":"1 2 3 4 5 6 7 8 J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R S T U V W X Y Z a b c d e f g h i j k l m","194":"0 n o p q r s t u v w x y z"},E:{"1":"eC fC 2C KC gC hC iC jC 3C","2":"J PB K D E F A B C L M G sC SC tC uC vC wC TC FC GC xC yC zC UC VC HC 0C IC WC XC YC ZC aC 1C JC bC cC dC"},F:{"1":"0 p q r s t u v w x y z","2":"1 2 3 4 5 6 7 8 F B C G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB wB xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y 4C 5C 6C 7C FC kC 8C GC","194":"Z a b c d e f g h i j k l m n o"},G:{"1":"eC fC VD KC gC hC iC jC","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"},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:{"2":"EC"},N:{"2":"A B"},O:{"2":"HC"},P:{"1":"6 7 8","2":"1 2 3 4 5 J dD eD fD gD hD TC iD jD kD lD mD IC JC KC nD"},Q:{"2":"oD"},R:{"2":"pD"},S:{"2":"qD rD"}},B:5,C:"Scoped Styles: the @scope rule",D:true};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"K D E F A B","16":"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 lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC","2":"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 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 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","16":"F"},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:{"1":"WD"},I:{"1":"LC J I ZD aD lC bD cD","16":"XD YD"},J:{"1":"D A"},K:{"1":"A B C H FC kC GC"},L:{"1":"I"},M:{"1":"EC"},N:{"1":"A B"},O:{"1":"HC"},P:{"1":"1 2 3 4 5 6 7 8 J dD eD fD gD hD TC iD jD kD lD mD IC JC KC nD"},Q:{"1":"oD"},R:{"1":"pD"},S:{"1":"qD rD"}},B:1,C:"Element.insertAdjacentElement() & Element.insertAdjacentText()",D:true};
|
||||
@@ -0,0 +1,113 @@
|
||||
// Copyright (c) 2010 LearnBoost <tj@learnboost.com>
|
||||
|
||||
#include "CanvasGradient.h"
|
||||
#include "InstanceData.h"
|
||||
|
||||
#include "Canvas.h"
|
||||
#include "color.h"
|
||||
|
||||
using namespace Napi;
|
||||
|
||||
/*
|
||||
* Initialize CanvasGradient.
|
||||
*/
|
||||
|
||||
void
|
||||
Gradient::Initialize(Napi::Env& env, Napi::Object& exports) {
|
||||
Napi::HandleScope scope(env);
|
||||
InstanceData* data = env.GetInstanceData<InstanceData>();
|
||||
|
||||
Napi::Function ctor = DefineClass(env, "CanvasGradient", {
|
||||
InstanceMethod<&Gradient::AddColorStop>("addColorStop", napi_default_method)
|
||||
});
|
||||
|
||||
exports.Set("CanvasGradient", ctor);
|
||||
data->CanvasGradientCtor = Napi::Persistent(ctor);
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize a new CanvasGradient.
|
||||
*/
|
||||
|
||||
Gradient::Gradient(const Napi::CallbackInfo& info) : Napi::ObjectWrap<Gradient>(info), env(info.Env()) {
|
||||
// Linear
|
||||
if (
|
||||
4 == info.Length() &&
|
||||
info[0].IsNumber() &&
|
||||
info[1].IsNumber() &&
|
||||
info[2].IsNumber() &&
|
||||
info[3].IsNumber()
|
||||
) {
|
||||
double x0 = info[0].As<Napi::Number>().DoubleValue();
|
||||
double y0 = info[1].As<Napi::Number>().DoubleValue();
|
||||
double x1 = info[2].As<Napi::Number>().DoubleValue();
|
||||
double y1 = info[3].As<Napi::Number>().DoubleValue();
|
||||
_pattern = cairo_pattern_create_linear(x0, y0, x1, y1);
|
||||
return;
|
||||
}
|
||||
|
||||
// Radial
|
||||
if (
|
||||
6 == info.Length() &&
|
||||
info[0].IsNumber() &&
|
||||
info[1].IsNumber() &&
|
||||
info[2].IsNumber() &&
|
||||
info[3].IsNumber() &&
|
||||
info[4].IsNumber() &&
|
||||
info[5].IsNumber()
|
||||
) {
|
||||
double x0 = info[0].As<Napi::Number>().DoubleValue();
|
||||
double y0 = info[1].As<Napi::Number>().DoubleValue();
|
||||
double r0 = info[2].As<Napi::Number>().DoubleValue();
|
||||
double x1 = info[3].As<Napi::Number>().DoubleValue();
|
||||
double y1 = info[4].As<Napi::Number>().DoubleValue();
|
||||
double r1 = info[5].As<Napi::Number>().DoubleValue();
|
||||
_pattern = cairo_pattern_create_radial(x0, y0, r0, x1, y1, r1);
|
||||
return;
|
||||
}
|
||||
|
||||
Napi::TypeError::New(env, "invalid arguments").ThrowAsJavaScriptException();
|
||||
}
|
||||
|
||||
/*
|
||||
* Add color stop.
|
||||
*/
|
||||
|
||||
void
|
||||
Gradient::AddColorStop(const Napi::CallbackInfo& info) {
|
||||
if (!info[0].IsNumber()) {
|
||||
Napi::TypeError::New(env, "offset required").ThrowAsJavaScriptException();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!info[1].IsString()) {
|
||||
Napi::TypeError::New(env, "color string required").ThrowAsJavaScriptException();
|
||||
return;
|
||||
}
|
||||
|
||||
short ok;
|
||||
std::string str = info[1].As<Napi::String>();
|
||||
uint32_t rgba = rgba_from_string(str.c_str(), &ok);
|
||||
|
||||
if (ok) {
|
||||
rgba_t color = rgba_create(rgba);
|
||||
cairo_pattern_add_color_stop_rgba(
|
||||
_pattern
|
||||
, info[0].As<Napi::Number>().DoubleValue()
|
||||
, color.r
|
||||
, color.g
|
||||
, color.b
|
||||
, color.a);
|
||||
} else {
|
||||
Napi::TypeError::New(env, "parse color failed").ThrowAsJavaScriptException();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Destroy the pattern.
|
||||
*/
|
||||
|
||||
Gradient::~Gradient() {
|
||||
if (_pattern) cairo_pattern_destroy(_pattern);
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
/**
|
||||
* @fileoverview Require or disallow Unicode BOM
|
||||
* @author Andrew Johnston <https://github.com/ehjay>
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "layout",
|
||||
|
||||
defaultOptions: ["never"],
|
||||
|
||||
docs: {
|
||||
description: "Require or disallow Unicode byte order mark (BOM)",
|
||||
recommended: false,
|
||||
url: "https://eslint.org/docs/latest/rules/unicode-bom",
|
||||
},
|
||||
|
||||
fixable: "whitespace",
|
||||
|
||||
schema: [
|
||||
{
|
||||
enum: ["always", "never"],
|
||||
},
|
||||
],
|
||||
messages: {
|
||||
expected: "Expected Unicode BOM (Byte Order Mark).",
|
||||
unexpected: "Unexpected Unicode BOM (Byte Order Mark).",
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
//--------------------------------------------------------------------------
|
||||
// Public
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
return {
|
||||
Program: function checkUnicodeBOM(node) {
|
||||
const sourceCode = context.sourceCode,
|
||||
location = { column: 0, line: 1 };
|
||||
const [requireBOM] = context.options;
|
||||
|
||||
if (!sourceCode.hasBOM && requireBOM === "always") {
|
||||
context.report({
|
||||
node,
|
||||
loc: location,
|
||||
messageId: "expected",
|
||||
fix(fixer) {
|
||||
return fixer.insertTextBeforeRange(
|
||||
[0, 1],
|
||||
"\uFEFF",
|
||||
);
|
||||
},
|
||||
});
|
||||
} else if (sourceCode.hasBOM && requireBOM === "never") {
|
||||
context.report({
|
||||
node,
|
||||
loc: location,
|
||||
messageId: "unexpected",
|
||||
fix(fixer) {
|
||||
return fixer.removeRange([-1, 0]);
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
module.exports={C:{"4":0.02758,"52":0.01379,"68":0.0046,"78":0.00919,"80":0.0046,"110":0.0046,"115":0.1195,"120":0.01838,"125":0.0046,"128":0.02758,"131":0.0046,"132":0.0046,"133":0.00919,"134":0.00919,"135":0.23899,"136":0.88243,"137":0.00919,_:"2 3 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 69 70 71 72 73 74 75 76 77 79 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 111 112 113 114 116 117 118 119 121 122 123 124 126 127 129 130 138 139 140 3.5 3.6"},D:{"38":0.0046,"39":0.0046,"40":0.0046,"41":0.0046,"42":0.0046,"43":0.0046,"44":0.0046,"45":0.0046,"46":0.0046,"47":0.00919,"48":0.01838,"49":0.01379,"50":0.0046,"51":0.0046,"52":0.0046,"53":0.0046,"54":0.0046,"55":0.0046,"56":0.0046,"57":0.0046,"58":0.05975,"59":0.0046,"60":0.0046,"65":0.0046,"72":0.0046,"74":0.00919,"79":0.05975,"81":0.0046,"85":0.0046,"86":0.0046,"87":0.04136,"90":0.0046,"91":0.0046,"92":0.0046,"93":0.0046,"94":0.0046,"95":0.0046,"96":0.0046,"99":0.0046,"100":0.00919,"101":0.0046,"102":0.01379,"103":0.04596,"104":0.00919,"106":0.0046,"107":0.00919,"108":0.02758,"109":0.91001,"110":0.01379,"111":0.01379,"112":0.02298,"113":0.01379,"114":0.01838,"115":0.00919,"116":0.14248,"117":0.0046,"118":0.02298,"119":0.02758,"120":0.03217,"121":0.02298,"122":0.10571,"123":0.02298,"124":0.07813,"125":0.03217,"126":0.06434,"127":0.07354,"128":0.18844,"129":0.04136,"130":0.08273,"131":0.49637,"132":0.44122,"133":8.78296,"134":18.41158,"135":0.01379,"136":0.0046,_:"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 66 67 68 69 70 71 73 75 76 77 78 80 83 84 88 89 97 98 105 137 138"},F:{"87":0.0046,"95":0.01379,"114":0.00919,"115":0.0046,"116":1.62239,"117":3.29074,_:"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 88 89 90 91 92 93 94 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"16":0.02758,"18":0.0046,"92":0.01379,"109":0.01838,"114":0.01379,"122":0.00919,"124":0.0046,"125":0.0046,"126":0.00919,"127":0.0046,"128":0.00919,"129":0.00919,"130":0.01379,"131":0.05515,"132":0.08732,"133":1.25471,"134":3.20341,_:"12 13 14 15 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 108 110 111 112 113 115 116 117 118 119 120 121 123"},E:{"4":0.0046,"14":0.0046,_:"0 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 15.2-15.3","12.1":0.00919,"13.1":0.03217,"14.1":0.02298,"15.1":0.0046,"15.4":0.0046,"15.5":0.01379,"15.6":0.07354,"16.0":0.01379,"16.1":0.01379,"16.2":0.0046,"16.3":0.02758,"16.4":0.01379,"16.5":0.01379,"16.6":0.08732,"17.0":0.0046,"17.1":0.03217,"17.2":0.0046,"17.3":0.00919,"17.4":0.03677,"17.5":0.05515,"17.6":0.17005,"18.0":0.03677,"18.1":0.07813,"18.2":0.03217,"18.3":0.73076,"18.4":0.02298},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00208,"5.0-5.1":0,"6.0-6.1":0.00623,"7.0-7.1":0.00415,"8.1-8.4":0,"9.0-9.2":0.00312,"9.3":0.01454,"10.0-10.2":0.00104,"10.3":0.02389,"11.0-11.2":0.1101,"11.3-11.4":0.00727,"12.0-12.1":0.00415,"12.2-12.5":0.10283,"13.0-13.1":0.00208,"13.2":0.00312,"13.3":0.00415,"13.4-13.7":0.01454,"14.0-14.4":0.03635,"14.5-14.8":0.04362,"15.0-15.1":0.02389,"15.2-15.3":0.02389,"15.4":0.02908,"15.5":0.03324,"15.6-15.8":0.40923,"16.0":0.05816,"16.1":0.11944,"16.2":0.06232,"16.3":0.10802,"16.4":0.02389,"16.5":0.04466,"16.6-16.7":0.48505,"17.0":0.02908,"17.1":0.05193,"17.2":0.03947,"17.3":0.05505,"17.4":0.1101,"17.5":0.24512,"17.6-17.7":0.71147,"18.0":0.19942,"18.1":0.65227,"18.2":0.29186,"18.3":6.09998,"18.4":0.09036},P:{"4":0.07252,"20":0.01036,"21":0.01036,"22":0.01036,"23":0.03108,"24":0.02072,"25":0.02072,"26":0.06216,"27":1.33651,_:"5.0-5.4 6.2-6.4 8.2 9.2 10.1 12.0 13.0 14.0 15.0 17.0 18.0 19.0","7.2-7.4":0.03108,"11.1-11.2":0.01036,"16.0":0.01036},I:{"0":0.11325,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.00003,"4.4":0,"4.4.3-4.4.4":0.00012},K:{"0":0.23237,_:"10 11 12 11.1 11.5 12.1"},A:{"8":0.01548,"9":0.00516,"10":0.01032,"11":0.22183,_:"6 7 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{"0":0.21616},Q:{_:"14.9"},O:{"0":0.02162},H:{"0":0},L:{"0":42.78582}};
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,186 @@
|
||||
#ifndef SRC_NAPI_INL_DEPRECATED_H_
|
||||
#define SRC_NAPI_INL_DEPRECATED_H_
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// PropertyDescriptor class
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
template <typename Getter>
|
||||
inline PropertyDescriptor PropertyDescriptor::Accessor(
|
||||
const char* utf8name,
|
||||
Getter getter,
|
||||
napi_property_attributes attributes,
|
||||
void* /*data*/) {
|
||||
using CbData = details::CallbackData<Getter, Napi::Value>;
|
||||
// TODO: Delete when the function is destroyed
|
||||
auto callbackData = new CbData({getter, nullptr});
|
||||
|
||||
return PropertyDescriptor({utf8name,
|
||||
nullptr,
|
||||
nullptr,
|
||||
CbData::Wrapper,
|
||||
nullptr,
|
||||
nullptr,
|
||||
attributes,
|
||||
callbackData});
|
||||
}
|
||||
|
||||
template <typename Getter>
|
||||
inline PropertyDescriptor PropertyDescriptor::Accessor(
|
||||
const std::string& utf8name,
|
||||
Getter getter,
|
||||
napi_property_attributes attributes,
|
||||
void* data) {
|
||||
return Accessor(utf8name.c_str(), getter, attributes, data);
|
||||
}
|
||||
|
||||
template <typename Getter>
|
||||
inline PropertyDescriptor PropertyDescriptor::Accessor(
|
||||
napi_value name,
|
||||
Getter getter,
|
||||
napi_property_attributes attributes,
|
||||
void* /*data*/) {
|
||||
using CbData = details::CallbackData<Getter, Napi::Value>;
|
||||
// TODO: Delete when the function is destroyed
|
||||
auto callbackData = new CbData({getter, nullptr});
|
||||
|
||||
return PropertyDescriptor({nullptr,
|
||||
name,
|
||||
nullptr,
|
||||
CbData::Wrapper,
|
||||
nullptr,
|
||||
nullptr,
|
||||
attributes,
|
||||
callbackData});
|
||||
}
|
||||
|
||||
template <typename Getter>
|
||||
inline PropertyDescriptor PropertyDescriptor::Accessor(
|
||||
Name name, Getter getter, napi_property_attributes attributes, void* data) {
|
||||
napi_value nameValue = name;
|
||||
return PropertyDescriptor::Accessor(nameValue, getter, attributes, data);
|
||||
}
|
||||
|
||||
template <typename Getter, typename Setter>
|
||||
inline PropertyDescriptor PropertyDescriptor::Accessor(
|
||||
const char* utf8name,
|
||||
Getter getter,
|
||||
Setter setter,
|
||||
napi_property_attributes attributes,
|
||||
void* /*data*/) {
|
||||
using CbData = details::AccessorCallbackData<Getter, Setter>;
|
||||
// TODO: Delete when the function is destroyed
|
||||
auto callbackData = new CbData({getter, setter, nullptr});
|
||||
|
||||
return PropertyDescriptor({utf8name,
|
||||
nullptr,
|
||||
nullptr,
|
||||
CbData::GetterWrapper,
|
||||
CbData::SetterWrapper,
|
||||
nullptr,
|
||||
attributes,
|
||||
callbackData});
|
||||
}
|
||||
|
||||
template <typename Getter, typename Setter>
|
||||
inline PropertyDescriptor PropertyDescriptor::Accessor(
|
||||
const std::string& utf8name,
|
||||
Getter getter,
|
||||
Setter setter,
|
||||
napi_property_attributes attributes,
|
||||
void* data) {
|
||||
return Accessor(utf8name.c_str(), getter, setter, attributes, data);
|
||||
}
|
||||
|
||||
template <typename Getter, typename Setter>
|
||||
inline PropertyDescriptor PropertyDescriptor::Accessor(
|
||||
napi_value name,
|
||||
Getter getter,
|
||||
Setter setter,
|
||||
napi_property_attributes attributes,
|
||||
void* /*data*/) {
|
||||
using CbData = details::AccessorCallbackData<Getter, Setter>;
|
||||
// TODO: Delete when the function is destroyed
|
||||
auto callbackData = new CbData({getter, setter, nullptr});
|
||||
|
||||
return PropertyDescriptor({nullptr,
|
||||
name,
|
||||
nullptr,
|
||||
CbData::GetterWrapper,
|
||||
CbData::SetterWrapper,
|
||||
nullptr,
|
||||
attributes,
|
||||
callbackData});
|
||||
}
|
||||
|
||||
template <typename Getter, typename Setter>
|
||||
inline PropertyDescriptor PropertyDescriptor::Accessor(
|
||||
Name name,
|
||||
Getter getter,
|
||||
Setter setter,
|
||||
napi_property_attributes attributes,
|
||||
void* data) {
|
||||
napi_value nameValue = name;
|
||||
return PropertyDescriptor::Accessor(
|
||||
nameValue, getter, setter, attributes, data);
|
||||
}
|
||||
|
||||
template <typename Callable>
|
||||
inline PropertyDescriptor PropertyDescriptor::Function(
|
||||
const char* utf8name,
|
||||
Callable cb,
|
||||
napi_property_attributes attributes,
|
||||
void* /*data*/) {
|
||||
using ReturnType = decltype(cb(CallbackInfo(nullptr, nullptr)));
|
||||
using CbData = details::CallbackData<Callable, ReturnType>;
|
||||
// TODO: Delete when the function is destroyed
|
||||
auto callbackData = new CbData({cb, nullptr});
|
||||
|
||||
return PropertyDescriptor({utf8name,
|
||||
nullptr,
|
||||
CbData::Wrapper,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
attributes,
|
||||
callbackData});
|
||||
}
|
||||
|
||||
template <typename Callable>
|
||||
inline PropertyDescriptor PropertyDescriptor::Function(
|
||||
const std::string& utf8name,
|
||||
Callable cb,
|
||||
napi_property_attributes attributes,
|
||||
void* data) {
|
||||
return Function(utf8name.c_str(), cb, attributes, data);
|
||||
}
|
||||
|
||||
template <typename Callable>
|
||||
inline PropertyDescriptor PropertyDescriptor::Function(
|
||||
napi_value name,
|
||||
Callable cb,
|
||||
napi_property_attributes attributes,
|
||||
void* /*data*/) {
|
||||
using ReturnType = decltype(cb(CallbackInfo(nullptr, nullptr)));
|
||||
using CbData = details::CallbackData<Callable, ReturnType>;
|
||||
// TODO: Delete when the function is destroyed
|
||||
auto callbackData = new CbData({cb, nullptr});
|
||||
|
||||
return PropertyDescriptor({nullptr,
|
||||
name,
|
||||
CbData::Wrapper,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
attributes,
|
||||
callbackData});
|
||||
}
|
||||
|
||||
template <typename Callable>
|
||||
inline PropertyDescriptor PropertyDescriptor::Function(
|
||||
Name name, Callable cb, napi_property_attributes attributes, void* data) {
|
||||
napi_value nameValue = name;
|
||||
return PropertyDescriptor::Function(nameValue, cb, attributes, data);
|
||||
}
|
||||
|
||||
#endif // !SRC_NAPI_INL_DEPRECATED_H_
|
||||
@@ -0,0 +1,36 @@
|
||||
import type { SourceMapSegment } from './sourcemap-segment';
|
||||
export interface SourceMapV3 {
|
||||
file?: string | null;
|
||||
names: readonly string[];
|
||||
sourceRoot?: string;
|
||||
sources: readonly (string | null)[];
|
||||
sourcesContent?: readonly (string | null)[];
|
||||
version: 3;
|
||||
ignoreList?: readonly number[];
|
||||
}
|
||||
export interface EncodedSourceMap extends SourceMapV3 {
|
||||
mappings: string;
|
||||
}
|
||||
export interface DecodedSourceMap extends SourceMapV3 {
|
||||
mappings: readonly SourceMapSegment[][];
|
||||
}
|
||||
export interface Pos {
|
||||
line: number;
|
||||
column: number;
|
||||
}
|
||||
export declare type Mapping = {
|
||||
generated: Pos;
|
||||
source: undefined;
|
||||
original: undefined;
|
||||
name: undefined;
|
||||
} | {
|
||||
generated: Pos;
|
||||
source: string;
|
||||
original: Pos;
|
||||
name: string;
|
||||
} | {
|
||||
generated: Pos;
|
||||
source: string;
|
||||
original: Pos;
|
||||
name: undefined;
|
||||
};
|
||||
@@ -0,0 +1,90 @@
|
||||
/**
|
||||
* @fileoverview Disallow shadowing of NaN, undefined, and Infinity (ES5 section 15.1.1)
|
||||
* @author Michael Ficarra
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Determines if a variable safely shadows undefined.
|
||||
* This is the case when a variable named `undefined` is never assigned to a value (i.e. it always shares the same value
|
||||
* as the global).
|
||||
* @param {eslintScope.Variable} variable The variable to check
|
||||
* @returns {boolean} true if this variable safely shadows `undefined`
|
||||
*/
|
||||
function safelyShadowsUndefined(variable) {
|
||||
return (
|
||||
variable.name === "undefined" &&
|
||||
variable.references.every(ref => !ref.isWrite()) &&
|
||||
variable.defs.every(
|
||||
def =>
|
||||
def.node.type === "VariableDeclarator" &&
|
||||
def.node.init === null,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "suggestion",
|
||||
|
||||
docs: {
|
||||
description: "Disallow identifiers from shadowing restricted names",
|
||||
recommended: true,
|
||||
url: "https://eslint.org/docs/latest/rules/no-shadow-restricted-names",
|
||||
},
|
||||
|
||||
schema: [],
|
||||
|
||||
messages: {
|
||||
shadowingRestrictedName: "Shadowing of global property '{{name}}'.",
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const RESTRICTED = new Set([
|
||||
"undefined",
|
||||
"NaN",
|
||||
"Infinity",
|
||||
"arguments",
|
||||
"eval",
|
||||
]);
|
||||
const sourceCode = context.sourceCode;
|
||||
|
||||
// Track reported nodes to avoid duplicate reports. For example, on class declarations.
|
||||
const reportedNodes = new Set();
|
||||
|
||||
return {
|
||||
"VariableDeclaration, :function, CatchClause, ImportDeclaration, ClassDeclaration, ClassExpression"(
|
||||
node,
|
||||
) {
|
||||
for (const variable of sourceCode.getDeclaredVariables(node)) {
|
||||
if (
|
||||
variable.defs.length > 0 &&
|
||||
RESTRICTED.has(variable.name) &&
|
||||
!safelyShadowsUndefined(variable)
|
||||
) {
|
||||
for (const def of variable.defs) {
|
||||
const nodeToReport = def.name;
|
||||
|
||||
if (!reportedNodes.has(nodeToReport)) {
|
||||
reportedNodes.add(nodeToReport);
|
||||
context.report({
|
||||
node: nodeToReport,
|
||||
messageId: "shadowingRestrictedName",
|
||||
data: {
|
||||
name: variable.name,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
let { nanoid, customAlphabet } = require('..')
|
||||
|
||||
function print(msg) {
|
||||
process.stdout.write(msg + '\n')
|
||||
}
|
||||
|
||||
function error(msg) {
|
||||
process.stderr.write(msg + '\n')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
if (process.argv.includes('--help') || process.argv.includes('-h')) {
|
||||
print(`
|
||||
Usage
|
||||
$ nanoid [options]
|
||||
|
||||
Options
|
||||
-s, --size Generated ID size
|
||||
-a, --alphabet Alphabet to use
|
||||
-h, --help Show this help
|
||||
|
||||
Examples
|
||||
$ nanoid --s 15
|
||||
S9sBF77U6sDB8Yg
|
||||
|
||||
$ nanoid --size 10 --alphabet abc
|
||||
bcabababca`)
|
||||
process.exit()
|
||||
}
|
||||
|
||||
let alphabet, size
|
||||
for (let i = 2; i < process.argv.length; i++) {
|
||||
let arg = process.argv[i]
|
||||
if (arg === '--size' || arg === '-s') {
|
||||
size = Number(process.argv[i + 1])
|
||||
i += 1
|
||||
if (Number.isNaN(size) || size <= 0) {
|
||||
error('Size must be positive integer')
|
||||
}
|
||||
} else if (arg === '--alphabet' || arg === '-a') {
|
||||
alphabet = process.argv[i + 1]
|
||||
i += 1
|
||||
} else {
|
||||
error('Unknown argument ' + arg)
|
||||
}
|
||||
}
|
||||
|
||||
if (alphabet) {
|
||||
let customNanoid = customAlphabet(alphabet, size)
|
||||
print(customNanoid())
|
||||
} else {
|
||||
print(nanoid(size))
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={C:{"48":0.00915,"52":0.06402,"60":0.05945,"61":0.00457,"68":0.00457,"78":0.15548,"91":0.01829,"100":0.00457,"101":0.01829,"102":0.1189,"104":0.00457,"108":0.10975,"111":0.00457,"115":0.55791,"122":0.03201,"123":0.10061,"124":0.02744,"125":0.01829,"126":0.00457,"127":0.00457,"128":2.42826,"129":0.00915,"130":0.00915,"131":0.00457,"132":0.01372,"133":0.05945,"134":0.0686,"135":0.78656,"136":2.70722,"137":0.00457,_:"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 62 63 64 65 66 67 69 70 71 72 73 74 75 76 77 79 80 81 82 83 84 85 86 87 88 89 90 92 93 94 95 96 97 98 99 103 105 106 107 109 110 112 113 114 116 117 118 119 120 121 138 139 140 3.5 3.6"},D:{"11":0.00915,"79":0.11433,"80":0.00457,"81":0.00457,"86":0.00457,"87":0.01829,"88":0.01372,"89":0.00457,"90":0.04573,"91":0.01372,"94":0.00457,"95":0.00457,"97":0.00915,"98":0.00915,"99":0.00915,"100":0.00457,"101":0.01829,"102":0.0503,"103":0.02287,"104":0.00457,"105":0.02744,"106":0.0503,"107":0.0503,"108":0.14176,"109":0.49388,"110":0.01372,"111":0.02287,"112":0.06402,"113":0.00457,"114":0.28353,"116":0.17835,"117":0.02744,"118":0.76826,"119":0.0686,"120":0.1692,"121":0.15091,"122":0.24694,"123":0.05945,"124":0.07774,"125":0.03201,"126":0.09603,"127":0.03201,"128":0.10975,"129":0.02744,"130":0.05488,"131":0.35669,"132":0.4573,"133":5.0989,"134":9.15515,"135":0.00915,"136":0.01372,_:"4 5 6 7 8 9 10 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 83 84 85 92 93 96 115 137 138"},F:{"46":0.00915,"84":0.00457,"87":0.03658,"88":0.00915,"95":0.01829,"96":0.05488,"102":0.00457,"107":0.00457,"114":0.00457,"115":0.00457,"116":0.25609,"117":1.29416,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 85 86 89 90 91 92 93 94 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.01372,"92":0.00457,"100":0.00915,"101":0.00457,"102":0.03201,"103":0.00457,"106":0.01829,"107":0.00915,"108":0.02287,"109":0.01829,"111":0.00457,"114":0.00457,"118":0.00457,"119":0.01372,"120":0.00915,"121":0.01829,"122":0.02287,"123":0.03658,"125":0.00457,"126":0.04116,"128":0.00915,"129":0.02744,"130":0.1692,"131":0.21493,"132":0.20579,"133":1.62799,"134":3.87333,_:"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 104 105 110 112 113 115 116 117 124 127"},E:{"9":0.00457,"14":0.01829,"15":0.00915,_:"0 4 5 6 7 8 10 11 12 13 3.1 3.2 5.1 6.1 7.1 9.1 10.1 11.1","12.1":0.00457,"13.1":0.0503,"14.1":0.12347,"15.1":0.00457,"15.2-15.3":0.00457,"15.4":0.03201,"15.5":0.04573,"15.6":0.38871,"16.0":0.1189,"16.1":0.16006,"16.2":0.07774,"16.3":0.20121,"16.4":0.03201,"16.5":0.11433,"16.6":0.35669,"17.0":0.16006,"17.1":0.30182,"17.2":0.05488,"17.3":0.10061,"17.4":0.12347,"17.5":0.3384,"17.6":0.66766,"18.0":0.17835,"18.1":1.07923,"18.2":0.4573,"18.3":2.83526,"18.4":0.04116},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00386,"5.0-5.1":0,"6.0-6.1":0.01159,"7.0-7.1":0.00773,"8.1-8.4":0,"9.0-9.2":0.00579,"9.3":0.02704,"10.0-10.2":0.00193,"10.3":0.04443,"11.0-11.2":0.20476,"11.3-11.4":0.01352,"12.0-12.1":0.00773,"12.2-12.5":0.19123,"13.0-13.1":0.00386,"13.2":0.00579,"13.3":0.00773,"13.4-13.7":0.02704,"14.0-14.4":0.06761,"14.5-14.8":0.08113,"15.0-15.1":0.04443,"15.2-15.3":0.04443,"15.4":0.05409,"15.5":0.06181,"15.6-15.8":0.76107,"16.0":0.10817,"16.1":0.22214,"16.2":0.1159,"16.3":0.20089,"16.4":0.04443,"16.5":0.08306,"16.6-16.7":0.90208,"17.0":0.05409,"17.1":0.09658,"17.2":0.0734,"17.3":0.10238,"17.4":0.20476,"17.5":0.45587,"17.6-17.7":1.32318,"18.0":0.37088,"18.1":1.21308,"18.2":0.5428,"18.3":11.34462,"18.4":0.16805},P:{"4":0.17678,"20":0.0104,"21":0.06239,"22":0.0104,"23":0.07279,"24":0.05199,"25":0.05199,"26":0.08319,"27":3.28596,"5.0-5.4":0.0104,"6.2-6.4":0.0104,"7.2-7.4":0.0104,_:"8.2 9.2 10.1 11.1-11.2 12.0 13.0 14.0 15.0 16.0 18.0 19.0","17.0":0.0208},I:{"0":0.26532,"3":0,"4":0,"2.1":0,"2.2":0,"2.3":0,"4.1":0,"4.2-4.3":0.00008,"4.4":0,"4.4.3-4.4.4":0.00029},K:{"0":0.54803,_:"10 11 12 11.1 11.5 12.1"},A:{"11":0.09146,_:"6 7 8 9 10 5.5"},S:{_:"2.5 3.0-3.1"},J:{_:"7 10"},N:{_:"10 11"},R:{_:"0"},M:{"0":1.36735},Q:{"14.9":1.45417},O:{"0":1.18287},H:{"0":0},L:{"0":26.41291}};
|
||||
@@ -0,0 +1 @@
|
||||
module.exports={A:{A:{"1":"K D E F A B","16":"mC"},B:{"1":"0 9 C L M G N O P Q H R S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I"},C:{"1":"0 1 2 3 4 5 6 7 8 9 LC J PB K D E F A B C L M G N O P QB RB SB TB UB VB WB XB YB ZB aB bB cB dB eB fB gB hB iB jB kB lB mB nB oB pB qB rB sB tB uB vB MC wB NC xB yB zB 0B 1B 2B 3B 4B 5B 6B 7B 8B 9B AC BC CC DC Q H R OC S T U V W X Y Z a b c d e f g h i j k l m n o p q r s t u v w x y z AB BB CB DB EB FB GB HB IB JB KB LB MB NB OB I PC EC QC RC oC pC qC rC","16":"nC"},D:{"1":"0 1 2 3 4 5 6 7 8 9 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","16":"J PB K D E F A B C L M"},E:{"1":"PB 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","16":"J 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 FC kC 8C GC","16":"F 4C 5C 6C 7C"},G:{"1":"E 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","16":"SC"},H:{"1":"WD"},I:{"1":"LC J I ZD aD lC bD cD","16":"XD YD"},J:{"1":"D A"},K:{"1":"C H GC","16":"A B FC kC"},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:"document.elementFromPoint()",D:true};
|
||||
Binary file not shown.
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = ensureBlock;
|
||||
var _toBlock = require("./toBlock.js");
|
||||
function ensureBlock(node, key = "body") {
|
||||
const result = (0, _toBlock.default)(node[key], node);
|
||||
node[key] = result;
|
||||
return result;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=ensureBlock.js.map
|
||||
@@ -0,0 +1,166 @@
|
||||
/**
|
||||
* @fileoverview Rule to disallow empty functions.
|
||||
* @author Toru Nagashima
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Requirements
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const astUtils = require("./utils/ast-utils");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const ALLOW_OPTIONS = Object.freeze([
|
||||
"functions",
|
||||
"arrowFunctions",
|
||||
"generatorFunctions",
|
||||
"methods",
|
||||
"generatorMethods",
|
||||
"getters",
|
||||
"setters",
|
||||
"constructors",
|
||||
"asyncFunctions",
|
||||
"asyncMethods",
|
||||
]);
|
||||
|
||||
/**
|
||||
* Gets the kind of a given function node.
|
||||
* @param {ASTNode} node A function node to get. This is one of
|
||||
* an ArrowFunctionExpression, a FunctionDeclaration, or a
|
||||
* FunctionExpression.
|
||||
* @returns {string} The kind of the function. This is one of "functions",
|
||||
* "arrowFunctions", "generatorFunctions", "asyncFunctions", "methods",
|
||||
* "generatorMethods", "asyncMethods", "getters", "setters", and
|
||||
* "constructors".
|
||||
*/
|
||||
function getKind(node) {
|
||||
const parent = node.parent;
|
||||
let kind;
|
||||
|
||||
if (node.type === "ArrowFunctionExpression") {
|
||||
return "arrowFunctions";
|
||||
}
|
||||
|
||||
// Detects main kind.
|
||||
if (parent.type === "Property") {
|
||||
if (parent.kind === "get") {
|
||||
return "getters";
|
||||
}
|
||||
if (parent.kind === "set") {
|
||||
return "setters";
|
||||
}
|
||||
kind = parent.method ? "methods" : "functions";
|
||||
} else if (parent.type === "MethodDefinition") {
|
||||
if (parent.kind === "get") {
|
||||
return "getters";
|
||||
}
|
||||
if (parent.kind === "set") {
|
||||
return "setters";
|
||||
}
|
||||
if (parent.kind === "constructor") {
|
||||
return "constructors";
|
||||
}
|
||||
kind = "methods";
|
||||
} else {
|
||||
kind = "functions";
|
||||
}
|
||||
|
||||
// Detects prefix.
|
||||
let prefix;
|
||||
|
||||
if (node.generator) {
|
||||
prefix = "generator";
|
||||
} else if (node.async) {
|
||||
prefix = "async";
|
||||
} else {
|
||||
return kind;
|
||||
}
|
||||
return prefix + kind[0].toUpperCase() + kind.slice(1);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/** @type {import('../shared/types').Rule} */
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "suggestion",
|
||||
|
||||
defaultOptions: [{ allow: [] }],
|
||||
|
||||
docs: {
|
||||
description: "Disallow empty functions",
|
||||
recommended: false,
|
||||
url: "https://eslint.org/docs/latest/rules/no-empty-function",
|
||||
},
|
||||
|
||||
schema: [
|
||||
{
|
||||
type: "object",
|
||||
properties: {
|
||||
allow: {
|
||||
type: "array",
|
||||
items: { enum: ALLOW_OPTIONS },
|
||||
uniqueItems: true,
|
||||
},
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
],
|
||||
|
||||
messages: {
|
||||
unexpected: "Unexpected empty {{name}}.",
|
||||
},
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const [{ allow }] = context.options;
|
||||
const sourceCode = context.sourceCode;
|
||||
|
||||
/**
|
||||
* Reports a given function node if the node matches the following patterns.
|
||||
*
|
||||
* - Not allowed by options.
|
||||
* - The body is empty.
|
||||
* - The body doesn't have any comments.
|
||||
* @param {ASTNode} node A function node to report. This is one of
|
||||
* an ArrowFunctionExpression, a FunctionDeclaration, or a
|
||||
* FunctionExpression.
|
||||
* @returns {void}
|
||||
*/
|
||||
function reportIfEmpty(node) {
|
||||
const kind = getKind(node);
|
||||
const name = astUtils.getFunctionNameWithKind(node);
|
||||
const innerComments = sourceCode.getTokens(node.body, {
|
||||
includeComments: true,
|
||||
filter: astUtils.isCommentToken,
|
||||
});
|
||||
|
||||
if (
|
||||
!allow.includes(kind) &&
|
||||
node.body.type === "BlockStatement" &&
|
||||
node.body.body.length === 0 &&
|
||||
innerComments.length === 0
|
||||
) {
|
||||
context.report({
|
||||
node,
|
||||
loc: node.body.loc,
|
||||
messageId: "unexpected",
|
||||
data: { name },
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
ArrowFunctionExpression: reportIfEmpty,
|
||||
FunctionDeclaration: reportIfEmpty,
|
||||
FunctionExpression: reportIfEmpty,
|
||||
};
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"names":["_index","require","CLEAR_KEYS","CLEAR_KEYS_PLUS_COMMENTS","COMMENT_KEYS","removeProperties","node","opts","map","preserveComments","key","undefined","Object","keys","symbols","getOwnPropertySymbols","sym"],"sources":["../../src/modifications/removeProperties.ts"],"sourcesContent":["import { COMMENT_KEYS } from \"../constants/index.ts\";\nimport type * as t from \"../index.ts\";\n\nconst CLEAR_KEYS = [\n \"tokens\", // only exist in t.File\n \"start\",\n \"end\",\n \"loc\",\n // Fixme: should be extra.raw / extra.rawValue?\n \"raw\",\n \"rawValue\",\n] as const;\n\nconst CLEAR_KEYS_PLUS_COMMENTS = [\n ...COMMENT_KEYS,\n \"comments\",\n ...CLEAR_KEYS,\n] as const;\n\nexport type Options = { preserveComments?: boolean };\n/**\n * Remove all of the _* properties from a node along with the additional metadata\n * properties like location data and raw token data.\n */\nexport default function removeProperties(\n node: t.Node,\n opts: Options = {},\n): void {\n const map = opts.preserveComments ? CLEAR_KEYS : CLEAR_KEYS_PLUS_COMMENTS;\n for (const key of map) {\n // @ts-expect-error tokens only exist in t.File\n if (node[key] != null) node[key] = undefined;\n }\n\n for (const key of Object.keys(node)) {\n // @ts-expect-error string can not index node\n if (key[0] === \"_\" && node[key] != null) node[key] = undefined;\n }\n\n const symbols: Array<symbol> = Object.getOwnPropertySymbols(node);\n for (const sym of symbols) {\n // @ts-expect-error Fixme: document symbol properties\n node[sym] = null;\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAGA,MAAMC,UAAU,GAAG,CACjB,QAAQ,EACR,OAAO,EACP,KAAK,EACL,KAAK,EAEL,KAAK,EACL,UAAU,CACF;AAEV,MAAMC,wBAAwB,GAAG,CAC/B,GAAGC,mBAAY,EACf,UAAU,EACV,GAAGF,UAAU,CACL;AAOK,SAASG,gBAAgBA,CACtCC,IAAY,EACZC,IAAa,GAAG,CAAC,CAAC,EACZ;EACN,MAAMC,GAAG,GAAGD,IAAI,CAACE,gBAAgB,GAAGP,UAAU,GAAGC,wBAAwB;EACzE,KAAK,MAAMO,GAAG,IAAIF,GAAG,EAAE;IAErB,IAAIF,IAAI,CAACI,GAAG,CAAC,IAAI,IAAI,EAAEJ,IAAI,CAACI,GAAG,CAAC,GAAGC,SAAS;EAC9C;EAEA,KAAK,MAAMD,GAAG,IAAIE,MAAM,CAACC,IAAI,CAACP,IAAI,CAAC,EAAE;IAEnC,IAAII,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,IAAIJ,IAAI,CAACI,GAAG,CAAC,IAAI,IAAI,EAAEJ,IAAI,CAACI,GAAG,CAAC,GAAGC,SAAS;EAChE;EAEA,MAAMG,OAAsB,GAAGF,MAAM,CAACG,qBAAqB,CAACT,IAAI,CAAC;EACjE,KAAK,MAAMU,GAAG,IAAIF,OAAO,EAAE;IAEzBR,IAAI,CAACU,GAAG,CAAC,GAAG,IAAI;EAClB;AACF","ignoreList":[]}
|
||||
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"name": "eslint-visitor-keys",
|
||||
"version": "4.2.0",
|
||||
"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": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/estree": "^0.0.51",
|
||||
"@types/estree-jsx": "^0.0.1",
|
||||
"@typescript-eslint/parser": "^8.7.0",
|
||||
"c8": "^7.11.0",
|
||||
"chai": "^4.3.6",
|
||||
"eslint-release": "^3.2.0",
|
||||
"esquery": "^1.4.0",
|
||||
"json-diff": "^0.7.3",
|
||||
"mocha": "^9.2.1",
|
||||
"opener": "^1.5.2",
|
||||
"rollup": "^4.22.4",
|
||||
"rollup-plugin-dts": "^6.1.1",
|
||||
"tsd": "^0.31.2",
|
||||
"typescript": "^5.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:types": "tsc -v && tsc",
|
||||
"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/js",
|
||||
"funding": "https://opencollective.com/eslint",
|
||||
"keywords": [],
|
||||
"author": "Toru Nagashima (https://github.com/mysticatea)",
|
||||
"license": "Apache-2.0",
|
||||
"bugs": {
|
||||
"url": "https://github.com/eslint/js/issues"
|
||||
},
|
||||
"homepage": "https://github.com/eslint/js/blob/main/packages/eslint-visitor-keys/README.md"
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.transformFromAst = void 0;
|
||||
exports.transformFromAstAsync = transformFromAstAsync;
|
||||
exports.transformFromAstSync = transformFromAstSync;
|
||||
function _gensync() {
|
||||
const data = require("gensync");
|
||||
_gensync = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
var _index = require("./config/index.js");
|
||||
var _index2 = require("./transformation/index.js");
|
||||
var _rewriteStackTrace = require("./errors/rewrite-stack-trace.js");
|
||||
const transformFromAstRunner = _gensync()(function* (ast, code, opts) {
|
||||
const config = yield* (0, _index.default)(opts);
|
||||
if (config === null) return null;
|
||||
if (!ast) throw new Error("No AST given");
|
||||
return yield* (0, _index2.run)(config, code, ast);
|
||||
});
|
||||
const transformFromAst = exports.transformFromAst = function transformFromAst(ast, code, optsOrCallback, maybeCallback) {
|
||||
let opts;
|
||||
let callback;
|
||||
if (typeof optsOrCallback === "function") {
|
||||
callback = optsOrCallback;
|
||||
opts = undefined;
|
||||
} else {
|
||||
opts = optsOrCallback;
|
||||
callback = maybeCallback;
|
||||
}
|
||||
if (callback === undefined) {
|
||||
{
|
||||
return (0, _rewriteStackTrace.beginHiddenCallStack)(transformFromAstRunner.sync)(ast, code, opts);
|
||||
}
|
||||
}
|
||||
(0, _rewriteStackTrace.beginHiddenCallStack)(transformFromAstRunner.errback)(ast, code, opts, callback);
|
||||
};
|
||||
function transformFromAstSync(...args) {
|
||||
return (0, _rewriteStackTrace.beginHiddenCallStack)(transformFromAstRunner.sync)(...args);
|
||||
}
|
||||
function transformFromAstAsync(...args) {
|
||||
return (0, _rewriteStackTrace.beginHiddenCallStack)(transformFromAstRunner.async)(...args);
|
||||
}
|
||||
0 && 0;
|
||||
|
||||
//# sourceMappingURL=transform-ast.js.map
|
||||
Binary file not shown.
Reference in New Issue
Block a user