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

View File

@@ -0,0 +1,113 @@
// Generated by LiveScript 1.6.0
(function(){
var reject, special, tokenRegex;
reject = require('prelude-ls').reject;
function consumeOp(tokens, op){
if (tokens[0] === op) {
return tokens.shift();
} else {
throw new Error("Expected '" + op + "', but got '" + tokens[0] + "' instead in " + JSON.stringify(tokens) + ".");
}
}
function maybeConsumeOp(tokens, op){
if (tokens[0] === op) {
return tokens.shift();
}
}
function consumeList(tokens, arg$, hasDelimiters){
var open, close, result, untilTest;
open = arg$[0], close = arg$[1];
if (hasDelimiters) {
consumeOp(tokens, open);
}
result = [];
untilTest = "," + (hasDelimiters ? close : '');
while (tokens.length && (hasDelimiters && tokens[0] !== close)) {
result.push(consumeElement(tokens, untilTest));
maybeConsumeOp(tokens, ',');
}
if (hasDelimiters) {
consumeOp(tokens, close);
}
return result;
}
function consumeArray(tokens, hasDelimiters){
return consumeList(tokens, ['[', ']'], hasDelimiters);
}
function consumeTuple(tokens, hasDelimiters){
return consumeList(tokens, ['(', ')'], hasDelimiters);
}
function consumeFields(tokens, hasDelimiters){
var result, untilTest, key;
if (hasDelimiters) {
consumeOp(tokens, '{');
}
result = {};
untilTest = "," + (hasDelimiters ? '}' : '');
while (tokens.length && (!hasDelimiters || tokens[0] !== '}')) {
key = consumeValue(tokens, ':');
consumeOp(tokens, ':');
result[key] = consumeElement(tokens, untilTest);
maybeConsumeOp(tokens, ',');
}
if (hasDelimiters) {
consumeOp(tokens, '}');
}
return result;
}
function consumeValue(tokens, untilTest){
var out;
untilTest == null && (untilTest = '');
out = '';
while (tokens.length && -1 === untilTest.indexOf(tokens[0])) {
out += tokens.shift();
}
return out;
}
function consumeElement(tokens, untilTest){
switch (tokens[0]) {
case '[':
return consumeArray(tokens, true);
case '(':
return consumeTuple(tokens, true);
case '{':
return consumeFields(tokens, true);
default:
return consumeValue(tokens, untilTest);
}
}
function consumeTopLevel(tokens, types, options){
var ref$, type, structure, origTokens, result, finalResult, x$, y$;
ref$ = types[0], type = ref$.type, structure = ref$.structure;
origTokens = tokens.concat();
if (!options.explicit && types.length === 1 && ((!type && structure) || (type === 'Array' || type === 'Object'))) {
result = structure === 'array' || type === 'Array'
? consumeArray(tokens, tokens[0] === '[')
: structure === 'tuple'
? consumeTuple(tokens, tokens[0] === '(')
: consumeFields(tokens, tokens[0] === '{');
finalResult = tokens.length ? consumeElement(structure === 'array' || type === 'Array'
? (x$ = origTokens, x$.unshift('['), x$.push(']'), x$)
: (y$ = origTokens, y$.unshift('('), y$.push(')'), y$)) : result;
} else {
finalResult = consumeElement(tokens);
}
return finalResult;
}
special = /\[\]\(\)}{:,/.source;
tokenRegex = RegExp('("(?:\\\\"|[^"])*")|(\'(?:\\\\\'|[^\'])*\')|(/(?:\\\\/|[^/])*/[a-zA-Z]*)|(#.*#)|([' + special + '])|([^\\s' + special + '](?:\\s*[^\\s' + special + ']+)*)|\\s*');
module.exports = function(types, string, options){
var tokens, node;
options == null && (options = {});
if (!options.explicit && types.length === 1 && types[0].type === 'String') {
return string;
}
tokens = reject(not$, string.split(tokenRegex));
node = consumeTopLevel(tokens, types, options);
if (!node) {
throw new Error("Error parsing '" + string + "'.");
}
return node;
};
function not$(x){ return !x; }
}).call(this);

View File

@@ -0,0 +1,3 @@
export function byteLength(b64: string): number;
export function toByteArray(b64: string): Uint8Array;
export function fromByteArray(uint8: Uint8Array): string;

View File

