From d3653fe8ac776be625326f629d210d677a8eefc2 Mon Sep 17 00:00:00 2001 From: "Node.js GitHub Bot" Date: Tue, 2 Jul 2024 03:50:32 +0300 Subject: [PATCH] tools: update eslint to 9.6.0 PR-URL: https://github.com/nodejs/node/pull/53645 Reviewed-By: Moshe Atlow Reviewed-By: Luigi Pinca Reviewed-By: Trivikram Kamat --- .../@eslint-community/regexpp/index.js | 138 ++- .../@eslint-community/regexpp/index.mjs | 138 ++- .../@eslint-community/regexpp/package.json | 2 +- .../@eslint/config-array/dist/cjs/index.cjs | 1 + .../@eslint/config-array/dist/esm/index.js | 1 + .../@eslint/config-array/package.json | 4 +- .../node_modules/@eslint/js/package.json | 2 +- .../node_modules/@pkgr/core/lib/constants.js | 5 + .../node_modules/@pkgr/core/lib/helpers.js | 49 + .../node_modules/@pkgr/core/lib/index.cjs | 64 ++ .../node_modules/@pkgr/core/lib/index.js | 3 + .../node_modules/@pkgr/core/package.json | 29 + .../dist/array-element-newline.js | 4 + .../dist/object-curly-newline.js | 18 +- .../@stylistic/eslint-plugin-js/package.json | 2 +- .../@typescript-eslint/types/package.json | 2 +- .../node_modules/es-module-lexer/LICENSE | 10 + .../es-module-lexer/dist/lexer.asm.js | 2 + .../es-module-lexer/dist/lexer.cjs | 1 + .../es-module-lexer/dist/lexer.js | 2 + .../node_modules/es-module-lexer/lexer.js | 925 ++++++++++++++++++ .../node_modules/es-module-lexer/package.json | 54 + .../eslint-plugin-jsdoc/dist/generateRule.cjs | 2 +- .../dist/import-worker.cjs | 17 + .../dist/import-worker.mjs | 11 + .../dist/rules/checkParamNames.cjs | 3 + .../dist/rules/checkValues.cjs | 25 +- .../dist/rules/noTypes.cjs | 4 +- .../dist/rules/noUndefinedTypes.cjs | 61 +- .../eslint-plugin-jsdoc/dist/tagNames.cjs | 1 + .../eslint-plugin-jsdoc/package.json | 9 +- .../eslint-plugin-jsdoc/src/import-worker.mjs | 11 + .../src/rules/checkParamNames.js | 5 + .../src/rules/checkValues.js | 31 +- .../eslint-plugin-jsdoc/src/rules/noTypes.js | 6 +- .../src/rules/noUndefinedTypes.js | 64 +- .../eslint-plugin-jsdoc/src/tagNames.js | 1 + .../node_modules/eslint/conf/ecma-version.js | 2 +- .../node_modules/eslint/conf/globals.js | 7 +- tools/eslint/node_modules/eslint/lib/cli.js | 25 +- .../eslint/lib/eslint/eslint-helpers.js | 5 + .../node_modules/eslint/lib/eslint/eslint.js | 18 +- .../eslint/lib/eslint/legacy-eslint.js | 14 + .../languages/js/source-code/source-code.js | 12 +- .../lib/linter/config-comment-parser.js | 19 +- .../node_modules/eslint/lib/linter/linter.js | 333 ++++--- .../eslint/node_modules/eslint/lib/options.js | 14 +- .../eslint/lib/rules/no-unused-vars.js | 64 +- .../node_modules/eslint/lib/shared/flags.js | 26 + .../node_modules/eslint/lib/shared/logging.js | 11 +- .../node_modules/eslint/lib/shared/types.js | 2 +- tools/eslint/node_modules/eslint/package.json | 17 +- .../node_modules/parse-imports/dist/index.cjs | 403 ++++++++ .../node_modules/parse-imports/dist/index.js | 400 ++++++++ .../eslint/node_modules/parse-imports/license | 201 ++++ .../node_modules/parse-imports/package.json | 60 ++ .../node_modules/parse-imports/readme.md | 280 ++++++ tools/eslint/node_modules/slashes/LICENSE | 17 + .../slashes/lib/cjs/add-slashes.js | 24 + .../slashes/lib/cjs/get-escaped-any.js | 27 + .../lib/cjs/get-escaped-json-unsafe.js | 20 + .../slashes/lib/cjs/get-unescaped-any.js | 25 + .../node_modules/slashes/lib/cjs/index.js | 22 + .../node_modules/slashes/lib/cjs/package.json | 1 + .../slashes/lib/cjs/remove-slashes.js | 47 + .../slashes/lib/cjs/types/escape-sequence.js | 3 + .../slashes/lib/esm/add-slashes.js | 21 + .../slashes/lib/esm/get-escaped-any.js | 24 + .../lib/esm/get-escaped-json-unsafe.js | 17 + .../slashes/lib/esm/get-unescaped-any.js | 22 + .../node_modules/slashes/lib/esm/index.js | 6 + .../slashes/lib/esm/remove-slashes.js | 43 + .../slashes/lib/esm/types/escape-sequence.js | 2 + .../eslint/node_modules/slashes/package.json | 58 ++ tools/eslint/node_modules/synckit/LICENSE | 21 + .../eslint/node_modules/synckit/lib/index.cjs | 401 ++++++++ .../eslint/node_modules/synckit/lib/index.js | 344 +++++++ .../eslint/node_modules/synckit/lib/types.js | 2 + .../eslint/node_modules/synckit/package.json | 39 + .../node_modules/tslib/CopyrightNotice.txt | 15 + tools/eslint/node_modules/tslib/LICENSE.txt | 12 + tools/eslint/node_modules/tslib/SECURITY.md | 41 + .../node_modules/tslib/modules/index.js | 68 ++ .../node_modules/tslib/modules/package.json | 3 + tools/eslint/node_modules/tslib/package.json | 47 + .../eslint/node_modules/tslib/tslib.es6.html | 1 + tools/eslint/node_modules/tslib/tslib.es6.js | 374 +++++++ tools/eslint/node_modules/tslib/tslib.es6.mjs | 373 +++++++ tools/eslint/node_modules/tslib/tslib.html | 1 + tools/eslint/node_modules/tslib/tslib.js | 424 ++++++++ tools/eslint/package-lock.json | 119 ++- tools/eslint/package.json | 6 +- 92 files changed, 5987 insertions(+), 303 deletions(-) create mode 100644 tools/eslint/node_modules/@pkgr/core/lib/constants.js create mode 100644 tools/eslint/node_modules/@pkgr/core/lib/helpers.js create mode 100644 tools/eslint/node_modules/@pkgr/core/lib/index.cjs create mode 100644 tools/eslint/node_modules/@pkgr/core/lib/index.js create mode 100644 tools/eslint/node_modules/@pkgr/core/package.json create mode 100644 tools/eslint/node_modules/es-module-lexer/LICENSE create mode 100644 tools/eslint/node_modules/es-module-lexer/dist/lexer.asm.js create mode 100644 tools/eslint/node_modules/es-module-lexer/dist/lexer.cjs create mode 100644 tools/eslint/node_modules/es-module-lexer/dist/lexer.js create mode 100644 tools/eslint/node_modules/es-module-lexer/lexer.js create mode 100644 tools/eslint/node_modules/es-module-lexer/package.json create mode 100644 tools/eslint/node_modules/eslint-plugin-jsdoc/dist/import-worker.cjs create mode 100644 tools/eslint/node_modules/eslint-plugin-jsdoc/dist/import-worker.mjs create mode 100644 tools/eslint/node_modules/eslint-plugin-jsdoc/src/import-worker.mjs create mode 100644 tools/eslint/node_modules/eslint/lib/shared/flags.js create mode 100644 tools/eslint/node_modules/parse-imports/dist/index.cjs create mode 100644 tools/eslint/node_modules/parse-imports/dist/index.js create mode 100644 tools/eslint/node_modules/parse-imports/license create mode 100644 tools/eslint/node_modules/parse-imports/package.json create mode 100644 tools/eslint/node_modules/parse-imports/readme.md create mode 100644 tools/eslint/node_modules/slashes/LICENSE create mode 100644 tools/eslint/node_modules/slashes/lib/cjs/add-slashes.js create mode 100644 tools/eslint/node_modules/slashes/lib/cjs/get-escaped-any.js create mode 100644 tools/eslint/node_modules/slashes/lib/cjs/get-escaped-json-unsafe.js create mode 100644 tools/eslint/node_modules/slashes/lib/cjs/get-unescaped-any.js create mode 100644 tools/eslint/node_modules/slashes/lib/cjs/index.js create mode 100644 tools/eslint/node_modules/slashes/lib/cjs/package.json create mode 100644 tools/eslint/node_modules/slashes/lib/cjs/remove-slashes.js create mode 100644 tools/eslint/node_modules/slashes/lib/cjs/types/escape-sequence.js create mode 100644 tools/eslint/node_modules/slashes/lib/esm/add-slashes.js create mode 100644 tools/eslint/node_modules/slashes/lib/esm/get-escaped-any.js create mode 100644 tools/eslint/node_modules/slashes/lib/esm/get-escaped-json-unsafe.js create mode 100644 tools/eslint/node_modules/slashes/lib/esm/get-unescaped-any.js create mode 100644 tools/eslint/node_modules/slashes/lib/esm/index.js create mode 100644 tools/eslint/node_modules/slashes/lib/esm/remove-slashes.js create mode 100644 tools/eslint/node_modules/slashes/lib/esm/types/escape-sequence.js create mode 100644 tools/eslint/node_modules/slashes/package.json create mode 100644 tools/eslint/node_modules/synckit/LICENSE create mode 100644 tools/eslint/node_modules/synckit/lib/index.cjs create mode 100644 tools/eslint/node_modules/synckit/lib/index.js create mode 100644 tools/eslint/node_modules/synckit/lib/types.js create mode 100644 tools/eslint/node_modules/synckit/package.json create mode 100644 tools/eslint/node_modules/tslib/CopyrightNotice.txt create mode 100644 tools/eslint/node_modules/tslib/LICENSE.txt create mode 100644 tools/eslint/node_modules/tslib/SECURITY.md create mode 100644 tools/eslint/node_modules/tslib/modules/index.js create mode 100644 tools/eslint/node_modules/tslib/modules/package.json create mode 100644 tools/eslint/node_modules/tslib/package.json create mode 100644 tools/eslint/node_modules/tslib/tslib.es6.html create mode 100644 tools/eslint/node_modules/tslib/tslib.es6.js create mode 100644 tools/eslint/node_modules/tslib/tslib.es6.mjs create mode 100644 tools/eslint/node_modules/tslib/tslib.html create mode 100644 tools/eslint/node_modules/tslib/tslib.js diff --git a/tools/eslint/node_modules/@eslint-community/regexpp/index.js b/tools/eslint/node_modules/@eslint-community/regexpp/index.js index 1a5c438c9800d0..aedc9a991ed084 100644 --- a/tools/eslint/node_modules/@eslint-community/regexpp/index.js +++ b/tools/eslint/node_modules/@eslint-community/regexpp/index.js @@ -6,7 +6,7 @@ var ast = /*#__PURE__*/Object.freeze({ __proto__: null }); -const latestEcmaVersion = 2024; +const latestEcmaVersion = 2025; let largeIdStartRanges = undefined; let largeIdContinueRanges = undefined; @@ -264,6 +264,103 @@ function combineSurrogatePair(lead, trail) { return (lead - 0xd800) * 0x400 + (trail - 0xdc00) + 0x10000; } +class GroupSpecifiersAsES2018 { + constructor() { + this.groupName = new Set(); + } + clear() { + this.groupName.clear(); + } + isEmpty() { + return !this.groupName.size; + } + hasInPattern(name) { + return this.groupName.has(name); + } + hasInScope(name) { + return this.hasInPattern(name); + } + addToScope(name) { + this.groupName.add(name); + } + enterDisjunction() { + } + enterAlternative() { + } + leaveDisjunction() { + } +} +class BranchID { + constructor(parent, base) { + this.parent = parent; + this.base = base !== null && base !== void 0 ? base : this; + } + separatedFrom(other) { + var _a, _b; + if (this.base === other.base && this !== other) { + return true; + } + if (other.parent && this.separatedFrom(other.parent)) { + return true; + } + return (_b = (_a = this.parent) === null || _a === void 0 ? void 0 : _a.separatedFrom(other)) !== null && _b !== void 0 ? _b : false; + } + child() { + return new BranchID(this, null); + } + sibling() { + return new BranchID(this.parent, this.base); + } +} +class GroupSpecifiersAsES2025 { + constructor() { + this.branchID = new BranchID(null, null); + this.groupNames = new Map(); + } + clear() { + this.branchID = new BranchID(null, null); + this.groupNames.clear(); + } + isEmpty() { + return !this.groupNames.size; + } + enterDisjunction() { + this.branchID = this.branchID.child(); + } + enterAlternative(index) { + if (index === 0) { + return; + } + this.branchID = this.branchID.sibling(); + } + leaveDisjunction() { + this.branchID = this.branchID.parent; + } + hasInPattern(name) { + return this.groupNames.has(name); + } + hasInScope(name) { + const branches = this.groupNames.get(name); + if (!branches) { + return false; + } + for (const branch of branches) { + if (!branch.separatedFrom(this.branchID)) { + return true; + } + } + return false; + } + addToScope(name) { + const branches = this.groupNames.get(name); + if (branches) { + branches.push(this.branchID); + return; + } + this.groupNames.set(name, [this.branchID]); + } +} + const legacyImpl = { at(s, end, i) { return i < end ? s.charCodeAt(i) : -1; @@ -496,10 +593,13 @@ class RegExpValidator { this._lastStrValue = ""; this._lastAssertionIsQuantifiable = false; this._numCapturingParens = 0; - this._groupNames = new Set(); this._backreferenceNames = new Set(); this._srcCtx = null; this._options = options !== null && options !== void 0 ? options : {}; + this._groupSpecifiers = + this.ecmaVersion >= 2025 + ? new GroupSpecifiersAsES2025() + : new GroupSpecifiersAsES2018(); } validateLiteral(source, start = 0, end = source.length) { this._srcCtx = { source, start, end, kind: "literal" }; @@ -542,7 +642,7 @@ class RegExpValidator { this.consumePattern(); if (!this._nFlag && this.ecmaVersion >= 2018 && - this._groupNames.size > 0) { + !this._groupSpecifiers.isEmpty()) { this._nFlag = true; this.rewind(start); this.consumePattern(); @@ -879,7 +979,7 @@ class RegExpValidator { consumePattern() { const start = this.index; this._numCapturingParens = this.countCapturingParens(); - this._groupNames.clear(); + this._groupSpecifiers.clear(); this._backreferenceNames.clear(); this.onPatternEnter(start); this.consumeDisjunction(); @@ -898,7 +998,7 @@ class RegExpValidator { this.raise(`Unexpected character '${c}'`); } for (const name of this._backreferenceNames) { - if (!this._groupNames.has(name)) { + if (!this._groupSpecifiers.hasInPattern(name)) { this.raise("Invalid named capture referenced"); } } @@ -939,6 +1039,7 @@ class RegExpValidator { consumeDisjunction() { const start = this.index; let i = 0; + this._groupSpecifiers.enterDisjunction(); this.onDisjunctionEnter(start); do { this.consumeAlternative(i++); @@ -950,9 +1051,11 @@ class RegExpValidator { this.raise("Lone quantifier brackets"); } this.onDisjunctionLeave(start, this.index); + this._groupSpecifiers.leaveDisjunction(); } consumeAlternative(i) { const start = this.index; + this._groupSpecifiers.enterAlternative(i); this.onAlternativeEnter(start, i); while (this.currentCodePoint !== -1 && this.consumeTerm()) { } @@ -1186,8 +1289,8 @@ class RegExpValidator { consumeGroupSpecifier() { if (this.eat(QUESTION_MARK)) { if (this.eatGroupName()) { - if (!this._groupNames.has(this._lastStrValue)) { - this._groupNames.add(this._lastStrValue); + if (!this._groupSpecifiers.hasInScope(this._lastStrValue)) { + this._groupSpecifiers.addToScope(this._lastStrValue); return true; } this.raise("Duplicate capture group name"); @@ -2010,11 +2113,21 @@ class RegExpParserState { this._node.raw = this.source.slice(start, end); for (const reference of this._backreferences) { const ref = reference.ref; - const group = typeof ref === "number" - ? this._capturingGroups[ref - 1] - : this._capturingGroups.find((g) => g.name === ref); - reference.resolved = group; - group.references.push(reference); + const groups = typeof ref === "number" + ? [this._capturingGroups[ref - 1]] + : this._capturingGroups.filter((g) => g.name === ref); + if (groups.length === 1) { + const group = groups[0]; + reference.ambiguous = false; + reference.resolved = group; + } + else { + reference.ambiguous = true; + reference.resolved = groups; + } + for (const group of groups) { + group.references.push(reference); + } } } onAlternativeEnter(start) { @@ -2260,6 +2373,7 @@ class RegExpParserState { end, raw: this.source.slice(start, end), ref, + ambiguous: false, resolved: DUMMY_CAPTURING_GROUP, }; parent.elements.push(node); diff --git a/tools/eslint/node_modules/@eslint-community/regexpp/index.mjs b/tools/eslint/node_modules/@eslint-community/regexpp/index.mjs index cfee242f5e0afe..6589e43f1d46f5 100644 --- a/tools/eslint/node_modules/@eslint-community/regexpp/index.mjs +++ b/tools/eslint/node_modules/@eslint-community/regexpp/index.mjs @@ -2,7 +2,7 @@ var ast = /*#__PURE__*/Object.freeze({ __proto__: null }); -const latestEcmaVersion = 2024; +const latestEcmaVersion = 2025; let largeIdStartRanges = undefined; let largeIdContinueRanges = undefined; @@ -260,6 +260,103 @@ function combineSurrogatePair(lead, trail) { return (lead - 0xd800) * 0x400 + (trail - 0xdc00) + 0x10000; } +class GroupSpecifiersAsES2018 { + constructor() { + this.groupName = new Set(); + } + clear() { + this.groupName.clear(); + } + isEmpty() { + return !this.groupName.size; + } + hasInPattern(name) { + return this.groupName.has(name); + } + hasInScope(name) { + return this.hasInPattern(name); + } + addToScope(name) { + this.groupName.add(name); + } + enterDisjunction() { + } + enterAlternative() { + } + leaveDisjunction() { + } +} +class BranchID { + constructor(parent, base) { + this.parent = parent; + this.base = base !== null && base !== void 0 ? base : this; + } + separatedFrom(other) { + var _a, _b; + if (this.base === other.base && this !== other) { + return true; + } + if (other.parent && this.separatedFrom(other.parent)) { + return true; + } + return (_b = (_a = this.parent) === null || _a === void 0 ? void 0 : _a.separatedFrom(other)) !== null && _b !== void 0 ? _b : false; + } + child() { + return new BranchID(this, null); + } + sibling() { + return new BranchID(this.parent, this.base); + } +} +class GroupSpecifiersAsES2025 { + constructor() { + this.branchID = new BranchID(null, null); + this.groupNames = new Map(); + } + clear() { + this.branchID = new BranchID(null, null); + this.groupNames.clear(); + } + isEmpty() { + return !this.groupNames.size; + } + enterDisjunction() { + this.branchID = this.branchID.child(); + } + enterAlternative(index) { + if (index === 0) { + return; + } + this.branchID = this.branchID.sibling(); + } + leaveDisjunction() { + this.branchID = this.branchID.parent; + } + hasInPattern(name) { + return this.groupNames.has(name); + } + hasInScope(name) { + const branches = this.groupNames.get(name); + if (!branches) { + return false; + } + for (const branch of branches) { + if (!branch.separatedFrom(this.branchID)) { + return true; + } + } + return false; + } + addToScope(name) { + const branches = this.groupNames.get(name); + if (branches) { + branches.push(this.branchID); + return; + } + this.groupNames.set(name, [this.branchID]); + } +} + const legacyImpl = { at(s, end, i) { return i < end ? s.charCodeAt(i) : -1; @@ -492,10 +589,13 @@ class RegExpValidator { this._lastStrValue = ""; this._lastAssertionIsQuantifiable = false; this._numCapturingParens = 0; - this._groupNames = new Set(); this._backreferenceNames = new Set(); this._srcCtx = null; this._options = options !== null && options !== void 0 ? options : {}; + this._groupSpecifiers = + this.ecmaVersion >= 2025 + ? new GroupSpecifiersAsES2025() + : new GroupSpecifiersAsES2018(); } validateLiteral(source, start = 0, end = source.length) { this._srcCtx = { source, start, end, kind: "literal" }; @@ -538,7 +638,7 @@ class RegExpValidator { this.consumePattern(); if (!this._nFlag && this.ecmaVersion >= 2018 && - this._groupNames.size > 0) { + !this._groupSpecifiers.isEmpty()) { this._nFlag = true; this.rewind(start); this.consumePattern(); @@ -875,7 +975,7 @@ class RegExpValidator { consumePattern() { const start = this.index; this._numCapturingParens = this.countCapturingParens(); - this._groupNames.clear(); + this._groupSpecifiers.clear(); this._backreferenceNames.clear(); this.onPatternEnter(start); this.consumeDisjunction(); @@ -894,7 +994,7 @@ class RegExpValidator { this.raise(`Unexpected character '${c}'`); } for (const name of this._backreferenceNames) { - if (!this._groupNames.has(name)) { + if (!this._groupSpecifiers.hasInPattern(name)) { this.raise("Invalid named capture referenced"); } } @@ -935,6 +1035,7 @@ class RegExpValidator { consumeDisjunction() { const start = this.index; let i = 0; + this._groupSpecifiers.enterDisjunction(); this.onDisjunctionEnter(start); do { this.consumeAlternative(i++); @@ -946,9 +1047,11 @@ class RegExpValidator { this.raise("Lone quantifier brackets"); } this.onDisjunctionLeave(start, this.index); + this._groupSpecifiers.leaveDisjunction(); } consumeAlternative(i) { const start = this.index; + this._groupSpecifiers.enterAlternative(i); this.onAlternativeEnter(start, i); while (this.currentCodePoint !== -1 && this.consumeTerm()) { } @@ -1182,8 +1285,8 @@ class RegExpValidator { consumeGroupSpecifier() { if (this.eat(QUESTION_MARK)) { if (this.eatGroupName()) { - if (!this._groupNames.has(this._lastStrValue)) { - this._groupNames.add(this._lastStrValue); + if (!this._groupSpecifiers.hasInScope(this._lastStrValue)) { + this._groupSpecifiers.addToScope(this._lastStrValue); return true; } this.raise("Duplicate capture group name"); @@ -2006,11 +2109,21 @@ class RegExpParserState { this._node.raw = this.source.slice(start, end); for (const reference of this._backreferences) { const ref = reference.ref; - const group = typeof ref === "number" - ? this._capturingGroups[ref - 1] - : this._capturingGroups.find((g) => g.name === ref); - reference.resolved = group; - group.references.push(reference); + const groups = typeof ref === "number" + ? [this._capturingGroups[ref - 1]] + : this._capturingGroups.filter((g) => g.name === ref); + if (groups.length === 1) { + const group = groups[0]; + reference.ambiguous = false; + reference.resolved = group; + } + else { + reference.ambiguous = true; + reference.resolved = groups; + } + for (const group of groups) { + group.references.push(reference); + } } } onAlternativeEnter(start) { @@ -2256,6 +2369,7 @@ class RegExpParserState { end, raw: this.source.slice(start, end), ref, + ambiguous: false, resolved: DUMMY_CAPTURING_GROUP, }; parent.elements.push(node); diff --git a/tools/eslint/node_modules/@eslint-community/regexpp/package.json b/tools/eslint/node_modules/@eslint-community/regexpp/package.json index 9f48fedebbbb5a..6c64680641fa4a 100644 --- a/tools/eslint/node_modules/@eslint-community/regexpp/package.json +++ b/tools/eslint/node_modules/@eslint-community/regexpp/package.json @@ -1,6 +1,6 @@ { "name": "@eslint-community/regexpp", - "version": "4.10.1", + "version": "4.11.0", "description": "Regular expression parser for ECMAScript.", "keywords": [ "regexp", diff --git a/tools/eslint/node_modules/@eslint/config-array/dist/cjs/index.cjs b/tools/eslint/node_modules/@eslint/config-array/dist/cjs/index.cjs index 439cd7fd1afaa0..0a4b034e6f60bb 100644 --- a/tools/eslint/node_modules/@eslint/config-array/dist/cjs/index.cjs +++ b/tools/eslint/node_modules/@eslint/config-array/dist/cjs/index.cjs @@ -206,6 +206,7 @@ const negatedMinimatchCache = new Map(); const MINIMATCH_OPTIONS = { // matchBase: true, dot: true, + allowWindowsEscape: true, }; /** diff --git a/tools/eslint/node_modules/@eslint/config-array/dist/esm/index.js b/tools/eslint/node_modules/@eslint/config-array/dist/esm/index.js index d738721b120080..ce238f280e5c58 100644 --- a/tools/eslint/node_modules/@eslint/config-array/dist/esm/index.js +++ b/tools/eslint/node_modules/@eslint/config-array/dist/esm/index.js @@ -205,6 +205,7 @@ const negatedMinimatchCache = new Map(); const MINIMATCH_OPTIONS = { // matchBase: true, dot: true, + allowWindowsEscape: true, }; /** diff --git a/tools/eslint/node_modules/@eslint/config-array/package.json b/tools/eslint/node_modules/@eslint/config-array/package.json index db984656267de5..5e7f838e47cc4e 100644 --- a/tools/eslint/node_modules/@eslint/config-array/package.json +++ b/tools/eslint/node_modules/@eslint/config-array/package.json @@ -1,6 +1,6 @@ { "name": "@eslint/config-array", - "version": "0.16.0", + "version": "0.17.0", "description": "General purpose glob-based configuration matching.", "author": "Nicholas C. Zakas", "type": "module", @@ -48,7 +48,7 @@ "dependencies": { "@eslint/object-schema": "^2.1.4", "debug": "^4.3.1", - "minimatch": "^3.0.5" + "minimatch": "^3.1.2" }, "devDependencies": { "@types/minimatch": "^3.0.5", diff --git a/tools/eslint/node_modules/@eslint/js/package.json b/tools/eslint/node_modules/@eslint/js/package.json index 594acad45701c2..d5f67512e6ad41 100644 --- a/tools/eslint/node_modules/@eslint/js/package.json +++ b/tools/eslint/node_modules/@eslint/js/package.json @@ -1,6 +1,6 @@ { "name": "@eslint/js", - "version": "9.5.0", + "version": "9.6.0", "description": "ESLint JavaScript language implementation", "main": "./src/index.js", "scripts": {}, diff --git a/tools/eslint/node_modules/@pkgr/core/lib/constants.js b/tools/eslint/node_modules/@pkgr/core/lib/constants.js new file mode 100644 index 00000000000000..374f420c29c903 --- /dev/null +++ b/tools/eslint/node_modules/@pkgr/core/lib/constants.js @@ -0,0 +1,5 @@ +import { createRequire } from 'node:module'; +export const CWD = process.cwd(); +export const cjsRequire = typeof require === 'undefined' ? createRequire(import.meta.url) : require; +export const EXTENSIONS = ['.ts', '.tsx', ...Object.keys(cjsRequire.extensions)]; +//# sourceMappingURL=constants.js.map \ No newline at end of file diff --git a/tools/eslint/node_modules/@pkgr/core/lib/helpers.js b/tools/eslint/node_modules/@pkgr/core/lib/helpers.js new file mode 100644 index 00000000000000..08e33302dc7df1 --- /dev/null +++ b/tools/eslint/node_modules/@pkgr/core/lib/helpers.js @@ -0,0 +1,49 @@ +import fs from 'node:fs'; +import path from 'node:path'; +import { CWD, EXTENSIONS, cjsRequire } from './constants.js'; +export const tryPkg = (pkg) => { + try { + return cjsRequire.resolve(pkg); + } + catch (_a) { } +}; +export const isPkgAvailable = (pkg) => !!tryPkg(pkg); +export const tryFile = (filePath, includeDir = false) => { + if (typeof filePath === 'string') { + return fs.existsSync(filePath) && + (includeDir || fs.statSync(filePath).isFile()) + ? filePath + : ''; + } + for (const file of filePath !== null && filePath !== void 0 ? filePath : []) { + if (tryFile(file, includeDir)) { + return file; + } + } + return ''; +}; +export const tryExtensions = (filepath, extensions = EXTENSIONS) => { + const ext = [...extensions, ''].find(ext => tryFile(filepath + ext)); + return ext == null ? '' : filepath + ext; +}; +export const findUp = (searchEntry, searchFileOrIncludeDir, includeDir) => { + console.assert(path.isAbsolute(searchEntry)); + if (!tryFile(searchEntry, true) || + (searchEntry !== CWD && !searchEntry.startsWith(CWD + path.sep))) { + return ''; + } + searchEntry = path.resolve(fs.statSync(searchEntry).isDirectory() + ? searchEntry + : path.resolve(searchEntry, '..')); + const isSearchFile = typeof searchFileOrIncludeDir === 'string'; + const searchFile = isSearchFile ? searchFileOrIncludeDir : 'package.json'; + do { + const searched = tryFile(path.resolve(searchEntry, searchFile), isSearchFile && includeDir); + if (searched) { + return searched; + } + searchEntry = path.resolve(searchEntry, '..'); + } while (searchEntry === CWD || searchEntry.startsWith(CWD + path.sep)); + return ''; +}; +//# sourceMappingURL=helpers.js.map \ No newline at end of file diff --git a/tools/eslint/node_modules/@pkgr/core/lib/index.cjs b/tools/eslint/node_modules/@pkgr/core/lib/index.cjs new file mode 100644 index 00000000000000..8c63baf13b9816 --- /dev/null +++ b/tools/eslint/node_modules/@pkgr/core/lib/index.cjs @@ -0,0 +1,64 @@ +'use strict'; + +var node_module = require('node:module'); +var fs = require('node:fs'); +var path = require('node:path'); + +const import_meta = {}; +const CWD = process.cwd(); +const cjsRequire = typeof require === "undefined" ? node_module.createRequire(import_meta.url) : require; +const EXTENSIONS = [".ts", ".tsx", ...Object.keys(cjsRequire.extensions)]; + +const tryPkg = (pkg) => { + try { + return cjsRequire.resolve(pkg); + } catch (e) { + } +}; +const isPkgAvailable = (pkg) => !!tryPkg(pkg); +const tryFile = (filePath, includeDir = false) => { + if (typeof filePath === "string") { + return fs.existsSync(filePath) && (includeDir || fs.statSync(filePath).isFile()) ? filePath : ""; + } + for (const file of filePath != null ? filePath : []) { + if (tryFile(file, includeDir)) { + return file; + } + } + return ""; +}; +const tryExtensions = (filepath, extensions = EXTENSIONS) => { + const ext = [...extensions, ""].find((ext2) => tryFile(filepath + ext2)); + return ext == null ? "" : filepath + ext; +}; +const findUp = (searchEntry, searchFileOrIncludeDir, includeDir) => { + console.assert(path.isAbsolute(searchEntry)); + if (!tryFile(searchEntry, true) || searchEntry !== CWD && !searchEntry.startsWith(CWD + path.sep)) { + return ""; + } + searchEntry = path.resolve( + fs.statSync(searchEntry).isDirectory() ? searchEntry : path.resolve(searchEntry, "..") + ); + const isSearchFile = typeof searchFileOrIncludeDir === "string"; + const searchFile = isSearchFile ? searchFileOrIncludeDir : "package.json"; + do { + const searched = tryFile( + path.resolve(searchEntry, searchFile), + isSearchFile && includeDir + ); + if (searched) { + return searched; + } + searchEntry = path.resolve(searchEntry, ".."); + } while (searchEntry === CWD || searchEntry.startsWith(CWD + path.sep)); + return ""; +}; + +exports.CWD = CWD; +exports.EXTENSIONS = EXTENSIONS; +exports.cjsRequire = cjsRequire; +exports.findUp = findUp; +exports.isPkgAvailable = isPkgAvailable; +exports.tryExtensions = tryExtensions; +exports.tryFile = tryFile; +exports.tryPkg = tryPkg; diff --git a/tools/eslint/node_modules/@pkgr/core/lib/index.js b/tools/eslint/node_modules/@pkgr/core/lib/index.js new file mode 100644 index 00000000000000..e54355320647f5 --- /dev/null +++ b/tools/eslint/node_modules/@pkgr/core/lib/index.js @@ -0,0 +1,3 @@ +export * from './constants.js'; +export * from './helpers.js'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/tools/eslint/node_modules/@pkgr/core/package.json b/tools/eslint/node_modules/@pkgr/core/package.json new file mode 100644 index 00000000000000..6760bd55984d1c --- /dev/null +++ b/tools/eslint/node_modules/@pkgr/core/package.json @@ -0,0 +1,29 @@ +{ + "name": "@pkgr/core", + "version": "0.1.1", + "type": "module", + "description": "Shared core module for `@pkgr` packages or any package else", + "repository": "git+https://github.com/un-ts/pkgr.git", + "homepage": "https://github.com/un-ts/pkgr/blob/master/packages/core", + "author": "JounQin (https://www.1stG.me) ", + "funding": "https://opencollective.com/unts", + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + }, + "main": "./lib/index.cjs", + "module": "./lib/index.js", + "exports": { + "types": "./lib/index.d.ts", + "import": "./lib/index.js", + "require": "./lib/index.cjs" + }, + "types": "./lib/index.d.ts", + "files": [ + "lib" + ], + "publishConfig": { + "access": "public" + }, + "sideEffects": false +} diff --git a/tools/eslint/node_modules/@stylistic/eslint-plugin-js/dist/array-element-newline.js b/tools/eslint/node_modules/@stylistic/eslint-plugin-js/dist/array-element-newline.js index 7e6b37acc0175d..5108c33cc9833d 100644 --- a/tools/eslint/node_modules/@stylistic/eslint-plugin-js/dist/array-element-newline.js +++ b/tools/eslint/node_modules/@stylistic/eslint-plugin-js/dist/array-element-newline.js @@ -21,6 +21,9 @@ var arrayElementNewline = utils.createRule({ { type: "object", properties: { + consistent: { + type: "boolean" + }, multiline: { type: "boolean" }, @@ -78,6 +81,7 @@ var arrayElementNewline = utils.createRule({ consistent = true; minItems = Number.POSITIVE_INFINITY; } else { + consistent = Boolean(option.consistent); multiline = Boolean(option.multiline); minItems = option.minItems || Number.POSITIVE_INFINITY; } diff --git a/tools/eslint/node_modules/@stylistic/eslint-plugin-js/dist/object-curly-newline.js b/tools/eslint/node_modules/@stylistic/eslint-plugin-js/dist/object-curly-newline.js index b49ffd11b6d0c6..f016cce245bf98 100644 --- a/tools/eslint/node_modules/@stylistic/eslint-plugin-js/dist/object-curly-newline.js +++ b/tools/eslint/node_modules/@stylistic/eslint-plugin-js/dist/object-curly-newline.js @@ -58,16 +58,22 @@ function normalizeOptions(options) { ObjectExpression: normalizeOptionValue(options.ObjectExpression), ObjectPattern: normalizeOptionValue(options.ObjectPattern), ImportDeclaration: normalizeOptionValue(options.ImportDeclaration), - ExportNamedDeclaration: normalizeOptionValue(options.ExportDeclaration) + ExportNamedDeclaration: normalizeOptionValue(options.ExportDeclaration), + TSTypeLiteral: normalizeOptionValue(options.TSTypeLiteral), + TSInterfaceBody: normalizeOptionValue(options.TSInterfaceBody) }; } const value = normalizeOptionValue(options); - return { ObjectExpression: value, ObjectPattern: value, ImportDeclaration: value, ExportNamedDeclaration: value }; + return { ObjectExpression: value, ObjectPattern: value, ImportDeclaration: value, ExportNamedDeclaration: value, TSTypeLiteral: value, TSInterfaceBody: value }; } function areLineBreaksRequired(node, options, first, last) { let objectProperties; if (node.type === "ObjectExpression" || node.type === "ObjectPattern") { objectProperties = node.properties; + } else if (node.type === "TSTypeLiteral") { + objectProperties = node.members; + } else if (node.type === "TSInterfaceBody") { + objectProperties = node.body; } else { objectProperties = node.specifiers.filter((s) => s.type === "ImportSpecifier" || s.type === "ExportSpecifier"); } @@ -91,7 +97,9 @@ var objectCurlyNewline = utils.createRule({ ObjectExpression: OPTION_VALUE, ObjectPattern: OPTION_VALUE, ImportDeclaration: OPTION_VALUE, - ExportDeclaration: OPTION_VALUE + ExportDeclaration: OPTION_VALUE, + TSTypeLiteral: OPTION_VALUE, + TSInterfaceBody: OPTION_VALUE }, additionalProperties: false, minProperties: 1 @@ -192,7 +200,9 @@ var objectCurlyNewline = utils.createRule({ ObjectExpression: check, ObjectPattern: check, ImportDeclaration: check, - ExportNamedDeclaration: check + ExportNamedDeclaration: check, + TSTypeLiteral: check, + TSInterfaceBody: check }; } }); diff --git a/tools/eslint/node_modules/@stylistic/eslint-plugin-js/package.json b/tools/eslint/node_modules/@stylistic/eslint-plugin-js/package.json index bb8c080e64a810..2b5c6051b4bd6f 100644 --- a/tools/eslint/node_modules/@stylistic/eslint-plugin-js/package.json +++ b/tools/eslint/node_modules/@stylistic/eslint-plugin-js/package.json @@ -1,6 +1,6 @@ { "name": "@stylistic/eslint-plugin-js", - "version": "2.2.2", + "version": "2.3.0", "author": "Anthony Fu ", "license": "MIT", "homepage": "https://github.com/eslint-stylistic/eslint-stylistic#readme", diff --git a/tools/eslint/node_modules/@typescript-eslint/types/package.json b/tools/eslint/node_modules/@typescript-eslint/types/package.json index 155385bc82a9fe..86733c7ec98142 100644 --- a/tools/eslint/node_modules/@typescript-eslint/types/package.json +++ b/tools/eslint/node_modules/@typescript-eslint/types/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/types", - "version": "7.13.1", + "version": "7.14.1", "description": "Types for the TypeScript-ESTree AST spec", "files": [ "dist", diff --git a/tools/eslint/node_modules/es-module-lexer/LICENSE b/tools/eslint/node_modules/es-module-lexer/LICENSE new file mode 100644 index 00000000000000..c795a2775f8af8 --- /dev/null +++ b/tools/eslint/node_modules/es-module-lexer/LICENSE @@ -0,0 +1,10 @@ +MIT License +----------- + +Copyright (C) 2018-2022 Guy Bedford + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tools/eslint/node_modules/es-module-lexer/dist/lexer.asm.js b/tools/eslint/node_modules/es-module-lexer/dist/lexer.asm.js new file mode 100644 index 00000000000000..d771a33c62538d --- /dev/null +++ b/tools/eslint/node_modules/es-module-lexer/dist/lexer.asm.js @@ -0,0 +1,2 @@ +/* es-module-lexer 1.5.4 */ +let e,a,r,i=2<<19;const s=1===new Uint8Array(new Uint16Array([1]).buffer)[0]?function(e,a){const r=e.length;let i=0;for(;i>>8}},f="xportmportlassforetaourceromsyncunctionssertvoyiedelecontininstantybreareturdebuggeawaithrwhileifcatcfinallels";let t,c,n;export function parse(k,l="@"){t=k,c=l;const u=2*t.length+(2<<18);if(u>i||!e){for(;u>i;)i*=2;a=new ArrayBuffer(i),s(f,new Uint16Array(a,16,110)),e=function(e,a,r){"use asm";var i=new e.Int8Array(r),s=new e.Int16Array(r),f=new e.Int32Array(r),t=new e.Uint8Array(r),c=new e.Uint16Array(r),n=1040;function b(){var e=0,a=0,r=0,t=0,c=0,b=0,u=0;u=n;n=n+10240|0;i[804]=1;i[803]=0;s[399]=0;s[400]=0;f[69]=f[2];i[805]=0;f[68]=0;i[802]=0;f[70]=u+2048;f[71]=u;i[806]=0;e=(f[3]|0)+-2|0;f[72]=e;a=e+(f[66]<<1)|0;f[73]=a;e:while(1){r=e+2|0;f[72]=r;if(e>>>0>=a>>>0){t=18;break}a:do{switch(s[r>>1]|0){case 9:case 10:case 11:case 12:case 13:case 32:break;case 101:{if((((s[400]|0)==0?H(r)|0:0)?(m(e+4|0,16,10)|0)==0:0)?(k(),(i[804]|0)==0):0){t=9;break e}else t=17;break}case 105:{if(H(r)|0?(m(e+4|0,26,10)|0)==0:0){l();t=17}else t=17;break}case 59:{t=17;break}case 47:switch(s[e+4>>1]|0){case 47:{P();break a}case 42:{y(1);break a}default:{t=16;break e}}default:{t=16;break e}}}while(0);if((t|0)==17){t=0;f[69]=f[72]}e=f[72]|0;a=f[73]|0}if((t|0)==9){e=f[72]|0;f[69]=e;t=19}else if((t|0)==16){i[804]=0;f[72]=e;t=19}else if((t|0)==18)if(!(i[802]|0)){e=r;t=19}else e=0;do{if((t|0)==19){e:while(1){a=e+2|0;f[72]=a;if(e>>>0>=(f[73]|0)>>>0){t=92;break}a:do{switch(s[a>>1]|0){case 9:case 10:case 11:case 12:case 13:case 32:break;case 101:{if(((s[400]|0)==0?H(a)|0:0)?(m(e+4|0,16,10)|0)==0:0){k();t=91}else t=91;break}case 105:{if(H(a)|0?(m(e+4|0,26,10)|0)==0:0){l();t=91}else t=91;break}case 99:{if((H(a)|0?(m(e+4|0,36,8)|0)==0:0)?V(s[e+12>>1]|0)|0:0){i[806]=1;t=91}else t=91;break}case 40:{r=f[70]|0;e=s[400]|0;t=e&65535;f[r+(t<<3)>>2]=1;a=f[69]|0;s[400]=e+1<<16>>16;f[r+(t<<3)+4>>2]=a;t=91;break}case 41:{a=s[400]|0;if(!(a<<16>>16)){t=36;break e}r=a+-1<<16>>16;s[400]=r;t=s[399]|0;a=t&65535;if(t<<16>>16!=0?(f[(f[70]|0)+((r&65535)<<3)>>2]|0)==5:0){a=f[(f[71]|0)+(a+-1<<2)>>2]|0;r=a+4|0;if(!(f[r>>2]|0))f[r>>2]=(f[69]|0)+2;f[a+12>>2]=e+4;s[399]=t+-1<<16>>16;t=91}else t=91;break}case 123:{t=f[69]|0;r=f[63]|0;e=t;do{if((s[t>>1]|0)==41&(r|0)!=0?(f[r+4>>2]|0)==(t|0):0){a=f[64]|0;f[63]=a;if(!a){f[59]=0;break}else{f[a+32>>2]=0;break}}}while(0);r=f[70]|0;a=s[400]|0;t=a&65535;f[r+(t<<3)>>2]=(i[806]|0)==0?2:6;s[400]=a+1<<16>>16;f[r+(t<<3)+4>>2]=e;i[806]=0;t=91;break}case 125:{e=s[400]|0;if(!(e<<16>>16)){t=49;break e}r=f[70]|0;t=e+-1<<16>>16;s[400]=t;if((f[r+((t&65535)<<3)>>2]|0)==4){h();t=91}else t=91;break}case 39:{v(39);t=91;break}case 34:{v(34);t=91;break}case 47:switch(s[e+4>>1]|0){case 47:{P();break a}case 42:{y(1);break a}default:{e=f[69]|0;a=s[e>>1]|0;r:do{if(!(U(a)|0))if(a<<16>>16==41){r=s[400]|0;if(!(D(f[(f[70]|0)+((r&65535)<<3)+4>>2]|0)|0))t=65}else t=64;else switch(a<<16>>16){case 46:if(((s[e+-2>>1]|0)+-48&65535)<10){t=64;break r}else break r;case 43:if((s[e+-2>>1]|0)==43){t=64;break r}else break r;case 45:if((s[e+-2>>1]|0)==45){t=64;break r}else break r;default:break r}}while(0);if((t|0)==64){r=s[400]|0;t=65}r:do{if((t|0)==65){t=0;if(r<<16>>16!=0?(c=f[70]|0,b=(r&65535)+-1|0,a<<16>>16==102?(f[c+(b<<3)>>2]|0)==1:0):0){if((s[e+-2>>1]|0)==111?$(f[c+(b<<3)+4>>2]|0,44,3)|0:0)break}else t=69;if((t|0)==69?(0,a<<16>>16==125):0){t=f[70]|0;r=r&65535;if(p(f[t+(r<<3)+4>>2]|0)|0)break;if((f[t+(r<<3)>>2]|0)==6)break}if(!(o(e)|0)){switch(a<<16>>16){case 0:break r;case 47:{if(i[805]|0)break r;break}default:{}}t=f[65]|0;if((t|0?e>>>0>=(f[t>>2]|0)>>>0:0)?e>>>0<=(f[t+4>>2]|0)>>>0:0){g();i[805]=0;t=91;break a}r=f[3]|0;do{if(e>>>0<=r>>>0)break;e=e+-2|0;f[69]=e;a=s[e>>1]|0}while(!(E(a)|0));if(F(a)|0){do{if(e>>>0<=r>>>0)break;e=e+-2|0;f[69]=e}while(F(s[e>>1]|0)|0);if(j(e)|0){g();i[805]=0;t=91;break a}}i[805]=1;t=91;break a}}}while(0);g();i[805]=0;t=91;break a}}case 96:{r=f[70]|0;a=s[400]|0;t=a&65535;f[r+(t<<3)+4>>2]=f[69];s[400]=a+1<<16>>16;f[r+(t<<3)>>2]=3;h();t=91;break}default:t=91}}while(0);if((t|0)==91){t=0;f[69]=f[72]}e=f[72]|0}if((t|0)==36){T();e=0;break}else if((t|0)==49){T();e=0;break}else if((t|0)==92){e=(i[802]|0)==0?(s[399]|s[400])<<16>>16==0:0;break}}}while(0);n=u;return e|0}function k(){var e=0,a=0,r=0,t=0,c=0,n=0,b=0,k=0,l=0,o=0,h=0,d=0,C=0,g=0;k=f[72]|0;l=f[65]|0;g=k+12|0;f[72]=g;r=w(1)|0;e=f[72]|0;if(!((e|0)==(g|0)?!(I(r)|0):0))C=3;e:do{if((C|0)==3){a:do{switch(r<<16>>16){case 123:{f[72]=e+2;e=w(1)|0;a=f[72]|0;while(1){if(W(e)|0){v(e);e=(f[72]|0)+2|0;f[72]=e}else{q(e)|0;e=f[72]|0}w(1)|0;e=A(a,e)|0;if(e<<16>>16==44){f[72]=(f[72]|0)+2;e=w(1)|0}if(e<<16>>16==125){C=15;break}g=a;a=f[72]|0;if((a|0)==(g|0)){C=12;break}if(a>>>0>(f[73]|0)>>>0){C=14;break}}if((C|0)==12){T();break e}else if((C|0)==14){T();break e}else if((C|0)==15){i[803]=1;f[72]=(f[72]|0)+2;break a}break}case 42:{f[72]=e+2;w(1)|0;g=f[72]|0;A(g,g)|0;break}default:{i[804]=0;switch(r<<16>>16){case 100:{k=e+14|0;f[72]=k;switch((w(1)|0)<<16>>16){case 97:{a=f[72]|0;if((m(a+2|0,72,8)|0)==0?(c=a+10|0,F(s[c>>1]|0)|0):0){f[72]=c;w(0)|0;C=22}break}case 102:{C=22;break}case 99:{a=f[72]|0;if(((m(a+2|0,36,8)|0)==0?(t=a+10|0,g=s[t>>1]|0,V(g)|0|g<<16>>16==123):0)?(f[72]=t,n=w(1)|0,n<<16>>16!=123):0){d=n;C=31}break}default:{}}r:do{if((C|0)==22?(b=f[72]|0,(m(b+2|0,80,14)|0)==0):0){r=b+16|0;a=s[r>>1]|0;if(!(V(a)|0))switch(a<<16>>16){case 40:case 42:break;default:break r}f[72]=r;a=w(1)|0;if(a<<16>>16==42){f[72]=(f[72]|0)+2;a=w(1)|0}if(a<<16>>16!=40){d=a;C=31}}}while(0);if((C|0)==31?(o=f[72]|0,q(d)|0,h=f[72]|0,h>>>0>o>>>0):0){O(e,k,o,h);f[72]=(f[72]|0)+-2;break e}O(e,k,0,0);f[72]=e+12;break e}case 97:{f[72]=e+10;w(0)|0;e=f[72]|0;C=35;break}case 102:{C=35;break}case 99:{if((m(e+2|0,36,8)|0)==0?(a=e+10|0,E(s[a>>1]|0)|0):0){f[72]=a;g=w(1)|0;C=f[72]|0;q(g)|0;g=f[72]|0;O(C,g,C,g);f[72]=(f[72]|0)+-2;break e}e=e+4|0;f[72]=e;break}case 108:case 118:break;default:break e}if((C|0)==35){f[72]=e+16;e=w(1)|0;if(e<<16>>16==42){f[72]=(f[72]|0)+2;e=w(1)|0}C=f[72]|0;q(e)|0;g=f[72]|0;O(C,g,C,g);f[72]=(f[72]|0)+-2;break e}f[72]=e+6;i[804]=0;r=w(1)|0;e=f[72]|0;r=(q(r)|0|32)<<16>>16==123;t=f[72]|0;if(r){f[72]=t+2;g=w(1)|0;e=f[72]|0;q(g)|0}r:while(1){a=f[72]|0;if((a|0)==(e|0))break;O(e,a,e,a);a=w(1)|0;if(r)switch(a<<16>>16){case 93:case 125:break e;default:{}}e=f[72]|0;if(a<<16>>16!=44){C=51;break}f[72]=e+2;a=w(1)|0;e=f[72]|0;switch(a<<16>>16){case 91:case 123:{C=51;break r}default:{}}q(a)|0}if((C|0)==51)f[72]=e+-2;if(!r)break e;f[72]=t+-2;break e}}}while(0);g=(w(1)|0)<<16>>16==102;e=f[72]|0;if(g?(m(e+2|0,66,6)|0)==0:0){f[72]=e+8;u(k,w(1)|0,0);e=(l|0)==0?240:l+16|0;while(1){e=f[e>>2]|0;if(!e)break e;f[e+12>>2]=0;f[e+8>>2]=0;e=e+16|0}}f[72]=e+-2}}while(0);return}function l(){var e=0,a=0,r=0,t=0,c=0,n=0,b=0;c=f[72]|0;r=c+12|0;f[72]=r;t=w(1)|0;a=f[72]|0;e:do{if(t<<16>>16!=46)if(t<<16>>16==115&a>>>0>r>>>0)if((m(a+2|0,56,10)|0)==0?(e=a+12|0,V(s[e>>1]|0)|0):0)n=14;else{a=6;r=0;n=46}else{e=t;r=0;n=15}else{f[72]=a+2;switch((w(1)|0)<<16>>16){case 109:{e=f[72]|0;if(m(e+2|0,50,6)|0)break e;a=f[69]|0;if(!(G(a)|0)?(s[a>>1]|0)==46:0)break e;d(c,c,e+8|0,2);break e}case 115:{e=f[72]|0;if(m(e+2|0,56,10)|0)break e;a=f[69]|0;if(!(G(a)|0)?(s[a>>1]|0)==46:0)break e;e=e+12|0;n=14;break e}default:break e}}}while(0);if((n|0)==14){f[72]=e;e=w(1)|0;r=1;n=15}e:do{if((n|0)==15)switch(e<<16>>16){case 40:{a=f[70]|0;b=s[400]|0;t=b&65535;f[a+(t<<3)>>2]=5;e=f[72]|0;s[400]=b+1<<16>>16;f[a+(t<<3)+4>>2]=e;if((s[f[69]>>1]|0)==46)break e;f[72]=e+2;a=w(1)|0;d(c,f[72]|0,0,e);if(r){e=f[63]|0;f[e+28>>2]=5}else e=f[63]|0;c=f[71]|0;b=s[399]|0;s[399]=b+1<<16>>16;f[c+((b&65535)<<2)>>2]=e;switch(a<<16>>16){case 39:{v(39);break}case 34:{v(34);break}default:{f[72]=(f[72]|0)+-2;break e}}e=(f[72]|0)+2|0;f[72]=e;switch((w(1)|0)<<16>>16){case 44:{f[72]=(f[72]|0)+2;w(1)|0;c=f[63]|0;f[c+4>>2]=e;b=f[72]|0;f[c+16>>2]=b;i[c+24>>0]=1;f[72]=b+-2;break e}case 41:{s[400]=(s[400]|0)+-1<<16>>16;b=f[63]|0;f[b+4>>2]=e;f[b+12>>2]=(f[72]|0)+2;i[b+24>>0]=1;s[399]=(s[399]|0)+-1<<16>>16;break e}default:{f[72]=(f[72]|0)+-2;break e}}}case 123:{if(r){a=12;r=1;n=46;break e}e=f[72]|0;if(s[400]|0){f[72]=e+-2;break e}while(1){if(e>>>0>=(f[73]|0)>>>0)break;e=w(1)|0;if(!(W(e)|0)){if(e<<16>>16==125){n=36;break}}else v(e);e=(f[72]|0)+2|0;f[72]=e}if((n|0)==36)f[72]=(f[72]|0)+2;b=(w(1)|0)<<16>>16==102;e=f[72]|0;if(b?m(e+2|0,66,6)|0:0){T();break e}f[72]=e+8;e=w(1)|0;if(W(e)|0){u(c,e,0);break e}else{T();break e}}default:{if(r){a=12;r=1;n=46;break e}switch(e<<16>>16){case 42:case 39:case 34:{r=0;n=48;break e}default:{a=6;r=0;n=46;break e}}}}}while(0);if((n|0)==46){e=f[72]|0;if((e|0)==(c+(a<<1)|0))f[72]=e+-2;else n=48}do{if((n|0)==48){if(s[400]|0){f[72]=(f[72]|0)+-2;break}e=f[73]|0;a=f[72]|0;while(1){if(a>>>0>=e>>>0){n=55;break}t=s[a>>1]|0;if(W(t)|0){n=53;break}b=a+2|0;f[72]=b;a=b}if((n|0)==53){u(c,t,r);break}else if((n|0)==55){T();break}}}while(0);return}function u(e,a,r){e=e|0;a=a|0;r=r|0;var i=0,t=0;i=(f[72]|0)+2|0;switch(a<<16>>16){case 39:{v(39);t=5;break}case 34:{v(34);t=5;break}default:T()}do{if((t|0)==5){d(e,i,f[72]|0,1);if(r)f[(f[63]|0)+28>>2]=4;f[72]=(f[72]|0)+2;a=w(0)|0;r=a<<16>>16==97;if(r){i=f[72]|0;if(m(i+2|0,94,10)|0)t=13}else{i=f[72]|0;if(!(((a<<16>>16==119?(s[i+2>>1]|0)==105:0)?(s[i+4>>1]|0)==116:0)?(s[i+6>>1]|0)==104:0))t=13}if((t|0)==13){f[72]=i+-2;break}f[72]=i+((r?6:4)<<1);if((w(1)|0)<<16>>16!=123){f[72]=i;break}r=f[72]|0;a=r;e:while(1){f[72]=a+2;a=w(1)|0;switch(a<<16>>16){case 39:{v(39);f[72]=(f[72]|0)+2;a=w(1)|0;break}case 34:{v(34);f[72]=(f[72]|0)+2;a=w(1)|0;break}default:a=q(a)|0}if(a<<16>>16!=58){t=22;break}f[72]=(f[72]|0)+2;switch((w(1)|0)<<16>>16){case 39:{v(39);break}case 34:{v(34);break}default:{t=26;break e}}f[72]=(f[72]|0)+2;switch((w(1)|0)<<16>>16){case 125:{t=31;break e}case 44:break;default:{t=30;break e}}f[72]=(f[72]|0)+2;if((w(1)|0)<<16>>16==125){t=31;break}a=f[72]|0}if((t|0)==22){f[72]=i;break}else if((t|0)==26){f[72]=i;break}else if((t|0)==30){f[72]=i;break}else if((t|0)==31){t=f[63]|0;f[t+16>>2]=r;f[t+12>>2]=(f[72]|0)+2;break}}}while(0);return}function o(e){e=e|0;e:do{switch(s[e>>1]|0){case 100:switch(s[e+-2>>1]|0){case 105:{e=$(e+-4|0,104,2)|0;break e}case 108:{e=$(e+-4|0,108,3)|0;break e}default:{e=0;break e}}case 101:switch(s[e+-2>>1]|0){case 115:switch(s[e+-4>>1]|0){case 108:{e=B(e+-6|0,101)|0;break e}case 97:{e=B(e+-6|0,99)|0;break e}default:{e=0;break e}}case 116:{e=$(e+-4|0,114,4)|0;break e}case 117:{e=$(e+-4|0,122,6)|0;break e}default:{e=0;break e}}case 102:{if((s[e+-2>>1]|0)==111?(s[e+-4>>1]|0)==101:0)switch(s[e+-6>>1]|0){case 99:{e=$(e+-8|0,134,6)|0;break e}case 112:{e=$(e+-8|0,146,2)|0;break e}default:{e=0;break e}}else e=0;break}case 107:{e=$(e+-2|0,150,4)|0;break}case 110:{e=e+-2|0;if(B(e,105)|0)e=1;else e=$(e,158,5)|0;break}case 111:{e=B(e+-2|0,100)|0;break}case 114:{e=$(e+-2|0,168,7)|0;break}case 116:{e=$(e+-2|0,182,4)|0;break}case 119:switch(s[e+-2>>1]|0){case 101:{e=B(e+-4|0,110)|0;break e}case 111:{e=$(e+-4|0,190,3)|0;break e}default:{e=0;break e}}default:e=0}}while(0);return e|0}function h(){var e=0,a=0,r=0,i=0;a=f[73]|0;r=f[72]|0;e:while(1){e=r+2|0;if(r>>>0>=a>>>0){a=10;break}switch(s[e>>1]|0){case 96:{a=7;break e}case 36:{if((s[r+4>>1]|0)==123){a=6;break e}break}case 92:{e=r+4|0;break}default:{}}r=e}if((a|0)==6){e=r+4|0;f[72]=e;a=f[70]|0;i=s[400]|0;r=i&65535;f[a+(r<<3)>>2]=4;s[400]=i+1<<16>>16;f[a+(r<<3)+4>>2]=e}else if((a|0)==7){f[72]=e;r=f[70]|0;i=(s[400]|0)+-1<<16>>16;s[400]=i;if((f[r+((i&65535)<<3)>>2]|0)!=3)T()}else if((a|0)==10){f[72]=e;T()}return}function w(e){e=e|0;var a=0,r=0,i=0;r=f[72]|0;e:do{a=s[r>>1]|0;a:do{if(a<<16>>16!=47)if(e)if(V(a)|0)break;else break e;else if(F(a)|0)break;else break e;else switch(s[r+2>>1]|0){case 47:{P();break a}case 42:{y(e);break a}default:{a=47;break e}}}while(0);i=f[72]|0;r=i+2|0;f[72]=r}while(i>>>0<(f[73]|0)>>>0);return a|0}function d(e,a,r,s){e=e|0;a=a|0;r=r|0;s=s|0;var t=0,c=0;c=f[67]|0;f[67]=c+36;t=f[63]|0;f[((t|0)==0?236:t+32|0)>>2]=c;f[64]=t;f[63]=c;f[c+8>>2]=e;if(2==(s|0)){e=3;t=r}else{t=1==(s|0);e=t?1:2;t=t?r+2|0:0}f[c+12>>2]=t;f[c+28>>2]=e;f[c>>2]=a;f[c+4>>2]=r;f[c+16>>2]=0;f[c+20>>2]=s;a=1==(s|0);i[c+24>>0]=a&1;f[c+32>>2]=0;if(a|2==(s|0))i[803]=1;return}function v(e){e=e|0;var a=0,r=0,i=0,t=0;t=f[73]|0;a=f[72]|0;while(1){i=a+2|0;if(a>>>0>=t>>>0){a=9;break}r=s[i>>1]|0;if(r<<16>>16==e<<16>>16){a=10;break}if(r<<16>>16==92){r=a+4|0;if((s[r>>1]|0)==13){a=a+6|0;a=(s[a>>1]|0)==10?a:r}else a=r}else if(Z(r)|0){a=9;break}else a=i}if((a|0)==9){f[72]=i;T()}else if((a|0)==10)f[72]=i;return}function A(e,a){e=e|0;a=a|0;var r=0,i=0,t=0,c=0;r=f[72]|0;i=s[r>>1]|0;c=(e|0)==(a|0);t=c?0:e;c=c?0:a;if(i<<16>>16==97){f[72]=r+4;r=w(1)|0;e=f[72]|0;if(W(r)|0){v(r);a=(f[72]|0)+2|0;f[72]=a}else{q(r)|0;a=f[72]|0}i=w(1)|0;r=f[72]|0}if((r|0)!=(e|0))O(e,a,t,c);return i|0}function C(){var e=0,a=0,r=0;r=f[73]|0;a=f[72]|0;e:while(1){e=a+2|0;if(a>>>0>=r>>>0){a=6;break}switch(s[e>>1]|0){case 13:case 10:{a=6;break e}case 93:{a=7;break e}case 92:{e=a+4|0;break}default:{}}a=e}if((a|0)==6){f[72]=e;T();e=0}else if((a|0)==7){f[72]=e;e=93}return e|0}function g(){var e=0,a=0,r=0;e:while(1){e=f[72]|0;a=e+2|0;f[72]=a;if(e>>>0>=(f[73]|0)>>>0){r=7;break}switch(s[a>>1]|0){case 13:case 10:{r=7;break e}case 47:break e;case 91:{C()|0;break}case 92:{f[72]=e+4;break}default:{}}}if((r|0)==7)T();return}function p(e){e=e|0;switch(s[e>>1]|0){case 62:{e=(s[e+-2>>1]|0)==61;break}case 41:case 59:{e=1;break}case 104:{e=$(e+-2|0,210,4)|0;break}case 121:{e=$(e+-2|0,218,6)|0;break}case 101:{e=$(e+-2|0,230,3)|0;break}default:e=0}return e|0}function y(e){e=e|0;var a=0,r=0,i=0,t=0,c=0;t=(f[72]|0)+2|0;f[72]=t;r=f[73]|0;while(1){a=t+2|0;if(t>>>0>=r>>>0)break;i=s[a>>1]|0;if(!e?Z(i)|0:0)break;if(i<<16>>16==42?(s[t+4>>1]|0)==47:0){c=8;break}t=a}if((c|0)==8){f[72]=a;a=t+4|0}f[72]=a;return}function m(e,a,r){e=e|0;a=a|0;r=r|0;var s=0,f=0;e:do{if(!r)e=0;else{while(1){s=i[e>>0]|0;f=i[a>>0]|0;if(s<<24>>24!=f<<24>>24)break;r=r+-1|0;if(!r){e=0;break e}else{e=e+1|0;a=a+1|0}}e=(s&255)-(f&255)|0}}while(0);return e|0}function I(e){e=e|0;e:do{switch(e<<16>>16){case 38:case 37:case 33:{e=1;break}default:if((e&-8)<<16>>16==40|(e+-58&65535)<6)e=1;else{switch(e<<16>>16){case 91:case 93:case 94:{e=1;break e}default:{}}e=(e+-123&65535)<4}}}while(0);return e|0}function U(e){e=e|0;e:do{switch(e<<16>>16){case 38:case 37:case 33:break;default:if(!((e+-58&65535)<6|(e+-40&65535)<7&e<<16>>16!=41)){switch(e<<16>>16){case 91:case 94:break e;default:{}}return e<<16>>16!=125&(e+-123&65535)<4|0}}}while(0);return 1}function x(e){e=e|0;var a=0;a=s[e>>1]|0;e:do{if((a+-9&65535)>=5){switch(a<<16>>16){case 160:case 32:{a=1;break e}default:{}}if(I(a)|0)return a<<16>>16!=46|(G(e)|0)|0;else a=0}else a=1}while(0);return a|0}function S(e){e=e|0;var a=0,r=0,i=0,t=0;r=n;n=n+16|0;i=r;f[i>>2]=0;f[66]=e;a=f[3]|0;t=a+(e<<1)|0;e=t+2|0;s[t>>1]=0;f[i>>2]=e;f[67]=e;f[59]=0;f[63]=0;f[61]=0;f[60]=0;f[65]=0;f[62]=0;n=r;return a|0}function O(e,a,r,s){e=e|0;a=a|0;r=r|0;s=s|0;var t=0,c=0;t=f[67]|0;f[67]=t+20;c=f[65]|0;f[((c|0)==0?240:c+16|0)>>2]=t;f[65]=t;f[t>>2]=e;f[t+4>>2]=a;f[t+8>>2]=r;f[t+12>>2]=s;f[t+16>>2]=0;i[803]=1;return}function $(e,a,r){e=e|0;a=a|0;r=r|0;var i=0,s=0;i=e+(0-r<<1)|0;s=i+2|0;e=f[3]|0;if(s>>>0>=e>>>0?(m(s,a,r<<1)|0)==0:0)if((s|0)==(e|0))e=1;else e=x(i)|0;else e=0;return e|0}function j(e){e=e|0;switch(s[e>>1]|0){case 107:{e=$(e+-2|0,150,4)|0;break}case 101:{if((s[e+-2>>1]|0)==117)e=$(e+-4|0,122,6)|0;else e=0;break}default:e=0}return e|0}function B(e,a){e=e|0;a=a|0;var r=0;r=f[3]|0;if(r>>>0<=e>>>0?(s[e>>1]|0)==a<<16>>16:0)if((r|0)==(e|0))r=1;else r=E(s[e+-2>>1]|0)|0;else r=0;return r|0}function E(e){e=e|0;e:do{if((e+-9&65535)<5)e=1;else{switch(e<<16>>16){case 32:case 160:{e=1;break e}default:{}}e=e<<16>>16!=46&(I(e)|0)}}while(0);return e|0}function P(){var e=0,a=0,r=0;e=f[73]|0;r=f[72]|0;e:while(1){a=r+2|0;if(r>>>0>=e>>>0)break;switch(s[a>>1]|0){case 13:case 10:break e;default:r=a}}f[72]=a;return}function q(e){e=e|0;while(1){if(V(e)|0)break;if(I(e)|0)break;e=(f[72]|0)+2|0;f[72]=e;e=s[e>>1]|0;if(!(e<<16>>16)){e=0;break}}return e|0}function z(){var e=0;e=f[(f[61]|0)+20>>2]|0;switch(e|0){case 1:{e=-1;break}case 2:{e=-2;break}default:e=e-(f[3]|0)>>1}return e|0}function D(e){e=e|0;if(!($(e,196,5)|0)?!($(e,44,3)|0):0)e=$(e,206,2)|0;else e=1;return e|0}function F(e){e=e|0;switch(e<<16>>16){case 160:case 32:case 12:case 11:case 9:{e=1;break}default:e=0}return e|0}function G(e){e=e|0;if((s[e>>1]|0)==46?(s[e+-2>>1]|0)==46:0)e=(s[e+-4>>1]|0)==46;else e=0;return e|0}function H(e){e=e|0;if((f[3]|0)==(e|0))e=1;else e=x(e+-2|0)|0;return e|0}function J(){var e=0;e=f[(f[62]|0)+12>>2]|0;if(!e)e=-1;else e=e-(f[3]|0)>>1;return e|0}function K(){var e=0;e=f[(f[61]|0)+12>>2]|0;if(!e)e=-1;else e=e-(f[3]|0)>>1;return e|0}function L(){var e=0;e=f[(f[62]|0)+8>>2]|0;if(!e)e=-1;else e=e-(f[3]|0)>>1;return e|0}function M(){var e=0;e=f[(f[61]|0)+16>>2]|0;if(!e)e=-1;else e=e-(f[3]|0)>>1;return e|0}function N(){var e=0;e=f[(f[61]|0)+4>>2]|0;if(!e)e=-1;else e=e-(f[3]|0)>>1;return e|0}function Q(){var e=0;e=f[61]|0;e=f[((e|0)==0?236:e+32|0)>>2]|0;f[61]=e;return(e|0)!=0|0}function R(){var e=0;e=f[62]|0;e=f[((e|0)==0?240:e+16|0)>>2]|0;f[62]=e;return(e|0)!=0|0}function T(){i[802]=1;f[68]=(f[72]|0)-(f[3]|0)>>1;f[72]=(f[73]|0)+2;return}function V(e){e=e|0;return(e|128)<<16>>16==160|(e+-9&65535)<5|0}function W(e){e=e|0;return e<<16>>16==39|e<<16>>16==34|0}function X(){return(f[(f[61]|0)+8>>2]|0)-(f[3]|0)>>1|0}function Y(){return(f[(f[62]|0)+4>>2]|0)-(f[3]|0)>>1|0}function Z(e){e=e|0;return e<<16>>16==13|e<<16>>16==10|0}function _(){return(f[f[61]>>2]|0)-(f[3]|0)>>1|0}function ee(){return(f[f[62]>>2]|0)-(f[3]|0)>>1|0}function ae(){return t[(f[61]|0)+24>>0]|0|0}function re(e){e=e|0;f[3]=e;return}function ie(){return f[(f[61]|0)+28>>2]|0}function se(){return(i[803]|0)!=0|0}function fe(){return(i[804]|0)!=0|0}function te(){return f[68]|0}function ce(e){e=e|0;n=e+992+15&-16;return 992}return{su:ce,ai:M,e:te,ee:Y,ele:J,els:L,es:ee,f:fe,id:z,ie:N,ip:ae,is:_,it:ie,ms:se,p:b,re:R,ri:Q,sa:S,se:K,ses:re,ss:X}}("undefined"!=typeof self?self:global,{},a),r=e.su(i-(2<<17))}const h=t.length+1;e.ses(r),e.sa(h-1),s(t,new Uint16Array(a,r,h)),e.p()||(n=e.e(),o());const w=[],d=[];for(;e.ri();){const a=e.is(),r=e.ie(),i=e.ai(),s=e.id(),f=e.ss(),c=e.se(),n=e.it();let k;e.ip()&&(k=b(-1===s?a:a+1,t.charCodeAt(-1===s?a-1:a))),w.push({t:n,n:k,s:a,e:r,ss:f,se:c,d:s,a:i})}for(;e.re();){const a=e.es(),r=e.ee(),i=e.els(),s=e.ele(),f=t.charCodeAt(a),c=i>=0?t.charCodeAt(i):-1;d.push({s:a,e:r,ls:i,le:s,n:34===f||39===f?b(a+1,f):t.slice(a,r),ln:i<0?void 0:34===c||39===c?b(i+1,c):t.slice(i,s)})}return[w,d,!!e.f(),!!e.ms()]}function b(e,a){n=e;let r="",i=n;for(;;){n>=t.length&&o();const e=t.charCodeAt(n);if(e===a)break;92===e?(r+=t.slice(i,n),r+=k(),i=n):(8232===e||8233===e||u(e)&&o(),++n)}return r+=t.slice(i,n++),r}function k(){let e=t.charCodeAt(++n);switch(++n,e){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(l(2));case 117:return function(){const e=t.charCodeAt(n);let a;123===e?(++n,a=l(t.indexOf("}",n)-n),++n,a>1114111&&o()):a=l(4);return a<=65535?String.fromCharCode(a):(a-=65536,String.fromCharCode(55296+(a>>10),56320+(1023&a)))}();case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:10===t.charCodeAt(n)&&++n;case 10:return"";case 56:case 57:o();default:if(e>=48&&e<=55){let a=t.substr(n-1,3).match(/^[0-7]+/)[0],r=parseInt(a,8);return r>255&&(a=a.slice(0,-1),r=parseInt(a,8)),n+=a.length-1,e=t.charCodeAt(n),"0"===a&&56!==e&&57!==e||o(),String.fromCharCode(r)}return u(e)?"":String.fromCharCode(e)}}function l(e){const a=n;let r=0,i=0;for(let a=0;a=97)e=s-97+10;else if(s>=65)e=s-65+10;else{if(!(s>=48&&s<=57))break;e=s-48}if(e>=16)break;i=s,r=16*r+e}else 95!==i&&0!==a||o(),i=s}return 95!==i&&n-a===e||o(),r}function u(e){return 13===e||10===e}function o(){throw Object.assign(Error(`Parse error ${c}:${t.slice(0,n).split("\n").length}:${n-t.lastIndexOf("\n",n-1)}`),{idx:n})} diff --git a/tools/eslint/node_modules/es-module-lexer/dist/lexer.cjs b/tools/eslint/node_modules/es-module-lexer/dist/lexer.cjs new file mode 100644 index 00000000000000..178d743dc0ee86 --- /dev/null +++ b/tools/eslint/node_modules/es-module-lexer/dist/lexer.cjs @@ -0,0 +1 @@ +"use strict";var ImportType;exports.init=exports.ImportType=void 0,exports.parse=parse,exports.ImportType=ImportType,function(A){A[A.Static=1]="Static",A[A.Dynamic=2]="Dynamic",A[A.ImportMeta=3]="ImportMeta",A[A.StaticSourcePhase=4]="StaticSourcePhase",A[A.DynamicSourcePhase=5]="DynamicSourcePhase"}(ImportType||(exports.ImportType=ImportType={}));const A=1===new Uint8Array(new Uint16Array([1]).buffer)[0];function parse(E,g="@"){if(!C)return init.then((()=>parse(E)));const I=E.length+1,w=(C.__heap_base.value||C.__heap_base)+4*I-C.memory.buffer.byteLength;w>0&&C.memory.grow(Math.ceil(w/65536));const K=C.sa(I-1);if((A?B:Q)(E,new Uint16Array(C.memory.buffer,K,I)),!C.parse())throw Object.assign(new Error(`Parse error ${g}:${E.slice(0,C.e()).split("\n").length}:${C.e()-E.lastIndexOf("\n",C.e()-1)}`),{idx:C.e()});const o=[],D=[];for(;C.ri();){const A=C.is(),Q=C.ie(),B=C.it(),g=C.ai(),I=C.id(),w=C.ss(),K=C.se();let D;C.ip()&&(D=k(E.slice(-1===I?A-1:A,-1===I?Q+1:Q))),o.push({n:D,t:B,s:A,e:Q,ss:w,se:K,d:I,a:g})}for(;C.re();){const A=C.es(),Q=C.ee(),B=C.els(),g=C.ele(),I=E.slice(A,Q),w=I[0],K=B<0?void 0:E.slice(B,g),o=K?K[0]:"";D.push({s:A,e:Q,ls:B,le:g,n:'"'===w||"'"===w?k(I):I,ln:'"'===o||"'"===o?k(K):K})}function k(A){try{return(0,eval)(A)}catch(A){}}return[o,D,!!C.f(),!!C.ms()]}function Q(A,Q){const B=A.length;let C=0;for(;C>>8}}function B(A,Q){const B=A.length;let C=0;for(;CA.charCodeAt(0))))).then(WebAssembly.instantiate).then((({exports:A})=>{C=A}));var E;exports.init=init; \ No newline at end of file diff --git a/tools/eslint/node_modules/es-module-lexer/dist/lexer.js b/tools/eslint/node_modules/es-module-lexer/dist/lexer.js new file mode 100644 index 00000000000000..030e14e2bf4f39 --- /dev/null +++ b/tools/eslint/node_modules/es-module-lexer/dist/lexer.js @@ -0,0 +1,2 @@ +/* es-module-lexer 1.5.4 */ +export var ImportType;!function(A){A[A.Static=1]="Static",A[A.Dynamic=2]="Dynamic",A[A.ImportMeta=3]="ImportMeta",A[A.StaticSourcePhase=4]="StaticSourcePhase",A[A.DynamicSourcePhase=5]="DynamicSourcePhase"}(ImportType||(ImportType={}));const A=1===new Uint8Array(new Uint16Array([1]).buffer)[0];export function parse(E,g="@"){if(!C)return init.then((()=>parse(E)));const I=E.length+1,w=(C.__heap_base.value||C.__heap_base)+4*I-C.memory.buffer.byteLength;w>0&&C.memory.grow(Math.ceil(w/65536));const K=C.sa(I-1);if((A?B:Q)(E,new Uint16Array(C.memory.buffer,K,I)),!C.parse())throw Object.assign(new Error(`Parse error ${g}:${E.slice(0,C.e()).split("\n").length}:${C.e()-E.lastIndexOf("\n",C.e()-1)}`),{idx:C.e()});const D=[],o=[];for(;C.ri();){const A=C.is(),Q=C.ie(),B=C.it(),g=C.ai(),I=C.id(),w=C.ss(),K=C.se();let o;C.ip()&&(o=k(E.slice(-1===I?A-1:A,-1===I?Q+1:Q))),D.push({n:o,t:B,s:A,e:Q,ss:w,se:K,d:I,a:g})}for(;C.re();){const A=C.es(),Q=C.ee(),B=C.els(),g=C.ele(),I=E.slice(A,Q),w=I[0],K=B<0?void 0:E.slice(B,g),D=K?K[0]:"";o.push({s:A,e:Q,ls:B,le:g,n:'"'===w||"'"===w?k(I):I,ln:'"'===D||"'"===D?k(K):K})}function k(A){try{return(0,eval)(A)}catch(A){}}return[D,o,!!C.f(),!!C.ms()]}function Q(A,Q){const B=A.length;let C=0;for(;C>>8}}function B(A,Q){const B=A.length;let C=0;for(;CA.charCodeAt(0))))).then(WebAssembly.instantiate).then((({exports:A})=>{C=A}));var E; \ No newline at end of file diff --git a/tools/eslint/node_modules/es-module-lexer/lexer.js b/tools/eslint/node_modules/es-module-lexer/lexer.js new file mode 100644 index 00000000000000..587fafe06e18c9 --- /dev/null +++ b/tools/eslint/node_modules/es-module-lexer/lexer.js @@ -0,0 +1,925 @@ +let source, pos, end, + openTokenDepth, + lastTokenPos, + openTokenPosStack, + openClassPosStack, + curDynamicImport, + templateStackDepth, + facade, + lastSlashWasDivision, + nextBraceIsClass, + templateDepth, + templateStack, + imports, + exports, + name; + +function addImport (ss, s, e, d) { + const impt = { ss, se: d === -2 ? e : d === -1 ? e + 1 : 0, s, e, d, a: -1, n: undefined }; + imports.push(impt); + return impt; +} + +function addExport (s, e, ls, le) { + exports.push({ + s, + e, + ls, + le, + n: s[0] === '"' ? readString(s, '"') : s[0] === "'" ? readString(s, "'") : source.slice(s, e), + ln: ls[0] === '"' ? readString(ls, '"') : ls[0] === "'" ? readString(ls, "'") : source.slice(ls, le) + }); +} + +function readName (impt) { + let { d, s } = impt; + if (d !== -1) + s++; + impt.n = readString(s, source.charCodeAt(s - 1)); +} + +// Note: parsing is based on the _assumption_ that the source is already valid +export function parse (_source, _name) { + openTokenDepth = 0; + curDynamicImport = null; + templateDepth = -1; + lastTokenPos = -1; + lastSlashWasDivision = false; + templateStack = Array(1024); + templateStackDepth = 0; + openTokenPosStack = Array(1024); + openClassPosStack = Array(1024); + nextBraceIsClass = false; + facade = true; + name = _name || '@'; + + imports = []; + exports = []; + + source = _source; + pos = -1; + end = source.length - 1; + let ch = 0; + + // start with a pure "module-only" parser + m: while (pos++ < end) { + ch = source.charCodeAt(pos); + + if (ch === 32 || ch < 14 && ch > 8) + continue; + + switch (ch) { + case 101/*e*/: + if (openTokenDepth === 0 && keywordStart(pos) && source.startsWith('xport', pos + 1)) { + tryParseExportStatement(); + // export might have been a non-pure declaration + if (!facade) { + lastTokenPos = pos; + break m; + } + } + break; + case 105/*i*/: + if (keywordStart(pos) && source.startsWith('mport', pos + 1)) + tryParseImportStatement(); + break; + case 59/*;*/: + break; + case 47/*/*/: { + const next_ch = source.charCodeAt(pos + 1); + if (next_ch === 47/*/*/) { + lineComment(); + // dont update lastToken + continue; + } + else if (next_ch === 42/***/) { + blockComment(true); + // dont update lastToken + continue; + } + // fallthrough + } + default: + // as soon as we hit a non-module token, we go to main parser + facade = false; + pos--; + break m; + } + lastTokenPos = pos; + } + + while (pos++ < end) { + ch = source.charCodeAt(pos); + + if (ch === 32 || ch < 14 && ch > 8) + continue; + + switch (ch) { + case 101/*e*/: + if (openTokenDepth === 0 && keywordStart(pos) && source.startsWith('xport', pos + 1)) + tryParseExportStatement(); + break; + case 105/*i*/: + if (keywordStart(pos) && source.startsWith('mport', pos + 1)) + tryParseImportStatement(); + break; + case 99/*c*/: + if (keywordStart(pos) && source.startsWith('lass', pos + 1) && isBrOrWs(source.charCodeAt(pos + 5))) + nextBraceIsClass = true; + break; + case 40/*(*/: + openTokenPosStack[openTokenDepth++] = lastTokenPos; + break; + case 41/*)*/: + if (openTokenDepth === 0) + syntaxError(); + openTokenDepth--; + if (curDynamicImport && curDynamicImport.d === openTokenPosStack[openTokenDepth]) { + if (curDynamicImport.e === 0) + curDynamicImport.e = pos; + curDynamicImport.se = pos; + curDynamicImport = null; + } + break; + case 123/*{*/: + // dynamic import followed by { is not a dynamic import (so remove) + // this is a sneaky way to get around { import () {} } v { import () } + // block / object ambiguity without a parser (assuming source is valid) + if (source.charCodeAt(lastTokenPos) === 41/*)*/ && imports.length && imports[imports.length - 1].e === lastTokenPos) { + imports.pop(); + } + openClassPosStack[openTokenDepth] = nextBraceIsClass; + nextBraceIsClass = false; + openTokenPosStack[openTokenDepth++] = lastTokenPos; + break; + case 125/*}*/: + if (openTokenDepth === 0) + syntaxError(); + if (openTokenDepth-- === templateDepth) { + templateDepth = templateStack[--templateStackDepth]; + templateString(); + } + else { + if (templateDepth !== -1 && openTokenDepth < templateDepth) + syntaxError(); + } + break; + case 39/*'*/: + case 34/*"*/: + stringLiteral(ch); + break; + case 47/*/*/: { + const next_ch = source.charCodeAt(pos + 1); + if (next_ch === 47/*/*/) { + lineComment(); + // dont update lastToken + continue; + } + else if (next_ch === 42/***/) { + blockComment(true); + // dont update lastToken + continue; + } + else { + // Division / regex ambiguity handling based on checking backtrack analysis of: + // - what token came previously (lastToken) + // - if a closing brace or paren, what token came before the corresponding + // opening brace or paren (lastOpenTokenIndex) + const lastToken = source.charCodeAt(lastTokenPos); + const lastExport = exports[exports.length - 1]; + if (isExpressionPunctuator(lastToken) && + !(lastToken === 46/*.*/ && (source.charCodeAt(lastTokenPos - 1) >= 48/*0*/ && source.charCodeAt(lastTokenPos - 1) <= 57/*9*/)) && + !(lastToken === 43/*+*/ && source.charCodeAt(lastTokenPos - 1) === 43/*+*/) && !(lastToken === 45/*-*/ && source.charCodeAt(lastTokenPos - 1) === 45/*-*/) || + lastToken === 41/*)*/ && isParenKeyword(openTokenPosStack[openTokenDepth]) || + lastToken === 125/*}*/ && (isExpressionTerminator(openTokenPosStack[openTokenDepth]) || openClassPosStack[openTokenDepth]) || + lastToken === 47/*/*/ && lastSlashWasDivision || + isExpressionKeyword(lastTokenPos) || + !lastToken) { + regularExpression(); + lastSlashWasDivision = false; + } + else if (lastExport && lastTokenPos >= lastExport.s && lastTokenPos <= lastExport.e) { + // export default /some-regexp/ + regularExpression(); + lastSlashWasDivision = false; + } + else { + lastSlashWasDivision = true; + } + } + break; + } + case 96/*`*/: + templateString(); + break; + } + lastTokenPos = pos; + } + + if (templateDepth !== -1 || openTokenDepth) + syntaxError(); + + return [imports, exports, facade]; +} + +function tryParseImportStatement () { + const startPos = pos; + + pos += 6; + + let ch = commentWhitespace(true); + + switch (ch) { + // dynamic import + case 40/*(*/: + openTokenPosStack[openTokenDepth++] = startPos; + if (source.charCodeAt(lastTokenPos) === 46/*.*/) + return; + // dynamic import indicated by positive d + const impt = addImport(startPos, pos + 1, 0, startPos); + curDynamicImport = impt; + // try parse a string, to record a safe dynamic import string + pos++; + ch = commentWhitespace(true); + if (ch === 39/*'*/ || ch === 34/*"*/) { + stringLiteral(ch); + } + else { + pos--; + return; + } + pos++; + ch = commentWhitespace(true); + if (ch === 44/*,*/) { + impt.e = pos; + pos++; + ch = commentWhitespace(true); + impt.a = pos; + readName(impt); + pos--; + } + else if (ch === 41/*)*/) { + openTokenDepth--; + impt.e = pos; + impt.se = pos; + readName(impt); + } + else { + pos--; + } + return; + // import.meta + case 46/*.*/: + pos++; + ch = commentWhitespace(true); + // import.meta indicated by d === -2 + if (ch === 109/*m*/ && source.startsWith('eta', pos + 1) && source.charCodeAt(lastTokenPos) !== 46/*.*/) + addImport(startPos, startPos, pos + 4, -2); + return; + + default: + // no space after "import" -> not an import keyword + if (pos === startPos + 6) + break; + case 34/*"*/: + case 39/*'*/: + case 123/*{*/: + case 42/***/: + // import statement only permitted at base-level + if (openTokenDepth !== 0) { + pos--; + return; + } + while (pos < end) { + ch = source.charCodeAt(pos); + if (ch === 39/*'*/ || ch === 34/*"*/) { + readImportString(startPos, ch); + return; + } + pos++; + } + syntaxError(); + } +} + +function tryParseExportStatement () { + const sStartPos = pos; + const prevExport = exports.length; + + pos += 6; + + const curPos = pos; + + let ch = commentWhitespace(true); + + if (pos === curPos && !isPunctuator(ch)) + return; + + switch (ch) { + // export default ... + case 100/*d*/: + addExport(pos, pos + 7, -1, -1); + return; + + // export async? function*? name () { + case 97/*a*/: + pos += 5; + commentWhitespace(true); + // fallthrough + case 102/*f*/: + pos += 8; + ch = commentWhitespace(true); + if (ch === 42/***/) { + pos++; + ch = commentWhitespace(true); + } + const startPos = pos; + ch = readToWsOrPunctuator(ch); + addExport(startPos, pos, startPos, pos); + pos--; + return; + + // export class name ... + case 99/*c*/: + if (source.startsWith('lass', pos + 1) && isBrOrWsOrPunctuatorNotDot(source.charCodeAt(pos + 5))) { + pos += 5; + ch = commentWhitespace(true); + const startPos = pos; + ch = readToWsOrPunctuator(ch); + addExport(startPos, pos, startPos, pos); + pos--; + return; + } + pos += 2; + // fallthrough + + // export var/let/const name = ...(, name = ...)+ + case 118/*v*/: + case 109/*l*/: + // destructured initializations not currently supported (skipped for { or [) + // also, lexing names after variable equals is skipped (export var p = function () { ... }, q = 5 skips "q") + pos += 2; + facade = false; + do { + pos++; + ch = commentWhitespace(true); + const startPos = pos; + ch = readToWsOrPunctuator(ch); + // dont yet handle [ { destructurings + if (ch === 123/*{*/ || ch === 91/*[*/) { + pos--; + return; + } + if (pos === startPos) + return; + addExport(startPos, pos, startPos, pos); + ch = commentWhitespace(true); + if (ch === 61/*=*/) { + pos--; + return; + } + } while (ch === 44/*,*/); + pos--; + return; + + + // export {...} + case 123/*{*/: + pos++; + ch = commentWhitespace(true); + while (true) { + const startPos = pos; + readToWsOrPunctuator(ch); + const endPos = pos; + commentWhitespace(true); + ch = readExportAs(startPos, endPos); + // , + if (ch === 44/*,*/) { + pos++; + ch = commentWhitespace(true); + } + if (ch === 125/*}*/) + break; + if (pos === startPos) + return syntaxError(); + if (pos > end) + return syntaxError(); + } + pos++; + ch = commentWhitespace(true); + break; + + // export * + // export * as X + case 42/***/: + pos++; + commentWhitespace(true); + ch = readExportAs(pos, pos); + ch = commentWhitespace(true); + break; + } + + // from ... + if (ch === 102/*f*/ && source.startsWith('rom', pos + 1)) { + pos += 4; + readImportString(sStartPos, commentWhitespace(true)); + + // There were no local names. + for (let i = prevExport; i < exports.length; ++i) { + exports[i].ls = exports[i].le = -1; + exports[i].ln = undefined; + } + } + else { + pos--; + } +} + +/* + * Ported from Acorn + * + * MIT License + + * Copyright (C) 2012-2020 by various contributors (see AUTHORS) + + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +let acornPos; +function readString (start, quote) { + acornPos = start; + let out = '', chunkStart = acornPos; + for (;;) { + if (acornPos >= source.length) syntaxError(); + const ch = source.charCodeAt(acornPos); + if (ch === quote) break; + if (ch === 92) { // '\' + out += source.slice(chunkStart, acornPos); + out += readEscapedChar(); + chunkStart = acornPos; + } + else if (ch === 0x2028 || ch === 0x2029) { + ++acornPos; + } + else { + if (isBr(ch)) syntaxError(); + ++acornPos; + } + } + out += source.slice(chunkStart, acornPos++); + return out; +} + +// Used to read escaped characters + +function readEscapedChar () { + let ch = source.charCodeAt(++acornPos); + ++acornPos; + switch (ch) { + case 110: return '\n'; // 'n' -> '\n' + case 114: return '\r'; // 'r' -> '\r' + case 120: return String.fromCharCode(readHexChar(2)); // 'x' + case 117: return readCodePointToString(); // 'u' + case 116: return '\t'; // 't' -> '\t' + case 98: return '\b'; // 'b' -> '\b' + case 118: return '\u000b'; // 'v' -> '\u000b' + case 102: return '\f'; // 'f' -> '\f' + case 13: if (source.charCodeAt(acornPos) === 10) ++acornPos; // '\r\n' + case 10: // ' \n' + return ''; + case 56: + case 57: + syntaxError(); + default: + if (ch >= 48 && ch <= 55) { + let octalStr = source.substr(acornPos - 1, 3).match(/^[0-7]+/)[0]; + let octal = parseInt(octalStr, 8); + if (octal > 255) { + octalStr = octalStr.slice(0, -1); + octal = parseInt(octalStr, 8); + } + acornPos += octalStr.length - 1; + ch = source.charCodeAt(acornPos); + if (octalStr !== '0' || ch === 56 || ch === 57) + syntaxError(); + return String.fromCharCode(octal); + } + if (isBr(ch)) { + // Unicode new line characters after \ get removed from output in both + // template literals and strings + return ''; + } + return String.fromCharCode(ch); + } +} + +// Used to read character escape sequences ('\x', '\u', '\U'). + +function readHexChar (len) { + const start = acornPos; + let total = 0, lastCode = 0; + for (let i = 0; i < len; ++i, ++acornPos) { + let code = source.charCodeAt(acornPos), val; + + if (code === 95) { + if (lastCode === 95 || i === 0) syntaxError(); + lastCode = code; + continue; + } + + if (code >= 97) val = code - 97 + 10; // a + else if (code >= 65) val = code - 65 + 10; // A + else if (code >= 48 && code <= 57) val = code - 48; // 0-9 + else break; + if (val >= 16) break; + lastCode = code; + total = total * 16 + val; + } + + if (lastCode === 95 || acornPos - start !== len) syntaxError(); + + return total; +} + +// Read a string value, interpreting backslash-escapes. + +function readCodePointToString () { + const ch = source.charCodeAt(acornPos); + let code; + if (ch === 123) { // '{' + ++acornPos; + code = readHexChar(source.indexOf('}', acornPos) - acornPos); + ++acornPos; + if (code > 0x10FFFF) syntaxError(); + } else { + code = readHexChar(4); + } + // UTF-16 Decoding + if (code <= 0xFFFF) return String.fromCharCode(code); + code -= 0x10000; + return String.fromCharCode((code >> 10) + 0xD800, (code & 1023) + 0xDC00); +} + +/* + * + */ + +function readExportAs (startPos, endPos) { + let ch = source.charCodeAt(pos); + let ls = startPos, le = endPos; + if (ch === 97 /*a*/) { + pos += 2; + ch = commentWhitespace(true); + startPos = pos; + readToWsOrPunctuator(ch); + endPos = pos; + ch = commentWhitespace(true); + } + if (pos !== startPos) + addExport(startPos, endPos, ls, le); + return ch; +} + +function readImportString (ss, ch) { + const startPos = pos + 1; + if (ch === 39/*'*/ || ch === 34/*"*/) { + stringLiteral(ch); + } + else { + syntaxError(); + return; + } + const impt = addImport(ss, startPos, pos, -1); + readName(impt); + pos++; + ch = commentWhitespace(false); + if (ch !== 97/*a*/ || !source.startsWith('ssert', pos + 1)) { + pos--; + return; + } + const assertIndex = pos; + + pos += 6; + ch = commentWhitespace(true); + if (ch !== 123/*{*/) { + pos = assertIndex; + return; + } + const assertStart = pos; + do { + pos++; + ch = commentWhitespace(true); + if (ch === 39/*'*/ || ch === 34/*"*/) { + stringLiteral(ch); + pos++; + ch = commentWhitespace(true); + } + else { + ch = readToWsOrPunctuator(ch); + } + if (ch !== 58/*:*/) { + pos = assertIndex; + return; + } + pos++; + ch = commentWhitespace(true); + if (ch === 39/*'*/ || ch === 34/*"*/) { + stringLiteral(ch); + } + else { + pos = assertIndex; + return; + } + pos++; + ch = commentWhitespace(true); + if (ch === 44/*,*/) { + pos++; + ch = commentWhitespace(true); + if (ch === 125/*}*/) + break; + continue; + } + if (ch === 125/*}*/) + break; + pos = assertIndex; + return; + } while (true); + impt.a = assertStart; + impt.se = pos + 1; +} + +function commentWhitespace (br) { + let ch; + do { + ch = source.charCodeAt(pos); + if (ch === 47/*/*/) { + const next_ch = source.charCodeAt(pos + 1); + if (next_ch === 47/*/*/) + lineComment(); + else if (next_ch === 42/***/) + blockComment(br); + else + return ch; + } + else if (br ? !isBrOrWs(ch): !isWsNotBr(ch)) { + return ch; + } + } while (pos++ < end); + return ch; +} + +function templateString () { + while (pos++ < end) { + const ch = source.charCodeAt(pos); + if (ch === 36/*$*/ && source.charCodeAt(pos + 1) === 123/*{*/) { + pos++; + templateStack[templateStackDepth++] = templateDepth; + templateDepth = ++openTokenDepth; + return; + } + if (ch === 96/*`*/) + return; + if (ch === 92/*\*/) + pos++; + } + syntaxError(); +} + +function blockComment (br) { + pos++; + while (pos++ < end) { + const ch = source.charCodeAt(pos); + if (!br && isBr(ch)) + return; + if (ch === 42/***/ && source.charCodeAt(pos + 1) === 47/*/*/) { + pos++; + return; + } + } +} + +function lineComment () { + while (pos++ < end) { + const ch = source.charCodeAt(pos); + if (ch === 10/*\n*/ || ch === 13/*\r*/) + return; + } +} + +function stringLiteral (quote) { + while (pos++ < end) { + let ch = source.charCodeAt(pos); + if (ch === quote) + return; + if (ch === 92/*\*/) { + ch = source.charCodeAt(++pos); + if (ch === 13/*\r*/ && source.charCodeAt(pos + 1) === 10/*\n*/) + pos++; + } + else if (isBr(ch)) + break; + } + syntaxError(); +} + +function regexCharacterClass () { + while (pos++ < end) { + let ch = source.charCodeAt(pos); + if (ch === 93/*]*/) + return ch; + if (ch === 92/*\*/) + pos++; + else if (ch === 10/*\n*/ || ch === 13/*\r*/) + break; + } + syntaxError(); +} + +function regularExpression () { + while (pos++ < end) { + let ch = source.charCodeAt(pos); + if (ch === 47/*/*/) + return; + if (ch === 91/*[*/) + ch = regexCharacterClass(); + else if (ch === 92/*\*/) + pos++; + else if (ch === 10/*\n*/ || ch === 13/*\r*/) + break; + } + syntaxError(); +} + +function readToWsOrPunctuator (ch) { + do { + if (isBrOrWs(ch) || isPunctuator(ch)) + return ch; + } while (ch = source.charCodeAt(++pos)); + return ch; +} + +// Note: non-asii BR and whitespace checks omitted for perf / footprint +// if there is a significant user need this can be reconsidered +function isBr (c) { + return c === 13/*\r*/ || c === 10/*\n*/; +} + +function isWsNotBr (c) { + return c === 9 || c === 11 || c === 12 || c === 32 || c === 160; +} + +function isBrOrWs (c) { + return c > 8 && c < 14 || c === 32 || c === 160; +} + +function isBrOrWsOrPunctuatorNotDot (c) { + return c > 8 && c < 14 || c === 32 || c === 160 || isPunctuator(c) && c !== 46/*.*/; +} + +function keywordStart (pos) { + return pos === 0 || isBrOrWsOrPunctuatorNotDot(source.charCodeAt(pos - 1)); +} + +function readPrecedingKeyword (pos, match) { + if (pos < match.length - 1) + return false; + return source.startsWith(match, pos - match.length + 1) && (pos === 0 || isBrOrWsOrPunctuatorNotDot(source.charCodeAt(pos - match.length))); +} + +function readPrecedingKeyword1 (pos, ch) { + return source.charCodeAt(pos) === ch && (pos === 0 || isBrOrWsOrPunctuatorNotDot(source.charCodeAt(pos - 1))); +} + +// Detects one of case, debugger, delete, do, else, in, instanceof, new, +// return, throw, typeof, void, yield, await +function isExpressionKeyword (pos) { + switch (source.charCodeAt(pos)) { + case 100/*d*/: + switch (source.charCodeAt(pos - 1)) { + case 105/*i*/: + // void + return readPrecedingKeyword(pos - 2, 'vo'); + case 108/*l*/: + // yield + return readPrecedingKeyword(pos - 2, 'yie'); + default: + return false; + } + case 101/*e*/: + switch (source.charCodeAt(pos - 1)) { + case 115/*s*/: + switch (source.charCodeAt(pos - 2)) { + case 108/*l*/: + // else + return readPrecedingKeyword1(pos - 3, 101/*e*/); + case 97/*a*/: + // case + return readPrecedingKeyword1(pos - 3, 99/*c*/); + default: + return false; + } + case 116/*t*/: + // delete + return readPrecedingKeyword(pos - 2, 'dele'); + default: + return false; + } + case 102/*f*/: + if (source.charCodeAt(pos - 1) !== 111/*o*/ || source.charCodeAt(pos - 2) !== 101/*e*/) + return false; + switch (source.charCodeAt(pos - 3)) { + case 99/*c*/: + // instanceof + return readPrecedingKeyword(pos - 4, 'instan'); + case 112/*p*/: + // typeof + return readPrecedingKeyword(pos - 4, 'ty'); + default: + return false; + } + case 110/*n*/: + // in, return + return readPrecedingKeyword1(pos - 1, 105/*i*/) || readPrecedingKeyword(pos - 1, 'retur'); + case 111/*o*/: + // do + return readPrecedingKeyword1(pos - 1, 100/*d*/); + case 114/*r*/: + // debugger + return readPrecedingKeyword(pos - 1, 'debugge'); + case 116/*t*/: + // await + return readPrecedingKeyword(pos - 1, 'awai'); + case 119/*w*/: + switch (source.charCodeAt(pos - 1)) { + case 101/*e*/: + // new + return readPrecedingKeyword1(pos - 2, 110/*n*/); + case 111/*o*/: + // throw + return readPrecedingKeyword(pos - 2, 'thr'); + default: + return false; + } + } + return false; +} + +function isParenKeyword (curPos) { + return source.charCodeAt(curPos) === 101/*e*/ && source.startsWith('whil', curPos - 4) || + source.charCodeAt(curPos) === 114/*r*/ && source.startsWith('fo', curPos - 2) || + source.charCodeAt(curPos - 1) === 105/*i*/ && source.charCodeAt(curPos) === 102/*f*/; +} + +function isPunctuator (ch) { + // 23 possible punctuator endings: !%&()*+,-./:;<=>?[]^{}|~ + return ch === 33/*!*/ || ch === 37/*%*/ || ch === 38/*&*/ || + ch > 39 && ch < 48 || ch > 57 && ch < 64 || + ch === 91/*[*/ || ch === 93/*]*/ || ch === 94/*^*/ || + ch > 122 && ch < 127; +} + +function isExpressionPunctuator (ch) { + // 20 possible expression endings: !%&(*+,-.:;<=>?[^{|~ + return ch === 33/*!*/ || ch === 37/*%*/ || ch === 38/*&*/ || + ch > 39 && ch < 47 && ch !== 41 || ch > 57 && ch < 64 || + ch === 91/*[*/ || ch === 94/*^*/ || ch > 122 && ch < 127 && ch !== 125/*}*/; +} + +function isExpressionTerminator (curPos) { + // detects: + // => ; ) finally catch else + // as all of these followed by a { will indicate a statement brace + switch (source.charCodeAt(curPos)) { + case 62/*>*/: + return source.charCodeAt(curPos - 1) === 61/*=*/; + case 59/*;*/: + case 41/*)*/: + return true; + case 104/*h*/: + return source.startsWith('catc', curPos - 4); + case 121/*y*/: + return source.startsWith('finall', curPos - 6); + case 101/*e*/: + return source.startsWith('els', curPos - 3); + } + return false; +} + +function syntaxError () { + throw Object.assign(new Error(`Parse error ${name}:${source.slice(0, pos).split('\n').length}:${pos - source.lastIndexOf('\n', pos - 1)}`), { idx: pos }); +} \ No newline at end of file diff --git a/tools/eslint/node_modules/es-module-lexer/package.json b/tools/eslint/node_modules/es-module-lexer/package.json new file mode 100644 index 00000000000000..e5ac6e350d81d1 --- /dev/null +++ b/tools/eslint/node_modules/es-module-lexer/package.json @@ -0,0 +1,54 @@ +{ + "name": "es-module-lexer", + "version": "1.5.4", + "description": "Lexes ES modules returning their import/export metadata", + "main": "dist/lexer.cjs", + "module": "dist/lexer.js", + "types": "types/lexer.d.ts", + "exports": { + ".": { + "types": "./types/lexer.d.ts", + "module": "./dist/lexer.js", + "import": "./dist/lexer.js", + "require": "./dist/lexer.cjs" + }, + "./js": "./dist/lexer.asm.js" + }, + "scripts": { + "build": "npm install -g chomp ; chomp build", + "test": "npm install -g chomp ; chomp test" + }, + "author": "Guy Bedford", + "license": "MIT", + "devDependencies": { + "@babel/cli": "^7.5.5", + "@babel/core": "^7.5.5", + "@babel/plugin-transform-modules-commonjs": "^7.5.0", + "@swc/cli": "^0.1.57", + "@swc/core": "^1.2.224", + "@types/node": "^18.7.1", + "kleur": "^2.0.2", + "mocha": "^5.2.0", + "terser": "^5.19.4", + "typescript": "^4.7.4" + }, + "files": [ + "dist", + "types", + "lexer.js" + ], + "type": "module", + "repository": { + "type": "git", + "url": "git+https://github.com/guybedford/es-module-lexer.git" + }, + "bugs": { + "url": "https://github.com/guybedford/es-module-lexer/issues" + }, + "homepage": "https://github.com/guybedford/es-module-lexer#readme", + "directories": { + "lib": "lib", + "test": "test" + }, + "keywords": [] +} diff --git a/tools/eslint/node_modules/eslint-plugin-jsdoc/dist/generateRule.cjs b/tools/eslint/node_modules/eslint-plugin-jsdoc/dist/generateRule.cjs index 50bb8c5126564f..8aeafa2a3e2a97 100644 --- a/tools/eslint/node_modules/eslint-plugin-jsdoc/dist/generateRule.cjs +++ b/tools/eslint/node_modules/eslint-plugin-jsdoc/dist/generateRule.cjs @@ -15,7 +15,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; * npm run create-rule my-new-rule -- --recommended * ``` */ -const _dirname = (0, _path.dirname)((0, _url.fileURLToPath)(import.meta.url)); +const _dirname = (0, _path.dirname)((0, _url.fileURLToPath)(require('url').pathToFileURL(__filename).toString())); // Todo: Would ideally have prompts, e.g., to ask for whether // type was problem/layout, etc. diff --git a/tools/eslint/node_modules/eslint-plugin-jsdoc/dist/import-worker.cjs b/tools/eslint/node_modules/eslint-plugin-jsdoc/dist/import-worker.cjs new file mode 100644 index 00000000000000..995a9baea23d23 --- /dev/null +++ b/tools/eslint/node_modules/eslint-plugin-jsdoc/dist/import-worker.cjs @@ -0,0 +1,17 @@ +"use strict"; + +var _synckit = require("synckit"); +function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); } +function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } +(0, _synckit.runAsWorker)(async imprt => { + const { + parseImports + } = await Promise.resolve().then(() => _interopRequireWildcard(require('parse-imports'))); + try { + // ESLint doesn't support async rules + return [...(await parseImports(imprt))]; + } catch (err) { + return false; + } +}); +//# sourceMappingURL=import-worker.cjs.map \ No newline at end of file diff --git a/tools/eslint/node_modules/eslint-plugin-jsdoc/dist/import-worker.mjs b/tools/eslint/node_modules/eslint-plugin-jsdoc/dist/import-worker.mjs new file mode 100644 index 00000000000000..cc54de761a9411 --- /dev/null +++ b/tools/eslint/node_modules/eslint-plugin-jsdoc/dist/import-worker.mjs @@ -0,0 +1,11 @@ +import { runAsWorker } from 'synckit' + +runAsWorker(async (imprt) => { + const { parseImports } = await import('parse-imports'); + try { + // ESLint doesn't support async rules + return [...await parseImports(imprt)]; + } catch (err) { + return false; + } +}) diff --git a/tools/eslint/node_modules/eslint-plugin-jsdoc/dist/rules/checkParamNames.cjs b/tools/eslint/node_modules/eslint-plugin-jsdoc/dist/rules/checkParamNames.cjs index 3cdb8223d92cb3..54c4fd5c691936 100644 --- a/tools/eslint/node_modules/eslint-plugin-jsdoc/dist/rules/checkParamNames.cjs +++ b/tools/eslint/node_modules/eslint-plugin-jsdoc/dist/rules/checkParamNames.cjs @@ -271,6 +271,9 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({ } validateParameterNamesDeep(targetTagName, allowExtraTrailingParamDocs, jsdocParameterNamesDeep, jsdoc, report); }, { + contextDefaults: ['ArrowFunctionExpression', 'FunctionDeclaration', 'FunctionExpression', 'TSDeclareFunction', + // Add this to above defaults + 'TSMethodSignature'], meta: { docs: { description: 'Ensures that parameter names in JSDoc match those in the function declaration.', diff --git a/tools/eslint/node_modules/eslint-plugin-jsdoc/dist/rules/checkValues.cjs b/tools/eslint/node_modules/eslint-plugin-jsdoc/dist/rules/checkValues.cjs index 01e25779e3210f..0efccce86013de 100644 --- a/tools/eslint/node_modules/eslint-plugin-jsdoc/dist/rules/checkValues.cjs +++ b/tools/eslint/node_modules/eslint-plugin-jsdoc/dist/rules/checkValues.cjs @@ -4,15 +4,21 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; -var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc.cjs")); +var _nodePath = require("node:path"); +var _nodeUrl = require("node:url"); +var _synckit = require("synckit"); var _semver = _interopRequireDefault(require("semver")); var _spdxExpressionParse = _interopRequireDefault(require("spdx-expression-parse")); +var _iterateJsdoc = _interopRequireDefault(require("../iterateJsdoc.cjs")); function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } +const _dirname = (0, _nodePath.dirname)((0, _nodeUrl.fileURLToPath)(require('url').pathToFileURL(__filename).toString())); +const pathName = (0, _nodePath.join)(_dirname, '../import-worker.mjs'); const allowedKinds = new Set(['class', 'constant', 'event', 'external', 'file', 'function', 'member', 'mixin', 'module', 'namespace', 'typedef']); var _default = exports.default = (0, _iterateJsdoc.default)(({ utils, report, - context + context, + settings }) => { const options = context.options[0] || {}; const { @@ -83,6 +89,21 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({ } } }); + if (settings.mode === 'typescript') { + utils.forEachPreferredTag('import', tag => { + const { + type, + name, + description + } = tag; + const typePart = type ? `{${type}} ` : ''; + const imprt = 'import ' + (description ? `${typePart}${name} ${description}` : `${typePart}${name}`); + const getImports = (0, _synckit.createSyncFn)(pathName); + if (!getImports(imprt)) { + report(`Bad @import tag`, null, tag); + } + }); + } utils.forEachPreferredTag('author', (jsdocParameter, targetTagName) => { const author = /** @type {string} */utils.getTagDescription(jsdocParameter).trim(); if (!author) { diff --git a/tools/eslint/node_modules/eslint-plugin-jsdoc/dist/rules/noTypes.cjs b/tools/eslint/node_modules/eslint-plugin-jsdoc/dist/rules/noTypes.cjs index 67ed9e659e216a..8e1998156e3cc0 100644 --- a/tools/eslint/node_modules/eslint-plugin-jsdoc/dist/rules/noTypes.cjs +++ b/tools/eslint/node_modules/eslint-plugin-jsdoc/dist/rules/noTypes.cjs @@ -32,7 +32,9 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({ } } }, { - contextDefaults: true, + contextDefaults: ['ArrowFunctionExpression', 'FunctionDeclaration', 'FunctionExpression', 'TSDeclareFunction', + // Add this to above defaults + 'TSMethodSignature'], meta: { docs: { description: 'This rule reports types being used on `@param` or `@returns`.', diff --git a/tools/eslint/node_modules/eslint-plugin-jsdoc/dist/rules/noUndefinedTypes.cjs b/tools/eslint/node_modules/eslint-plugin-jsdoc/dist/rules/noUndefinedTypes.cjs index 3f31ece23583fb..281a448853611f 100644 --- a/tools/eslint/node_modules/eslint-plugin-jsdoc/dist/rules/noUndefinedTypes.cjs +++ b/tools/eslint/node_modules/eslint-plugin-jsdoc/dist/rules/noUndefinedTypes.cjs @@ -4,10 +4,15 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; -var _iterateJsdoc = _interopRequireWildcard(require("../iterateJsdoc.cjs")); +var _path = require("path"); +var _url = require("url"); +var _synckit = require("synckit"); var _jsdoccomment = require("@es-joy/jsdoccomment"); +var _iterateJsdoc = _interopRequireWildcard(require("../iterateJsdoc.cjs")); function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); } function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } +const _dirname = (0, _path.dirname)((0, _url.fileURLToPath)(require('url').pathToFileURL(__filename).toString())); +const pathName = (0, _path.join)(_dirname, '../import-worker.mjs'); const extraTypes = ['null', 'undefined', 'void', 'string', 'boolean', 'object', 'function', 'symbol', 'number', 'bigint', 'NaN', 'Infinity', 'any', '*', 'never', 'unknown', 'const', 'this', 'true', 'false', 'Array', 'Object', 'RegExp', 'Date', 'Function']; const typescriptGlobals = [ // https://www.typescriptlang.org/docs/handbook/utility-types.html @@ -72,11 +77,12 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({ return stripPseudoTypes(preferredType.replacement); }).filter(Boolean); } - const typedefDeclarations = sourceCode.getAllComments().filter(comment => { + const comments = sourceCode.getAllComments().filter(comment => { return /^\*\s/u.test(comment.value); }).map(commentNode => { return (0, _iterateJsdoc.parseComment)(commentNode, ''); - }).flatMap(doc => { + }); + const typedefDeclarations = comments.flatMap(doc => { return doc.tags.filter(({ tag }) => { @@ -85,6 +91,51 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({ }).map(tag => { return tag.name; }); + const importTags = settings.mode === 'typescript' ? ( /** @type {string[]} */comments.flatMap(doc => { + return doc.tags.filter(({ + tag + }) => { + return tag === 'import'; + }); + }).flatMap(tag => { + const { + type, + name, + description + } = tag; + const typePart = type ? `{${type}} ` : ''; + const imprt = 'import ' + (description ? `${typePart}${name} ${description}` : `${typePart}${name}`); + const getImports = (0, _synckit.createSyncFn)(pathName); + const imports = /** @type {import('parse-imports').Import[]} */getImports(imprt); + if (!imports) { + return null; + } + return imports.flatMap(({ + importClause + }) => { + /* c8 ignore next */ + const { + default: dflt, + named, + namespace + } = importClause || {}; + const types = []; + if (dflt) { + types.push(dflt); + } + if (namespace) { + types.push(namespace); + } + if (named) { + for (const { + binding + } of named) { + types.push(binding); + } + } + return types; + }); + }).filter(Boolean)) : []; const ancestorNodes = []; let currentNode = node; // No need for Program node? @@ -137,7 +188,7 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({ }) => { return name; /* c8 ignore next */ - }) : []).concat(extraTypes).concat(typedefDeclarations).concat(definedTypes).concat( /** @type {string[]} */definedPreferredTypes).concat(settings.mode === 'jsdoc' ? [] : [...(settings.mode === 'typescript' ? typescriptGlobals : []), ...closureGenericTypes])); + }) : []).concat(extraTypes).concat(typedefDeclarations).concat(importTags).concat(definedTypes).concat( /** @type {string[]} */definedPreferredTypes).concat(settings.mode === 'jsdoc' ? [] : [...(settings.mode === 'typescript' ? typescriptGlobals : []), ...closureGenericTypes])); /** * @typedef {{ @@ -175,7 +226,7 @@ var _default = exports.default = (0, _iterateJsdoc.default)(({ const typeTags = utils.filterTags(({ tag }) => { - return utils.tagMightHaveTypePosition(tag) && (tag !== 'suppress' || settings.mode !== 'closure'); + return tag !== 'import' && utils.tagMightHaveTypePosition(tag) && (tag !== 'suppress' || settings.mode !== 'closure'); }).map(tagToParsedType('type')); const namepathReferencingTags = utils.filterTags(({ tag diff --git a/tools/eslint/node_modules/eslint-plugin-jsdoc/dist/tagNames.cjs b/tools/eslint/node_modules/eslint-plugin-jsdoc/dist/tagNames.cjs index 11e12dab1c22d3..da9750680312be 100644 --- a/tools/eslint/node_modules/eslint-plugin-jsdoc/dist/tagNames.cjs +++ b/tools/eslint/node_modules/eslint-plugin-jsdoc/dist/tagNames.cjs @@ -103,6 +103,7 @@ const jsdocTags = exports.jsdocTags = { const typeScriptTags = exports.typeScriptTags = { ...jsdocTags, // https://github.com/microsoft/TypeScript/issues/22160 + // https://devblogs.microsoft.com/typescript/announcing-typescript-5-5/#the-jsdoc-import-tag import: [], // https://www.typescriptlang.org/tsconfig/#stripInternal internal: [], diff --git a/tools/eslint/node_modules/eslint-plugin-jsdoc/package.json b/tools/eslint/node_modules/eslint-plugin-jsdoc/package.json index 26fb06c3feb50f..dd5ea9dc8d753a 100644 --- a/tools/eslint/node_modules/eslint-plugin-jsdoc/package.json +++ b/tools/eslint/node_modules/eslint-plugin-jsdoc/package.json @@ -11,8 +11,10 @@ "debug": "^4.3.4", "escape-string-regexp": "^4.0.0", "esquery": "^1.5.0", + "parse-imports": "^2.1.0", "semver": "^7.6.2", - "spdx-expression-parse": "^4.0.0" + "spdx-expression-parse": "^4.0.0", + "synckit": "^0.9.0" }, "description": "JSDoc linting rules for ESLint.", "devDependencies": { @@ -43,6 +45,7 @@ "@typescript-eslint/parser": "^7.11.0", "babel-plugin-add-module-exports": "^1.0.4", "babel-plugin-istanbul": "^6.1.1", + "babel-plugin-transform-import-meta": "^2.2.1", "c8": "^9.1.0", "camelcase": "^6.3.0", "chai": "^4.3.10", @@ -125,7 +128,7 @@ "scripts": { "tsc": "tsc", "tsc-build": "tsc -p tsconfig-prod.json", - "build": "rimraf ./dist && cross-env NODE_ENV=production babel ./src --out-file-extension .cjs --out-dir ./dist --copy-files --source-maps --ignore ./src/bin/*.js --no-copy-ignored && replace 'require\\(\"\\.(.*?)\\.[^.]*?\"\\)' 'require(\".$1.cjs\")' 'dist' -r --include=\"*.cjs\" && pnpm tsc-build", + "build": "rimraf ./dist && cross-env NODE_ENV=production babel ./src --out-file-extension .cjs --out-dir ./dist --copy-files --source-maps --ignore ./src/bin/*.js --no-copy-ignored && replace 'require\\(\"\\.(.*?)\\.[^.]*?\"\\)' 'require(\".$1.cjs\")' 'dist' -r --include=\"*.cjs\" && cp src/import-worker.mjs dist/import-worker.mjs && pnpm tsc-build", "check-docs": "babel-node ./src/bin/generateDocs.js --check", "create-docs": "npm run create-options && babel-node ./src/bin/generateDocs.js", "create-rule": "babel-node ./src/bin/generateRule.js", @@ -140,5 +143,5 @@ "test-cov": "cross-env TIMING=1 c8 --reporter text npm run test-no-cov", "test-index": "npm run test-no-cov -- test/rules/index.js" }, - "version": "48.2.12" + "version": "48.5.0" } diff --git a/tools/eslint/node_modules/eslint-plugin-jsdoc/src/import-worker.mjs b/tools/eslint/node_modules/eslint-plugin-jsdoc/src/import-worker.mjs new file mode 100644 index 00000000000000..cc54de761a9411 --- /dev/null +++ b/tools/eslint/node_modules/eslint-plugin-jsdoc/src/import-worker.mjs @@ -0,0 +1,11 @@ +import { runAsWorker } from 'synckit' + +runAsWorker(async (imprt) => { + const { parseImports } = await import('parse-imports'); + try { + // ESLint doesn't support async rules + return [...await parseImports(imprt)]; + } catch (err) { + return false; + } +}) diff --git a/tools/eslint/node_modules/eslint-plugin-jsdoc/src/rules/checkParamNames.js b/tools/eslint/node_modules/eslint-plugin-jsdoc/src/rules/checkParamNames.js index 3569efcd52b426..b1b8cd9ec42035 100644 --- a/tools/eslint/node_modules/eslint-plugin-jsdoc/src/rules/checkParamNames.js +++ b/tools/eslint/node_modules/eslint-plugin-jsdoc/src/rules/checkParamNames.js @@ -378,6 +378,11 @@ export default iterateJsdoc(({ targetTagName, allowExtraTrailingParamDocs, jsdocParameterNamesDeep, jsdoc, report, ); }, { + contextDefaults: [ + 'ArrowFunctionExpression', 'FunctionDeclaration', 'FunctionExpression', 'TSDeclareFunction', + // Add this to above defaults + 'TSMethodSignature' + ], meta: { docs: { description: 'Ensures that parameter names in JSDoc match those in the function declaration.', diff --git a/tools/eslint/node_modules/eslint-plugin-jsdoc/src/rules/checkValues.js b/tools/eslint/node_modules/eslint-plugin-jsdoc/src/rules/checkValues.js index b3741c8caccb70..dcb50f6a3c27ed 100644 --- a/tools/eslint/node_modules/eslint-plugin-jsdoc/src/rules/checkValues.js +++ b/tools/eslint/node_modules/eslint-plugin-jsdoc/src/rules/checkValues.js @@ -1,6 +1,13 @@ -import iterateJsdoc from '../iterateJsdoc.js'; +import { dirname, join } from 'node:path'; +import { fileURLToPath } from 'node:url'; + +import { createSyncFn } from 'synckit'; import semver from 'semver'; import spdxExpressionParse from 'spdx-expression-parse'; +import iterateJsdoc from '../iterateJsdoc.js'; + +const __dirname = dirname(fileURLToPath(import.meta.url)); +const pathName = join(__dirname, '../import-worker.mjs'); const allowedKinds = new Set([ 'class', @@ -20,6 +27,7 @@ export default iterateJsdoc(({ utils, report, context, + settings, }) => { const options = context.options[0] || {}; const { @@ -157,6 +165,27 @@ export default iterateJsdoc(({ } }); + if (settings.mode === 'typescript') { + utils.forEachPreferredTag('import', (tag) => { + const { + type, name, description + } = tag; + const typePart = type ? `{${type}} `: ''; + const imprt = 'import ' + (description + ? `${typePart}${name} ${description}` + : `${typePart}${name}`); + + const getImports = createSyncFn(pathName); + if (!getImports(imprt)) { + report( + `Bad @import tag`, + null, + tag, + ); + } + }); + } + utils.forEachPreferredTag('author', (jsdocParameter, targetTagName) => { const author = /** @type {string} */ ( utils.getTagDescription(jsdocParameter) diff --git a/tools/eslint/node_modules/eslint-plugin-jsdoc/src/rules/noTypes.js b/tools/eslint/node_modules/eslint-plugin-jsdoc/src/rules/noTypes.js index 527891a1551860..5f7e5b8352f7c5 100644 --- a/tools/eslint/node_modules/eslint-plugin-jsdoc/src/rules/noTypes.js +++ b/tools/eslint/node_modules/eslint-plugin-jsdoc/src/rules/noTypes.js @@ -31,7 +31,11 @@ export default iterateJsdoc(({ } } }, { - contextDefaults: true, + contextDefaults: [ + 'ArrowFunctionExpression', 'FunctionDeclaration', 'FunctionExpression', 'TSDeclareFunction', + // Add this to above defaults + 'TSMethodSignature' + ], meta: { docs: { description: 'This rule reports types being used on `@param` or `@returns`.', diff --git a/tools/eslint/node_modules/eslint-plugin-jsdoc/src/rules/noUndefinedTypes.js b/tools/eslint/node_modules/eslint-plugin-jsdoc/src/rules/noUndefinedTypes.js index 4ed51f18d1815c..3642f127853862 100644 --- a/tools/eslint/node_modules/eslint-plugin-jsdoc/src/rules/noUndefinedTypes.js +++ b/tools/eslint/node_modules/eslint-plugin-jsdoc/src/rules/noUndefinedTypes.js @@ -1,12 +1,19 @@ -import iterateJsdoc, { - parseComment, -} from '../iterateJsdoc.js'; +import { dirname, join } from 'path'; +import { fileURLToPath } from 'url'; + +import { createSyncFn } from 'synckit'; import { getJSDocComment, parse as parseType, traverse, tryParse as tryParseType, } from '@es-joy/jsdoccomment'; +import iterateJsdoc, { + parseComment, +} from '../iterateJsdoc.js'; + +const __dirname = dirname(fileURLToPath(import.meta.url)); +const pathName = join(__dirname, '../import-worker.mjs'); const extraTypes = [ 'null', 'undefined', 'void', 'string', 'boolean', 'object', @@ -109,13 +116,15 @@ export default iterateJsdoc(({ .filter(Boolean)); } - const typedefDeclarations = sourceCode.getAllComments() + const comments = sourceCode.getAllComments() .filter((comment) => { return (/^\*\s/u).test(comment.value); }) .map((commentNode) => { return parseComment(commentNode, ''); - }) + }); + + const typedefDeclarations = comments .flatMap((doc) => { return doc.tags.filter(({ tag, @@ -127,6 +136,48 @@ export default iterateJsdoc(({ return tag.name; }); + + const importTags = settings.mode === 'typescript' ? /** @type {string[]} */ (comments.flatMap((doc) => { + return doc.tags.filter(({ + tag, + }) => { + return tag === 'import'; + }); + }).flatMap((tag) => { + const { + type, name, description + } = tag; + const typePart = type ? `{${type}} `: ''; + const imprt = 'import ' + (description + ? `${typePart}${name} ${description}` + : `${typePart}${name}`); + + const getImports = createSyncFn(pathName); + const imports = /** @type {import('parse-imports').Import[]} */ (getImports(imprt)); + if (!imports) { + return null; + } + + return imports.flatMap(({importClause}) => { + /* c8 ignore next */ + const {default: dflt, named, namespace} = importClause || {}; + const types = []; + if (dflt) { + types.push(dflt); + } + if (namespace) { + types.push(namespace); + } + if (named) { + for (const {binding} of named) { + types.push(binding); + } + } + + return types; + }); + }).filter(Boolean)) : []; + const ancestorNodes = []; let currentNode = node; @@ -193,6 +244,7 @@ export default iterateJsdoc(({ ) .concat(extraTypes) .concat(typedefDeclarations) + .concat(importTags) .concat(definedTypes) .concat(/** @type {string[]} */ (definedPreferredTypes)) .concat( @@ -245,7 +297,7 @@ export default iterateJsdoc(({ const typeTags = utils.filterTags(({ tag, }) => { - return utils.tagMightHaveTypePosition(tag) && (tag !== 'suppress' || settings.mode !== 'closure'); + return tag !== 'import' && utils.tagMightHaveTypePosition(tag) && (tag !== 'suppress' || settings.mode !== 'closure'); }).map(tagToParsedType('type')); const namepathReferencingTags = utils.filterTags(({ diff --git a/tools/eslint/node_modules/eslint-plugin-jsdoc/src/tagNames.js b/tools/eslint/node_modules/eslint-plugin-jsdoc/src/tagNames.js index 60a609dd78978b..6e80840b1e6e9a 100644 --- a/tools/eslint/node_modules/eslint-plugin-jsdoc/src/tagNames.js +++ b/tools/eslint/node_modules/eslint-plugin-jsdoc/src/tagNames.js @@ -137,6 +137,7 @@ const typeScriptTags = { ...jsdocTags, // https://github.com/microsoft/TypeScript/issues/22160 + // https://devblogs.microsoft.com/typescript/announcing-typescript-5-5/#the-jsdoc-import-tag import: [], // https://www.typescriptlang.org/tsconfig/#stripInternal diff --git a/tools/eslint/node_modules/eslint/conf/ecma-version.js b/tools/eslint/node_modules/eslint/conf/ecma-version.js index 48b1e2f7edc261..4e38c1d2cc3750 100644 --- a/tools/eslint/node_modules/eslint/conf/ecma-version.js +++ b/tools/eslint/node_modules/eslint/conf/ecma-version.js @@ -9,7 +9,7 @@ * The latest ECMAScript version supported by ESLint. * @type {number} year-based ECMAScript version */ -const LATEST_ECMA_VERSION = 2024; +const LATEST_ECMA_VERSION = 2025; module.exports = { LATEST_ECMA_VERSION diff --git a/tools/eslint/node_modules/eslint/conf/globals.js b/tools/eslint/node_modules/eslint/conf/globals.js index c356adb171414d..81df6bb200181e 100644 --- a/tools/eslint/node_modules/eslint/conf/globals.js +++ b/tools/eslint/node_modules/eslint/conf/globals.js @@ -133,6 +133,10 @@ const es2024 = { ...es2023 }; +const es2025 = { + ...es2024 +}; + //----------------------------------------------------------------------------- // Exports @@ -151,5 +155,6 @@ module.exports = { es2021, es2022, es2023, - es2024 + es2024, + es2025 }; diff --git a/tools/eslint/node_modules/eslint/lib/cli.js b/tools/eslint/node_modules/eslint/lib/cli.js index 81fdc19b7483c3..6ee9e537982c97 100644 --- a/tools/eslint/node_modules/eslint/lib/cli.js +++ b/tools/eslint/node_modules/eslint/lib/cli.js @@ -26,7 +26,7 @@ const fs = require("node:fs"), { normalizeSeverityToString } = require("./shared/severity"); const { Legacy: { naming } } = require("@eslint/eslintrc"); const { ModuleImporter } = require("@humanwhocodes/module-importer"); - +const { inactiveFlags, activeFlags } = require("./shared/flags"); const debug = require("debug")("eslint:cli"); //------------------------------------------------------------------------------ @@ -117,6 +117,7 @@ async function translateOptions({ fix, fixDryRun, fixType, + flag, global, ignore, ignorePath, @@ -225,6 +226,7 @@ async function translateOptions({ options.ignorePatterns = ignorePattern; options.stats = stats; options.warnIgnored = warnIgnored; + options.flags = flag; /* * For performance reasons rules not marked as 'error' are filtered out in quiet mode. As maxWarnings @@ -485,8 +487,27 @@ const cli = { } const ActiveESLint = usingFlatConfig ? ESLint : LegacyESLint; + const eslintOptions = await translateOptions(options, usingFlatConfig ? "flat" : "eslintrc"); + + if (eslintOptions.flags) { + debug("Checking for inactive flags"); + + for (const flag of eslintOptions.flags) { + if (inactiveFlags.has(flag)) { + log.warn(`InactiveFlag: The '${flag}' flag is no longer active: ${inactiveFlags.get(flag)}`); + continue; + } + + if (activeFlags.has(flag)) { + continue; + } + + log.error(`InvalidFlag: The '${flag}' flag is invalid.`); + return 2; + } + } - const engine = new ActiveESLint(await translateOptions(options, usingFlatConfig ? "flat" : "eslintrc")); + const engine = new ActiveESLint(eslintOptions); let results; if (useStdin) { diff --git a/tools/eslint/node_modules/eslint/lib/eslint/eslint-helpers.js b/tools/eslint/node_modules/eslint/lib/eslint/eslint-helpers.js index 3c4aa8c04f6f06..38c16155cfdab9 100644 --- a/tools/eslint/node_modules/eslint/lib/eslint/eslint-helpers.js +++ b/tools/eslint/node_modules/eslint/lib/eslint/eslint-helpers.js @@ -723,6 +723,7 @@ function processOptions({ errorOnUnmatchedPattern = true, fix = false, fixTypes = null, // ← should be null by default because if it's an array then it suppresses rules that don't have the `meta.type` property. + flags = [], globInputPaths = true, ignore = true, ignorePatterns = null, @@ -810,6 +811,9 @@ function processOptions({ if (fixTypes !== null && !isFixTypeArray(fixTypes)) { errors.push("'fixTypes' must be an array of any of \"directive\", \"problem\", \"suggestion\", and \"layout\"."); } + if (!isEmptyArrayOrArrayOfNonEmptyString(flags)) { + errors.push("'flags' must be an array of non-empty strings."); + } if (typeof globInputPaths !== "boolean") { errors.push("'globInputPaths' must be a boolean."); } @@ -863,6 +867,7 @@ function processOptions({ errorOnUnmatchedPattern, fix, fixTypes, + flags: [...flags], globInputPaths, ignore, ignorePatterns, diff --git a/tools/eslint/node_modules/eslint/lib/eslint/eslint.js b/tools/eslint/node_modules/eslint/lib/eslint/eslint.js index ede77bec63b915..f20b2119a418f7 100644 --- a/tools/eslint/node_modules/eslint/lib/eslint/eslint.js +++ b/tools/eslint/node_modules/eslint/lib/eslint/eslint.js @@ -76,6 +76,7 @@ const { Retrier } = require("@humanwhocodes/retry"); * @property {boolean} [errorOnUnmatchedPattern] If `false` then `ESLint#lintFiles()` doesn't throw even if no target files found. Defaults to `true`. * @property {boolean|Function} [fix] Execute in autofix mode. If a function, should return a boolean. * @property {string[]} [fixTypes] Array of rule types to apply fixes for. + * @property {string[]} [flags] Array of feature flags to enable. * @property {boolean} [globInputPaths] Set to false to skip glob resolution of input file paths to lint (default: true). If false, each input file paths is assumed to be a non-glob path to an existing file. * @property {boolean} [ignore] False disables all ignore patterns except for the default ones. * @property {string[]} [ignorePatterns] Ignore file patterns to use in addition to config ignores. These patterns are relative to `cwd`. @@ -421,7 +422,8 @@ async function calculateConfigArray(eslint, { relativeIgnorePatterns = ignorePatterns; } else { - const relativeIgnorePath = path.relative(basePath, cwd); + // In minimatch patterns, only `/` can be used as path separator + const relativeIgnorePath = path.relative(basePath, cwd).replaceAll(path.sep, "/"); relativeIgnorePatterns = ignorePatterns.map(pattern => { const negated = pattern.startsWith("!"); @@ -593,7 +595,8 @@ class ESLint { const processedOptions = processOptions(options); const linter = new Linter({ cwd: processedOptions.cwd, - configType: "flat" + configType: "flat", + flags: processedOptions.flags }); const cacheFilePath = getCacheFile( @@ -766,6 +769,17 @@ class ESLint { return createRulesMeta(resultRules); } + /** + * Indicates if the given feature flag is enabled for this instance. + * @param {string} flag The feature flag to check. + * @returns {boolean} `true` if the feature flag is enabled, `false` if not. + */ + hasFlag(flag) { + + // note: Linter does validation of the flags + return privateMembers.get(this).linter.hasFlag(flag); + } + /** * Executes the current configuration on an array of file and directory names. * @param {string|string[]} patterns An array of file and directory names. diff --git a/tools/eslint/node_modules/eslint/lib/eslint/legacy-eslint.js b/tools/eslint/node_modules/eslint/lib/eslint/legacy-eslint.js index a781fe9c86c4cf..f282e58746411a 100644 --- a/tools/eslint/node_modules/eslint/lib/eslint/legacy-eslint.js +++ b/tools/eslint/node_modules/eslint/lib/eslint/legacy-eslint.js @@ -171,6 +171,7 @@ function processOptions({ extensions = null, // ← should be null by default because if it's an array then it suppresses RFC20 feature. fix = false, fixTypes = null, // ← should be null by default because if it's an array then it suppresses rules that don't have the `meta.type` property. + flags, /* eslint-disable-line no-unused-vars -- leaving for compatibility with ESLint#hasFlag */ globInputPaths = true, ignore = true, ignorePath = null, // ← should be null by default because if it's a string then it may throw ENOENT. @@ -310,6 +311,7 @@ function processOptions({ extensions, fix, fixTypes, + flags: [], // LegacyESLint does not support flags, so just ignore them. globInputPaths, ignore, ignorePath, @@ -558,6 +560,18 @@ class LegacyESLint { } + /* eslint-disable no-unused-vars, class-methods-use-this -- leaving for compatibility with ESLint#hasFlag */ + /** + * Indicates if the given feature flag is enabled for this instance. For this + * class, this always returns `false` because it does not support feature flags. + * @param {string} flag The feature flag to check. + * @returns {boolean} Always false. + */ + hasFlag(flag) { + return false; + } + /* eslint-enable no-unused-vars, class-methods-use-this -- reenable rules for the rest of the file */ + /** * Executes the current configuration on an array of file and directory names. * @param {string[]} patterns An array of file and directory names. diff --git a/tools/eslint/node_modules/eslint/lib/languages/js/source-code/source-code.js b/tools/eslint/node_modules/eslint/lib/languages/js/source-code/source-code.js index 0becf2180ff279..2401dafc522bef 100644 --- a/tools/eslint/node_modules/eslint/lib/languages/js/source-code/source-code.js +++ b/tools/eslint/node_modules/eslint/lib/languages/js/source-code/source-code.js @@ -1099,7 +1099,7 @@ class SourceCode extends TokenStore { /** * Applies configuration found inside of the source code. This method is only * called when ESLint is running with inline configuration allowed. - * @returns {{problems:Array,configs:{config:FlatConfigArray,node:ASTNode}}} Information + * @returns {{problems:Array,configs:{config:FlatConfigArray,loc:Location}}} Information * that ESLint needs to further process the inline configuration. */ applyInlineConfig() { @@ -1147,17 +1147,21 @@ class SourceCode extends TokenStore { break; case "eslint": { - const parseResult = commentParser.parseJsonConfig(directiveValue, comment.loc); + const parseResult = commentParser.parseJsonConfig(directiveValue); if (parseResult.success) { configs.push({ config: { rules: parseResult.config }, - node: comment + loc: comment.loc }); } else { - problems.push(parseResult.error); + problems.push({ + ruleId: null, + loc: comment.loc, + message: parseResult.error.message + }); } break; diff --git a/tools/eslint/node_modules/eslint/lib/linter/config-comment-parser.js b/tools/eslint/node_modules/eslint/lib/linter/config-comment-parser.js index aaa56e1daa9641..ec05cf8aadadee 100644 --- a/tools/eslint/node_modules/eslint/lib/linter/config-comment-parser.js +++ b/tools/eslint/node_modules/eslint/lib/linter/config-comment-parser.js @@ -22,12 +22,6 @@ const levn = require("levn"), const debug = require("debug")("eslint:config-comment-parser"); -//------------------------------------------------------------------------------ -// Typedefs -//------------------------------------------------------------------------------ - -/** @typedef {import("../shared/types").LintMessage} LintMessage */ - //------------------------------------------------------------------------------ // Public Interface //------------------------------------------------------------------------------ @@ -69,10 +63,9 @@ module.exports = class ConfigCommentParser { /** * Parses a JSON-like config. * @param {string} string The string to parse. - * @param {Object} location Start line and column of comments for potential error message. - * @returns {({success: true, config: Object}|{success: false, error: LintMessage})} Result map object + * @returns {({success: true, config: Object}|{success: false, error: {message: string}})} Result map object */ - parseJsonConfig(string, location) { + parseJsonConfig(string) { debug("Parsing JSON config"); // Parses a JSON-like comment by the same way as parsing CLI option. @@ -115,13 +108,7 @@ module.exports = class ConfigCommentParser { return { success: false, error: { - ruleId: null, - fatal: true, - severity: 2, - message: `Failed to parse JSON from '${normalizedString}': ${ex.message}`, - line: location.start.line, - column: location.start.column + 1, - nodeType: null + message: `Failed to parse JSON from '${normalizedString}': ${ex.message}` } }; diff --git a/tools/eslint/node_modules/eslint/lib/linter/linter.js b/tools/eslint/node_modules/eslint/lib/linter/linter.js index 2587c7d74bb947..a2a69f4c2b4b22 100644 --- a/tools/eslint/node_modules/eslint/lib/linter/linter.js +++ b/tools/eslint/node_modules/eslint/lib/linter/linter.js @@ -45,6 +45,7 @@ const { RuleValidator } = require("../config/rule-validator"); const { assertIsRuleSeverity } = require("../config/flat-config-schema"); const { normalizeSeverityToString } = require("../shared/severity"); const jslang = require("../languages/js"); +const { activeFlags } = require("../shared/flags"); const debug = require("debug")("eslint:linter"); const MAX_AUTOFIX_PASSES = 10; const DEFAULT_PARSER_NAME = "espree"; @@ -317,9 +318,10 @@ function createLintingProblem(options) { * @param {string} options.justification The justification of the directive * @param {ASTNode|token} options.node The Comment node/token. * @param {function(string): {create: Function}} ruleMapper A map from rule IDs to defined rules + * @param {Language} language The language to use to adjust the location information. * @returns {Object} Directives and problems from the comment */ -function createDisableDirectives({ type, value, justification, node }, ruleMapper) { +function createDisableDirectives({ type, value, justification, node }, ruleMapper, language) { const ruleIds = Object.keys(commentParser.parseListConfig(value)); const directiveRules = ruleIds.length ? ruleIds : [null]; const result = { @@ -333,26 +335,36 @@ function createDisableDirectives({ type, value, justification, node }, ruleMappe // push to directives, if the rule is defined(including null, e.g. /*eslint enable*/) if (ruleId === null || !!ruleMapper(ruleId)) { if (type === "disable-next-line") { + const { line, column } = updateLocationInformation( + node.loc.end, + language + ); + result.directives.push({ parentDirective, type, - line: node.loc.end.line, - column: node.loc.end.column + 1, + line, + column, ruleId, justification }); } else { + const { line, column } = updateLocationInformation( + node.loc.start, + language + ); + result.directives.push({ parentDirective, type, - line: node.loc.start.line, - column: node.loc.start.column + 1, + line, + column, ruleId, justification }); } } else { - result.directiveProblems.push(createLintingProblem({ ruleId, loc: node.loc })); + result.directiveProblems.push(createLintingProblem({ ruleId, loc: node.loc, language })); } } return result; @@ -430,7 +442,7 @@ function getDirectiveComments(sourceCode, ruleMapper, warnInlineConfig, config) value: directiveValue, justification: justificationPart, node: comment - }, ruleMapper); + }, ruleMapper, jslang); disableDirectives.push(...directives); problems.push(...directiveProblems); @@ -470,7 +482,7 @@ function getDirectiveComments(sourceCode, ruleMapper, warnInlineConfig, config) break; case "eslint": { - const parseResult = commentParser.parseJsonConfig(directiveValue, comment.loc); + const parseResult = commentParser.parseJsonConfig(directiveValue); if (parseResult.success) { Object.keys(parseResult.config).forEach(name => { @@ -557,7 +569,14 @@ function getDirectiveComments(sourceCode, ruleMapper, warnInlineConfig, config) configuredRules[name] = ruleOptions; }); } else { - problems.push(parseResult.error); + const problem = createLintingProblem({ + ruleId: null, + loc: comment.loc, + message: parseResult.error.message + }); + + problem.fatal = true; + problems.push(problem); } break; @@ -588,22 +607,24 @@ function getDirectiveCommentsForFlatConfig(sourceCode, ruleMapper, language) { const disableDirectives = []; const problems = []; - const { - directives: directivesSources, - problems: directivesProblems - } = sourceCode.getDisableDirectives(); + if (sourceCode.getDisableDirectives) { + const { + directives: directivesSources, + problems: directivesProblems + } = sourceCode.getDisableDirectives(); - problems.push(...directivesProblems.map(directiveProblem => createLintingProblem({ - ...directiveProblem, - language - }))); + problems.push(...directivesProblems.map(directiveProblem => createLintingProblem({ + ...directiveProblem, + language + }))); - directivesSources.forEach(directive => { - const { directives, directiveProblems } = createDisableDirectives(directive, ruleMapper); + directivesSources.forEach(directive => { + const { directives, directiveProblems } = createDisableDirectives(directive, ruleMapper, language); - disableDirectives.push(...directives); - problems.push(...directiveProblems); - }); + disableDirectives.push(...directives); + problems.push(...directiveProblems); + }); + } return { problems, @@ -1122,9 +1143,9 @@ function runRules( }); const eventGenerator = new NodeEventGenerator(emitter, { - visitorKeys: sourceCode.visitorKeys, + visitorKeys: sourceCode.visitorKeys ?? language.visitorKeys, fallback: Traverser.getKeys, - matchClass: language.matchesSelectorClass, + matchClass: language.matchesSelectorClass ?? (() => false), nodeTypeKey: language.nodeTypeKey }); @@ -1253,11 +1274,13 @@ class Linter { * Initialize the Linter. * @param {Object} [config] the config object * @param {string} [config.cwd] path to a directory that should be considered as the current working directory, can be undefined. + * @param {Array} [config.flags] the feature flags to enable. * @param {"flat"|"eslintrc"} [config.configType="flat"] the type of config used. */ - constructor({ cwd, configType = "flat" } = {}) { + constructor({ cwd, configType = "flat", flags = [] } = {}) { internalSlotsMap.set(this, { cwd: normalizeCwd(cwd), + flags: flags.filter(flag => activeFlags.has(flag)), lastConfigArray: null, lastSourceCode: null, lastSuppressedMessages: [], @@ -1278,6 +1301,15 @@ class Linter { return pkg.version; } + /** + * Indicates if the given feature flag is enabled for this instance. + * @param {string} flag The feature flag to check. + * @returns {boolean} `true` if the feature flag is enabled, `false` if not. + */ + hasFlag(flag) { + return internalSlotsMap.get(this).flags.includes(flag); + } + /** * Same as linter.verify, except without support for processors. * @param {string|SourceCode} textOrSourceCode The text to parse or a SourceCode object. @@ -1679,8 +1711,13 @@ class Linter { /* * If the given source code object as the first argument does not have scopeManager, analyze the scope. * This is for backward compatibility (SourceCode is frozen so it cannot rebind). + * + * We check explicitly for `null` to ensure that this is a JS-flavored language. + * For non-JS languages we don't want to do this. + * + * TODO: Remove this check when we stop exporting the `SourceCode` object. */ - if (!slots.lastSourceCode.scopeManager) { + if (slots.lastSourceCode.scopeManager === null) { slots.lastSourceCode = new SourceCode({ text: slots.lastSourceCode.text, ast: slots.lastSourceCode.ast, @@ -1699,7 +1736,7 @@ class Linter { * this is primarily about adding variables into the global scope * to account for ecmaVersion and configured globals. */ - sourceCode.applyLanguageOptions(languageOptions); + sourceCode.applyLanguageOptions?.(languageOptions); const mergedInlineConfig = { rules: {} @@ -1716,147 +1753,151 @@ class Linter { // if inline config should warn then add the warnings if (options.warnInlineConfig) { - sourceCode.getInlineConfigNodes().forEach(node => { - inlineConfigProblems.push(createLintingProblem({ - ruleId: null, - message: `'${sourceCode.text.slice(node.range[0], node.range[1])}' has no effect because you have 'noInlineConfig' setting in ${options.warnInlineConfig}.`, - loc: node.loc, - severity: 1, - language: config.language - })); + if (sourceCode.getInlineConfigNodes) { + sourceCode.getInlineConfigNodes().forEach(node => { + inlineConfigProblems.push(createLintingProblem({ + ruleId: null, + message: `'${sourceCode.text.slice(node.range[0], node.range[1])}' has no effect because you have 'noInlineConfig' setting in ${options.warnInlineConfig}.`, + loc: node.loc, + severity: 1, + language: config.language + })); - }); + }); + } } else { - const inlineConfigResult = sourceCode.applyInlineConfig(); - - inlineConfigProblems.push( - ...inlineConfigResult.problems - .map(problem => createLintingProblem({ ...problem, language: config.language })) - .map(problem => { - problem.fatal = true; - return problem; - }) - ); + const inlineConfigResult = sourceCode.applyInlineConfig?.(); + + if (inlineConfigResult) { + inlineConfigProblems.push( + ...inlineConfigResult.problems + .map(problem => createLintingProblem({ ...problem, language: config.language })) + .map(problem => { + problem.fatal = true; + return problem; + }) + ); + + // next we need to verify information about the specified rules + const ruleValidator = new RuleValidator(); + + for (const { config: inlineConfig, loc } of inlineConfigResult.configs) { + + Object.keys(inlineConfig.rules).forEach(ruleId => { + const rule = getRuleFromConfig(ruleId, config); + const ruleValue = inlineConfig.rules[ruleId]; + + if (!rule) { + inlineConfigProblems.push(createLintingProblem({ + ruleId, + loc, + language: config.language + })); + return; + } - // next we need to verify information about the specified rules - const ruleValidator = new RuleValidator(); + if (Object.hasOwn(mergedInlineConfig.rules, ruleId)) { + inlineConfigProblems.push(createLintingProblem({ + message: `Rule "${ruleId}" is already configured by another configuration comment in the preceding code. This configuration is ignored.`, + loc, + language: config.language + })); + return; + } - for (const { config: inlineConfig, node } of inlineConfigResult.configs) { + try { - Object.keys(inlineConfig.rules).forEach(ruleId => { - const rule = getRuleFromConfig(ruleId, config); - const ruleValue = inlineConfig.rules[ruleId]; + let ruleOptions = Array.isArray(ruleValue) ? ruleValue : [ruleValue]; - if (!rule) { - inlineConfigProblems.push(createLintingProblem({ - ruleId, - loc: node.loc, - language: config.language - })); - return; - } + assertIsRuleSeverity(ruleId, ruleOptions[0]); - if (Object.hasOwn(mergedInlineConfig.rules, ruleId)) { - inlineConfigProblems.push(createLintingProblem({ - message: `Rule "${ruleId}" is already configured by another configuration comment in the preceding code. This configuration is ignored.`, - loc: node.loc, - language: config.language - })); - return; - } + /* + * If the rule was already configured, inline rule configuration that + * only has severity should retain options from the config and just override the severity. + * + * Example: + * + * { + * rules: { + * curly: ["error", "multi"] + * } + * } + * + * /* eslint curly: ["warn"] * / + * + * Results in: + * + * curly: ["warn", "multi"] + */ - try { + let shouldValidateOptions = true; - let ruleOptions = Array.isArray(ruleValue) ? ruleValue : [ruleValue]; + if ( - assertIsRuleSeverity(ruleId, ruleOptions[0]); + /* + * If inline config for the rule has only severity + */ + ruleOptions.length === 1 && - /* - * If the rule was already configured, inline rule configuration that - * only has severity should retain options from the config and just override the severity. - * - * Example: - * - * { - * rules: { - * curly: ["error", "multi"] - * } - * } - * - * /* eslint curly: ["warn"] * / - * - * Results in: - * - * curly: ["warn", "multi"] - */ + /* + * And the rule was already configured + */ + config.rules && Object.hasOwn(config.rules, ruleId) + ) { - let shouldValidateOptions = true; + /* + * Then use severity from the inline config and options from the provided config + */ + ruleOptions = [ + ruleOptions[0], // severity from the inline config + ...config.rules[ruleId].slice(1) // options from the provided config + ]; - if ( + // if the rule was enabled, the options have already been validated + if (config.rules[ruleId][0] > 0) { + shouldValidateOptions = false; + } + } - /* - * If inline config for the rule has only severity - */ - ruleOptions.length === 1 && + if (shouldValidateOptions) { + ruleValidator.validate({ + plugins: config.plugins, + rules: { + [ruleId]: ruleOptions + } + }); + } - /* - * And the rule was already configured - */ - config.rules && Object.hasOwn(config.rules, ruleId) - ) { + mergedInlineConfig.rules[ruleId] = ruleOptions; + } catch (err) { /* - * Then use severity from the inline config and options from the provided config + * If the rule has invalid `meta.schema`, throw the error because + * this is not an invalid inline configuration but an invalid rule. */ - ruleOptions = [ - ruleOptions[0], // severity from the inline config - ...config.rules[ruleId].slice(1) // options from the provided config - ]; - - // if the rule was enabled, the options have already been validated - if (config.rules[ruleId][0] > 0) { - shouldValidateOptions = false; + if (err.code === "ESLINT_INVALID_RULE_OPTIONS_SCHEMA") { + throw err; } - } - if (shouldValidateOptions) { - ruleValidator.validate({ - plugins: config.plugins, - rules: { - [ruleId]: ruleOptions - } - }); - } + let baseMessage = err.message.slice( + err.message.startsWith("Key \"rules\":") + ? err.message.indexOf(":", 12) + 1 + : err.message.indexOf(":") + 1 + ).trim(); - mergedInlineConfig.rules[ruleId] = ruleOptions; - } catch (err) { - - /* - * If the rule has invalid `meta.schema`, throw the error because - * this is not an invalid inline configuration but an invalid rule. - */ - if (err.code === "ESLINT_INVALID_RULE_OPTIONS_SCHEMA") { - throw err; - } - - let baseMessage = err.message.slice( - err.message.startsWith("Key \"rules\":") - ? err.message.indexOf(":", 12) + 1 - : err.message.indexOf(":") + 1 - ).trim(); + if (err.messageTemplate) { + baseMessage += ` You passed "${ruleValue}".`; + } - if (err.messageTemplate) { - baseMessage += ` You passed "${ruleValue}".`; + inlineConfigProblems.push(createLintingProblem({ + ruleId, + message: `Inline configuration for rule "${ruleId}" is invalid:\n\t${baseMessage}\n`, + loc, + language: config.language + })); } - - inlineConfigProblems.push(createLintingProblem({ - ruleId, - message: `Inline configuration for rule "${ruleId}" is invalid:\n\t${baseMessage}\n`, - loc: node.loc, - language: config.language - })); - } - }); + }); + } } } } @@ -1873,7 +1914,7 @@ class Linter { let lintingProblems; - sourceCode.finalize(); + sourceCode.finalize?.(); try { lintingProblems = runRules( diff --git a/tools/eslint/node_modules/eslint/lib/options.js b/tools/eslint/node_modules/eslint/lib/options.js index 5515ec60837e75..d35c9f6d906718 100644 --- a/tools/eslint/node_modules/eslint/lib/options.js +++ b/tools/eslint/node_modules/eslint/lib/options.js @@ -30,6 +30,7 @@ const optionator = require("optionator"); * @property {boolean} errorOnUnmatchedPattern Prevent errors when pattern is unmatched * @property {boolean} eslintrc Disable use of configuration from .eslintrc.* * @property {string[]} [ext] Specify JavaScript file extensions + * @property {string[]} [flag] Feature flags * @property {boolean} fix Automatically fix problems * @property {boolean} fixDryRun Automatically fix problems without saving the changes to the file system * @property {("directive" | "problem" | "suggestion" | "layout")[]} [fixType] Specify the types of fixes to apply (directive, problem, suggestion, layout) @@ -176,6 +177,16 @@ module.exports = function(usingFlatConfig) { }; } + let flagFlag; + + if (usingFlatConfig) { + flagFlag = { + option: "flag", + type: "[String]", + description: "Enable a feature flag" + }; + } + return optionator({ prepend: "eslint [options] file.js [file.js] [dir]", defaults: { @@ -424,7 +435,8 @@ module.exports = function(usingFlatConfig) { type: "path::String", description: "Print the configuration for the given file" }, - statsFlag + statsFlag, + flagFlag ].filter(value => !!value) }); }; diff --git a/tools/eslint/node_modules/eslint/lib/rules/no-unused-vars.js b/tools/eslint/node_modules/eslint/lib/rules/no-unused-vars.js index d17253acf745c2..baf14a7f79dcbd 100644 --- a/tools/eslint/node_modules/eslint/lib/rules/no-unused-vars.js +++ b/tools/eslint/node_modules/eslint/lib/rules/no-unused-vars.js @@ -147,6 +147,36 @@ module.exports = { } } + /** + * Determines what variable type a def is. + * @param {Object} def the declaration to check + * @returns {VariableType} a simple name for the types of variables that this rule supports + */ + function defToVariableType(def) { + + /* + * This `destructuredArrayIgnorePattern` error report works differently from the catch + * clause and parameter error reports. _Both_ the `varsIgnorePattern` and the + * `destructuredArrayIgnorePattern` will be checked for array destructuring. However, + * for the purposes of the report, the currently defined behavior is to only inform the + * user of the `destructuredArrayIgnorePattern` if it's present (regardless of the fact + * that the `varsIgnorePattern` would also apply). If it's not present, the user will be + * informed of the `varsIgnorePattern`, assuming that's present. + */ + if (config.destructuredArrayIgnorePattern && def.name.parent.type === "ArrayPattern") { + return "array-destructure"; + } + + switch (def.type) { + case "CatchClause": + return "catch-clause"; + case "Parameter": + return "parameter"; + default: + return "variable"; + } + } + /** * Gets a given variable's description and configured ignore pattern * based on the provided variableType @@ -167,7 +197,7 @@ module.exports = { case "catch-clause": pattern = config.caughtErrorsIgnorePattern; - variableDescription = "args"; + variableDescription = "caught errors"; break; case "parameter": @@ -202,28 +232,7 @@ module.exports = { let additionalMessageData = ""; if (def) { - let pattern; - let variableDescription; - - switch (def.type) { - case "CatchClause": - if (config.caughtErrorsIgnorePattern) { - [variableDescription, pattern] = getVariableDescription("catch-clause"); - } - break; - - case "Parameter": - if (config.argsIgnorePattern) { - [variableDescription, pattern] = getVariableDescription("parameter"); - } - break; - - default: - if (config.varsIgnorePattern) { - [variableDescription, pattern] = getVariableDescription("variable"); - } - break; - } + const [variableDescription, pattern] = getVariableDescription(defToVariableType(def)); if (pattern && variableDescription) { additionalMessageData = `. Allowed unused ${variableDescription} must match ${pattern}`; @@ -248,14 +257,7 @@ module.exports = { let additionalMessageData = ""; if (def) { - let pattern; - let variableDescription; - - if (def.name.parent.type === "ArrayPattern" && config.destructuredArrayIgnorePattern) { - [variableDescription, pattern] = getVariableDescription("array-destructure"); - } else if (config.varsIgnorePattern) { - [variableDescription, pattern] = getVariableDescription("variable"); - } + const [variableDescription, pattern] = getVariableDescription(defToVariableType(def)); if (pattern && variableDescription) { additionalMessageData = `. Allowed unused ${variableDescription} must match ${pattern}`; diff --git a/tools/eslint/node_modules/eslint/lib/shared/flags.js b/tools/eslint/node_modules/eslint/lib/shared/flags.js new file mode 100644 index 00000000000000..555f818e4871b0 --- /dev/null +++ b/tools/eslint/node_modules/eslint/lib/shared/flags.js @@ -0,0 +1,26 @@ +/** + * @fileoverview Shared flags for ESLint. + */ + +"use strict"; + +/** + * The set of flags that change ESLint behavior with a description. + * @type {Map} + */ +const activeFlags = new Map([ + ["test_only", "This flag is only used for testing."] +]); + +/** + * The set of flags that used to be active but no longer have an effect. + * @type {Map} + */ +const inactiveFlags = new Map([ + ["test_only_old", "This flag is no longer used for testing."] +]); + +module.exports = { + activeFlags, + inactiveFlags +}; diff --git a/tools/eslint/node_modules/eslint/lib/shared/logging.js b/tools/eslint/node_modules/eslint/lib/shared/logging.js index fd5e8a648e1c25..9310e586c23b61 100644 --- a/tools/eslint/node_modules/eslint/lib/shared/logging.js +++ b/tools/eslint/node_modules/eslint/lib/shared/logging.js @@ -11,7 +11,7 @@ module.exports = { /** - * Cover for console.log + * Cover for console.info * @param {...any} args The elements to log. * @returns {void} */ @@ -19,6 +19,15 @@ module.exports = { console.log(...args); }, + /** + * Cover for console.warn + * @param {...any} args The elements to log. + * @returns {void} + */ + warn(...args) { + console.warn(...args); + }, + /** * Cover for console.error * @param {...any} args The elements to log. diff --git a/tools/eslint/node_modules/eslint/lib/shared/types.js b/tools/eslint/node_modules/eslint/lib/shared/types.js index f4186dd96adab8..94a91afc813955 100644 --- a/tools/eslint/node_modules/eslint/lib/shared/types.js +++ b/tools/eslint/node_modules/eslint/lib/shared/types.js @@ -21,7 +21,7 @@ module.exports = {}; /** * @typedef {Object} ParserOptions * @property {EcmaFeatures} [ecmaFeatures] The optional features. - * @property {3|5|6|7|8|9|10|11|12|13|14|15|2015|2016|2017|2018|2019|2020|2021|2022|2023|2024} [ecmaVersion] The ECMAScript version (or revision number). + * @property {3|5|6|7|8|9|10|11|12|13|14|15|16|2015|2016|2017|2018|2019|2020|2021|2022|2023|2024|2025} [ecmaVersion] The ECMAScript version (or revision number). * @property {"script"|"module"} [sourceType] The source code type. * @property {boolean} [allowReserved] Allowing the use of reserved words as identifiers in ES3. */ diff --git a/tools/eslint/node_modules/eslint/package.json b/tools/eslint/node_modules/eslint/package.json index 02e5647338d5a8..b5abac6090bc43 100644 --- a/tools/eslint/node_modules/eslint/package.json +++ b/tools/eslint/node_modules/eslint/package.json @@ -1,6 +1,6 @@ { "name": "eslint", - "version": "9.5.0", + "version": "9.6.0", "author": "Nicholas C. Zakas ", "description": "An AST-based pattern checker for JavaScript.", "bin": { @@ -68,9 +68,9 @@ "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", - "@eslint/config-array": "^0.16.0", + "@eslint/config-array": "^0.17.0", "@eslint/eslintrc": "^3.1.0", - "@eslint/js": "9.5.0", + "@eslint/js": "9.6.0", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.3.0", "@nodelib/fs.walk": "^1.2.8", @@ -81,7 +81,7 @@ "escape-string-regexp": "^4.0.0", "eslint-scope": "^8.0.1", "eslint-visitor-keys": "^4.0.0", - "espree": "^10.0.1", + "espree": "^10.1.0", "esquery": "^1.5.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", @@ -104,13 +104,11 @@ "devDependencies": { "@babel/core": "^7.4.3", "@babel/preset-env": "^7.4.3", - "@eslint-community/eslint-plugin-eslint-comments": "^4.3.0", "@types/estree": "^1.0.5", "@types/node": "^20.11.5", "@wdio/browser-runner": "^8.38.3", "@wdio/cli": "^8.38.2", "@wdio/concise-reporter": "^8.38.2", - "@wdio/globals": "^8.38.2", "@wdio/mocha-framework": "^8.38.2", "babel-loader": "^8.0.5", "c8": "^7.12.0", @@ -122,11 +120,8 @@ "eslint": "file:.", "eslint-config-eslint": "file:packages/eslint-config-eslint", "eslint-plugin-eslint-plugin": "^6.0.0", - "eslint-plugin-internal-rules": "file:tools/internal-rules", - "eslint-plugin-jsdoc": "^48.2.3", - "eslint-plugin-n": "^17.2.0", - "eslint-plugin-unicorn": "^52.0.0", "eslint-release": "^3.2.2", + "eslint-rule-composer": "^0.3.0", "eslump": "^3.0.0", "esprima": "^4.0.1", "fast-glob": "^3.2.11", @@ -136,7 +131,7 @@ "got": "^11.8.3", "gray-matter": "^4.0.3", "js-yaml": "^4.1.0", - "knip": "^5.8.0", + "knip": "^5.21.0", "lint-staged": "^11.0.0", "load-perf": "^0.2.0", "markdown-it": "^12.2.0", diff --git a/tools/eslint/node_modules/parse-imports/dist/index.cjs b/tools/eslint/node_modules/parse-imports/dist/index.cjs new file mode 100644 index 00000000000000..1d1577b349ee2a --- /dev/null +++ b/tools/eslint/node_modules/parse-imports/dist/index.cjs @@ -0,0 +1,403 @@ +var esModuleLexer = require('es-module-lexer'); +var assert = require('node:assert'); +var slashes = require('slashes'); +var module$1 = require('node:module'); +var node_path = require('node:path'); + +var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null; +/** + * Copyright 2020 Google LLC + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const separatorRegex = /^(?:\s+|,)$/u; +const skipSeparators = (imported, i) => { + while (i < imported.length && separatorRegex.test(imported[i])) { + i++; + } + return i; +}; +const skipNonSeparators = (imported, i) => { + while (i < imported.length && !separatorRegex.test(imported[i])) { + i++; + } + return i; +}; + +/** + * Copyright 2020 Google LLC + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const parseDefaultImport = (importClauseString, i) => { + const startIndex = i; + i = skipNonSeparators(importClauseString, i); + return { + defaultImport: importClauseString.slice(startIndex, i), + i + }; +}; + +/** + * Copyright 2020 Google LLC + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const parseNamedImports = (importClauseString, i) => { + const startIndex = ++i; + while (i < importClauseString.length && importClauseString[i] !== `}`) { + i++; + } + const namedImports = importClauseString.slice(startIndex, i++).split(`,`).map(namedImport => { + namedImport = namedImport.trim(); + if (namedImport.includes(` `)) { + const components = namedImport.split(` `); + return { + specifier: components[0], + binding: components.at(-1) + }; + } + return { + specifier: namedImport, + binding: namedImport + }; + }).filter(({ + specifier + }) => specifier.length > 0); + return { + namedImports, + i + }; +}; + +/** + * Copyright 2020 Google LLC + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const parseNamespaceImport = (importClauseString, i) => { + i++; + i = skipSeparators(importClauseString, i); + i += `as`.length; + i = skipSeparators(importClauseString, i); + const startIndex = i; + i = skipNonSeparators(importClauseString, i); + return { + namespaceImport: importClauseString.slice(startIndex, i), + i + }; +}; + +/** + * Copyright 2020 Google LLC + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +// Assumes import clause is syntactically valid +const parseImportClause = importClauseString => { + let defaultImport; + let namespaceImport; + const namedImports = []; + for (let i = 0; i < importClauseString.length; i++) { + if (separatorRegex.test(importClauseString[i])) { + continue; + } + if (importClauseString[i] === `{`) { + let newNamedImports; + ({ + namedImports: newNamedImports, + i + } = parseNamedImports(importClauseString, i)); + namedImports.push(...newNamedImports); + } else if (importClauseString[i] === `*`) { + ({ + namespaceImport, + i + } = parseNamespaceImport(importClauseString, i)); + } else { + ({ + defaultImport, + i + } = parseDefaultImport(importClauseString, i)); + } + } + return { + default: defaultImport, + namespace: namespaceImport, + named: namedImports + }; +}; + +/** + * Copyright 2020 Google LLC + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Assumes the string is syntactically valid +const isConstantStringLiteral = stringLiteral => { + const quote = [`'`, `"`, `\``].find(quoteCandidate => stringLiteral.startsWith(quoteCandidate) && stringLiteral.endsWith(quoteCandidate)); + if (quote == null) { + return false; + } + for (let i = 1; i < stringLiteral.length - 1; i++) { + // Check for end of string literal before end of stringLiteral + if (stringLiteral[i] === quote && stringLiteral[i - 1] !== `\\`) { + return false; + } + + // Check for interpolated value in template literal + if (quote === `\`` && stringLiteral.slice(i, i + 2) === `\${` && stringLiteral[i - 1] !== `\\`) { + return false; + } + } + return true; +}; + +/** + * Copyright 2020 Google LLC + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const builtinModules = new Set(module$1.builtinModules); +const parseType = moduleSpecifier => { + if (moduleSpecifier.length === 0) { + return `invalid`; + } + if (moduleSpecifier.startsWith(`/`)) { + return `absolute`; + } + if (moduleSpecifier.startsWith(`.`)) { + return `relative`; + } + if (builtinModules.has(moduleSpecifier)) { + return `builtin`; + } + return `package`; +}; + +/** + * Copyright 2020 Google LLC + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const require$1 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))); +const resolve = (from, to) => { + try { + return require$1.resolve(to, { + paths: [node_path.dirname(from)] + }); + } catch { + return undefined; + } +}; + +/** + * Copyright 2020 Google LLC + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const parseModuleSpecifier = (moduleSpecifierString, { + isDynamicImport, + resolveFrom +}) => { + assert(isDynamicImport || isConstantStringLiteral(moduleSpecifierString)); + const { + isConstant, + value + } = !isDynamicImport || isConstantStringLiteral(moduleSpecifierString) ? { + isConstant: true, + value: slashes.removeSlashes(moduleSpecifierString.slice(1, -1)) + } : { + isConstant: false, + value: undefined + }; + return { + type: isConstant ? parseType(value) : `unknown`, + isConstant, + code: moduleSpecifierString, + value, + resolved: typeof resolveFrom === `string` && isConstant ? resolve(resolveFrom, value) : undefined + }; +}; + +/** + * Copyright 2020 Google LLC + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const wasmLoadPromise = esModuleLexer.init; +const parseImports = async (code, options) => { + await wasmLoadPromise; + return parseImportsSync(code, options); +}; +const parseImportsSync = (code, { + resolveFrom +} = {}) => { + const result = esModuleLexer.parse(code, resolveFrom == null ? undefined : resolveFrom); + if (!Array.isArray(result)) { + throw new TypeError(`Expected WASM to be loaded before calling parseImportsSync`); + } + const [imports] = result; + return { + *[Symbol.iterator]() { + for (let { + d: dynamicImportStartIndex, + ss: statementStartIndex, + s: moduleSpecifierStartIndex, + e: moduleSpecifierEndIndexExclusive + } of imports) { + const isImportMeta = dynamicImportStartIndex === -2; + if (isImportMeta) { + continue; + } + const isDynamicImport = dynamicImportStartIndex > -1; + + // Include string literal quotes in character range + if (!isDynamicImport) { + moduleSpecifierStartIndex--; + moduleSpecifierEndIndexExclusive++; + } + const moduleSpecifierString = code.slice(moduleSpecifierStartIndex, moduleSpecifierEndIndexExclusive); + const moduleSpecifier = { + startIndex: moduleSpecifierStartIndex, + endIndex: moduleSpecifierEndIndexExclusive, + ...parseModuleSpecifier(moduleSpecifierString, { + isDynamicImport, + resolveFrom + }) + }; + let importClause; + if (!isDynamicImport) { + let importClauseString = code.slice(statementStartIndex + `import`.length, moduleSpecifierStartIndex).trim(); + if (importClauseString.endsWith(`from`)) { + importClauseString = importClauseString.slice(0, Math.max(0, importClauseString.length - `from`.length)); + } + importClause = parseImportClause(importClauseString); + } + yield { + startIndex: statementStartIndex, + // Include the closing parenthesis for dynamic import + endIndex: isDynamicImport ? moduleSpecifierEndIndexExclusive + 1 : moduleSpecifierEndIndexExclusive, + isDynamicImport, + moduleSpecifier, + importClause + }; + } + } + }; +}; + +exports.parseImports = parseImports; +exports.parseImportsSync = parseImportsSync; +exports.wasmLoadPromise = wasmLoadPromise; diff --git a/tools/eslint/node_modules/parse-imports/dist/index.js b/tools/eslint/node_modules/parse-imports/dist/index.js new file mode 100644 index 00000000000000..a27ebd11c9534e --- /dev/null +++ b/tools/eslint/node_modules/parse-imports/dist/index.js @@ -0,0 +1,400 @@ +import { init, parse } from 'es-module-lexer'; +import assert from 'node:assert'; +import { removeSlashes } from 'slashes'; +import module, { createRequire } from 'node:module'; +import { dirname } from 'node:path'; + +/** + * Copyright 2020 Google LLC + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const separatorRegex = /^(?:\s+|,)$/u; +const skipSeparators = (imported, i) => { + while (i < imported.length && separatorRegex.test(imported[i])) { + i++; + } + return i; +}; +const skipNonSeparators = (imported, i) => { + while (i < imported.length && !separatorRegex.test(imported[i])) { + i++; + } + return i; +}; + +/** + * Copyright 2020 Google LLC + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const parseDefaultImport = (importClauseString, i) => { + const startIndex = i; + i = skipNonSeparators(importClauseString, i); + return { + defaultImport: importClauseString.slice(startIndex, i), + i + }; +}; + +/** + * Copyright 2020 Google LLC + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const parseNamedImports = (importClauseString, i) => { + const startIndex = ++i; + while (i < importClauseString.length && importClauseString[i] !== `}`) { + i++; + } + const namedImports = importClauseString.slice(startIndex, i++).split(`,`).map(namedImport => { + namedImport = namedImport.trim(); + if (namedImport.includes(` `)) { + const components = namedImport.split(` `); + return { + specifier: components[0], + binding: components.at(-1) + }; + } + return { + specifier: namedImport, + binding: namedImport + }; + }).filter(({ + specifier + }) => specifier.length > 0); + return { + namedImports, + i + }; +}; + +/** + * Copyright 2020 Google LLC + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const parseNamespaceImport = (importClauseString, i) => { + i++; + i = skipSeparators(importClauseString, i); + i += `as`.length; + i = skipSeparators(importClauseString, i); + const startIndex = i; + i = skipNonSeparators(importClauseString, i); + return { + namespaceImport: importClauseString.slice(startIndex, i), + i + }; +}; + +/** + * Copyright 2020 Google LLC + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +// Assumes import clause is syntactically valid +const parseImportClause = importClauseString => { + let defaultImport; + let namespaceImport; + const namedImports = []; + for (let i = 0; i < importClauseString.length; i++) { + if (separatorRegex.test(importClauseString[i])) { + continue; + } + if (importClauseString[i] === `{`) { + let newNamedImports; + ({ + namedImports: newNamedImports, + i + } = parseNamedImports(importClauseString, i)); + namedImports.push(...newNamedImports); + } else if (importClauseString[i] === `*`) { + ({ + namespaceImport, + i + } = parseNamespaceImport(importClauseString, i)); + } else { + ({ + defaultImport, + i + } = parseDefaultImport(importClauseString, i)); + } + } + return { + default: defaultImport, + namespace: namespaceImport, + named: namedImports + }; +}; + +/** + * Copyright 2020 Google LLC + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// Assumes the string is syntactically valid +const isConstantStringLiteral = stringLiteral => { + const quote = [`'`, `"`, `\``].find(quoteCandidate => stringLiteral.startsWith(quoteCandidate) && stringLiteral.endsWith(quoteCandidate)); + if (quote == null) { + return false; + } + for (let i = 1; i < stringLiteral.length - 1; i++) { + // Check for end of string literal before end of stringLiteral + if (stringLiteral[i] === quote && stringLiteral[i - 1] !== `\\`) { + return false; + } + + // Check for interpolated value in template literal + if (quote === `\`` && stringLiteral.slice(i, i + 2) === `\${` && stringLiteral[i - 1] !== `\\`) { + return false; + } + } + return true; +}; + +/** + * Copyright 2020 Google LLC + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const builtinModules = new Set(module.builtinModules); +const parseType = moduleSpecifier => { + if (moduleSpecifier.length === 0) { + return `invalid`; + } + if (moduleSpecifier.startsWith(`/`)) { + return `absolute`; + } + if (moduleSpecifier.startsWith(`.`)) { + return `relative`; + } + if (builtinModules.has(moduleSpecifier)) { + return `builtin`; + } + return `package`; +}; + +/** + * Copyright 2020 Google LLC + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const require = createRequire(import.meta.url); +const resolve = (from, to) => { + try { + return require.resolve(to, { + paths: [dirname(from)] + }); + } catch { + return undefined; + } +}; + +/** + * Copyright 2020 Google LLC + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const parseModuleSpecifier = (moduleSpecifierString, { + isDynamicImport, + resolveFrom +}) => { + assert(isDynamicImport || isConstantStringLiteral(moduleSpecifierString)); + const { + isConstant, + value + } = !isDynamicImport || isConstantStringLiteral(moduleSpecifierString) ? { + isConstant: true, + value: removeSlashes(moduleSpecifierString.slice(1, -1)) + } : { + isConstant: false, + value: undefined + }; + return { + type: isConstant ? parseType(value) : `unknown`, + isConstant, + code: moduleSpecifierString, + value, + resolved: typeof resolveFrom === `string` && isConstant ? resolve(resolveFrom, value) : undefined + }; +}; + +/** + * Copyright 2020 Google LLC + * + * 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 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const wasmLoadPromise = init; +const parseImports = async (code, options) => { + await wasmLoadPromise; + return parseImportsSync(code, options); +}; +const parseImportsSync = (code, { + resolveFrom +} = {}) => { + const result = parse(code, resolveFrom == null ? undefined : resolveFrom); + if (!Array.isArray(result)) { + throw new TypeError(`Expected WASM to be loaded before calling parseImportsSync`); + } + const [imports] = result; + return { + *[Symbol.iterator]() { + for (let { + d: dynamicImportStartIndex, + ss: statementStartIndex, + s: moduleSpecifierStartIndex, + e: moduleSpecifierEndIndexExclusive + } of imports) { + const isImportMeta = dynamicImportStartIndex === -2; + if (isImportMeta) { + continue; + } + const isDynamicImport = dynamicImportStartIndex > -1; + + // Include string literal quotes in character range + if (!isDynamicImport) { + moduleSpecifierStartIndex--; + moduleSpecifierEndIndexExclusive++; + } + const moduleSpecifierString = code.slice(moduleSpecifierStartIndex, moduleSpecifierEndIndexExclusive); + const moduleSpecifier = { + startIndex: moduleSpecifierStartIndex, + endIndex: moduleSpecifierEndIndexExclusive, + ...parseModuleSpecifier(moduleSpecifierString, { + isDynamicImport, + resolveFrom + }) + }; + let importClause; + if (!isDynamicImport) { + let importClauseString = code.slice(statementStartIndex + `import`.length, moduleSpecifierStartIndex).trim(); + if (importClauseString.endsWith(`from`)) { + importClauseString = importClauseString.slice(0, Math.max(0, importClauseString.length - `from`.length)); + } + importClause = parseImportClause(importClauseString); + } + yield { + startIndex: statementStartIndex, + // Include the closing parenthesis for dynamic import + endIndex: isDynamicImport ? moduleSpecifierEndIndexExclusive + 1 : moduleSpecifierEndIndexExclusive, + isDynamicImport, + moduleSpecifier, + importClause + }; + } + } + }; +}; + +export { parseImports, parseImportsSync, wasmLoadPromise }; diff --git a/tools/eslint/node_modules/parse-imports/license b/tools/eslint/node_modules/parse-imports/license new file mode 100644 index 00000000000000..f49a4e16e68b12 --- /dev/null +++ b/tools/eslint/node_modules/parse-imports/license @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/tools/eslint/node_modules/parse-imports/package.json b/tools/eslint/node_modules/parse-imports/package.json new file mode 100644 index 00000000000000..c4d12f5477e3f2 --- /dev/null +++ b/tools/eslint/node_modules/parse-imports/package.json @@ -0,0 +1,60 @@ +{ + "name": "parse-imports", + "version": "2.1.0", + "author": { + "name": "Tomer Aberbach", + "email": "tomeraberbach@gmail.com", + "url": "https://tomeraberba.ch" + }, + "description": "A blazing fast ES module imports parser.", + "keywords": [ + "esm", + "imports", + "module", + "parser", + "imports" + ], + "homepage": "https://github.com/TomerAberbach/parse-imports", + "repository": "TomerAberbach/parse-imports", + "bugs": { + "url": "https://github.com/TomerAberbach/parse-imports/issues" + }, + "license": "Apache 2.0", + "files": [ + "dist" + ], + "type": "module", + "engines": { + "node": ">= 18" + }, + "exports": { + "types": "./dist/index.d.ts", + "require": "./dist/index.cjs", + "import": "./dist/index.js" + }, + "types": "./dist/index.d.ts", + "main": "./dist/index.cjs", + "module": "./dist/index.js", + "prettier": "tomer/prettier-config", + "dependencies": { + "es-module-lexer": "^1.5.3", + "slashes": "^3.0.12" + }, + "devDependencies": { + "@types/jest": "^29.5.12", + "@types/node": "^20.14.8", + "eslint": "^8.57.0", + "jest": "^29.7.0", + "prettier": "^3.3.2", + "tomer": "^3.2.4", + "typescript": "^5.5.2" + }, + "scripts": { + "format": "tomer format", + "lint": "tomer lint", + "typecheck": "tomer typecheck", + "test": "tomer test", + "build": "tomer build", + "clean": "tomer clean dist" + } +} \ No newline at end of file diff --git a/tools/eslint/node_modules/parse-imports/readme.md b/tools/eslint/node_modules/parse-imports/readme.md new file mode 100644 index 00000000000000..b45683cbdca256 --- /dev/null +++ b/tools/eslint/node_modules/parse-imports/readme.md @@ -0,0 +1,280 @@ +

