diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json index 4dcbad2d..8b988e3f 100644 --- a/node_modules/.package-lock.json +++ b/node_modules/.package-lock.json @@ -593,9 +593,9 @@ } }, "node_modules/@babel/traverse": { - "version": "7.23.0", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.0.tgz", - "integrity": "sha512-t/QaEvyIoIkwzpiZ7aoSKK8kObQYeF7T2v+dazAYCb8SXtp58zEVkWW7zAnju8FNKNdr4ScAOEDmMItbyOmEYw==", + "version": "7.23.2", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.2.tgz", + "integrity": "sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw==", "dev": true, "dependencies": { "@babel/code-frame": "^7.22.13", @@ -634,9 +634,9 @@ "dev": true }, "node_modules/@github/markdownlint-github": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/@github/markdownlint-github/-/markdownlint-github-0.6.0.tgz", - "integrity": "sha512-THR2p9AExA1lxLoBIJnmFg8VGOCMDNcQDxA6O/JvSyL4ODqGrqozbMsH4xCE19+7Li+NeqwqJEdmmVas5LjT1A==", + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/@github/markdownlint-github/-/markdownlint-github-0.6.2.tgz", + "integrity": "sha512-cd+eRhqqIAXICHu5RQ9de70AZEI14opO9TqTz8HjkjQwWC1HRsdTwsRiK+6Fz2DqC1ZEd6t7+Dh5brOChLozcg==", "dependencies": { "lodash": "^4.17.15" } diff --git a/node_modules/@babel/traverse/lib/path/evaluation.js b/node_modules/@babel/traverse/lib/path/evaluation.js index 6ddf14d9..f533e762 100644 --- a/node_modules/@babel/traverse/lib/path/evaluation.js +++ b/node_modules/@babel/traverse/lib/path/evaluation.js @@ -295,7 +295,10 @@ function _evaluate(path, state) { const property = callee.get("property"); if (object.isIdentifier() && property.isIdentifier() && isValidObjectCallee(object.node.name) && !isInvalidMethod(property.node.name)) { context = global[object.node.name]; - func = context[property.node.name]; + const key = property.node.name; + if (Object.hasOwnProperty.call(context, key)) { + func = context[key]; + } } if (object.isLiteral() && property.isIdentifier()) { const type = typeof object.node.value; diff --git a/node_modules/@babel/traverse/lib/path/evaluation.js.map b/node_modules/@babel/traverse/lib/path/evaluation.js.map index 67a2b7dd..5ef394f8 100644 --- a/node_modules/@babel/traverse/lib/path/evaluation.js.map +++ b/node_modules/@babel/traverse/lib/path/evaluation.js.map @@ -1 +1 @@ -{"version":3,"names":["VALID_OBJECT_CALLEES","VALID_IDENTIFIER_CALLEES","INVALID_METHODS","isValidObjectCallee","val","includes","isValidIdentifierCallee","isInvalidMethod","evaluateTruthy","res","evaluate","confident","value","deopt","path","state","deoptPath","Globals","Map","undefined","Infinity","NaN","evaluateCached","node","seen","has","existing","get","resolved","item","set","_evaluate","isSequenceExpression","exprs","length","isStringLiteral","isNumericLiteral","isBooleanLiteral","isNullLiteral","isTemplateLiteral","evaluateQuasis","quasis","isTaggedTemplateExpression","isMemberExpression","object","name","property","isIdentifier","scope","getBinding","quasi","isConditionalExpression","testResult","isExpressionWrapper","parentPath","isCallExpression","callee","isLiteral","type","key","computed","isReferencedIdentifier","binding","constantViolations","start","end","hasValue","resolve","isUnaryExpression","prefix","operator","argument","isFunction","isClass","arg","isArrayExpression","arr","elems","elem","elemValue","push","isObjectExpression","obj","props","prop","isObjectMethod","isSpreadElement","keyPath","valuePath","isLogicalExpression","wasConfident","left","leftConfident","right","rightConfident","isBinaryExpression","Math","pow","context","func","global","args","map","apply","raw","str","i","cooked","expr","String"],"sources":["../../src/path/evaluation.ts"],"sourcesContent":["import type NodePath from \"./index.ts\";\nimport type * as t from \"@babel/types\";\n\n// This file contains Babels metainterpreter that can evaluate static code.\n\nconst VALID_OBJECT_CALLEES = [\"Number\", \"String\", \"Math\"] as const;\nconst VALID_IDENTIFIER_CALLEES = [\n \"isFinite\",\n \"isNaN\",\n \"parseFloat\",\n \"parseInt\",\n \"decodeURI\",\n \"decodeURIComponent\",\n \"encodeURI\",\n \"encodeURIComponent\",\n process.env.BABEL_8_BREAKING ? \"btoa\" : null,\n process.env.BABEL_8_BREAKING ? \"atob\" : null,\n] as const;\n\nconst INVALID_METHODS = [\"random\"] as const;\n\nfunction isValidObjectCallee(\n val: string,\n): val is (typeof VALID_OBJECT_CALLEES)[number] {\n return VALID_OBJECT_CALLEES.includes(\n // @ts-expect-error val is a string\n val,\n );\n}\n\nfunction isValidIdentifierCallee(\n val: string,\n): val is (typeof VALID_IDENTIFIER_CALLEES)[number] {\n return VALID_IDENTIFIER_CALLEES.includes(\n // @ts-expect-error val is a string\n val,\n );\n}\n\nfunction isInvalidMethod(val: string): val is (typeof INVALID_METHODS)[number] {\n return INVALID_METHODS.includes(\n // @ts-expect-error val is a string\n val,\n );\n}\n\n/**\n * Walk the input `node` and statically evaluate if it's truthy.\n *\n * Returning `true` when we're sure that the expression will evaluate to a\n * truthy value, `false` if we're sure that it will evaluate to a falsy\n * value and `undefined` if we aren't sure. Because of this please do not\n * rely on coercion when using this method and check with === if it's false.\n *\n * For example do:\n *\n * if (t.evaluateTruthy(node) === false) falsyLogic();\n *\n * **AND NOT**\n *\n * if (!t.evaluateTruthy(node)) falsyLogic();\n *\n */\n\nexport function evaluateTruthy(this: NodePath): boolean {\n const res = this.evaluate();\n if (res.confident) return !!res.value;\n}\n\ntype State = {\n confident: boolean;\n deoptPath: NodePath | null;\n seen: Map;\n};\n\ntype Result = {\n resolved: boolean;\n value?: any;\n};\n/**\n * Deopts the evaluation\n */\nfunction deopt(path: NodePath, state: State) {\n if (!state.confident) return;\n state.deoptPath = path;\n state.confident = false;\n}\n\nconst Globals = new Map([\n [\"undefined\", undefined],\n [\"Infinity\", Infinity],\n [\"NaN\", NaN],\n]);\n\n/**\n * We wrap the _evaluate method so we can track `seen` nodes, we push an item\n * to the map before we actually evaluate it so we can deopt on self recursive\n * nodes such as:\n *\n * var g = a ? 1 : 2,\n * a = g * this.foo\n */\nfunction evaluateCached(path: NodePath, state: State): any {\n const { node } = path;\n const { seen } = state;\n\n if (seen.has(node)) {\n const existing = seen.get(node);\n if (existing.resolved) {\n return existing.value;\n } else {\n deopt(path, state);\n return;\n }\n } else {\n const item: Result = { resolved: false };\n seen.set(node, item);\n\n const val = _evaluate(path, state);\n if (state.confident) {\n item.resolved = true;\n item.value = val;\n }\n return val;\n }\n}\n\nfunction _evaluate(path: NodePath, state: State): any {\n if (!state.confident) return;\n\n if (path.isSequenceExpression()) {\n const exprs = path.get(\"expressions\");\n return evaluateCached(exprs[exprs.length - 1], state);\n }\n\n if (\n path.isStringLiteral() ||\n path.isNumericLiteral() ||\n path.isBooleanLiteral()\n ) {\n return path.node.value;\n }\n\n if (path.isNullLiteral()) {\n return null;\n }\n\n if (path.isTemplateLiteral()) {\n return evaluateQuasis(path, path.node.quasis, state);\n }\n\n if (\n path.isTaggedTemplateExpression() &&\n path.get(\"tag\").isMemberExpression()\n ) {\n const object = path.get(\"tag.object\") as NodePath;\n const {\n // @ts-expect-error todo(flow->ts): possible bug, object is can be any expression and so name might be undefined\n node: { name },\n } = object;\n const property = path.get(\"tag.property\") as NodePath;\n\n if (\n object.isIdentifier() &&\n name === \"String\" &&\n // todo(flow->ts): was changed from getBinding(name, true)\n // should this be hasBinding(name, true) as the binding is never used later?\n !path.scope.getBinding(name) &&\n property.isIdentifier() &&\n property.node.name === \"raw\"\n ) {\n return evaluateQuasis(path, path.node.quasi.quasis, state, true);\n }\n }\n\n if (path.isConditionalExpression()) {\n const testResult = evaluateCached(path.get(\"test\"), state);\n if (!state.confident) return;\n if (testResult) {\n return evaluateCached(path.get(\"consequent\"), state);\n } else {\n return evaluateCached(path.get(\"alternate\"), state);\n }\n }\n\n if (path.isExpressionWrapper()) {\n // TypeCastExpression, ExpressionStatement etc\n return evaluateCached(path.get(\"expression\"), state);\n }\n\n // \"foo\".length, \"foo\"[0]\n if (\n path.isMemberExpression() &&\n !path.parentPath.isCallExpression({ callee: path.node })\n ) {\n const property = path.get(\"property\");\n const object = path.get(\"object\");\n\n if (object.isLiteral()) {\n // @ts-expect-error todo(flow->ts): instead of typeof - would it be better to check type of ast node?\n const value = object.node.value;\n const type = typeof value;\n\n let key = null;\n if (path.node.computed) {\n key = evaluateCached(property, state);\n if (!state.confident) return;\n } else if (property.isIdentifier()) {\n key = property.node.name;\n }\n if (\n (type === \"number\" || type === \"string\") &&\n key != null &&\n (typeof key === \"number\" || typeof key === \"string\")\n ) {\n return value[key];\n }\n }\n }\n\n if (path.isReferencedIdentifier()) {\n const binding = path.scope.getBinding(path.node.name);\n\n if (binding) {\n if (\n binding.constantViolations.length > 0 ||\n path.node.start < binding.path.node.end\n ) {\n deopt(binding.path, state);\n return;\n }\n if (binding.hasValue) {\n return binding.value;\n }\n }\n\n const name = path.node.name;\n if (Globals.has(name)) {\n if (!binding) {\n return Globals.get(name);\n }\n deopt(binding.path, state);\n return;\n }\n\n const resolved = path.resolve();\n if (resolved === path) {\n deopt(path, state);\n return;\n } else {\n return evaluateCached(resolved, state);\n }\n }\n\n if (path.isUnaryExpression({ prefix: true })) {\n if (path.node.operator === \"void\") {\n // we don't need to evaluate the argument to know what this will return\n return undefined;\n }\n\n const argument = path.get(\"argument\");\n if (\n path.node.operator === \"typeof\" &&\n (argument.isFunction() || argument.isClass())\n ) {\n return \"function\";\n }\n\n const arg = evaluateCached(argument, state);\n if (!state.confident) return;\n switch (path.node.operator) {\n case \"!\":\n return !arg;\n case \"+\":\n return +arg;\n case \"-\":\n return -arg;\n case \"~\":\n return ~arg;\n case \"typeof\":\n return typeof arg;\n }\n }\n\n if (path.isArrayExpression()) {\n const arr = [];\n const elems: Array = path.get(\"elements\");\n for (const elem of elems) {\n const elemValue = elem.evaluate();\n\n if (elemValue.confident) {\n arr.push(elemValue.value);\n } else {\n deopt(elemValue.deopt, state);\n return;\n }\n }\n return arr;\n }\n\n if (path.isObjectExpression()) {\n const obj = {};\n const props = path.get(\"properties\");\n for (const prop of props) {\n if (prop.isObjectMethod() || prop.isSpreadElement()) {\n deopt(prop, state);\n return;\n }\n const keyPath = (prop as NodePath).get(\"key\");\n let key;\n // @ts-expect-error todo(flow->ts): type refinement issues ObjectMethod and SpreadElement somehow not excluded\n if (prop.node.computed) {\n key = keyPath.evaluate();\n if (!key.confident) {\n deopt(key.deopt, state);\n return;\n }\n key = key.value;\n } else if (keyPath.isIdentifier()) {\n key = keyPath.node.name;\n } else {\n key = (\n keyPath.node as t.StringLiteral | t.NumericLiteral | t.BigIntLiteral\n ).value;\n }\n const valuePath = (prop as NodePath).get(\"value\");\n let value = valuePath.evaluate();\n if (!value.confident) {\n deopt(value.deopt, state);\n return;\n }\n value = value.value;\n // @ts-expect-error key is any type\n obj[key] = value;\n }\n return obj;\n }\n\n if (path.isLogicalExpression()) {\n // If we are confident that the left side of an && is false, or the left\n // side of an || is true, we can be confident about the entire expression\n const wasConfident = state.confident;\n const left = evaluateCached(path.get(\"left\"), state);\n const leftConfident = state.confident;\n state.confident = wasConfident;\n const right = evaluateCached(path.get(\"right\"), state);\n const rightConfident = state.confident;\n\n switch (path.node.operator) {\n case \"||\":\n // TODO consider having a \"truthy type\" that doesn't bail on\n // left uncertainty but can still evaluate to truthy.\n state.confident = leftConfident && (!!left || rightConfident);\n if (!state.confident) return;\n\n return left || right;\n case \"&&\":\n state.confident = leftConfident && (!left || rightConfident);\n if (!state.confident) return;\n\n return left && right;\n case \"??\":\n state.confident = leftConfident && (left != null || rightConfident);\n if (!state.confident) return;\n\n return left ?? right;\n }\n }\n\n if (path.isBinaryExpression()) {\n const left = evaluateCached(path.get(\"left\"), state);\n if (!state.confident) return;\n const right = evaluateCached(path.get(\"right\"), state);\n if (!state.confident) return;\n\n switch (path.node.operator) {\n case \"-\":\n return left - right;\n case \"+\":\n return left + right;\n case \"/\":\n return left / right;\n case \"*\":\n return left * right;\n case \"%\":\n return left % right;\n case \"**\":\n return left ** right;\n case \"<\":\n return left < right;\n case \">\":\n return left > right;\n case \"<=\":\n return left <= right;\n case \">=\":\n return left >= right;\n case \"==\":\n return left == right; // eslint-disable-line eqeqeq\n case \"!=\":\n return left != right;\n case \"===\":\n return left === right;\n case \"!==\":\n return left !== right;\n case \"|\":\n return left | right;\n case \"&\":\n return left & right;\n case \"^\":\n return left ^ right;\n case \"<<\":\n return left << right;\n case \">>\":\n return left >> right;\n case \">>>\":\n return left >>> right;\n }\n }\n\n if (path.isCallExpression()) {\n const callee = path.get(\"callee\");\n let context;\n let func;\n\n // Number(1);\n if (\n callee.isIdentifier() &&\n !path.scope.getBinding(callee.node.name) &&\n (isValidObjectCallee(callee.node.name) ||\n isValidIdentifierCallee(callee.node.name))\n ) {\n func = global[callee.node.name];\n }\n\n if (callee.isMemberExpression()) {\n const object = callee.get(\"object\");\n const property = callee.get(\"property\");\n\n // Math.min(1, 2)\n if (\n object.isIdentifier() &&\n property.isIdentifier() &&\n isValidObjectCallee(object.node.name) &&\n !isInvalidMethod(property.node.name)\n ) {\n context = global[object.node.name];\n // @ts-expect-error property may not exist in context object\n func = context[property.node.name];\n }\n\n // \"abc\".charCodeAt(4)\n if (object.isLiteral() && property.isIdentifier()) {\n // @ts-expect-error todo(flow->ts): consider checking ast node type instead of value type (StringLiteral and NumberLiteral)\n const type = typeof object.node.value;\n if (type === \"string\" || type === \"number\") {\n // @ts-expect-error todo(flow->ts): consider checking ast node type instead of value type\n context = object.node.value;\n func = context[property.node.name];\n }\n }\n }\n\n if (func) {\n const args = path.get(\"arguments\").map(arg => evaluateCached(arg, state));\n if (!state.confident) return;\n\n return func.apply(context, args);\n }\n }\n\n deopt(path, state);\n}\n\nfunction evaluateQuasis(\n path: NodePath,\n quasis: Array,\n state: State,\n raw = false,\n) {\n let str = \"\";\n\n let i = 0;\n const exprs: Array> = path.isTemplateLiteral()\n ? path.get(\"expressions\")\n : path.get(\"quasi.expressions\");\n\n for (const elem of quasis) {\n // not confident, evaluated an expression we don't like\n if (!state.confident) break;\n\n // add on element\n str += raw ? elem.value.raw : elem.value.cooked;\n\n // add on interpolated expression if it's present\n const expr = exprs[i++];\n if (expr) str += String(evaluateCached(expr, state));\n }\n\n if (!state.confident) return;\n return str;\n}\n\n/**\n * Walk the input `node` and statically evaluate it.\n *\n * Returns an object in the form `{ confident, value, deopt }`. `confident`\n * indicates whether or not we had to drop out of evaluating the expression\n * because of hitting an unknown node that we couldn't confidently find the\n * value of, in which case `deopt` is the path of said node.\n *\n * Example:\n *\n * t.evaluate(parse(\"5 + 5\")) // { confident: true, value: 10 }\n * t.evaluate(parse(\"!true\")) // { confident: true, value: false }\n * t.evaluate(parse(\"foo + foo\")) // { confident: false, value: undefined, deopt: NodePath }\n *\n */\n\nexport function evaluate(this: NodePath): {\n confident: boolean;\n value: any;\n deopt?: NodePath;\n} {\n const state: State = {\n confident: true,\n deoptPath: null,\n seen: new Map(),\n };\n let value = evaluateCached(this, state);\n if (!state.confident) value = undefined;\n\n return {\n confident: state.confident,\n deopt: state.deoptPath,\n value: value,\n };\n}\n"],"mappings":";;;;;;;AAKA,MAAMA,oBAAoB,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAU;AAClE,MAAMC,wBAAwB,GAAG,CAC/B,UAAU,EACV,OAAO,EACP,YAAY,EACZ,UAAU,EACV,WAAW,EACX,oBAAoB,EACpB,WAAW,EACX,oBAAoB,EACoB,IAAI,EACJ,IAAI,CACpC;AAEV,MAAMC,eAAe,GAAG,CAAC,QAAQ,CAAU;AAE3C,SAASC,mBAAmBA,CAC1BC,GAAW,EACmC;EAC9C,OAAOJ,oBAAoB,CAACK,QAAQ,CAElCD,GACF,CAAC;AACH;AAEA,SAASE,uBAAuBA,CAC9BF,GAAW,EACuC;EAClD,OAAOH,wBAAwB,CAACI,QAAQ,CAEtCD,GACF,CAAC;AACH;AAEA,SAASG,eAAeA,CAACH,GAAW,EAA2C;EAC7E,OAAOF,eAAe,CAACG,QAAQ,CAE7BD,GACF,CAAC;AACH;AAoBO,SAASI,cAAcA,CAAA,EAA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CAACJ,SAAS,EAAE;IAGtB8F,GAAG,IAAID,GAAG,GAAG1B,IAAI,CAAClE,KAAK,CAAC4F,GAAG,GAAG1B,IAAI,CAAClE,KAAK,CAAC+F,MAAM;IAG/C,MAAMC,IAAI,GAAG3E,KAAK,CAACyE,CAAC,EAAE,CAAC;IACvB,IAAIE,IAAI,EAAEH,GAAG,IAAII,MAAM,CAACvF,cAAc,CAACsF,IAAI,EAAE7F,KAAK,CAAC,CAAC;EACtD;EAEA,IAAI,CAACA,KAAK,CAACJ,SAAS,EAAE;EACtB,OAAO8F,GAAG;AACZ;AAkBO,SAAS/F,QAAQA,CAAA,EAItB;EACA,MAAMK,KAAY,GAAG;IACnBJ,SAAS,EAAE,IAAI;IACfK,SAAS,EAAE,IAAI;IACfQ,IAAI,EAAE,IAAIN,GAAG,CAAC;EAChB,CAAC;EACD,IAAIN,KAAK,GAAGU,cAAc,CAAC,IAAI,EAAEP,KAAK,CAAC;EACvC,IAAI,CAACA,KAAK,CAACJ,SAAS,EAAEC,KAAK,GAAGO,SAAS;EAEvC,OAAO;IACLR,SAAS,EAAEI,KAAK,CAACJ,SAAS;IAC1BE,KAAK,EAAEE,KAAK,CAACC,SAAS;IACtBJ,KAAK,EAAEA;EACT,CAAC;AACH"} \ No newline at end of file +{"version":3,"names":["VALID_OBJECT_CALLEES","VALID_IDENTIFIER_CALLEES","INVALID_METHODS","isValidObjectCallee","val","includes","isValidIdentifierCallee","isInvalidMethod","evaluateTruthy","res","evaluate","confident","value","deopt","path","state","deoptPath","Globals","Map","undefined","Infinity","NaN","evaluateCached","node","seen","has","existing","get","resolved","item","set","_evaluate","isSequenceExpression","exprs","length","isStringLiteral","isNumericLiteral","isBooleanLiteral","isNullLiteral","isTemplateLiteral","evaluateQuasis","quasis","isTaggedTemplateExpression","isMemberExpression","object","name","property","isIdentifier","scope","getBinding","quasi","isConditionalExpression","testResult","isExpressionWrapper","parentPath","isCallExpression","callee","isLiteral","type","key","computed","isReferencedIdentifier","binding","constantViolations","start","end","hasValue","resolve","isUnaryExpression","prefix","operator","argument","isFunction","isClass","arg","isArrayExpression","arr","elems","elem","elemValue","push","isObjectExpression","obj","props","prop","isObjectMethod","isSpreadElement","keyPath","valuePath","isLogicalExpression","wasConfident","left","leftConfident","right","rightConfident","isBinaryExpression","Math","pow","context","func","global","Object","hasOwnProperty","call","args","map","apply","raw","str","i","cooked","expr","String"],"sources":["../../src/path/evaluation.ts"],"sourcesContent":["import type NodePath from \"./index.ts\";\nimport type * as t from \"@babel/types\";\n\n// This file contains Babels metainterpreter that can evaluate static code.\n\nconst VALID_OBJECT_CALLEES = [\"Number\", \"String\", \"Math\"] as const;\nconst VALID_IDENTIFIER_CALLEES = [\n \"isFinite\",\n \"isNaN\",\n \"parseFloat\",\n \"parseInt\",\n \"decodeURI\",\n \"decodeURIComponent\",\n \"encodeURI\",\n \"encodeURIComponent\",\n process.env.BABEL_8_BREAKING ? \"btoa\" : null,\n process.env.BABEL_8_BREAKING ? \"atob\" : null,\n] as const;\n\nconst INVALID_METHODS = [\"random\"] as const;\n\nfunction isValidObjectCallee(\n val: string,\n): val is (typeof VALID_OBJECT_CALLEES)[number] {\n return VALID_OBJECT_CALLEES.includes(\n // @ts-expect-error val is a string\n val,\n );\n}\n\nfunction isValidIdentifierCallee(\n val: string,\n): val is (typeof VALID_IDENTIFIER_CALLEES)[number] {\n return VALID_IDENTIFIER_CALLEES.includes(\n // @ts-expect-error val is a string\n val,\n );\n}\n\nfunction isInvalidMethod(val: string): val is (typeof INVALID_METHODS)[number] {\n return INVALID_METHODS.includes(\n // @ts-expect-error val is a string\n val,\n );\n}\n\n/**\n * Walk the input `node` and statically evaluate if it's truthy.\n *\n * Returning `true` when we're sure that the expression will evaluate to a\n * truthy value, `false` if we're sure that it will evaluate to a falsy\n * value and `undefined` if we aren't sure. Because of this please do not\n * rely on coercion when using this method and check with === if it's false.\n *\n * For example do:\n *\n * if (t.evaluateTruthy(node) === false) falsyLogic();\n *\n * **AND NOT**\n *\n * if (!t.evaluateTruthy(node)) falsyLogic();\n *\n */\n\nexport function evaluateTruthy(this: NodePath): boolean {\n const res = this.evaluate();\n if (res.confident) return !!res.value;\n}\n\ntype State = {\n confident: boolean;\n deoptPath: NodePath | null;\n seen: Map;\n};\n\ntype Result = {\n resolved: boolean;\n value?: any;\n};\n/**\n * Deopts the evaluation\n */\nfunction deopt(path: NodePath, state: State) {\n if (!state.confident) return;\n state.deoptPath = path;\n state.confident = false;\n}\n\nconst Globals = new Map([\n [\"undefined\", undefined],\n [\"Infinity\", Infinity],\n [\"NaN\", NaN],\n]);\n\n/**\n * We wrap the _evaluate method so we can track `seen` nodes, we push an item\n * to the map before we actually evaluate it so we can deopt on self recursive\n * nodes such as:\n *\n * var g = a ? 1 : 2,\n * a = g * this.foo\n */\nfunction evaluateCached(path: NodePath, state: State): any {\n const { node } = path;\n const { seen } = state;\n\n if (seen.has(node)) {\n const existing = seen.get(node);\n if (existing.resolved) {\n return existing.value;\n } else {\n deopt(path, state);\n return;\n }\n } else {\n const item: Result = { resolved: false };\n seen.set(node, item);\n\n const val = _evaluate(path, state);\n if (state.confident) {\n item.resolved = true;\n item.value = val;\n }\n return val;\n }\n}\n\nfunction _evaluate(path: NodePath, state: State): any {\n if (!state.confident) return;\n\n if (path.isSequenceExpression()) {\n const exprs = path.get(\"expressions\");\n return evaluateCached(exprs[exprs.length - 1], state);\n }\n\n if (\n path.isStringLiteral() ||\n path.isNumericLiteral() ||\n path.isBooleanLiteral()\n ) {\n return path.node.value;\n }\n\n if (path.isNullLiteral()) {\n return null;\n }\n\n if (path.isTemplateLiteral()) {\n return evaluateQuasis(path, path.node.quasis, state);\n }\n\n if (\n path.isTaggedTemplateExpression() &&\n path.get(\"tag\").isMemberExpression()\n ) {\n const object = path.get(\"tag.object\") as NodePath;\n const {\n // @ts-expect-error todo(flow->ts): possible bug, object is can be any expression and so name might be undefined\n node: { name },\n } = object;\n const property = path.get(\"tag.property\") as NodePath;\n\n if (\n object.isIdentifier() &&\n name === \"String\" &&\n // todo(flow->ts): was changed from getBinding(name, true)\n // should this be hasBinding(name, true) as the binding is never used later?\n !path.scope.getBinding(name) &&\n property.isIdentifier() &&\n property.node.name === \"raw\"\n ) {\n return evaluateQuasis(path, path.node.quasi.quasis, state, true);\n }\n }\n\n if (path.isConditionalExpression()) {\n const testResult = evaluateCached(path.get(\"test\"), state);\n if (!state.confident) return;\n if (testResult) {\n return evaluateCached(path.get(\"consequent\"), state);\n } else {\n return evaluateCached(path.get(\"alternate\"), state);\n }\n }\n\n if (path.isExpressionWrapper()) {\n // TypeCastExpression, ExpressionStatement etc\n return evaluateCached(path.get(\"expression\"), state);\n }\n\n // \"foo\".length, \"foo\"[0]\n if (\n path.isMemberExpression() &&\n !path.parentPath.isCallExpression({ callee: path.node })\n ) {\n const property = path.get(\"property\");\n const object = path.get(\"object\");\n\n if (object.isLiteral()) {\n // @ts-expect-error todo(flow->ts): instead of typeof - would it be better to check type of ast node?\n const value = object.node.value;\n const type = typeof value;\n\n let key = null;\n if (path.node.computed) {\n key = evaluateCached(property, state);\n if (!state.confident) return;\n } else if (property.isIdentifier()) {\n key = property.node.name;\n }\n if (\n (type === \"number\" || type === \"string\") &&\n key != null &&\n (typeof key === \"number\" || typeof key === \"string\")\n ) {\n return value[key];\n }\n }\n }\n\n if (path.isReferencedIdentifier()) {\n const binding = path.scope.getBinding(path.node.name);\n\n if (binding) {\n if (\n binding.constantViolations.length > 0 ||\n path.node.start < binding.path.node.end\n ) {\n deopt(binding.path, state);\n return;\n }\n if (binding.hasValue) {\n return binding.value;\n }\n }\n\n const name = path.node.name;\n if (Globals.has(name)) {\n if (!binding) {\n return Globals.get(name);\n }\n deopt(binding.path, state);\n return;\n }\n\n const resolved = path.resolve();\n if (resolved === path) {\n deopt(path, state);\n return;\n } else {\n return evaluateCached(resolved, state);\n }\n }\n\n if (path.isUnaryExpression({ prefix: true })) {\n if (path.node.operator === \"void\") {\n // we don't need to evaluate the argument to know what this will return\n return undefined;\n }\n\n const argument = path.get(\"argument\");\n if (\n path.node.operator === \"typeof\" &&\n (argument.isFunction() || argument.isClass())\n ) {\n return \"function\";\n }\n\n const arg = evaluateCached(argument, state);\n if (!state.confident) return;\n switch (path.node.operator) {\n case \"!\":\n return !arg;\n case \"+\":\n return +arg;\n case \"-\":\n return -arg;\n case \"~\":\n return ~arg;\n case \"typeof\":\n return typeof arg;\n }\n }\n\n if (path.isArrayExpression()) {\n const arr = [];\n const elems: Array = path.get(\"elements\");\n for (const elem of elems) {\n const elemValue = elem.evaluate();\n\n if (elemValue.confident) {\n arr.push(elemValue.value);\n } else {\n deopt(elemValue.deopt, state);\n return;\n }\n }\n return arr;\n }\n\n if (path.isObjectExpression()) {\n const obj = {};\n const props = path.get(\"properties\");\n for (const prop of props) {\n if (prop.isObjectMethod() || prop.isSpreadElement()) {\n deopt(prop, state);\n return;\n }\n const keyPath = (prop as NodePath).get(\"key\");\n let key;\n // @ts-expect-error todo(flow->ts): type refinement issues ObjectMethod and SpreadElement somehow not excluded\n if (prop.node.computed) {\n key = keyPath.evaluate();\n if (!key.confident) {\n deopt(key.deopt, state);\n return;\n }\n key = key.value;\n } else if (keyPath.isIdentifier()) {\n key = keyPath.node.name;\n } else {\n key = (\n keyPath.node as t.StringLiteral | t.NumericLiteral | t.BigIntLiteral\n ).value;\n }\n const valuePath = (prop as NodePath).get(\"value\");\n let value = valuePath.evaluate();\n if (!value.confident) {\n deopt(value.deopt, state);\n return;\n }\n value = value.value;\n // @ts-expect-error key is any type\n obj[key] = value;\n }\n return obj;\n }\n\n if (path.isLogicalExpression()) {\n // If we are confident that the left side of an && is false, or the left\n // side of an || is true, we can be confident about the entire expression\n const wasConfident = state.confident;\n const left = evaluateCached(path.get(\"left\"), state);\n const leftConfident = state.confident;\n state.confident = wasConfident;\n const right = evaluateCached(path.get(\"right\"), state);\n const rightConfident = state.confident;\n\n switch (path.node.operator) {\n case \"||\":\n // TODO consider having a \"truthy type\" that doesn't bail on\n // left uncertainty but can still evaluate to truthy.\n state.confident = leftConfident && (!!left || rightConfident);\n if (!state.confident) return;\n\n return left || right;\n case \"&&\":\n state.confident = leftConfident && (!left || rightConfident);\n if (!state.confident) return;\n\n return left && right;\n case \"??\":\n state.confident = leftConfident && (left != null || rightConfident);\n if (!state.confident) return;\n\n return left ?? right;\n }\n }\n\n if (path.isBinaryExpression()) {\n const left = evaluateCached(path.get(\"left\"), state);\n if (!state.confident) return;\n const right = evaluateCached(path.get(\"right\"), state);\n if (!state.confident) return;\n\n switch (path.node.operator) {\n case \"-\":\n return left - right;\n case \"+\":\n return left + right;\n case \"/\":\n return left / right;\n case \"*\":\n return left * right;\n case \"%\":\n return left % right;\n case \"**\":\n return left ** right;\n case \"<\":\n return left < right;\n case \">\":\n return left > right;\n case \"<=\":\n return left <= right;\n case \">=\":\n return left >= right;\n case \"==\":\n return left == right; // eslint-disable-line eqeqeq\n case \"!=\":\n return left != right;\n case \"===\":\n return left === right;\n case \"!==\":\n return left !== right;\n case \"|\":\n return left | right;\n case \"&\":\n return left & right;\n case \"^\":\n return left ^ right;\n case \"<<\":\n return left << right;\n case \">>\":\n return left >> right;\n case \">>>\":\n return left >>> right;\n }\n }\n\n if (path.isCallExpression()) {\n const callee = path.get(\"callee\");\n let context;\n let func;\n\n // Number(1);\n if (\n callee.isIdentifier() &&\n !path.scope.getBinding(callee.node.name) &&\n (isValidObjectCallee(callee.node.name) ||\n isValidIdentifierCallee(callee.node.name))\n ) {\n func = global[callee.node.name];\n }\n\n if (callee.isMemberExpression()) {\n const object = callee.get(\"object\");\n const property = callee.get(\"property\");\n\n // Math.min(1, 2)\n if (\n object.isIdentifier() &&\n property.isIdentifier() &&\n isValidObjectCallee(object.node.name) &&\n !isInvalidMethod(property.node.name)\n ) {\n context = global[object.node.name];\n const key = property.node.name;\n // TODO(Babel 8): Use Object.hasOwn\n if (Object.hasOwnProperty.call(context, key)) {\n func = context[key as keyof typeof context];\n }\n }\n\n // \"abc\".charCodeAt(4)\n if (object.isLiteral() && property.isIdentifier()) {\n // @ts-expect-error todo(flow->ts): consider checking ast node type instead of value type (StringLiteral and NumberLiteral)\n const type = typeof object.node.value;\n if (type === \"string\" || type === \"number\") {\n // @ts-expect-error todo(flow->ts): consider checking ast node type instead of value type\n context = object.node.value;\n func = context[property.node.name];\n }\n }\n }\n\n if (func) {\n const args = path.get(\"arguments\").map(arg => evaluateCached(arg, state));\n if (!state.confident) return;\n\n return func.apply(context, args);\n }\n }\n\n deopt(path, state);\n}\n\nfunction evaluateQuasis(\n path: NodePath,\n quasis: Array,\n state: State,\n raw = false,\n) {\n let str = \"\";\n\n let i = 0;\n const exprs: Array> = path.isTemplateLiteral()\n ? path.get(\"expressions\")\n : path.get(\"quasi.expressions\");\n\n for (const elem of quasis) {\n // not confident, evaluated an expression we don't like\n if (!state.confident) break;\n\n // add on element\n str += raw ? elem.value.raw : elem.value.cooked;\n\n // add on interpolated expression if it's present\n const expr = exprs[i++];\n if (expr) str += String(evaluateCached(expr, state));\n }\n\n if (!state.confident) return;\n return str;\n}\n\n/**\n * Walk the input `node` and statically evaluate it.\n *\n * Returns an object in the form `{ confident, value, deopt }`. `confident`\n * indicates whether or not we had to drop out of evaluating the expression\n * because of hitting an unknown node that we couldn't confidently find the\n * value of, in which case `deopt` is the path of said node.\n *\n * Example:\n *\n * t.evaluate(parse(\"5 + 5\")) // { confident: true, value: 10 }\n * t.evaluate(parse(\"!true\")) // { confident: true, value: false }\n * t.evaluate(parse(\"foo + foo\")) // { confident: false, value: undefined, deopt: NodePath }\n *\n */\n\nexport function evaluate(this: NodePath): {\n confident: boolean;\n value: any;\n deopt?: NodePath;\n} {\n const state: State = {\n confident: true,\n deoptPath: null,\n seen: new Map(),\n };\n let value = evaluateCached(this, state);\n if (!state.confident) value = undefined;\n\n return {\n confident: state.confident,\n deopt: state.deoptPath,\n value: value,\n };\n}\n"],"mappings":";;;;;;;AAKA,MAAMA,oBAAoB,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAU;AA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AAK,CAAC;EACvC,IAAI,CAACA,KAAK,CAACJ,SAAS,EAAEC,KAAK,GAAGO,SAAS;EAEvC,OAAO;IACLR,SAAS,EAAEI,KAAK,CAACJ,SAAS;IAC1BE,KAAK,EAAEE,KAAK,CAACC,SAAS;IACtBJ,KAAK,EAAEA;EACT,CAAC;AACH"} \ No newline at end of file diff --git a/node_modules/@babel/traverse/package.json b/node_modules/@babel/traverse/package.json index debdbf79..a80ac80f 100644 --- a/node_modules/@babel/traverse/package.json +++ b/node_modules/@babel/traverse/package.json @@ -1,6 +1,6 @@ { "name": "@babel/traverse", - "version": "7.23.0", + "version": "7.23.2", "description": "The Babel Traverse module maintains the overall tree state, and is responsible for replacing, removing, and adding nodes", "author": "The Babel Team (https://babel.dev/team)", "homepage": "https://babel.dev/docs/en/next/babel-traverse", diff --git a/node_modules/@github/markdownlint-github/.github/workflows/accessibility-alt-text-bot.yml b/node_modules/@github/markdownlint-github/.github/workflows/accessibility-alt-text-bot.yml index 192edb8d..0eac9ebb 100644 --- a/node_modules/@github/markdownlint-github/.github/workflows/accessibility-alt-text-bot.yml +++ b/node_modules/@github/markdownlint-github/.github/workflows/accessibility-alt-text-bot.yml @@ -23,4 +23,4 @@ jobs: if: ${{ github.event.issue || github.event.pull_request || github.event.discussion }} steps: - name: Get action 'github/accessibility-alt-text-bot' - uses: github/accessibility-alt-text-bot@v1.3.0 + uses: github/accessibility-alt-text-bot@v1.4.0 diff --git a/node_modules/@github/markdownlint-github/.github/workflows/ci.yml b/node_modules/@github/markdownlint-github/.github/workflows/ci.yml index 6bc40597..dadcb6d5 100644 --- a/node_modules/@github/markdownlint-github/.github/workflows/ci.yml +++ b/node_modules/@github/markdownlint-github/.github/workflows/ci.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: 19 - run: npm install diff --git a/node_modules/@github/markdownlint-github/.github/workflows/publish.yml b/node_modules/@github/markdownlint-github/.github/workflows/publish.yml index d8212016..5c1c6eb3 100644 --- a/node_modules/@github/markdownlint-github/.github/workflows/publish.yml +++ b/node_modules/@github/markdownlint-github/.github/workflows/publish.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 with: node-version: 16 registry-url: https://registry.npmjs.org/ diff --git a/node_modules/@github/markdownlint-github/README.md b/node_modules/@github/markdownlint-github/README.md index 3bc08be3..e9cc582e 100644 --- a/node_modules/@github/markdownlint-github/README.md +++ b/node_modules/@github/markdownlint-github/README.md @@ -14,7 +14,7 @@ The following are custom rules defined in this plugin. * [**GH001** _no-default-alt-text_](./docs/rules/GH001-no-default-alt-text.md) * [**GH002** _no-generic-link-text_](./docs/rules/GH002-no-generic-link-text.md) -* [**GH002** _no-empty-alt-text_](./docs/rules/GH002-no-empty-alt-text.md) +* [**GH003** _no-empty-alt-text_](./docs/rules/GH003-no-empty-alt-text.md) See [`markdownlint` rules](https://github.com/DavidAnson/markdownlint#rules--aliases) for documentation on rules pulled in from `markdownlint`. diff --git a/node_modules/@github/markdownlint-github/package.json b/node_modules/@github/markdownlint-github/package.json index 72ebc406..b2b49016 100644 --- a/node_modules/@github/markdownlint-github/package.json +++ b/node_modules/@github/markdownlint-github/package.json @@ -1,6 +1,6 @@ { "name": "@github/markdownlint-github", - "version": "0.6.0", + "version": "0.6.2", "description": "An opinionated collection of markdownlint rules used by GitHub.", "main": "index.js", "directories": { @@ -19,8 +19,8 @@ "eslint": "^8.22.0", "eslint-plugin-github": "^4.3.7", "jest": "^29.5.0", - "markdownlint": "^0.31.0", - "markdownlint-cli2": "^0.10.0" + "markdownlint": "^0.33.0", + "markdownlint-cli2": "^0.12.1" }, "repository": { "type": "git", diff --git a/node_modules/@github/markdownlint-github/src/rules/no-default-alt-text.js b/node_modules/@github/markdownlint-github/src/rules/no-default-alt-text.js index 32545612..e91a9ef2 100644 --- a/node_modules/@github/markdownlint-github/src/rules/no-default-alt-text.js +++ b/node_modules/@github/markdownlint-github/src/rules/no-default-alt-text.js @@ -3,9 +3,10 @@ * * "Screen Shot 2020-10-20 at 2 52 27 PM" * * "Screenshot 2020-10-20 at 2 52 27 PM" * * "Clean Shot 2020-10-20 @45x" + * * "Screencast from 23 02 2024 19 15 19]" */ const defaultScreenshotRegex = - "(?:screen|clean) ?shot \\d{4}-\\d{2}-\\d{2}[^'\"\\]]*"; + "(?:screen|clean) ?(?:shot|cast) \\d{4}-\\d{2}-\\d{2}[^'\"\\]]*"; const imageRegex = "image"; const combinedRegex = `(${[defaultScreenshotRegex, imageRegex].join("|")})`; diff --git a/node_modules/@github/markdownlint-github/src/rules/no-empty-alt-text.js b/node_modules/@github/markdownlint-github/src/rules/no-empty-alt-text.js index 0ade74b3..85ad2e7d 100644 --- a/node_modules/@github/markdownlint-github/src/rules/no-empty-alt-text.js +++ b/node_modules/@github/markdownlint-github/src/rules/no-empty-alt-text.js @@ -1,4 +1,3 @@ -// TODO: Clean up when https://github.com/DavidAnson/markdownlint/pull/993 is merged module.exports = { names: ["GH003", "no-empty-alt-text"], description: "Please provide an alternative text for the image.", @@ -19,7 +18,6 @@ module.exports = { ); const ImageRegex = new RegExp(//, "gid"); - const htmlAltRegex = new RegExp(/alt=['"]/, "gid"); const htmlEmptyAltRegex = new RegExp(/alt=['"]['"]/, "gid"); for (const token of htmlTagsWithImages) { const lineRange = token.map; @@ -35,8 +33,6 @@ module.exports = { const emptyAltMatches = [ ...imageTag[0].matchAll(htmlEmptyAltRegex), ][0]; - const noAltMatches = [...imageTag[0].matchAll(htmlAltRegex)]; - if (emptyAltMatches) { const matchingContent = emptyAltMatches[0]; const startIndex = emptyAltMatches.indices[0][0]; @@ -44,11 +40,6 @@ module.exports = { lineNumber: lineNumber + i, range: [imageTagIndex + startIndex + 1, matchingContent.length], }); - } else if (noAltMatches.length === 0) { - onError({ - lineNumber: lineNumber + i, - range: [imageTagIndex + 1, imageTag[0].length], - }); } } } diff --git a/node_modules/@github/markdownlint-github/test/no-default-alt-text.test.js b/node_modules/@github/markdownlint-github/test/no-default-alt-text.test.js index 314a7816..04fc9fd1 100644 --- a/node_modules/@github/markdownlint-github/test/no-default-alt-text.test.js +++ b/node_modules/@github/markdownlint-github/test/no-default-alt-text.test.js @@ -26,6 +26,7 @@ describe("GH001: No Default Alt Text", () => { test("markdown example", async () => { const strings = [ "![Screen Shot 2022-06-26 at 7 41 30 PM](https://user-images.githubusercontent.com/abcdef.png)", + "![Screencast from 23 02 2024 19 15 19](https://user-images.githubusercontent.com/abcdef.png)", "![ScreenShot 2022-06-26 at 7 41 30 PM](https://user-images.githubusercontent.com/abcdef.png)", "![Screen shot 2022-06-26 at 7 41 30 PM](https://user-images.githubusercontent.com/abcdef.png)", "![Screenshot 2022-06-26 at 7 41 30 PM](https://user-images.githubusercontent.com/abcdef.png)", @@ -50,6 +51,7 @@ describe("GH001: No Default Alt Text", () => { test("HTML example", async () => { const strings = [ 'Screen Shot 2022-06-26 at 7 41 30 PM', + ' Screencast from 23 02 2024 19 15 19', 'ScreenShot 2022-06-26 at 7 41 30 PM', 'Screen shot 2022-06-26 at 7 41 30 PM', 'Screenshot 2022-06-26 at 7 41 30 PM', diff --git a/node_modules/@github/markdownlint-github/test/no-empty-alt-text.test.js b/node_modules/@github/markdownlint-github/test/no-empty-alt-text.test.js index 1479bf77..180594a1 100644 --- a/node_modules/@github/markdownlint-github/test/no-empty-alt-text.test.js +++ b/node_modules/@github/markdownlint-github/test/no-empty-alt-text.test.js @@ -19,19 +19,15 @@ describe("GH003: No Empty Alt Text", () => { '', "", ' ', - '', - '', - "", ]; const results = await runTest(strings, noEmptyStringAltRule); - const failedRules = results .map((result) => result.ruleNames) .flat() .filter((name) => !name.includes("GH")); - expect(failedRules).toHaveLength(8); + expect(failedRules).toHaveLength(4); for (const rule of failedRules) { expect(rule).toBe("no-empty-alt-text"); } diff --git a/package-lock.json b/package-lock.json index 4e12a80b..bb07f9ad 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.0", "license": "ISC", "dependencies": { - "@github/markdownlint-github": "^0.6.0", + "@github/markdownlint-github": "^0.6.2", "markdownlint": "^0.31.1" }, "devDependencies": { @@ -647,9 +647,9 @@ "dev": true }, "node_modules/@github/markdownlint-github": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/@github/markdownlint-github/-/markdownlint-github-0.6.0.tgz", - "integrity": "sha512-THR2p9AExA1lxLoBIJnmFg8VGOCMDNcQDxA6O/JvSyL4ODqGrqozbMsH4xCE19+7Li+NeqwqJEdmmVas5LjT1A==", + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/@github/markdownlint-github/-/markdownlint-github-0.6.2.tgz", + "integrity": "sha512-cd+eRhqqIAXICHu5RQ9de70AZEI14opO9TqTz8HjkjQwWC1HRsdTwsRiK+6Fz2DqC1ZEd6t7+Dh5brOChLozcg==", "dependencies": { "lodash": "^4.17.15" } @@ -4586,9 +4586,9 @@ "dev": true }, "@github/markdownlint-github": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/@github/markdownlint-github/-/markdownlint-github-0.6.0.tgz", - "integrity": "sha512-THR2p9AExA1lxLoBIJnmFg8VGOCMDNcQDxA6O/JvSyL4ODqGrqozbMsH4xCE19+7Li+NeqwqJEdmmVas5LjT1A==", + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/@github/markdownlint-github/-/markdownlint-github-0.6.2.tgz", + "integrity": "sha512-cd+eRhqqIAXICHu5RQ9de70AZEI14opO9TqTz8HjkjQwWC1HRsdTwsRiK+6Fz2DqC1ZEd6t7+Dh5brOChLozcg==", "requires": { "lodash": "^4.17.15" } diff --git a/package.json b/package.json index 93e56906..a765aa79 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "jest": "^29.7.0" }, "dependencies": { - "@github/markdownlint-github": "^0.6.0", + "@github/markdownlint-github": "^0.6.2", "markdownlint": "^0.31.1" } -} +} diff --git a/src/index.test.js b/src/index.test.js index 4818601b..af26bf3d 100644 --- a/src/index.test.js +++ b/src/index.test.js @@ -32,6 +32,10 @@ test("no-default-alt-text: should return errors", async () => { expect(result[0]).toBe( "Images should have meaningful alternative text (alt text)" ); + result = await validate("![Screencast 2020-01-01 at 12.00.00.png]()"); + expect(result[0]).toBe( + "Images should have meaningful alternative text (alt text)" + ); result = await validate("![image]()"); expect(result[0]).toBe( "Images should have meaningful alternative text (alt text)" @@ -85,6 +89,10 @@ test("no-default-alt-text: should return errors", async () => { result = await validate( 'CleanShot 2020-01-01 @12x' ); + result = await validate('Screencast 2020-01-01 @12x'); + expect(result[0]).toBe( + "Images should have meaningful alternative text (alt text)" + ); expect(result[0]).toBe( "Images should have meaningful alternative text (alt text)" ); diff --git a/yarn.lock b/yarn.lock index 677313eb..8cd3fe75 100644 --- a/yarn.lock +++ b/yarn.lock @@ -23,7 +23,7 @@ resolved "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.22.20.tgz" integrity sha512-BQYjKbpXjoXwFW5jGqiizJQQT/aC7pFm9Ok1OWssonuguICi264lbgMzRp2ZMmRSlfkX6DsWDDcsrctK8Rwfiw== -"@babel/core@^7.11.6", "@babel/core@^7.12.3": +"@babel/core@^7.0.0", "@babel/core@^7.0.0-0", "@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.8.0": version "7.23.0" resolved "https://registry.npmjs.org/@babel/core/-/core-7.23.0.tgz" integrity sha512-97z/ju/Jy1rZmDxybphrBuI+jtJjFVoz7Mr9yUQVVVi+DNZE333uFQeMOqcCIy1x3WYBIbWftUSLmbNXNT7qFQ== @@ -276,7 +276,7 @@ "@babel/traverse@^7.23.0": version "7.23.2" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.23.2.tgz#329c7a06735e144a506bdb2cad0268b7f46f4ad8" + resolved "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.2.tgz" integrity sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw== dependencies: "@babel/code-frame" "^7.22.13" @@ -304,10 +304,10 @@ resolved "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@github/markdownlint-github@^0.6.0": - version "0.6.0" - resolved "https://registry.npmjs.org/@github/markdownlint-github/-/markdownlint-github-0.6.0.tgz" - integrity sha512-THR2p9AExA1lxLoBIJnmFg8VGOCMDNcQDxA6O/JvSyL4ODqGrqozbMsH4xCE19+7Li+NeqwqJEdmmVas5LjT1A== +"@github/markdownlint-github@^0.6.2": + version "0.6.2" + resolved "https://registry.npmjs.org/@github/markdownlint-github/-/markdownlint-github-0.6.2.tgz" + integrity sha512-cd+eRhqqIAXICHu5RQ9de70AZEI14opO9TqTz8HjkjQwWC1HRsdTwsRiK+6Fz2DqC1ZEd6t7+Dh5brOChLozcg== dependencies: lodash "^4.17.15" @@ -803,7 +803,7 @@ braces@^3.0.2: dependencies: fill-range "^7.0.1" -browserslist@^4.21.9: +browserslist@^4.21.9, "browserslist@>= 4.21.0": version "4.22.1" resolved "https://registry.npmjs.org/browserslist/-/browserslist-4.22.1.tgz" integrity sha512-FEVc202+2iuClEhZhrWy6ZiAcRLvNMyYcxZ8raemul1DYVOVdFsbqckWLdsixQZCpJlwe77Z3UTalE7jsjnKfQ== @@ -936,16 +936,16 @@ color-convert@^2.0.1: dependencies: color-name "~1.1.4" -color-name@1.1.3: - version "1.1.3" - resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz" - integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== - color-name@~1.1.4: version "1.1.4" resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== +color-name@1.1.3: + version "1.1.3" + resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz" + integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== + concat-map@0.0.1: version "0.0.1" resolved "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz" @@ -1146,11 +1146,6 @@ fs.realpath@^1.0.0: resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== -fsevents@^2.3.2: - version "2.3.3" - resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" - integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== - gensync@^1.0.0-beta.2: version "1.0.0-beta.2" resolved "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz" @@ -1564,7 +1559,7 @@ jest-resolve-dependencies@^29.7.0: jest-regex-util "^29.6.3" jest-snapshot "^29.7.0" -jest-resolve@^29.7.0: +jest-resolve@*, jest-resolve@^29.7.0: version "29.7.0" resolved "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.7.0.tgz" integrity sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA== @@ -2120,7 +2115,14 @@ semver@^6.3.0, semver@^6.3.1: resolved "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== -semver@^7.5.3, semver@^7.5.4: +semver@^7.5.3: + version "7.5.4" + resolved "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz" + integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA== + dependencies: + lru-cache "^6.0.0" + +semver@^7.5.4: version "7.5.4" resolved "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz" integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==