@@ -0,0 +1,69 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = createTemplateBuilder;
var _options = require("./options.js");
var _string = require("./string.js");
var _literal = require("./literal.js");
const NO_PLACEHOLDER = (0, _options.validate)({
placeholderPattern: false
});
function createTemplateBuilder(formatter, defaultOpts) {
const templateFnCache = new WeakMap();
const templateAstCache = new WeakMap();
const cachedOpts = defaultOpts || (0, _options.validate)(null);
return Object.assign((tpl, ...args) => {
if (typeof tpl === "string") {
if (args.length > 1) throw new Error("Unexpected extra params.");
return extendedTrace((0, _string.default)(formatter, tpl, (0, _options.merge)(cachedOpts, (0, _options.validate)(args[0]))));
} else if (Array.isArray(tpl)) {
let builder = templateFnCache.get(tpl);
if (!builder) {
builder = (0, _literal.default)(formatter, tpl, cachedOpts);
templateFnCache.set(tpl, builder);
}
return extendedTrace(builder(args));
} else if (typeof tpl === "object" && tpl) {
if (args.length > 0) throw new Error("Unexpected extra params.");
return createTemplateBuilder(formatter, (0, _options.merge)(cachedOpts, (0, _options.validate)(tpl)));
}
throw new Error(`Unexpected template param ${typeof tpl}`);
}, {
ast: (tpl, ...args) => {
if (typeof tpl === "string") {
if (args.length > 1) throw new Error("Unexpected extra params.");
return (0, _string.default)(formatter, tpl, (0, _options.merge)((0, _options.merge)(cachedOpts, (0, _options.validate)(args[0])), NO_PLACEHOLDER))();
} else if (Array.isArray(tpl)) {
let builder = templateAstCache.get(tpl);
if (!builder) {
builder = (0, _literal.default)(formatter, tpl, (0, _options.merge)(cachedOpts, NO_PLACEHOLDER));
templateAstCache.set(tpl, builder);
}
return builder(args)();
}
throw new Error(`Unexpected template param ${typeof tpl}`);
}
});
}
function extendedTrace(fn) {
let rootStack = "";
try {
throw new Error();
} catch (error) {
if (error.stack) {
rootStack = error.stack.split("\n").slice(3).join("\n");
}
}
return arg => {
try {
return fn(arg);
} catch (err) {
err.stack += `\n =============\n${rootStack}`;
throw err;
}
};
}
//# sourceMappingURL=builder.js.map

View File

@@ -0,0 +1,71 @@
{
"name": "source-map-js",
"description": "Generates and consumes source maps",
"version": "1.2.1",
"homepage": "https://github.com/7rulnik/source-map-js",
"author": "Valentin 7rulnik Semirulnik <v7rulnik@gmail.com>",
"contributors": [
"Nick Fitzgerald <nfitzgerald@mozilla.com>",
"Tobias Koppers <tobias.koppers@googlemail.com>",
"Duncan Beevers <duncan@dweebd.com>",
"Stephen Crane <scrane@mozilla.com>",
"Ryan Seddon <seddon.ryan@gmail.com>",
"Miles Elam <miles.elam@deem.com>",
"Mihai Bazon <mihai.bazon@gmail.com>",
"Michael Ficarra <github.public.email@michael.ficarra.me>",
"Todd Wolfson <todd@twolfson.com>",
"Alexander Solovyov <alexander@solovyov.net>",
"Felix Gnass <fgnass@gmail.com>",
"Conrad Irwin <conrad.irwin@gmail.com>",
"usrbincc <usrbincc@yahoo.com>",
"David Glasser <glasser@davidglasser.net>",
"Chase Douglas <chase@newrelic.com>",
"Evan Wallace <evan.exe@gmail.com>",
"Heather Arthur <fayearthur@gmail.com>",
"Hugh Kennedy <hughskennedy@gmail.com>",
"David Glasser <glasser@davidglasser.net>",
"Simon Lydell <simon.lydell@gmail.com>",
"Jmeas Smith <jellyes2@gmail.com>",
"Michael Z Goddard <mzgoddard@gmail.com>",
"azu <azu@users.noreply.github.com>",
"John Gozde <john@gozde.ca>",
"Adam Kirkton <akirkton@truefitinnovation.com>",
"Chris Montgomery <christopher.montgomery@dowjones.com>",
"J. Ryan Stinnett <jryans@gmail.com>",
"Jack Herrington <jherrington@walmartlabs.com>",
"Chris Truter <jeffpalentine@gmail.com>",
"Daniel Espeset <daniel@danielespeset.com>",
"Jamie Wong <jamie.lf.wong@gmail.com>",
"Eddy Bruël <ejpbruel@mozilla.com>",
"Hawken Rives <hawkrives@gmail.com>",
"Gilad Peleg <giladp007@gmail.com>",
"djchie <djchie.dev@gmail.com>",
"Gary Ye <garysye@gmail.com>",
"Nicolas Lalevée <nicolas.lalevee@hibnet.org>"
],
"repository": "7rulnik/source-map-js",
"main": "./source-map.js",
"files": [
"source-map.js",
"source-map.d.ts",
"lib/"
],
"engines": {
"node": ">=0.10.0"
},
"license": "BSD-3-Clause",
"scripts": {
"test": "npm run build && node test/run-tests.js",
"build": "webpack --color",
"toc": "doctoc --title '## Table of Contents' README.md && doctoc --title '## Table of Contents' CONTRIBUTING.md"
},
"devDependencies": {
"clean-publish": "^3.1.0",
"doctoc": "^0.15.0",
"webpack": "^1.12.0"
},
"clean-publish": {
"cleanDocs": true
},
"typings": "source-map.d.ts"
}