+ parse-imports +

+ + + +
+ A blazing fast ES module imports parser. +
+ +## Features + +- Uses the superb WASM-based + [`es-module-lexer`](https://github.com/guybedford/es-module-lexer) under the + hood +- Identifies module specifier types (e.g. relative file import, package import, + builtin import, etc.) +- Unescapes module specifier escape sequences +- Collects default, named, and namespace imports +- Works with dynamic imports +- Resolves module specifier paths via `require.resolve` + +## Install + +```sh +$ npm i parse-imports +``` + +## Usage + +```js +import { parseImports } from 'parse-imports' + +const code = ` + import a from 'b' + import * as c from './d' + import { e as f, g as h, i } from '/j' + import k, { l as m } from 'n' + import o, * as p from "./q" + import r, { s as t, u } from "/v" + import fs from 'fs' + + ;(async () => { + await import("w") + await import("x" + "y") + })() +` + +// Lazily iterate over iterable of imports +for (const $import of await parseImports(code)) { + console.log($import) +} + +// Or get as an array of imports +const imports = [...(await parseImports(code))] + +console.log(imports[0]) +//=> +// { +// startIndex: 3, +// endIndex: 20, +// isDynamicImport: false, +// moduleSpecifier: { +// type: 'package', +// startIndex: 17, +// endIndex: 20, +// isConstant: true, +// code: `'b'`, +// value: 'b', +// resolved: undefined +// }, +// importClause: { +// default: 'a', +// named: [], +// namespace: undefined +// } +// } + +console.log(imports[1]) +//=> +// { +// startIndex: 23, +// endIndex: 47, +// isDynamicImport: false, +// moduleSpecifier: { +// type: 'relative', +// startIndex: 42, +// endIndex: 47, +// isConstant: true, +// code: `'./d'`, +// value: './d', +// resolved: undefined +// }, +// importClause: { +// default: undefined, +// named: [], +// namespace: 'c' +// } +// } + +console.log(imports[5]) +//=> +// { +// startIndex: 153, +// endIndex: 186, +// isDynamicImport: false, +// moduleSpecifier: { +// type: 'absolute', +// startIndex: 182, +// endIndex: 186, +// isConstant: true, +// code: '"/v"', +// value: '/v', +// resolved: undefined +// }, +// importClause: { +// default: 'r', +// named: [ +// { specifier: 's', binding: 't' }, +// { specifier: 'u', binding: 'u' } +// ], +// namespace: undefined +// } +// } + +console.log(imports[7]) +//=> +// { +// startIndex: 238, +// endIndex: 249, +// isDynamicImport: true, +// moduleSpecifier: { +// type: 'package', +// startIndex: 245, +// endIndex: 248, +// isConstant: true, +// code: '"w"', +// value: 'w', +// resolved: undefined +// }, +// importClause: undefined +// } + +console.log(imports[8]) +//=> +// { +// startIndex: 260, +// endIndex: 277, +// isDynamicImport: true, +// moduleSpecifier: { +// type: 'unknown', +// startIndex: 267, +// endIndex: 276, +// isConstant: false, +// code: '"x" + "y"', +// value: undefined, +// resolved: undefined +// }, +// importClause: undefined +// } +``` + +## API + +Use `parseImports` when you're able to await a `Promise` result and +`parseImportsSync` otherwise. + +> [!IMPORTANT] +> +> You can only call `parseImportsSync` once the WASM has loaded. You can be sure +> this has happened by awaiting the exported `wasmLoadPromise`. + +See the [type definitions](./src/index.d.ts) for details. + +### Types + + + +```ts +type ModuleSpecifierType = + | 'invalid' + | 'absolute' + | 'relative' + | 'builtin' + | 'package' + | 'unknown' + +type Import = { + startIndex: number + endIndex: number + isDynamicImport: boolean + moduleSpecifier: { + type: ModuleSpecifierType + startIndex: number + endIndex: number + isConstant: boolean + code: string + value?: string + resolved?: string + } + importClause?: { + default?: string + named: string[] + namespace?: string + } +} +``` + +#### `Import` + +`code.substring(startIndex, endIndex)` returns the full import statement or +expression. +`code.substring(moduleSpecifier.startIndex, moduleSpecifier.endIndex)` returns +the module specifier including quotes. + +`moduleSpecifier.isConstant` is `true` when the import is not a dynamic import +(`isDynamicImport` is `false`), or when the import is a dynamic import where the +specifier is a simple string literal (e.g. `import('fs')`, `import("fs")`, +``import(`fs`)``). + +If `moduleSpecifier.isConstant` is `false`, then `moduleSpecifier.type` is +`'unknown'`. Otherwise, it is set according to the following rules: + +- `'invalid'` if the module specifier is the empty string +- `'absolute'` if the module specifier is an absolute file path +- `'relative'` if the module specifier is a relative file path +- `'builtin'` if the module specifier is the name of a builtin Node.js package +- `'package'` otherwise + +`moduleSpecifier.code` is the module specifier as it was written in the code. +For non-constant dynamic imports it could be a complex expression. + +`moduleSpecifier.value` is `moduleSpecifier.code` without string literal quotes +and unescaped if `moduleSpecifier.isConstant` is `true`. Otherwise, it is +`undefined`. + +`moduleSpecifier.resolved` is set if the `resolveFrom` option is set and +`moduleSpecifier.value` is not `undefined`. + +`importClause` is only `undefined` if `isDynamicImport` is `true`. + +`importClause.default` is the default import identifier or `undefined` if the +import statement does not have a default import. + +`importClause.named` is the array of objects representing the named imports of +the import statement. It is empty if the import statement does not have any +named imports. Each object in the array has a `specifier` field set to the +imported identifier and a `binding` field set to the identifier for accessing +the imported value. For example, `import { a, x as y } from 'something'` would +have the following array for `importClause.named`: +`[{ specifier: 'a', binding: 'a' }, { specifier: 'x', binding: 'y' }]`. + +`importClause.namespace` is the namespace import identifier or `undefined` if +the import statement does not have a namespace import. + +## Contributing + +Stars are always welcome! + +For bugs and feature requests, +[please create an issue](https://github.com/TomerAberbach/parse-imports/issues/new). + +For pull requests, please read the +[contributing guidelines](https://github.com/TomerAberbach/parse-imports/blob/main/contributing.md). + +## License + +[Apache 2.0](https://github.com/TomerAberbach/parse-imports/blob/main/license) + +This is not an official Google product. diff --git a/tools/eslint/node_modules/slashes/LICENSE b/tools/eslint/node_modules/slashes/LICENSE new file mode 100644 index 00000000000000..8cc3dc88fb5b0c --- /dev/null +++ b/tools/eslint/node_modules/slashes/LICENSE @@ -0,0 +1,17 @@ +ISC License + +Copyright (c) 2022 Chris Ackerman + +Permission to use, copy, modify, and /or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND +Chris Ackerman +DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL +Chris Ackerman +BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN +AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN +CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/tools/eslint/node_modules/slashes/lib/cjs/add-slashes.js b/tools/eslint/node_modules/slashes/lib/cjs/add-slashes.js new file mode 100644 index 00000000000000..53198e6b24de01 --- /dev/null +++ b/tools/eslint/node_modules/slashes/lib/cjs/add-slashes.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.addSlashes = void 0; +const get_escaped_any_js_1 = require("./get-escaped-any.js"); +const get_escaped_json_unsafe_js_1 = require("./get-escaped-json-unsafe.js"); +const addSlashes = (str, options = {}) => { + const { getEscaped = get_escaped_json_unsafe_js_1.getEscapedJsonUnsafe } = options; + let result = ''; + for (const char of str) { + const escaped = getEscaped(char); + if (!escaped) { + result += char; + } + else if (escaped === true || escaped.length < 2) { + result += (0, get_escaped_any_js_1.getEscapedAny)(char) || char; + } + else { + result += escaped; + } + } + return result; +}; +exports.addSlashes = addSlashes; +//# sourceMappingURL=add-slashes.js.map \ No newline at end of file diff --git a/tools/eslint/node_modules/slashes/lib/cjs/get-escaped-any.js b/tools/eslint/node_modules/slashes/lib/cjs/get-escaped-any.js new file mode 100644 index 00000000000000..6ea733e9217b37 --- /dev/null +++ b/tools/eslint/node_modules/slashes/lib/cjs/get-escaped-any.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getEscapedAny = void 0; +const getEscapedAny = (char) => { + switch (char) { + case '\b': + return '\\b'; + case '\f': + return '\\f'; + case '\n': + return '\\n'; + case '\r': + return '\\r'; + case '\t': + return '\\t'; + case `"`: + case '\\': + return `\\${char}`; + } + let unicode = ''; + for (let index = char.length - 1; index >= 0; index--) { + unicode = `\\u${('000' + char.charCodeAt(index).toString(16)).slice(-4)}${unicode}`; + } + return unicode || false; +}; +exports.getEscapedAny = getEscapedAny; +//# sourceMappingURL=get-escaped-any.js.map \ No newline at end of file diff --git a/tools/eslint/node_modules/slashes/lib/cjs/get-escaped-json-unsafe.js b/tools/eslint/node_modules/slashes/lib/cjs/get-escaped-json-unsafe.js new file mode 100644 index 00000000000000..344cacac3e1e23 --- /dev/null +++ b/tools/eslint/node_modules/slashes/lib/cjs/get-escaped-json-unsafe.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getEscapedJsonUnsafe = void 0; +const getEscapedJsonUnsafe = (char) => { + switch (char) { + case '\b': + case '\f': + case '\n': + case '\r': + case '\t': + case '\v': + case '\0': + case `"`: + case '\\': + return true; + } + return false; +}; +exports.getEscapedJsonUnsafe = getEscapedJsonUnsafe; +//# sourceMappingURL=get-escaped-json-unsafe.js.map \ No newline at end of file diff --git a/tools/eslint/node_modules/slashes/lib/cjs/get-unescaped-any.js b/tools/eslint/node_modules/slashes/lib/cjs/get-unescaped-any.js new file mode 100644 index 00000000000000..919b4e263dc14c --- /dev/null +++ b/tools/eslint/node_modules/slashes/lib/cjs/get-unescaped-any.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getUnescapedAny = void 0; +const getUnescapedAny = (sequence, code) => { + if (code != null) { + return String.fromCodePoint(code); + } + switch (sequence) { + case '\\b': + return '\b'; + case '\\f': + return '\f'; + case '\\n': + return '\n'; + case '\\r': + return '\r'; + case '\\t': + return '\t'; + case '\\v': + return '\v'; + } + return false; +}; +exports.getUnescapedAny = getUnescapedAny; +//# sourceMappingURL=get-unescaped-any.js.map \ No newline at end of file diff --git a/tools/eslint/node_modules/slashes/lib/cjs/index.js b/tools/eslint/node_modules/slashes/lib/cjs/index.js new file mode 100644 index 00000000000000..ede6df2826ed33 --- /dev/null +++ b/tools/eslint/node_modules/slashes/lib/cjs/index.js @@ -0,0 +1,22 @@ +"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 __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./add-slashes.js"), exports); +__exportStar(require("./get-escaped-any.js"), exports); +__exportStar(require("./get-escaped-json-unsafe.js"), exports); +__exportStar(require("./get-unescaped-any.js"), exports); +__exportStar(require("./remove-slashes.js"), exports); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/tools/eslint/node_modules/slashes/lib/cjs/package.json b/tools/eslint/node_modules/slashes/lib/cjs/package.json new file mode 100644 index 00000000000000..a3c15a7a6312b4 --- /dev/null +++ b/tools/eslint/node_modules/slashes/lib/cjs/package.json @@ -0,0 +1 @@ +{ "type": "commonjs" } diff --git a/tools/eslint/node_modules/slashes/lib/cjs/remove-slashes.js b/tools/eslint/node_modules/slashes/lib/cjs/remove-slashes.js new file mode 100644 index 00000000000000..ba7c04c660b385 --- /dev/null +++ b/tools/eslint/node_modules/slashes/lib/cjs/remove-slashes.js @@ -0,0 +1,47 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.stripSlashes = exports.removeSlashes = void 0; +const get_unescaped_any_js_1 = require("./get-unescaped-any.js"); +const removeSlashes = (source, options = {}) => { + const { getUnescaped = get_unescaped_any_js_1.getUnescapedAny } = options; + const rx = /(?:(\\(u([0-9a-f]{4})|u\{([0-9a-f]+)\}|x([0-9a-f]{2})|(\d{1,3})|([\s\S]|$)))|([\s\S]))/giu; + let match; + let result = ''; + while (null != (match = rx.exec(source))) { + const [, sequence, fallback, unicode, unicodePoint, hex, octal, char, literal] = match; + if (literal) { + result += literal; + continue; + } + let code; + if (char != null) { + code = null; + } + else if (octal) { + code = Number.parseInt(octal, 8); + } + else { + code = Number.parseInt((unicodePoint || unicode || hex), 16); + } + try { + const unescaped = getUnescaped(sequence, code); + if (!unescaped) { + result += fallback; + } + else if (unescaped === true) { + result += (0, get_unescaped_any_js_1.getUnescapedAny)(sequence, code) || fallback; + } + else { + result += unescaped; + } + } + catch (_error) { + result += fallback; + } + } + return result; +}; +exports.removeSlashes = removeSlashes; +const stripSlashes = removeSlashes; +exports.stripSlashes = stripSlashes; +//# sourceMappingURL=remove-slashes.js.map \ No newline at end of file diff --git a/tools/eslint/node_modules/slashes/lib/cjs/types/escape-sequence.js b/tools/eslint/node_modules/slashes/lib/cjs/types/escape-sequence.js new file mode 100644 index 00000000000000..da1cf39e11d246 --- /dev/null +++ b/tools/eslint/node_modules/slashes/lib/cjs/types/escape-sequence.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=escape-sequence.js.map \ No newline at end of file diff --git a/tools/eslint/node_modules/slashes/lib/esm/add-slashes.js b/tools/eslint/node_modules/slashes/lib/esm/add-slashes.js new file mode 100644 index 00000000000000..ed8ad49dc54b65 --- /dev/null +++ b/tools/eslint/node_modules/slashes/lib/esm/add-slashes.js @@ -0,0 +1,21 @@ +import { getEscapedAny } from './get-escaped-any.js'; +import { getEscapedJsonUnsafe } from './get-escaped-json-unsafe.js'; +const addSlashes = (str, options = {}) => { + const { getEscaped = getEscapedJsonUnsafe } = options; + let result = ''; + for (const char of str) { + const escaped = getEscaped(char); + if (!escaped) { + result += char; + } + else if (escaped === true || escaped.length < 2) { + result += getEscapedAny(char) || char; + } + else { + result += escaped; + } + } + return result; +}; +export { addSlashes }; +//# sourceMappingURL=add-slashes.js.map \ No newline at end of file diff --git a/tools/eslint/node_modules/slashes/lib/esm/get-escaped-any.js b/tools/eslint/node_modules/slashes/lib/esm/get-escaped-any.js new file mode 100644 index 00000000000000..48617e8cd39371 --- /dev/null +++ b/tools/eslint/node_modules/slashes/lib/esm/get-escaped-any.js @@ -0,0 +1,24 @@ +const getEscapedAny = (char) => { + switch (char) { + case '\b': + return '\\b'; + case '\f': + return '\\f'; + case '\n': + return '\\n'; + case '\r': + return '\\r'; + case '\t': + return '\\t'; + case `"`: + case '\\': + return `\\${char}`; + } + let unicode = ''; + for (let index = char.length - 1; index >= 0; index--) { + unicode = `\\u${('000' + char.charCodeAt(index).toString(16)).slice(-4)}${unicode}`; + } + return unicode || false; +}; +export { getEscapedAny }; +//# sourceMappingURL=get-escaped-any.js.map \ No newline at end of file diff --git a/tools/eslint/node_modules/slashes/lib/esm/get-escaped-json-unsafe.js b/tools/eslint/node_modules/slashes/lib/esm/get-escaped-json-unsafe.js new file mode 100644 index 00000000000000..6862042bf03a04 --- /dev/null +++ b/tools/eslint/node_modules/slashes/lib/esm/get-escaped-json-unsafe.js @@ -0,0 +1,17 @@ +const getEscapedJsonUnsafe = (char) => { + switch (char) { + case '\b': + case '\f': + case '\n': + case '\r': + case '\t': + case '\v': + case '\0': + case `"`: + case '\\': + return true; + } + return false; +}; +export { getEscapedJsonUnsafe }; +//# sourceMappingURL=get-escaped-json-unsafe.js.map \ No newline at end of file diff --git a/tools/eslint/node_modules/slashes/lib/esm/get-unescaped-any.js b/tools/eslint/node_modules/slashes/lib/esm/get-unescaped-any.js new file mode 100644 index 00000000000000..f7f63c25f2ed7b --- /dev/null +++ b/tools/eslint/node_modules/slashes/lib/esm/get-unescaped-any.js @@ -0,0 +1,22 @@ +const getUnescapedAny = (sequence, code) => { + if (code != null) { + return String.fromCodePoint(code); + } + switch (sequence) { + case '\\b': + return '\b'; + case '\\f': + return '\f'; + case '\\n': + return '\n'; + case '\\r': + return '\r'; + case '\\t': + return '\t'; + case '\\v': + return '\v'; + } + return false; +}; +export { getUnescapedAny }; +//# sourceMappingURL=get-unescaped-any.js.map \ No newline at end of file diff --git a/tools/eslint/node_modules/slashes/lib/esm/index.js b/tools/eslint/node_modules/slashes/lib/esm/index.js new file mode 100644 index 00000000000000..e86a9cec28f04d --- /dev/null +++ b/tools/eslint/node_modules/slashes/lib/esm/index.js @@ -0,0 +1,6 @@ +export * from './add-slashes.js'; +export * from './get-escaped-any.js'; +export * from './get-escaped-json-unsafe.js'; +export * from './get-unescaped-any.js'; +export * from './remove-slashes.js'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/tools/eslint/node_modules/slashes/lib/esm/remove-slashes.js b/tools/eslint/node_modules/slashes/lib/esm/remove-slashes.js new file mode 100644 index 00000000000000..f86e5c014ea36e --- /dev/null +++ b/tools/eslint/node_modules/slashes/lib/esm/remove-slashes.js @@ -0,0 +1,43 @@ +import { getUnescapedAny } from './get-unescaped-any.js'; +const removeSlashes = (source, options = {}) => { + const { getUnescaped = getUnescapedAny } = options; + const rx = /(?:(\\(u([0-9a-f]{4})|u\{([0-9a-f]+)\}|x([0-9a-f]{2})|(\d{1,3})|([\s\S]|$)))|([\s\S]))/giu; + let match; + let result = ''; + while (null != (match = rx.exec(source))) { + const [, sequence, fallback, unicode, unicodePoint, hex, octal, char, literal] = match; + if (literal) { + result += literal; + continue; + } + let code; + if (char != null) { + code = null; + } + else if (octal) { + code = Number.parseInt(octal, 8); + } + else { + code = Number.parseInt((unicodePoint || unicode || hex), 16); + } + try { + const unescaped = getUnescaped(sequence, code); + if (!unescaped) { + result += fallback; + } + else if (unescaped === true) { + result += getUnescapedAny(sequence, code) || fallback; + } + else { + result += unescaped; + } + } + catch (_error) { + result += fallback; + } + } + return result; +}; +const stripSlashes = removeSlashes; +export { removeSlashes, stripSlashes }; +//# sourceMappingURL=remove-slashes.js.map \ No newline at end of file diff --git a/tools/eslint/node_modules/slashes/lib/esm/types/escape-sequence.js b/tools/eslint/node_modules/slashes/lib/esm/types/escape-sequence.js new file mode 100644 index 00000000000000..f5878961512771 --- /dev/null +++ b/tools/eslint/node_modules/slashes/lib/esm/types/escape-sequence.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=escape-sequence.js.map \ No newline at end of file diff --git a/tools/eslint/node_modules/slashes/package.json b/tools/eslint/node_modules/slashes/package.json new file mode 100644 index 00000000000000..f86347fdbe6a6c --- /dev/null +++ b/tools/eslint/node_modules/slashes/package.json @@ -0,0 +1,58 @@ +{ + "name": "slashes", + "description": "Add or remove backslashes (escape or unescape).", + "author": { + "name": "Chris Ackerman", + "email": "chris@topher.land" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Shakeskeyboarde/slashes.git" + }, + "license": "ISC", + "version": "3.0.12", + "files": [ + "lib/**" + ], + "directories": { + "lib": "lib" + }, + "keywords": [ + "escape", + "unescape", + "encode", + "decode", + "strip", + "json", + "php" + ], + "type": "module", + "types": "lib/types/index.d.ts", + "main": "lib/cjs/index.js", + "module": "lib/esm/index.js", + "exports": { + ".": { + "types": "./lib/types/index.d.ts", + "require": "./lib/cjs/index.js", + "default": "./lib/esm/index.js" + } + }, + "sideEffects": false, + "scripts": { + "test": "rc npm-test -o", + "prepack": "del-cli *.tgz && rc npm-prepack", + "modernize": "npx npm-check-updates -i --format group" + }, + "devDependencies": { + "@types/jest": "^29.2.4", + "del-cli": "^5.0.0", + "eslint": "^8.30.0", + "eslint-config-rational": "^2.0.7", + "jest": "^29.3.1", + "jest-environment-jsdom": "^29.3.1", + "parallel-rc": "^1.0.12", + "prettier": "^2.8.1", + "ts-jest": "^29.0.3", + "typescript": "^4.9.4" + } +} diff --git a/tools/eslint/node_modules/synckit/LICENSE b/tools/eslint/node_modules/synckit/LICENSE new file mode 100644 index 00000000000000..b93398b949d1a4 --- /dev/null +++ b/tools/eslint/node_modules/synckit/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 UnTS + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/tools/eslint/node_modules/synckit/lib/index.cjs b/tools/eslint/node_modules/synckit/lib/index.cjs new file mode 100644 index 00000000000000..8f6ade969d14af --- /dev/null +++ b/tools/eslint/node_modules/synckit/lib/index.cjs @@ -0,0 +1,401 @@ +'use strict'; + +var node_crypto = require('node:crypto'); +var fs = require('node:fs'); +var node_module = require('node:module'); +var path = require('node:path'); +var node_url = require('node:url'); +var node_worker_threads = require('node:worker_threads'); +var core = require('@pkgr/core'); + +var __async = (__this, __arguments, generator) => { + return new Promise((resolve, reject) => { + var fulfilled = (value) => { + try { + step(generator.next(value)); + } catch (e) { + reject(e); + } + }; + var rejected = (value) => { + try { + step(generator.throw(value)); + } catch (e) { + reject(e); + } + }; + var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); + step((generator = generator.apply(__this, __arguments)).next()); + }); +}; +const import_meta = {}; +const INT32_BYTES = 4; +const TsRunner = { + // https://github.com/TypeStrong/ts-node + TsNode: "ts-node", + // https://github.com/egoist/esbuild-register + EsbuildRegister: "esbuild-register", + // https://github.com/folke/esbuild-runner + EsbuildRunner: "esbuild-runner", + // https://github.com/swc-project/swc-node/tree/master/packages/register + SWC: "swc", + // https://github.com/esbuild-kit/tsx + TSX: "tsx" +}; +const { + NODE_OPTIONS, + SYNCKIT_EXEC_ARGV, + SYNCKIT_GLOBAL_SHIMS, + SYNCKIT_TIMEOUT, + SYNCKIT_TS_RUNNER +} = process.env; +const DEFAULT_TIMEOUT = SYNCKIT_TIMEOUT ? +SYNCKIT_TIMEOUT : void 0; +const DEFAULT_EXEC_ARGV = (SYNCKIT_EXEC_ARGV == null ? void 0 : SYNCKIT_EXEC_ARGV.split(",")) || []; +const DEFAULT_TS_RUNNER = SYNCKIT_TS_RUNNER; +const DEFAULT_GLOBAL_SHIMS = ["1", "true"].includes( + SYNCKIT_GLOBAL_SHIMS +); +const DEFAULT_GLOBAL_SHIMS_PRESET = [ + { + moduleName: "node-fetch", + globalName: "fetch" + }, + { + moduleName: "node:perf_hooks", + globalName: "performance", + named: "performance" + } +]; +const MTS_SUPPORTED_NODE_VERSION = 16; +let syncFnCache; +function extractProperties(object) { + if (object && typeof object === "object") { + const properties = {}; + for (const key in object) { + properties[key] = object[key]; + } + return properties; + } +} +function createSyncFn(workerPath, timeoutOrOptions) { + syncFnCache != null ? syncFnCache : syncFnCache = /* @__PURE__ */ new Map(); + const cachedSyncFn = syncFnCache.get(workerPath); + if (cachedSyncFn) { + return cachedSyncFn; + } + if (!path.isAbsolute(workerPath)) { + throw new Error("`workerPath` must be absolute"); + } + const syncFn = startWorkerThread( + workerPath, + /* istanbul ignore next */ + typeof timeoutOrOptions === "number" ? { timeout: timeoutOrOptions } : timeoutOrOptions + ); + syncFnCache.set(workerPath, syncFn); + return syncFn; +} +const cjsRequire = typeof require === "undefined" ? node_module.createRequire(import_meta.url) : ( + /* istanbul ignore next */ + require +); +const dataUrl = (code) => new URL(`data:text/javascript,${encodeURIComponent(code)}`); +const isFile = (path2) => { + var _a; + try { + return !!((_a = fs.statSync(path2, { throwIfNoEntry: false })) == null ? void 0 : _a.isFile()); + } catch (e) { + return false; + } +}; +const setupTsRunner = (workerPath, { execArgv, tsRunner }) => { + let ext = path.extname(workerPath); + if (!/[/\\]node_modules[/\\]/.test(workerPath) && (!ext || /^\.[cm]?js$/.test(ext))) { + const workPathWithoutExt = ext ? workerPath.slice(0, -ext.length) : workerPath; + let extensions; + switch (ext) { + case ".cjs": { + extensions = [".cts", ".cjs"]; + break; + } + case ".mjs": { + extensions = [".mts", ".mjs"]; + break; + } + default: { + extensions = [".ts", ".js"]; + break; + } + } + const found = core.tryExtensions(workPathWithoutExt, extensions); + let differentExt; + if (found && (!ext || (differentExt = found !== workPathWithoutExt))) { + workerPath = found; + if (differentExt) { + ext = path.extname(workerPath); + } + } + } + const isTs = /\.[cm]?ts$/.test(workerPath); + let jsUseEsm = workerPath.endsWith(".mjs"); + let tsUseEsm = workerPath.endsWith(".mts"); + if (isTs) { + if (!tsUseEsm) { + const pkg = core.findUp(workerPath); + if (pkg) { + tsUseEsm = cjsRequire(pkg).type === "module"; + } + } + if (tsRunner == null && core.isPkgAvailable(TsRunner.TsNode)) { + tsRunner = TsRunner.TsNode; + } + switch (tsRunner) { + case TsRunner.TsNode: { + if (tsUseEsm) { + if (!execArgv.includes("--loader")) { + execArgv = ["--loader", `${TsRunner.TsNode}/esm`, ...execArgv]; + } + } else if (!execArgv.includes("-r")) { + execArgv = ["-r", `${TsRunner.TsNode}/register`, ...execArgv]; + } + break; + } + case TsRunner.EsbuildRegister: { + if (!execArgv.includes("-r")) { + execArgv = ["-r", TsRunner.EsbuildRegister, ...execArgv]; + } + break; + } + case TsRunner.EsbuildRunner: { + if (!execArgv.includes("-r")) { + execArgv = ["-r", `${TsRunner.EsbuildRunner}/register`, ...execArgv]; + } + break; + } + case TsRunner.SWC: { + if (!execArgv.includes("-r")) { + execArgv = ["-r", `@${TsRunner.SWC}-node/register`, ...execArgv]; + } + break; + } + case TsRunner.TSX: { + if (!execArgv.includes("--loader")) { + execArgv = ["--loader", TsRunner.TSX, ...execArgv]; + } + break; + } + default: { + throw new Error(`Unknown ts runner: ${String(tsRunner)}`); + } + } + } else if (!jsUseEsm) { + const pkg = core.findUp(workerPath); + if (pkg) { + jsUseEsm = cjsRequire(pkg).type === "module"; + } + } + if (process.versions.pnp) { + const nodeOptions = NODE_OPTIONS == null ? void 0 : NODE_OPTIONS.split(/\s+/); + let pnpApiPath; + try { + pnpApiPath = cjsRequire.resolve("pnpapi"); + } catch (e) { + } + if (pnpApiPath && !(nodeOptions == null ? void 0 : nodeOptions.some( + (option, index) => ["-r", "--require"].includes(option) && pnpApiPath === cjsRequire.resolve(nodeOptions[index + 1]) + )) && !execArgv.includes(pnpApiPath)) { + execArgv = ["-r", pnpApiPath, ...execArgv]; + const pnpLoaderPath = path.resolve(pnpApiPath, "../.pnp.loader.mjs"); + if (isFile(pnpLoaderPath)) { + const experimentalLoader = node_url.pathToFileURL(pnpLoaderPath).toString(); + execArgv = ["--experimental-loader", experimentalLoader, ...execArgv]; + } + } + } + return { + ext, + isTs, + jsUseEsm, + tsRunner, + tsUseEsm, + workerPath, + execArgv + }; +}; +const md5Hash = (text) => node_crypto.createHash("md5").update(text).digest("hex"); +const encodeImportModule = (moduleNameOrGlobalShim, type = "import") => { + const { moduleName, globalName, named, conditional } = typeof moduleNameOrGlobalShim === "string" ? { moduleName: moduleNameOrGlobalShim } : moduleNameOrGlobalShim; + const importStatement = type === "import" ? `import${globalName ? " " + (named === null ? "* as " + globalName : (named == null ? void 0 : named.trim()) ? `{${named}}` : globalName) + " from" : ""} '${path.isAbsolute(moduleName) ? String(node_url.pathToFileURL(moduleName)) : moduleName}'` : `${globalName ? "const " + ((named == null ? void 0 : named.trim()) ? `{${named}}` : globalName) + "=" : ""}require('${moduleName.replace(/\\/g, "\\\\")}')`; + if (!globalName) { + return importStatement; + } + const overrideStatement = `globalThis.${globalName}=${(named == null ? void 0 : named.trim()) ? named : globalName}`; + return importStatement + (conditional === false ? `;${overrideStatement}` : `;if(!globalThis.${globalName})${overrideStatement}`); +}; +const _generateGlobals = (globalShims, type) => globalShims.reduce( + (acc, shim) => `${acc}${acc ? ";" : ""}${encodeImportModule(shim, type)}`, + "" +); +let globalsCache; +let tmpdir; +const _dirname = typeof __dirname === "undefined" ? path.dirname(node_url.fileURLToPath(import_meta.url)) : ( + /* istanbul ignore next */ + __dirname +); +let sharedBuffer; +let sharedBufferView; +const generateGlobals = (workerPath, globalShims, type = "import") => { + globalsCache != null ? globalsCache : globalsCache = /* @__PURE__ */ new Map(); + const cached = globalsCache.get(workerPath); + if (cached) { + const [content2, filepath2] = cached; + if (type === "require" && !filepath2 || type === "import" && filepath2 && isFile(filepath2)) { + return content2; + } + } + const globals = _generateGlobals(globalShims, type); + let content = globals; + let filepath; + if (type === "import") { + if (!tmpdir) { + tmpdir = path.resolve(core.findUp(_dirname), "../node_modules/.synckit"); + } + fs.mkdirSync(tmpdir, { recursive: true }); + filepath = path.resolve(tmpdir, md5Hash(workerPath) + ".mjs"); + content = encodeImportModule(filepath); + fs.writeFileSync(filepath, globals); + } + globalsCache.set(workerPath, [content, filepath]); + return content; +}; +function startWorkerThread(workerPath, { + timeout = DEFAULT_TIMEOUT, + execArgv = DEFAULT_EXEC_ARGV, + tsRunner = DEFAULT_TS_RUNNER, + transferList = [], + globalShims = DEFAULT_GLOBAL_SHIMS +} = {}) { + const { port1: mainPort, port2: workerPort } = new node_worker_threads.MessageChannel(); + const { + isTs, + ext, + jsUseEsm, + tsUseEsm, + tsRunner: finalTsRunner, + workerPath: finalWorkerPath, + execArgv: finalExecArgv + } = setupTsRunner(workerPath, { execArgv, tsRunner }); + const workerPathUrl = node_url.pathToFileURL(finalWorkerPath); + if (/\.[cm]ts$/.test(finalWorkerPath)) { + const isTsxSupported = !tsUseEsm || Number.parseFloat(process.versions.node) >= MTS_SUPPORTED_NODE_VERSION; + if (!finalTsRunner) { + throw new Error("No ts runner specified, ts worker path is not supported"); + } else if ([ + // https://github.com/egoist/esbuild-register/issues/79 + TsRunner.EsbuildRegister, + // https://github.com/folke/esbuild-runner/issues/67 + TsRunner.EsbuildRunner, + // https://github.com/swc-project/swc-node/issues/667 + TsRunner.SWC, + .../* istanbul ignore next */ + isTsxSupported ? [] : [TsRunner.TSX] + ].includes(finalTsRunner)) { + throw new Error( + `${finalTsRunner} is not supported for ${ext} files yet` + /* istanbul ignore next */ + (isTsxSupported ? ", you can try [tsx](https://github.com/esbuild-kit/tsx) instead" : "") + ); + } + } + const finalGlobalShims = (globalShims === true ? DEFAULT_GLOBAL_SHIMS_PRESET : Array.isArray(globalShims) ? globalShims : []).filter(({ moduleName }) => core.isPkgAvailable(moduleName)); + sharedBufferView != null ? sharedBufferView : sharedBufferView = new Int32Array( + /* istanbul ignore next */ + sharedBuffer != null ? sharedBuffer : sharedBuffer = new SharedArrayBuffer( + INT32_BYTES + ), + 0, + 1 + ); + const useGlobals = finalGlobalShims.length > 0; + const useEval = isTs ? !tsUseEsm : !jsUseEsm && useGlobals; + const worker = new node_worker_threads.Worker( + jsUseEsm && useGlobals || tsUseEsm && finalTsRunner === TsRunner.TsNode ? dataUrl( + `${generateGlobals( + finalWorkerPath, + finalGlobalShims + )};import '${String(workerPathUrl)}'` + ) : useEval ? `${generateGlobals( + finalWorkerPath, + finalGlobalShims, + "require" + )};${encodeImportModule(finalWorkerPath, "require")}` : workerPathUrl, + { + eval: useEval, + workerData: { sharedBuffer, workerPort }, + transferList: [workerPort, ...transferList], + execArgv: finalExecArgv + } + ); + let nextID = 0; + const syncFn = (...args) => { + const id = nextID++; + const msg = { id, args }; + worker.postMessage(msg); + const status = Atomics.wait(sharedBufferView, 0, 0, timeout); + Atomics.store(sharedBufferView, 0, 0); + if (!["ok", "not-equal"].includes(status)) { + throw new Error("Internal error: Atomics.wait() failed: " + status); + } + const { + id: id2, + result, + error, + properties + } = node_worker_threads.receiveMessageOnPort(mainPort).message; + if (id !== id2) { + throw new Error(`Internal error: Expected id ${id} but got id ${id2}`); + } + if (error) { + throw Object.assign(error, properties); + } + return result; + }; + worker.unref(); + return syncFn; +} +function runAsWorker(fn) { + if (!node_worker_threads.workerData) { + return; + } + const { workerPort, sharedBuffer: sharedBuffer2 } = node_worker_threads.workerData; + const sharedBufferView2 = new Int32Array(sharedBuffer2, 0, 1); + node_worker_threads.parentPort.on( + "message", + ({ id, args }) => { + (() => __async(this, null, function* () { + let msg; + try { + msg = { id, result: yield fn(...args) }; + } catch (error) { + msg = { id, error, properties: extractProperties(error) }; + } + workerPort.postMessage(msg); + Atomics.add(sharedBufferView2, 0, 1); + Atomics.notify(sharedBufferView2, 0); + }))(); + } + ); +} + +exports.DEFAULT_EXEC_ARGV = DEFAULT_EXEC_ARGV; +exports.DEFAULT_GLOBAL_SHIMS = DEFAULT_GLOBAL_SHIMS; +exports.DEFAULT_GLOBAL_SHIMS_PRESET = DEFAULT_GLOBAL_SHIMS_PRESET; +exports.DEFAULT_TIMEOUT = DEFAULT_TIMEOUT; +exports.DEFAULT_TS_RUNNER = DEFAULT_TS_RUNNER; +exports.MTS_SUPPORTED_NODE_VERSION = MTS_SUPPORTED_NODE_VERSION; +exports.TsRunner = TsRunner; +exports._generateGlobals = _generateGlobals; +exports.createSyncFn = createSyncFn; +exports.encodeImportModule = encodeImportModule; +exports.extractProperties = extractProperties; +exports.generateGlobals = generateGlobals; +exports.isFile = isFile; +exports.runAsWorker = runAsWorker; diff --git a/tools/eslint/node_modules/synckit/lib/index.js b/tools/eslint/node_modules/synckit/lib/index.js new file mode 100644 index 00000000000000..91bf9c07faf41f --- /dev/null +++ b/tools/eslint/node_modules/synckit/lib/index.js @@ -0,0 +1,344 @@ +import { __awaiter } from "tslib"; +import { createHash } from 'node:crypto'; +import fs from 'node:fs'; +import { createRequire } from 'node:module'; +import path from 'node:path'; +import { fileURLToPath, pathToFileURL } from 'node:url'; +import { MessageChannel, Worker, parentPort, receiveMessageOnPort, workerData, } from 'node:worker_threads'; +import { findUp, isPkgAvailable, tryExtensions } from '@pkgr/core'; +const INT32_BYTES = 4; +export * from './types.js'; +export const TsRunner = { + TsNode: 'ts-node', + EsbuildRegister: 'esbuild-register', + EsbuildRunner: 'esbuild-runner', + SWC: 'swc', + TSX: 'tsx', +}; +const { NODE_OPTIONS, SYNCKIT_EXEC_ARGV, SYNCKIT_GLOBAL_SHIMS, SYNCKIT_TIMEOUT, SYNCKIT_TS_RUNNER, } = process.env; +export const DEFAULT_TIMEOUT = SYNCKIT_TIMEOUT ? +SYNCKIT_TIMEOUT : undefined; +export const DEFAULT_EXEC_ARGV = (SYNCKIT_EXEC_ARGV === null || SYNCKIT_EXEC_ARGV === void 0 ? void 0 : SYNCKIT_EXEC_ARGV.split(',')) || []; +export const DEFAULT_TS_RUNNER = SYNCKIT_TS_RUNNER; +export const DEFAULT_GLOBAL_SHIMS = ['1', 'true'].includes(SYNCKIT_GLOBAL_SHIMS); +export const DEFAULT_GLOBAL_SHIMS_PRESET = [ + { + moduleName: 'node-fetch', + globalName: 'fetch', + }, + { + moduleName: 'node:perf_hooks', + globalName: 'performance', + named: 'performance', + }, +]; +export const MTS_SUPPORTED_NODE_VERSION = 16; +let syncFnCache; +export function extractProperties(object) { + if (object && typeof object === 'object') { + const properties = {}; + for (const key in object) { + properties[key] = object[key]; + } + return properties; + } +} +export function createSyncFn(workerPath, timeoutOrOptions) { + syncFnCache !== null && syncFnCache !== void 0 ? syncFnCache : (syncFnCache = new Map()); + const cachedSyncFn = syncFnCache.get(workerPath); + if (cachedSyncFn) { + return cachedSyncFn; + } + if (!path.isAbsolute(workerPath)) { + throw new Error('`workerPath` must be absolute'); + } + const syncFn = startWorkerThread(workerPath, typeof timeoutOrOptions === 'number' + ? { timeout: timeoutOrOptions } + : timeoutOrOptions); + syncFnCache.set(workerPath, syncFn); + return syncFn; +} +const cjsRequire = typeof require === 'undefined' + ? createRequire(import.meta.url) + : require; +const dataUrl = (code) => new URL(`data:text/javascript,${encodeURIComponent(code)}`); +export const isFile = (path) => { + var _a; + try { + return !!((_a = fs.statSync(path, { throwIfNoEntry: false })) === null || _a === void 0 ? void 0 : _a.isFile()); + } + catch (_b) { + return false; + } +}; +const setupTsRunner = (workerPath, { execArgv, tsRunner }) => { + let ext = path.extname(workerPath); + if (!/[/\\]node_modules[/\\]/.test(workerPath) && + (!ext || /^\.[cm]?js$/.test(ext))) { + const workPathWithoutExt = ext + ? workerPath.slice(0, -ext.length) + : workerPath; + let extensions; + switch (ext) { + case '.cjs': { + extensions = ['.cts', '.cjs']; + break; + } + case '.mjs': { + extensions = ['.mts', '.mjs']; + break; + } + default: { + extensions = ['.ts', '.js']; + break; + } + } + const found = tryExtensions(workPathWithoutExt, extensions); + let differentExt; + if (found && (!ext || (differentExt = found !== workPathWithoutExt))) { + workerPath = found; + if (differentExt) { + ext = path.extname(workerPath); + } + } + } + const isTs = /\.[cm]?ts$/.test(workerPath); + let jsUseEsm = workerPath.endsWith('.mjs'); + let tsUseEsm = workerPath.endsWith('.mts'); + if (isTs) { + if (!tsUseEsm) { + const pkg = findUp(workerPath); + if (pkg) { + tsUseEsm = + cjsRequire(pkg).type === + 'module'; + } + } + if (tsRunner == null && isPkgAvailable(TsRunner.TsNode)) { + tsRunner = TsRunner.TsNode; + } + switch (tsRunner) { + case TsRunner.TsNode: { + if (tsUseEsm) { + if (!execArgv.includes('--loader')) { + execArgv = ['--loader', `${TsRunner.TsNode}/esm`, ...execArgv]; + } + } + else if (!execArgv.includes('-r')) { + execArgv = ['-r', `${TsRunner.TsNode}/register`, ...execArgv]; + } + break; + } + case TsRunner.EsbuildRegister: { + if (!execArgv.includes('-r')) { + execArgv = ['-r', TsRunner.EsbuildRegister, ...execArgv]; + } + break; + } + case TsRunner.EsbuildRunner: { + if (!execArgv.includes('-r')) { + execArgv = ['-r', `${TsRunner.EsbuildRunner}/register`, ...execArgv]; + } + break; + } + case TsRunner.SWC: { + if (!execArgv.includes('-r')) { + execArgv = ['-r', `@${TsRunner.SWC}-node/register`, ...execArgv]; + } + break; + } + case TsRunner.TSX: { + if (!execArgv.includes('--loader')) { + execArgv = ['--loader', TsRunner.TSX, ...execArgv]; + } + break; + } + default: { + throw new Error(`Unknown ts runner: ${String(tsRunner)}`); + } + } + } + else if (!jsUseEsm) { + const pkg = findUp(workerPath); + if (pkg) { + jsUseEsm = + cjsRequire(pkg).type === 'module'; + } + } + if (process.versions.pnp) { + const nodeOptions = NODE_OPTIONS === null || NODE_OPTIONS === void 0 ? void 0 : NODE_OPTIONS.split(/\s+/); + let pnpApiPath; + try { + pnpApiPath = cjsRequire.resolve('pnpapi'); + } + catch (_a) { } + if (pnpApiPath && + !(nodeOptions === null || nodeOptions === void 0 ? void 0 : nodeOptions.some((option, index) => ['-r', '--require'].includes(option) && + pnpApiPath === cjsRequire.resolve(nodeOptions[index + 1]))) && + !execArgv.includes(pnpApiPath)) { + execArgv = ['-r', pnpApiPath, ...execArgv]; + const pnpLoaderPath = path.resolve(pnpApiPath, '../.pnp.loader.mjs'); + if (isFile(pnpLoaderPath)) { + const experimentalLoader = pathToFileURL(pnpLoaderPath).toString(); + execArgv = ['--experimental-loader', experimentalLoader, ...execArgv]; + } + } + } + return { + ext, + isTs, + jsUseEsm, + tsRunner, + tsUseEsm, + workerPath, + execArgv, + }; +}; +const md5Hash = (text) => createHash('md5').update(text).digest('hex'); +export const encodeImportModule = (moduleNameOrGlobalShim, type = 'import') => { + const { moduleName, globalName, named, conditional } = typeof moduleNameOrGlobalShim === 'string' + ? { moduleName: moduleNameOrGlobalShim } + : moduleNameOrGlobalShim; + const importStatement = type === 'import' + ? `import${globalName + ? ' ' + + (named === null + ? '* as ' + globalName + : (named === null || named === void 0 ? void 0 : named.trim()) + ? `{${named}}` + : globalName) + + ' from' + : ''} '${path.isAbsolute(moduleName) + ? String(pathToFileURL(moduleName)) + : moduleName}'` + : `${globalName + ? 'const ' + ((named === null || named === void 0 ? void 0 : named.trim()) ? `{${named}}` : globalName) + '=' + : ''}require('${moduleName + .replace(/\\/g, '\\\\')}')`; + if (!globalName) { + return importStatement; + } + const overrideStatement = `globalThis.${globalName}=${(named === null || named === void 0 ? void 0 : named.trim()) ? named : globalName}`; + return (importStatement + + (conditional === false + ? `;${overrideStatement}` + : `;if(!globalThis.${globalName})${overrideStatement}`)); +}; +export const _generateGlobals = (globalShims, type) => globalShims.reduce((acc, shim) => `${acc}${acc ? ';' : ''}${encodeImportModule(shim, type)}`, ''); +let globalsCache; +let tmpdir; +const _dirname = typeof __dirname === 'undefined' + ? path.dirname(fileURLToPath(import.meta.url)) + : __dirname; +let sharedBuffer; +let sharedBufferView; +export const generateGlobals = (workerPath, globalShims, type = 'import') => { + globalsCache !== null && globalsCache !== void 0 ? globalsCache : (globalsCache = new Map()); + const cached = globalsCache.get(workerPath); + if (cached) { + const [content, filepath] = cached; + if ((type === 'require' && !filepath) || + (type === 'import' && filepath && isFile(filepath))) { + return content; + } + } + const globals = _generateGlobals(globalShims, type); + let content = globals; + let filepath; + if (type === 'import') { + if (!tmpdir) { + tmpdir = path.resolve(findUp(_dirname), '../node_modules/.synckit'); + } + fs.mkdirSync(tmpdir, { recursive: true }); + filepath = path.resolve(tmpdir, md5Hash(workerPath) + '.mjs'); + content = encodeImportModule(filepath); + fs.writeFileSync(filepath, globals); + } + globalsCache.set(workerPath, [content, filepath]); + return content; +}; +function startWorkerThread(workerPath, { timeout = DEFAULT_TIMEOUT, execArgv = DEFAULT_EXEC_ARGV, tsRunner = DEFAULT_TS_RUNNER, transferList = [], globalShims = DEFAULT_GLOBAL_SHIMS, } = {}) { + const { port1: mainPort, port2: workerPort } = new MessageChannel(); + const { isTs, ext, jsUseEsm, tsUseEsm, tsRunner: finalTsRunner, workerPath: finalWorkerPath, execArgv: finalExecArgv, } = setupTsRunner(workerPath, { execArgv, tsRunner }); + const workerPathUrl = pathToFileURL(finalWorkerPath); + if (/\.[cm]ts$/.test(finalWorkerPath)) { + const isTsxSupported = !tsUseEsm || + Number.parseFloat(process.versions.node) >= MTS_SUPPORTED_NODE_VERSION; + if (!finalTsRunner) { + throw new Error('No ts runner specified, ts worker path is not supported'); + } + else if ([ + TsRunner.EsbuildRegister, + TsRunner.EsbuildRunner, + TsRunner.SWC, + ...(isTsxSupported ? [] : [TsRunner.TSX]), + ].includes(finalTsRunner)) { + throw new Error(`${finalTsRunner} is not supported for ${ext} files yet` + + (isTsxSupported + ? ', you can try [tsx](https://github.com/esbuild-kit/tsx) instead' + : '')); + } + } + const finalGlobalShims = (globalShims === true + ? DEFAULT_GLOBAL_SHIMS_PRESET + : Array.isArray(globalShims) + ? globalShims + : []).filter(({ moduleName }) => isPkgAvailable(moduleName)); + sharedBufferView !== null && sharedBufferView !== void 0 ? sharedBufferView : (sharedBufferView = new Int32Array((sharedBuffer !== null && sharedBuffer !== void 0 ? sharedBuffer : (sharedBuffer = new SharedArrayBuffer(INT32_BYTES))), 0, 1)); + const useGlobals = finalGlobalShims.length > 0; + const useEval = isTs ? !tsUseEsm : !jsUseEsm && useGlobals; + const worker = new Worker((jsUseEsm && useGlobals) || (tsUseEsm && finalTsRunner === TsRunner.TsNode) + ? dataUrl(`${generateGlobals(finalWorkerPath, finalGlobalShims)};import '${String(workerPathUrl)}'`) + : useEval + ? `${generateGlobals(finalWorkerPath, finalGlobalShims, 'require')};${encodeImportModule(finalWorkerPath, 'require')}` + : workerPathUrl, { + eval: useEval, + workerData: { sharedBuffer, workerPort }, + transferList: [workerPort, ...transferList], + execArgv: finalExecArgv, + }); + let nextID = 0; + const syncFn = (...args) => { + const id = nextID++; + const msg = { id, args }; + worker.postMessage(msg); + const status = Atomics.wait(sharedBufferView, 0, 0, timeout); + Atomics.store(sharedBufferView, 0, 0); + if (!['ok', 'not-equal'].includes(status)) { + throw new Error('Internal error: Atomics.wait() failed: ' + status); + } + const { id: id2, result, error, properties, } = receiveMessageOnPort(mainPort) + .message; + if (id !== id2) { + throw new Error(`Internal error: Expected id ${id} but got id ${id2}`); + } + if (error) { + throw Object.assign(error, properties); + } + return result; + }; + worker.unref(); + return syncFn; +} +export function runAsWorker(fn) { + if (!workerData) { + return; + } + const { workerPort, sharedBuffer } = workerData; + const sharedBufferView = new Int32Array(sharedBuffer, 0, 1); + parentPort.on('message', ({ id, args }) => { + ; + (() => __awaiter(this, void 0, void 0, function* () { + let msg; + try { + msg = { id, result: yield fn(...args) }; + } + catch (error) { + msg = { id, error, properties: extractProperties(error) }; + } + workerPort.postMessage(msg); + Atomics.add(sharedBufferView, 0, 1); + Atomics.notify(sharedBufferView, 0); + }))(); + }); +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/tools/eslint/node_modules/synckit/lib/types.js b/tools/eslint/node_modules/synckit/lib/types.js new file mode 100644 index 00000000000000..718fd38ae40c67 --- /dev/null +++ b/tools/eslint/node_modules/synckit/lib/types.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/tools/eslint/node_modules/synckit/package.json b/tools/eslint/node_modules/synckit/package.json new file mode 100644 index 00000000000000..f14713e992059b --- /dev/null +++ b/tools/eslint/node_modules/synckit/package.json @@ -0,0 +1,39 @@ +{ + "name": "synckit", + "version": "0.9.0", + "type": "module", + "description": "Perform async work synchronously in Node.js using `worker_threads` with first-class TypeScript support.", + "repository": "git+https://github.com/un-ts/synckit.git", + "author": "JounQin (https://www.1stG.me) ", + "funding": "https://opencollective.com/unts", + "license": "MIT", + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "main": "./lib/index.cjs", + "module": "./lib/index.js", + "exports": { + "types": "./lib/index.d.ts", + "import": "./lib/index.js", + "require": "./lib/index.cjs" + }, + "types": "./lib/index.d.ts", + "files": [ + "lib", + "!**/*.tsbuildinfo" + ], + "keywords": [ + "deasync", + "make-synchronous", + "sync", + "sync-exec", + "sync-rpc", + "sync-threads", + "synchronize", + "synckit" + ], + "dependencies": { + "@pkgr/core": "^0.1.0", + "tslib": "^2.6.2" + } +} \ No newline at end of file diff --git a/tools/eslint/node_modules/tslib/CopyrightNotice.txt b/tools/eslint/node_modules/tslib/CopyrightNotice.txt new file mode 100644 index 00000000000000..0e42542369729e --- /dev/null +++ b/tools/eslint/node_modules/tslib/CopyrightNotice.txt @@ -0,0 +1,15 @@ +/****************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ + diff --git a/tools/eslint/node_modules/tslib/LICENSE.txt b/tools/eslint/node_modules/tslib/LICENSE.txt new file mode 100644 index 00000000000000..bfe6430cb0d83f --- /dev/null +++ b/tools/eslint/node_modules/tslib/LICENSE.txt @@ -0,0 +1,12 @@ +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. \ No newline at end of file diff --git a/tools/eslint/node_modules/tslib/SECURITY.md b/tools/eslint/node_modules/tslib/SECURITY.md new file mode 100644 index 00000000000000..869fdfe2b24699 --- /dev/null +++ b/tools/eslint/node_modules/tslib/SECURITY.md @@ -0,0 +1,41 @@ + + +## Security + +Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/). + +If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below. + +## Reporting Security Issues + +**Please do not report security vulnerabilities through public GitHub issues.** + +Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report). + +If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey). + +You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc). + +Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue: + + * Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.) + * Full paths of source file(s) related to the manifestation of the issue + * The location of the affected source code (tag/branch/commit or direct URL) + * Any special configuration required to reproduce the issue + * Step-by-step instructions to reproduce the issue + * Proof-of-concept or exploit code (if possible) + * Impact of the issue, including how an attacker might exploit the issue + +This information will help us triage your report more quickly. + +If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs. + +## Preferred Languages + +We prefer all communications to be in English. + +## Policy + +Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd). + + diff --git a/tools/eslint/node_modules/tslib/modules/index.js b/tools/eslint/node_modules/tslib/modules/index.js new file mode 100644 index 00000000000000..af9f5ac4e248a6 --- /dev/null +++ b/tools/eslint/node_modules/tslib/modules/index.js @@ -0,0 +1,68 @@ +import tslib from '../tslib.js'; +const { + __extends, + __assign, + __rest, + __decorate, + __param, + __esDecorate, + __runInitializers, + __propKey, + __setFunctionName, + __metadata, + __awaiter, + __generator, + __exportStar, + __createBinding, + __values, + __read, + __spread, + __spreadArrays, + __spreadArray, + __await, + __asyncGenerator, + __asyncDelegator, + __asyncValues, + __makeTemplateObject, + __importStar, + __importDefault, + __classPrivateFieldGet, + __classPrivateFieldSet, + __classPrivateFieldIn, + __addDisposableResource, + __disposeResources, +} = tslib; +export { + __extends, + __assign, + __rest, + __decorate, + __param, + __esDecorate, + __runInitializers, + __propKey, + __setFunctionName, + __metadata, + __awaiter, + __generator, + __exportStar, + __createBinding, + __values, + __read, + __spread, + __spreadArrays, + __spreadArray, + __await, + __asyncGenerator, + __asyncDelegator, + __asyncValues, + __makeTemplateObject, + __importStar, + __importDefault, + __classPrivateFieldGet, + __classPrivateFieldSet, + __classPrivateFieldIn, + __addDisposableResource, + __disposeResources, +}; +export default tslib; diff --git a/tools/eslint/node_modules/tslib/modules/package.json b/tools/eslint/node_modules/tslib/modules/package.json new file mode 100644 index 00000000000000..aafa0e4b45ab8f --- /dev/null +++ b/tools/eslint/node_modules/tslib/modules/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} \ No newline at end of file diff --git a/tools/eslint/node_modules/tslib/package.json b/tools/eslint/node_modules/tslib/package.json new file mode 100644 index 00000000000000..a8646d5c157da9 --- /dev/null +++ b/tools/eslint/node_modules/tslib/package.json @@ -0,0 +1,47 @@ +{ + "name": "tslib", + "author": "Microsoft Corp.", + "homepage": "https://www.typescriptlang.org/", + "version": "2.6.3", + "license": "0BSD", + "description": "Runtime library for TypeScript helper functions", + "keywords": [ + "TypeScript", + "Microsoft", + "compiler", + "language", + "javascript", + "tslib", + "runtime" + ], + "bugs": { + "url": "https://github.com/Microsoft/TypeScript/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/Microsoft/tslib.git" + }, + "main": "tslib.js", + "module": "tslib.es6.js", + "jsnext:main": "tslib.es6.js", + "typings": "tslib.d.ts", + "sideEffects": false, + "exports": { + ".": { + "module": { + "types": "./modules/index.d.ts", + "default": "./tslib.es6.mjs" + }, + "import": { + "node": "./modules/index.js", + "default": { + "types": "./modules/index.d.ts", + "default": "./tslib.es6.mjs" + } + }, + "default": "./tslib.js" + }, + "./*": "./*", + "./": "./" + } +} diff --git a/tools/eslint/node_modules/tslib/tslib.es6.html b/tools/eslint/node_modules/tslib/tslib.es6.html new file mode 100644 index 00000000000000..b122e41b06af80 --- /dev/null +++ b/tools/eslint/node_modules/tslib/tslib.es6.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/tools/eslint/node_modules/tslib/tslib.es6.js b/tools/eslint/node_modules/tslib/tslib.es6.js new file mode 100644 index 00000000000000..b212c2564d715a --- /dev/null +++ b/tools/eslint/node_modules/tslib/tslib.es6.js @@ -0,0 +1,374 @@ +/****************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global Reflect, Promise, SuppressedError, Symbol */ + +var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); +}; + +export function __extends(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +} + +export var __assign = function() { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + } + return __assign.apply(this, arguments); +} + +export function __rest(s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; +} + +export function __decorate(decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +} + +export function __param(paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } +} + +export function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { + function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } + var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; + var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; + var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); + var _, done = false; + for (var i = decorators.length - 1; i >= 0; i--) { + var context = {}; + for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; + for (var p in contextIn.access) context.access[p] = contextIn.access[p]; + context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; + var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); + if (kind === "accessor") { + if (result === void 0) continue; + if (result === null || typeof result !== "object") throw new TypeError("Object expected"); + if (_ = accept(result.get)) descriptor.get = _; + if (_ = accept(result.set)) descriptor.set = _; + if (_ = accept(result.init)) initializers.unshift(_); + } + else if (_ = accept(result)) { + if (kind === "field") initializers.unshift(_); + else descriptor[key] = _; + } + } + if (target) Object.defineProperty(target, contextIn.name, descriptor); + done = true; +}; + +export function __runInitializers(thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); + } + return useValue ? value : void 0; +}; + +export function __propKey(x) { + return typeof x === "symbol" ? x : "".concat(x); +}; + +export function __setFunctionName(f, name, prefix) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); +}; + +export function __metadata(metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); +} + +export function __awaiter(thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +} + +export function __generator(thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (g && (g = 0, op[0] && (_ = 0)), _) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +} + +export var __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]; +}); + +export function __exportStar(m, o) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); +} + +export function __values(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +} + +export function __read(o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +} + +/** @deprecated */ +export function __spread() { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; +} + +/** @deprecated */ +export function __spreadArrays() { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; +} + +export function __spreadArray(to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); +} + +export function __await(v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); +} + +export function __asyncGenerator(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; + function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } + function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } +} + +export function __asyncDelegator(o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } +} + +export function __asyncValues(o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } +} + +export function __makeTemplateObject(cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; +}; + +var __setModuleDefault = Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}; + +export function __importStar(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; +} + +export function __importDefault(mod) { + return (mod && mod.__esModule) ? mod : { default: mod }; +} + +export function __classPrivateFieldGet(receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +} + +export function __classPrivateFieldSet(receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +} + +export function __classPrivateFieldIn(state, receiver) { + if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); + return typeof state === "function" ? receiver === state : state.has(receiver); +} + +export function __addDisposableResource(env, value, async) { + if (value !== null && value !== void 0) { + if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); + var dispose, inner; + if (async) { + if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); + dispose = value[Symbol.asyncDispose]; + } + if (dispose === void 0) { + if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); + dispose = value[Symbol.dispose]; + if (async) inner = dispose; + } + if (typeof dispose !== "function") throw new TypeError("Object not disposable."); + if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; + env.stack.push({ value: value, dispose: dispose, async: async }); + } + else if (async) { + env.stack.push({ async: true }); + } + return value; + +} + +var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { + var e = new Error(message); + return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; +}; + +export function __disposeResources(env) { + function fail(e) { + env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; + env.hasError = true; + } + function next() { + while (env.stack.length) { + var rec = env.stack.pop(); + try { + var result = rec.dispose && rec.dispose.call(rec.value); + if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); + } + catch (e) { + fail(e); + } + } + if (env.hasError) throw env.error; + } + return next(); +} + +export default { + __extends: __extends, + __assign: __assign, + __rest: __rest, + __decorate: __decorate, + __param: __param, + __metadata: __metadata, + __awaiter: __awaiter, + __generator: __generator, + __createBinding: __createBinding, + __exportStar: __exportStar, + __values: __values, + __read: __read, + __spread: __spread, + __spreadArrays: __spreadArrays, + __spreadArray: __spreadArray, + __await: __await, + __asyncGenerator: __asyncGenerator, + __asyncDelegator: __asyncDelegator, + __asyncValues: __asyncValues, + __makeTemplateObject: __makeTemplateObject, + __importStar: __importStar, + __importDefault: __importDefault, + __classPrivateFieldGet: __classPrivateFieldGet, + __classPrivateFieldSet: __classPrivateFieldSet, + __classPrivateFieldIn: __classPrivateFieldIn, + __addDisposableResource: __addDisposableResource, + __disposeResources: __disposeResources, +}; diff --git a/tools/eslint/node_modules/tslib/tslib.es6.mjs b/tools/eslint/node_modules/tslib/tslib.es6.mjs new file mode 100644 index 00000000000000..0df91b1b4d6ba1 --- /dev/null +++ b/tools/eslint/node_modules/tslib/tslib.es6.mjs @@ -0,0 +1,373 @@ +/****************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global Reflect, Promise, SuppressedError, Symbol */ + +var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); +}; + +export function __extends(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +} + +export var __assign = function() { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + } + return __assign.apply(this, arguments); +} + +export function __rest(s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; +} + +export function __decorate(decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +} + +export function __param(paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } +} + +export function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { + function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } + var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; + var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; + var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); + var _, done = false; + for (var i = decorators.length - 1; i >= 0; i--) { + var context = {}; + for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; + for (var p in contextIn.access) context.access[p] = contextIn.access[p]; + context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; + var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); + if (kind === "accessor") { + if (result === void 0) continue; + if (result === null || typeof result !== "object") throw new TypeError("Object expected"); + if (_ = accept(result.get)) descriptor.get = _; + if (_ = accept(result.set)) descriptor.set = _; + if (_ = accept(result.init)) initializers.unshift(_); + } + else if (_ = accept(result)) { + if (kind === "field") initializers.unshift(_); + else descriptor[key] = _; + } + } + if (target) Object.defineProperty(target, contextIn.name, descriptor); + done = true; +}; + +export function __runInitializers(thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); + } + return useValue ? value : void 0; +}; + +export function __propKey(x) { + return typeof x === "symbol" ? x : "".concat(x); +}; + +export function __setFunctionName(f, name, prefix) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); +}; + +export function __metadata(metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); +} + +export function __awaiter(thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +} + +export function __generator(thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (g && (g = 0, op[0] && (_ = 0)), _) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +} + +export var __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]; +}); + +export function __exportStar(m, o) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); +} + +export function __values(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +} + +export function __read(o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +} + +/** @deprecated */ +export function __spread() { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; +} + +/** @deprecated */ +export function __spreadArrays() { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; +} + +export function __spreadArray(to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); +} + +export function __await(v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); +} + +export function __asyncGenerator(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; + function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } + function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } +} + +export function __asyncDelegator(o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } +} + +export function __asyncValues(o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } +} + +export function __makeTemplateObject(cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; +}; + +var __setModuleDefault = Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}; + +export function __importStar(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; +} + +export function __importDefault(mod) { + return (mod && mod.__esModule) ? mod : { default: mod }; +} + +export function __classPrivateFieldGet(receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +} + +export function __classPrivateFieldSet(receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +} + +export function __classPrivateFieldIn(state, receiver) { + if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); + return typeof state === "function" ? receiver === state : state.has(receiver); +} + +export function __addDisposableResource(env, value, async) { + if (value !== null && value !== void 0) { + if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); + var dispose, inner; + if (async) { + if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); + dispose = value[Symbol.asyncDispose]; + } + if (dispose === void 0) { + if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); + dispose = value[Symbol.dispose]; + if (async) inner = dispose; + } + if (typeof dispose !== "function") throw new TypeError("Object not disposable."); + if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; + env.stack.push({ value: value, dispose: dispose, async: async }); + } + else if (async) { + env.stack.push({ async: true }); + } + return value; +} + +var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { + var e = new Error(message); + return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; +}; + +export function __disposeResources(env) { + function fail(e) { + env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; + env.hasError = true; + } + function next() { + while (env.stack.length) { + var rec = env.stack.pop(); + try { + var result = rec.dispose && rec.dispose.call(rec.value); + if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); + } + catch (e) { + fail(e); + } + } + if (env.hasError) throw env.error; + } + return next(); +} + +export default { + __extends, + __assign, + __rest, + __decorate, + __param, + __metadata, + __awaiter, + __generator, + __createBinding, + __exportStar, + __values, + __read, + __spread, + __spreadArrays, + __spreadArray, + __await, + __asyncGenerator, + __asyncDelegator, + __asyncValues, + __makeTemplateObject, + __importStar, + __importDefault, + __classPrivateFieldGet, + __classPrivateFieldSet, + __classPrivateFieldIn, + __addDisposableResource, + __disposeResources, +}; diff --git a/tools/eslint/node_modules/tslib/tslib.html b/tools/eslint/node_modules/tslib/tslib.html new file mode 100644 index 00000000000000..44c9ba51e3547a --- /dev/null +++ b/tools/eslint/node_modules/tslib/tslib.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/tools/eslint/node_modules/tslib/tslib.js b/tools/eslint/node_modules/tslib/tslib.js new file mode 100644 index 00000000000000..0f7c846b75a4b8 --- /dev/null +++ b/tools/eslint/node_modules/tslib/tslib.js @@ -0,0 +1,424 @@ +/****************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global global, define, Symbol, Reflect, Promise, SuppressedError */ +var __extends; +var __assign; +var __rest; +var __decorate; +var __param; +var __esDecorate; +var __runInitializers; +var __propKey; +var __setFunctionName; +var __metadata; +var __awaiter; +var __generator; +var __exportStar; +var __values; +var __read; +var __spread; +var __spreadArrays; +var __spreadArray; +var __await; +var __asyncGenerator; +var __asyncDelegator; +var __asyncValues; +var __makeTemplateObject; +var __importStar; +var __importDefault; +var __classPrivateFieldGet; +var __classPrivateFieldSet; +var __classPrivateFieldIn; +var __createBinding; +var __addDisposableResource; +var __disposeResources; +(function (factory) { + var root = typeof global === "object" ? global : typeof self === "object" ? self : typeof this === "object" ? this : {}; + if (typeof define === "function" && define.amd) { + define("tslib", ["exports"], function (exports) { factory(createExporter(root, createExporter(exports))); }); + } + else if (typeof module === "object" && typeof module.exports === "object") { + factory(createExporter(root, createExporter(module.exports))); + } + else { + factory(createExporter(root)); + } + function createExporter(exports, previous) { + if (exports !== root) { + if (typeof Object.create === "function") { + Object.defineProperty(exports, "__esModule", { value: true }); + } + else { + exports.__esModule = true; + } + } + return function (id, v) { return exports[id] = previous ? previous(id, v) : v; }; + } +}) +(function (exporter) { + var extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + + __extends = function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; + + __assign = Object.assign || function (t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + }; + + __rest = function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; + }; + + __decorate = function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; + }; + + __param = function (paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } + }; + + __esDecorate = function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { + function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } + var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; + var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; + var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); + var _, done = false; + for (var i = decorators.length - 1; i >= 0; i--) { + var context = {}; + for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; + for (var p in contextIn.access) context.access[p] = contextIn.access[p]; + context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; + var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); + if (kind === "accessor") { + if (result === void 0) continue; + if (result === null || typeof result !== "object") throw new TypeError("Object expected"); + if (_ = accept(result.get)) descriptor.get = _; + if (_ = accept(result.set)) descriptor.set = _; + if (_ = accept(result.init)) initializers.unshift(_); + } + else if (_ = accept(result)) { + if (kind === "field") initializers.unshift(_); + else descriptor[key] = _; + } + } + if (target) Object.defineProperty(target, contextIn.name, descriptor); + done = true; + }; + + __runInitializers = function (thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); + } + return useValue ? value : void 0; + }; + + __propKey = function (x) { + return typeof x === "symbol" ? x : "".concat(x); + }; + + __setFunctionName = function (f, name, prefix) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); + }; + + __metadata = function (metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); + }; + + __awaiter = function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); + }; + + __generator = function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (g && (g = 0, op[0] && (_ = 0)), _) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } + }; + + __exportStar = function(m, o) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); + }; + + __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]; + }); + + __values = function (o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); + }; + + __read = function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; + }; + + /** @deprecated */ + __spread = function () { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; + }; + + /** @deprecated */ + __spreadArrays = function () { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; + }; + + __spreadArray = function (to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); + }; + + __await = function (v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); + }; + + __asyncGenerator = function (thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; + function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } + function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } + }; + + __asyncDelegator = function (o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } + }; + + __asyncValues = function (o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } + }; + + __makeTemplateObject = function (cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; + }; + + var __setModuleDefault = Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); + }) : function(o, v) { + o["default"] = v; + }; + + __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; + }; + + __importDefault = function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; + }; + + __classPrivateFieldGet = function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); + }; + + __classPrivateFieldSet = function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; + }; + + __classPrivateFieldIn = function (state, receiver) { + if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); + return typeof state === "function" ? receiver === state : state.has(receiver); + }; + + __addDisposableResource = function (env, value, async) { + if (value !== null && value !== void 0) { + if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); + var dispose, inner; + if (async) { + if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); + dispose = value[Symbol.asyncDispose]; + } + if (dispose === void 0) { + if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); + dispose = value[Symbol.dispose]; + if (async) inner = dispose; + } + if (typeof dispose !== "function") throw new TypeError("Object not disposable."); + if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; + env.stack.push({ value: value, dispose: dispose, async: async }); + } + else if (async) { + env.stack.push({ async: true }); + } + return value; + }; + + var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { + var e = new Error(message); + return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; + }; + + __disposeResources = function (env) { + function fail(e) { + env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; + env.hasError = true; + } + function next() { + while (env.stack.length) { + var rec = env.stack.pop(); + try { + var result = rec.dispose && rec.dispose.call(rec.value); + if (rec.async) return Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); + } + catch (e) { + fail(e); + } + } + if (env.hasError) throw env.error; + } + return next(); + }; + + exporter("__extends", __extends); + exporter("__assign", __assign); + exporter("__rest", __rest); + exporter("__decorate", __decorate); + exporter("__param", __param); + exporter("__esDecorate", __esDecorate); + exporter("__runInitializers", __runInitializers); + exporter("__propKey", __propKey); + exporter("__setFunctionName", __setFunctionName); + exporter("__metadata", __metadata); + exporter("__awaiter", __awaiter); + exporter("__generator", __generator); + exporter("__exportStar", __exportStar); + exporter("__createBinding", __createBinding); + exporter("__values", __values); + exporter("__read", __read); + exporter("__spread", __spread); + exporter("__spreadArrays", __spreadArrays); + exporter("__spreadArray", __spreadArray); + exporter("__await", __await); + exporter("__asyncGenerator", __asyncGenerator); + exporter("__asyncDelegator", __asyncDelegator); + exporter("__asyncValues", __asyncValues); + exporter("__makeTemplateObject", __makeTemplateObject); + exporter("__importStar", __importStar); + exporter("__importDefault", __importDefault); + exporter("__classPrivateFieldGet", __classPrivateFieldGet); + exporter("__classPrivateFieldSet", __classPrivateFieldSet); + exporter("__classPrivateFieldIn", __classPrivateFieldIn); + exporter("__addDisposableResource", __addDisposableResource); + exporter("__disposeResources", __disposeResources); +}); diff --git a/tools/eslint/package-lock.json b/tools/eslint/package-lock.json index 5e672a8479d99d..51842edff47848 100644 --- a/tools/eslint/package-lock.json +++ b/tools/eslint/package-lock.json @@ -11,10 +11,10 @@ "@babel/core": "^7.24.7", "@babel/eslint-parser": "^7.24.7", "@babel/plugin-syntax-import-attributes": "^7.24.7", - "@stylistic/eslint-plugin-js": "^2.2.2", - "eslint": "^9.5.0", + "@stylistic/eslint-plugin-js": "^2.3.0", + "eslint": "^9.6.0", "eslint-formatter-tap": "^8.40.0", - "eslint-plugin-jsdoc": "^48.2.12", + "eslint-plugin-jsdoc": "^48.5.0", "eslint-plugin-markdown": "^5.0.0", "globals": "^15.6.0" } @@ -421,23 +421,23 @@ } }, "node_modules/@eslint-community/regexpp": { - "version": "4.10.1", - "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.10.1.tgz", - "integrity": "sha512-Zm2NGpWELsQAD1xsJzGQpYfvICSsFkEpU0jxBjfdC6uNEWXcHnfs9hScFWtXVDVl+rBQJGrl4g1vcKIejpH9dA==", + "version": "4.11.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.11.0.tgz", + "integrity": "sha512-G/M/tIiMrTAxEWRfLfQJMmGNX28IxBg4PBz8XqQhqUHLFI6TL2htpIB1iQCj144V5ee/JaKyT9/WZ0MGZWfA7A==", "license": "MIT", "engines": { "node": "^12.0.0 || ^14.0.0 || >=16.0.0" } }, "node_modules/@eslint/config-array": { - "version": "0.16.0", - "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.16.0.tgz", - "integrity": "sha512-/jmuSd74i4Czf1XXn7wGRWZCuyaUZ330NH1Bek0Pplatt4Sy1S5haN21SCLLdbeKslQ+S0wEJ+++v5YibSi+Lg==", + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.17.0.tgz", + "integrity": "sha512-A68TBu6/1mHHuc5YJL0U0VVeGNiklLAL6rRmhTCP2B5XjWLMnrX+HkO+IAXyHvks5cyyY1jjK5ITPQ1HGS2EVA==", "license": "Apache-2.0", "dependencies": { "@eslint/object-schema": "^2.1.4", "debug": "^4.3.1", - "minimatch": "^3.0.5" + "minimatch": "^3.1.2" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -479,9 +479,9 @@ } }, "node_modules/@eslint/js": { - "version": "9.5.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.5.0.tgz", - "integrity": "sha512-A7+AOT2ICkodvtsWnxZP4Xxk3NbZ3VMHd8oihydLRGrJgqqdEz1qSeEgXYyT/Cu8h1TWWsQRejIx48mtjZ5y1w==", + "version": "9.6.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.6.0.tgz", + "integrity": "sha512-D9B0/3vNg44ZeWbYMpBoXqNP4j6eQD5vNwIlGAuFRRzK/WtT/jvDQW3Bi9kkf3PMDMlM7Yi+73VLUsn5bJcl8A==", "license": "MIT", "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -614,10 +614,22 @@ "node": ">= 8" } }, + "node_modules/@pkgr/core": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@pkgr/core/-/core-0.1.1.tgz", + "integrity": "sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==", + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, "node_modules/@stylistic/eslint-plugin-js": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/@stylistic/eslint-plugin-js/-/eslint-plugin-js-2.2.2.tgz", - "integrity": "sha512-Vj2Q1YHVvJw+ThtOvmk5Yx7wZanVrIBRUTT89horLDb4xdP9GA1um9XOYQC6j67VeUC2gjZQnz5/RVJMzaOhtw==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@stylistic/eslint-plugin-js/-/eslint-plugin-js-2.3.0.tgz", + "integrity": "sha512-lQwoiYb0Fs6Yc5QS3uT8+T9CPKK2Eoxc3H8EnYJgM26v/DgtW+1lvy2WNgyBflU+ThShZaHm3a6CdD9QeKx23w==", "license": "MIT", "dependencies": { "@types/eslint": "^8.56.10", @@ -682,9 +694,9 @@ "license": "MIT" }, "node_modules/@typescript-eslint/types": { - "version": "7.13.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.13.1.tgz", - "integrity": "sha512-7K7HMcSQIAND6RBL4kDl24sG/xKM13cA85dc7JnmQXw2cBDngg7c19B++JzvJHRG3zG36n9j1i451GBzRuHchw==", + "version": "7.14.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.14.1.tgz", + "integrity": "sha512-mL7zNEOQybo5R3AavY+Am7KLv8BorIv7HCYS5rKoNZKQD9tsfGUpO4KdAn3sSUvTiS4PQkr2+K0KJbxj8H9NDg==", "license": "MIT", "engines": { "node": "^18.18.0 || >=20.0.0" @@ -967,6 +979,12 @@ "integrity": "sha512-nkoEX2QIB8kwCOtvtgwhXWy2IHVcOLQZu9Qo36uaGB835mdX/h8uLRlosL6QIhLVUnAiicXRW00PwaPZC74Nrg==", "license": "ISC" }, + "node_modules/es-module-lexer": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.5.4.tgz", + "integrity": "sha512-MVNK56NiMrOwitFB7cqDwq0CQutbw+0BvLshJSse0MUNU+y1FC3bUS/AQg7oUng+/wKrrki7JfmwtVHkVfPLlw==", + "license": "MIT" + }, "node_modules/escalade": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.2.tgz", @@ -986,16 +1004,16 @@ } }, "node_modules/eslint": { - "version": "9.5.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.5.0.tgz", - "integrity": "sha512-+NAOZFrW/jFTS3dASCGBxX1pkFD0/fsO+hfAkJ4TyYKwgsXZbqzrw+seCYFCcPCYXvnD67tAnglU7GQTz6kcVw==", + "version": "9.6.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.6.0.tgz", + "integrity": "sha512-ElQkdLMEEqQNM9Njff+2Y4q2afHk7JpkPvrd7Xh7xefwgQynqPxwf55J7di9+MEibWUGdNjFF9ITG9Pck5M84w==", "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", - "@eslint/config-array": "^0.16.0", + "@eslint/config-array": "^0.17.0", "@eslint/eslintrc": "^3.1.0", - "@eslint/js": "9.5.0", + "@eslint/js": "9.6.0", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.3.0", "@nodelib/fs.walk": "^1.2.8", @@ -1006,7 +1024,7 @@ "escape-string-regexp": "^4.0.0", "eslint-scope": "^8.0.1", "eslint-visitor-keys": "^4.0.0", - "espree": "^10.0.1", + "espree": "^10.1.0", "esquery": "^1.5.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", @@ -1049,9 +1067,9 @@ } }, "node_modules/eslint-plugin-jsdoc": { - "version": "48.2.12", - "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-48.2.12.tgz", - "integrity": "sha512-sO9sKkJx5ovWoRk9hV0YiNzXQ4Z6j27CqE/po2E3wddZVuy9wvKPSTiIhpxMTrP/qURvKayJIDB2+o9kyCW1Fw==", + "version": "48.5.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-48.5.0.tgz", + "integrity": "sha512-ukXPNpGby3KjCveCizIS8t1EbuJEHYEu/tBg8GCbn/YbHcXwphyvYCdvRZ/oMRfTscGSSzfsWoZ+ZkAP0/6YMQ==", "license": "BSD-3-Clause", "dependencies": { "@es-joy/jsdoccomment": "~0.43.1", @@ -1060,8 +1078,10 @@ "debug": "^4.3.4", "escape-string-regexp": "^4.0.0", "esquery": "^1.5.0", + "parse-imports": "^2.1.0", "semver": "^7.6.2", - "spdx-expression-parse": "^4.0.0" + "spdx-expression-parse": "^4.0.0", + "synckit": "^0.9.0" }, "engines": { "node": ">=18" @@ -1844,6 +1864,19 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/parse-imports": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/parse-imports/-/parse-imports-2.1.0.tgz", + "integrity": "sha512-JQWgmK2o4w8leUkZeZPatWdAny6vXGU/3siIUvMF6J2rDCud9aTt8h/px9oZJ6U3EcfhngBJ635uPFI0q0VAeA==", + "license": "Apache 2.0", + "dependencies": { + "es-module-lexer": "^1.5.3", + "slashes": "^3.0.12" + }, + "engines": { + "node": ">= 18" + } + }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -1978,6 +2011,12 @@ "node": ">=8" } }, + "node_modules/slashes": { + "version": "3.0.12", + "resolved": "https://registry.npmjs.org/slashes/-/slashes-3.0.12.tgz", + "integrity": "sha512-Q9VME8WyGkc7pJf6QEkj3wE+2CnvZMI+XJhwdTPR8Z/kWQRXi7boAWLDibRPyHRTUTPx5FaU7MsyrjI3yLB4HA==", + "license": "ISC" + }, "node_modules/spdx-exceptions": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.5.0.tgz", @@ -2036,6 +2075,22 @@ "node": ">=4" } }, + "node_modules/synckit": { + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.9.0.tgz", + "integrity": "sha512-7RnqIMq572L8PeEzKeBINYEJDDxpcH8JEgLwUqBd3TkofhFRbkq4QLR0u+36avGAhCRbk2nnmjcW9SE531hPDg==", + "license": "MIT", + "dependencies": { + "@pkgr/core": "^0.1.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, "node_modules/text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -2051,6 +2106,12 @@ "node": ">=4" } }, + "node_modules/tslib": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", + "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==", + "license": "0BSD" + }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", diff --git a/tools/eslint/package.json b/tools/eslint/package.json index 25bc4f8b56652f..217028dfd04701 100644 --- a/tools/eslint/package.json +++ b/tools/eslint/package.json @@ -10,10 +10,10 @@ "@babel/core": "^7.24.7", "@babel/eslint-parser": "^7.24.7", "@babel/plugin-syntax-import-attributes": "^7.24.7", - "@stylistic/eslint-plugin-js": "^2.2.2", - "eslint": "^9.5.0", + "@stylistic/eslint-plugin-js": "^2.3.0", + "eslint": "^9.6.0", "eslint-formatter-tap": "^8.40.0", - "eslint-plugin-jsdoc": "^48.2.12", + "eslint-plugin-jsdoc": "^48.5.0", "eslint-plugin-markdown": "^5.0.0", "globals": "^15.6.0" }