docs: 仓库链接指向本镜像仓库
Dev Build / cleanup (push) Waiting to run
Dev Build / typecheck (push) Waiting to run

This commit is contained in:
TanTan committed 2026-11-13 09:27:07 +08:00
1 parent fa9c73363d
commit 2a69b23b47
18210 files changed
+5101211 -16

No files matched your search

@@ -0,0 +1 @@
{"version":3,"names":["_utils","require","defineType","visitor","aliases","fields","process","env","BABEL_TYPES_8_BREAKING","object","validate","Object","assign","oneOfNodeTypes","callee","assertNodeType","expression","builder","body","async","assertValueType","default","exported","properties","validateArrayOfType","elements","arrayOfType","value"],"sources":["../../src/definitions/experimental.ts"],"sourcesContent":["import defineType, {\n arrayOfType,\n assertNodeType,\n assertValueType,\n validateArrayOfType,\n type ValidatorOneOfNodeTypes,\n} from \"./utils.ts\";\n\ndefineType(\"ArgumentPlaceholder\", {});\n\ndefineType(\"BindExpression\", {\n visitor: [\"object\", \"callee\"],\n aliases: [\"Expression\"],\n fields:\n !process.env.BABEL_8_BREAKING && !process.env.BABEL_TYPES_8_BREAKING\n ? {\n object: {\n validate: Object.assign(() => {}, {\n oneOfNodeTypes: [\"Expression\"] as const,\n }) satisfies ValidatorOneOfNodeTypes,\n },\n callee: {\n validate: Object.assign(() => {}, {\n oneOfNodeTypes: [\"Expression\"] as const,\n }) satisfies ValidatorOneOfNodeTypes,\n },\n }\n : {\n object: {\n validate: assertNodeType(\"Expression\"),\n },\n callee: {\n validate: assertNodeType(\"Expression\"),\n },\n },\n});\n\ndefineType(\"Decorator\", {\n visitor: [\"expression\"],\n fields: {\n expression: {\n validate: assertNodeType(\"Expression\"),\n },\n },\n});\n\ndefineType(\"DoExpression\", {\n visitor: [\"body\"],\n builder: [\"body\", \"async\"],\n aliases: [\"Expression\"],\n fields: {\n body: {\n validate: assertNodeType(\"BlockStatement\"),\n },\n async: {\n validate: assertValueType(\"boolean\"),\n default: false,\n },\n },\n});\n\ndefineType(\"ExportDefaultSpecifier\", {\n visitor: [\"exported\"],\n aliases: [\"ModuleSpecifier\"],\n fields: {\n exported: {\n validate: assertNodeType(\"Identifier\"),\n },\n },\n});\n\nif (!process.env.BABEL_8_BREAKING) {\n defineType(\"RecordExpression\", {\n visitor: [\"properties\"],\n aliases: [\"Expression\"],\n fields: {\n properties: validateArrayOfType(\"ObjectProperty\", \"SpreadElement\"),\n },\n });\n\n defineType(\"TupleExpression\", {\n fields: {\n elements: {\n validate: arrayOfType(\"Expression\", \"SpreadElement\"),\n default: [],\n },\n },\n visitor: [\"elements\"],\n aliases: [\"Expression\"],\n });\n\n defineType(\"DecimalLiteral\", {\n builder: [\"value\"],\n fields: {\n value: {\n validate: assertValueType(\"string\"),\n },\n },\n aliases: [\"Expression\", \"Pureish\", \"Literal\", \"Immutable\"],\n });\n}\n\n// https://github.com/tc39/proposal-js-module-blocks\ndefineType(\"ModuleExpression\", {\n visitor: [\"body\"],\n fields: {\n body: {\n validate: assertNodeType(\"Program\"),\n },\n },\n aliases: [\"Expression\"],\n});\n\n// https://github.com/tc39/proposal-pipeline-operator\n// https://github.com/js-choi/proposal-hack-pipes\ndefineType(\"TopicReference\", {\n aliases: [\"Expression\"],\n});\n\n// https://github.com/tc39/proposal-pipeline-operator\n// https://github.com/js-choi/proposal-smart-pipes\ndefineType(\"PipelineTopicExpression\", {\n builder: [\"expression\"],\n visitor: [\"expression\"],\n fields: {\n expression: {\n validate: assertNodeType(\"Expression\"),\n },\n },\n aliases: [\"Expression\"],\n});\n\ndefineType(\"PipelineBareFunction\", {\n builder: [\"callee\"],\n visitor: [\"callee\"],\n fields: {\n callee: {\n validate: assertNodeType(\"Expression\"),\n },\n },\n aliases: [\"Expression\"],\n});\n\ndefineType(\"PipelinePrimaryTopicReference\", {\n aliases: [\"Expression\"],\n});\n\n// https://github.com/tc39/proposal-discard-binding\ndefineType(\"VoidPattern\", {\n aliases: [\"Pattern\", \"PatternLike\", \"FunctionParameter\"],\n});\n"],"mappings":";;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAQA,IAAAC,cAAU,EAAC,qBAAqB,EAAE,CAAC,CAAC,CAAC;AAErC,IAAAA,cAAU,EAAC,gBAAgB,EAAE;EAC3BC,OAAO,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;EAC7BC,OAAO,EAAE,CAAC,YAAY,CAAC;EACvBC,MAAM,EAC6B,CAACC,OAAO,CAACC,GAAG,CAACC,sBAAsB,GAChE;IACEC,MAAM,EAAE;MACNC,QAAQ,EAAEC,MAAM,CAACC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE;QAChCC,cAAc,EAAE,CAAC,YAAY;MAC/B,CAAC;IACH,CAAC;IACDC,MAAM,EAAE;MACNJ,QAAQ,EAAEC,MAAM,CAACC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE;QAChCC,cAAc,EAAE,CAAC,YAAY;MAC/B,CAAC;IACH;EACF,CAAC,GACD;IACEJ,MAAM,EAAE;MACNC,QAAQ,EAAE,IAAAK,qBAAc,EAAC,YAAY;IACvC,CAAC;IACDD,MAAM,EAAE;MACNJ,QAAQ,EAAE,IAAAK,qBAAc,EAAC,YAAY;IACvC;EACF;AACR,CAAC,CAAC;AAEF,IAAAb,cAAU,EAAC,WAAW,EAAE;EACtBC,OAAO,EAAE,CAAC,YAAY,CAAC;EACvBE,MAAM,EAAE;IACNW,UAAU,EAAE;MACVN,QAAQ,EAAE,IAAAK,qBAAc,EAAC,YAAY;IACvC;EACF;AACF,CAAC,CAAC;AAEF,IAAAb,cAAU,EAAC,cAAc,EAAE;EACzBC,OAAO,EAAE,CAAC,MAAM,CAAC;EACjBc,OAAO,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;EACLine truncated
@@ -0,0 +1,60 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GlobalScope = void 0;
const types_1 = require("@typescript-eslint/types");
const assert_1 = require("../assert");
const ImplicitGlobalVariableDefinition_1 = require("../definition/ImplicitGlobalVariableDefinition");
const variable_1 = require("../variable");
const ScopeBase_1 = require("./ScopeBase");
const ScopeType_1 = require("./ScopeType");
class GlobalScope extends ScopeBase_1.ScopeBase {
// note this is accessed in used in the legacy eslint-scope tests, so it can't be true private
implicit;
constructor(scopeManager, block) {
super(scopeManager, ScopeType_1.ScopeType.global, null, block, false);
this.implicit = {
leftToBeResolved: [],
set: new Map(),
variables: [],
};
}
addVariables(names) {
for (const name of names) {
this.defineVariable(name, this.set, this.variables, null, null);
this.implicit.set.delete(name);
}
const nameSet = new Set(names);
for (const reference of this.through) {
if (nameSet.has(reference.identifier.name)) {
const variable = this.set.get(reference.identifier.name);
(0, assert_1.assert)(variable, `Expected variable with name "${reference.identifier.name}" to be specified.`);
reference.resolved = variable;
variable.references.push(reference);
}
}
this.through = this.through.filter(reference => !nameSet.has(reference.identifier.name));
this.implicit.variables = this.implicit.variables.filter(variable => !nameSet.has(variable.name));
this.implicit.leftToBeResolved = this.implicit.leftToBeResolved.filter(reference => !nameSet.has(reference.identifier.name));
}
close(scopeManager) {
(0, assert_1.assert)(this.leftToResolve);
for (const ref of this.leftToResolve) {
if (ref.maybeImplicitGlobal && !this.set.has(ref.identifier.name)) {
// create an implicit global variable from assignment expression
const info = ref.maybeImplicitGlobal;
const node = info.pattern;
if (node.type === types_1.AST_NODE_TYPES.Identifier) {
this.defineVariable(node.name, this.implicit.set, this.implicit.variables, node, new ImplicitGlobalVariableDefinition_1.ImplicitGlobalVariableDefinition(info.pattern, info.node));
}
}
}
this.implicit.leftToBeResolved = this.leftToResolve;
super.close(scopeManager);
this.implicit.leftToBeResolved = [...this.through];
return null;
}
defineImplicitVariable(name, options) {
this.defineVariable(new variable_1.ImplicitLibVariable(this, name, options), this.set, this.variables, null, null);
}
}
exports.GlobalScope = GlobalScope;
@@ -0,0 +1,64 @@
{
"name": "@radix-ui/react-slot",
"version": "1.2.4",
"license": "MIT",
"source": "./src/index.ts",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"files": [
"dist",
"README.md"
],
"sideEffects": false,
"dependencies": {
"@radix-ui/react-compose-refs": "1.1.2"
},
"devDependencies": {
"@types/react": "^19.2.2",
"@types/react-dom": "^19.2.2",
"eslint": "^9.38.0",
"react": "^19.2.0",
"react-dom": "^19.2.0",
"typescript": "^5.9.3",
"@repo/eslint-config": "0.0.0",
"@repo/typescript-config": "0.0.0",
"@repo/builder": "0.0.0"
},
"peerDependencies": {
"@types/react": "*",
"react": "^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc"
},
"peerDependenciesMeta": {
"@types/react": {
"optional": true
}
},
"homepage": "https://radix-ui.com/primitives",
"repository": {
"type": "git",
"url": "git+https://github.com/radix-ui/primitives.git"
},
"bugs": {
"url": "https://github.com/radix-ui/primitives/issues"
},
"scripts": {
"lint": "eslint --max-warnings 0 src",
"clean": "rm -rf dist",
"reset": "rm -rf dist node_modules",
"typecheck": "tsc --noEmit",
"build": "radix-build"
},
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
}
}
}
@@ -0,0 +1 @@
{"version":3,"file":"toolNameValidation.js","sourceRoot":"","sources":["../../../src/shared/toolNameValidation.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;AAYH,4CA6DC;AAOD,oDAYC;AAOD,0DAOC;AAxGD;;GAEG;AACH,MAAM,eAAe,GAAG,yBAAyB,CAAC;AAElD;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,IAAY;IAIzC,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,eAAe;IACf,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpB,OAAO;YACH,OAAO,EAAE,KAAK;YACd,QAAQ,EAAE,CAAC,2BAA2B,CAAC;SAC1C,CAAC;IACN,CAAC;IAED,IAAI,IAAI,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC;QACpB,OAAO;YACH,OAAO,EAAE,KAAK;YACd,QAAQ,EAAE,CAAC,gEAAgE,IAAI,CAAC,MAAM,GAAG,CAAC;SAC7F,CAAC;IACN,CAAC;IAED,wFAAwF;IACxF,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACrB,QAAQ,CAAC,IAAI,CAAC,2DAA2D,CAAC,CAAC;IAC/E,CAAC;IAED,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACrB,QAAQ,CAAC,IAAI,CAAC,2DAA2D,CAAC,CAAC;IAC/E,CAAC;IAED,oFAAoF;IACpF,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7C,QAAQ,CAAC,IAAI,CAAC,uFAAuF,CAAC,CAAC;IAC3G,CAAC;IAED,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7C,QAAQ,CAAC,IAAI,CAAC,sFAAsF,CAAC,CAAC;IAC1G,CAAC;IAED,+BAA+B;IAC/B,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9B,MAAM,YAAY,GAAG,IAAI;aACpB,KAAK,CAAC,EAAE,CAAC;aACT,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;aAC5C,MAAM,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,CAAC,CAAC,oBAAoB;QAEpF,QAAQ,CAAC,IAAI,CACT,0CAA0C,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EACtF,8EAA8E,CACjF,CAAC;QAEF,OAAO;YACH,OAAO,EAAE,KAAK;YACd,QAAQ;SACX,CAAC;IACN,CAAC;IAED,OAAO;QACH,OAAO,EAAE,IAAI;QACb,QAAQ;KACX,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,SAAgB,oBAAoB,CAAC,IAAY,EAAE,QAAkB;IACjE,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,OAAO,CAAC,IAAI,CAAC,qCAAqC,IAAI,IAAI,CAAC,CAAC;QAC5D,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC7B,OAAO,CAAC,IAAI,CAAC,OAAO,OAAO,EAAE,CAAC,CAAC;QACnC,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,0EAA0E,CAAC,CAAC;QACzF,OAAO,CAAC,IAAI,CAAC,6EAA6E,CAAC,CAAC;QAC5F,OAAO,CAAC,IAAI,CACR,oIAAoI,CACvI,CAAC;IACN,CAAC;AACL,CAAC;AAED;;;;GAIG;AACH,SAAgB,uBAAuB,CAAC,IAAY;IAChD,MAAM,MAAM,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAEtC,oFAAoF;IACpF,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;IAE5C,OAAO,MAAM,CAAC,OAAO,CAAC;AAC1B,CAAC"}
@@ -0,0 +1 @@
{"version":3,"file":"badge-check.js","sources":["../../../src/icons/badge-check.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name BadgeCheck\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNMy44NSA4LjYyYTQgNCAwIDAgMSA0Ljc4LTQuNzcgNCA0IDAgMCAxIDYuNzQgMCA0IDQgMCAwIDEgNC43OCA0Ljc4IDQgNCAwIDAgMSAwIDYuNzQgNCA0IDAgMCAxLTQuNzcgNC43OCA0IDQgMCAwIDEtNi43NSAwIDQgNCAwIDAgMS00Ljc4LTQuNzcgNCA0IDAgMCAxIDAtNi43NloiIC8+CiAgPHBhdGggZD0ibTkgMTIgMiAyIDQtNCIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/badge-check\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst BadgeCheck = createLucideIcon('BadgeCheck', [\n [\n 'path',\n {\n d: 'M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z',\n key: '3c2336',\n },\n ],\n ['path', { d: 'm9 12 2 2 4-4', key: 'dzmm74' }],\n]);\n\nexport default BadgeCheck;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAa,iBAAiB,YAAc,CAAA,CAAA,CAAA;AAAA,CAChD,CAAA,CAAA;AAAA,CAAA,CAAA,CAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACA,CAAA,CAAA,CAAA,CAAA;AAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACH,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACP,CAAA,CAAA,CAAA,CAAA;AAAA,CACF,CAAA,CAAA,CAAA;AAAA,CAAA,CACA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAiB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAChD,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1 @@
module.exports={C:{"115":0.01081,"120":0.01081,"121":0.02521,"140":0.0036,"152":0.0036,"153":0.0072,"154":0.05763,"155":0.13327,"156":0.13327,"157":0.01081,_:"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 116 117 118 119 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 141 142 143 144 145 146 147 148 149 150 151 158 159 160 3.5 3.6"},D:{"76":0.0036,"93":0.0036,"103":0.03602,"104":0.01801,"105":0.02161,"106":0.02161,"107":0.01801,"108":0.02161,"109":0.04322,"110":0.01801,"111":0.02161,"112":0.02161,"116":0.03962,"117":0.01801,"118":0.03962,"119":0.02521,"120":0.04322,"123":0.0036,"124":0.02161,"126":0.0036,"128":0.02521,"131":0.04322,"133":0.05043,"134":0.01081,"135":0.01081,"136":0.01081,"137":0.01081,"138":0.02161,"139":0.01081,"140":0.01081,"141":0.02882,"142":0.03962,"143":0.0036,"144":0.01441,"145":0.01801,"146":0.0036,"147":0.03242,"148":0.08285,"149":0.08645,"150":0.46106,"151":0.46826,"152":1.12743,"153":0.57992,"154":0.1729,_:"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 77 78 79 80 81 83 84 85 86 87 88 89 90 91 92 94 95 96 97 98 99 100 101 102 113 114 115 121 122 125 127 129 130 132 155 156 157"},F:{"132":0.0036,"134":0.01081,"135":0.05403,_:"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 116 117 118 119 120 121 122 123 124 125 126 127 131 133 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"119":0.01081,"120":0.01081,"148":0.0036,"149":0.0036,"150":0.01081,"151":0.05403,"152":0.32418,"153":0.3638,"154":0.09725,_:"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 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147"},E:{"27":0.63035,_:"4 5 6 7 8 9 10 11 12 13 14 15 3.1 3.2 5.1 6.1 7.1 9.1 10.1 11.1 12.1 13.1 14.1 15.1 15.2-15.3 17.0 27.1 TP","15.4":0.02521,"15.5":0.0072,"15.6":0.28816,"16.0":0.0036,"16.1":0.02161,"16.2":0.01441,"16.3":0.05403,"16.4":0.03242,"16.5":0.0072,"16.6":0.75642,"17.1":1.00136,"17.2":0.06844,"17.3":0.07564,"17.4":0.12967,"17.5":0.04683,"17.6":0.43584,"18.0":0.01801,"18.1":0.09725,"18.2":0.06123,"18.3":0.43944,"18.4":0.03962,"18.5-18.7":0.41063,"26.0":0.06844,"26.1":0.08645,"26.2":0.37461,"26.3":0.5367,"26.4":0.22332,"26.5":2.01352,"26.6":19.56606,"27.2":0.02521},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00602,"5.0-5.1":0.00602,"6.0-6.1":0,"7.0-7.1":0.01204,"8.1-8.4":0,"9.0-9.2":0,"9.3":0,"10.0-10.2":0,"10.3":0.06018,"11.0-11.2":0.00602,"11.3-11.4":0.01204,"12.0-12.1":0,"12.2-12.5":0.15647,"13.0-13.1":0,"13.2":0.03009,"13.3":0,"13.4-13.7":0.00602,"14.0-14.4":0.02407,"14.5-14.8":0.03611,"15.0-15.1":0.03611,"15.2-15.3":0.02407,"15.4":0.03009,"15.5":0.03611,"15.6-15.8":0.78233,"16.0":0.06018,"16.1":0.10832,"16.2":0.06018,"16.3":0.1324,"16.4":0.03009,"16.5":0.04814,"16.6-16.7":1.08925,"17.0":0.04213,"17.1":0.06018,"17.2":0.06018,"17.3":0.09027,"17.4":0.12638,"17.5":0.24674,"17.6-17.7":0.6379,"18.0":0.1324,"18.1":0.26479,"18.2":0.36108,"18.3":0.62587,"18.4":0.39117,"18.5-18.7":8.08212,"26.0":0.39117,"26.1":0.39719,"26.2":1.03509,"26.3":1.11934,"26.4":0.81844,"26.5":5.48236,"26.6":33.82695,"27.0":2.59374,"27.1":0,"27.2":0.0662},P:{"28":0.01034,"29":0.02067,"30":0.23771,_:"4 20 21 22 23 24 25 26 27 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.03836,"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.00002},K:{"0":0.0128,_:"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"},L:{"0":3.6855},R:{_:"0"},M:{"0":0.03839},Q:{_:"14.9"},O:{"0":0.0064},H:{all:0}};
@@ -0,0 +1,900 @@
import { type Form, parseClass } from './parse-class.js'
export type { Form }
export type MatcherOptions = {
/** perform a case-insensitive match */
nocase?: boolean
/** do not treat strings starting with `.` specially */
dot?: boolean
/** do not match extglobs (treat them as normal strings) */
noext?: boolean
/**
* normalize unicode in the pattern and the tested strings, with
* this form. `true` means `'NFC'`.
*/
normalize?: boolean | Form
}
// parsed pattern items
export type Item =
| { t: 'lit'; ch: string }
| { t: 'any' | 'star' }
| { t: 'class'; re: RegExp }
| { t: 'ext'; type: string; alts: Item[][] }
// extglob syntax tokens become literals if they are not part of a
// closed extglob
export type Token =
Item | { t: 'open'; type: string } | { t: 'bar' } | { t: 'close' }
// state machine nodes
export type NegNode = { t: 'neg'; id: number; sub: Node; next: Node }
export type SplitNode = { t: 'split'; id: number; out: Node[] }
export type Node =
| ({ t: 'lit'; id: number; next: Node } & Lit)
| { t: 'any' | 'star'; id: number; next: Node }
| { t: 'class'; id: number; re: RegExp; next: Node }
| SplitNode
| NegNode
| { t: 'match'; id: number }
// the end of the pattern, or of a negated sub-pattern
const MATCH: Node = { t: 'match', id: 0 }
const extTypes = '!?+*@'
const lit = (ch: string): Item => ({ t: 'lit', ch })
const reEscape = (s: string) => s.replace(/[\\^$.*+?()[\]{}|/]/g, '\\$&')
// a RegExp that only matches `s`, with unicode case folding
const newFoldRe = (s: string) => new RegExp(`^${reEscape(s)}$`, 'iu')
// foldRe for one literal char. The same chars are in most patterns,
// so keep them. A RegExp without the `g` or `y` flag has no state to
// share.
const foldCache = new Map<string, RegExp>()
const foldRe = (ch: string) => {
let re = foldCache.get(ch)
if (!re) {
re = newFoldRe(ch)
if (foldCache.size >= 1000) foldCache.clear()
foldCache.set(ch, re)
}
return re
}
/**
* A literal char. With `nocase:true`, `re` folds case, and `ascii`
* holds its results for ASCII chars, by char code: 1 for a match,
* and 2 for not.
*/
export type Lit = { ch: string; re?: RegExp; ascii?: Uint8Array }
const litMatch = (l: Lit, c: string) => {
if (c === l.ch) return true
if (!l.re) return false
const code = c.charCodeAt(0)
if (code >= 128) return l.re.test(c)
const ascii = (l.ascii ??= new Uint8Array(128))
ascii[code] ||= l.re.test(c) ? 1 : 2
return ascii[code] === 1
}
const tokenize = (
p: string,
nocase: boolean,
noext: boolean,
form?: Form,
) => {
const toks: Token[] = []
for (let i = 0; i < p.length;) {
const c = String.fromCodePoint(p.codePointAt(i)!)
if (c === '\\') {
// a trailing \ is a literal \
const e = p.codePointAt(i + 1)
const ch = e === undefined ? c : String.fromCodePoint(e)
toks.push(lit(ch))
i += 1 + ch.length
continue
}
if (c === '[') {
const [re, consumed] = parseClass(p, i, nocase, form)
if (consumed) {
toks.push({ t: 'class', re })
i += consumed
continue
}
}
if (!noext && extTypes.includes(c) && p[i + 1] === '(') {
toks.push({ t: 'open', type: c })
i += 2
continue
}
toks.push(
!noext && c === '|' ? { t: 'bar' }
: !noext && c === ')' ? { t: 'close' }
: c === '*' ? { t: 'star' }
: c === '?' ? { t: 'any' }
: lit(c),
)
i += c.length
}
return toks
}
// map each open token index to the index of its close token
const pair = (toks: Token[]) => {
const pairs = new Map<number, number>()
const stack: number[] = []
toks.forEach((tok, i) => {
if (tok.t === 'open') stack.push(i)
else if (tok.t === 'close' && stack.length) pairs.set(stack.pop()!, i)
})
return pairs
}
// build the alternatives between start and end. An open token that
// is not closed is never inside a closed extglob, so bar and close
// tokens are only literal at the top level.
const build = (
toks: Token[],
pairs: Map<number, number>,
start: number,
end: number,
top: boolean,
): Item[][] => {
let seq: Item[] = []
const alts = [seq]
for (let i = start; i < end; i++) {
const tok = toks[i]!
const close = pairs.get(i)
if (tok.t === 'open' && close !== undefined) {
const sub = build(toks, pairs, i + 1, close, false)
seq.push({ t: 'ext', type: tok.type, alts: sub })
i = close
} else if (tok.t === 'bar' && !top) {
alts.push((seq = []))
} else if (tok.t === 'open') {
seq.push(lit(tok.type), lit('('))
} else if (tok.t === 'bar') {
seq.push(lit('|'))
} else if (tok.t === 'close') {
seq.push(lit(')'))
} else {
seq.push(tok)
}
}
return alts
}
// normalize each run of literal chars as one string, so that a char
// and the combining marks after it compose (or decompose) together.
// Syntax is already parsed, so a char that normalizes to a syntax
// char (such as full-width `*` in NFKC) stays a literal.
const normalize = (items: Item[], form: Form): Item[] => {
const out: Item[] = []
let run = ''
const flush = () => {
for (const ch of run.normalize(form)) out.push(lit(ch))
run = ''
}
for (const it of items) {
if (it.t === 'lit') {
run += it.ch
continue
}
flush()
out.push(
it.t === 'ext' ?
{ ...it, alts: it.alts.map(a => normalize(a, form)) }
: it,
)
}
flush()
return out
}
// the start node, and the number of node ids. Ids are dense, from 0
// for the match node.
const compile = (
items: Item[],
nocase: boolean,
): [start: Node, size: number] => {
let id = 1
const split = (out: Node[]): SplitNode => ({ t: 'split', id: id++, out })
const seq = (items: Item[], next: Node): Node =>
items.reduceRight((next, it) => item(it, next), next)
const item = (it: Item, next: Node): Node => {
switch (it.t) {
case 'lit':
const re = nocase ? foldRe(it.ch) : undefined
return { t: 'lit', id: id++, ch: it.ch, re, next }
case 'any':
case 'star':
return { t: it.t, id: id++, next }
case 'class':
return { t: 'class', id: id++, re: it.re, next }
}
const alts = (next: Node) => it.alts.map(a => seq(a, next))
switch (it.type) {
case '@':
return split(alts(next))
case '?':
return split([next, ...alts(next)])
case '!':
return { t: 'neg', id: id++, sub: split(alts(MATCH)), next }
}
// * and +, loop back after each match
const after = split([])
const entry = split(alts(after))
after.out.push(next, entry)
return it.type === '*' ? after : entry
}
const start = seq(items, MATCH)
return [start, id]
}
// one line per node, in the order that a walk from the start
// reaches them. Edges point to node ids. The nodes of a negated
// sub-pattern are indented under their negation.
const show = (start: Node): string => {
const lines: string[] = []
const seen = new Set<Node>()
const ref = (n: Node) => (n.t === 'match' ? 'match' : String(n.id))
const walk = (n: Node, indent: string) => {
if (n.t === 'match' || seen.has(n)) return
seen.add(n)
const line = (desc: string) => lines.push(`${indent}${n.id}: ${desc}`)
switch (n.t) {
case 'split':
line(`split -> ${n.out.map(ref).join(', ')}`)
for (const o of n.out) walk(o, indent)
return
case 'neg':
line(`!(${ref(n.sub)}) -> ${ref(n.next)}`)
walk(n.sub, indent + ' ')
return walk(n.next, indent)
case 'lit':
line(`${JSON.stringify(n.ch)} -> ${ref(n.next)}`)
break
case 'class':
line(`${n.re} -> ${ref(n.next)}`)
break
default:
line(`${n.t === 'any' ? '?' : '*'} -> ${ref(n.next)}`)
}
walk(n.next, indent)
}
walk(start, '')
return [`start -> ${ref(start)}`, ...lines].join('\n')
}
// A thread inside a !(...) negation. It holds the threads of the
// negated sub-pattern, started where the negation started. The
// negation matches the chars so far if the sub-pattern does not.
type Run = { t: 'run'; neg: NegNode; state: State }
// The threads at one position in the string. Each node thread is
// only kept once, and runs with the same state are only kept once,
// so that identical threads merge. The match node is not in
// `threads`, because it can not step. It sets `match` instead.
class State {
// set by the Sim, to mark the nodes that this state has
gen: number
threads: Node[] = []
match = false
runs: Run[] = []
// the sorted ids of the threads, with 0 for a match, once the
// state is done
ids: number[] = []
constructor(gen: number) {
this.gen = gen
}
// no threads, so nothing more can match
get dead() {
return !this.threads.length && !this.match && !this.runs.length
}
}
// true if the two states hold the same threads
const sameState = (a: State, b: State): boolean => {
if (a.ids.length !== b.ids.length) return false
if (a.runs.length !== b.runs.length) return false
if (a.ids.some((id, i) => id !== b.ids[i])) return false
return a.runs.every(r =>
b.runs.some(o => o.neg === r.neg && sameState(o.state, r.state)),
)
}
/**
* For each node id, the gen of the last state that has the node as
* a thread, and of the last state that walked through it. A state is
* built to the end before the states around it go on, and the nodes
* of a negated sub-pattern are only in its states (other than the
* match node, which is never marked). So one mark for each node is
* enough to know if the state being built has it. The Sims of a
* matcher never run at the same time, so they share one Marks.
*/
export type Marks = { has: Float64Array; seen: Float64Array; gen: number }
const marks = (size: number): Marks => ({
has: new Float64Array(size),
seen: new Float64Array(size),
gen: 0,
})
class Sim {
// `.` and `..` only match literal dots, even with `dot:true`
dots: boolean
// the string starts with `.`, and `dot:true` is not set
dotStart: boolean
#marks: Marks
constructor(dots: boolean, dotStart: boolean, marks: Marks) {
this.dots = dots
this.dotStart = dotStart
this.#marks = marks
}
state() {
return new State(++this.#marks.gen)
}
// sort the ids of a state, once it has all of its threads
done(state: State) {
state.ids = state.threads.map(n => n.id).sort((a, b) => a - b)
if (state.match) state.ids.unshift(MATCH.id)
return state
}
// true the first time that the state walks through the node, so
// that loops in the graph stop
#visit(state: State, node: Node) {
const { seen } = this.#marks
if (seen[node.id] === state.gen) return false
seen[node.id] = state.gen
return true
}
#addThread(state: State, node: Node) {
const { has } = this.#marks
if (has[node.id] === state.gen) return false
has[node.id] = state.gen
state.threads.push(node)
return true
}
// wildcards only match a leading dot if `dot:true`. In a negated
// sub-pattern, this does not apply, because the negation itself
// can not match a leading dot.
restricted(i: number, top: boolean) {
return top && (this.dots || (this.dotStart && i === 0))
}
add(state: State, node: Node, i: number, top: boolean): void {
switch (node.t) {
case 'split':
if (!this.#visit(state, node)) return
for (const o of node.out) this.add(state, o, i, top)
return
case 'neg':
if (!this.#visit(state, node)) return
const sub = this.state()
this.add(sub, node.sub, i, false)
this.done(sub)
return this.addRun(
state,
{ t: 'run', neg: node, state: sub },
i,
top,
)
case 'star':
// a * can not start a dotfile, even if it matches nothing
if (this.restricted(i, top)) return
if (this.#addThread(state, node))
this.add(state, node.next, i, top)
return
case 'match':
state.match = true
return
default:
this.#addThread(state, node)
}
}
addRun(state: State, run: Run, i: number, top: boolean) {
for (const r of state.runs) {
if (r.neg === run.neg && sameState(r.state, run.state)) return
}
state.runs.push(run)
if (!run.state.match) {
this.add(state, run.neg.next, i, top)
}
}
// the threads after char `c`, at index `i`
step(state: State, c: string, i: number, top: boolean): State {
const next = this.state()
for (const th of state.threads) {
switch (th.t) {
case 'lit':
if (litMatch(th, c)) {
this.add(next, th.next, i + 1, top)
}
break
case 'any':
if (!this.restricted(i, top)) this.add(next, th.next, i + 1, top)
break
case 'class':
if (!this.restricted(i, top) && th.re.test(c)) {
this.add(next, th.next, i + 1, top)
}
break
case 'star':
if (!this.restricted(i, top)) this.add(next, th, i + 1, top)
}
}
if (!this.restricted(i, top)) {
for (const run of state.runs) {
// a sub-pattern with no threads can not match again, so the
// run stays the same
if (run.state.dead) {
this.addRun(next, run, i + 1, top)
continue
}
const sub = this.step(run.state, c, i, false)
this.addRun(
next,
{ t: 'run', neg: run.neg, state: sub },
i + 1,
top,
)
}
}
return this.done(next)
}
}
// A canonical key for the threads in a state. States with the same
// key hold the same threads, so they match the same strings.
const stateKey = (state: State): string => {
const ids = state.ids.join()
if (!state.runs.length) return ids
const runs = state.runs.map(r => `${r.neg.id}(${stateKey(r.state)})`)
return `${ids}|${runs.sort().join('|')}`
}
// A cached state of the simulation, and the states that each char
// leads to.
type DState = {
state: State
match: boolean
// no threads, so nothing more can match
dead: boolean
// the next state for each ASCII char, by char code, and for the
// other chars
ascii?: (DState | undefined)[]
next: Map<string, DState>
}
// The cache can hold about this many chars of state keys and
// transitions. When it is full, it is cleared, so that a pattern
// can not use an unbounded amount of memory.
const DFA_BUDGET = 1 << 18
// A cache of the states that the simulation reaches, built as the
// matcher is used. Each char of a string is then one Map lookup,
// once the states that it leads to are known.
//
// The dot rules only restrict the first char of a dotfile (strings
// that are only `.` or `..` do not use the cache). So a dotfile
// starts at its own state, which takes its first step with the
// restriction, and every other state takes steps without it.
class Dfa {
#start: Node
#states = new Map<string, DState>()
#size = 0
#plain?: DState
#dotStart?: DState
#sim: Sim
#dotSim: Sim
constructor(start: Node, marks: Marks) {
this.#start = start
this.#sim = new Sim(false, false, marks)
this.#dotSim = new Sim(false, true, marks)
}
#make(state: State): DState {
return {
state,
match: state.match,
dead: state.dead,
next: new Map(),
}
}
#intern(state: State): DState {
const key = stateKey(state)
const found = this.#states.get(key)
if (found) return found
if (this.#size > DFA_BUDGET) this.#clear()
const d = this.#make(state)
this.#states.set(key, d)
this.#size += key.length + 1
return d
}
#clear() {
this.#states.clear()
this.#size = 0
this.#plain = undefined
this.#dotStart = undefined
}
start(dotStart: boolean): DState {
if (dotStart) {
if (this.#dotStart) return this.#dotStart
const state = this.#dotSim.state()
this.#dotSim.add(state, this.#start, 0, true)
return (this.#dotStart = this.#make(this.#dotSim.done(state)))
}
if (this.#plain) return this.#plain
const state = this.#sim.state()
this.#sim.add(state, this.#start, 0, true)
return (this.#plain = this.#intern(this.#sim.done(state)))
}
// the next state, after a miss in `d.ascii`
next(d: DState, c: string): DState {
const code = c.charCodeAt(0)
const found = code < 128 ? undefined : d.next.get(c)
if (found) return found
// the dotfile start is not in the cache, so it is never shared
const n =
d === this.#dotStart ?
this.#intern(this.#dotSim.step(d.state, c, 0, true))
: this.#intern(this.#sim.step(d.state, c, 1, true))
if (code < 128) {
if (!d.ascii) {
d.ascii = new Array(128)
this.#size += 128
}
d.ascii[code] = n
} else {
d.next.set(c, n)
}
this.#size++
return n
}
}
/**
* A node in a graph with no splits or negations. Such a graph is a
* chain of nodes that each match one char, or a `*`.
*/
export type LinearNode = Exclude<
Node,
SplitNode | NegNode | { t: 'match' }
>
// the nodes in order, if the graph is a single chain
const linear = (start: Node): LinearNode[] | undefined => {
const nodes: LinearNode[] = []
for (let n = start; n.t !== 'match'; n = n.next) {
if (n.t === 'split' || n.t === 'neg') return undefined
nodes.push(n)
}
return nodes
}
// Match a chain of nodes. Each node other than `*` matches exactly
// one char, so on a failure it is enough to go back to the last `*`
// and let it match one more char. This takes at most
// nodes.length * chars.length steps.
const testLinear = (
nodes: LinearNode[],
chars: ArrayLike<string>,
start: number,
end: number,
) => {
let ni = 0
let ci = start
let starNi = -1
let starCi = 0
while (ci < end) {
const n = nodes[ni]
if (n?.t === 'star') {
starNi = ni++
starCi = ci
continue
}
const c = chars[ci]!
if (
n &&
(n.t === 'any' ||
(n.t === 'lit' && litMatch(n, c)) ||
(n.t === 'class' && n.re.test(c)))
) {
ni++
ci++
continue
}
if (starNi === -1) return false
ni = starNi + 1
ci = ++starCi
}
while (nodes[ni]?.t === 'star') ni++
return ni === nodes.length
}
// The least and most chars that the items can match. These are only
// bounds: a negation can match a string of any length, so it counts
// as 0 to Infinity.
const lengths = (items: Item[]): [min: number, max: number] => {
let min = 0
let max = 0
for (const it of items) {
const [lo, hi] = itemLengths(it)
min += lo
max += hi
}
return [min, max]
}
const itemLengths = (it: Item): [min: number, max: number] => {
if (it.t === 'star') return [0, Infinity]
if (it.t !== 'ext') return [1, 1]
if (it.type === '!') return [0, Infinity]
const alts = it.alts.map(lengths)
const min = Math.min(...alts.map(a => a[0]))
const max = Math.max(...alts.map(a => a[1]))
// a loop of alternatives that only match the empty string is empty
const loop = max === 0 ? 0 : Infinity
return (
it.type === '@' ? [min, max]
: it.type === '?' ? [0, max]
: it.type === '*' ? [0, loop]
: [min, loop]
)
}
// true if the chars from `start` match the literals
const hasAffix = (
lits: Lit[],
chars: ArrayLike<string>,
start: number,
) => {
for (let j = 0; j < lits.length; j++) {
if (!litMatch(lits[j]!, chars[start + j]!)) return false
}
return true
}
// a `/`, or half of a surrogate pair
const slashOrSurrogate = /[/\ud800-\udfff]/
const surrogate = /[\ud800-\udfff]/
// a string can be indexed by code point, unless it has surrogate
// pairs
const codePoints = (s: string): ArrayLike<string> =>
surrogate.test(s) ? [...s] : s
const noSlash = (s: string) => {
if (s.includes('/')) {
throw new Error('can only match a single path portion, got: ' + s)
}
}
export class Matcher {
pattern: string
options: MatcherOptions
#start: Node
// the number of node ids
#size: number
#marks?: Marks
// the Sim for strings that are only `.` or `..`
#dotsSim?: Sim
// the string to compare, if the pattern has no magic. With
// `nocase:true`, the RegExp that folds case is made when it is
// first used.
#literal?: string
#literalFold = false
#literalRe?: RegExp
// the nodes between the prefix and suffix, if the graph is a
// single chain
#linear?: LinearNode[]
// the linear nodes are only `*` and `?`, so the length bounds and
// the prefix and suffix decide the match
#wild = false
// the least and most chars that a match can have
#min = 0
#max = Infinity
// the literals that a match must start and end with. Each one
// matches exactly one char, and they are distinct items in the
// pattern, so a string that does not have them can not match.
#prefix: Lit[] = []
#suffix: Lit[] = []
// the prefix and suffix as strings, if they do not fold case
#prefixStr?: string
#suffixStr?: string
// there is a prefix or suffix to check
#affix = false
#dfa?: Dfa
#form?: Form
constructor(pattern: string, options: MatcherOptions = {}) {
if (pattern.includes('/')) {
throw new Error(
'can only match a single path portion, got pattern: ' + pattern,
)
}
this.pattern = pattern
this.options = options
const { nocase = false, noext = false, normalize: n } = options
this.#form = n === true ? 'NFC' : n || undefined
// a pattern that is only an empty extglob is a literal string,
// except for `!()`, which matches any non-empty string
const literal = /^[?*+@]\(\)$/.test(pattern)
const toks = tokenize(pattern, nocase, noext || literal, this.#form)
let [items] = build(toks, pair(toks), 0, toks.length, true)
if (this.#form) items = normalize(items!, this.#form)
const [start, size] = compile(items!, nocase)
this.#start = start
this.#size = size
if (items!.every(it => it.t === 'lit')) {
this.#literal = items!.map(it => it.ch).join('')
this.#literalFold = nocase
} else {
const lit = (it: Item): Lit | undefined =>
it.t !== 'lit' ? undefined
: nocase ? { ch: it.ch, re: foldRe(it.ch) }
: { ch: it.ch }
for (const it of items!) {
const l = lit(it)
if (!l) break
this.#prefix.push(l)
}
for (let j = items!.length - 1; j >= 0; j--) {
const l = lit(items![j]!)
if (!l) break
this.#suffix.unshift(l)
}
this.#affix = !!(this.#prefix.length || this.#suffix.length)
if (!nocase) {
this.#prefixStr = this.#prefix.map(l => l.ch).join('')
this.#suffixStr = this.#suffix.map(l => l.ch).join('')
}
this.#linear = linear(this.#start)?.slice(
this.#prefix.length,
-this.#suffix.length || undefined,
)
this.#wild = !!this.#linear?.every(
n => n.t === 'star' || n.t === 'any',
)
const [min, max] = lengths(items!)
this.#min = min
this.#max = max
}
}
test(s: string): boolean {
// The `/` check uses the string as given, so with normalization it
// is a separate step. Otherwise, one scan finds both a `/` and the
// surrogate pairs that stop the string being indexed by code point.
if (this.#form) {
noSlash(s)
return this.#test(s.normalize(this.#form))
}
if (slashOrSurrogate.test(s)) {
noSlash(s)
return this.#test(s, [...s])
}
return this.#test(s, s)
}
/**
* The same as {@link Matcher#test}, but the string is not checked
* for `/` chars, so the result for a string that has one is not
* defined. Only use it for a string that is known to be one path
* portion, such as a part of a path that was split on `/`. It can
* be faster, because some patterns do not need to look at each char
* of the string.
*/
testUnchecked(s: string): boolean {
return this.#test(this.#form ? s.normalize(this.#form) : s)
}
// Test a string that has no `/`. `chars` indexes it by code point.
// If it is not given, it is only found if a step needs it.
#test(s: string, chars?: ArrayLike<string>): boolean {
if (this.#literal !== undefined) {
return this.#literalFold ?
(this.#literalRe ??= newFoldRe(this.#literal)).test(s)
: s === this.#literal
}
// the length check means that the prefix and suffix do not
// overlap. Without the chars, the length in code points is from
// half of the UTF-16 length (if each one is a surrogate pair) to
// all of it, which is often enough to know.
const min = this.#min
const max = this.#max
if (chars === undefined) {
const most = s.length
const least = (most + 1) >> 1
if (most < min || least > max) return false
if (least < min || most > max) chars = codePoints(s)
}
if (
chars !== undefined &&
(chars.length < min || chars.length > max)
) {
return false
}
const prefix = this.#prefix.length
if (this.#affix) {
if (this.#prefixStr !== undefined && this.#suffixStr !== undefined) {
if (
!s.startsWith(this.#prefixStr) ||
!s.endsWith(this.#suffixStr)
) {
return false
}
} else {
chars ??= codePoints(s)
const end = chars.length - this.#suffix.length
if (
!hasAffix(this.#prefix, chars, 0) ||
!hasAffix(this.#suffix, chars, end)
) {
return false
}
}
}
const dotStart = !this.options.dot && s.startsWith('.')
if (this.#linear) {
// `.` and `..` only match literal dots, even with `dot:true`
if (s === '.' || s === '..') return false
// only a literal can match the leading dot. A `*` can not
// start a dotfile, even if it matches nothing.
if (dotStart && !prefix) return false
if (this.#wild) return true
chars ??= codePoints(s)
const end = chars.length - this.#suffix.length
return testLinear(this.#linear, chars, prefix, end)
}
chars ??= codePoints(s)
if (s === '.' || s === '..') {
this.#marks ??= marks(this.#size)
const sim = (this.#dotsSim ??= new Sim(true, false, this.#marks))
const start = sim.state()
sim.add(start, this.#start, 0, true)
let state = sim.done(start)
for (let i = 0; i < chars.length; i++) {
state = sim.step(state, chars[i]!, i, true)
}
return state.match
}
this.#marks ??= marks(this.#size)
const dfa = (this.#dfa ??= new Dfa(this.#start, this.#marks))
let d = dfa.start(dotStart)
// read char codes from the string, so that a one-char string is
// only made for a cache miss
const str = chars === s
for (let i = 0; i < chars.length; i++) {
if (d.dead) return false
const code = str ? s.charCodeAt(i) : chars[i]!.charCodeAt(0)
d = d.ascii?.[code] ?? dfa.next(d, chars[i]!)
}
return d.match
}
/** a readable listing of the state machine */
toString(): string {
return show(this.#start)
}
}
@@ -0,0 +1,16 @@
{
"curly": true,
"eqeqeq": true,
"immed": true,
"eqnull": true,
"latedef": true,
"noarg": true,
"noempty": true,
"quotmark": "single",
"undef": true,
"unused": true,
"strict": true,
"trailing": true,
"node": true
}
@@ -0,0 +1,7 @@
'use strict';
if (process.env.NODE_ENV === 'production') {
module.exports = require('./cjs/react-jsx-runtime.production.js');
} else {
module.exports = require('./cjs/react-jsx-runtime.development.js');
}
@@ -0,0 +1 @@
module.exports={C:{"52":0.00468,"78":0.06088,"105":0.00937,"115":0.22947,"120":0.0562,"121":0.09834,"123":0.01873,"124":0.00937,"130":0.00468,"134":0.00468,"135":0.00937,"136":0.00468,"139":0.00468,"140":0.07961,"141":0.00468,"142":0.00468,"146":0.02342,"147":0.03278,"148":0.00468,"149":0.00468,"150":0.11708,"151":0.04683,"152":0.03746,"153":0.09366,"154":0.4964,"155":1.29251,"156":1.30656,"157":0.04215,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 106 107 108 109 110 111 112 113 114 116 117 118 119 122 125 126 127 128 129 131 132 133 137 138 143 144 145 158 159 160 3.5 3.6"},D:{"49":0.01405,"70":0.00468,"75":0.02342,"76":0.00468,"77":0.00468,"79":0.00937,"80":0.00468,"81":0.01873,"87":0.00937,"90":0.00468,"103":0.0281,"104":0.01873,"105":0.02342,"106":0.01873,"107":0.01873,"108":0.02342,"109":0.81953,"110":0.01873,"111":0.05151,"112":0.02342,"113":0.00468,"114":0.00468,"116":0.07025,"117":0.01873,"118":0.10771,"119":0.11708,"120":0.19669,"121":0.01405,"122":0.0562,"123":0.01873,"124":0.0562,"125":0.00468,"126":0.01873,"127":0.0281,"128":0.03278,"129":0.00937,"130":0.00468,"131":0.06088,"132":0.02342,"133":0.12176,"134":0.07961,"135":0.10303,"136":0.07493,"137":0.08429,"138":0.17327,"139":0.07961,"140":0.15454,"141":0.11239,"142":0.25757,"143":0.06088,"144":0.05151,"145":0.10303,"146":0.08429,"147":0.06088,"148":0.16391,"149":0.14049,"150":0.31844,"151":1.47983,"152":11.44057,"153":10.46182,"154":2.54287,"155":0.02342,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 71 72 73 74 78 83 84 85 86 88 89 91 92 93 94 95 96 97 98 99 100 101 102 115 156 157"},F:{"36":0.00468,"46":0.01873,"95":0.02342,"100":0.00468,"101":0.03746,"102":0.00468,"106":0.00468,"114":0.01405,"116":0.00468,"119":0.03278,"120":0.00468,"121":0.00468,"133":0.00468,"134":0.14517,"135":0.98811,_:"9 11 12 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 37 38 39 40 41 42 43 44 45 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 96 97 98 99 103 104 105 107 108 109 110 111 112 113 115 117 118 122 123 124 125 126 127 131 132 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"92":0.00468,"109":0.05151,"114":0.0281,"118":0.00937,"119":0.04683,"120":0.04683,"122":0.00468,"123":0.00937,"131":0.00468,"138":0.02342,"140":0.00468,"142":0.00468,"143":0.00468,"144":0.00937,"145":0.00468,"146":0.00468,"147":0.04215,"148":0.07025,"149":0.02342,"150":0.27161,"151":0.17327,"152":2.38833,"153":1.93876,"154":0.51045,_:"12 13 14 15 16 17 18 79 80 81 83 84 85 86 87 88 89 90 91 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 110 111 112 113 115 116 117 121 124 125 126 127 128 129 130 132 133 134 135 136 137 139 141"},E:{"27":0.11239,_:"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 15.1 15.2-15.3 15.4 15.5 16.0 16.1 16.4 17.0 27.1 TP","14.1":0.00937,"15.6":0.05151,"16.2":0.00468,"16.3":0.00468,"16.5":0.00468,"16.6":0.08898,"17.1":0.07025,"17.2":0.00937,"17.3":0.00468,"17.4":0.01405,"17.5":0.04683,"17.6":0.07493,"18.0":0.00468,"18.1":0.06088,"18.2":0.03278,"18.3":0.00937,"18.4":0.01873,"18.5-18.7":0.01873,"26.0":0.00468,"26.1":0.02342,"26.2":0.03278,"26.3":0.0281,"26.4":0.03746,"26.5":0.13581,"26.6":0.75396,"27.2":0.00468},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00117,"5.0-5.1":0.00117,"6.0-6.1":0,"7.0-7.1":0.00233,"8.1-8.4":0,"9.0-9.2":0,"9.3":0,"10.0-10.2":0,"10.3":0.01166,"11.0-11.2":0.00117,"11.3-11.4":0.00233,"12.0-12.1":0,"12.2-12.5":0.03032,"13.0-13.1":0,"13.2":0.00583,"13.3":0,"13.4-13.7":0.00117,"14.0-14.4":0.00467,"14.5-14.8":0.007,"15.0-15.1":0.007,"15.2-15.3":0.00467,"15.4":0.00583,"15.5":0.007,"15.6-15.8":0.15162,"16.0":0.01166,"16.1":0.02099,"16.2":0.01166,"16.3":0.02566,"16.4":0.00583,"16.5":0.00933,"16.6-16.7":0.21111,"17.0":0.00816,"17.1":0.01166,"17.2":0.01166,"17.3":0.01749,"17.4":0.02449,"17.5":0.04782,"17.6-17.7":0.12363,"18.0":0.02566,"18.1":0.05132,"18.2":0.06998,"18.3":0.1213,"18.4":0.07581,"18.5-18.7":1.56638,"26.0":0.07581,"26.1":0.07698,"26.2":0.20061,"26.3":0.21694,"26.4":0.15862,"26.5":1.06253,"26.6":6.55594,"27.0":0.50269,"27.1":0,"27.2":0.01283},P:{"4":0.02767,"22":0.00922,"23":0.01845,"24":0.00922,"25":0.02767,"26":0.02767,"27":0.02767,"28":0.03689,"29":0.06456,"30":3.10819,_:"20 21 5.0-5.4 6.2-6.4 9.2 10.1 11.1-11.2 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0","7.2-7.4":0.00922,"8.2":0.00922},I:{"0":0.04781,"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.00002},K:{"0":0.47312,_:"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 11Line truncated
@@ -0,0 +1 @@
module.exports={A:{A:{"1":"_A","2":"_IB","132":"_vC"},B:{"1":"_J"},C:{"1":"_w","2":"_f"},D:{"1":"_Q"},E:{"1":"_R"},F:{"1":"_wJ","2":"_qC"},G:{"1":"_1","513":"_8C"},H:{"4097":"1D"},I:{"1025":"_P"},J:{"258":"_B"},K:{"2":"A","258":"_bD","1025":"H"},L:{"1025":"I"},M:{"2049":"YC"},N:{"258":"_A"},O:{"258":"bC"},P:{"1025":"_F"},Q:{"1":"JE"},R:{"1025":"KE"},S:{"1":"_C"}},B:1,C:"Basic console logging functions",D:true};
@@ -0,0 +1,494 @@
import type { Angle, CssColor, Rule, CustomProperty, EnvironmentVariable, Function, Image, LengthValue, MediaQuery, Declaration, Ratio, Resolution, Selector, SupportsCondition, Time, Token, TokenOrValue, UnknownAtRule, Url, Variable, StyleRule, DeclarationBlock, ParsedComponent, Multiplier, StyleSheet, Location2 } from './ast';
import { Targets, Features } from './targets';
export * from './ast';
export { Targets, Features };
export interface TransformOptions<C extends CustomAtRules> {
/** The filename being transformed. Used for error messages and source maps. */
filename: string,
/** The source code to transform. */
code: Uint8Array,
/** Whether to enable minification. */
minify?: boolean,
/** Whether to output a source map. */
sourceMap?: boolean,
/** An input source map to extend. */
inputSourceMap?: string,
/**
* An optional project root path, used as the source root in the output source map.
* Also used to generate relative paths for sources used in CSS module hashes.
*/
projectRoot?: string,
/** The browser targets for the generated code. */
targets?: Targets,
/** Features that should always be compiled, even when supported by targets. */
include?: number,
/** Features that should never be compiled, even when unsupported by targets. */
exclude?: number,
/** Whether to enable parsing various draft syntax. */
drafts?: Drafts,
/** Whether to enable various non-standard syntax. */
nonStandard?: NonStandard,
/** Whether to compile this file as a CSS module. */
cssModules?: boolean | CSSModulesConfig,
/**
* Whether to analyze dependencies (e.g. `@import` and `url()`).
* When enabled, `@import` rules are removed, and `url()` dependencies
* are replaced with hashed placeholders that can be replaced with the final
* urls later (after bundling). Dependencies are returned as part of the result.
*/
analyzeDependencies?: boolean | DependencyOptions,
/**
* Replaces user action pseudo classes with class names that can be applied from JavaScript.
* This is useful for polyfills, for example.
*/
pseudoClasses?: PseudoClasses,
/**
* A list of class names, ids, and custom identifiers (e.g. @keyframes) that are known
* to be unused. These will be removed during minification. Note that these are not
* selectors but individual names (without any . or # prefixes).
*/
unusedSymbols?: string[],
/**
* Whether to ignore invalid rules and declarations rather than erroring.
* When enabled, warnings are returned, and the invalid rule or declaration is
* omitted from the output code.
*/
errorRecovery?: boolean,
/**
* An AST visitor object. This allows custom transforms or analysis to be implemented in JavaScript.
* Multiple visitors can be composed into one using the `composeVisitors` function.
* For optimal performance, visitors should be as specific as possible about what types of values
* they care about so that JavaScript has to be called as little as possible.
*/
visitor?: Visitor<C> | VisitorFunction<C>,
/**
* Defines how to parse custom CSS at-rules. Each at-rule can have a prelude, defined using a CSS
* [syntax string](https://drafts.css-houdini.org/css-properties-values-api/#syntax-strings), and
* a block body. The body can be a declaration list, rule list, or style block as defined in the
* [css spec](https://drafts.csswg.org/css-syntax/#declaration-rule-list).
*/
customAtRules?: C
}
// This is a hack to make TS still provide autocomplete for `property` vs. just making it `string`.
type PropertyStart = '-' | '_' | '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';
export type ReturnedDeclaration = Declaration | {
/** The property name. */
property: `${PropertyStart}${string}`,
/** The raw string value for the declaration. */
raw: string
};
export type ReturnedMediaQuery = MediaQuery | {
/** The raw string value for the media query. */
raw: string
};
type FindByType<Union, Name> = Union extends { type: Name } ? Union : never;
export type ReturnedRule = Rule<ReturnedDeclaration, ReturnedMediaQuery>;
type RequiredValue<Rule> = Rule extends { value: object }
? Rule['value'] extends StyleRule
? Rule & { value: Required<StyleRule> & { declarations: Required<DeclarationBlock> } }
: Rule & { value: Required<Rule['value']> }
: Rule;
type RuleVisitor<R = RequiredValue<Rule>> = ((rule: R) => ReturnedRule | ReturnedRule[] | void);
type MappedRuleVisitors = {
[Name in Exclude<Rule['type'], 'unknown' | 'custom'>]?: RuleVisitor<RequiredValue<FindByType<Rule, Name>>>;
}
type UnknownVisitors<T> = {
[name: string]: RuleVisitor<T>
}
type CustomVisitors<T extends CustomAtRules> = {
[Name in keyof T]?: RuleVisitor<CustomAtRule<Name, T[Name]>>
};
type AnyCustomAtRule<C extends CustomAtRules> = {
[Key in keyof C]: CustomAtRule<Key, C[Key]>
}[keyof C];
type RuleVisitors<C extends CustomAtRules> = MappedRuleVisitors & {
unknown?: UnknownVisitors<UnknownAtRule> | Omit<RuleVisitor<UnknownAtRule>, keyof CallableFunction>,
custom?: CustomVisitors<C> | Omit<RuleVisitor<AnyCustomAtRule<C>>, keyof CallableFunction>
};
type PreludeTypes = Exclude<ParsedComponent['type'], 'literal' | 'repeated' | 'token'>;
type SyntaxString = `<${PreludeTypes}>` | `<${PreludeTypes}>+` | `<${PreludeTypes}>#` | (string & {});
type ComponentTypes = {
[Key in PreludeTypes as `<${Key}>`]: FindByType<ParsedComponent, Key>
};
type Repetitions = {
[Key in PreludeTypes as `<${Key}>+` | `<${Key}>#`]: {
type: "repeated",
value: {
components: FindByType<ParsedComponent, Key>[],
multiplier: Multiplier
}
}
};
type MappedPrelude = ComponentTypes & Repetitions;
type MappedBody<P extends CustomAtRuleDefinition['body']> = P extends 'style-block' ? 'rule-list' : P;
interface CustomAtRule<N, R extends CustomAtRuleDefinition> {
name: N,
prelude: R['prelude'] extends keyof MappedPrelude ? MappedPrelude[R['prelude']] : ParsedComponent,
body: FindByType<CustomAtRuleBody, MappedBody<R['body']>>,
loc: Location2
}
type CustomAtRuleBody = {
type: 'declaration-list',
value: Required<DeclarationBlock>
} | {
type: 'rule-list',
value: RequiredValue<Rule>[]
};
type FindProperty<Union, Name> = Union extends { property: Name } ? Union : never;
type DeclarationVisitor<P = Declaration> = ((property: P) => ReturnedDeclaration | ReturnedDeclaration[] | void);
type MappedDeclarationVisitors = {
[Name in Exclude<Declaration['property'], 'unparsed' | 'custom'>]?: DeclarationVisitor<FindProperty<Declaration, Name> | FindProperty<Declaration, 'unparsed'>>;
}
type CustomPropertyVisitors = {
[name: string]: DeclarationVisitor<CustomProperty>
}
type DeclarationVisitors = MappedDeclarationVisitors & {
custom?: CustomPropertyVisitors | DeclarationVisitor<CustomProperty>
}
interface RawValue {
/** A raw string value which will be parsed like CSS. */
raw: string
}
type TokenReturnValue = TokenOrValue | TokenOrValue[] | RawValue | void;
type TokenVisitor = (token: Token) => TokenReturnValue;
type VisitableTokenTypes = 'ident' | 'at-keyword' | 'hash' | 'id-hash' | 'string' | 'number' | 'percentage' | 'dimension';
type TokenVisitors = {
[Name in VisitableTokenTypes]?: (token: FindByType<Token, Name>) => TokenReturnValue;
}
type FunctionVisitor = (fn: Function) => TokenReturnValue;
type EnvironmentVariableVisitor = (env: EnvironmentVariable) => TokenReturnValue;
type EnvironmentVariableVisitors = {
[name: string]: EnvironmentVariableVisitor
};
export interface Visitor<C extends CustomAtRules> {
StyleSheet?(stylesheet: StyleSheet): StyleSheet<ReturnedDeclaration, ReturnedMediaQuery> | void;
StyleSheetExit?(stylesheet: StyleSheet): StyleSheet<ReturnedDeclaration, ReturnedMediaQuery> | void;
Rule?: RuleVisitor | RuleVisitors<C>;
RuleExit?: RuleVisitor | RuleVisitors<C>;
Declaration?: DeclarationVisitor | DeclarationVisitors;
DeclarationExit?: DeclarationVisitor | DeclarationVisitors;
Url?(url: Url): Url | void;
Color?(color: CssColor): CssColor | void;
Image?(image: Image): Image | void;
ImageExit?(image: Image): Image | void;
Length?(length: LengthValue): LengthValue | void;
Angle?(angle: Angle): Angle | void;
Ratio?(ratio: Ratio): Ratio | void;
Resolution?(resolution: Resolution): Resolution | void;
Time?(time: Time): Time | void;
CustomIdent?(ident: string): string | void;
DashedIdent?(ident: string): string | void;
MediaQuery?(query: MediaQuery): ReturnedMediaQuery | ReturnedMediaQuery[] | void;
MediaQueryExit?(query: MediaQuery): ReturnedMediaQuery | ReturnedMediaQuery[] | void;
SupportsCondition?(condition: SupportsCondition): SupportsCondition;
SupportsConditionExit?(condition: SupportsCondition): SupportsCondition;
Selector?(selector: Selector): Selector | Selector[] | void;
Token?: TokenVisitor | TokenVisitors;
Function?: FunctionVisitor | { [name: string]: FunctionVisitor };
FunctionExit?: FunctionVisitor | { [name: string]: FunctionVisitor };
Variable?(variable: Variable): TokenReturnValue;
VariableExit?(variable: Variable): TokenReturnValue;
EnvironmentVariable?: EnvironmentVariableVisitor | EnvironmentVariableVisitors;
EnvironmentVariableExit?: EnvironmentVariableVisitor | EnvironmentVariableVisitors;
}
export type VisitorDependency = FileDependency | GlobDependency;
export interface VisitorOptions {
addDependency: (dep: VisitorDependency) => void
}
export type VisitorFunction<C extends CustomAtRules> = (options: VisitorOptions) => Visitor<C>;
export interface CustomAtRules {
[name: string]: CustomAtRuleDefinition
}
export interface CustomAtRuleDefinition {
/**
* Defines the syntax for a custom at-rule prelude. The value should be a
* CSS [syntax string](https://drafts.css-houdini.org/css-properties-values-api/#syntax-strings)
* representing the types of values that are accepted. This property may be omitted or
* set to null to indicate that no prelude is accepted.
*/
prelude?: SyntaxString | null,
/**
* Defines the type of body contained within the at-rule block.
* - declaration-list: A CSS declaration list, as in a style rule.
* - rule-list: A list of CSS rules, as supported within a non-nested
* at-rule such as `@media` or `@supports`.
* - style-block: Both a declaration list and rule list, as accepted within
* a nested at-rule within a style rule (e.g. `@media` inside a style rule
* with directly nested declarations).
*/
body?: 'declaration-list' | 'rule-list' | 'style-block' | null
}
export interface DependencyOptions {
/** Whether to preserve `@import` rules rather than removing them. */
preserveImports?: boolean
}
export type BundleOptions<C extends CustomAtRules> = Omit<TransformOptions<C>, 'code'>;
export interface BundleAsyncOptions<C extends CustomAtRules> extends BundleOptions<C> {
resolver?: Resolver;
}
/** Custom resolver to use when loading CSS files. */
export interface Resolver {
/** Read the given file and return its contents as a string. */
read?: (file: string) => string | Promise<string>;
/**
* Resolve the given CSS import specifier from the provided originating file to a
* path which gets passed to `read()`.
*/
resolve?: (specifier: string, originatingFile: string) => string | Promise<string>;
}
export interface Drafts {
/** Whether to enable @custom-media rules. */
customMedia?: boolean
}
export interface NonStandard {
/** Whether to enable the non-standard >>> and /deep/ selector combinators used by Angular and Vue. */
deepSelectorCombinator?: boolean
}
export interface PseudoClasses {
hover?: string,
active?: string,
focus?: string,
focusVisible?: string,
focusWithin?: string
}
export interface TransformResult {
/** The transformed code. */
code: Uint8Array,
/** The generated source map, if enabled. */
map: Uint8Array | void,
/** CSS module exports, if enabled. */
exports: CSSModuleExports | void,
/** CSS module references, if `dashedIdents` is enabled. */
references: CSSModuleReferences,
/** `@import` and `url()` dependencies, if enabled. */
dependencies: Dependency[] | void,
/** Warnings that occurred during compilation. */
warnings: Warning[]
}
export interface Warning {
message: string,
type: string,
value?: any,
loc: ErrorLocation
}
export interface CSSModulesConfig {
/** The pattern to use when renaming class names and other identifiers. Default is `[hash]_[local]`. */
pattern?: string,
/** Whether to rename dashed identifiers, e.g. custom properties. */
dashedIdents?: boolean,
/** Whether to enable hashing for `@keyframes`. */
animation?: boolean,
/** Whether to enable hashing for CSS grid identifiers. */
grid?: boolean,
/** Whether to enable hashing for `@container` names. */
container?: boolean,
/** Whether to enable hashing for custom identifiers. */
customIdents?: boolean,
/** Whether to require at least one class or id selector in each rule. */
pure?: boolean
}
export type CSSModuleExports = {
/** Maps exported (i.e. original) names to local names. */
[name: string]: CSSModuleExport
};
export interface CSSModuleExport {
/** The local (compiled) name for this export. */
name: string,
/** Whether the export is referenced in this file. */
isReferenced: boolean,
/** Other names that are composed by this export. */
composes: CSSModuleReference[]
}
export type CSSModuleReferences = {
/** Maps placeholder names to references. */
[name: string]: DependencyCSSModuleReference,
};
export type CSSModuleReference = LocalCSSModuleReference | GlobalCSSModuleReference | DependencyCSSModuleReference;
export interface LocalCSSModuleReference {
type: 'local',
/** The local (compiled) name for the reference. */
name: string,
}
export interface GlobalCSSModuleReference {
type: 'global',
/** The referenced global name. */
name: string,
}
export interface DependencyCSSModuleReference {
type: 'dependency',
/** The name to reference within the dependency. */
name: string,
/** The dependency specifier for the referenced file. */
specifier: string
}
export type Dependency = ImportDependency | UrlDependency | FileDependency | GlobDependency;
export interface ImportDependency {
type: 'import',
/** The url of the `@import` dependency. */
url: string,
/** The media query for the `@import` rule. */
media: string | null,
/** The `supports()` query for the `@import` rule. */
supports: string | null,
/** The source location where the `@import` rule was found. */
loc: SourceLocation,
/** The placeholder that the import was replaced with. */
placeholder: string
}
export interface UrlDependency {
type: 'url',
/** The url of the dependency. */
url: string,
/** The source location where the `url()` was found. */
loc: SourceLocation,
/** The placeholder that the url was replaced with. */
placeholder: string
}
export interface FileDependency {
type: 'file',
filePath: string
}
export interface GlobDependency {
type: 'glob',
glob: string
}
export interface SourceLocation {
/** The file path in which the dependency exists. */
filePath: string,
/** The start location of the dependency. */
start: Location,
/** The end location (inclusive) of the dependency. */
end: Location
}
export interface Location {
/** The line number (1-based). */
line: number,
/** The column number (0-based). */
column: number
}
export interface ErrorLocation extends Location {
filename: string
}
/**
* Compiles a CSS file, including optionally minifying and lowering syntax to the given
* targets. A source map may also be generated, but this is not enabled by default.
*/
export declare function transform<C extends CustomAtRules>(options: TransformOptions<C>): TransformResult;
export interface TransformAttributeOptions {
/** The filename in which the style attribute appeared. Used for error messages and dependencies. */
filename?: string,
/** The source code to transform. */
code: Uint8Array,
/** Whether to enable minification. */
minify?: boolean,
/** The browser targets for the generated code. */
targets?: Targets,
/**
* Whether to analyze `url()` dependencies.
* When enabled, `url()` dependencies are replaced with hashed placeholders
* that can be replaced with the final urls later (after bundling).
* Dependencies are returned as part of the result.
*/
analyzeDependencies?: boolean,
/**
* Whether to ignore invalid rules and declarations rather than erroring.
* When enabled, warnings are returned, and the invalid rule or declaration is
* omitted from the output code.
*/
errorRecovery?: boolean,
/**
* An AST visitor object. This allows custom transforms or analysis to be implemented in JavaScript.
* Multiple visitors can be composed into one using the `composeVisitors` function.
* For optimal performance, visitors should be as specific as possible about what types of values
* they care about so that JavaScript has to be called as little as possible.
*/
visitor?: Visitor<never> | VisitorFunction<never>
}
export interface TransformAttributeResult {
/** The transformed code. */
code: Uint8Array,
/** `@import` and `url()` dependencies, if enabled. */
dependencies: Dependency[] | void,
/** Warnings that occurred during compilation. */
warnings: Warning[]
}
/**
* Compiles a single CSS declaration list, such as an inline style attribute in HTML.
*/
export declare function transformStyleAttribute(options: TransformAttributeOptions): TransformAttributeResult;
/**
* Converts a browserslist result into targets that can be passed to lightningcss.
* @param browserslist the result of calling `browserslist`
*/
export declare function browserslistToTargets(browserslist: string[]): Targets;
/**
* Bundles a CSS file and its dependencies, inlining @import rules.
*/
export declare function bundle<C extends CustomAtRules>(options: BundleOptions<C>): TransformResult;
/**
* Bundles a CSS file and its dependencies asynchronously, inlining @import rules.
*/
export declare function bundleAsync<C extends CustomAtRules>(options: BundleAsyncOptions<C>): Promise<TransformResult>;
/**
* Composes multiple visitor objects into a single one.
*/
export declare function composeVisitors<C extends CustomAtRules>(visitors: (Visitor<C> | VisitorFunction<C>)[]): Visitor<C> | VisitorFunction<C>;
@@ -0,0 +1 @@
{"version":3,"file":"user-cog.js","sources":["../../../src/icons/user-cog.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name UserCog\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8Y2lyY2xlIGN4PSIxOCIgY3k9IjE1IiByPSIzIiAvPgogIDxjaXJjbGUgY3g9IjkiIGN5PSI3IiByPSI0IiAvPgogIDxwYXRoIGQ9Ik0xMCAxNUg2YTQgNCAwIDAgMC00IDR2MiIgLz4KICA8cGF0aCBkPSJtMjEuNyAxNi40LS45LS4zIiAvPgogIDxwYXRoIGQ9Im0xNS4yIDEzLjktLjktLjMiIC8+CiAgPHBhdGggZD0ibTE2LjYgMTguNy4zLS45IiAvPgogIDxwYXRoIGQ9Im0xOS4xIDEyLjIuMy0uOSIgLz4KICA8cGF0aCBkPSJtMTkuNiAxOC43LS40LTEiIC8+CiAgPHBhdGggZD0ibTE2LjggMTIuMy0uNC0xIiAvPgogIDxwYXRoIGQ9Im0xNC4zIDE2LjYgMS0uNCIgLz4KICA8cGF0aCBkPSJtMjAuNyAxMy44IDEtLjQiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/user-cog\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst UserCog = createLucideIcon('UserCog', [\n ['circle', { cx: '18', cy: '15', r: '3', key: 'gjjjvw' }],\n ['circle', { cx: '9', cy: '7', r: '4', key: 'nufk8' }],\n ['path', { d: 'M10 15H6a4 4 0 0 0-4 4v2', key: '1nfge6' }],\n ['path', { d: 'm21.7 16.4-.9-.3', key: '12j9ji' }],\n ['path', { d: 'm15.2 13.9-.9-.3', key: '1fdjdi' }],\n ['path', { d: 'm16.6 18.7.3-.9', key: 'heedtr' }],\n ['path', { d: 'm19.1 12.2.3-.9', key: '1af3ki' }],\n ['path', { d: 'm19.6 18.7-.4-1', key: '1x9vze' }],\n ['path', { d: 'm16.8 12.3-.4-1', key: 'vqeiwj' }],\n ['path', { d: 'm14.3 16.6 1-.4', key: '1qlj63' }],\n ['path', { d: 'm20.7 13.8 1-.4', key: '1v5t8k' }],\n]);\n\nexport default UserCog;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,iBAAiB,SAAW,CAAA,CAAA,CAAA;AAAA,CAC1C,CAAA,CAAC,QAAU,CAAA,CAAA,CAAA,CAAE,EAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAM,CAAI,CAAA,CAAA,CAAA,IAAA,CAAM,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,GAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAU,CAAA,CAAA;AAAA,CACxD,CAAA,CAAC,QAAU,CAAA,CAAA,CAAA,CAAE,EAAI,CAAA,CAAA,CAAA,CAAA,CAAA,EAAK,CAAI,CAAA,CAAA,CAAA,GAAA,CAAK,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,GAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAS,CAAA,CAAA;AAAA,CAAA,CACrD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA4B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAoB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACjD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAoB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACjD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAmB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAChD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAmB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAChD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAmB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAChD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAmB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAChD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAmB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAChD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAmB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAClD,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1 @@
{"version":3,"names":["exports","getModuleName","require"],"sources":["../../../src/transformation/file/babel-7-helpers.cjs"],"sourcesContent":["// TODO(Babel 8): Remove this file\n\nif (!process.env.BABEL_8_BREAKING) {\n exports.getModuleName = () =>\n require(\"@babel/helper-module-transforms\").getModuleName;\n} else if (process.env.IS_PUBLISH) {\n throw new Error(\n \"Internal Babel error: This file should only be loaded in Babel 7\",\n );\n}\n"],"mappings":"AAGEA,OAAO,CAACC,aAAa,GAAG,MACtBC,OAAO,CAAC,iCAAiC,CAAC,CAACD,aAAa;AAAC","ignoreList":[]}
@@ -0,0 +1 @@
{"version":3,"file":"bike.js","sources":["../../../src/icons/bike.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Bike\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8Y2lyY2xlIGN4PSIxOC41IiBjeT0iMTcuNSIgcj0iMy41IiAvPgogIDxjaXJjbGUgY3g9IjUuNSIgY3k9IjE3LjUiIHI9IjMuNSIgLz4KICA8Y2lyY2xlIGN4PSIxNSIgY3k9IjUiIHI9IjEiIC8+CiAgPHBhdGggZD0iTTEyIDE3LjVWMTRsLTMtMyA0LTMgMiAzaDIiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/bike\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst Bike = createLucideIcon('Bike', [\n ['circle', { cx: '18.5', cy: '17.5', r: '3.5', key: '15x4ox' }],\n ['circle', { cx: '5.5', cy: '17.5', r: '3.5', key: '1noe27' }],\n ['circle', { cx: '15', cy: '5', r: '1', key: '19l28e' }],\n ['path', { d: 'M12 17.5V14l-3-3 4-3 2 3h2', key: '1npguv' }],\n]);\n\nexport default Bike;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,iBAAiB,MAAQ,CAAA,CAAA,CAAA;AAAA,CACpC,CAAA,CAAC,QAAU,CAAA,CAAA,CAAA,CAAE,EAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAQ,CAAI,CAAA,CAAA,CAAA,MAAA,CAAQ,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,GAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAU,CAAA,CAAA;AAAA,CAC9D,CAAA,CAAC,QAAU,CAAA,CAAA,CAAA,CAAE,EAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAO,CAAI,CAAA,CAAA,CAAA,MAAA,CAAQ,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,GAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAU,CAAA,CAAA;AAAA,CAC7D,CAAA,CAAC,QAAU,CAAA,CAAA,CAAA,CAAE,EAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAM,CAAI,CAAA,CAAA,CAAA,GAAA,CAAK,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,GAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAU,CAAA,CAAA;AAAA,CAAA,CACvD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA8B,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC7D,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,118 @@
const IS_RECORD_SYMBOL = "@@__IMMUTABLE_RECORD__@@";
const IS_COLLECTION_SYMBOL = "@@__IMMUTABLE_ITERABLE__@@";
function isImmutable(v) {
return v && (v[IS_COLLECTION_SYMBOL] || v[IS_RECORD_SYMBOL]);
}
const OBJECT_PROTO = Object.getPrototypeOf({});
function getUnserializableMessage(err) {
if (err instanceof Error) {
return `<unserializable>: ${err.message}`;
}
if (typeof err === "string") {
return `<unserializable>: ${err}`;
}
return "<unserializable>";
}
// https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm
function serializeValue(val, seen = new WeakMap()) {
if (!val || typeof val === "string") {
return val;
}
if (val instanceof Error && "toJSON" in val && typeof val.toJSON === "function") {
const jsonValue = val.toJSON();
if (jsonValue && jsonValue !== val && typeof jsonValue === "object") {
if (typeof val.message === "string") {
safe(() => jsonValue.message ??= normalizeErrorMessage(val.message));
}
if (typeof val.stack === "string") {
safe(() => jsonValue.stack ??= val.stack);
}
if (typeof val.name === "string") {
safe(() => jsonValue.name ??= val.name);
}
if (val.cause != null) {
safe(() => jsonValue.cause ??= serializeValue(val.cause, seen));
}
}
return serializeValue(jsonValue, seen);
}
if (typeof val === "function") {
return `Function<${val.name || "anonymous"}>`;
}
if (typeof val === "symbol") {
return val.toString();
}
if (typeof val !== "object") {
return val;
}
if (typeof Buffer !== "undefined" && val instanceof Buffer) {
return `<Buffer(${val.length}) ...>`;
}
if (typeof Uint8Array !== "undefined" && val instanceof Uint8Array) {
return `<Uint8Array(${val.length}) ...>`;
}
// cannot serialize immutables as immutables
if (isImmutable(val)) {
return serializeValue(val.toJSON(), seen);
}
if (val instanceof Promise || val.constructor && val.constructor.prototype === "AsyncFunction") {
return "Promise";
}
if (typeof Element !== "undefined" && val instanceof Element) {
return val.tagName;
}
if (typeof val.toJSON === "function") {
return serializeValue(val.toJSON(), seen);
}
if (seen.has(val)) {
return seen.get(val);
}
if (Array.isArray(val)) {
// eslint-disable-next-line unicorn/no-new-array -- we need to keep sparse arrays ([1,,3])
const clone = new Array(val.length);
seen.set(val, clone);
val.forEach((e, i) => {
try {
clone[i] = serializeValue(e, seen);
} catch (err) {
clone[i] = getUnserializableMessage(err);
}
});
return clone;
} else {
// Objects with `Error` constructors appear to cause problems during worker communication
// using `MessagePort`, so the serialized error object is being recreated as plain object.
const clone = Object.create(null);
seen.set(val, clone);
let obj = val;
while (obj && obj !== OBJECT_PROTO) {
Object.getOwnPropertyNames(obj).forEach((key) => {
if (key in clone) {
return;
}
try {
clone[key] = serializeValue(val[key], seen);
} catch (err) {
// delete in case it has a setter from prototype that might throw
delete clone[key];
clone[key] = getUnserializableMessage(err);
}
});
obj = Object.getPrototypeOf(obj);
}
if (val instanceof Error) {
safe(() => clone.message = normalizeErrorMessage(val.message));
}
return clone;
}
}
function safe(fn) {
try {
return fn();
} catch {}
}
function normalizeErrorMessage(message) {
return message.replace(/\(0\s?,\s?__vite_ssr_import_\d+__.(\w+)\)/g, "$1").replace(/__(vite_ssr_import|vi_import)_\d+__\./g, "").replace(/getByTestId('__vitest_\d+__')/g, "page");
}
export { serializeValue };
@@ -0,0 +1,320 @@
"use client";
// src/popover.tsx
import * as React from "react";
import { composeEventHandlers } from "@radix-ui/primitive";
import { useComposedRefs } from "@radix-ui/react-compose-refs";
import { createContextScope } from "@radix-ui/react-context";
import { DismissableLayer } from "@radix-ui/react-dismissable-layer";
import { useFocusGuards } from "@radix-ui/react-focus-guards";
import { FocusScope } from "@radix-ui/react-focus-scope";
import { useId } from "@radix-ui/react-id";
import * as PopperPrimitive from "@radix-ui/react-popper";
import { createPopperScope } from "@radix-ui/react-popper";
import { Portal as PortalPrimitive } from "@radix-ui/react-portal";
import { Presence } from "@radix-ui/react-presence";
import { Primitive } from "@radix-ui/react-primitive";
import { createSlot } from "@radix-ui/react-slot";
import { useControllableState } from "@radix-ui/react-use-controllable-state";
import { hideOthers } from "aria-hidden";
import { RemoveScroll } from "react-remove-scroll";
import { jsx } from "react/jsx-runtime";
var POPOVER_NAME = "Popover";
var [createPopoverContext, createPopoverScope] = createContextScope(POPOVER_NAME, [
createPopperScope
]);
var usePopperScope = createPopperScope();
var [PopoverProvider, usePopoverContext] = createPopoverContext(POPOVER_NAME);
var Popover = (props) => {
const {
__scopePopover,
children,
open: openProp,
defaultOpen,
onOpenChange,
modal = false
} = props;
const popperScope = usePopperScope(__scopePopover);
const triggerRef = React.useRef(null);
const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false);
const [open, setOpen] = useControllableState({
prop: openProp,
defaultProp: defaultOpen ?? false,
onChange: onOpenChange,
caller: POPOVER_NAME
});
return /* @__PURE__ */ jsx(PopperPrimitive.Root, { ...popperScope, children: /* @__PURE__ */ jsx(
PopoverProvider,
{
scope: __scopePopover,
contentId: useId(),
triggerRef,
open,
onOpenChange: setOpen,
onOpenToggle: React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
hasCustomAnchor,
onCustomAnchorAdd: React.useCallback(() => setHasCustomAnchor(true), []),
onCustomAnchorRemove: React.useCallback(() => setHasCustomAnchor(false), []),
modal,
children
}
) });
};
Popover.displayName = POPOVER_NAME;
var ANCHOR_NAME = "PopoverAnchor";
var PopoverAnchor = React.forwardRef(
(props, forwardedRef) => {
const { __scopePopover, ...anchorProps } = props;
const context = usePopoverContext(ANCHOR_NAME, __scopePopover);
const popperScope = usePopperScope(__scopePopover);
const { onCustomAnchorAdd, onCustomAnchorRemove } = context;
React.useEffect(() => {
onCustomAnchorAdd();
return () => onCustomAnchorRemove();
}, [onCustomAnchorAdd, onCustomAnchorRemove]);
return /* @__PURE__ */ jsx(PopperPrimitive.Anchor, { ...popperScope, ...anchorProps, ref: forwardedRef });
}
);
PopoverAnchor.displayName = ANCHOR_NAME;
var TRIGGER_NAME = "PopoverTrigger";
var PopoverTrigger = React.forwardRef(
(props, forwardedRef) => {
const { __scopePopover, ...triggerProps } = props;
const context = usePopoverContext(TRIGGER_NAME, __scopePopover);
const popperScope = usePopperScope(__scopePopover);
const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
const trigger = /* @__PURE__ */ jsx(
Primitive.button,
{
type: "button",
"aria-haspopup": "dialog",
"aria-expanded": context.open,
"aria-controls": context.contentId,
"data-state": getState(context.open),
...triggerProps,
ref: composedTriggerRef,
onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
}
);
return context.hasCustomAnchor ? trigger : /* @__PURE__ */ jsx(PopperPrimitive.Anchor, { asChild: true, ...popperScope, children: trigger });
}
);
PopoverTrigger.displayName = TRIGGER_NAME;
var PORTAL_NAME = "PopoverPortal";
var [PortalProvider, usePortalContext] = createPopoverContext(PORTAL_NAME, {
forceMount: void 0
});
var PopoverPortal = (props) => {
const { __scopePopover, forceMount, children, container } = props;
const context = usePopoverContext(PORTAL_NAME, __scopePopover);
return /* @__PURE__ */ jsx(PortalProvider, { scope: __scopePopover, forceMount, children: /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx(PortalPrimitive, { asChild: true, container, children }) }) });
};
PopoverPortal.displayName = PORTAL_NAME;
var CONTENT_NAME = "PopoverContent";
var PopoverContent = React.forwardRef(
(props, forwardedRef) => {
const portalContext = usePortalContext(CONTENT_NAME, props.__scopePopover);
const { forceMount = portalContext.forceMount, ...contentProps } = props;
const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);
return /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: context.modal ? /* @__PURE__ */ jsx(PopoverContentModal, { ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx(PopoverContentNonModal, { ...contentProps, ref: forwardedRef }) });
}
);
PopoverContent.displayName = CONTENT_NAME;
var Slot = createSlot("PopoverContent.RemoveScroll");
var PopoverContentModal = React.forwardRef(
(props, forwardedRef) => {
const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);
const contentRef = React.useRef(null);
const composedRefs = useComposedRefs(forwardedRef, contentRef);
const isRightClickOutsideRef = React.useRef(false);
React.useEffect(() => {
const content = contentRef.current;
if (content) return hideOthers(content);
}, []);
return /* @__PURE__ */ jsx(RemoveScroll, { as: Slot, allowPinchZoom: true, children: /* @__PURE__ */ jsx(
PopoverContentImpl,
{
...props,
ref: composedRefs,
trapFocus: context.open,
disableOutsidePointerEvents: true,
onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
event.preventDefault();
if (!isRightClickOutsideRef.current) context.triggerRef.current?.focus();
}),
onPointerDownOutside: composeEventHandlers(
props.onPointerDownOutside,
(event) => {
const originalEvent = event.detail.originalEvent;
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
isRightClickOutsideRef.current = isRightClick;
},
{ checkForDefaultPrevented: false }
),
onFocusOutside: composeEventHandlers(
props.onFocusOutside,
(event) => event.preventDefault(),
{ checkForDefaultPrevented: false }
)
}
) });
}
);
var PopoverContentNonModal = React.forwardRef(
(props, forwardedRef) => {
const context = usePopoverContext(CONTENT_NAME, props.__scopePopover);
const hasInteractedOutsideRef = React.useRef(false);
const hasPointerDownOutsideRef = React.useRef(false);
return /* @__PURE__ */ jsx(
PopoverContentImpl,
{
...props,
ref: forwardedRef,
trapFocus: false,
disableOutsidePointerEvents: false,
onCloseAutoFocus: (event) => {
props.onCloseAutoFocus?.(event);
if (!event.defaultPrevented) {
if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();
event.preventDefault();
}
hasInteractedOutsideRef.current = false;
hasPointerDownOutsideRef.current = false;
},
onInteractOutside: (event) => {
props.onInteractOutside?.(event);
if (!event.defaultPrevented) {
hasInteractedOutsideRef.current = true;
if (event.detail.originalEvent.type === "pointerdown") {
hasPointerDownOutsideRef.current = true;
}
}
const target = event.target;
const targetIsTrigger = context.triggerRef.current?.contains(target);
if (targetIsTrigger) event.preventDefault();
if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) {
event.preventDefault();
}
}
}
);
}
);
var PopoverContentImpl = React.forwardRef(
(props, forwardedRef) => {
const {
__scopePopover,
trapFocus,
onOpenAutoFocus,
onCloseAutoFocus,
disableOutsidePointerEvents,
onEscapeKeyDown,
onPointerDownOutside,
onFocusOutside,
onInteractOutside,
...contentProps
} = props;
const context = usePopoverContext(CONTENT_NAME, __scopePopover);
const popperScope = usePopperScope(__scopePopover);
useFocusGuards();
return /* @__PURE__ */ jsx(
FocusScope,
{
asChild: true,
loop: true,
trapped: trapFocus,
onMountAutoFocus: onOpenAutoFocus,
onUnmountAutoFocus: onCloseAutoFocus,
children: /* @__PURE__ */ jsx(
DismissableLayer,
{
asChild: true,
disableOutsidePointerEvents,
onInteractOutside,
onEscapeKeyDown,
onPointerDownOutside,
onFocusOutside,
onDismiss: () => context.onOpenChange(false),
children: /* @__PURE__ */ jsx(
PopperPrimitive.Content,
{
"data-state": getState(context.open),
role: "dialog",
id: context.contentId,
...popperScope,
...contentProps,
ref: forwardedRef,
style: {
...contentProps.style,
// re-namespace exposed content custom properties
...{
"--radix-popover-content-transform-origin": "var(--radix-popper-transform-origin)",
"--radix-popover-content-available-width": "var(--radix-popper-available-width)",
"--radix-popover-content-available-height": "var(--radix-popper-available-height)",
"--radix-popover-trigger-width": "var(--radix-popper-anchor-width)",
"--radix-popover-trigger-height": "var(--radix-popper-anchor-height)"
}
}
}
)
}
)
}
);
}
);
var CLOSE_NAME = "PopoverClose";
var PopoverClose = React.forwardRef(
(props, forwardedRef) => {
const { __scopePopover, ...closeProps } = props;
const context = usePopoverContext(CLOSE_NAME, __scopePopover);
return /* @__PURE__ */ jsx(
Primitive.button,
{
type: "button",
...closeProps,
ref: forwardedRef,
onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))
}
);
}
);
PopoverClose.displayName = CLOSE_NAME;
var ARROW_NAME = "PopoverArrow";
var PopoverArrow = React.forwardRef(
(props, forwardedRef) => {
const { __scopePopover, ...arrowProps } = props;
const popperScope = usePopperScope(__scopePopover);
return /* @__PURE__ */ jsx(PopperPrimitive.Arrow, { ...popperScope, ...arrowProps, ref: forwardedRef });
}
);
PopoverArrow.displayName = ARROW_NAME;
function getState(open) {
return open ? "open" : "closed";
}
var Root2 = Popover;
var Anchor2 = PopoverAnchor;
var Trigger = PopoverTrigger;
var Portal = PopoverPortal;
var Content2 = PopoverContent;
var Close = PopoverClose;
var Arrow2 = PopoverArrow;
export {
Anchor2 as Anchor,
Arrow2 as Arrow,
Close,
Content2 as Content,
Popover,
PopoverAnchor,
PopoverArrow,
PopoverClose,
PopoverContent,
PopoverPortal,
PopoverTrigger,
Portal,
Root2 as Root,
Trigger,
createPopoverScope
};
//# sourceMappingURL=index.mjs.map
@@ -0,0 +1,3 @@
# @floating-ui/react-dom
This is the library to use Floating UI with React DOM.
@@ -0,0 +1,100 @@
import type AjvCore from "../core"
import type {AnyValidateFunction, SourceCode} from "../types"
import type {SchemaEnv} from "../compile"
import {UsedScopeValues, UsedValueState, ValueScopeName, varKinds} from "../compile/codegen/scope"
import {_, nil, _Code, Code, getProperty, getEsmExportName} from "../compile/codegen/code"
function standaloneCode(
ajv: AjvCore,
refsOrFunc?: {[K in string]?: string} | AnyValidateFunction
): string {
if (!ajv.opts.code.source) {
throw new Error("moduleCode: ajv instance must have code.source option")
}
const {_n} = ajv.scope.opts
return typeof refsOrFunc == "function"
? funcExportCode(refsOrFunc.source)
: refsOrFunc !== undefined
? multiExportsCode<string>(refsOrFunc, getValidate)
: multiExportsCode<SchemaEnv>(ajv.schemas, (sch) =>
sch.meta ? undefined : ajv.compile(sch.schema)
)
function getValidate(id: string): AnyValidateFunction {
const v = ajv.getSchema(id)
if (!v) throw new Error(`moduleCode: no schema with id ${id}`)
return v
}
function funcExportCode(source?: SourceCode): string {
const usedValues: UsedScopeValues = {}
const n = source?.validateName
const vCode = validateCode(usedValues, source)
if (ajv.opts.code.esm) {
// Always do named export as `validate` rather than the variable `n` which is `validateXX` for known export value
return `"use strict";${_n}export const validate = ${n};${_n}export default ${n};${_n}${vCode}`
}
return `"use strict";${_n}module.exports = ${n};${_n}module.exports.default = ${n};${_n}${vCode}`
}
function multiExportsCode<T extends SchemaEnv | string>(
schemas: {[K in string]?: T},
getValidateFunc: (schOrId: T) => AnyValidateFunction | undefined
): string {
const usedValues: UsedScopeValues = {}
let code = _`"use strict";`
for (const name in schemas) {
const v = getValidateFunc(schemas[name] as T)
if (v) {
const vCode = validateCode(usedValues, v.source)
const exportSyntax = ajv.opts.code.esm
? _`export const ${getEsmExportName(name)}`
: _`exports${getProperty(name)}`
code = _`${code}${_n}${exportSyntax} = ${v.source?.validateName};${_n}${vCode}`
}
}
return `${code}`
}
function validateCode(usedValues: UsedScopeValues, s?: SourceCode): Code {
if (!s) throw new Error('moduleCode: function does not have "source" property')
if (usedState(s.validateName) === UsedValueState.Completed) return nil
setUsedState(s.validateName, UsedValueState.Started)
const scopeCode = ajv.scope.scopeCode(s.scopeValues, usedValues, refValidateCode)
const code = new _Code(`${scopeCode}${_n}${s.validateCode}`)
return s.evaluated ? _`${code}${s.validateName}.evaluated = ${s.evaluated};${_n}` : code
function refValidateCode(n: ValueScopeName): Code | undefined {
const vRef = n.value?.ref
if (n.prefix === "validate" && typeof vRef == "function") {
const v = vRef as AnyValidateFunction
return validateCode(usedValues, v.source)
} else if ((n.prefix === "root" || n.prefix === "wrapper") && typeof vRef == "object") {
const {validate, validateName} = vRef as SchemaEnv
if (!validateName) throw new Error("ajv internal error")
const def = ajv.opts.code.es5 ? varKinds.var : varKinds.const
const wrapper = _`${def} ${n} = {validate: ${validateName}};`
if (usedState(validateName) === UsedValueState.Started) return wrapper
const vCode = validateCode(usedValues, validate?.source)
return _`${wrapper}${_n}${vCode}`
}
return undefined
}
function usedState(name: ValueScopeName): UsedValueState | undefined {
return usedValues[name.prefix]?.get(name)
}
function setUsedState(name: ValueScopeName, state: UsedValueState): void {
const {prefix} = name
const names = (usedValues[prefix] = usedValues[prefix] || new Map())
names.set(name, state)
}
}
}
module.exports = exports = standaloneCode
Object.defineProperty(exports, "__esModule", {value: true})
export default standaloneCode
@@ -0,0 +1,32 @@
import { RouteIds } from './routeInfo.cjs';
import { RegisteredRouter } from './router.cjs';
export type NotFoundError = {
/**
@deprecated
Use `routeId: rootRouteId` instead
*/
global?: boolean;
/**
@private
Do not use this. It's used internally to indicate a path matching error
*/
_global?: boolean;
data?: any;
throw?: boolean;
routeId?: RouteIds<RegisteredRouter['routeTree']>;
headers?: HeadersInit;
};
/**
* Create a not-found error object recognized by TanStack Router.
*
* Throw this from loaders/actions to trigger the nearest `notFoundComponent`.
* Use `routeId` to target a specific route's not-found boundary. If `throw`
* is true, the error is thrown instead of returned.
*
* @param options Optional settings including `routeId`, `headers`, and `throw`.
* @returns A not-found error object that can be thrown or returned.
* @link https://tanstack.com/router/latest/docs/router/framework/react/api/router/notFoundFunction
*/
export declare function notFound(options?: NotFoundError): NotFoundError;
/** Determine if a value is a TanStack Router not-found error. */
export declare function isNotFound(obj: any): obj is NotFoundError;
@@ -0,0 +1,2 @@
import type { LibDefinition } from '../variable';
export declare const dom: LibDefinition;
@@ -0,0 +1,82 @@
import { createReadStream } from "node:fs";
import * as fs from "node:fs/promises";
import * as stream from "node:stream";
import { describe, it, expect, vi } from "vitest";
import type { Handler, ParserOptions } from "./Parser.js";
import { WritableStream } from "./WritableStream.js";
import * as helper from "./__fixtures__/testHelper.js";
describe("WritableStream", () => {
it("should decode fragmented unicode characters", () => {
const ontext = vi.fn();
const stream = new WritableStream({ ontext });
stream.write(Buffer.from([0xe2, 0x82]));
stream.write(Buffer.from([0xac]));
stream.write("");
stream.end();
expect(ontext).toHaveBeenCalledWith("€");
});
it("Basic html", () => testStream("Basic.html"));
it("Attributes", () => testStream("Attributes.html"));
it("SVG", () => testStream("Svg.html"));
it("RSS feed", () => testStream("RSS_Example.xml", { xmlMode: true }));
it("Atom feed", () => testStream("Atom_Example.xml", { xmlMode: true }));
it("RDF feed", () => testStream("RDF_Example.xml", { xmlMode: true }));
});
function getPromiseEventCollector(): [
handler: Partial<Handler>,
promise: Promise<unknown>,
] {
let handler: Partial<Handler> | undefined;
const promise = new Promise<unknown>((resolve, reject) => {
handler = helper.getEventCollector((error, events) => {
if (error) {
reject(error);
} else {
resolve(events);
}
});
});
return [handler!, promise];
}
// TODO[engine:node@>=16]: Use promise version of `stream.finished` instead.
function finished(input: Parameters<typeof stream.finished>[0]): Promise<void> {
return new Promise((resolve, reject) => {
stream.finished(input, (error) => (error ? reject(error) : resolve()));
});
}
async function testStream(
file: string,
options?: ParserOptions,
): Promise<void> {
const filePath = new URL(`__fixtures__/Documents/${file}`, import.meta.url);
const [streamHandler, eventsPromise] = getPromiseEventCollector();
const fsStream = createReadStream(filePath).pipe(
new WritableStream(streamHandler, options),
);
await finished(fsStream);
const events = await eventsPromise;
expect(events).toMatchSnapshot();
const [singlePassHandler, singlePassPromise] = getPromiseEventCollector();
const singlePassStream = new WritableStream(singlePassHandler, options).end(
await fs.readFile(filePath),
);
await finished(singlePassStream);
expect(await singlePassPromise).toStrictEqual(events);
}
@@ -0,0 +1,223 @@
import { CSSProperties, PropsWithoutRef, RefAttributes, JSX, SVGAttributes } from 'react';
import { MotionNodeOptions, MotionValue, TransformProperties, SVGPathProperties } from 'motion-dom';
/**
* Either a string, or array of strings, that reference variants defined via the `variants` prop.
* @public
*/
type VariantLabels = string | string[];
type MotionValueString = MotionValue<string>;
type MotionValueNumber = MotionValue<number>;
type MotionValueAny = MotionValue<any>;
type AnyMotionValue = MotionValueNumber | MotionValueString | MotionValueAny;
type MotionValueHelper<T> = T | AnyMotionValue;
type MakeMotionHelper<T> = {
[K in keyof T]: MotionValueHelper<T[K]>;
};
type MakeCustomValueTypeHelper<T> = MakeMotionHelper<T>;
type MakeMotion<T> = MakeCustomValueTypeHelper<T>;
type MotionCSS = MakeMotion<Omit<CSSProperties, "rotate" | "scale" | "perspective" | "x" | "y" | "z">>;
/**
* @public
*/
type MotionTransform = MakeMotion<TransformProperties>;
type MotionSVGProps = MakeMotion<SVGPathProperties>;
/**
* @public
*/
interface MotionStyle extends MotionCSS, MotionTransform, MotionSVGProps {
}
/**
* Props for `motion` components.
*
* @public
*/
interface MotionProps extends MotionNodeOptions {
/**
*
* The React DOM `style` prop, enhanced with support for `MotionValue`s and separate `transform` values.
*
* ```jsx
* export const MyComponent = () => {
* const x = useMotionValue(0)
*
* return <motion.div style={{ x, opacity: 1, scale: 0.5 }} />
* }
* ```
*/
style?: MotionStyle;
children?: React.ReactNode | MotionValueNumber | MotionValueString;
}
interface HTMLElements {
a: HTMLAnchorElement;
abbr: HTMLElement;
address: HTMLElement;
area: HTMLAreaElement;
article: HTMLElement;
aside: HTMLElement;
audio: HTMLAudioElement;
b: HTMLElement;
base: HTMLBaseElement;
bdi: HTMLElement;
bdo: HTMLElement;
big: HTMLElement;
blockquote: HTMLQuoteElement;
body: HTMLBodyElement;
br: HTMLBRElement;
button: HTMLButtonElement;
canvas: HTMLCanvasElement;
caption: HTMLElement;
center: HTMLElement;
cite: HTMLElement;
code: HTMLElement;
col: HTMLTableColElement;
colgroup: HTMLTableColElement;
data: HTMLDataElement;
datalist: HTMLDataListElement;
dd: HTMLElement;
del: HTMLModElement;
details: HTMLDetailsElement;
dfn: HTMLElement;
dialog: HTMLDialogElement;
div: HTMLDivElement;
dl: HTMLDListElement;
dt: HTMLElement;
em: HTMLElement;
embed: HTMLEmbedElement;
fieldset: HTMLFieldSetElement;
figcaption: HTMLElement;
figure: HTMLElement;
footer: HTMLElement;
form: HTMLFormElement;
h1: HTMLHeadingElement;
h2: HTMLHeadingElement;
h3: HTMLHeadingElement;
h4: HTMLHeadingElement;
h5: HTMLHeadingElement;
h6: HTMLHeadingElement;
head: HTMLHeadElement;
header: HTMLElement;
hgroup: HTMLElement;
hr: HTMLHRElement;
html: HTMLHtmlElement;
i: HTMLElement;
iframe: HTMLIFrameElement;
img: HTMLImageElement;
input: HTMLInputElement;
ins: HTMLModElement;
kbd: HTMLElement;
keygen: HTMLElement;
label: HTMLLabelElement;
legend: HTMLLegendElement;
li: HTMLLIElement;
link: HTMLLinkElement;
main: HTMLElement;
map: HTMLMapElement;
mark: HTMLElement;
menu: HTMLElement;
menuitem: HTMLElement;
meta: HTMLMetaElement;
meter: HTMLMeterElement;
nav: HTMLElement;
noindex: HTMLElement;
noscript: HTMLElement;
object: HTMLObjectElement;
ol: HTMLOListElement;
optgroup: HTMLOptGroupElement;
option: HTMLOptionElement;
output: HTMLOutputElement;
p: HTMLParagraphElement;
param: HTMLParamElement;
picture: HTMLElement;
pre: HTMLPreElement;
progress: HTMLProgressElement;
q: HTMLQuoteElement;
rp: HTMLElement;
rt: HTMLElement;
ruby: HTMLElement;
s: HTMLElement;
samp: HTMLElement;
search: HTMLElement;
slot: HTMLSlotElement;
script: HTMLScriptElement;
section: HTMLElement;
select: HTMLSelectElement;
small: HTMLElement;
source: HTMLSourceElement;
span: HTMLSpanElement;
strong: HTMLElement;
style: HTMLStyleElement;
sub: HTMLElement;
summary: HTMLElement;
sup: HTMLElement;
table: HTMLTableElement;
template: HTMLTemplateElement;
tbody: HTMLTableSectionElement;
td: HTMLTableDataCellElement;
textarea: HTMLTextAreaElement;
tfoot: HTMLTableSectionElement;
th: HTMLTableHeaderCellElement;
thead: HTMLTableSectionElement;
time: HTMLTimeElement;
title: HTMLTitleElement;
tr: HTMLTableRowElement;
track: HTMLTrackElement;
u: HTMLElement;
ul: HTMLUListElement;
var: HTMLElement;
video: HTMLVideoElement;
wbr: HTMLElement;
webview: HTMLWebViewElement;
}
/**
* @public
*/
type ForwardRefComponent<T, P> = {
readonly $$typeof: symbol;
} & ((props: PropsWithoutRef<P> & RefAttributes<T>) => JSX.Element);
type AttributesWithoutMotionProps<Attributes> = {
[K in Exclude<keyof Attributes, keyof MotionProps>]?: Attributes[K];
};
/**
* @public
*/
type HTMLMotionProps<Tag extends keyof HTMLElements> = AttributesWithoutMotionProps<JSX.IntrinsicElements[Tag]> & MotionProps;
/**
* Motion-optimised versions of React's HTML components.
*
* @public
*/
type HTMLMotionComponents = {
[K in keyof HTMLElements]: ForwardRefComponent<HTMLElements[K], HTMLMotionProps<K>>;
};
type UnionStringArray<T extends Readonly<string[]>> = T[number];
declare const svgElements: readonly ["animate", "circle", "defs", "desc", "ellipse", "g", "image", "line", "filter", "marker", "mask", "metadata", "path", "pattern", "polygon", "polyline", "rect", "stop", "svg", "switch", "symbol", "text", "tspan", "use", "view", "clipPath", "feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence", "foreignObject", "linearGradient", "radialGradient", "textPath"];
type SVGElements = UnionStringArray<typeof svgElements>;
interface SVGAttributesWithoutMotionProps<T> extends Pick<SVGAttributes<T>, Exclude<keyof SVGAttributes<T>, keyof MotionProps>> {
}
/**
* Blanket-accept any SVG attribute as a `MotionValue`
* @public
*/
type SVGAttributesAsMotionValues<T> = MakeMotion<SVGAttributesWithoutMotionProps<T>>;
type UnwrapSVGFactoryElement<F> = F extends React.SVGProps<infer P> ? P : never;
/**
* @public
*/
interface SVGMotionProps<T> extends SVGAttributesAsMotionValues<T>, MotionProps {
}
/**
* Motion-optimised versions of React's SVG components.
*
* @public
*/
type SVGMotionComponents = {
[K in SVGElements]: ForwardRefComponent<UnwrapSVGFactoryElement<JSX.IntrinsicElements[K]>, SVGMotionProps<UnwrapSVGFactoryElement<JSX.IntrinsicElements[K]>>>;
};
export type { ForwardRefComponent as F, HTMLMotionComponents as H, MotionProps as M, SVGMotionComponents as S, VariantLabels as V, HTMLElements as a, HTMLMotionProps as b, MotionStyle as c, MotionTransform as d, SVGAttributesAsMotionValues as e, SVGMotionProps as f };
@@ -0,0 +1,53 @@
import { isCSSVar } from '../../render/dom/is-css-var.mjs';
import { transformProps } from '../../render/utils/keys-transform.mjs';
import { isHTMLElement } from '../../utils/is-html-element.mjs';
import { MotionValue } from '../../value/index.mjs';
import { createSelectorEffect } from '../utils/create-dom-effect.mjs';
import { createEffect } from '../utils/create-effect.mjs';
import { buildTransform } from './transform.mjs';
const originProps = new Set(["originX", "originY", "originZ"]);
const addStyleValue = (element, state, key, value) => {
let render = undefined;
let computed = undefined;
if (transformProps.has(key)) {
if (!state.get("transform")) {
// If this is an HTML element, we need to set the transform-box to fill-box
// to normalise the transform relative to the element's bounding box
if (!isHTMLElement(element) && !state.get("transformBox")) {
addStyleValue(element, state, "transformBox", new MotionValue("fill-box"));
}
state.set("transform", new MotionValue("none"), () => {
element.style.transform = buildTransform(state);
});
}
computed = state.get("transform");
}
else if (originProps.has(key)) {
if (!state.get("transformOrigin")) {
state.set("transformOrigin", new MotionValue(""), () => {
const originX = state.latest.originX ?? "50%";
const originY = state.latest.originY ?? "50%";
const originZ = state.latest.originZ ?? 0;
element.style.transformOrigin = `${originX} ${originY} ${originZ}`;
});
}
computed = state.get("transformOrigin");
}
else if (isCSSVar(key)) {
render = () => {
element.style.setProperty(key, state.latest[key]);
};
}
else {
render = () => {
element.style[key] = state.latest[key];
};
}
return state.set(key, value, render, computed);
};
const styleEffect = /*@__PURE__*/ createSelectorEffect(
/*@__PURE__*/ createEffect(addStyleValue));
export { addStyleValue, styleEffect };
//# sourceMappingURL=index.mjs.map
@@ -0,0 +1,23 @@
/**
* @license lucide-react v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/
import createLucideIcon from '../createLucideIcon.js';
const Bomb = createLucideIcon("Bomb", [
["circle", { cx: "11", cy: "13", r: "9", key: "hd149" }],
[
"path",
{
d: "M14.35 4.65 16.3 2.7a2.41 2.41 0 0 1 3.4 0l1.6 1.6a2.4 2.4 0 0 1 0 3.4l-1.95 1.95",
key: "jp4j1b"
}
],
["path", { d: "m22 2-1.5 1.5", key: "ay92ug" }]
]);
export { Bomb as default };
//# sourceMappingURL=bomb.js.map
@@ -0,0 +1,20 @@
import { ClientErrorStatusCode, ContentfulStatusCode, ServerErrorStatusCode } from "../utils/http-status.js";
import { ClientResponse, FilterClientResponseByStatusCode } from "./types.js";
import { DetailedError } from "./fetch-result-please.js";
//#region src/client/utils.d.ts
export declare const mergePath: (base: string, path: string) => string;
export declare const replaceUrlParam: (urlString: string, params: Record<string, string | undefined>) => string;
export declare const buildSearchParams: (query: Record<string, string | string[]>) => URLSearchParams;
export declare const replaceUrlProtocol: (urlString: string, protocol: "ws" | "http") => string;
export declare const removeIndexString: (urlString: string) => string;
export declare function deepMerge<T>(target: T, source: Record<string, unknown>): T;
/**
* Shortcut to get a consumable response from `hc`'s fetch calls (Response), with types inference.
*
* Smartly parse the response data, throwing a structured error if the response is not `ok`. ({@link DetailedError})
*
* @example const result = await parseResponse(client.posts.$get())
*/
export declare function parseResponse<T extends ClientResponse<any>>(fetchRes: T | Promise<T>): Promise<FilterClientResponseByStatusCode<T, Exclude<ContentfulStatusCode, ClientErrorStatusCode | ServerErrorStatusCode>> extends never ? undefined : FilterClientResponseByStatusCode<T, Exclude<ContentfulStatusCode, ClientErrorStatusCode | ServerErrorStatusCode>> extends ClientResponse<infer RT, infer _, infer RF> ? RF extends 'json' ? RT : RT extends string ? RT : string : undefined>;
//#endregion
export { DetailedError };
@@ -0,0 +1,97 @@
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABILITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/// <reference lib="es2020.bigint" />
interface Atomics {
/**
* Adds a value to the value at the given position in the array, returning the original value.
* Until this atomic operation completes, any other read or write operation against the array
* will block.
*/
add(typedArray: BigInt64Array<ArrayBufferLike> | BigUint64Array<ArrayBufferLike>, index: number, value: bigint): bigint;
/**
* Stores the bitwise AND of a value with the value at the given position in the array,
* returning the original value. Until this atomic operation completes, any other read or
* write operation against the array will block.
*/
and(typedArray: BigInt64Array<ArrayBufferLike> | BigUint64Array<ArrayBufferLike>, index: number, value: bigint): bigint;
/**
* Replaces the value at the given position in the array if the original value equals the given
* expected value, returning the original value. Until this atomic operation completes, any
* other read or write operation against the array will block.
*/
compareExchange(typedArray: BigInt64Array<ArrayBufferLike> | BigUint64Array<ArrayBufferLike>, index: number, expectedValue: bigint, replacementValue: bigint): bigint;
/**
* Replaces the value at the given position in the array, returning the original value. Until
* this atomic operation completes, any other read or write operation against the array will
* block.
*/
exchange(typedArray: BigInt64Array<ArrayBufferLike> | BigUint64Array<ArrayBufferLike>, index: number, value: bigint): bigint;
/**
* Returns the value at the given position in the array. Until this atomic operation completes,
* any other read or write operation against the array will block.
*/
load(typedArray: BigInt64Array<ArrayBufferLike> | BigUint64Array<ArrayBufferLike>, index: number): bigint;
/**
* Stores the bitwise OR of a value with the value at the given position in the array,
* returning the original value. Until this atomic operation completes, any other read or write
* operation against the array will block.
*/
or(typedArray: BigInt64Array<ArrayBufferLike> | BigUint64Array<ArrayBufferLike>, index: number, value: bigint): bigint;
/**
* Stores a value at the given position in the array, returning the new value. Until this
* atomic operation completes, any other read or write operation against the array will block.
*/
store(typedArray: BigInt64Array<ArrayBufferLike> | BigUint64Array<ArrayBufferLike>, index: number, value: bigint): bigint;
/**
* Subtracts a value from the value at the given position in the array, returning the original
* value. Until this atomic operation completes, any other read or write operation against the
* array will block.
*/
sub(typedArray: BigInt64Array<ArrayBufferLike> | BigUint64Array<ArrayBufferLike>, index: number, value: bigint): bigint;
/**
* If the value at the given position in the array is equal to the provided value, the current
* agent is put to sleep causing execution to suspend until the timeout expires (returning
* `"timed-out"`) or until the agent is awoken (returning `"ok"`); otherwise, returns
* `"not-equal"`.
*/
wait(typedArray: BigInt64Array<ArrayBufferLike>, index: number, value: bigint, timeout?: number): "ok" | "not-equal" | "timed-out";
/**
* Wakes up sleeping agents that are waiting on the given index of the array, returning the
* number of agents that were awoken.
* @param typedArray A shared BigInt64Array.
* @param index The position in the typedArray to wake up on.
* @param count The number of sleeping agents to notify. Defaults to +Infinity.
*/
notify(typedArray: BigInt64Array<ArrayBufferLike>, index: number, count?: number): number;
/**
* Stores the bitwise XOR of a value with the value at the given position in the array,
* returning the original value. Until this atomic operation completes, any other read or write
* operation against the array will block.
*/
xor(typedArray: BigInt64Array<ArrayBufferLike> | BigUint64Array<ArrayBufferLike>, index: number, value: bigint): bigint;
}
@@ -0,0 +1,621 @@
import { n as require_ast_utils } from "./vendor.js";
import { env } from "node:process";
import { AST_NODE_TYPES, AST_TOKEN_TYPES } from "@typescript-eslint/types";
import { KEYS } from "eslint-visitor-keys";
import { latestEcmaVersion, tokenize } from "espree";
import { traverse } from "estraverse";
function createAllConfigs(plugin, name, filter) {
const rules = Object.fromEntries(Object.entries(plugin.rules).filter(([key, rule]) => rule.meta.fixable && !rule.meta.deprecated && !rule.meta.experimental && key === rule.meta.docs.url.split("/").pop() && (!filter || filter(key, rule))).map(([key]) => [`${name}/${key}`, 2]));
return {
plugins: { [name]: plugin },
rules
};
}
const warned = /* @__PURE__ */ new Set();
function warnOnce(text) {
if (env.TEST || warned.has(text)) return;
warned.add(text);
console.warn(`[@stylistic/eslint-plugin]: ${text}`);
}
function warnDeprecation(value, instead, rule = "") {
let message = `You are using deprecated ${value}${rule ? ` in "${rule}"` : ""}`;
if (instead) message += `, please use ${instead} instead.`;
return warnOnce(message);
}
function warnDeprecatedOptions(options, keys, instead, rule = "") {
if (!Array.isArray(keys)) keys = [keys];
keys.forEach((key) => {
if (options && Object.hasOwn(options, key)) warnDeprecation(`option("${key.toString()}")`, instead ? `"${instead.toString()}"` : void 0, rule);
});
}
var import_ast_utils = require_ast_utils();
const COMMENTS_IGNORE_PATTERN = /^\s*(?:eslint|jshint\s+|jslint\s+|istanbul\s+|globals?\s+|exported\s+|jscs)/u;
const LINEBREAKS = /* @__PURE__ */ new Set([
"\r\n",
"\r",
"\n",
"\u2028",
"\u2029"
]);
const STATEMENT_LIST_PARENTS = /* @__PURE__ */ new Set([
"Program",
"BlockStatement",
"StaticBlock",
"SwitchCase"
]);
const DECIMAL_INTEGER_PATTERN = /^(?:0|0[0-7]*[89]\d*|[1-9](?:_?\d)*)$/u;
const OCTAL_OR_NON_OCTAL_DECIMAL_ESCAPE_PATTERN = /^(?:[^\\]|\\.)*\\(?:[1-9]|0\d)/su;
const ASSIGNMENT_OPERATOR = [
"=",
"+=",
"-=",
"*=",
"/=",
"%=",
"<<=",
">>=",
">>>=",
"|=",
"^=",
"&=",
"**=",
"||=",
"&&=",
"??="
];
const ES3_KEYWORDS = [
"abstract",
"boolean",
"break",
"byte",
"case",
"catch",
"char",
"class",
"const",
"continue",
"debugger",
"default",
"delete",
"do",
"double",
"else",
"enum",
"export",
"extends",
"false",
"final",
"finally",
"float",
"for",
"function",
"goto",
"if",
"implements",
"import",
"in",
"instanceof",
"int",
"interface",
"long",
"native",
"new",
"null",
"package",
"private",
"protected",
"public",
"return",
"short",
"static",
"super",
"switch",
"synchronized",
"this",
"throw",
"throws",
"transient",
"true",
"try",
"typeof",
"var",
"void",
"volatile",
"while",
"with"
];
const KEYWORDS = [
...ES3_KEYWORDS,
"arguments",
"as",
"async",
"await",
"eval",
"from",
"get",
"let",
"of",
"set",
"type",
"using",
"yield"
].concat(["accessor", "satisfies"]);
function createGlobalLinebreakMatcher() {
return new RegExp(import_ast_utils.LINEBREAK_MATCHER.source, "gu");
}
const anyFunctionPattern = /^(?:Function(?:Declaration|Expression)|ArrowFunctionExpression)$/u;
function getUpperFunction(node) {
for (let currentNode = node; currentNode; currentNode = currentNode.parent) if (anyFunctionPattern.test(currentNode.type)) return currentNode;
return null;
}
function isNullLiteral(node) {
return node.type === "Literal" && node.value === null && !("regex" in node) && !("bigint" in node);
}
function getStaticStringValue(node) {
switch (node.type) {
case "Literal":
if (node.value === null) {
if (isNullLiteral(node)) return String(node.value);
if (isRegExpLiteral(node)) return `/${node.regex.pattern}/${node.regex.flags}`;
if ("bigint" in node && node.bigint) return node.bigint;
} else return String(node.value);
break;
case "TemplateLiteral":
if (node.expressions.length === 0 && node.quasis.length === 1) return node.quasis[0].value.cooked;
break;
}
return null;
}
function getStaticPropertyName(node) {
let prop;
if (node) switch (node.type) {
case "ChainExpression": return getStaticPropertyName(node.expression);
case "Property":
case "PropertyDefinition":
case "MethodDefinition":
case "ImportAttribute":
prop = node.key;
break;
case "MemberExpression":
prop = node.property;
break;
}
if (prop) {
if (prop.type === "Identifier" && !("computed" in node && node.computed)) return prop.name;
return getStaticStringValue(prop);
}
return null;
}
function skipChainExpression(node) {
return node && node.type === "ChainExpression" ? node.expression : node;
}
function isParenthesised(sourceCode, node) {
const previousToken = sourceCode.getTokenBefore(node);
const nextToken = sourceCode.getTokenAfter(node);
return !!previousToken && !!nextToken && (0, import_ast_utils.isOpeningParenToken)(previousToken) && previousToken.range[1] <= node.range[0] && (0, import_ast_utils.isClosingParenToken)(nextToken) && nextToken.range[0] >= node.range[1];
}
function isEqToken(token) {
return token.value === "=" && token.type === "Punctuator";
}
function isQuestionToken(token) {
return token.value === "?" && token.type === "Punctuator";
}
function isKeywordToken(token) {
return token?.type === "Keyword";
}
function isHashbangComment(comment) {
return comment.type === "Shebang" || comment.type === "Hashbang";
}
function isLogicalExpression(node) {
return node.type === "LogicalExpression" && (node.operator === "&&" || node.operator === "||");
}
function isCoalesceExpression(node) {
return node.type === "LogicalExpression" && node.operator === "??";
}
function isMixedLogicalAndCoalesceExpressions(left, right) {
return isLogicalExpression(left) && isCoalesceExpression(right) || isCoalesceExpression(left) && isLogicalExpression(right);
}
function getSwitchCaseColonToken(node, sourceCode) {
if (node.test) return sourceCode.getTokenAfter(node.test, (token) => (0, import_ast_utils.isColonToken)(token));
return sourceCode.getFirstToken(node, 1);
}
function isTopLevelExpressionStatement(node) {
if (node.type !== "ExpressionStatement") return false;
const parent = node.parent;
return parent.type === "Program" || parent.type === "BlockStatement" && (0, import_ast_utils.isFunction)(parent.parent);
}
function isStringLiteral(node) {
return node.type === "Literal" && typeof node.value === "string" || node.type === "TemplateLiteral";
}
function isRegExpLiteral(node) {
return node.type === "Literal" && "regex" in node;
}
function isSurroundedBy(val, character) {
return val[0] === character && val[val.length - 1] === character;
}
function getPrecedence(node) {
switch (node.type) {
case "SequenceExpression": return 0;
case "AssignmentExpression":
case "ArrowFunctionExpression":
case "YieldExpression": return 1;
case "ConditionalExpression":
case "TSConditionalType": return 3;
case "LogicalExpression": switch (node.operator) {
case "||":
case "??": return 4;
case "&&": return 5;
}
case "BinaryExpression": switch (node.operator) {
case "|": return 6;
case "^": return 7;
case "&": return 8;
case "==":
case "!=":
case "===":
case "!==": return 9;
case "<":
case "<=":
case ">":
case ">=":
case "in":
case "instanceof": return 10;
case "<<":
case ">>":
case ">>>": return 11;
case "+":
case "-": return 12;
case "*":
case "/":
case "%": return 13;
case "**": return 15;
}
case "TSUnionType": return 6;
case "TSIntersectionType": return 8;
case "UnaryExpression":
case "AwaitExpression": return 16;
case "UpdateExpression": return 17;
case "CallExpression":
case "ChainExpression":
case "ImportExpression": return 18;
case "NewExpression": return 19;
case "TSImportType":
case "TSArrayType": return 20;
default:
if (node.type in KEYS) return 20;
return -1;
}
}
function isDecimalInteger(node) {
return node.type === "Literal" && typeof node.value === "number" && DECIMAL_INTEGER_PATTERN.test(node.raw);
}
function isDecimalIntegerNumericToken(token) {
return token.type === "Numeric" && DECIMAL_INTEGER_PATTERN.test(token.value);
}
function getNextLocation(sourceCode, { column, line }) {
if (column < sourceCode.lines[line - 1].length) return {
column: column + 1,
line
};
if (line < sourceCode.lines.length) return {
column: 0,
line: line + 1
};
return null;
}
function isNumericLiteral(node) {
return node.type === "Literal" && (typeof node.value === "number" || Boolean("bigint" in node && node.bigint));
}
function canTokensBeAdjacent(leftValue, rightValue) {
const espreeOptions = {
comment: true,
ecmaVersion: latestEcmaVersion,
range: true
};
let leftToken;
if (typeof leftValue === "string") {
let tokens;
try {
tokens = tokenize(leftValue, espreeOptions);
} catch {
return false;
}
const comments = tokens.comments;
leftToken = tokens[tokens.length - 1];
if (comments.length) {
const lastComment = comments[comments.length - 1];
if (!leftToken || lastComment.range[0] > leftToken.range[0]) leftToken = lastComment;
}
} else leftToken = leftValue;
if (isHashbangComment(leftToken)) return false;
let rightToken;
if (typeof rightValue === "string") {
let tokens;
try {
tokens = tokenize(rightValue, espreeOptions);
} catch {
return false;
}
const comments = tokens.comments;
rightToken = tokens[0];
if (comments.length) {
const firstComment = comments[0];
if (!rightToken || firstComment.range[0] < rightToken.range[0]) rightToken = firstComment;
}
} else rightToken = rightValue;
if (leftToken.type === "Punctuator" || rightToken.type === "Punctuator") {
if (leftToken.type === "Punctuator" && rightToken.type === "Punctuator") {
const PLUS_TOKENS = new Set(["+", "++"]);
const MINUS_TOKENS = new Set(["-", "--"]);
return !(PLUS_TOKENS.has(leftToken.value) && PLUS_TOKENS.has(rightToken.value) || MINUS_TOKENS.has(leftToken.value) && MINUS_TOKENS.has(rightToken.value));
}
if (leftToken.type === "Punctuator" && leftToken.value === "/") return ![
"Block",
"Line",
"RegularExpression"
].includes(rightToken.type);
return true;
}
if (leftToken.type === "String" || rightToken.type === "String" || leftToken.type === "Template" || rightToken.type === "Template") return true;
if (leftToken.type !== "Numeric" && rightToken.type === "Numeric" && rightToken.value.startsWith(".")) return true;
if (leftToken.type === "Block" || rightToken.type === "Block" || rightToken.type === "Line") return true;
if (rightToken.type === "PrivateIdentifier") return true;
return false;
}
function hasOctalOrNonOctalDecimalEscapeSequence(rawString) {
return OCTAL_OR_NON_OCTAL_DECIMAL_ESCAPE_PATTERN.test(rawString);
}
const WHITE_SPACES_PATTERN = /^\s*$/u;
function isWhiteSpaces(value) {
return typeof value === "string" ? WHITE_SPACES_PATTERN.test(value) : false;
}
function getFirstNodeInLine(context, node) {
const sourceCode = context.sourceCode;
let token = node;
let lines = null;
do {
token = sourceCode.getTokenBefore(token);
lines = token.type === "JSXText" ? token.value.split("\n") : null;
} while (token.type === "JSXText" && lines && isWhiteSpaces(lines.at(-1)));
return token;
}
function isNodeFirstInLine(context, node) {
const token = getFirstNodeInLine(context, node);
if (!token) return false;
return !(0, import_ast_utils.isTokenOnSameLine)(token, node);
}
function getTokenBeforeClosingBracket(node) {
const attributes = "attributes" in node && node.attributes;
if (!attributes || attributes.length === 0) return node.name;
return attributes[attributes.length - 1];
}
function isSingleLine(node) {
return node.loc.start.line === node.loc.end.line;
}
function getCommentsBetween(sourceCode, left, right) {
return sourceCode.getTokensBetween(left, right, {
includeComments: true,
filter: import_ast_utils.isCommentToken
});
}
function isJSDocComment(token) {
if (token.type !== "Block") return false;
return token.value.startsWith("*");
}
function isObjectNotArray(obj) {
return typeof obj === "object" && obj != null && !Array.isArray(obj);
}
function deepMerge(first = {}, second = {}) {
const keys = new Set(Object.keys(first).concat(Object.keys(second)));
return Array.from(keys).reduce((acc, key) => {
const firstHasKey = key in first;
const secondHasKey = key in second;
const firstValue = first[key];
const secondValue = second[key];
if (firstHasKey && secondHasKey) if (isObjectNotArray(firstValue) && isObjectNotArray(secondValue)) acc[key] = deepMerge(firstValue, secondValue);
else acc[key] = secondValue;
else if (firstHasKey) acc[key] = firstValue;
else acc[key] = secondValue;
return acc;
}, {});
}
function createRule({ name, create, meta }) {
return {
create: ((context) => {
if (meta.deprecated) {
let insted;
if (typeof meta.deprecated !== "boolean") {
const { replacedBy } = meta.deprecated;
if (replacedBy) insted = replacedBy.map(({ rule, plugin }) => `"${rule?.name}"${plugin?.name ? ` in "${plugin.name}"` : ""}`).join(", ");
}
warnDeprecation(`rule("${name}")`, insted);
}
const { defaultOptions = [] } = meta;
const optionsCount = Math.max(context.options.length, defaultOptions.length);
return create(context, Array.from({ length: optionsCount }, (_, i) => {
if (isObjectNotArray(context.options[i]) && isObjectNotArray(defaultOptions[i])) return deepMerge(defaultOptions[i], context.options[i]);
return context.options[i] ?? defaultOptions[i];
}));
}),
meta: {
...meta,
docs: {
...meta.docs,
url: `https://eslint.style/rules/${name}`
}
}
};
}
function safeReplaceTextBetween(sourceCode, left, right, replacement) {
if (sourceCode.commentsExistBetween(left, right)) return null;
const range = [left.range[1], right.range[0]];
return (fixer) => fixer.replaceTextRange(range, typeof replacement === "function" ? replacement() : replacement);
}
function isTextSourceCode(sourceCode) {
return typeof sourceCode.text === "string";
}
function hasLinesAndGetLocFromIndex(sourceCode) {
return typeof sourceCode.getLocFromIndex === "function" && Array.isArray(sourceCode.lines);
}
function isESTreeSourceCode(sourceCode) {
return typeof sourceCode === "object" && sourceCode !== null && "isESTree" in sourceCode && sourceCode.isESTree === true;
}
function traverse$1(ASTnode, visitor) {
const opts = Object.assign({}, { fallback(node) {
return Object.keys(node).filter((key) => key === "children" || key === "argument");
} }, visitor);
opts.keys = Object.assign({}, visitor.keys, {
JSXElement: ["children"],
JSXFragment: ["children"]
});
traverse(ASTnode, opts);
}
function traverseReturns(ASTNode, onReturn) {
const nodeType = ASTNode.type;
if (nodeType === "ReturnStatement") {
onReturn(ASTNode.argument, () => {});
return;
}
if (nodeType === "ArrowFunctionExpression" && ASTNode.expression) {
onReturn(ASTNode.body, () => {});
return;
}
if (nodeType !== "FunctionExpression" && nodeType !== "FunctionDeclaration" && nodeType !== "ArrowFunctionExpression" && nodeType !== "MethodDefinition") return;
traverse$1(ASTNode.body, { enter(node) {
const breakTraverse = () => {
this.break();
};
switch (node.type) {
case "ReturnStatement":
this.skip();
onReturn(node.argument, breakTraverse);
return;
case "BlockStatement":
case "IfStatement":
case "ForStatement":
case "WhileStatement":
case "SwitchStatement":
case "SwitchCase": return;
default: this.skip();
}
} });
}
function getVariable(variables, name) {
return variables.find((variable) => variable.name === name);
}
function variablesInScope(context) {
let scope = context.getScope();
let variables = scope.variables;
while (scope.type !== "global") {
scope = scope.upper;
variables = scope.variables.concat(variables);
}
if (scope.childScopes.length) {
variables = scope.childScopes[0].variables.concat(variables);
if (scope.childScopes[0].childScopes.length) variables = scope.childScopes[0].childScopes[0].variables.concat(variables);
}
variables.reverse();
return variables;
}
function findVariableByName(context, name) {
const variable = getVariable(variablesInScope(context), name);
if (!variable || !variable.defs[0] || !variable.defs[0].node) return null;
if (variable.defs[0].node.type === "TypeAlias") return variable.defs[0].node.right;
if (variable.defs[0].type === "ImportBinding") return variable.defs[0].node;
return variable.defs[0].node.init;
}
const COMPAT_TAG_REGEX = /^[a-z]/;
function isDOMComponent(node) {
const name = getElementType(node);
return COMPAT_TAG_REGEX.test(name);
}
function isJSX(node) {
return node && ["JSXElement", "JSXFragment"].includes(node.type);
}
function isReturningJSX(ASTnode, context, strict = false, ignoreNull = false) {
const isJSXValue = (node) => {
if (!node) return false;
switch (node.type) {
case "ConditionalExpression":
if (strict) return isJSXValue(node.consequent) && isJSXValue(node.alternate);
return isJSXValue(node.consequent) || isJSXValue(node.alternate);
case "LogicalExpression":
if (strict) return isJSXValue(node.left) && isJSXValue(node.right);
return isJSXValue(node.left) || isJSXValue(node.right);
case "SequenceExpression": return isJSXValue(node.expressions[node.expressions.length - 1]);
case "JSXElement":
case "JSXFragment": return true;
case "Literal": return !ignoreNull && node.value === null;
case "Identifier": return isJSX(findVariableByName(context, node.name));
default: return false;
}
};
let found = false;
traverseReturns(ASTnode, (node, breakTraverse) => {
if (isJSXValue(node)) {
found = true;
breakTraverse();
}
});
return found;
}
function getPropName(sourceCode, prop) {
if (prop.type === "JSXSpreadAttribute") return sourceCode.getText(prop.argument);
if (prop.name.type === "JSXNamespacedName") return `${prop.name.namespace.name}:${prop.name.name.name}`;
return prop.name.name;
}
function resolveMemberExpressions(object, property) {
if (object.type === "JSXMemberExpression") return `${resolveMemberExpressions(object.object, object.property)}.${property.name}`;
return `${object.name}.${property.name}`;
}
function getElementType(node) {
if (node.type === "JSXOpeningFragment") return "<>";
const { name } = node;
if (!name) throw new Error("The argument provided is not a JSXElement node.");
if (name.type === "JSXMemberExpression") {
const { object, property } = name;
return resolveMemberExpressions(object, property);
}
if (name.type === "JSXNamespacedName") return `${name.namespace.name}:${name.name.name}`;
return node.name.name;
}
let segmenter;
function isASCII(value) {
return /^[\u0020-\u007F]*$/u.test(value);
}
function getStringLength(value) {
if (isASCII(value)) return value.length;
segmenter ??= new Intl.Segmenter();
return [...segmenter.segment(value)].length;
}
var FixTracker = class {
retainedRange;
constructor(fixer, sourceCode) {
this.fixer = fixer;
this.sourceCode = sourceCode;
this.retainedRange = null;
}
retainRange(range) {
this.retainedRange = range;
return this;
}
retainEnclosingFunction(node) {
const functionNode = getUpperFunction(node);
return this.retainRange(functionNode ? functionNode.range : this.sourceCode.ast.range);
}
retainSurroundingTokens(nodeOrToken) {
const tokenBefore = this.sourceCode.getTokenBefore(nodeOrToken) || nodeOrToken;
const tokenAfter = this.sourceCode.getTokenAfter(nodeOrToken) || nodeOrToken;
return this.retainRange([tokenBefore.range[0], tokenAfter.range[1]]);
}
replaceTextRange(range, text) {
let actualRange;
if (this.retainedRange) actualRange = [Math.min(this.retainedRange[0], range[0]), Math.max(this.retainedRange[1], range[1])];
else actualRange = range;
return this.fixer.replaceTextRange(actualRange, this.sourceCode.text.slice(actualRange[0], range[0]) + text + this.sourceCode.text.slice(range[1], actualRange[1]));
}
remove(nodeOrToken) {
return this.replaceTextRange(nodeOrToken.range, "");
}
};
export { warnDeprecation as $, getStaticPropertyName as A, isMixedLogicalAndCoalesceExpressions as B, WHITE_SPACES_PATTERN as C, getFirstNodeInLine as D, getCommentsBetween as E, isDecimalIntegerNumericToken as F, isRegExpLiteral as G, isNumericLiteral as H, isEqToken as I, isSurroundedBy as J, isSingleLine as K, isHashbangComment as L, getTokenBeforeClosingBracket as M, hasOctalOrNonOctalDecimalEscapeSequence as N, getNextLocation as O, isDecimalInteger as P, warnDeprecatedOptions as Q, isJSDocComment as R, STATEMENT_LIST_PARENTS as S, createGlobalLinebreakMatcher as T, isParenthesised as U, isNodeFirstInLine as V, isQuestionToken as W, isWhiteSpaces as X, isTopLevelExpressionStatement as Y, skipChainExpression as Z, ASSIGNMENT_OPERATOR as _, isDOMComponent as a, KEYWORDS as b, hasLinesAndGetLocFromIndex as c, safeReplaceTextBetween as d, createAllConfigs as et, createRule as f, import_ast_utils as g, AST_TOKEN_TYPES as h, getPropName as i, getSwitchCaseColonToken as j, getPrecedence as k, isESTreeSourceCode as l, AST_NODE_TYPES as m, getStringLength as n, isJSX as o, deepMerge as p, isStringLiteral as q, getElementType as r, isReturningJSX as s, FixTracker as t, isTextSourceCode as u, COMMENTS_IGNORE_PATTERN as v, canTokensBeAdjacent as w, LINEBREAKS as x, ES3_KEYWORDS as y, isKeywordToken as z };
@@ -0,0 +1 @@
{"version":3,"file":"skip-back.js","sources":["../../../src/icons/skip-back.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name SkipBack\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cG9seWdvbiBwb2ludHM9IjE5IDIwIDkgMTIgMTkgNCAxOSAyMCIgLz4KICA8bGluZSB4MT0iNSIgeDI9IjUiIHkxPSIxOSIgeTI9IjUiIC8+Cjwvc3ZnPgo=) - https://lucide.dev/icons/skip-back\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst SkipBack = createLucideIcon('SkipBack', [\n ['polygon', { points: '19 20 9 12 19 4 19 20', key: 'o2sva' }],\n ['line', { x1: '5', x2: '5', y1: '19', y2: '5', key: '1ocqjk' }],\n]);\n\nexport default SkipBack;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,iBAAiB,UAAY,CAAA,CAAA,CAAA;AAAA,CAAA,CAC5C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,CAAA,CAAA,CAAA,CAAE,QAAQ,CAAyB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,SAAS,CAAA,CAAA;AAAA,CAC7D,CAAA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAE,CAAA,CAAA,CAAA,EAAI,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAK,CAAA,CAAA,CAAA,CAAA,EAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAK,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AACjE,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,32 @@
{
"name": "siginfo",
"version": "2.0.0",
"description": "Utility module to print pretty messages on SIGINFO/SIGUSR1",
"main": "index.js",
"dependencies": {},
"devDependencies": {
"standard": "^14.3.4"
},
"scripts": {
"test": "standard"
},
"repository": {
"type": "git",
"url": "git+https://github.com/emilbayes/siginfo.git"
},
"keywords": [
"siginfo",
"sigusr1",
"ctrl",
"t",
"info",
"progress",
"inspect"
],
"author": "Emil Bay <github@tixz.dk>",
"license": "ISC",
"bugs": {
"url": "https://github.com/emilbayes/siginfo/issues"
},
"homepage": "https://github.com/emilbayes/siginfo#readme"
}
@@ -0,0 +1 @@
{"version":3,"file":"RouterClient.cjs","names":[],"sources":["../../../src/ssr/RouterClient.tsx"],"sourcesContent":["import { hydrate } from '@tanstack/router-core/ssr/client'\nimport { Await } from '../awaited'\nimport { RouterProvider } from '../RouterProvider'\nimport type { AnyRouter } from '@tanstack/router-core'\n\nlet hydrationPromise: Promise<void | Array<Array<void>>> | undefined\n\nexport function RouterClient(props: { router: AnyRouter }) {\n if (!hydrationPromise) {\n if (!props.router.stores.matchesId.get().length) {\n hydrationPromise = hydrate(props.router)\n } else {\n hydrationPromise = Promise.resolve()\n }\n }\n return (\n <Await\n promise={hydrationPromise}\n children={() => <RouterProvider router={props.router} />}\n />\n )\n}\n"],"mappings":";;;;;;AAKA,IAAI;AAEJ,SAAgB,aAAa,OAA8B;AACzD,KAAI,CAAC,iBACH,KAAI,CAAC,MAAM,OAAO,OAAO,UAAU,KAAK,CAAC,OACvC,qBAAA,GAAA,iCAAA,SAA2B,MAAM,OAAO;KAExC,oBAAmB,QAAQ,SAAS;AAGxC,QACE,iBAAA,GAAA,kBAAA,KAAC,gBAAA,OAAD;EACE,SAAS;EACT,gBAAgB,iBAAA,GAAA,kBAAA,KAAC,uBAAA,gBAAD,EAAgB,QAAQ,MAAM,QAAU,CAAA;EACxD,CAAA"}
@@ -0,0 +1,13 @@
{
"all": true,
"check-coverage": false,
"reporter": ["text-summary", "text", "html", "json"],
"lines": 86,
"statements": 85.93,
"functions": 82.43,
"branches": 76.06,
"exclude": [
"coverage",
"test"
]
}
@@ -0,0 +1,418 @@
flf2a$ 4 3 7 0 9
pepper.flf by Dr. Pepper (mcscs1jcwj@dct.ac.uk)
Completed and ported to figlet by Juan Car (jc@juguete.quim.ucm.es)
version 1.0 -- 20/Jan/94
version 1.1 -- 18/Feb/94 -- smushmode 0, thanks to Glenn Chappell (ggc@uiuc.edu)
Uses spanish character set with -D option:
_ _
[ = a' \ = e' ] = i' { = o' | = u' } = n ~ = N
$@
$@
$@
$@@
@
/@
. @
@@
@
//@
$ @
@@
@
_/_/@
-/-/ @
@@
_,@
/_`@
._/ @
' @@
@
./@
/.@
@@
_@
(/@
(_X@
@@
@
/@
@
@@
@
/@
| @
@@
@
|@
/ @
@@
@
.|/@
/|`@
@@
@
_ /_@
/' @
@@
@
@
/@
@@
@
__@
@
@@
@
@
.@
@@
@
/@
/' @
@@
_ @
/ /@
/_/ @
@@
@
-/@
/ @
@@
_@
'/@
/_ @
@@
_ @
_/@
._/ @
@@
@
/_/@
/ @
@@
__@
/_ @
._/ @
@@
_ @
/_`@
/_/ @
@@
__@
/@
/' @
@@
_ @
/_/@
/_/ @
@@
_ @
/_/@
/ @
@@
@
.@
. @
@@
@
.@
/ @
@@
@
/@
\@
@@
@
__@
-- @
@@
@
\@
/@
@@
_ @
'_/@
/ @
@@
_ @
/.)@
/_~ @
@@
_ @
/_/@
/ / @
@@
_ @
/_)@
/_) @
@@
_ @
/ `@
/_, @
@@
_ @
/ |@
/_.'@
@@
_ @
/_`@
/_, @
@@
_ @
/_`@
/ $ @
@@
_ @
/ `@
/_; @
@@
@
/_/@
/ / @
@@
@
/@
/ @
@@
_ @
/@
(_/ @
@@
@
/_/@
/`\ @
@@
@
/ @
/_,@
@@
@
/|,/@
/ / @
@@
@
/|/@
/ | @
@@
_ @
/ /@
/_/ @
@@
_ @
/_/@
/$ @
@@
_ @
/ /@
/_\ @
@@
_ @
/_/@
/ \ @
@@
_ @
/_`@
._/ @
@@
__@
/ @
/ @
@@
@
/ /@
/_/ @
@@
@
| |@
|/ @
@@
@
| | |@
|/|/ @
@@
@
\ /@
/'\@
@@
@
/_/@
/ @
@@
_ @
/@
/_.@
@@
__@
/ @
/_ @
@@
@
\ @
\@
@@
_ @
/@
__/ @
@@
@
/|@
@
@@
@
@
__@
@@
@
\@
@
@@
@
_ @
/_|@
@@
@
/_@
/_/@
@@
@
_ @
/_$@
@@
@
_/@
/_/ @
@@
@
_ @
/_'@
@@
@
_/|@
/$ @
@@
@
_ @
/_/@
_/ @@
@
/_@
/ /@
@@
@
.@
/ @
@@
@
.@
/ @
|/ @@
@
/_@
/\ @
@@
@
/@
/ @
@@
@
_ _ @
/ / /@
@@
@
_ @
/ /@
@@
@
_ @
/_/@
@@
@
_ @
/_/@
/$ @@
@
_ @
/_/@
/ @@
@
_@
/ @
@@
@
_@
_\ @
@@
@
_/_@
/$ @
@@
@
@
/_/@
@@
@
@
|/@
@@
@
@
|/|/@
@@
@
@
><@
@@
@
@
/_/@
_/ @@
@
_ @
/_@
@@
_ @
_/ `@
/_ @
@@
@
/@
/ @
@@
_ @
/@
._/`@
@@
@
/|/@
@
@@
@
_'@
/_|@
@@
@
_'@
/_'@
@@
@
,@
/ @
@@
@
_'@
/_/@
@@
@
,@
/_/@
@@
@
_--@
/ / @
@@
--@
/|/@
/ | @
@@
@@ -0,0 +1,43 @@
{
"name": "node-gyp-build",
"version": "4.8.4",
"description": "Build tool and bindings loader for node-gyp that supports prebuilds",
"main": "index.js",
"imports": {
"fs": {
"bare": "builtin:fs",
"default": "fs"
},
"path": {
"bare": "builtin:path",
"default": "path"
},
"os": {
"bare": "builtin:os",
"default": "os"
}
},
"devDependencies": {
"array-shuffle": "^1.0.1",
"standard": "^14.0.0",
"tape": "^5.0.0"
},
"scripts": {
"test": "standard && node test"
},
"bin": {
"node-gyp-build": "./bin.js",
"node-gyp-build-optional": "./optional.js",
"node-gyp-build-test": "./build-test.js"
},
"repository": {
"type": "git",
"url": "https://github.com/prebuild/node-gyp-build.git"
},
"author": "Mathias Buus (@mafintosh)",
"license": "MIT",
"bugs": {
"url": "https://github.com/prebuild/node-gyp-build/issues"
},
"homepage": "https://github.com/prebuild/node-gyp-build"
}
@@ -0,0 +1 @@
module.exports={A:{D:{"1":"_2H","33":"_v _tD"},L:{"1":"I"},B:{"1":"_3H","33":"_0 _tD"},C:{"1":"_H _dQ","2":"_o _eC _L"},M:{"1":"YC"},A:{"2":"_Z","33":"_A"},F:{"1":"_sQ","2":"_T","33":"_QJ _fG"},K:{"1":"H","2":"_D"},E:{"1":"_TH _EE _OE","2":"XD","33":"_iF"},G:{"1":"_JE","33":"_XF"},P:{"1":"_rF","33":"_lF"},I:{"1":"I","2":"_W","33":"_y"}},B:6,C:"::file-selector-button CSS pseudo-element",D:undefined};
@@ -0,0 +1,182 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Pax = void 0;
const node_path_1 = require("node:path");
const header_js_1 = require("./header.js");
class Pax {
atime;
mtime;
ctime;
charset;
comment;
gid;
uid;
gname;
uname;
linkpath;
dev;
ino;
nlink;
path;
size;
mode;
global;
constructor(obj, global = false) {
this.atime = obj.atime;
this.charset = obj.charset;
this.comment = obj.comment;
this.ctime = obj.ctime;
this.dev = obj.dev;
this.gid = obj.gid;
this.global = global;
this.gname = obj.gname;
this.ino = obj.ino;
this.linkpath = obj.linkpath;
this.mtime = obj.mtime;
this.nlink = obj.nlink;
this.path = obj.path;
this.size = obj.size;
this.uid = obj.uid;
this.uname = obj.uname;
}
encode() {
const body = this.encodeBody();
if (body === '') {
return Buffer.allocUnsafe(0);
}
const bodyLen = Buffer.byteLength(body);
// round up to 512 bytes
// add 512 for header
const bufLen = 512 * Math.ceil(1 + bodyLen / 512);
const buf = Buffer.allocUnsafe(bufLen);
// 0-fill the header section, it might not hit every field
for (let i = 0; i < 512; i++) {
buf[i] = 0;
}
new header_js_1.Header({
// XXX split the path
// then the path should be PaxHeader + basename, but less than 99,
// prepend with the dirname
/* c8 ignore start */
path: ('PaxHeader/' + (0, node_path_1.basename)(this.path ?? '')).slice(0, 99),
/* c8 ignore stop */
mode: this.mode || 0o644,
uid: this.uid,
gid: this.gid,
size: bodyLen,
mtime: this.mtime,
type: this.global ? 'GlobalExtendedHeader' : 'ExtendedHeader',
linkpath: '',
uname: this.uname || '',
gname: this.gname || '',
devmaj: 0,
devmin: 0,
atime: this.atime,
ctime: this.ctime,
}).encode(buf);
buf.write(body, 512, bodyLen, 'utf8');
// null pad after the body
for (let i = bodyLen + 512; i < buf.length; i++) {
buf[i] = 0;
}
return buf;
}
encodeBody() {
return (this.encodeField('path') +
this.encodeField('ctime') +
this.encodeField('atime') +
this.encodeField('dev') +
this.encodeField('ino') +
this.encodeField('nlink') +
this.encodeField('charset') +
this.encodeField('comment') +
this.encodeField('gid') +
this.encodeField('gname') +
this.encodeField('linkpath') +
this.encodeField('mtime') +
this.encodeField('size') +
this.encodeField('uid') +
this.encodeField('uname'));
}
encodeField(field) {
if (this[field] === undefined) {
return '';
}
const r = this[field];
const v = r instanceof Date ? r.getTime() / 1000 : r;
const s = ' ' +
(field === 'dev' || field === 'ino' || field === 'nlink' ?
'SCHILY.'
: '') +
field +
'=' +
v +
'\n';
const byteLen = Buffer.byteLength(s);
// the digits includes the length of the digits in ascii base-10
// so if it's 9 characters, then adding 1 for the 9 makes it 10
// which makes it 11 chars.
let digits = Math.floor(Math.log(byteLen) / Math.log(10)) + 1;
if (byteLen + digits >= Math.pow(10, digits)) {
digits += 1;
}
const len = digits + byteLen;
return len + s;
}
static parse(str, ex, g = false) {
return new Pax(merge(parseKV(str), ex), g);
}
}
exports.Pax = Pax;
const merge = (a, b) => b ? Object.assign({}, b, a) : a;
const parseKV = (str) => str
.replace(/\n$/, '')
.split('\n')
.reduce(parseKVLine, Object.create(null));
const parseKVLine = (set, line) => {
const n = parseInt(line, 10);
// XXX Values with \n in them will fail this.
// Refactor to not be a naive line-by-line parse.
if (n !== Buffer.byteLength(line) + 1) {
return set;
}
line = line.slice((n + ' ').length);
const kv = line.split('=');
const r = kv.shift();
if (!r) {
return set;
}
const k = r.replace(/^SCHILY\.(dev|ino|nlink)/, '$1');
const v = kv.join('=').replace(/\0.*/, '');
switch (k) {
case 'path':
case 'linkpath':
case 'type':
case 'charset':
case 'comment':
case 'gname':
case 'uname':
set[k] = v;
break;
case 'ctime':
case 'atime':
case 'mtime':
set[k] = new Date(Number(v) * 1000);
break;
case 'size':
const s = +v;
if (s >= 0)
set[k] = s;
break;
case 'gid':
case 'uid':
case 'dev':
case 'ino':
case 'nlink':
case 'mode':
set[k] = +v;
break;
}
return set;
};
//# sourceMappingURL=pax.js.map
@@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FunctionExpressionNameScope = void 0;
const definition_1 = require("../definition");
const ScopeBase_1 = require("./ScopeBase");
const ScopeType_1 = require("./ScopeType");
class FunctionExpressionNameScope extends ScopeBase_1.ScopeBase {
functionExpressionScope;
constructor(scopeManager, upperScope, block) {
super(scopeManager, ScopeType_1.ScopeType.functionExpressionName, upperScope, block, false);
if (block.id) {
this.defineIdentifier(block.id, new definition_1.FunctionNameDefinition(block.id, block));
}
this.functionExpressionScope = true;
}
}
exports.FunctionExpressionNameScope = FunctionExpressionNameScope;
@@ -0,0 +1,8 @@
export { analyze, type AnalyzeOptions } from './analyze';
export * from './definition';
export { PatternVisitor, type PatternVisitorCallback, type PatternVisitorOptions, } from './referencer/PatternVisitor';
export { Reference } from './referencer/Reference';
export { Visitor } from './referencer/Visitor';
export * from './scope';
export { ScopeManager } from './ScopeManager';
export * from './variable';
@@ -0,0 +1,585 @@
/**
* HTTPS is the HTTP protocol over TLS/SSL. In Node.js this is implemented as a
* separate module.
* @see [source](https://github.com/nodejs/node/blob/v24.x/lib/https.js)
*/
declare module "https" {
import { NonSharedBuffer } from "node:buffer";
import { Duplex } from "node:stream";
import * as tls from "node:tls";
import * as http from "node:http";
import { URL } from "node:url";
interface ServerOptions<
Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse,
> extends http.ServerOptions<Request, Response>, tls.TlsOptions {}
interface RequestOptions extends http.RequestOptions, tls.SecureContextOptions {
checkServerIdentity?:
| ((hostname: string, cert: tls.DetailedPeerCertificate) => Error | undefined)
| undefined;
rejectUnauthorized?: boolean | undefined; // Defaults to true
servername?: string | undefined; // SNI TLS Extension
}
interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions {
maxCachedSessions?: number | undefined;
}
/**
* An `Agent` object for HTTPS similar to `http.Agent`. See {@link request} for more information.
*
* Like `http.Agent`, the `createConnection(options[, callback])` method can be overridden to customize
* how TLS connections are established.
*
* > See [`agent.createConnection()`](https://nodejs.org/docs/latest-v24.x/api/http.html#agentcreateconnectionoptions-callback)
* for details on overriding this method, including asynchronous socket creation with a callback.
* @since v0.4.5
*/
class Agent extends http.Agent {
constructor(options?: AgentOptions);
options: AgentOptions;
createConnection(
options: RequestOptions,
callback?: (err: Error | null, stream: Duplex) => void,
): Duplex | null | undefined;
getName(options?: RequestOptions): string;
}
interface Server<
Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse,
> extends http.Server<Request, Response> {}
/**
* See `http.Server` for more information.
* @since v0.3.4
*/
class Server<
Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse,
> extends tls.Server {
constructor(requestListener?: http.RequestListener<Request, Response>);
constructor(
options: ServerOptions<Request, Response>,
requestListener?: http.RequestListener<Request, Response>,
);
/**
* Closes all connections connected to this server.
* @since v18.2.0
*/
closeAllConnections(): void;
/**
* Closes all connections connected to this server which are not sending a request or waiting for a response.
* @since v18.2.0
*/
closeIdleConnections(): void;
addListener(event: string, listener: (...args: any[]) => void): this;
addListener(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: tls.TLSSocket) => void): this;
addListener(
event: "newSession",
listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void,
): this;
addListener(
event: "OCSPRequest",
listener: (
certificate: NonSharedBuffer,
issuer: NonSharedBuffer,
callback: (err: Error | null, resp: Buffer | null) => void,
) => void,
): this;
addListener(
event: "resumeSession",
listener: (
sessionId: NonSharedBuffer,
callback: (err: Error | null, sessionData: Buffer | null) => void,
) => void,
): this;
addListener(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this;
addListener(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
addListener(event: "close", listener: () => void): this;
addListener(event: "connection", listener: (socket: Duplex) => void): this;
addListener(event: "error", listener: (err: Error) => void): this;
addListener(event: "listening", listener: () => void): this;
addListener(event: "checkContinue", listener: http.RequestListener<Request, Response>): this;
addListener(event: "checkExpectation", listener: http.RequestListener<Request, Response>): this;
addListener(event: "clientError", listener: (err: Error, socket: Duplex) => void): this;
addListener(
event: "connect",
listener: (req: InstanceType<Request>, socket: Duplex, head: NonSharedBuffer) => void,
): this;
addListener(event: "request", listener: http.RequestListener<Request, Response>): this;
addListener(
event: "upgrade",
listener: (req: InstanceType<Request>, socket: Duplex, head: NonSharedBuffer) => void,
): this;
emit(event: string, ...args: any[]): boolean;
emit(event: "keylog", line: NonSharedBuffer, tlsSocket: tls.TLSSocket): boolean;
emit(
event: "newSession",
sessionId: NonSharedBuffer,
sessionData: NonSharedBuffer,
callback: () => void,
): boolean;
emit(
event: "OCSPRequest",
certificate: NonSharedBuffer,
issuer: NonSharedBuffer,
callback: (err: Error | null, resp: Buffer | null) => void,
): boolean;
emit(
event: "resumeSession",
sessionId: NonSharedBuffer,
callback: (err: Error | null, sessionData: Buffer | null) => void,
): boolean;
emit(event: "secureConnection", tlsSocket: tls.TLSSocket): boolean;
emit(event: "tlsClientError", err: Error, tlsSocket: tls.TLSSocket): boolean;
emit(event: "close"): boolean;
emit(event: "connection", socket: Duplex): boolean;
emit(event: "error", err: Error): boolean;
emit(event: "listening"): boolean;
emit(
event: "checkContinue",
req: InstanceType<Request>,
res: InstanceType<Response>,
): boolean;
emit(
event: "checkExpectation",
req: InstanceType<Request>,
res: InstanceType<Response>,
): boolean;
emit(event: "clientError", err: Error, socket: Duplex): boolean;
emit(event: "connect", req: InstanceType<Request>, socket: Duplex, head: NonSharedBuffer): boolean;
emit(
event: "request",
req: InstanceType<Request>,
res: InstanceType<Response>,
): boolean;
emit(event: "upgrade", req: InstanceType<Request>, socket: Duplex, head: NonSharedBuffer): boolean;
on(event: string, listener: (...args: any[]) => void): this;
on(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: tls.TLSSocket) => void): this;
on(
event: "newSession",
listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void,
): this;
on(
event: "OCSPRequest",
listener: (
certificate: NonSharedBuffer,
issuer: NonSharedBuffer,
callback: (err: Error | null, resp: Buffer | null) => void,
) => void,
): this;
on(
event: "resumeSession",
listener: (
sessionId: NonSharedBuffer,
callback: (err: Error | null, sessionData: Buffer | null) => void,
) => void,
): this;
on(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this;
on(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
on(event: "close", listener: () => void): this;
on(event: "connection", listener: (socket: Duplex) => void): this;
on(event: "error", listener: (err: Error) => void): this;
on(event: "listening", listener: () => void): this;
on(event: "checkContinue", listener: http.RequestListener<Request, Response>): this;
on(event: "checkExpectation", listener: http.RequestListener<Request, Response>): this;
on(event: "clientError", listener: (err: Error, socket: Duplex) => void): this;
on(
event: "connect",
listener: (req: InstanceType<Request>, socket: Duplex, head: NonSharedBuffer) => void,
): this;
on(event: "request", listener: http.RequestListener<Request, Response>): this;
on(
event: "upgrade",
listener: (req: InstanceType<Request>, socket: Duplex, head: NonSharedBuffer) => void,
): this;
once(event: string, listener: (...args: any[]) => void): this;
once(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: tls.TLSSocket) => void): this;
once(
event: "newSession",
listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void,
): this;
once(
event: "OCSPRequest",
listener: (
certificate: NonSharedBuffer,
issuer: NonSharedBuffer,
callback: (err: Error | null, resp: Buffer | null) => void,
) => void,
): this;
once(
event: "resumeSession",
listener: (
sessionId: NonSharedBuffer,
callback: (err: Error | null, sessionData: Buffer | null) => void,
) => void,
): this;
once(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this;
once(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
once(event: "close", listener: () => void): this;
once(event: "connection", listener: (socket: Duplex) => void): this;
once(event: "error", listener: (err: Error) => void): this;
once(event: "listening", listener: () => void): this;
once(event: "checkContinue", listener: http.RequestListener<Request, Response>): this;
once(event: "checkExpectation", listener: http.RequestListener<Request, Response>): this;
once(event: "clientError", listener: (err: Error, socket: Duplex) => void): this;
once(
event: "connect",
listener: (req: InstanceType<Request>, socket: Duplex, head: NonSharedBuffer) => void,
): this;
once(event: "request", listener: http.RequestListener<Request, Response>): this;
once(
event: "upgrade",
listener: (req: InstanceType<Request>, socket: Duplex, head: NonSharedBuffer) => void,
): this;
prependListener(event: string, listener: (...args: any[]) => void): this;
prependListener(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: tls.TLSSocket) => void): this;
prependListener(
event: "newSession",
listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void,
): this;
prependListener(
event: "OCSPRequest",
listener: (
certificate: NonSharedBuffer,
issuer: NonSharedBuffer,
callback: (err: Error | null, resp: Buffer | null) => void,
) => void,
): this;
prependListener(
event: "resumeSession",
listener: (
sessionId: NonSharedBuffer,
callback: (err: Error | null, sessionData: Buffer | null) => void,
) => void,
): this;
prependListener(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this;
prependListener(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
prependListener(event: "close", listener: () => void): this;
prependListener(event: "connection", listener: (socket: Duplex) => void): this;
prependListener(event: "error", listener: (err: Error) => void): this;
prependListener(event: "listening", listener: () => void): this;
prependListener(event: "checkContinue", listener: http.RequestListener<Request, Response>): this;
prependListener(event: "checkExpectation", listener: http.RequestListener<Request, Response>): this;
prependListener(event: "clientError", listener: (err: Error, socket: Duplex) => void): this;
prependListener(
event: "connect",
listener: (req: InstanceType<Request>, socket: Duplex, head: NonSharedBuffer) => void,
): this;
prependListener(event: "request", listener: http.RequestListener<Request, Response>): this;
prependListener(
event: "upgrade",
listener: (req: InstanceType<Request>, socket: Duplex, head: NonSharedBuffer) => void,
): this;
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
prependOnceListener(event: "keylog", listener: (line: NonSharedBuffer, tlsSocket: tls.TLSSocket) => void): this;
prependOnceListener(
event: "newSession",
listener: (sessionId: NonSharedBuffer, sessionData: NonSharedBuffer, callback: () => void) => void,
): this;
prependOnceListener(
event: "OCSPRequest",
listener: (
certificate: NonSharedBuffer,
issuer: NonSharedBuffer,
callback: (err: Error | null, resp: Buffer | null) => void,
) => void,
): this;
prependOnceListener(
event: "resumeSession",
listener: (
sessionId: NonSharedBuffer,
callback: (err: Error | null, sessionData: Buffer | null) => void,
) => void,
): this;
prependOnceListener(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this;
prependOnceListener(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this;
prependOnceListener(event: "close", listener: () => void): this;
prependOnceListener(event: "connection", listener: (socket: Duplex) => void): this;
prependOnceListener(event: "error", listener: (err: Error) => void): this;
prependOnceListener(event: "listening", listener: () => void): this;
prependOnceListener(event: "checkContinue", listener: http.RequestListener<Request, Response>): this;
prependOnceListener(event: "checkExpectation", listener: http.RequestListener<Request, Response>): this;
prependOnceListener(event: "clientError", listener: (err: Error, socket: Duplex) => void): this;
prependOnceListener(
event: "connect",
listener: (req: InstanceType<Request>, socket: Duplex, head: NonSharedBuffer) => void,
): this;
prependOnceListener(event: "request", listener: http.RequestListener<Request, Response>): this;
prependOnceListener(
event: "upgrade",
listener: (req: InstanceType<Request>, socket: Duplex, head: NonSharedBuffer) => void,
): this;
}
/**
* ```js
* // curl -k https://localhost:8000/
* import https from 'node:https';
* import fs from 'node:fs';
*
* const options = {
* key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
* cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'),
* };
*
* https.createServer(options, (req, res) => {
* res.writeHead(200);
* res.end('hello world\n');
* }).listen(8000);
* ```
*
* Or
*
* ```js
* import https from 'node:https';
* import fs from 'node:fs';
*
* const options = {
* pfx: fs.readFileSync('test/fixtures/test_cert.pfx'),
* passphrase: 'sample',
* };
*
* https.createServer(options, (req, res) => {
* res.writeHead(200);
* res.end('hello world\n');
* }).listen(8000);
* ```
* @since v0.3.4
* @param options Accepts `options` from `createServer`, `createSecureContext` and `createServer`.
* @param requestListener A listener to be added to the `'request'` event.
*/
function createServer<
Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse,
>(requestListener?: http.RequestListener<Request, Response>): Server<Request, Response>;
function createServer<
Request extends typeof http.IncomingMessage = typeof http.IncomingMessage,
Response extends typeof http.ServerResponse<InstanceType<Request>> = typeof http.ServerResponse,
>(
options: ServerOptions<Request, Response>,
requestListener?: http.RequestListener<Request, Response>,
): Server<Request, Response>;
/**
* Makes a request to a secure web server.
*
* The following additional `options` from `tls.connect()` are also accepted: `ca`, `cert`, `ciphers`, `clientCertEngine`, `crl`, `dhparam`, `ecdhCurve`, `honorCipherOrder`, `key`, `passphrase`,
* `pfx`, `rejectUnauthorized`, `secureOptions`, `secureProtocol`, `servername`, `sessionIdContext`, `highWaterMark`.
*
* `options` can be an object, a string, or a `URL` object. If `options` is a
* string, it is automatically parsed with `new URL()`. If it is a `URL` object, it will be automatically converted to an ordinary `options` object.
*
* `https.request()` returns an instance of the `http.ClientRequest` class. The `ClientRequest` instance is a writable stream. If one needs to
* upload a file with a POST request, then write to the `ClientRequest` object.
*
* ```js
* import https from 'node:https';
*
* const options = {
* hostname: 'encrypted.google.com',
* port: 443,
* path: '/',
* method: 'GET',
* };
*
* const req = https.request(options, (res) => {
* console.log('statusCode:', res.statusCode);
* console.log('headers:', res.headers);
*
* res.on('data', (d) => {
* process.stdout.write(d);
* });
* });
*
* req.on('error', (e) => {
* console.error(e);
* });
* req.end();
* ```
*
* Example using options from `tls.connect()`:
*
* ```js
* const options = {
* hostname: 'encrypted.google.com',
* port: 443,
* path: '/',
* method: 'GET',
* key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
* cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'),
* };
* options.agent = new https.Agent(options);
*
* const req = https.request(options, (res) => {
* // ...
* });
* ```
*
* Alternatively, opt out of connection pooling by not using an `Agent`.
*
* ```js
* const options = {
* hostname: 'encrypted.google.com',
* port: 443,
* path: '/',
* method: 'GET',
* key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
* cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'),
* agent: false,
* };
*
* const req = https.request(options, (res) => {
* // ...
* });
* ```
*
* Example using a `URL` as `options`:
*
* ```js
* const options = new URL('https://abc:xyz@example.com');
*
* const req = https.request(options, (res) => {
* // ...
* });
* ```
*
* Example pinning on certificate fingerprint, or the public key (similar to`pin-sha256`):
*
* ```js
* import tls from 'node:tls';
* import https from 'node:https';
* import crypto from 'node:crypto';
*
* function sha256(s) {
* return crypto.createHash('sha256').update(s).digest('base64');
* }
* const options = {
* hostname: 'github.com',
* port: 443,
* path: '/',
* method: 'GET',
* checkServerIdentity: function(host, cert) {
* // Make sure the certificate is issued to the host we are connected to
* const err = tls.checkServerIdentity(host, cert);
* if (err) {
* return err;
* }
*
* // Pin the public key, similar to HPKP pin-sha256 pinning
* const pubkey256 = 'pL1+qb9HTMRZJmuC/bB/ZI9d302BYrrqiVuRyW+DGrU=';
* if (sha256(cert.pubkey) !== pubkey256) {
* const msg = 'Certificate verification error: ' +
* `The public key of '${cert.subject.CN}' ` +
* 'does not match our pinned fingerprint';
* return new Error(msg);
* }
*
* // Pin the exact certificate, rather than the pub key
* const cert256 = '25:FE:39:32:D9:63:8C:8A:FC:A1:9A:29:87:' +
* 'D8:3E:4C:1D:98:DB:71:E4:1A:48:03:98:EA:22:6A:BD:8B:93:16';
* if (cert.fingerprint256 !== cert256) {
* const msg = 'Certificate verification error: ' +
* `The certificate of '${cert.subject.CN}' ` +
* 'does not match our pinned fingerprint';
* return new Error(msg);
* }
*
* // This loop is informational only.
* // Print the certificate and public key fingerprints of all certs in the
* // chain. Its common to pin the public key of the issuer on the public
* // internet, while pinning the public key of the service in sensitive
* // environments.
* do {
* console.log('Subject Common Name:', cert.subject.CN);
* console.log(' Certificate SHA256 fingerprint:', cert.fingerprint256);
*
* hash = crypto.createHash('sha256');
* console.log(' Public key ping-sha256:', sha256(cert.pubkey));
*
* lastprint256 = cert.fingerprint256;
* cert = cert.issuerCertificate;
* } while (cert.fingerprint256 !== lastprint256);
*
* },
* };
*
* options.agent = new https.Agent(options);
* const req = https.request(options, (res) => {
* console.log('All OK. Server matched our pinned cert or public key');
* console.log('statusCode:', res.statusCode);
* // Print the HPKP values
* console.log('headers:', res.headers['public-key-pins']);
*
* res.on('data', (d) => {});
* });
*
* req.on('error', (e) => {
* console.error(e.message);
* });
* req.end();
* ```
*
* Outputs for example:
*
* ```text
* Subject Common Name: github.com
* Certificate SHA256 fingerprint: 25:FE:39:32:D9:63:8C:8A:FC:A1:9A:29:87:D8:3E:4C:1D:98:DB:71:E4:1A:48:03:98:EA:22:6A:BD:8B:93:16
* Public key ping-sha256: pL1+qb9HTMRZJmuC/bB/ZI9d302BYrrqiVuRyW+DGrU=
* Subject Common Name: DigiCert SHA2 Extended Validation Server CA
* Certificate SHA256 fingerprint: 40:3E:06:2A:26:53:05:91:13:28:5B:AF:80:A0:D4:AE:42:2C:84:8C:9F:78:FA:D0:1F:C9:4B:C5:B8:7F:EF:1A
* Public key ping-sha256: RRM1dGqnDFsCJXBTHky16vi1obOlCgFFn/yOhI/y+ho=
* Subject Common Name: DigiCert High Assurance EV Root CA
* Certificate SHA256 fingerprint: 74:31:E5:F4:C3:C1:CE:46:90:77:4F:0B:61:E0:54:40:88:3B:A9:A0:1E:D0:0B:A6:AB:D7:80:6E:D3:B1:18:CF
* Public key ping-sha256: WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18=
* All OK. Server matched our pinned cert or public key
* statusCode: 200
* headers: max-age=0; pin-sha256="WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18="; pin-sha256="RRM1dGqnDFsCJXBTHky16vi1obOlCgFFn/yOhI/y+ho=";
* pin-sha256="k2v657xBsOVe1PQRwOsHsw3bsGT2VzIqz5K+59sNQws="; pin-sha256="K87oWBWM9UZfyddvDfoxL+8lpNyoUB2ptGtn0fv6G2Q="; pin-sha256="IQBnNBEiFuhj+8x6X8XLgh01V9Ic5/V3IRQLNFFc7v4=";
* pin-sha256="iie1VXtL7HzAMF+/PVPR9xzT80kQxdZeJ+zduCB3uj0="; pin-sha256="LvRiGEjRqfzurezaWuj8Wie2gyHMrW5Q06LspMnox7A="; includeSubDomains
* ```
* @since v0.3.6
* @param options Accepts all `options` from `request`, with some differences in default values:
*/
function request(
options: RequestOptions | string | URL,
callback?: (res: http.IncomingMessage) => void,
): http.ClientRequest;
function request(
url: string | URL,
options: RequestOptions,
callback?: (res: http.IncomingMessage) => void,
): http.ClientRequest;
/**
* Like `http.get()` but for HTTPS.
*
* `options` can be an object, a string, or a `URL` object. If `options` is a
* string, it is automatically parsed with `new URL()`. If it is a `URL` object, it will be automatically converted to an ordinary `options` object.
*
* ```js
* import https from 'node:https';
*
* https.get('https://encrypted.google.com/', (res) => {
* console.log('statusCode:', res.statusCode);
* console.log('headers:', res.headers);
*
* res.on('data', (d) => {
* process.stdout.write(d);
* });
*
* }).on('error', (e) => {
* console.error(e);
* });
* ```
* @since v0.3.6
* @param options Accepts the same `options` as {@link request}, with the `method` always set to `GET`.
*/
function get(
options: RequestOptions | string | URL,
callback?: (res: http.IncomingMessage) => void,
): http.ClientRequest;
function get(
url: string | URL,
options: RequestOptions,
callback?: (res: http.IncomingMessage) => void,
): http.ClientRequest;
let globalAgent: Agent;
}
declare module "node:https" {
export * from "https";
}
@@ -0,0 +1 @@
!function(u,D){"object"==typeof exports&&"undefined"!=typeof module?module.exports=D():"function"==typeof define&&define.amd?define(D):u.JSON5=D()}(this,function(){"use strict";function u(u,D){return u(D={exports:{}},D.exports),D.exports}var D=u(function(u){var D=u.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=D)}),e=u(function(u){var D=u.exports={version:"2.6.5"};"number"==typeof __e&&(__e=D)}),r=(e.version,function(u){return"object"==typeof u?null!==u:"function"==typeof u}),t=function(u){if(!r(u))throw TypeError(u+" is not an object!");return u},n=function(u){try{return!!u()}catch(u){return!0}},F=!n(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),C=D.document,A=r(C)&&r(C.createElement),i=!F&&!n(function(){return 7!=Object.defineProperty((u="div",A?C.createElement(u):{}),"a",{get:function(){return 7}}).a;var u}),E=Object.defineProperty,o={f:F?Object.defineProperty:function(u,D,e){if(t(u),D=function(u,D){if(!r(u))return u;var e,t;if(D&&"function"==typeof(e=u.toString)&&!r(t=e.call(u)))return t;if("function"==typeof(e=u.valueOf)&&!r(t=e.call(u)))return t;if(!D&&"function"==typeof(e=u.toString)&&!r(t=e.call(u)))return t;throw TypeError("Can't convert object to primitive value")}(D,!0),t(e),i)try{return E(u,D,e)}catch(u){}if("get"in e||"set"in e)throw TypeError("Accessors not supported!");return"value"in e&&(u[D]=e.value),u}},a=F?function(u,D,e){return o.f(u,D,function(u,D){return{enumerable:!(1&u),configurable:!(2&u),writable:!(4&u),value:D}}(1,e))}:function(u,D,e){return u[D]=e,u},c={}.hasOwnProperty,B=function(u,D){return c.call(u,D)},s=0,f=Math.random(),l=u(function(u){var r=D["__core-js_shared__"]||(D["__core-js_shared__"]={});(u.exports=function(u,D){return r[u]||(r[u]=void 0!==D?D:{})})("versions",[]).push({version:e.version,mode:"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})})("native-function-to-string",Function.toString),d=u(function(u){var r,t="Symbol(".concat(void 0===(r="src")?"":r,")_",(++s+f).toString(36)),n=(""+l).split("toString");e.inspectSource=function(u){return l.call(u)},(u.exports=function(u,e,r,F){var C="function"==typeof r;C&&(B(r,"name")||a(r,"name",e)),u[e]!==r&&(C&&(B(r,t)||a(r,t,u[e]?""+u[e]:n.join(String(e)))),u===D?u[e]=r:F?u[e]?u[e]=r:a(u,e,r):(delete u[e],a(u,e,r)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[t]||l.call(this)})}),v=function(u,D,e){if(function(u){if("function"!=typeof u)throw TypeError(u+" is not a function!")}(u),void 0===D)return u;switch(e){case 1:return function(e){return u.call(D,e)};case 2:return function(e,r){return u.call(D,e,r)};case 3:return function(e,r,t){return u.call(D,e,r,t)}}return function(){return u.apply(D,arguments)}},p=function(u,r,t){var n,F,C,A,i=u&p.F,E=u&p.G,o=u&p.S,c=u&p.P,B=u&p.B,s=E?D:o?D[r]||(D[r]={}):(D[r]||{}).prototype,f=E?e:e[r]||(e[r]={}),l=f.prototype||(f.prototype={});for(n in E&&(t=r),t)C=((F=!i&&s&&void 0!==s[n])?s:t)[n],A=B&&F?v(C,D):c&&"function"==typeof C?v(Function.call,C):C,s&&d(s,n,C,u&p.U),f[n]!=C&&a(f,n,A),c&&l[n]!=C&&(l[n]=C)};D.core=e,p.F=1,p.G=2,p.S=4,p.P=8,p.B=16,p.W=32,p.U=64,p.R=128;var h,m=p,g=Math.ceil,y=Math.floor,w=function(u){return isNaN(u=+u)?0:(u>0?y:g)(u)},b=(h=!1,function(u,D){var e,r,t=String(function(u){if(null==u)throw TypeError("Can't call method on "+u);return u}(u)),n=w(D),F=t.length;return n<0||n>=F?h?"":void 0:(e=t.charCodeAt(n))<55296||e>56319||n+1===F||(r=t.charCodeAt(n+1))<56320||r>57343?h?t.charAt(n):e:h?t.slice(n,n+2):r-56320+(e-55296<<10)+65536});m(m.P,"String",{codePointAt:function(u){return b(this,u)}});e.String.codePointAt;var S=Math.max,x=Math.min,N=String.fromCharCode,P=String.fromCodePoint;m(m.S+m.F*(!!P&&1!=P.length),"String",{fromCodePoint:function(u){for(var D,e,r,t=arguments,n=[],F=arguments.length,C=0;F>C;){if(D=+t[C++],r=1114111,((e=w(e=D))<0?S(e+r,0):x(e,r))!==D)throw RangeError(D+" is not a valid code point");n.push(D<65536?N(D):N(55296+((D-=65536)>>10),D%1024+56320))}return n.join("")}});e.String.fromCodePoint;var _,O,j,I,V,J,M,k,L,T,z,H,$,R,G={Space_Separator:/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,ID_Start:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5ELine truncated
@@ -0,0 +1,166 @@
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const require_utils_encode = require("../../utils/encode.js");
//#region src/middleware/secure-headers/secure-headers.ts
const HEADERS_MAP = {
crossOriginEmbedderPolicy: ["Cross-Origin-Embedder-Policy", "require-corp"],
crossOriginResourcePolicy: ["Cross-Origin-Resource-Policy", "same-origin"],
crossOriginOpenerPolicy: ["Cross-Origin-Opener-Policy", "same-origin"],
originAgentCluster: ["Origin-Agent-Cluster", "?1"],
referrerPolicy: ["Referrer-Policy", "no-referrer"],
strictTransportSecurity: ["Strict-Transport-Security", "max-age=15552000; includeSubDomains"],
xContentTypeOptions: ["X-Content-Type-Options", "nosniff"],
xDnsPrefetchControl: ["X-DNS-Prefetch-Control", "off"],
xDownloadOptions: ["X-Download-Options", "noopen"],
xFrameOptions: ["X-Frame-Options", "SAMEORIGIN"],
xPermittedCrossDomainPolicies: ["X-Permitted-Cross-Domain-Policies", "none"],
xXssProtection: ["X-XSS-Protection", "0"]
};
const DEFAULT_OPTIONS = {
crossOriginEmbedderPolicy: false,
crossOriginResourcePolicy: true,
crossOriginOpenerPolicy: true,
originAgentCluster: true,
referrerPolicy: true,
strictTransportSecurity: true,
xContentTypeOptions: true,
xDnsPrefetchControl: true,
xDownloadOptions: true,
xFrameOptions: true,
xPermittedCrossDomainPolicies: true,
xXssProtection: true,
removePoweredBy: true,
permissionsPolicy: {}
};
const generateNonce = () => {
const arrayBuffer = /* @__PURE__ */ new Uint8Array(16);
crypto.getRandomValues(arrayBuffer);
return require_utils_encode.encodeBase64(arrayBuffer.buffer);
};
const NONCE = (ctx) => {
const key = "secureHeadersNonce";
const init = ctx.get(key);
const nonce = init || generateNonce();
if (init == null) ctx.set(key, nonce);
return `'nonce-${nonce}'`;
};
/**
* Secure Headers Middleware for Hono.
*
* @see {@link https://hono.dev/docs/middleware/builtin/secure-headers}
*
* @param {Partial<SecureHeadersOptions>} [customOptions] - The options for the secure headers middleware.
* @param {ContentSecurityPolicyOptions} [customOptions.contentSecurityPolicy] - Settings for the Content-Security-Policy header.
* @param {ContentSecurityPolicyOptions} [customOptions.contentSecurityPolicyReportOnly] - Settings for the Content-Security-Policy-Report-Only header.
* @param {overridableHeader} [customOptions.crossOriginEmbedderPolicy=false] - Settings for the Cross-Origin-Embedder-Policy header.
* @param {overridableHeader} [customOptions.crossOriginResourcePolicy=true] - Settings for the Cross-Origin-Resource-Policy header.
* @param {overridableHeader} [customOptions.crossOriginOpenerPolicy=true] - Settings for the Cross-Origin-Opener-Policy header.
* @param {overridableHeader} [customOptions.originAgentCluster=true] - Settings for the Origin-Agent-Cluster header.
* @param {overridableHeader} [customOptions.referrerPolicy=true] - Settings for the Referrer-Policy header.
* @param {ReportingEndpointOptions[]} [customOptions.reportingEndpoints] - Settings for the Reporting-Endpoints header.
* @param {ReportToOptions[]} [customOptions.reportTo] - Settings for the Report-To header.
* @param {overridableHeader} [customOptions.strictTransportSecurity=true] - Settings for the Strict-Transport-Security header.
* @param {overridableHeader} [customOptions.xContentTypeOptions=true] - Settings for the X-Content-Type-Options header.
* @param {overridableHeader} [customOptions.xDnsPrefetchControl=true] - Settings for the X-DNS-Prefetch-Control header.
* @param {overridableHeader} [customOptions.xDownloadOptions=true] - Settings for the X-Download-Options header.
* @param {overridableHeader} [customOptions.xFrameOptions=true] - Settings for the X-Frame-Options header.
* @param {overridableHeader} [customOptions.xPermittedCrossDomainPolicies=true] - Settings for the X-Permitted-Cross-Domain-Policies header.
* @param {overridableHeader} [customOptions.xXssProtection=true] - Settings for the X-XSS-Protection header.
* @param {boolean} [customOptions.removePoweredBy=true] - Settings for remove X-Powered-By header.
* @param {PermissionsPolicyOptions} [customOptions.permissionsPolicy] - Settings for the Permissions-Policy header.
* @returns {MiddlewareHandler} The middleware handler function.
*
* @example
* ```ts
* const app = new Hono()
* app.use(secureHeaders())
* ```
*/
const secureHeaders = (customOptions) => {
const options = {
...DEFAULT_OPTIONS,
...customOptions
};
const headersToSet = getFilteredHeaders(options);
const callbacks = [];
if (options.contentSecurityPolicy) {
const [callback, value] = getCSPDirectives(options.contentSecurityPolicy, "Content-Security-Policy");
if (callback) callbacks.push(callback);
headersToSet.push(["Content-Security-Policy", value]);
}
if (options.contentSecurityPolicyReportOnly) {
const [callback, value] = getCSPDirectives(options.contentSecurityPolicyReportOnly, "Content-Security-Policy-Report-Only");
if (callback) callbacks.push(callback);
headersToSet.push(["Content-Security-Policy-Report-Only", value]);
}
if (options.permissionsPolicy && Object.keys(options.permissionsPolicy).length > 0) headersToSet.push(["Permissions-Policy", getPermissionsPolicyDirectives(options.permissionsPolicy)]);
if (options.reportingEndpoints) headersToSet.push(["Reporting-Endpoints", getReportingEndpoints(options.reportingEndpoints)]);
if (options.reportTo) headersToSet.push(["Report-To", getReportToOptions(options.reportTo)]);
return async function secureHeaders(ctx, next) {
const headersToSetForReq = callbacks.length === 0 ? headersToSet : callbacks.reduce((acc, cb) => cb(ctx, acc), headersToSet);
await next();
setHeaders(ctx, headersToSetForReq);
if (options?.removePoweredBy) ctx.res.headers.delete("X-Powered-By");
};
};
function getFilteredHeaders(options) {
return Object.entries(HEADERS_MAP).filter(([key]) => options[key]).map(([key, defaultValue]) => {
const overrideValue = options[key];
return typeof overrideValue === "string" ? [defaultValue[0], overrideValue] : defaultValue;
});
}
function getCSPDirectives(contentSecurityPolicy, headerName) {
const callbacks = [];
const resultValues = [];
for (const [directive, value] of Object.entries(contentSecurityPolicy)) {
const valueArray = Array.isArray(value) ? value : [value];
valueArray.forEach((value, i) => {
if (typeof value === "function") {
const index = i * 2 + 2 + resultValues.length;
callbacks.push((ctx, values) => {
values[index] = value(ctx, directive);
});
}
});
resultValues.push(directive.replace(/[A-Z]+(?![a-z])|[A-Z]/g, (match, offset) => offset ? "-" + match.toLowerCase() : match.toLowerCase()), ...valueArray.flatMap((value) => [" ", value]), "; ");
}
resultValues.pop();
return callbacks.length === 0 ? [void 0, resultValues.join("")] : [(ctx, headersToSet) => headersToSet.map((values) => {
if (values[0] === headerName) {
const clone = values[1].slice();
callbacks.forEach((cb) => {
cb(ctx, clone);
});
return [values[0], clone.join("")];
} else return values;
}), resultValues];
}
function getPermissionsPolicyDirectives(policy) {
return Object.entries(policy).map(([directive, value]) => {
const kebabDirective = camelToKebab(directive);
if (typeof value === "boolean") return `${kebabDirective}=${value ? "*" : "()"}`;
if (Array.isArray(value)) {
if (value.length === 0) return `${kebabDirective}=()`;
if (value.length === 1 && value[0] === "*") return `${kebabDirective}=*`;
if (value.length === 1 && value[0] === "none") return `${kebabDirective}=()`;
return `${kebabDirective}=(${value.map((item) => ["self", "src"].includes(item) ? item : `"${item}"`).join(" ")})`;
}
return "";
}).filter(Boolean).join(", ");
}
function camelToKebab(str) {
return str.replace(/([a-z\d])([A-Z])/g, "$1-$2").toLowerCase();
}
function getReportingEndpoints(reportingEndpoints = []) {
return reportingEndpoints.map((endpoint) => `${endpoint.name}="${endpoint.url}"`).join(", ");
}
function getReportToOptions(reportTo = []) {
return reportTo.map((option) => JSON.stringify(option)).join(", ");
}
function setHeaders(ctx, headersToSet) {
headersToSet.forEach(([header, value]) => {
ctx.res.headers.set(header, value);
});
}
//#endregion
exports.NONCE = NONCE;
exports.secureHeaders = secureHeaders;
@@ -0,0 +1,143 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = default_1;
const util = __importStar(require("../core/util.cjs"));
const error = () => {
const Sizable = {
string: { unit: "znakov", verb: "mať" },
file: { unit: "bajtov", verb: "mať" },
array: { unit: "prvkov", verb: "mať" },
set: { unit: "prvkov", verb: "mať" },
map: { unit: "položiek", verb: "mať" },
};
function getSizing(origin) {
return Sizable[origin] ?? null;
}
const FormatDictionary = {
regex: "regulárny výraz",
email: "e-mailová adresa",
url: "URL",
emoji: "emoji",
uuid: "UUID",
uuidv4: "UUIDv4",
uuidv6: "UUIDv6",
nanoid: "nanoid",
guid: "GUID",
cuid: "cuid",
cuid2: "cuid2",
ulid: "ULID",
xid: "XID",
ksuid: "KSUID",
datetime: "dátum a čas vo formáte ISO",
date: "dátum vo formáte ISO",
time: "čas vo formáte ISO",
duration: "doba trvania ISO",
ipv4: "IPv4 adresa",
ipv6: "IPv6 adresa",
mac: "MAC adresa",
cidrv4: "rozsah IPv4",
cidrv6: "rozsah IPv6",
base64: "reťazec zakódovaný vo formáte base64",
base64url: "reťazec zakódovaný vo formáte base64url",
json_string: "reťazec vo formáte JSON",
e164: "číslo E.164",
credit_card: "číslo kreditnej karty",
currency_code: "kód meny",
iban: "IBAN",
jwt: "JWT",
template_literal: "vstup",
};
const TypeDictionary = {
nan: "NaN",
number: "číslo",
string: "reťazec",
function: "funkcia",
array: "pole",
};
return (issue) => {
switch (issue.code) {
case "invalid_type": {
const expected = TypeDictionary[issue.expected] ?? issue.expected;
const receivedType = util.parsedType(issue.input);
const received = TypeDictionary[receivedType] ?? receivedType;
if (/^[A-Z]/.test(issue.expected)) {
return `Neplatný vstup: očakávané instanceof ${issue.expected}, obdržané ${received}`;
}
return `Neplatný vstup: očakávané ${expected}, obdržané ${received}`;
}
case "invalid_value":
if (issue.values.length === 1)
return `Neplatný vstup: očakávané ${util.stringifyPrimitive(issue.values[0])}`;
return `Neplatný vstup: očakávaná jedna z hodnôt ${util.joinValues(issue.values, "|")}`;
case "too_big": {
const adj = issue.inclusive ? "<=" : "<";
const sizing = getSizing(issue.origin);
if (sizing) {
return `Hodnota je príliš veľká: ${issue.origin ?? "hodnota"} musí mať ${adj}${issue.maximum.toString()} ${sizing.unit ?? "prvkov"}`;
}
return `Hodnota je príliš veľká: ${issue.origin ?? "hodnota"} musí byť ${adj}${issue.maximum.toString()}`;
}
case "too_small": {
const adj = issue.inclusive ? ">=" : ">";
const sizing = getSizing(issue.origin);
if (sizing) {
return `Hodnota je príliš malá: ${issue.origin ?? "hodnota"} musí mať ${adj}${issue.minimum.toString()} ${sizing.unit ?? "prvkov"}`;
}
return `Hodnota je príliš malá: ${issue.origin ?? "hodnota"} musí byť ${adj}${issue.minimum.toString()}`;
}
case "invalid_format": {
const _issue = issue;
if (_issue.format === "starts_with")
return `Neplatný reťazec: musí začínať na "${_issue.prefix}"`;
if (_issue.format === "ends_with")
return `Neplatný reťazec: musí končiť na "${_issue.suffix}"`;
if (_issue.format === "includes")
return `Neplatný reťazec: musí obsahovať "${_issue.includes}"`;
if (_issue.format === "regex")
return `Neplatný reťazec: musí zodpovedať vzoru ${_issue.pattern}`;
return `Neplatný formát ${FormatDictionary[_issue.format] ?? issue.format}`;
}
case "not_multiple_of":
return `Neplatné číslo: musí byť násobkom ${issue.divisor}`;
case "unrecognized_keys":
return `Neznáme klúče: ${util.joinValues(issue.keys, ", ")}`;
case "invalid_key":
return `Neplatný klúč v ${issue.origin}`;
case "invalid_union":
return "Neplatný vstup";
case "invalid_element":
return `Neplatná hodnota v ${issue.origin}`;
default:
return `Neplatný vstup`;
}
};
};
function default_1() {
return {
localeError: error(),
};
}
module.exports = exports.default;
@@ -0,0 +1,4 @@
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"preferTypeParameter", [], import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
name: string;
};
export default _default;
@@ -0,0 +1,13 @@
/**
* Log levels for logging (日志级别枚举)
*/
declare enum Level {
TRACE = 6,
DEBUG = 5,
INFO = 4,
WARN = 3,
ERROR = 2,
FATAL = 1,
OFF = 0
}
export default Level;
@@ -0,0 +1 @@
module.exports={C:{"96":0.01921,"115":0.07685,"127":0.01921,"133":0.21133,"135":0.03842,"140":0.03842,"145":0.05764,"146":0.03842,"147":0.01921,"149":0.1537,"150":0.03842,"152":0.05764,"153":0.05764,"154":0.60998,"155":0.91257,"156":2.74251,"157":0.05764,_:"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 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 116 117 118 119 120 121 122 123 124 125 126 128 129 130 131 132 134 136 137 138 139 141 142 143 144 148 151 158 159 160 3.5 3.6"},D:{"71":0.01921,"72":0.03842,"88":0.01921,"109":0.39865,"120":0.07685,"123":0.05764,"127":0.19212,"129":0.03842,"130":0.01921,"131":0.34101,"134":0.19212,"139":0.26897,"142":0.05764,"143":0.05764,"144":0.01921,"145":0.1537,"146":0.01921,"147":0.05764,"148":0.03842,"149":0.59077,"150":0.45629,"151":2.34386,"152":7.23812,"153":10.20638,"154":1.29681,_:"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 73 74 75 76 77 78 79 80 81 83 84 85 86 87 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 110 111 112 113 114 115 116 117 118 119 121 122 124 125 126 128 132 133 135 136 137 138 140 141 155 156 157"},F:{"119":9.46671,"135":0.34101,_:"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 116 117 118 120 121 122 123 124 125 126 127 131 132 133 134 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"128":0.39865,"137":0.07685,"139":0.01921,"140":0.03842,"142":0.21133,"146":0.01921,"151":0.43707,"152":2.83857,"153":1.77231,"154":0.41786,_:"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 126 127 129 130 131 132 133 134 135 136 138 141 143 144 145 147 148 149 150"},E:{_:"4 5 6 7 8 9 10 11 12 13 14 15 27 3.1 3.2 5.1 6.1 7.1 9.1 10.1 11.1 12.1 13.1 14.1 15.1 15.2-15.3 15.4 15.5 15.6 16.0 16.1 16.2 16.3 16.4 16.5 16.6 17.0 17.2 17.3 17.4 17.5 17.6 18.0 18.1 18.2 18.3 18.4 18.5-18.7 26.0 26.1 26.2 26.4 26.5 27.1 27.2 TP","17.1":0.03842,"26.3":0.05764,"26.6":0.05764},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00009,"5.0-5.1":0.00009,"6.0-6.1":0,"7.0-7.1":0.00017,"8.1-8.4":0,"9.0-9.2":0,"9.3":0,"10.0-10.2":0,"10.3":0.00087,"11.0-11.2":0.00009,"11.3-11.4":0.00017,"12.0-12.1":0,"12.2-12.5":0.00226,"13.0-13.1":0,"13.2":0.00043,"13.3":0,"13.4-13.7":0.00009,"14.0-14.4":0.00035,"14.5-14.8":0.00052,"15.0-15.1":0.00052,"15.2-15.3":0.00035,"15.4":0.00043,"15.5":0.00052,"15.6-15.8":0.01128,"16.0":0.00087,"16.1":0.00156,"16.2":0.00087,"16.3":0.00191,"16.4":0.00043,"16.5":0.00069,"16.6-16.7":0.01571,"17.0":0.00061,"17.1":0.00087,"17.2":0.00087,"17.3":0.0013,"17.4":0.00182,"17.5":0.00356,"17.6-17.7":0.0092,"18.0":0.00191,"18.1":0.00382,"18.2":0.00521,"18.3":0.00903,"18.4":0.00564,"18.5-18.7":0.11656,"26.0":0.00564,"26.1":0.00573,"26.2":0.01493,"26.3":0.01614,"26.4":0.0118,"26.5":0.07907,"26.6":0.48785,"27.0":0.03741,"27.1":0,"27.2":0.00095},P:{"4":0.04074,"30":0.21391,_:"20 21 22 23 24 25 26 27 28 29 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.07874,_:"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"},L:{"0":52.36516},R:{_:"0"},M:{"0":0.05717},Q:{_:"14.9"},O:{"0":0.07796},H:{all:0.02}};
@@ -0,0 +1,368 @@
/**
* @fileoverview Restrict usage of duplicate imports.
* @author Simen Bekkhus
*/
"use strict";
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
const NAMED_TYPES = ["ImportSpecifier", "ExportSpecifier"];
const NAMESPACE_TYPES = [
"ImportNamespaceSpecifier",
"ExportNamespaceSpecifier",
];
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/**
* Check if an import/export type belongs to (ImportSpecifier|ExportSpecifier) or (ImportNamespaceSpecifier|ExportNamespaceSpecifier).
* @param {string} importExportType An import/export type to check.
* @param {string} type Can be "named" or "namespace"
* @returns {boolean} True if import/export type belongs to (ImportSpecifier|ExportSpecifier) or (ImportNamespaceSpecifier|ExportNamespaceSpecifier) and false if it doesn't.
*/
function isImportExportSpecifier(importExportType, type) {
const arrayToCheck = type === "named" ? NAMED_TYPES : NAMESPACE_TYPES;
return arrayToCheck.includes(importExportType);
}
/**
* Return the type of (import|export).
* @param {ASTNode} node A node to get.
* @returns {string} The type of the (import|export).
*/
function getImportExportType(node) {
if (node.specifiers && node.specifiers.length > 0) {
const nodeSpecifiers = node.specifiers;
const index = nodeSpecifiers.findIndex(
({ type }) =>
isImportExportSpecifier(type, "named") ||
isImportExportSpecifier(type, "namespace"),
);
const i = index > -1 ? index : 0;
return nodeSpecifiers[i].type;
}
if (node.type === "ExportAllDeclaration") {
if (node.exported) {
return "ExportNamespaceSpecifier";
}
return "ExportAll";
}
return "SideEffectImport";
}
/**
* Returns a boolean indicates if two (import|export) can be merged
* @param {ASTNode} node1 A node to check.
* @param {ASTNode} node2 A node to check.
* @returns {boolean} True if two (import|export) can be merged, false if they can't.
*/
function isImportExportCanBeMerged(node1, node2) {
const importExportType1 = getImportExportType(node1);
const importExportType2 = getImportExportType(node2);
if (
(node1.importKind === "type" || node1.exportKind === "type") &&
(node2.importKind === "type" || node2.exportKind === "type")
) {
const isDefault1 = importExportType1 === "ImportDefaultSpecifier";
const isDefault2 = importExportType2 === "ImportDefaultSpecifier";
const isNamed1 = isImportExportSpecifier(importExportType1, "named");
const isNamed2 = isImportExportSpecifier(importExportType2, "named");
if ((isDefault1 && isNamed2) || (isDefault2 && isNamed1)) {
return false;
}
}
if (
(importExportType1 === "ExportAll" &&
importExportType2 !== "ExportAll" &&
importExportType2 !== "SideEffectImport") ||
(importExportType1 !== "ExportAll" &&
importExportType1 !== "SideEffectImport" &&
importExportType2 === "ExportAll")
) {
return false;
}
if (
(isImportExportSpecifier(importExportType1, "namespace") &&
isImportExportSpecifier(importExportType2, "named")) ||
(isImportExportSpecifier(importExportType2, "namespace") &&
isImportExportSpecifier(importExportType1, "named"))
) {
return false;
}
return true;
}
/**
* Returns a boolean if we should report (import|export).
* @param {ASTNode} node A node to be reported or not.
* @param {[ASTNode]} previousNodes An array contains previous nodes of the module imported or exported.
* @param {boolean} allowSeparateTypeImports Whether to allow separate type and value imports.
* @returns {boolean} True if the (import|export) should be reported.
*/
function shouldReportImportExport(
node,
previousNodes,
allowSeparateTypeImports,
) {
let i = 0;
while (i < previousNodes.length) {
const previousNode = previousNodes[i];
if (allowSeparateTypeImports) {
const isTypeNode =
node.importKind === "type" || node.exportKind === "type";
const isTypePrevious =
previousNode.importKind === "type" ||
previousNode.exportKind === "type";
if (isTypeNode !== isTypePrevious) {
i++;
continue;
}
}
if (isImportExportCanBeMerged(node, previousNode)) {
return true;
}
i++;
}
return false;
}
/**
* Returns array contains only nodes with declarations types equal to type.
* @param {[{node: ASTNode, declarationType: string}]} nodes An array contains objects, each object contains a node and a declaration type.
* @param {string} type Declaration type.
* @returns {[ASTNode]} An array contains only nodes with declarations types equal to type.
*/
function getNodesByDeclarationType(nodes, type) {
return nodes
.filter(({ declarationType }) => declarationType === type)
.map(({ node }) => node);
}
/**
* Returns the name of the module imported or re-exported.
* @param {ASTNode} node A node to get.
* @returns {string} The name of the module, or empty string if no name.
*/
function getModule(node) {
if (node && node.source && node.source.value) {
return node.source.value.trim();
}
return "";
}
/**
* Checks if the (import|export) can be merged with at least one import or one export, and reports if so.
* @param {RuleContext} context The ESLint rule context object.
* @param {ASTNode} node A node to get.
* @param {Map} modules A Map object contains as a key a module name and as value an array contains objects, each object contains a node and a declaration type.
* @param {string} declarationType A declaration type can be an import or export.
* @param {boolean} includeExports Whether or not to check for exports in addition to imports.
* @param {boolean} allowSeparateTypeImports Whether to allow separate type and value imports.
* @returns {void} No return value.
*/
function checkAndReport(
context,
node,
modules,
declarationType,
includeExports,
allowSeparateTypeImports,
) {
const module = getModule(node);
if (modules.has(module)) {
const previousNodes = modules.get(module);
const messagesIds = [];
const importNodes = getNodesByDeclarationType(previousNodes, "import");
let exportNodes;
if (includeExports) {
exportNodes = getNodesByDeclarationType(previousNodes, "export");
}
if (declarationType === "import") {
if (
shouldReportImportExport(
node,
importNodes,
allowSeparateTypeImports,
)
) {
messagesIds.push("import");
}
if (includeExports) {
if (
shouldReportImportExport(
node,
exportNodes,
allowSeparateTypeImports,
)
) {
messagesIds.push("importAs");
}
}
} else if (declarationType === "export") {
if (
shouldReportImportExport(
node,
exportNodes,
allowSeparateTypeImports,
)
) {
messagesIds.push("export");
}
if (
shouldReportImportExport(
node,
importNodes,
allowSeparateTypeImports,
)
) {
messagesIds.push("exportAs");
}
}
messagesIds.forEach(messageId =>
context.report({
node,
messageId,
data: {
module,
},
}),
);
}
}
/**
* @callback nodeCallback
* @param {ASTNode} node A node to handle.
*/
/**
* Returns a function handling the (imports|exports) of a given file
* @param {RuleContext} context The ESLint rule context object.
* @param {Map} modules A Map object contains as a key a module name and as value an array contains objects, each object contains a node and a declaration type.
* @param {string} declarationType A declaration type can be an import or export.
* @param {boolean} includeExports Whether or not to check for exports in addition to imports.
* @param {boolean} allowSeparateTypeImports Whether to allow separate type and value imports.
* @returns {nodeCallback} A function passed to ESLint to handle the statement.
*/
function handleImportsExports(
context,
modules,
declarationType,
includeExports,
allowSeparateTypeImports,
) {
return function (node) {
const module = getModule(node);
if (module) {
checkAndReport(
context,
node,
modules,
declarationType,
includeExports,
allowSeparateTypeImports,
);
const currentNode = { node, declarationType };
let nodes = [currentNode];
if (modules.has(module)) {
const previousNodes = modules.get(module);
nodes = [...previousNodes, currentNode];
}
modules.set(module, nodes);
}
};
}
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
dialects: ["javascript", "typescript"],
language: "javascript",
type: "problem",
defaultOptions: [
{
includeExports: false,
allowSeparateTypeImports: false,
},
],
docs: {
description: "Disallow duplicate module imports",
recommended: false,
url: "https://eslint.org/docs/latest/rules/no-duplicate-imports",
},
schema: [
{
type: "object",
properties: {
includeExports: {
type: "boolean",
},
allowSeparateTypeImports: {
type: "boolean",
},
},
additionalProperties: false,
},
],
messages: {
import: "'{{module}}' import is duplicated.",
importAs: "'{{module}}' import is duplicated as export.",
export: "'{{module}}' export is duplicated.",
exportAs: "'{{module}}' export is duplicated as import.",
},
},
create(context) {
const [{ includeExports, allowSeparateTypeImports }] = context.options;
const modules = new Map();
const handlers = {
ImportDeclaration: handleImportsExports(
context,
modules,
"import",
includeExports,
allowSeparateTypeImports,
),
};
if (includeExports) {
handlers.ExportNamedDeclaration = handleImportsExports(
context,
modules,
"export",
includeExports,
allowSeparateTypeImports,
);
handlers.ExportAllDeclaration = handleImportsExports(
context,
modules,
"export",
includeExports,
allowSeparateTypeImports,
);
}
return handlers;
},
};
@@ -0,0 +1,4 @@
'use strict';
/** @type {import('./floor')} */
module.exports = Math.floor;
@@ -0,0 +1 @@
{"version":3,"file":"headContentUtils.cjs","names":[],"sources":["../../src/headContentUtils.tsx"],"sourcesContent":["import * as React from 'react'\nimport { useStore } from '@tanstack/react-store'\nimport {\n deepEqual,\n escapeHtml,\n getAssetCrossOrigin,\n isInlinableStylesheet,\n resolveManifestAssetLink,\n} from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { useRouter } from './useRouter'\nimport type {\n AssetCrossOriginConfig,\n RouterManagedTag,\n} from '@tanstack/router-core'\n\nfunction buildTagsFromMatches(\n router: ReturnType<typeof useRouter>,\n nonce: string | undefined,\n matches: Array<any>,\n assetCrossOrigin?: AssetCrossOriginConfig,\n): Array<RouterManagedTag> {\n const routeMeta = matches.map((match) => match.meta!).filter(Boolean)\n\n const resultMeta: Array<RouterManagedTag> = []\n const metaByAttribute: Record<string, true> = {}\n let title: RouterManagedTag | undefined\n for (let i = routeMeta.length - 1; i >= 0; i--) {\n const metas = routeMeta[i]!\n for (let j = metas.length - 1; j >= 0; j--) {\n const m = metas[j]\n if (!m) continue\n\n if (m.title) {\n if (!title) {\n title = {\n tag: 'title',\n children: m.title,\n }\n }\n } else if ('script:ld+json' in m) {\n try {\n const json = JSON.stringify(m['script:ld+json'])\n resultMeta.push({\n tag: 'script',\n attrs: {\n type: 'application/ld+json',\n },\n children: escapeHtml(json),\n })\n } catch {\n // Skip invalid JSON-LD objects\n }\n } else {\n const attribute = m.name ?? m.property\n if (attribute) {\n if (metaByAttribute[attribute]) {\n continue\n } else {\n metaByAttribute[attribute] = true\n }\n }\n\n resultMeta.push({\n tag: 'meta',\n attrs: {\n ...m,\n nonce,\n },\n })\n }\n }\n }\n\n if (title) {\n resultMeta.push(title)\n }\n\n if (nonce) {\n resultMeta.push({\n tag: 'meta',\n attrs: {\n property: 'csp-nonce',\n content: nonce,\n },\n })\n }\n resultMeta.reverse()\n\n const constructedLinks = matches\n .map((match) => match.links!)\n .filter(Boolean)\n .flat(1)\n .map((link) => ({\n tag: 'link',\n attrs: {\n ...link,\n nonce,\n },\n })) satisfies Array<RouterManagedTag>\n\n const manifest = router.ssr?.manifest\n const assetLinks = matches\n .map((match) => manifest?.routes[match.routeId]?.assets ?? [])\n .filter(Boolean)\n .flat(1)\n .flatMap((asset): Array<RouterManagedTag> => {\n if (asset.tag === 'link') {\n if (isInlinableStylesheet(manifest, asset)) {\n return []\n }\n\n return [\n {\n tag: 'link',\n attrs: {\n ...asset.attrs,\n crossOrigin:\n getAssetCrossOrigin(assetCrossOrigin, 'stylesheet') ??\n asset.attrs?.crossOrigin,\n suppressHydrationWarning: true,\n nonce,\n },\n },\n ]\n }\n\n if (asset.tag === 'style') {\n return [\n {\n tag: 'style',\n attrs: {\n ...asset.attrs,\n nonce,\n },\n children: asset.children,\n ...(asset.inlineCss ? { inlineCss: true as const } : {}),\n },\n ]\n }\n\n return []\n })\n\n const preloadLinks: Array<RouterManagedTag> = []\n matches\n .map((match) => router.looseRoutesById[match.routeId]!)\n .forEach((route) =>\n router.ssr?.manifest?.routes[route.id]?.preloads\n ?.filter(Boolean)\n .forEach((preload) => {\n const preloadLink = resolveManifestAssetLink(preload)\n preloadLinks.push({\n tag: 'link',\n attrs: {\n rel: 'modulepreload',\n href: preloadLink.href,\n crossOrigin:\n getAssetCrossOrigin(assetCrossOrigin, 'modulepreload') ??\n preloadLink.crossOrigin,\n nonce,\n },\n })\n }),\n )\n\n const styles = (\n matches\n .map((match) => match.styles!)\n .flat(1)\n .filter(Boolean) as Array<RouterManagedTag>\n ).map(({ children, ...attrs }) => ({\n tag: 'style',\n attrs: {\n ...attrs,\n nonce,\n },\n children,\n }))\n\n const headScripts = (\n matches\n .map((match) => match.headScripts!)\n .flat(1)\n .filter(Boolean) as Array<RouterManagedTag>\n ).map(({ children, ...script }) => ({\n tag: 'script',\n attrs: {\n ...script,\n nonce,\n },\n children,\n }))\n\n return uniqBy(\n [\n ...resultMeta,\n ...preloaLine truncated
@@ -0,0 +1,212 @@
'use strict'
const { Buffer } = require('node:buffer')
const net = require('node:net')
const { InvalidArgumentError } = require('./errors')
/**
* Parse an address and determine its type
* @param {string} address - The address to parse
* @returns {{type: number, buffer: Buffer}} Address type and buffer
*/
function parseAddress (address) {
// Check if it's an IPv4 address
if (net.isIPv4(address)) {
const parts = address.split('.').map(Number)
return {
type: 0x01, // IPv4
buffer: Buffer.from(parts)
}
}
// Check if it's an IPv6 address
if (net.isIPv6(address)) {
return {
type: 0x04, // IPv6
buffer: parseIPv6(address)
}
}
// Otherwise, treat as domain name
const domainBuffer = Buffer.from(address, 'utf8')
if (domainBuffer.length > 255) {
throw new InvalidArgumentError('Domain name too long (max 255 bytes)')
}
return {
type: 0x03, // Domain
buffer: Buffer.concat([Buffer.from([domainBuffer.length]), domainBuffer])
}
}
/**
* Parse IPv6 address to buffer
* @param {string} address - IPv6 address string
* @returns {Buffer} 16-byte buffer
*/
function parseIPv6 (address) {
const buffer = Buffer.alloc(16)
let normalizedAddress = address
// Expand an embedded IPv4 tail into the last two IPv6 groups.
if (address.includes('.')) {
const lastColonIndex = address.lastIndexOf(':')
const ipv4Part = address.slice(lastColonIndex + 1)
if (net.isIPv4(ipv4Part)) {
const octets = ipv4Part.split('.').map(Number)
const high = ((octets[0] << 8) | octets[1]).toString(16)
const low = ((octets[2] << 8) | octets[3]).toString(16)
normalizedAddress = `${address.slice(0, lastColonIndex)}:${high}:${low}`
}
}
// Handle compressed notation (::)
const doubleColonIndex = normalizedAddress.indexOf('::')
if (doubleColonIndex !== -1) {
const before = normalizedAddress.slice(0, doubleColonIndex)
const after = normalizedAddress.slice(doubleColonIndex + 2)
const beforeParts = before === '' ? [] : before.split(':')
const afterParts = after === '' ? [] : after.split(':')
let bufferIndex = 0
for (const part of beforeParts) {
buffer.writeUInt16BE(parseInt(part, 16), bufferIndex)
bufferIndex += 2
}
bufferIndex = 16 - afterParts.length * 2
for (const part of afterParts) {
buffer.writeUInt16BE(parseInt(part, 16), bufferIndex)
bufferIndex += 2
}
} else {
const parts = normalizedAddress.split(':')
for (let i = 0; i < parts.length; i++) {
buffer.writeUInt16BE(parseInt(parts[i], 16), i * 2)
}
}
return buffer
}
/**
* Build a SOCKS5 address buffer
* @param {number} type - Address type (1=IPv4, 3=Domain, 4=IPv6)
* @param {Buffer} addressBuffer - The address data
* @param {number} port - Port number
* @returns {Buffer} Complete address buffer including type, address, and port
*/
function buildAddressBuffer (type, addressBuffer, port) {
const portBuffer = Buffer.allocUnsafe(2)
portBuffer.writeUInt16BE(port, 0)
return Buffer.concat([
Buffer.from([type]),
addressBuffer,
portBuffer
])
}
/**
* Parse address from SOCKS5 response
* @param {Buffer} buffer - Buffer containing the address
* @param {number} offset - Starting offset in buffer
* @returns {{address: string, port: number, bytesRead: number}}
*/
function parseResponseAddress (buffer, offset = 0) {
if (buffer.length < offset + 1) {
throw new InvalidArgumentError('Buffer too small to contain address type')
}
const addressType = buffer[offset]
let address
let currentOffset = offset + 1
switch (addressType) {
case 0x01: { // IPv4
if (buffer.length < currentOffset + 6) {
throw new InvalidArgumentError('Buffer too small for IPv4 address')
}
address = Array.from(buffer.subarray(currentOffset, currentOffset + 4)).join('.')
currentOffset += 4
break
}
case 0x03: { // Domain
if (buffer.length < currentOffset + 1) {
throw new InvalidArgumentError('Buffer too small for domain length')
}
const domainLength = buffer[currentOffset]
currentOffset += 1
if (buffer.length < currentOffset + domainLength + 2) {
throw new InvalidArgumentError('Buffer too small for domain address')
}
address = buffer.subarray(currentOffset, currentOffset + domainLength).toString('utf8')
currentOffset += domainLength
break
}
case 0x04: { // IPv6
if (buffer.length < currentOffset + 18) {
throw new InvalidArgumentError('Buffer too small for IPv6 address')
}
// Convert buffer to IPv6 string
const parts = []
for (let i = 0; i < 8; i++) {
const value = buffer.readUInt16BE(currentOffset + i * 2)
parts.push(value.toString(16))
}
address = parts.join(':')
currentOffset += 16
break
}
default:
throw new InvalidArgumentError(`Invalid address type: ${addressType}`)
}
// Parse port
if (buffer.length < currentOffset + 2) {
throw new InvalidArgumentError('Buffer too small for port')
}
const port = buffer.readUInt16BE(currentOffset)
currentOffset += 2
return {
address,
port,
bytesRead: currentOffset - offset
}
}
/**
* Create error for SOCKS5 reply code
* @param {number} replyCode - SOCKS5 reply code
* @returns {Error} Appropriate error object
*/
function createReplyError (replyCode) {
const messages = {
0x01: 'General SOCKS server failure',
0x02: 'Connection not allowed by ruleset',
0x03: 'Network unreachable',
0x04: 'Host unreachable',
0x05: 'Connection refused',
0x06: 'TTL expired',
0x07: 'Command not supported',
0x08: 'Address type not supported'
}
const message = messages[replyCode] || `Unknown SOCKS5 error code: ${replyCode}`
const error = new Error(message)
error.code = `SOCKS5_${replyCode}`
return error
}
module.exports = {
parseAddress,
parseIPv6,
buildAddressBuffer,
parseResponseAddress,
createReplyError
}
@@ -0,0 +1,371 @@
import { ft as __commonJSMin } from "./node.js";
//#region ../../node_modules/.pnpm/postcss-value-parser@4.2.0/node_modules/postcss-value-parser/lib/parse.js
var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
var openParentheses = "(".charCodeAt(0);
var closeParentheses = ")".charCodeAt(0);
var singleQuote = "'".charCodeAt(0);
var doubleQuote = "\"".charCodeAt(0);
var backslash = "\\".charCodeAt(0);
var slash = "/".charCodeAt(0);
var comma = ",".charCodeAt(0);
var colon = ":".charCodeAt(0);
var star = "*".charCodeAt(0);
var uLower = "u".charCodeAt(0);
var uUpper = "U".charCodeAt(0);
var plus = "+".charCodeAt(0);
var isUnicodeRange = /^[a-f0-9?-]+$/i;
module.exports = function(input) {
var tokens = [];
var value = input;
var next, quote, prev, token, escape, escapePos, whitespacePos, parenthesesOpenPos;
var pos = 0;
var code = value.charCodeAt(pos);
var max = value.length;
var stack = [{ nodes: tokens }];
var balanced = 0;
var parent;
var name = "";
var before = "";
var after = "";
while (pos < max) if (code <= 32) {
next = pos;
do {
next += 1;
code = value.charCodeAt(next);
} while (code <= 32);
token = value.slice(pos, next);
prev = tokens[tokens.length - 1];
if (code === closeParentheses && balanced) after = token;
else if (prev && prev.type === "div") {
prev.after = token;
prev.sourceEndIndex += token.length;
} else if (code === comma || code === colon || code === slash && value.charCodeAt(next + 1) !== star && (!parent || parent && parent.type === "function" && parent.value !== "calc")) before = token;
else tokens.push({
type: "space",
sourceIndex: pos,
sourceEndIndex: next,
value: token
});
pos = next;
} else if (code === singleQuote || code === doubleQuote) {
next = pos;
quote = code === singleQuote ? "'" : "\"";
token = {
type: "string",
sourceIndex: pos,
quote
};
do {
escape = false;
next = value.indexOf(quote, next + 1);
if (~next) {
escapePos = next;
while (value.charCodeAt(escapePos - 1) === backslash) {
escapePos -= 1;
escape = !escape;
}
} else {
value += quote;
next = value.length - 1;
token.unclosed = true;
}
} while (escape);
token.value = value.slice(pos + 1, next);
token.sourceEndIndex = token.unclosed ? next : next + 1;
tokens.push(token);
pos = next + 1;
code = value.charCodeAt(pos);
} else if (code === slash && value.charCodeAt(pos + 1) === star) {
next = value.indexOf("*/", pos);
token = {
type: "comment",
sourceIndex: pos,
sourceEndIndex: next + 2
};
if (next === -1) {
token.unclosed = true;
next = value.length;
token.sourceEndIndex = next;
}
token.value = value.slice(pos + 2, next);
tokens.push(token);
pos = next + 2;
code = value.charCodeAt(pos);
} else if ((code === slash || code === star) && parent && parent.type === "function" && parent.value === "calc") {
token = value[pos];
tokens.push({
type: "word",
sourceIndex: pos - before.length,
sourceEndIndex: pos + token.length,
value: token
});
pos += 1;
code = value.charCodeAt(pos);
} else if (code === slash || code === comma || code === colon) {
token = value[pos];
tokens.push({
type: "div",
sourceIndex: pos - before.length,
sourceEndIndex: pos + token.length,
value: token,
before,
after: ""
});
before = "";
pos += 1;
code = value.charCodeAt(pos);
} else if (openParentheses === code) {
next = pos;
do {
next += 1;
code = value.charCodeAt(next);
} while (code <= 32);
parenthesesOpenPos = pos;
token = {
type: "function",
sourceIndex: pos - name.length,
value: name,
before: value.slice(parenthesesOpenPos + 1, next)
};
pos = next;
if (name === "url" && code !== singleQuote && code !== doubleQuote) {
next -= 1;
do {
escape = false;
next = value.indexOf(")", next + 1);
if (~next) {
escapePos = next;
while (value.charCodeAt(escapePos - 1) === backslash) {
escapePos -= 1;
escape = !escape;
}
} else {
value += ")";
next = value.length - 1;
token.unclosed = true;
}
} while (escape);
whitespacePos = next;
do {
whitespacePos -= 1;
code = value.charCodeAt(whitespacePos);
} while (code <= 32);
if (parenthesesOpenPos < whitespacePos) {
if (pos !== whitespacePos + 1) token.nodes = [{
type: "word",
sourceIndex: pos,
sourceEndIndex: whitespacePos + 1,
value: value.slice(pos, whitespacePos + 1)
}];
else token.nodes = [];
if (token.unclosed && whitespacePos + 1 !== next) {
token.after = "";
token.nodes.push({
type: "space",
sourceIndex: whitespacePos + 1,
sourceEndIndex: next,
value: value.slice(whitespacePos + 1, next)
});
} else {
token.after = value.slice(whitespacePos + 1, next);
token.sourceEndIndex = next;
}
} else {
token.after = "";
token.nodes = [];
}
pos = next + 1;
token.sourceEndIndex = token.unclosed ? next : pos;
code = value.charCodeAt(pos);
tokens.push(token);
} else {
balanced += 1;
token.after = "";
token.sourceEndIndex = pos + 1;
tokens.push(token);
stack.push(token);
tokens = token.nodes = [];
parent = token;
}
name = "";
} else if (closeParentheses === code && balanced) {
pos += 1;
code = value.charCodeAt(pos);
parent.after = after;
parent.sourceEndIndex += after.length;
after = "";
balanced -= 1;
stack[stack.length - 1].sourceEndIndex = pos;
stack.pop();
parent = stack[balanced];
tokens = parent.nodes;
} else {
next = pos;
do {
if (code === backslash) next += 1;
next += 1;
code = value.charCodeAt(next);
} while (next < max && !(code <= 32 || code === singleQuote || code === doubleQuote || code === comma || code === colon || code === slash || code === openParentheses || code === star && parent && parent.type === "function" && parent.value === "calc" || code === slash && parent.type === "function" && parent.value === "calc" || code === closeParentheses && balanced));
token = value.slice(pos, next);
if (openParentheses === code) name = token;
else if ((uLower === token.charCodeAt(0) || uUpper === token.charCodeAt(0)) && plus === token.charCodeAt(1) && isUnicodeRange.test(token.slice(2))) tokens.push({
type: "unicode-range",
sourceIndex: pos,
sourceEndIndex: next,
value: token
});
else tokens.push({
type: "word",
sourceIndex: pos,
sourceEndIndex: next,
value: token
});
pos = next;
}
for (pos = stack.length - 1; pos; pos -= 1) {
stack[pos].unclosed = true;
stack[pos].sourceEndIndex = value.length;
}
return stack[0].nodes;
};
}));
//#endregion
//#region ../../node_modules/.pnpm/postcss-value-parser@4.2.0/node_modules/postcss-value-parser/lib/walk.js
var require_walk = /* @__PURE__ */ __commonJSMin(((exports, module) => {
module.exports = function walk(nodes, cb, bubble) {
var i, max, node, result;
for (i = 0, max = nodes.length; i < max; i += 1) {
node = nodes[i];
if (!bubble) result = cb(node, i, nodes);
if (result !== false && node.type === "function" && Array.isArray(node.nodes)) walk(node.nodes, cb, bubble);
if (bubble) cb(node, i, nodes);
}
};
}));
//#endregion
//#region ../../node_modules/.pnpm/postcss-value-parser@4.2.0/node_modules/postcss-value-parser/lib/stringify.js
var require_stringify = /* @__PURE__ */ __commonJSMin(((exports, module) => {
function stringifyNode(node, custom) {
var type = node.type;
var value = node.value;
var buf;
var customResult;
if (custom && (customResult = custom(node)) !== void 0) return customResult;
else if (type === "word" || type === "space") return value;
else if (type === "string") {
buf = node.quote || "";
return buf + value + (node.unclosed ? "" : buf);
} else if (type === "comment") return "/*" + value + (node.unclosed ? "" : "*/");
else if (type === "div") return (node.before || "") + value + (node.after || "");
else if (Array.isArray(node.nodes)) {
buf = stringify(node.nodes, custom);
if (type !== "function") return buf;
return value + "(" + (node.before || "") + buf + (node.after || "") + (node.unclosed ? "" : ")");
}
return value;
}
function stringify(nodes, custom) {
var result, i;
if (Array.isArray(nodes)) {
result = "";
for (i = nodes.length - 1; ~i; i -= 1) result = stringifyNode(nodes[i], custom) + result;
return result;
}
return stringifyNode(nodes, custom);
}
module.exports = stringify;
}));
//#endregion
//#region ../../node_modules/.pnpm/postcss-value-parser@4.2.0/node_modules/postcss-value-parser/lib/unit.js
var require_unit = /* @__PURE__ */ __commonJSMin(((exports, module) => {
var minus = "-".charCodeAt(0);
var plus = "+".charCodeAt(0);
var dot = ".".charCodeAt(0);
var exp = "e".charCodeAt(0);
var EXP = "E".charCodeAt(0);
function likeNumber(value) {
var code = value.charCodeAt(0);
var nextCode;
if (code === plus || code === minus) {
nextCode = value.charCodeAt(1);
if (nextCode >= 48 && nextCode <= 57) return true;
var nextNextCode = value.charCodeAt(2);
if (nextCode === dot && nextNextCode >= 48 && nextNextCode <= 57) return true;
return false;
}
if (code === dot) {
nextCode = value.charCodeAt(1);
if (nextCode >= 48 && nextCode <= 57) return true;
return false;
}
if (code >= 48 && code <= 57) return true;
return false;
}
module.exports = function(value) {
var pos = 0;
var length = value.length;
var code;
var nextCode;
var nextNextCode;
if (length === 0 || !likeNumber(value)) return false;
code = value.charCodeAt(pos);
if (code === plus || code === minus) pos++;
while (pos < length) {
code = value.charCodeAt(pos);
if (code < 48 || code > 57) break;
pos += 1;
}
code = value.charCodeAt(pos);
nextCode = value.charCodeAt(pos + 1);
if (code === dot && nextCode >= 48 && nextCode <= 57) {
pos += 2;
while (pos < length) {
code = value.charCodeAt(pos);
if (code < 48 || code > 57) break;
pos += 1;
}
}
code = value.charCodeAt(pos);
nextCode = value.charCodeAt(pos + 1);
nextNextCode = value.charCodeAt(pos + 2);
if ((code === exp || code === EXP) && (nextCode >= 48 && nextCode <= 57 || (nextCode === plus || nextCode === minus) && nextNextCode >= 48 && nextNextCode <= 57)) {
pos += nextCode === plus || nextCode === minus ? 3 : 2;
while (pos < length) {
code = value.charCodeAt(pos);
if (code < 48 || code > 57) break;
pos += 1;
}
}
return {
number: value.slice(0, pos),
unit: value.slice(pos)
};
};
}));
//#endregion
//#region ../../node_modules/.pnpm/postcss-value-parser@4.2.0/node_modules/postcss-value-parser/lib/index.js
var require_lib = /* @__PURE__ */ __commonJSMin(((exports, module) => {
var parse = require_parse();
var walk = require_walk();
var stringify = require_stringify();
function ValueParser(value) {
if (this instanceof ValueParser) {
this.nodes = parse(value);
return this;
}
return new ValueParser(value);
}
ValueParser.prototype.toString = function() {
return Array.isArray(this.nodes) ? stringify(this.nodes) : "";
};
ValueParser.prototype.walk = function(cb, bubble) {
walk(this.nodes, cb, bubble);
return this;
};
ValueParser.unit = require_unit();
ValueParser.walk = walk;
ValueParser.stringify = stringify;
module.exports = ValueParser;
}));
//#endregion
export { require_lib as t };
@@ -0,0 +1,11 @@
import { RenderedChunk, Plugin } from 'rollup';
interface PluginOptions {
warn?: (message: string) => void;
matcher?: (info: RenderedChunk) => boolean;
}
declare function cjsExportsDtsMatcher(info: RenderedChunk): boolean;
declare function defaultCjsExportsDtsMatcher(info: RenderedChunk): boolean;
declare function FixDtsDefaultCjsExportsPlugin(options?: PluginOptions): Plugin;
export { FixDtsDefaultCjsExportsPlugin, type PluginOptions, cjsExportsDtsMatcher, defaultCjsExportsDtsMatcher };
@@ -0,0 +1,35 @@
import * as React from "./";
export { Fragment } from "./";
export namespace JSX {
interface Element extends React.JSX.Element {}
interface ElementClass extends React.JSX.ElementClass {}
interface ElementAttributesProperty extends React.JSX.ElementAttributesProperty {}
interface ElementChildrenAttribute extends React.JSX.ElementChildrenAttribute {}
type LibraryManagedAttributes<C, P> = React.JSX.LibraryManagedAttributes<C, P>;
interface IntrinsicAttributes extends React.JSX.IntrinsicAttributes {}
interface IntrinsicClassAttributes<T> extends React.JSX.IntrinsicClassAttributes<T> {}
interface IntrinsicElements extends React.JSX.IntrinsicElements {}
}
/**
* Create a React element.
*
* You should not use this function directly. Use JSX and a transpiler instead.
*/
export function jsx(
type: React.ElementType,
props: unknown,
key?: React.Key,
): React.ReactElement;
/**
* Create a React element.
*
* You should not use this function directly. Use JSX and a transpiler instead.
*/
export function jsxs(
type: React.ElementType,
props: unknown,
key?: React.Key,
): React.ReactElement;
@@ -0,0 +1,44 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _interopRequireWildcard;
function _interopRequireWildcard(obj, nodeInterop) {
if (typeof WeakMap === "function") {
var cacheBabelInterop = new WeakMap();
var cacheNodeInterop = new WeakMap();
}
return (exports.default = _interopRequireWildcard = function (obj, nodeInterop) {
if (!nodeInterop && obj && obj.__esModule) {
return obj;
}
var _;
var newObj = {
__proto__: null,
default: obj
};
var desc;
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
return newObj;
}
_ = nodeInterop ? cacheNodeInterop : cacheBabelInterop;
if (_) {
if (_.has(obj)) return _.get(obj);
_.set(obj, newObj);
}
for (const key in obj) {
if (key !== "default" && {}.hasOwnProperty.call(obj, key)) {
desc = (_ = Object.defineProperty) && Object.getOwnPropertyDescriptor(obj, key);
if (desc && (desc.get || desc.set)) {
_(newObj, key, desc);
} else {
newObj[key] = obj[key];
}
}
}
return newObj;
})(obj, nodeInterop);
}
//# sourceMappingURL=interopRequireWildcard.js.map
@@ -0,0 +1,24 @@
/**
* Given a absolute or relative time definition and current/prev time state of the sequence,
* calculate an absolute time for the next keyframes.
*/
function calcNextTime(current, next, prev, labels) {
if (typeof next === "number") {
return next;
}
else if (next.startsWith("-") || next.startsWith("+")) {
return Math.max(0, current + parseFloat(next));
}
else if (next === "<") {
return prev;
}
else if (next.startsWith("<")) {
return Math.max(0, prev + parseFloat(next.slice(1)));
}
else {
return labels.get(next) ?? current;
}
}
export { calcNextTime };
//# sourceMappingURL=calc-time.mjs.map
@@ -0,0 +1 @@
module.exports={A:{A:{"2":"_E"},B:{"2":"_J"},C:{"2":"_S"},D:{"2":"_MI","194":"_LM"},E:{"2":"_R"},F:{"2":"_XI","194":"_MF"},G:{"2":"_M"},H:{"2":"1D"},I:{"2":"_P"},J:{"2":"_B"},K:{"2":"_N"},L:{"194":"I"},M:{"2":"YC"},N:{"2":"_A"},O:{"2":"bC"},P:{"2":"_F"},Q:{"2":"JE"},R:{"2":"KE"},S:{"2":"_C"}},B:4,C:"Magnetometer",D:true};
@@ -0,0 +1 @@
{"version":3,"file":"useLoaderData.cjs","names":[],"sources":["../../src/useLoaderData.tsx"],"sourcesContent":["import { useMatch } from './useMatch'\nimport type {\n StructuralSharingOption,\n ValidateSelected,\n} from './structuralSharing'\nimport type {\n AnyRouter,\n RegisteredRouter,\n ResolveUseLoaderData,\n StrictOrFrom,\n UseLoaderDataResult,\n} from '@tanstack/router-core'\n\nexport interface UseLoaderDataBaseOptions<\n TRouter extends AnyRouter,\n TFrom,\n TStrict extends boolean,\n TSelected,\n TStructuralSharing,\n> {\n select?: (\n match: ResolveUseLoaderData<TRouter, TFrom, TStrict>,\n ) => ValidateSelected<TRouter, TSelected, TStructuralSharing>\n}\n\nexport type UseLoaderDataOptions<\n TRouter extends AnyRouter,\n TFrom extends string | undefined,\n TStrict extends boolean,\n TSelected,\n TStructuralSharing,\n> = StrictOrFrom<TRouter, TFrom, TStrict> &\n UseLoaderDataBaseOptions<\n TRouter,\n TFrom,\n TStrict,\n TSelected,\n TStructuralSharing\n > &\n StructuralSharingOption<TRouter, TSelected, TStructuralSharing>\n\nexport type UseLoaderDataRoute<out TId> = <\n TRouter extends AnyRouter = RegisteredRouter,\n TSelected = unknown,\n TStructuralSharing extends boolean = boolean,\n>(\n opts?: UseLoaderDataBaseOptions<\n TRouter,\n TId,\n true,\n TSelected,\n TStructuralSharing\n > &\n StructuralSharingOption<TRouter, TSelected, TStructuralSharing>,\n) => UseLoaderDataResult<TRouter, TId, true, TSelected>\n\n/**\n * Read and select the current route's loader data with type‑safety.\n *\n * Options:\n * - `from`/`strict`: Choose which route's data to read and strictness\n * - `select`: Map the loader data to a derived value\n * - `structuralSharing`: Enable structural sharing for stable references\n *\n * @returns The loader data (or selected value) for the matched route.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLoaderDataHook\n */\nexport function useLoaderData<\n TRouter extends AnyRouter = RegisteredRouter,\n const TFrom extends string | undefined = undefined,\n TStrict extends boolean = true,\n TSelected = unknown,\n TStructuralSharing extends boolean = boolean,\n>(\n opts: UseLoaderDataOptions<\n TRouter,\n TFrom,\n TStrict,\n TSelected,\n TStructuralSharing\n >,\n): UseLoaderDataResult<TRouter, TFrom, TStrict, TSelected> {\n return useMatch({\n from: opts.from!,\n strict: opts.strict,\n structuralSharing: opts.structuralSharing,\n select: (s: any) => {\n return opts.select ? opts.select(s.loaderData) : s.loaderData\n },\n } as any) as UseLoaderDataResult<TRouter, TFrom, TStrict, TSelected>\n}\n"],"mappings":";;;;;;;;;;;;;AAmEA,SAAgB,cAOd,MAOyD;AACzD,QAAO,iBAAA,SAAS;EACd,MAAM,KAAK;EACX,QAAQ,KAAK;EACb,mBAAmB,KAAK;EACxB,SAAS,MAAW;AAClB,UAAO,KAAK,SAAS,KAAK,OAAO,EAAE,WAAW,GAAG,EAAE;;EAEtD,CAAQ"}
@@ -0,0 +1,71 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.authenticateClient = authenticateClient;
const z = __importStar(require("zod/v4"));
const errors_js_1 = require("../errors.js");
const ClientAuthenticatedRequestSchema = z.object({
client_id: z.string(),
client_secret: z.string().optional()
});
function authenticateClient({ clientsStore }) {
return async (req, res, next) => {
try {
const result = ClientAuthenticatedRequestSchema.safeParse(req.body);
if (!result.success) {
throw new errors_js_1.InvalidRequestError(String(result.error));
}
const { client_id, client_secret } = result.data;
const client = await clientsStore.getClient(client_id);
if (!client) {
throw new errors_js_1.InvalidClientError('Invalid client_id');
}
if (client.client_secret) {
if (!client_secret) {
throw new errors_js_1.InvalidClientError('Client secret is required');
}
if (client.client_secret !== client_secret) {
throw new errors_js_1.InvalidClientError('Invalid client_secret');
}
if (client.client_secret_expires_at && client.client_secret_expires_at < Math.floor(Date.now() / 1000)) {
throw new errors_js_1.InvalidClientError('Client secret has expired');
}
}
req.client = client;
next();
}
catch (error) {
if (error instanceof errors_js_1.OAuthError) {
const status = error instanceof errors_js_1.ServerError ? 500 : 400;
res.status(status).json(error.toResponseObject());
}
else {
const serverError = new errors_js_1.ServerError('Internal Server Error');
res.status(500).json(serverError.toResponseObject());
}
}
};
}
//# sourceMappingURL=clientAuth.js.map
@@ -0,0 +1 @@
module.exports={C:{"78":0.05009,"82":0.00911,"102":0.00911,"110":0.00455,"115":0.22315,"119":0.00455,"120":0.02277,"121":0.03643,"126":0.00455,"128":0.02732,"135":0.00455,"136":0.00455,"137":0.00455,"139":0.00911,"140":0.53737,"141":0.03188,"142":0.00911,"143":0.00911,"144":0.01366,"146":0.00455,"147":0.00455,"149":0.01822,"150":0.09563,"151":0.02277,"152":0.03188,"153":0.07286,"154":0.60568,"155":1.92634,"156":1.5939,"157":0.02277,_:"2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 79 80 81 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 103 104 105 106 107 108 109 111 112 113 114 116 117 118 122 123 124 125 127 129 130 131 132 133 134 138 145 148 158 159 160 3.5 3.6"},D:{"49":0.01366,"70":0.00455,"71":0.00455,"73":0.00455,"79":0.00455,"84":0.00455,"85":0.01822,"86":0.00911,"87":0.08653,"91":0.00455,"94":0.00911,"95":0.00455,"98":0.06831,"103":0.15939,"104":0.01366,"105":0.02277,"106":0.01366,"107":0.01366,"108":0.01366,"109":0.2869,"110":0.00911,"111":0.02277,"112":0.01366,"113":0.00911,"114":0.00455,"116":0.10019,"117":0.01366,"118":0.25958,"119":0.09563,"120":0.06376,"121":0.00911,"122":0.05009,"123":0.0592,"124":0.01822,"126":0.00455,"128":0.04099,"130":0.00455,"131":0.07742,"132":0.01366,"133":0.16394,"134":0.15028,"135":0.14117,"136":0.13662,"137":0.13662,"138":0.30056,"139":0.20493,"140":0.26413,"141":0.15028,"142":0.52826,"143":0.00455,"144":0.27779,"145":0.02277,"146":0.06376,"147":0.25047,"148":0.08653,"149":0.15484,"150":0.3962,"151":1.29789,"152":7.71448,"153":7.26818,"154":2.06752,"155":0.01366,_:"4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 72 74 75 76 77 78 80 81 83 88 89 90 92 93 96 97 99 100 101 102 115 125 127 129 156 157"},F:{"37":0.00455,"46":0.00455,"100":0.01822,"101":0.01822,"102":0.00911,"119":0.00455,"120":0.00455,"132":0.00455,"133":0.02732,"134":0.12296,"135":1.52559,_:"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 38 39 40 41 42 43 44 45 47 48 49 50 51 52 53 54 55 56 57 58 60 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 121 122 123 124 125 126 127 131 9.5-9.6 10.0-10.1 10.5 10.6 11.1 11.5 11.6 12.1"},B:{"17":0.00455,"90":0.00455,"92":0.00911,"119":0.02277,"120":0.02277,"122":0.02732,"138":0.00455,"140":0.01822,"141":0.02277,"142":0.05465,"144":0.02277,"145":0.00455,"146":0.01822,"147":0.01366,"148":0.00911,"149":0.09108,"150":0.14573,"151":0.18216,"152":2.64132,"153":3.5339,"154":0.82883,_:"12 13 14 15 16 18 79 80 81 83 84 85 86 87 88 89 91 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 121 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 139 143"},E:{"27":0.18671,_:"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 12.1 15.1 15.2-15.3 15.4 15.5 16.1 16.2 17.0 18.2 27.1 27.2 TP","11.1":0.00455,"13.1":0.00911,"14.1":0.01366,"15.6":0.10019,"16.0":0.00455,"16.3":0.01366,"16.4":0.00911,"16.5":0.02277,"16.6":0.20038,"17.1":0.04554,"17.2":0.00455,"17.3":0.00911,"17.4":0.06831,"17.5":0.02732,"17.6":0.18216,"18.0":0.05465,"18.1":0.01366,"18.3":0.01822,"18.4":0.04554,"18.5-18.7":0.15939,"26.0":0.00455,"26.1":0.00911,"26.2":0.05009,"26.3":0.05009,"26.4":0.12296,"26.5":0.23225,"26.6":1.60756},G:{"8":0,"3.2":0,"4.0-4.1":0,"4.2-4.3":0.00168,"5.0-5.1":0.00168,"6.0-6.1":0,"7.0-7.1":0.00336,"8.1-8.4":0,"9.0-9.2":0,"9.3":0,"10.0-10.2":0,"10.3":0.01679,"11.0-11.2":0.00168,"11.3-11.4":0.00336,"12.0-12.1":0,"12.2-12.5":0.04365,"13.0-13.1":0,"13.2":0.00839,"13.3":0,"13.4-13.7":0.00168,"14.0-14.4":0.00671,"14.5-14.8":0.01007,"15.0-15.1":0.01007,"15.2-15.3":0.00671,"15.4":0.00839,"15.5":0.01007,"15.6-15.8":0.21823,"16.0":0.01679,"16.1":0.03022,"16.2":0.01679,"16.3":0.03693,"16.4":0.00839,"16.5":0.01343,"16.6-16.7":0.30384,"17.0":0.01175,"17.1":0.01679,"17.2":0.01679,"17.3":0.02518,"17.4":0.03525,"17.5":0.06883,"17.6-17.7":0.17794,"18.0":0.03693,"18.1":0.07386,"18.2":0.10072,"18.3":0.17458,"18.4":0.10912,"18.5-18.7":2.25449,"26.0":0.10912,"26.1":0.11079,"26.2":0.28874,"26.3":0.31224,"26.4":0.2283,"26.5":1.52929,"26.6":9.43594,"27.0":0.72352,"27.1":0,"27.2":0.01847},P:{"4":0.01876,"25":0.00938,"26":0.00938,"27":0.00938,"28":0.02814,"29":0.0469,"30":2.26993,_:"20 21 22 23 24 5.0-5.4 6.2-6.4 8.2 9.2 10.1 11.1-11.2 12.0 13.0 14.0 15.0 16.0 17.0 18.0 19.0","7.2-7.4":0.00938},I:{"0":0.01088,"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.20147,_:"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"},L:{"0":34.82315},R:{_:"0"},M:{"0":0.68063},Q:{_:"14.9"},O:{"0":0.26136},H:{alLine truncated
@@ -0,0 +1,252 @@
import collections
import contextlib
import functools
import os
import re
import sys
import warnings
from typing import Dict, Generator, Iterator, NamedTuple, Optional, Sequence, Tuple
from ._elffile import EIClass, EIData, ELFFile, EMachine
EF_ARM_ABIMASK = 0xFF000000
EF_ARM_ABI_VER5 = 0x05000000
EF_ARM_ABI_FLOAT_HARD = 0x00000400
# `os.PathLike` not a generic type until Python 3.9, so sticking with `str`
# as the type for `path` until then.
@contextlib.contextmanager
def _parse_elf(path: str) -> Generator[Optional[ELFFile], None, None]:
try:
with open(path, "rb") as f:
yield ELFFile(f)
except (OSError, TypeError, ValueError):
yield None
def _is_linux_armhf(executable: str) -> bool:
# hard-float ABI can be detected from the ELF header of the running
# process
# https://static.docs.arm.com/ihi0044/g/aaelf32.pdf
with _parse_elf(executable) as f:
return (
f is not None
and f.capacity == EIClass.C32
and f.encoding == EIData.Lsb
and f.machine == EMachine.Arm
and f.flags & EF_ARM_ABIMASK == EF_ARM_ABI_VER5
and f.flags & EF_ARM_ABI_FLOAT_HARD == EF_ARM_ABI_FLOAT_HARD
)
def _is_linux_i686(executable: str) -> bool:
with _parse_elf(executable) as f:
return (
f is not None
and f.capacity == EIClass.C32
and f.encoding == EIData.Lsb
and f.machine == EMachine.I386
)
def _have_compatible_abi(executable: str, archs: Sequence[str]) -> bool:
if "armv7l" in archs:
return _is_linux_armhf(executable)
if "i686" in archs:
return _is_linux_i686(executable)
allowed_archs = {"x86_64", "aarch64", "ppc64", "ppc64le", "s390x", "loongarch64"}
return any(arch in allowed_archs for arch in archs)
# If glibc ever changes its major version, we need to know what the last
# minor version was, so we can build the complete list of all versions.
# For now, guess what the highest minor version might be, assume it will
# be 50 for testing. Once this actually happens, update the dictionary
# with the actual value.
_LAST_GLIBC_MINOR: Dict[int, int] = collections.defaultdict(lambda: 50)
class _GLibCVersion(NamedTuple):
major: int
minor: int
def _glibc_version_string_confstr() -> Optional[str]:
"""
Primary implementation of glibc_version_string using os.confstr.
"""
# os.confstr is quite a bit faster than ctypes.DLL. It's also less likely
# to be broken or missing. This strategy is used in the standard library
# platform module.
# https://github.com/python/cpython/blob/fcf1d003bf4f0100c/Lib/platform.py#L175-L183
try:
# Should be a string like "glibc 2.17".
version_string: str = getattr(os, "confstr")("CS_GNU_LIBC_VERSION")
assert version_string is not None
_, version = version_string.rsplit()
except (AssertionError, AttributeError, OSError, ValueError):
# os.confstr() or CS_GNU_LIBC_VERSION not available (or a bad value)...
return None
return version
def _glibc_version_string_ctypes() -> Optional[str]:
"""
Fallback implementation of glibc_version_string using ctypes.
"""
try:
import ctypes
except ImportError:
return None
# ctypes.CDLL(None) internally calls dlopen(NULL), and as the dlopen
# manpage says, "If filename is NULL, then the returned handle is for the
# main program". This way we can let the linker do the work to figure out
# which libc our process is actually using.
#
# We must also handle the special case where the executable is not a
# dynamically linked executable. This can occur when using musl libc,
# for example. In this situation, dlopen() will error, leading to an
# OSError. Interestingly, at least in the case of musl, there is no
# errno set on the OSError. The single string argument used to construct
# OSError comes from libc itself and is therefore not portable to
# hard code here. In any case, failure to call dlopen() means we
# can proceed, so we bail on our attempt.
try:
process_namespace = ctypes.CDLL(None)
except OSError:
return None
try:
gnu_get_libc_version = process_namespace.gnu_get_libc_version
except AttributeError:
# Symbol doesn't exist -> therefore, we are not linked to
# glibc.
return None
# Call gnu_get_libc_version, which returns a string like "2.5"
gnu_get_libc_version.restype = ctypes.c_char_p
version_str: str = gnu_get_libc_version()
# py2 / py3 compatibility:
if not isinstance(version_str, str):
version_str = version_str.decode("ascii")
return version_str
def _glibc_version_string() -> Optional[str]:
"""Returns glibc version string, or None if not using glibc."""
return _glibc_version_string_confstr() or _glibc_version_string_ctypes()
def _parse_glibc_version(version_str: str) -> Tuple[int, int]:
"""Parse glibc version.
We use a regexp instead of str.split because we want to discard any
random junk that might come after the minor version -- this might happen
in patched/forked versions of glibc (e.g. Linaro's version of glibc
uses version strings like "2.20-2014.11"). See gh-3588.
"""
m = re.match(r"(?P<major>[0-9]+)\.(?P<minor>[0-9]+)", version_str)
if not m:
warnings.warn(
f"Expected glibc version with 2 components major.minor,"
f" got: {version_str}",
RuntimeWarning,
)
return -1, -1
return int(m.group("major")), int(m.group("minor"))
@functools.lru_cache()
def _get_glibc_version() -> Tuple[int, int]:
version_str = _glibc_version_string()
if version_str is None:
return (-1, -1)
return _parse_glibc_version(version_str)
# From PEP 513, PEP 600
def _is_compatible(arch: str, version: _GLibCVersion) -> bool:
sys_glibc = _get_glibc_version()
if sys_glibc < version:
return False
# Check for presence of _manylinux module.
try:
import _manylinux # noqa
except ImportError:
return True
if hasattr(_manylinux, "manylinux_compatible"):
result = _manylinux.manylinux_compatible(version[0], version[1], arch)
if result is not None:
return bool(result)
return True
if version == _GLibCVersion(2, 5):
if hasattr(_manylinux, "manylinux1_compatible"):
return bool(_manylinux.manylinux1_compatible)
if version == _GLibCVersion(2, 12):
if hasattr(_manylinux, "manylinux2010_compatible"):
return bool(_manylinux.manylinux2010_compatible)
if version == _GLibCVersion(2, 17):
if hasattr(_manylinux, "manylinux2014_compatible"):
return bool(_manylinux.manylinux2014_compatible)
return True
_LEGACY_MANYLINUX_MAP = {
# CentOS 7 w/ glibc 2.17 (PEP 599)
(2, 17): "manylinux2014",
# CentOS 6 w/ glibc 2.12 (PEP 571)
(2, 12): "manylinux2010",
# CentOS 5 w/ glibc 2.5 (PEP 513)
(2, 5): "manylinux1",
}
def platform_tags(archs: Sequence[str]) -> Iterator[str]:
"""Generate manylinux tags compatible to the current platform.
:param archs: Sequence of compatible architectures.
The first one shall be the closest to the actual architecture and be the part of
platform tag after the ``linux_`` prefix, e.g. ``x86_64``.
The ``linux_`` prefix is assumed as a prerequisite for the current platform to
be manylinux-compatible.
:returns: An iterator of compatible manylinux tags.
"""
if not _have_compatible_abi(sys.executable, archs):
return
# Oldest glibc to be supported regardless of architecture is (2, 17).
too_old_glibc2 = _GLibCVersion(2, 16)
if set(archs) & {"x86_64", "i686"}:
# On x86/i686 also oldest glibc to be supported is (2, 5).
too_old_glibc2 = _GLibCVersion(2, 4)
current_glibc = _GLibCVersion(*_get_glibc_version())
glibc_max_list = [current_glibc]
# We can assume compatibility across glibc major versions.
# https://sourceware.org/bugzilla/show_bug.cgi?id=24636
#
# Build a list of maximum glibc versions so that we can
# output the canonical list of all glibc from current_glibc
# down to too_old_glibc2, including all intermediary versions.
for glibc_major in range(current_glibc.major - 1, 1, -1):
glibc_minor = _LAST_GLIBC_MINOR[glibc_major]
glibc_max_list.append(_GLibCVersion(glibc_major, glibc_minor))
for arch in archs:
for glibc_max in glibc_max_list:
if glibc_max.major == too_old_glibc2.major:
min_minor = too_old_glibc2.minor
else:
# For other glibc major versions oldest supported is (x, 0).
min_minor = -1
for glibc_minor in range(glibc_max.minor, min_minor, -1):
glibc_version = _GLibCVersion(glibc_max.major, glibc_minor)
tag = "manylinux_{}_{}".format(*glibc_version)
if _is_compatible(arch, glibc_version):
yield f"{tag}_{arch}"
# Handle the legacy manylinux1, manylinux2010, manylinux2014 tags.
if glibc_version in _LEGACY_MANYLINUX_MAP:
legacy_tag = _LEGACY_MANYLINUX_MAP[glibc_version]
if _is_compatible(arch, glibc_version):
yield f"{legacy_tag}_{arch}"
@@ -0,0 +1 @@
{"version":3,"file":"cloud-rain-wind.js","sources":["../../../src/icons/cloud-rain-wind.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name CloudRainWind\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNNCAxNC44OTlBNyA3IDAgMSAxIDE1LjcxIDhoMS43OWE0LjUgNC41IDAgMCAxIDIuNSA4LjI0MiIgLz4KICA8cGF0aCBkPSJtOS4yIDIyIDMtNyIgLz4KICA8cGF0aCBkPSJtOSAxMy0zIDciIC8+CiAgPHBhdGggZD0ibTE3IDEzLTMgNyIgLz4KPC9zdmc+Cg==) - https://lucide.dev/icons/cloud-rain-wind\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst CloudRainWind = createLucideIcon('CloudRainWind', [\n ['path', { d: 'M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242', key: '1pljnt' }],\n ['path', { d: 'm9.2 22 3-7', key: 'sb5f6j' }],\n ['path', { d: 'm9 13-3 7', key: '500co5' }],\n ['path', { d: 'm17 13-3 7', key: '8t2fiy' }],\n]);\n\nexport default CloudRainWind;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAgB,iBAAiB,eAAiB,CAAA,CAAA,CAAA;AAAA,CAAA,CACtD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAA4D,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACzF,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAe,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC5C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAa,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CAC1C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAc,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAC7C,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,4 @@
declare const _default: import("@typescript-eslint/utils/ts-eslint").RuleModule<"commentDetected", [], import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
name: string;
};
export default _default;
@@ -0,0 +1,61 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.convertComments = convertComments;
const tsutils = __importStar(require("ts-api-utils"));
const ts = __importStar(require("typescript"));
const node_utils_1 = require("./node-utils");
const ts_estree_1 = require("./ts-estree");
/**
* Convert all comments for the given AST.
* @param ast the AST object
* @returns the converted ESTreeComment
* @private
*/
function convertComments(ast) {
return Array.from(tsutils.iterateComments(ast), ({ end, kind, pos, value }) => {
const type = kind === ts.SyntaxKind.SingleLineCommentTrivia
? ts_estree_1.AST_TOKEN_TYPES.Line
: ts_estree_1.AST_TOKEN_TYPES.Block;
const range = [pos, end];
const loc = (0, node_utils_1.getLocFor)(range, ast);
return {
type,
loc,
range,
value,
};
});
}
@@ -0,0 +1 @@
{"version":3,"file":"wine-off.js","sources":["../../../src/icons/wine-off.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name WineOff\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8cGF0aCBkPSJNOCAyMmg4IiAvPgogIDxwYXRoIGQ9Ik03IDEwaDNtNyAwaC0xLjM0MyIgLz4KICA8cGF0aCBkPSJNMTIgMTV2NyIgLz4KICA8cGF0aCBkPSJNNy4zMDcgNy4zMDdBMTIuMzMgMTIuMzMgMCAwIDAgNyAxMGE1IDUgMCAwIDAgNy4zOTEgNC4zOTFNOC42MzggMi45ODFDOC43NSAyLjY2OCA4Ljg3MiAyLjM0IDkgMmg2YzEuNSA0IDIgNiAyIDggMCAuNDA3LS4wNS44MDktLjE0NSAxLjE5OCIgLz4KICA8bGluZSB4MT0iMiIgeDI9IjIyIiB5MT0iMiIgeTI9IjIyIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/wine-off\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst WineOff = createLucideIcon('WineOff', [\n ['path', { d: 'M8 22h8', key: 'rmew8v' }],\n ['path', { d: 'M7 10h3m7 0h-1.343', key: 'v48bem' }],\n ['path', { d: 'M12 15v7', key: 't2xh3l' }],\n [\n 'path',\n {\n d: 'M7.307 7.307A12.33 12.33 0 0 0 7 10a5 5 0 0 0 7.391 4.391M8.638 2.981C8.75 2.668 8.872 2.34 9 2h6c1.5 4 2 6 2 8 0 .407-.05.809-.145 1.198',\n key: '1ymjlu',\n },\n ],\n ['line', { x1: '2', x2: '22', y1: '2', y2: '22', key: 'a6p6uj' }],\n]);\n\nexport default WineOff;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,iBAAiB,SAAW,CAAA,CAAA,CAAA;AAAA,CAAA,CAC1C,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACxC,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAsB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CAAA,CACnD,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAA,CAAA,CAAA,CAAE,GAAG,CAAY,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA,CAAA;AAAA,CACzC,CAAA,CAAA;AAAA,CAAA,CAAA,CAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACA,CAAA,CAAA,CAAA,CAAA;AAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACH,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CACP,CAAA,CAAA,CAAA,CAAA;AAAA,CACF,CAAA,CAAA,CAAA;AAAA,CACA,CAAA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ,CAAE,CAAA,CAAA,CAAA,EAAI,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAI,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAI,CAAA,CAAA,CAAA,CAAK,CAAA,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAM,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,UAAU,CAAA;AAClE,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1 @@
{"version":3,"file":"shimsWorkerd.d.mts","names":[],"sources":["../src/shimsWorkerd.ts"],"sourcesContent":[],"mappings":";;;;;;AAqBA;;;cAAa,gBAAA"}
@@ -0,0 +1 @@
{"version":3,"file":"check-square.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1,143 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ValueScope = exports.ValueScopeName = exports.Scope = exports.varKinds = exports.UsedValueState = void 0;
const code_1 = require("./code");
class ValueError extends Error {
constructor(name) {
super(`CodeGen: "code" for ${name} not defined`);
this.value = name.value;
}
}
var UsedValueState;
(function (UsedValueState) {
UsedValueState[UsedValueState["Started"] = 0] = "Started";
UsedValueState[UsedValueState["Completed"] = 1] = "Completed";
})(UsedValueState || (exports.UsedValueState = UsedValueState = {}));
exports.varKinds = {
const: new code_1.Name("const"),
let: new code_1.Name("let"),
var: new code_1.Name("var"),
};
class Scope {
constructor({ prefixes, parent } = {}) {
this._names = {};
this._prefixes = prefixes;
this._parent = parent;
}
toName(nameOrPrefix) {
return nameOrPrefix instanceof code_1.Name ? nameOrPrefix : this.name(nameOrPrefix);
}
name(prefix) {
return new code_1.Name(this._newName(prefix));
}
_newName(prefix) {
const ng = this._names[prefix] || this._nameGroup(prefix);
return `${prefix}${ng.index++}`;
}
_nameGroup(prefix) {
var _a, _b;
if (((_b = (_a = this._parent) === null || _a === void 0 ? void 0 : _a._prefixes) === null || _b === void 0 ? void 0 : _b.has(prefix)) || (this._prefixes && !this._prefixes.has(prefix))) {
throw new Error(`CodeGen: prefix "${prefix}" is not allowed in this scope`);
}
return (this._names[prefix] = { prefix, index: 0 });
}
}
exports.Scope = Scope;
class ValueScopeName extends code_1.Name {
constructor(prefix, nameStr) {
super(nameStr);
this.prefix = prefix;
}
setValue(value, { property, itemIndex }) {
this.value = value;
this.scopePath = (0, code_1._) `.${new code_1.Name(property)}[${itemIndex}]`;
}
}
exports.ValueScopeName = ValueScopeName;
const line = (0, code_1._) `\n`;
class ValueScope extends Scope {
constructor(opts) {
super(opts);
this._values = {};
this._scope = opts.scope;
this.opts = { ...opts, _n: opts.lines ? line : code_1.nil };
}
get() {
return this._scope;
}
name(prefix) {
return new ValueScopeName(prefix, this._newName(prefix));
}
value(nameOrPrefix, value) {
var _a;
if (value.ref === undefined)
throw new Error("CodeGen: ref must be passed in value");
const name = this.toName(nameOrPrefix);
const { prefix } = name;
const valueKey = (_a = value.key) !== null && _a !== void 0 ? _a : value.ref;
let vs = this._values[prefix];
if (vs) {
const _name = vs.get(valueKey);
if (_name)
return _name;
}
else {
vs = this._values[prefix] = new Map();
}
vs.set(valueKey, name);
const s = this._scope[prefix] || (this._scope[prefix] = []);
const itemIndex = s.length;
s[itemIndex] = value.ref;
name.setValue(value, { property: prefix, itemIndex });
return name;
}
getValue(prefix, keyOrRef) {
const vs = this._values[prefix];
if (!vs)
return;
return vs.get(keyOrRef);
}
scopeRefs(scopeName, values = this._values) {
return this._reduceValues(values, (name) => {
if (name.scopePath === undefined)
throw new Error(`CodeGen: name "${name}" has no value`);
return (0, code_1._) `${scopeName}${name.scopePath}`;
});
}
scopeCode(values = this._values, usedValues, getCode) {
return this._reduceValues(values, (name) => {
if (name.value === undefined)
throw new Error(`CodeGen: name "${name}" has no value`);
return name.value.code;
}, usedValues, getCode);
}
_reduceValues(values, valueCode, usedValues = {}, getCode) {
let code = code_1.nil;
for (const prefix in values) {
const vs = values[prefix];
if (!vs)
continue;
const nameSet = (usedValues[prefix] = usedValues[prefix] || new Map());
vs.forEach((name) => {
if (nameSet.has(name))
return;
nameSet.set(name, UsedValueState.Started);
let c = valueCode(name);
if (c) {
const def = this.opts.es5 ? exports.varKinds.var : exports.varKinds.const;
code = (0, code_1._) `${code}${def} ${name} = ${c};${this.opts._n}`;
}
else if ((c = getCode === null || getCode === void 0 ? void 0 : getCode(name))) {
code = (0, code_1._) `${code}${c}${this.opts._n}`;
}
else {
throw new ValueError(name);
}
nameSet.set(name, UsedValueState.Completed);
});
}
return code;
}
}
exports.ValueScope = ValueScope;
//# sourceMappingURL=scope.js.map
@@ -0,0 +1,535 @@
/**
* @fileoverview Rule to preserve caught errors when re-throwing exceptions
* @author Amnish Singh Arora
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const astUtils = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Types
//------------------------------------------------------------------------------
/** @typedef {import("estree").Node} ASTNode */
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
/*
* This is an indicator of an error cause node, that is too complicated to be detected and fixed.
* Eg, when error options is an `Identifier` or a `SpreadElement`.
*/
const UNKNOWN_CAUSE = Symbol("unknown_cause");
const BUILT_IN_ERROR_TYPES = new Set([
"Error",
"EvalError",
"RangeError",
"ReferenceError",
"SyntaxError",
"TypeError",
"URIError",
"AggregateError",
]);
/**
* Finds and returns information about the `cause` property of an error being thrown.
* @param {ASTNode} throwStatement `ThrowStatement` to be checked.
* @returns {{ value: ASTNode; multipleDefinitions: boolean; } | UNKNOWN_CAUSE | null}
* Information about the `cause` of the error being thrown, such as the value node and
* whether there are multiple definitions of `cause`. `null` if there is no `cause`.
*/
function getErrorCause(throwStatement) {
const throwExpression = throwStatement.argument;
/*
* Determine which argument index holds the options object
* `AggregateError` is a special case as it accepts the `options` object as third argument.
*/
const optionsIndex =
throwExpression.callee.name === "AggregateError" ? 2 : 1;
/*
* Make sure there is no `SpreadElement` at or before the `optionsIndex`
* as this messes up the effective order of arguments and makes it complicated
* to track where the actual error options need to be at
*/
const spreadExpressionIndex = throwExpression.arguments.findIndex(
arg => arg.type === "SpreadElement",
);
if (spreadExpressionIndex >= 0 && spreadExpressionIndex <= optionsIndex) {
return UNKNOWN_CAUSE;
}
const errorOptions = throwExpression.arguments[optionsIndex];
if (errorOptions) {
if (errorOptions.type === "ObjectExpression") {
if (
errorOptions.properties.some(
prop => prop.type === "SpreadElement",
)
) {
/*
* If there is a spread element as part of error options, it is too complicated
* to verify if the cause is used properly and auto-fix.
*/
return UNKNOWN_CAUSE;
}
const causeProperties = errorOptions.properties.filter(
prop => astUtils.getStaticPropertyName(prop) === "cause",
);
const causeProperty = causeProperties.at(-1);
return causeProperty
? {
value: causeProperty.value,
multipleDefinitions: causeProperties.length > 1,
}
: null;
}
// Error options exist, but too complicated to be analyzed/fixed
return UNKNOWN_CAUSE;
}
return null;
}
/**
* Finds and returns the `CatchClause` node, that the `node` is part of.
* @param {ASTNode} node The AST node to be evaluated.
* @returns {ASTNode | null } The closest parent `CatchClause` node, `null` if the `node` is not in a catch block.
*/
function findParentCatch(node) {
let currentNode = node;
while (currentNode && currentNode.type !== "CatchClause") {
if (
[
"FunctionDeclaration",
"FunctionExpression",
"ArrowFunctionExpression",
"StaticBlock",
].includes(currentNode.type)
) {
/*
* Make sure the ThrowStatement is not made inside a function definition or a static block inside a high level catch.
* In such cases, the caught error is not directly related to the Throw.
*
* For example,
* try {
* } catch (error) {
* foo = {
* bar() {
* throw new Error();
* }
* };
* }
*/
return null;
}
currentNode = currentNode.parent;
}
return currentNode;
}
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../types').Rule.RuleModule} */
module.exports = {
meta: {
type: "suggestion",
defaultOptions: [
{
requireCatchParameter: false,
},
],
docs: {
description:
"Disallow losing originally caught error when re-throwing custom errors",
recommended: true,
url: "https://eslint.org/docs/latest/rules/preserve-caught-error", // URL to the documentation page for this rule
},
/*
* TODO: We should allow passing `customErrorTypes` option once something like `typescript-eslint`'s
* `TypeOrValueSpecifier` is implemented in core Eslint.
* See:
* 1. https://typescript-eslint.io/packages/type-utils/type-or-value-specifier/
* 2. https://github.com/eslint/eslint/pull/19913#discussion_r2192608593
* 3. https://github.com/eslint/eslint/discussions/16540
*/
schema: [
{
type: "object",
properties: {
requireCatchParameter: {
type: "boolean",
description:
"Requires the catch blocks to always have the caught error parameter so it is not discarded.",
},
},
additionalProperties: false,
},
],
messages: {
missingCause:
"There is no `cause` attached to the symptom error being thrown.",
incorrectCause:
"The symptom error is being thrown with an incorrect `cause`.",
includeCause:
"Include the original caught error as the `cause` of the symptom error.",
missingCatchErrorParam:
"The caught error is not accessible because the catch clause lacks the error parameter. Start referencing the caught error using the catch parameter.",
partiallyLostError:
"Re-throws cannot preserve the caught error as a part of it is being lost due to destructuring.",
caughtErrorShadowed:
"The caught error is being attached as `cause`, but is shadowed by a closer scoped redeclaration.",
},
hasSuggestions: true,
},
create(context) {
const sourceCode = context.sourceCode;
const [{ requireCatchParameter }] = context.options;
//----------------------------------------------------------------------
// Helpers
//----------------------------------------------------------------------
/**
* Checks if a `ThrowStatement` is constructing and throwing a new `Error` object.
*
* Covers all the error types on `globalThis` that support `cause` property:
* https://github.com/microsoft/TypeScript/blob/main/src/lib/es2022.error.d.ts
* @param {ASTNode} throwStatement The `ThrowStatement` that needs to be checked.
* @returns {boolean} `true` if a new "Error" is being thrown, else `false`.
*/
function isThrowingNewError(throwStatement) {
return (
(throwStatement.argument.type === "NewExpression" ||
throwStatement.argument.type === "CallExpression") &&
throwStatement.argument.callee.type === "Identifier" &&
BUILT_IN_ERROR_TYPES.has(throwStatement.argument.callee.name) &&
/*
* Make sure the thrown Error is instance is one of the built-in global error types.
* Custom imports could shadow this, which would lead to false positives.
* e.g. import { Error } from "./my-custom-error.js";
* throw Error("Failed to perform error prone operations");
*/
sourceCode.isGlobalReference(throwStatement.argument.callee)
);
}
/**
* Inserts `cause: <caughtErrorName>` into an inline options object expression.
* @param {RuleFixer} fixer The fixer object.
* @param {ASTNode} optionsNode The options object node.
* @param {string} caughtErrorName The name of the caught error (e.g., "err").
* @returns {Fix} The fix object.
*/
function insertCauseIntoOptions(fixer, optionsNode, caughtErrorName) {
const properties = optionsNode.properties;
if (properties.length === 0) {
// Insert inside empty braces: `{}` → `{ cause: err }`
return fixer.insertTextAfter(
sourceCode.getFirstToken(optionsNode),
`cause: ${caughtErrorName}`,
);
}
const lastProp = properties.at(-1);
return fixer.insertTextAfter(
lastProp,
`, cause: ${caughtErrorName}`,
);
}
//----------------------------------------------------------------------
// Public
//----------------------------------------------------------------------
return {
ThrowStatement(node) {
// Check if the throw is inside a catch block
const parentCatch = findParentCatch(node);
const throwStatement = node;
// Check if a new error is being thrown in a catch block
if (parentCatch && isThrowingNewError(throwStatement)) {
if (
parentCatch.param &&
parentCatch.param.type !== "Identifier"
) {
/*
* When a part of the caught error is being lost at the parameter level, commonly due to destructuring.
* e.g. catch({ message, ...rest })
*/
context.report({
messageId: "partiallyLostError",
node: parentCatch,
});
return;
}
const caughtError =
parentCatch.param?.type === "Identifier"
? parentCatch.param
: null;
// Check if there are throw statements and caught error is being ignored
if (!caughtError) {
if (requireCatchParameter) {
context.report({
node: throwStatement,
messageId: "missingCatchErrorParam",
});
return;
}
return;
}
// Check if there is a cause attached to the new error
const errorCauseInfo = getErrorCause(throwStatement);
if (errorCauseInfo === UNKNOWN_CAUSE) {
// Error options exist, but too complicated to be analyzed/fixed
return;
}
if (errorCauseInfo === null) {
// If there is no `cause` attached to the error being thrown.
context.report({
messageId: "missingCause",
node: throwStatement,
suggest: [
{
messageId: "includeCause",
fix(fixer) {
const throwExpression =
throwStatement.argument;
const args = throwExpression.arguments;
const errorType =
throwExpression.callee.name;
// AggregateError: errors, message, options
if (errorType === "AggregateError") {
const errorsArg = args[0];
const messageArg = args[1];
const optionsArg = args[2];
if (!errorsArg) {
// Case: `throw new AggregateError()` → insert all arguments
const lastToken =
sourceCode.getLastToken(
throwExpression,
);
const lastCalleeToken =
sourceCode.getLastToken(
throwExpression.callee,
);
const parenToken =
sourceCode.getFirstTokenBetween(
lastCalleeToken,
lastToken,
astUtils.isOpeningParenToken,
);
if (parenToken) {
return fixer.insertTextAfter(
parenToken,
`[], "", { cause: ${caughtError.name} }`,
);
}
return fixer.insertTextAfter(
throwExpression.callee,
`([], "", { cause: ${caughtError.name} })`,
);
}
if (!messageArg) {
// Case: `throw new AggregateError([])` → insert message and options
return fixer.insertTextAfter(
errorsArg,
`, "", { cause: ${caughtError.name} }`,
);
}
if (!optionsArg) {
// Case: `throw new AggregateError([], "")` → insert error options only
return fixer.insertTextAfter(
messageArg,
`, { cause: ${caughtError.name} }`,
);
}
if (
optionsArg.type ===
"ObjectExpression"
) {
return insertCauseIntoOptions(
fixer,
optionsArg,
caughtError.name,
);
}
// Complex dynamic options — skip
return null;
}
// Normal Error types
const messageArg = args[0];
const optionsArg = args[1];
if (!messageArg) {
// Case: `throw new Error()` → insert both message and options
const lastToken =
sourceCode.getLastToken(
throwExpression,
);
const lastCalleeToken =
sourceCode.getLastToken(
throwExpression.callee,
);
const parenToken =
sourceCode.getFirstTokenBetween(
lastCalleeToken,
lastToken,
astUtils.isOpeningParenToken,
);
if (parenToken) {
return fixer.insertTextAfter(
parenToken,
`"", { cause: ${caughtError.name} }`,
);
}
return fixer.insertTextAfter(
throwExpression.callee,
`("", { cause: ${caughtError.name} })`,
);
}
if (!optionsArg) {
// Case: `throw new Error("Some message")` → insert only options
return fixer.insertTextAfter(
messageArg,
`, { cause: ${caughtError.name} }`,
);
}
if (
optionsArg.type ===
"ObjectExpression"
) {
return insertCauseIntoOptions(
fixer,
optionsArg,
caughtError.name,
);
}
return null; // Identifier or spread — do not fix
},
},
],
});
// We don't need to check further
return;
}
const { value: thrownErrorCause } = errorCauseInfo;
// If there is an attached cause, verify that it matches the caught error
if (
!(
thrownErrorCause.type === "Identifier" &&
thrownErrorCause.name === caughtError.name
)
) {
const suggest = errorCauseInfo.multipleDefinitions
? null // If there are multiple `cause` definitions, a suggestion could be confusing.
: [
{
messageId: "includeCause",
fix(fixer) {
/*
* In case `cause` is attached using object property shorthand or as a method or accessor.
* e.g. throw Error("fail", { cause });
* throw Error("fail", { cause() { doSomething(); } });
* throw Error("fail", { get cause() { return error; } });
*/
if (
thrownErrorCause.parent
.method ||
thrownErrorCause.parent
.shorthand ||
thrownErrorCause.parent.kind !==
"init"
) {
return fixer.replaceText(
thrownErrorCause.parent,
`cause: ${caughtError.name}`,
);
}
return fixer.replaceText(
thrownErrorCause,
caughtError.name,
);
},
},
];
context.report({
messageId: "incorrectCause",
node: thrownErrorCause,
suggest,
});
return;
}
/*
* If the attached cause matches the identifier name of the caught error,
* make sure it is not being shadowed by a closer scoped redeclaration.
*
* e.g. try {
* doSomething();
* } catch (error) {
* if (whatever) {
* const error = anotherError;
* throw new Error("Something went wrong");
* }
* }
*/
let scope = sourceCode.getScope(throwStatement);
do {
const variable = scope.set.get(caughtError.name);
if (variable) {
break;
}
scope = scope.upper;
} while (scope);
if (scope?.block !== parentCatch) {
// Caught error is being shadowed
context.report({
messageId: "caughtErrorShadowed",
node: throwStatement,
});
}
}
},
};
},
};
@@ -0,0 +1,15 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://json-schema.org/draft/2020-12/meta/unevaluated",
"$vocabulary": {
"https://json-schema.org/draft/2020-12/vocab/unevaluated": true
},
"$dynamicAnchor": "meta",
"title": "Unevaluated applicator vocabulary meta-schema",
"type": ["object", "boolean"],
"properties": {
"unevaluatedItems": {"$dynamicRef": "#meta"},
"unevaluatedProperties": {"$dynamicRef": "#meta"}
}
}
@@ -0,0 +1 @@
{"version":3,"file":"ellipsis.js","sources":["../../../src/icons/ellipsis.ts"],"sourcesContent":["import createLucideIcon from '../createLucideIcon';\n\n/**\n * @component @name Ellipsis\n * @description Lucide SVG icon component, renders SVG Element with children.\n *\n * @preview ![img](data:image/svg+xml;base64,PHN2ZyAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIgogIHdpZHRoPSIyNCIKICBoZWlnaHQ9IjI0IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHN0cm9rZT0iIzAwMCIgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmZmY7IGJvcmRlci1yYWRpdXM6IDJweCIKICBzdHJva2Utd2lkdGg9IjIiCiAgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIgogIHN0cm9rZS1saW5lam9pbj0icm91bmQiCj4KICA8Y2lyY2xlIGN4PSIxMiIgY3k9IjEyIiByPSIxIiAvPgogIDxjaXJjbGUgY3g9IjE5IiBjeT0iMTIiIHI9IjEiIC8+CiAgPGNpcmNsZSBjeD0iNSIgY3k9IjEyIiByPSIxIiAvPgo8L3N2Zz4K) - https://lucide.dev/icons/ellipsis\n * @see https://lucide.dev/guide/packages/lucide-react - Documentation\n *\n * @param {Object} props - Lucide icons props and any valid SVG attribute\n * @returns {JSX.Element} JSX Element\n *\n */\nconst Ellipsis = createLucideIcon('Ellipsis', [\n ['circle', { cx: '12', cy: '12', r: '1', key: '41hilf' }],\n ['circle', { cx: '19', cy: '12', r: '1', key: '1wjl8i' }],\n ['circle', { cx: '5', cy: '12', r: '1', key: '1pcz8c' }],\n]);\n\nexport default Ellipsis;\n"],"names":[],"mappings":";;;;;;;;;AAaM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,iBAAiB,UAAY,CAAA,CAAA,CAAA;AAAA,CAC5C,CAAA,CAAC,QAAU,CAAA,CAAA,CAAA,CAAE,EAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAM,CAAI,CAAA,CAAA,CAAA,IAAA,CAAM,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,GAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAU,CAAA,CAAA;AAAA,CACxD,CAAA,CAAC,QAAU,CAAA,CAAA,CAAA,CAAE,EAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAM,CAAI,CAAA,CAAA,CAAA,IAAA,CAAM,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,GAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAU,CAAA,CAAA;AAAA,CACxD,CAAA,CAAC,QAAU,CAAA,CAAA,CAAA,CAAE,EAAI,CAAA,CAAA,CAAA,CAAA,CAAA,EAAK,CAAI,CAAA,CAAA,CAAA,IAAA,CAAM,CAAA,CAAG,EAAA,CAAA,CAAA,CAAA,CAAA,CAAK,GAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAU,CAAA;AACzD,CAAC,CAAA,CAAA;;"}
@@ -0,0 +1,30 @@
omrilotan (https://github.com/omrilotan)
gorangajic (https://github.com/gorangajic)
deedeeh (https://github.com/deedeeh)
dependabot[bot] (https://github.com/apps/dependabot)
itayganor (https://github.com/itayganor)
franzmoro (https://github.com/franzmoro)
webinista (https://github.com/webinista)
LeaVerou (https://github.com/LeaVerou)
maximn (https://github.com/maximn)
rynmsh (https://github.com/rynmsh)
oskarrisberg (https://github.com/oskarrisberg)
ArkadyFukzon (https://github.com/ArkadyFukzon)
viraptor (https://github.com/viraptor)
timbowhite (https://github.com/timbowhite)
chinesedfan (https://github.com/chinesedfan)
deadlypants1973 (https://github.com/deadlypants1973)
dependabot-preview[bot] (https://github.com/apps/dependabot-preview)
drewbard (https://github.com/drewbard)
interisti (https://github.com/interisti)
kieranstartup (https://github.com/kieranstartup)
orangeflame (https://github.com/orangeflame)
lirantal (https://github.com/lirantal)
migara (https://github.com/migara)
neraks (https://github.com/neraks)
niftylettuce (https://github.com/niftylettuce)
wcho (https://github.com/wcho)
simonecorsi (https://github.com/simonecorsi)
0x7f (https://github.com/0x7f)
mhluska (https://github.com/mhluska)
hijarian (https://github.com/hijarian)