View File

@@ -0,0 +1 @@
{"version":3,"names":["_toPropertyKey","require","_defineProperty","obj","key","value","toPropertyKey","Object","defineProperty","enumerable","configurable","writable"],"sources":["../../src/helpers/defineProperty.ts"],"sourcesContent":["/* @minVersion 7.0.0-beta.0 */\nimport toPropertyKey from \"./toPropertyKey.ts\";\n\nexport default function _defineProperty<T extends object>(\n obj: T,\n key: PropertyKey,\n value: any,\n) {\n key = toPropertyKey(key);\n // Shortcircuit the slow defineProperty path when possible.\n // We are trying to avoid issues where setters defined on the\n // prototype cause side effects under the fast path of simple\n // assignment. By checking for existence of the property with\n // the in operator, we can optimize most of this overhead away.\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true,\n });\n } else {\n // @ts-expect-error - Explicitly assigning to generic type key\n obj[key] = value;\n }\n return obj;\n}\n"],"mappings":";;;;;;AACA,IAAAA,cAAA,GAAAC,OAAA;AAEe,SAASC,eAAeA,CACrCC,GAAM,EACNC,GAAgB,EAChBC,KAAU,EACV;EACAD,GAAG,GAAG,IAAAE,sBAAa,EAACF,GAAG,CAAC;EAMxB,IAAIA,GAAG,IAAID,GAAG,EAAE;IACdI,MAAM,CAACC,cAAc,CAACL,GAAG,EAAEC,GAAG,EAAE;MAC9BC,KAAK,EAAEA,KAAK;MACZI,UAAU,EAAE,IAAI;MAChBC,YAAY,EAAE,IAAI;MAClBC,QAAQ,EAAE;IACZ,CAAC,CAAC;EACJ,CAAC,MAAM;IAELR,GAAG,CAACC,GAAG,CAAC,GAAGC,KAAK;EAClB;EACA,OAAOF,GAAG;AACZ","ignoreList":[]}

View File

@@ -0,0 +1,54 @@
{
"name": "glob-parent",
"version": "6.0.2",
"description": "Extract the non-magic parent path from a glob string.",
"author": "Gulp Team <team@gulpjs.com> (https://gulpjs.com/)",
"contributors": [
"Elan Shanker (https://github.com/es128)",
"Blaine Bublitz <blaine.bublitz@gmail.com>"
],
"repository": "gulpjs/glob-parent",
"license": "ISC",
"engines": {
"node": ">=10.13.0"
},
"main": "index.js",
"files": [
"LICENSE",
"index.js"
],
"scripts": {
"lint": "eslint .",
"pretest": "npm run lint",
"test": "nyc mocha --async-only"
},
"dependencies": {
"is-glob": "^4.0.3"
},
"devDependencies": {
"eslint": "^7.0.0",
"eslint-config-gulp": "^5.0.0",
"expect": "^26.0.1",
"mocha": "^7.1.2",
"nyc": "^15.0.1"
},
"nyc": {
"reporter": [
"lcov",
"text-summary"
]
},
"prettier": {
"singleQuote": true
},
"keywords": [
"glob",
"parent",
"strip",
"path",
"dirname",
"directory",
"base",
"wildcard"
]
}

View File

@@ -0,0 +1 @@
{"version":3,"names":["_helperPluginUtils","require","_core","TRACE_ID","FILE_NAME_VAR","createNodeFromNullish","val","fn","t","nullLiteral","_default","exports","default","declare","api","assertVersion","makeTrace","fileNameIdentifier","line","column","fileLineLiteral","numericLiteral","fileColumnLiteral","c","template","expression","ast","isSourceAttr","attr","isJSXAttribute","name","visitor","JSXOpeningElement","path","state","node","loc","attributes","some","fileNameId","scope","generateUidIdentifier","getProgramParent","push","id","init","stringLiteral","filename","jsxAttribute","jsxIdentifier","jsxExpressionContainer","cloneNode","start"],"sources":["../src/index.ts"],"sourcesContent":["/**\n * This adds {fileName, lineNumber, columnNumber} annotations to JSX tags.\n *\n * NOTE: lineNumber and columnNumber are both 1-based.\n *\n * == JSX Literals ==\n *\n * <sometag />\n *\n * becomes:\n *\n * var __jsxFileName = 'this/file.js';\n * <sometag __source={{fileName: __jsxFileName, lineNumber: 10, columnNumber: 1}}/>\n */\nimport { declare } from \"@babel/helper-plugin-utils\";\nimport { types as t, template } from \"@babel/core\";\n\nconst TRACE_ID = \"__source\";\nconst FILE_NAME_VAR = \"_jsxFileName\";\n\nconst createNodeFromNullish = <T, N extends t.Node>(\n val: T | null,\n fn: (val: T) => N,\n): N | t.NullLiteral => (val == null ? t.nullLiteral() : fn(val));\n\ntype State = {\n fileNameIdentifier: t.Identifier;\n};\nexport default declare<State>(api => {\n api.assertVersion(REQUIRED_VERSION(7));\n\n function makeTrace(\n fileNameIdentifier: t.Identifier,\n { line, column }: { line: number; column: number },\n ) {\n const fileLineLiteral = createNodeFromNullish(line, t.numericLiteral);\n const fileColumnLiteral = createNodeFromNullish(column, c =>\n // c + 1 to make it 1-based instead of 0-based.\n t.numericLiteral(c + 1),\n );\n\n return template.expression.ast`{\n fileName: ${fileNameIdentifier},\n lineNumber: ${fileLineLiteral},\n columnNumber: ${fileColumnLiteral},\n }`;\n }\n\n const isSourceAttr = (attr: t.Node) =>\n t.isJSXAttribute(attr) && attr.name.name === TRACE_ID;\n\n return {\n name: \"transform-react-jsx-source\",\n visitor: {\n JSXOpeningElement(path, state) {\n const { node } = path;\n if (\n // the element was generated and doesn't have location information\n !node.loc ||\n // Already has __source\n path.node.attributes.some(isSourceAttr)\n ) {\n return;\n }\n\n if (!state.fileNameIdentifier) {\n const fileNameId = path.scope.generateUidIdentifier(FILE_NAME_VAR);\n state.fileNameIdentifier = fileNameId;\n\n path.scope.getProgramParent().push({\n id: fileNameId,\n init: t.stringLiteral(state.filename || \"\"),\n });\n }\n\n node.attributes.push(\n t.jsxAttribute(\n t.jsxIdentifier(TRACE_ID),\n t.jsxExpressionContainer(\n makeTrace(t.cloneNode(state.fileNameIdentifier), node.loc.start),\n ),\n ),\n );\n },\n },\n };\n});\n"],"mappings":";;;;;;AAcA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAEA,MAAME,QAAQ,GAAG,UAAU;AAC3B,MAAMC,aAAa,GAAG,cAAc;AAEpC,MAAMC,qBAAqB,GAAGA,CAC5BC,GAAa,EACbC,EAAiB,KACMD,GAAG,IAAI,IAAI,GAAGE,WAAC,CAACC,WAAW,CAAC,CAAC,GAAGF,EAAE,CAACD,GAAG,CAAE;AAAC,IAAAI,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAKnD,IAAAC,0BAAO,EAAQC,GAAG,IAAI;EACnCA,GAAG,CAACC,aAAa,CAAkB,CAAE,CAAC;EAEtC,SAASC,SAASA,CAChBC,kBAAgC,EAChC;IAAEC,IAAI;IAAEC;EAAyC,CAAC,EAClD;IACA,MAAMC,eAAe,GAAGf,qBAAqB,CAACa,IAAI,EAAEV,WAAC,CAACa,cAAc,CAAC;IACrE,MAAMC,iBAAiB,GAAGjB,qBAAqB,CAACc,MAAM,EAAEI,CAAC,IAEvDf,WAAC,CAACa,cAAc,CAACE,CAAC,GAAG,CAAC,CACxB,CAAC;IAED,OAAOC,cAAQ,CAACC,UAAU,CAACC,GAAG;AAClC,kBAAkBT,kBAAkB;AACpC,oBAAoBG,eAAe;AACnC,sBAAsBE,iBAAiB;AACvC,MAAM;EACJ;EAEA,MAAMK,YAAY,GAAIC,IAAY,IAChCpB,WAAC,CAACqB,cAAc,CAACD,IAAI,CAAC,IAAIA,IAAI,CAACE,IAAI,CAACA,IAAI,KAAK3B,QAAQ;EAEvD,OAAO;IACL2B,IAAI,EAAE,4BAA4B;IAClCC,OAAO,EAAE;MACPC,iBAAiBA,CAACC,IAAI,EAAEC,KAAK,EAAE;QAC7B,MAAM;UAAEC;QAAK,CAAC,GAAGF,IAAI;QACrB,IAEE,CAACE,IAAI,CAACC,GAAG,IAETH,IAAI,CAACE,IAAI,CAACE,UAAU,CAACC,IAAI,CAACX,YAAY,CAAC,EACvC;UACA;QACF;QAEA,IAAI,CAACO,KAAK,CAACjB,kBAAkB,EAAE;UAC7B,MAAMsB,UAAU,GAAGN,IAAI,CAACO,KAAK,CAACC,qBAAqB,CAACrC,aAAa,CAAC;UAClE8B,KAAK,CAACjB,kBAAkB,GAAGsB,UAAU;UAErCN,IAAI,CAACO,KAAK,CAACE,gBAAgB,CAAC,CAAC,CAACC,IAAI,CAAC;YACjCC,EAAE,EAAEL,UAAU;YACdM,IAAI,EAAErC,WAAC,CAACsC,aAAa,CAACZ,KAAK,CAACa,QAAQ,IAAI,EAAE;UAC5C,CAAC,CAAC;QACJ;QAEAZ,IAAI,CAACE,UAAU,CAACM,IAAI,CAClBnC,WAAC,CAACwC,YAAY,CACZxC,WAAC,CAACyC,aAAa,CAAC9C,QAAQ,CAAC,EACzBK,WAAC,CAAC0C,sBAAsB,CACtBlC,SAAS,CAACR,WAAC,CAAC2C,SAAS,CAACjB,KAAK,CAACjB,kBAAkB,CAAC,EAAEkB,IAAI,CAACC,GAAG,CAACgB,KAAK,CACjE,CACF,CACF,CAAC;MACH;IACF;EACF,CAAC;AACH,CAAC,CAAC","ignoreList":[]}

View File

@@ -0,0 +1,57 @@
/**
* @fileoverview Reports useless `catch` clauses that just rethrow their error.
* @author Teddy Katz
*/
"use strict";
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../shared/types').Rule} */
module.exports = {
meta: {
type: "suggestion",
docs: {
description: "Disallow unnecessary `catch` clauses",
recommended: true,
url: "https://eslint.org/docs/latest/rules/no-useless-catch",
},
schema: [],
messages: {
unnecessaryCatchClause: "Unnecessary catch clause.",
unnecessaryCatch: "Unnecessary try/catch wrapper.",
},
},
create(context) {
return {
CatchClause(node) {
if (
node.param &&
node.param.type === "Identifier" &&
node.body.body.length &&
node.body.body[0].type === "ThrowStatement" &&
node.body.body[0].argument.type === "Identifier" &&
node.body.body[0].argument.name === node.param.name
) {
if (node.parent.finalizer) {
context.report({
node,
messageId: "unnecessaryCatchClause",
});
} else {
context.report({
node: node.parent,
messageId: "unnecessaryCatch",
});
}
}
},
};
},
};

View File

@@ -0,0 +1,368 @@
/**
* @fileoverview Rule to flag on declaring variables already declared in the outer scope
* @author Ilya Volodin
*/
"use strict";
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
const astUtils = require("./utils/ast-utils");
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
const FUNC_EXPR_NODE_TYPES = new Set([
"ArrowFunctionExpression",
"FunctionExpression",
]);
const CALL_EXPR_NODE_TYPE = new Set(["CallExpression"]);
const FOR_IN_OF_TYPE = /^For(?:In|Of)Statement$/u;
const SENTINEL_TYPE =
/^(?:(?:Function|Class)(?:Declaration|Expression)|ArrowFunctionExpression|CatchClause|ImportDeclaration|ExportNamedDeclaration)$/u;
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
/** @type {import('../shared/types').Rule} */
module.exports = {
meta: {
type: "suggestion",
defaultOptions: [
{
allow: [],
builtinGlobals: false,
hoist: "functions",
ignoreOnInitialization: false,
},
],
docs: {
description:
"Disallow variable declarations from shadowing variables declared in the outer scope",
recommended: false,
url: "https://eslint.org/docs/latest/rules/no-shadow",
},
schema: [
{
type: "object",
properties: {
builtinGlobals: { type: "boolean" },
hoist: { enum: ["all", "functions", "never"] },
allow: {
type: "array",
items: {
type: "string",
},
},
ignoreOnInitialization: { type: "boolean" },
},
additionalProperties: false,
},
],
messages: {
noShadow:
"'{{name}}' is already declared in the upper scope on line {{shadowedLine}} column {{shadowedColumn}}.",
noShadowGlobal: "'{{name}}' is already a global variable.",
},
},
create(context) {
const [{ builtinGlobals, hoist, allow, ignoreOnInitialization }] =
context.options;
const sourceCode = context.sourceCode;
/**
* Checks whether or not a given location is inside of the range of a given node.
* @param {ASTNode} node An node to check.
* @param {number} location A location to check.
* @returns {boolean} `true` if the location is inside of the range of the node.
*/
function isInRange(node, location) {
return (
node && node.range[0] <= location && location <= node.range[1]
);
}
/**
* Searches from the current node through its ancestry to find a matching node.
* @param {ASTNode} node a node to get.
* @param {(node: ASTNode) => boolean} match a callback that checks whether or not the node verifies its condition or not.
* @returns {ASTNode|null} the matching node.
*/
function findSelfOrAncestor(node, match) {
let currentNode = node;
while (currentNode && !match(currentNode)) {
currentNode = currentNode.parent;
}
return currentNode;
}
/**
* Finds function's outer scope.
* @param {Scope} scope Function's own scope.
* @returns {Scope} Function's outer scope.
*/
function getOuterScope(scope) {
const upper = scope.upper;
if (upper.type === "function-expression-name") {
return upper.upper;
}
return upper;
}
/**
* Checks if a variable and a shadowedVariable have the same init pattern ancestor.
* @param {Object} variable a variable to check.
* @param {Object} shadowedVariable a shadowedVariable to check.
* @returns {boolean} Whether or not the variable and the shadowedVariable have the same init pattern ancestor.
*/
function isInitPatternNode(variable, shadowedVariable) {
const outerDef = shadowedVariable.defs[0];
if (!outerDef) {
return false;
}
const { variableScope } = variable.scope;
if (
!(
FUNC_EXPR_NODE_TYPES.has(variableScope.block.type) &&
getOuterScope(variableScope) === shadowedVariable.scope
)
) {
return false;
}
const fun = variableScope.block;
const { parent } = fun;
const callExpression = findSelfOrAncestor(parent, node =>
CALL_EXPR_NODE_TYPE.has(node.type),
);
if (!callExpression) {
return false;
}
let node = outerDef.name;
const location = callExpression.range[1];
while (node) {
if (node.type === "VariableDeclarator") {
if (isInRange(node.init, location)) {
return true;
}
if (
FOR_IN_OF_TYPE.test(node.parent.parent.type) &&
isInRange(node.parent.parent.right, location)
) {
return true;
}
break;
} else if (node.type === "AssignmentPattern") {
if (isInRange(node.right, location)) {
return true;
}
} else if (SENTINEL_TYPE.test(node.type)) {
break;
}
node = node.parent;
}
return false;
}
/**
* Check if variable name is allowed.
* @param {ASTNode} variable The variable to check.
* @returns {boolean} Whether or not the variable name is allowed.
*/
function isAllowed(variable) {
return allow.includes(variable.name);
}
/**
* Checks if a variable of the class name in the class scope of ClassDeclaration.
*
* ClassDeclaration creates two variables of its name into its outer scope and its class scope.
* So we should ignore the variable in the class scope.
* @param {Object} variable The variable to check.
* @returns {boolean} Whether or not the variable of the class name in the class scope of ClassDeclaration.
*/
function isDuplicatedClassNameVariable(variable) {
const block = variable.scope.block;
return (
block.type === "ClassDeclaration" &&
block.id === variable.identifiers[0]
);
}
/**
* Checks if a variable is inside the initializer of scopeVar.
*
* To avoid reporting at declarations such as `var a = function a() {};`.
* But it should report `var a = function(a) {};` or `var a = function() { function a() {} };`.
* @param {Object} variable The variable to check.
* @param {Object} scopeVar The scope variable to look for.
* @returns {boolean} Whether or not the variable is inside initializer of scopeVar.
*/
function isOnInitializer(variable, scopeVar) {
const outerScope = scopeVar.scope;
const outerDef = scopeVar.defs[0];
const outer = outerDef && outerDef.parent && outerDef.parent.range;
const innerScope = variable.scope;
const innerDef = variable.defs[0];
const inner = innerDef && innerDef.name.range;
return (
outer &&
inner &&
outer[0] < inner[0] &&
inner[1] < outer[1] &&
((innerDef.type === "FunctionName" &&
innerDef.node.type === "FunctionExpression") ||
innerDef.node.type === "ClassExpression") &&
outerScope === innerScope.upper
);
}
/**
* Get a range of a variable's identifier node.
* @param {Object} variable The variable to get.
* @returns {Array|undefined} The range of the variable's identifier node.
*/
function getNameRange(variable) {
const def = variable.defs[0];
return def && def.name.range;
}
/**
* Get declared line and column of a variable.
* @param {eslint-scope.Variable} variable The variable to get.
* @returns {Object} The declared line and column of the variable.
*/
function getDeclaredLocation(variable) {
const identifier = variable.identifiers[0];
let obj;
if (identifier) {
obj = {
global: false,
line: identifier.loc.start.line,
column: identifier.loc.start.column + 1,
};
} else {
obj = {
global: true,
};
}
return obj;
}
/**
* Checks if a variable is in TDZ of scopeVar.
* @param {Object} variable The variable to check.
* @param {Object} scopeVar The variable of TDZ.
* @returns {boolean} Whether or not the variable is in TDZ of scopeVar.
*/
function isInTdz(variable, scopeVar) {
const outerDef = scopeVar.defs[0];
const inner = getNameRange(variable);
const outer = getNameRange(scopeVar);
return (
inner &&
outer &&
inner[1] < outer[0] &&
// Excepts FunctionDeclaration if is {"hoist":"function"}.
(hoist !== "functions" ||
!outerDef ||
outerDef.node.type !== "FunctionDeclaration")
);
}
/**
* Checks the current context for shadowed variables.
* @param {Scope} scope Fixme
* @returns {void}
*/
function checkForShadows(scope) {
const variables = scope.variables;
for (let i = 0; i < variables.length; ++i) {
const variable = variables[i];
// Skips "arguments" or variables of a class name in the class scope of ClassDeclaration.
if (
variable.identifiers.length === 0 ||
isDuplicatedClassNameVariable(variable) ||
isAllowed(variable)
) {
continue;
}
// Gets shadowed variable.
const shadowed = astUtils.getVariableByName(
scope.upper,
variable.name,
);
if (
shadowed &&
(shadowed.identifiers.length > 0 ||
(builtinGlobals && "writeable" in shadowed)) &&
!isOnInitializer(variable, shadowed) &&
!(
ignoreOnInitialization &&
isInitPatternNode(variable, shadowed)
) &&
!(hoist !== "all" && isInTdz(variable, shadowed))
) {
const location = getDeclaredLocation(shadowed);
const messageId = location.global
? "noShadowGlobal"
: "noShadow";
const data = { name: variable.name };
if (!location.global) {
data.shadowedLine = location.line;
data.shadowedColumn = location.column;
}
context.report({
node: variable.identifiers[0],
messageId,
data,
});
}
}
}
return {
"Program:exit"(node) {
const globalScope = sourceCode.getScope(node);
const stack = globalScope.childScopes.slice();
while (stack.length) {
const scope = stack.pop();
stack.push(...scope.childScopes);
checkForShadows(scope);
}
},
};
},
};

View File

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

View File

@@ -0,0 +1,166 @@
# Changes
## 2.0.2
* Rename bin to `node-which`
## 2.0.1
* generate changelog and publish on version bump
* enforce 100% test coverage
* Promise interface
## 2.0.0
* Parallel tests, modern JavaScript, and drop support for node < 8
## 1.3.1
* update deps
* update travis
## v1.3.0
* Add nothrow option to which.sync
* update tap
## v1.2.14
* appveyor: drop node 5 and 0.x
* travis-ci: add node 6, drop 0.x
## v1.2.13
* test: Pass missing option to pass on windows
* update tap
* update isexe to 2.0.0
* neveragain.tech pledge request
## v1.2.12
* Removed unused require
## v1.2.11
* Prevent changelog script from being included in package
## v1.2.10
* Use env.PATH only, not env.Path
## v1.2.9
* fix for paths starting with ../
* Remove unused `is-absolute` module
## v1.2.8
* bullet items in changelog that contain (but don't start with) #
## v1.2.7
* strip 'update changelog' changelog entries out of changelog
## v1.2.6
* make the changelog bulleted
## v1.2.5
* make a changelog, and keep it up to date
* don't include tests in package
* Properly handle relative-path executables
* appveyor
* Attach error code to Not Found error
* Make tests pass on Windows
## v1.2.4
* Fix typo
## v1.2.3
* update isexe, fix regression in pathExt handling
## v1.2.2
* update deps, use isexe module, test windows
## v1.2.1
* Sometimes windows PATH entries are quoted
* Fixed a bug in the check for group and user mode bits. This bug was introduced during refactoring for supporting strict mode.
* doc cli
## v1.2.0
* Add support for opt.all and -as cli flags
* test the bin
* update travis
* Allow checking for multiple programs in bin/which
* tap 2
## v1.1.2
* travis
* Refactored and fixed undefined error on Windows
* Support strict mode
## v1.1.1
* test +g exes against secondary groups, if available
* Use windows exe semantics on cygwin & msys
* cwd should be first in path on win32, not last
* Handle lower-case 'env.Path' on Windows
* Update docs
* use single-quotes
## v1.1.0
* Add tests, depend on is-absolute
## v1.0.9
* which.js: root is allowed to execute files owned by anyone
## v1.0.8
* don't use graceful-fs
## v1.0.7
* add license to package.json
## v1.0.6
* isc license
## 1.0.5
* Awful typo
## 1.0.4
* Test for path absoluteness properly
* win: Allow '' as a pathext if cmd has a . in it
## 1.0.3
* Remove references to execPath
* Make `which.sync()` work on Windows by honoring the PATHEXT variable.
* Make `isExe()` always return true on Windows.
* MIT
## 1.0.2
* Only files can be exes
## 1.0.1
* Respect the PATHEXT env for win32 support
* should 0755 the bin
* binary
* guts
* package
* 1st

View File

@@ -0,0 +1 @@
{"version":3,"names":[],"sources":["../../src/config/cache-contexts.ts"],"sourcesContent":["import type { Targets } from \"@babel/helper-compilation-targets\";\n\nimport type { ConfigContext } from \"./config-chain.ts\";\nimport type { CallerMetadata } from \"./validation/options.ts\";\n\nexport type { ConfigContext as FullConfig };\n\nexport type FullPreset = {\n targets: Targets;\n} & ConfigContext;\nexport type FullPlugin = {\n assumptions: { [name: string]: boolean };\n} & FullPreset;\n\n// Context not including filename since it is used in places that cannot\n// process 'ignore'/'only' and other filename-based logic.\nexport type SimpleConfig = {\n envName: string;\n caller: CallerMetadata | undefined;\n};\nexport type SimplePreset = {\n targets: Targets;\n} & SimpleConfig;\nexport type SimplePlugin = {\n assumptions: {\n [name: string]: boolean;\n };\n} & SimplePreset;\n"],"mappings":"","ignoreList":[]}

View File

@@ -0,0 +1,6 @@
{
exports.getModuleName = () => require("@babel/helper-module-transforms").getModuleName;
}
0 && 0;
//# sourceMappingURL=babel-7-helpers.cjs.map

View File

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

View File

@@ -0,0 +1,110 @@
const { existsSync } = require('node:fs');
const path = require('node:path');
const { platform, arch, report } = require('node:process');
const isMusl = () => !report.getReport().header.glibcVersionRuntime;
const bindingsByPlatformAndArch = {
android: {
arm: { base: 'android-arm-eabi' },
arm64: { base: 'android-arm64' }
},
darwin: {
arm64: { base: 'darwin-arm64' },
x64: { base: 'darwin-x64' }
},
freebsd: {
arm64: { base: 'freebsd-arm64' },
x64: { base: 'freebsd-x64' }
},
linux: {
arm: { base: 'linux-arm-gnueabihf', musl: 'linux-arm-musleabihf' },
arm64: { base: 'linux-arm64-gnu', musl: 'linux-arm64-musl' },
loong64: { base: 'linux-loongarch64-gnu', musl: null },
ppc64: { base: 'linux-powerpc64le-gnu', musl: null },
riscv64: { base: 'linux-riscv64-gnu', musl: 'linux-riscv64-musl' },
s390x: { base: 'linux-s390x-gnu', musl: null },
x64: { base: 'linux-x64-gnu', musl: 'linux-x64-musl' }
},
win32: {
arm64: { base: 'win32-arm64-msvc' },
ia32: { base: 'win32-ia32-msvc' },
x64: { base: 'win32-x64-msvc' }
}
};
const msvcLinkFilenameByArch = {
arm64: 'vc_redist.arm64.exe',
ia32: 'vc_redist.x86.exe',
x64: 'vc_redist.x64.exe'
};
const packageBase = getPackageBase();
const localName = `./rollup.${packageBase}.node`;
const requireWithFriendlyError = id => {
try {
return require(id);
} catch (error) {
if (
platform === 'win32' &&
error instanceof Error &&
error.code === 'ERR_DLOPEN_FAILED' &&
error.message.includes('The specified module could not be found')
) {
const msvcDownloadLink = `https://aka.ms/vs/17/release/${msvcLinkFilenameByArch[arch]}`;
throw new Error(
`Failed to load module ${id}. ` +
'Required DLL was not found. ' +
'This error usually happens when Microsoft Visual C++ Redistributable is not installed. ' +
`You can download it from ${msvcDownloadLink}`,
{ cause: error }
);
}
throw new Error(
`Cannot find module ${id}. ` +
`npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
{ cause: error }
);
}
};
const { parse, parseAsync, xxhashBase64Url, xxhashBase36, xxhashBase16 } = requireWithFriendlyError(
existsSync(path.join(__dirname, localName)) ? localName : `@rollup/rollup-${packageBase}`
);
function getPackageBase() {
const imported = bindingsByPlatformAndArch[platform]?.[arch];
if (!imported) {
throwUnsupportedError(false);
}
if ('musl' in imported && isMusl()) {
return imported.musl || throwUnsupportedError(true);
}
return imported.base;
}
function throwUnsupportedError(isMusl) {
throw new Error(
`Your current platform "${platform}${isMusl ? ' (musl)' : ''}" and architecture "${arch}" combination is not yet supported by the native Rollup build. Please use the WASM build "@rollup/wasm-node" instead.
The following platform-architecture combinations are supported:
${Object.entries(bindingsByPlatformAndArch)
.flatMap(([platformName, architectures]) =>
Object.entries(architectures).flatMap(([architectureName, { musl }]) => {
const name = `${platformName}-${architectureName}`;
return musl ? [name, `${name} (musl)`] : [name];
})
)
.join('\n')}
If this is important to you, please consider supporting Rollup to make a native build for your platform and architecture available.`
);
}
module.exports.parse = parse;
module.exports.parseAsync = parseAsync;
module.exports.xxhashBase64Url = xxhashBase64Url;
module.exports.xxhashBase36 = xxhashBase36;
module.exports.xxhashBase16 = xxhashBase16;