react-doctor 0.9.13-dev.ff7dd67 → 0.9.14-dev.bcf8062
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_react-doctor_require-typescript-DnwIzXJn.js +7 -0
- package/dist/{active-scan-abort-registry-DwG6tSPy.js → active-scan-abort-registry-B72ASBUh.js} +3 -3
- package/dist/build-section-divider-v7NN_cR8.js +80 -0
- package/dist/{ci-ByM_SFTq.js → ci-BnQkEEV1.js} +12 -12
- package/dist/cli.js +25 -26
- package/dist/constants-CKOk_Fa9.js +23 -0
- package/dist/{design-2hjOmtV1.js → design-Du1rV5hV.js} +4 -4
- package/dist/{devtools-CC2PAZ85.js → devtools-DOdrAPkZ.js} +3 -3
- package/dist/duplicate-jsx-worker.d.ts +1 -0
- package/dist/duplicate-jsx-worker.js +636 -0
- package/dist/{exit-gracefully-niPFXq9Y.js → exit-gracefully-D9ffPCDJ.js} +7 -7
- package/dist/{get-east-asian-width-Bv2TD3Xj.js → get-east-asian-width-CM5BOEC-.js} +3 -3
- package/dist/{handle-error-D-4lexec.js → handle-error-BWHTahSo.js} +5 -5
- package/dist/index.js +2324 -1619
- package/dist/{inspect-BrctG7ql.js → inspect-fWFs2jtk.js} +25 -21
- package/dist/{install-CcFc56OK.js → install-DWpPYvxU.js} +9 -9
- package/dist/{install-doctor-script-Coa2ErCg.js → install-doctor-script-wNnu5y_f.js} +5 -5
- package/dist/{install-github-workflow-DlfdrYkQ.js → install-github-workflow-DsgMnbqe.js} +5 -5
- package/dist/{install-react-doctor-BWxqZMX-.js → install-react-doctor-hFwI2elO.js} +8 -8
- package/dist/{jsx-runtime-Njm7vAoN.js → jsx-runtime-DCJqkm-B.js} +7 -7
- package/dist/oxlint-worker.d.ts +1 -0
- package/dist/oxlint-worker.js +135 -0
- package/dist/{print-branded-header-DFkeG4BS.js → print-branded-header-BcXGdtml.js} +4 -4
- package/dist/project-analysis-worker.js +452 -469
- package/dist/{prompt-runtime-scan-url-BenBNq25.js → prompt-runtime-scan-url-s4NKC5nM.js} +5 -5
- package/dist/{read-object-file-CqMtxcfF.js → read-object-file-Be3X79OD.js} +4 -4
- package/dist/{record-metric-Bkorhx43.js → record-metric-D8ltm-Oh.js} +1818 -1062
- package/dist/{report-error-DPjmfRi9.js → report-error-5LSXHGJq.js} +7 -7
- package/dist/{report-workflow-result-CBL6CrLY.js → report-workflow-result-2aLf7RhF.js} +5 -5
- package/dist/{resolve-scope-BFloAClV.js → resolve-scope-BXJ4WEdf.js} +6 -6
- package/dist/{rules-BKNy9YIl.js → rules-C71aHICA.js} +6 -6
- package/dist/{run-scan-app-Bc70ozp-.js → run-scan-app-BqzvDO2G.js} +28 -22
- package/dist/{runtime-scan-ODrdp5mV.js → runtime-scan-TcGr2CHS.js} +11 -11
- package/dist/{sanitize-runtime-url-BYOmPSdm.js → sanitize-runtime-url-LBQ4amZg.js} +4 -4
- package/dist/{scan-BfcGHHkI.js → scan-8j0aKndg.js} +9 -9
- package/dist/{semver-DFtnEmN-.js → semver-DlmXks31.js} +3 -3
- package/dist/{should-fail-scan-gate-CCPDoHaM.js → should-fail-scan-gate-fjfa2sYx.js} +116 -72
- package/dist/{should-skip-prompts-D-ClPHHR.js → should-skip-prompts-BZZxI1vY.js} +4 -4
- package/dist/{should-use-tui-BaCVIPPN.js → should-use-tui-C59qAiOG.js} +4 -4
- package/dist/{telemetry-runtime-BGWa_GB9.js → telemetry-runtime-CmlSXXfi.js} +153 -5
- package/dist/unwrap-typescript-expression-CbO_6kmC.js +14 -0
- package/dist/{version-DN1N-oZy.js → version-DRDcTlA9.js} +4 -4
- package/dist/{why-CyioXUF2.js → why-DthVqP00.js} +4 -4
- package/dist/{with-run-span-GsCWW2_X.js → with-run-span-D4-folvM.js} +5 -5
- package/package.json +6 -6
- package/dist/build-section-divider-BRuN44fL.js +0 -216
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="a64790d6-0fbf-5baf-969b-f9980583a72d")}catch(e){}}();
|
|
3
3
|
import { i as __toESM, n as __exportAll, r as __require, t as __commonJSMin } from "./chunk-ChKA3wi6.js";
|
|
4
|
-
import { n as require_picomatch$2, t as require_semver } from "./semver-
|
|
4
|
+
import { n as require_picomatch$2, t as require_semver } from "./semver-DlmXks31.js";
|
|
5
|
+
import { t as _react_doctor_require_typescript_default } from "./_react-doctor_require-typescript-DnwIzXJn.js";
|
|
6
|
+
import { t as unwrapTypescriptExpression } from "./unwrap-typescript-expression-CbO_6kmC.js";
|
|
7
|
+
import { a as MAX_GLOB_PATTERN_LENGTH_CHARS, c as GIT_CHECK_ATTR_MAX_BUFFER_BYTES } from "./constants-CKOk_Fa9.js";
|
|
5
8
|
import { builtinModules } from "node:module";
|
|
6
9
|
import { spawnSync } from "node:child_process";
|
|
7
10
|
import * as path$1 from "node:path";
|
|
8
11
|
import path, { basename, dirname, extname, isAbsolute, join, parse, posix, relative, resolve, sep } from "node:path";
|
|
9
12
|
import * as fs$1 from "node:fs";
|
|
10
13
|
import { existsSync, readFileSync, readdirSync, realpathSync, statSync } from "node:fs";
|
|
11
|
-
import ts from "typescript";
|
|
12
14
|
import { parseSync } from "oxc-parser";
|
|
15
|
+
import { readFile } from "node:fs/promises";
|
|
13
16
|
import { ResolverFactory } from "oxc-resolver";
|
|
14
17
|
import { devNull } from "node:os";
|
|
15
18
|
import { parseJSONC, parseTOML, parseYAML } from "confbox";
|
|
16
|
-
import { readFile } from "node:fs/promises";
|
|
17
19
|
import { parse as parse$1 } from "@astrojs/compiler/sync";
|
|
18
20
|
//#region ../core/src/project-analysis/constants.ts
|
|
19
21
|
const DEFAULT_EXTENSIONS = [
|
|
@@ -13380,19 +13382,19 @@ const collectStylesheetImportSpecifiers = (content) => {
|
|
|
13380
13382
|
const extractJitiLoadReferences = (sourceText) => {
|
|
13381
13383
|
if (!sourceText.includes("jiti")) return [];
|
|
13382
13384
|
const virtualFilePath = "react-doctor-jiti-source.tsx";
|
|
13383
|
-
const sourceFile =
|
|
13385
|
+
const sourceFile = _react_doctor_require_typescript_default.createSourceFile(virtualFilePath, sourceText, _react_doctor_require_typescript_default.ScriptTarget.Latest, true, _react_doctor_require_typescript_default.ScriptKind.TSX);
|
|
13384
13386
|
const compilerOptions = {
|
|
13385
13387
|
allowJs: true,
|
|
13386
|
-
jsx:
|
|
13388
|
+
jsx: _react_doctor_require_typescript_default.JsxEmit.Preserve,
|
|
13387
13389
|
noLib: true,
|
|
13388
13390
|
noResolve: true,
|
|
13389
|
-
target:
|
|
13391
|
+
target: _react_doctor_require_typescript_default.ScriptTarget.Latest
|
|
13390
13392
|
};
|
|
13391
|
-
const compilerHost =
|
|
13393
|
+
const compilerHost = _react_doctor_require_typescript_default.createCompilerHost(compilerOptions);
|
|
13392
13394
|
compilerHost.fileExists = (candidatePath) => candidatePath === virtualFilePath;
|
|
13393
13395
|
compilerHost.getSourceFile = (candidatePath) => candidatePath === virtualFilePath ? sourceFile : void 0;
|
|
13394
13396
|
compilerHost.readFile = (candidatePath) => candidatePath === virtualFilePath ? sourceText : void 0;
|
|
13395
|
-
const program =
|
|
13397
|
+
const program = _react_doctor_require_typescript_default.createProgram({
|
|
13396
13398
|
rootNames: [virtualFilePath],
|
|
13397
13399
|
options: compilerOptions,
|
|
13398
13400
|
host: compilerHost
|
|
@@ -13407,60 +13409,60 @@ const extractJitiLoadReferences = (sourceText) => {
|
|
|
13407
13409
|
const factorySymbols = /* @__PURE__ */ new Set();
|
|
13408
13410
|
const moduleSymbols = /* @__PURE__ */ new Set();
|
|
13409
13411
|
const loaderSymbols = /* @__PURE__ */ new Set();
|
|
13410
|
-
const isRequireJitiCall = (expression) =>
|
|
13412
|
+
const isRequireJitiCall = (expression) => _react_doctor_require_typescript_default.isCallExpression(expression) && _react_doctor_require_typescript_default.isIdentifier(expression.expression) && expression.expression.text === "require" && typeChecker.getSymbolAtLocation(expression.expression) === void 0 && expression.arguments.length === 1 && _react_doctor_require_typescript_default.isStringLiteralLike(expression.arguments[0]) && expression.arguments[0].text === "jiti";
|
|
13411
13413
|
for (const statement of boundSourceFile.statements) {
|
|
13412
|
-
if (
|
|
13414
|
+
if (_react_doctor_require_typescript_default.isImportDeclaration(statement) && _react_doctor_require_typescript_default.isStringLiteral(statement.moduleSpecifier) && statement.moduleSpecifier.text === "jiti") {
|
|
13413
13415
|
const importClause = statement.importClause;
|
|
13414
13416
|
if (!importClause) continue;
|
|
13415
13417
|
if (importClause.name) {
|
|
13416
13418
|
const defaultImportSymbol = typeChecker.getSymbolAtLocation(importClause.name);
|
|
13417
13419
|
if (defaultImportSymbol) factorySymbols.add(defaultImportSymbol);
|
|
13418
13420
|
}
|
|
13419
|
-
if (importClause.namedBindings &&
|
|
13421
|
+
if (importClause.namedBindings && _react_doctor_require_typescript_default.isNamespaceImport(importClause.namedBindings)) {
|
|
13420
13422
|
const moduleSymbol = typeChecker.getSymbolAtLocation(importClause.namedBindings.name);
|
|
13421
13423
|
if (moduleSymbol) moduleSymbols.add(moduleSymbol);
|
|
13422
13424
|
}
|
|
13423
|
-
if (importClause.namedBindings &&
|
|
13425
|
+
if (importClause.namedBindings && _react_doctor_require_typescript_default.isNamedImports(importClause.namedBindings)) for (const importSpecifier of importClause.namedBindings.elements) {
|
|
13424
13426
|
if ((importSpecifier.propertyName?.text ?? importSpecifier.name.text) !== "createJiti") continue;
|
|
13425
13427
|
const factorySymbol = typeChecker.getSymbolAtLocation(importSpecifier.name);
|
|
13426
13428
|
if (factorySymbol) factorySymbols.add(factorySymbol);
|
|
13427
13429
|
}
|
|
13428
13430
|
continue;
|
|
13429
13431
|
}
|
|
13430
|
-
if (!
|
|
13432
|
+
if (!_react_doctor_require_typescript_default.isVariableStatement(statement)) continue;
|
|
13431
13433
|
for (const declaration of statement.declarationList.declarations) {
|
|
13432
13434
|
if (!declaration.initializer || !isRequireJitiCall(declaration.initializer)) continue;
|
|
13433
|
-
if (
|
|
13435
|
+
if (_react_doctor_require_typescript_default.isIdentifier(declaration.name)) {
|
|
13434
13436
|
const moduleSymbol = typeChecker.getSymbolAtLocation(declaration.name);
|
|
13435
13437
|
if (moduleSymbol) moduleSymbols.add(moduleSymbol);
|
|
13436
13438
|
continue;
|
|
13437
13439
|
}
|
|
13438
|
-
if (!
|
|
13440
|
+
if (!_react_doctor_require_typescript_default.isObjectBindingPattern(declaration.name)) continue;
|
|
13439
13441
|
for (const bindingElement of declaration.name.elements) {
|
|
13440
13442
|
const importedName = bindingElement.propertyName ?? bindingElement.name;
|
|
13441
|
-
if (!
|
|
13442
|
-
if (!
|
|
13443
|
+
if (!_react_doctor_require_typescript_default.isIdentifier(importedName) || importedName.text !== "createJiti") continue;
|
|
13444
|
+
if (!_react_doctor_require_typescript_default.isIdentifier(bindingElement.name)) continue;
|
|
13443
13445
|
const factorySymbol = typeChecker.getSymbolAtLocation(bindingElement.name);
|
|
13444
13446
|
if (factorySymbol) factorySymbols.add(factorySymbol);
|
|
13445
13447
|
}
|
|
13446
13448
|
}
|
|
13447
13449
|
}
|
|
13448
|
-
const isRequireJitiFactoryCall = (expression) =>
|
|
13450
|
+
const isRequireJitiFactoryCall = (expression) => _react_doctor_require_typescript_default.isCallExpression(expression) && isRequireJitiCall(expression.expression);
|
|
13449
13451
|
const isFactoryExpression = (expression) => {
|
|
13450
13452
|
const factorySymbol = typeChecker.getSymbolAtLocation(expression);
|
|
13451
13453
|
if (factorySymbol && factorySymbols.has(factorySymbol)) return true;
|
|
13452
|
-
if (!
|
|
13454
|
+
if (!_react_doctor_require_typescript_default.isPropertyAccessExpression(expression) || expression.name.text !== "createJiti") return false;
|
|
13453
13455
|
const moduleSymbol = typeChecker.getSymbolAtLocation(expression.expression);
|
|
13454
13456
|
return moduleSymbol !== void 0 && moduleSymbols.has(moduleSymbol);
|
|
13455
13457
|
};
|
|
13456
13458
|
const collectLoaderBindings = (node) => {
|
|
13457
|
-
if (
|
|
13459
|
+
if (_react_doctor_require_typescript_default.isVariableDeclaration(node) && _react_doctor_require_typescript_default.isIdentifier(node.name) && node.initializer && _react_doctor_require_typescript_default.isCallExpression(node.initializer)) {
|
|
13458
13460
|
if (isRequireJitiFactoryCall(node.initializer) || isFactoryExpression(node.initializer.expression)) {
|
|
13459
13461
|
const loaderSymbol = typeChecker.getSymbolAtLocation(node.name);
|
|
13460
13462
|
if (loaderSymbol) loaderSymbols.add(loaderSymbol);
|
|
13461
13463
|
}
|
|
13462
13464
|
}
|
|
13463
|
-
|
|
13465
|
+
_react_doctor_require_typescript_default.forEachChild(node, collectLoaderBindings);
|
|
13464
13466
|
};
|
|
13465
13467
|
collectLoaderBindings(boundSourceFile);
|
|
13466
13468
|
const references = [];
|
|
@@ -13468,25 +13470,25 @@ const extractJitiLoadReferences = (sourceText) => {
|
|
|
13468
13470
|
const firstArgument = callExpression.arguments[0];
|
|
13469
13471
|
const position = boundSourceFile.getLineAndCharacterOfPosition(callExpression.getStart());
|
|
13470
13472
|
references.push({
|
|
13471
|
-
path: firstArgument &&
|
|
13473
|
+
path: firstArgument && _react_doctor_require_typescript_default.isStringLiteralLike(firstArgument) ? firstArgument.text : void 0,
|
|
13472
13474
|
line: position.line + 1,
|
|
13473
13475
|
column: position.character
|
|
13474
13476
|
});
|
|
13475
13477
|
};
|
|
13476
13478
|
const visitLoaderCalls = (node) => {
|
|
13477
|
-
if (
|
|
13479
|
+
if (_react_doctor_require_typescript_default.isCallExpression(node)) {
|
|
13478
13480
|
const calleeSymbol = typeChecker.getSymbolAtLocation(node.expression);
|
|
13479
13481
|
if (calleeSymbol && loaderSymbols.has(calleeSymbol)) recordLoaderCall(node);
|
|
13480
|
-
else if (
|
|
13482
|
+
else if (_react_doctor_require_typescript_default.isCallExpression(node.expression)) {
|
|
13481
13483
|
if (isRequireJitiFactoryCall(node.expression) || isFactoryExpression(node.expression.expression)) recordLoaderCall(node);
|
|
13482
|
-
} else if (
|
|
13484
|
+
} else if (_react_doctor_require_typescript_default.isPropertyAccessExpression(node.expression) && node.expression.name.text === "import") {
|
|
13483
13485
|
const loaderExpression = node.expression.expression;
|
|
13484
13486
|
const loaderSymbol = typeChecker.getSymbolAtLocation(loaderExpression);
|
|
13485
|
-
const isInlineFactory =
|
|
13487
|
+
const isInlineFactory = _react_doctor_require_typescript_default.isCallExpression(loaderExpression) && isFactoryExpression(loaderExpression.expression);
|
|
13486
13488
|
if (loaderSymbol && loaderSymbols.has(loaderSymbol) || isInlineFactory) recordLoaderCall(node);
|
|
13487
13489
|
}
|
|
13488
13490
|
}
|
|
13489
|
-
|
|
13491
|
+
_react_doctor_require_typescript_default.forEachChild(node, visitLoaderCalls);
|
|
13490
13492
|
};
|
|
13491
13493
|
visitLoaderCalls(boundSourceFile);
|
|
13492
13494
|
return references;
|
|
@@ -36057,10 +36059,10 @@ const extractMarkdownModuleStatements = (sourceText) => {
|
|
|
36057
36059
|
//#endregion
|
|
36058
36060
|
//#region ../core/src/project-analysis/collect/parse.ts
|
|
36059
36061
|
const extractRecoveryImports = (filePath, sourceText) => {
|
|
36060
|
-
const sourceFile =
|
|
36062
|
+
const sourceFile = _react_doctor_require_typescript_default.createSourceFile(filePath, sourceText, _react_doctor_require_typescript_default.ScriptTarget.Latest, true, filePath.endsWith("x") ? _react_doctor_require_typescript_default.ScriptKind.TSX : _react_doctor_require_typescript_default.ScriptKind.TS);
|
|
36061
36063
|
const imports = [];
|
|
36062
36064
|
for (const statement of sourceFile.statements) {
|
|
36063
|
-
if (!
|
|
36065
|
+
if (!_react_doctor_require_typescript_default.isImportDeclaration(statement) || !_react_doctor_require_typescript_default.isStringLiteral(statement.moduleSpecifier)) continue;
|
|
36064
36066
|
const importedNames = [];
|
|
36065
36067
|
const importClause = statement.importClause;
|
|
36066
36068
|
if (importClause?.name) importedNames.push({
|
|
@@ -36070,14 +36072,14 @@ const extractRecoveryImports = (filePath, sourceText) => {
|
|
|
36070
36072
|
isDefault: true,
|
|
36071
36073
|
isTypeOnly: importClause.isTypeOnly
|
|
36072
36074
|
});
|
|
36073
|
-
if (importClause?.namedBindings &&
|
|
36075
|
+
if (importClause?.namedBindings && _react_doctor_require_typescript_default.isNamespaceImport(importClause.namedBindings)) importedNames.push({
|
|
36074
36076
|
name: "*",
|
|
36075
36077
|
alias: importClause.namedBindings.name.text,
|
|
36076
36078
|
isNamespace: true,
|
|
36077
36079
|
isDefault: false,
|
|
36078
36080
|
isTypeOnly: importClause.isTypeOnly
|
|
36079
36081
|
});
|
|
36080
|
-
if (importClause?.namedBindings &&
|
|
36082
|
+
if (importClause?.namedBindings && _react_doctor_require_typescript_default.isNamedImports(importClause.namedBindings)) for (const element of importClause.namedBindings.elements) importedNames.push({
|
|
36081
36083
|
name: element.propertyName?.text ?? element.name.text,
|
|
36082
36084
|
alias: element.name.text,
|
|
36083
36085
|
isNamespace: false,
|
|
@@ -36102,18 +36104,18 @@ const restoreMaskedSourceRange = (maskedSource, sourceSection, startOffset) => {
|
|
|
36102
36104
|
for (let characterIndex = 0; characterIndex < sourceSection.length; characterIndex++) maskedSource[startOffset + characterIndex] = sourceSection[characterIndex];
|
|
36103
36105
|
};
|
|
36104
36106
|
const maskSelectedExportKeywords = (sourceText, shouldMaskStatement) => {
|
|
36105
|
-
const sourceFile =
|
|
36107
|
+
const sourceFile = _react_doctor_require_typescript_default.createSourceFile("embedded-component.tsx", sourceText, _react_doctor_require_typescript_default.ScriptTarget.Latest, true, _react_doctor_require_typescript_default.ScriptKind.TSX);
|
|
36106
36108
|
const maskedSource = sourceText.split("");
|
|
36107
36109
|
for (const statement of sourceFile.statements) {
|
|
36108
|
-
if (!shouldMaskStatement(statement) || !
|
|
36109
|
-
const exportModifier =
|
|
36110
|
+
if (!shouldMaskStatement(statement) || !_react_doctor_require_typescript_default.canHaveModifiers(statement)) continue;
|
|
36111
|
+
const exportModifier = _react_doctor_require_typescript_default.getModifiers(statement)?.find((modifier) => modifier.kind === _react_doctor_require_typescript_default.SyntaxKind.ExportKeyword);
|
|
36110
36112
|
if (!exportModifier) continue;
|
|
36111
36113
|
for (let characterIndex = exportModifier.getStart(sourceFile); characterIndex < exportModifier.end; characterIndex++) maskedSource[characterIndex] = " ";
|
|
36112
36114
|
}
|
|
36113
36115
|
return maskedSource.join("");
|
|
36114
36116
|
};
|
|
36115
|
-
const maskAstroPropsExports = (sourceText) => maskSelectedExportKeywords(sourceText, (statement) => (
|
|
36116
|
-
const maskSvelteInstancePropExports = (sourceText) => maskSelectedExportKeywords(sourceText, (statement) =>
|
|
36117
|
+
const maskAstroPropsExports = (sourceText) => maskSelectedExportKeywords(sourceText, (statement) => (_react_doctor_require_typescript_default.isInterfaceDeclaration(statement) || _react_doctor_require_typescript_default.isTypeAliasDeclaration(statement)) && statement.name.text === "Props");
|
|
36118
|
+
const maskSvelteInstancePropExports = (sourceText) => maskSelectedExportKeywords(sourceText, (statement) => _react_doctor_require_typescript_default.isVariableStatement(statement) && (statement.declarationList.flags & _react_doctor_require_typescript_default.NodeFlags.Let) !== 0);
|
|
36117
36119
|
const extractAstroSources = (sourceText) => {
|
|
36118
36120
|
const maskedSource = createWhitespaceMask(sourceText);
|
|
36119
36121
|
let astroRoot;
|
|
@@ -38057,13 +38059,6 @@ const discoverMobileEntryPoints = (directory) => {
|
|
|
38057
38059
|
}
|
|
38058
38060
|
};
|
|
38059
38061
|
//#endregion
|
|
38060
|
-
//#region ../core/src/utils/unwrap-typescript-expression.ts
|
|
38061
|
-
const unwrapTypescriptExpression = (expression) => {
|
|
38062
|
-
let currentExpression = expression;
|
|
38063
|
-
while (ts.isParenthesizedExpression(currentExpression) || ts.isAsExpression(currentExpression) || ts.isSatisfiesExpression(currentExpression) || ts.isNonNullExpression(currentExpression) || ts.isTypeAssertionExpression(currentExpression)) currentExpression = currentExpression.expression;
|
|
38064
|
-
return currentExpression;
|
|
38065
|
-
};
|
|
38066
|
-
//#endregion
|
|
38067
38062
|
//#region ../core/src/project-analysis/collect/expo-config-plugin-entries.ts
|
|
38068
38063
|
const EXPO_CONFIG_FILE_GLOBS = ["app.config.{ts,mts,cts,js,mjs,cjs}", "app.json"];
|
|
38069
38064
|
const NESTED_EXPO_CONFIG_FILE_GLOBS = [
|
|
@@ -38107,52 +38102,52 @@ const addExpoPluginEntry = (entries, packageNamePlugins, rootDirectory, configDi
|
|
|
38107
38102
|
entries.add(resolvedPath);
|
|
38108
38103
|
};
|
|
38109
38104
|
const getPropertyName$4 = (name) => {
|
|
38110
|
-
if (
|
|
38105
|
+
if (_react_doctor_require_typescript_default.isIdentifier(name) || _react_doctor_require_typescript_default.isStringLiteral(name) || _react_doctor_require_typescript_default.isNumericLiteral(name)) return name.text;
|
|
38111
38106
|
};
|
|
38112
38107
|
const collectExpoPluginPathsFromArray = (array, entries, packageNamePlugins, rootDirectory, configDirectory) => {
|
|
38113
38108
|
for (const element of array.elements) {
|
|
38114
|
-
if (
|
|
38109
|
+
if (_react_doctor_require_typescript_default.isStringLiteral(element) || _react_doctor_require_typescript_default.isNoSubstitutionTemplateLiteral(element)) {
|
|
38115
38110
|
addExpoPluginEntry(entries, packageNamePlugins, rootDirectory, configDirectory, element.text);
|
|
38116
38111
|
continue;
|
|
38117
38112
|
}
|
|
38118
|
-
if (
|
|
38113
|
+
if (_react_doctor_require_typescript_default.isArrayLiteralExpression(element)) {
|
|
38119
38114
|
const [pluginName] = element.elements;
|
|
38120
|
-
if (pluginName && (
|
|
38115
|
+
if (pluginName && (_react_doctor_require_typescript_default.isStringLiteral(pluginName) || _react_doctor_require_typescript_default.isNoSubstitutionTemplateLiteral(pluginName))) addExpoPluginEntry(entries, packageNamePlugins, rootDirectory, configDirectory, pluginName.text);
|
|
38121
38116
|
}
|
|
38122
38117
|
}
|
|
38123
38118
|
};
|
|
38124
38119
|
const collectExpoPluginPathsFromConfigObject = (objectLiteral, entries, packageNamePlugins, rootDirectory, configDirectory) => {
|
|
38125
38120
|
for (const property of objectLiteral.properties) {
|
|
38126
|
-
if (!
|
|
38121
|
+
if (!_react_doctor_require_typescript_default.isPropertyAssignment(property)) continue;
|
|
38127
38122
|
const propertyName = getPropertyName$4(property.name);
|
|
38128
|
-
if (propertyName === "plugins" &&
|
|
38129
|
-
if (propertyName === "expo" &&
|
|
38123
|
+
if (propertyName === "plugins" && _react_doctor_require_typescript_default.isArrayLiteralExpression(property.initializer)) collectExpoPluginPathsFromArray(property.initializer, entries, packageNamePlugins, rootDirectory, configDirectory);
|
|
38124
|
+
if (propertyName === "expo" && _react_doctor_require_typescript_default.isObjectLiteralExpression(property.initializer)) collectExpoPluginPathsFromConfigObject(property.initializer, entries, packageNamePlugins, rootDirectory, configDirectory);
|
|
38130
38125
|
}
|
|
38131
38126
|
};
|
|
38132
38127
|
const collectReturnedExpoConfigPluginPaths = (body, entries, packageNamePlugins, rootDirectory, configDirectory) => {
|
|
38133
|
-
if (!
|
|
38128
|
+
if (!_react_doctor_require_typescript_default.isBlock(body)) {
|
|
38134
38129
|
const expression = unwrapTypescriptExpression(body);
|
|
38135
|
-
if (
|
|
38130
|
+
if (_react_doctor_require_typescript_default.isObjectLiteralExpression(expression)) collectExpoPluginPathsFromConfigObject(expression, entries, packageNamePlugins, rootDirectory, configDirectory);
|
|
38136
38131
|
return;
|
|
38137
38132
|
}
|
|
38138
38133
|
const visit = (node) => {
|
|
38139
|
-
if (
|
|
38140
|
-
if (
|
|
38134
|
+
if (_react_doctor_require_typescript_default.isFunctionDeclaration(node) || _react_doctor_require_typescript_default.isFunctionExpression(node) || _react_doctor_require_typescript_default.isArrowFunction(node)) return;
|
|
38135
|
+
if (_react_doctor_require_typescript_default.isReturnStatement(node) && node.expression) {
|
|
38141
38136
|
const expression = unwrapTypescriptExpression(node.expression);
|
|
38142
|
-
if (
|
|
38137
|
+
if (_react_doctor_require_typescript_default.isObjectLiteralExpression(expression)) collectExpoPluginPathsFromConfigObject(expression, entries, packageNamePlugins, rootDirectory, configDirectory);
|
|
38143
38138
|
return;
|
|
38144
38139
|
}
|
|
38145
|
-
|
|
38140
|
+
_react_doctor_require_typescript_default.forEachChild(node, visit);
|
|
38146
38141
|
};
|
|
38147
38142
|
visit(body);
|
|
38148
38143
|
};
|
|
38149
38144
|
const collectExpoPluginPathsFromConfigExpression = (expression, entries, packageNamePlugins, rootDirectory, configDirectory, bindings, seenIdentifiers = /* @__PURE__ */ new Set()) => {
|
|
38150
38145
|
const configExpression = unwrapTypescriptExpression(expression);
|
|
38151
|
-
if (
|
|
38146
|
+
if (_react_doctor_require_typescript_default.isObjectLiteralExpression(configExpression)) {
|
|
38152
38147
|
collectExpoPluginPathsFromConfigObject(configExpression, entries, packageNamePlugins, rootDirectory, configDirectory);
|
|
38153
38148
|
return;
|
|
38154
38149
|
}
|
|
38155
|
-
if (
|
|
38150
|
+
if (_react_doctor_require_typescript_default.isIdentifier(configExpression)) {
|
|
38156
38151
|
if (seenIdentifiers.has(configExpression.text)) return;
|
|
38157
38152
|
seenIdentifiers.add(configExpression.text);
|
|
38158
38153
|
const boundExpression = bindings.expressions.get(configExpression.text);
|
|
@@ -38164,23 +38159,23 @@ const collectExpoPluginPathsFromConfigExpression = (expression, entries, package
|
|
|
38164
38159
|
if (boundFunction?.body) collectReturnedExpoConfigPluginPaths(boundFunction.body, entries, packageNamePlugins, rootDirectory, configDirectory);
|
|
38165
38160
|
return;
|
|
38166
38161
|
}
|
|
38167
|
-
if (
|
|
38162
|
+
if (_react_doctor_require_typescript_default.isArrowFunction(configExpression)) {
|
|
38168
38163
|
collectReturnedExpoConfigPluginPaths(configExpression.body, entries, packageNamePlugins, rootDirectory, configDirectory);
|
|
38169
38164
|
return;
|
|
38170
38165
|
}
|
|
38171
|
-
if (
|
|
38166
|
+
if (_react_doctor_require_typescript_default.isFunctionExpression(configExpression) && configExpression.body) collectReturnedExpoConfigPluginPaths(configExpression.body, entries, packageNamePlugins, rootDirectory, configDirectory);
|
|
38172
38167
|
};
|
|
38173
|
-
const hasDefaultExportModifier = (node) => Boolean(
|
|
38174
|
-
const isModuleExportsAssignmentTarget = (node) =>
|
|
38168
|
+
const hasDefaultExportModifier = (node) => Boolean(_react_doctor_require_typescript_default.canHaveModifiers(node) && _react_doctor_require_typescript_default.getModifiers(node)?.some((modifier) => modifier.kind === _react_doctor_require_typescript_default.SyntaxKind.DefaultKeyword));
|
|
38169
|
+
const isModuleExportsAssignmentTarget = (node) => _react_doctor_require_typescript_default.isPropertyAccessExpression(node) && _react_doctor_require_typescript_default.isIdentifier(node.expression) && node.expression.text === "module" && node.name.text === "exports";
|
|
38175
38170
|
const collectStaticConfigBindings = (sourceFile) => {
|
|
38176
38171
|
const expressions = /* @__PURE__ */ new Map();
|
|
38177
38172
|
const functions = /* @__PURE__ */ new Map();
|
|
38178
38173
|
for (const statement of sourceFile.statements) {
|
|
38179
|
-
if (
|
|
38180
|
-
for (const declaration of statement.declarationList.declarations) if (
|
|
38174
|
+
if (_react_doctor_require_typescript_default.isVariableStatement(statement)) {
|
|
38175
|
+
for (const declaration of statement.declarationList.declarations) if (_react_doctor_require_typescript_default.isIdentifier(declaration.name) && declaration.initializer) expressions.set(declaration.name.text, declaration.initializer);
|
|
38181
38176
|
continue;
|
|
38182
38177
|
}
|
|
38183
|
-
if (
|
|
38178
|
+
if (_react_doctor_require_typescript_default.isFunctionDeclaration(statement) && statement.name) functions.set(statement.name.text, statement);
|
|
38184
38179
|
}
|
|
38185
38180
|
return {
|
|
38186
38181
|
expressions,
|
|
@@ -38189,23 +38184,23 @@ const collectStaticConfigBindings = (sourceFile) => {
|
|
|
38189
38184
|
};
|
|
38190
38185
|
const collectExpoPluginPathsFromAppConfig = (configPath, entries, packageNamePlugins, rootDirectory) => {
|
|
38191
38186
|
const extension = extname(configPath);
|
|
38192
|
-
const sourceFile =
|
|
38187
|
+
const sourceFile = _react_doctor_require_typescript_default.createSourceFile(configPath, readFileSync(configPath, "utf8"), _react_doctor_require_typescript_default.ScriptTarget.Latest, true, extension === ".ts" || extension === ".mts" || extension === ".cts" ? _react_doctor_require_typescript_default.ScriptKind.TS : _react_doctor_require_typescript_default.ScriptKind.JS);
|
|
38193
38188
|
const configDirectory = dirname(configPath);
|
|
38194
38189
|
const bindings = collectStaticConfigBindings(sourceFile);
|
|
38195
38190
|
const visit = (node) => {
|
|
38196
|
-
if (
|
|
38191
|
+
if (_react_doctor_require_typescript_default.isExportAssignment(node)) {
|
|
38197
38192
|
collectExpoPluginPathsFromConfigExpression(node.expression, entries, packageNamePlugins, rootDirectory, configDirectory, bindings);
|
|
38198
38193
|
return;
|
|
38199
38194
|
}
|
|
38200
|
-
if (
|
|
38195
|
+
if (_react_doctor_require_typescript_default.isFunctionDeclaration(node) && hasDefaultExportModifier(node) && node.body) {
|
|
38201
38196
|
collectReturnedExpoConfigPluginPaths(node.body, entries, packageNamePlugins, rootDirectory, configDirectory);
|
|
38202
38197
|
return;
|
|
38203
38198
|
}
|
|
38204
|
-
if (
|
|
38199
|
+
if (_react_doctor_require_typescript_default.isBinaryExpression(node) && node.operatorToken.kind === _react_doctor_require_typescript_default.SyntaxKind.EqualsToken && isModuleExportsAssignmentTarget(node.left)) {
|
|
38205
38200
|
collectExpoPluginPathsFromConfigExpression(node.right, entries, packageNamePlugins, rootDirectory, configDirectory, bindings);
|
|
38206
38201
|
return;
|
|
38207
38202
|
}
|
|
38208
|
-
|
|
38203
|
+
_react_doctor_require_typescript_default.forEachChild(node, visit);
|
|
38209
38204
|
};
|
|
38210
38205
|
visit(sourceFile);
|
|
38211
38206
|
};
|
|
@@ -38885,23 +38880,23 @@ const resolveGeneratedOutputs = (patterns, configDirectory) => {
|
|
|
38885
38880
|
};
|
|
38886
38881
|
const extractVitePluginConfigContents = (content) => {
|
|
38887
38882
|
const pluginConfigContents = [];
|
|
38888
|
-
const sourceFile =
|
|
38889
|
-
const pluginName = sourceFile.statements.find((statement) =>
|
|
38883
|
+
const sourceFile = _react_doctor_require_typescript_default.createSourceFile("vite.config.ts", content, _react_doctor_require_typescript_default.ScriptTarget.Latest, true, _react_doctor_require_typescript_default.ScriptKind.TS);
|
|
38884
|
+
const pluginName = sourceFile.statements.find((statement) => _react_doctor_require_typescript_default.isImportDeclaration(statement) && _react_doctor_require_typescript_default.isStringLiteral(statement.moduleSpecifier) && statement.moduleSpecifier.text === "vite-plugin-graphql-codegen" && statement.importClause?.name !== void 0)?.importClause?.name?.text;
|
|
38890
38885
|
if (!pluginName) return [];
|
|
38891
|
-
const exportAssignment = sourceFile.statements.find((statement) =>
|
|
38886
|
+
const exportAssignment = sourceFile.statements.find((statement) => _react_doctor_require_typescript_default.isExportAssignment(statement) && !statement.isExportEquals);
|
|
38892
38887
|
if (!exportAssignment) return [];
|
|
38893
38888
|
const topLevelVariableInitializers = /* @__PURE__ */ new Map();
|
|
38894
38889
|
for (const statement of sourceFile.statements) {
|
|
38895
|
-
if (!
|
|
38896
|
-
for (const declaration of statement.declarationList.declarations) if (
|
|
38890
|
+
if (!_react_doctor_require_typescript_default.isVariableStatement(statement)) continue;
|
|
38891
|
+
for (const declaration of statement.declarationList.declarations) if (_react_doctor_require_typescript_default.isIdentifier(declaration.name) && declaration.initializer) topLevelVariableInitializers.set(declaration.name.text, declaration.initializer);
|
|
38897
38892
|
}
|
|
38898
38893
|
const unwrapExpression = (expression) => {
|
|
38899
|
-
if (
|
|
38894
|
+
if (_react_doctor_require_typescript_default.isParenthesizedExpression(expression) || _react_doctor_require_typescript_default.isAsExpression(expression) || _react_doctor_require_typescript_default.isSatisfiesExpression(expression)) return unwrapExpression(expression.expression);
|
|
38900
38895
|
return expression;
|
|
38901
38896
|
};
|
|
38902
38897
|
const collectPluginExpression = (expression, variableInitializers, isPluginNameShadowed, visitedIdentifiers = /* @__PURE__ */ new Set()) => {
|
|
38903
38898
|
const unwrappedExpression = unwrapExpression(expression);
|
|
38904
|
-
if (
|
|
38899
|
+
if (_react_doctor_require_typescript_default.isCallExpression(unwrappedExpression) && _react_doctor_require_typescript_default.isIdentifier(unwrappedExpression.expression) && unwrappedExpression.expression.text === pluginName) {
|
|
38905
38900
|
const configArgument = unwrappedExpression.arguments[0];
|
|
38906
38901
|
if (configArgument && !isPluginNameShadowed) {
|
|
38907
38902
|
const bindingStatements = [...variableInitializers.entries()].map(([variableName, initializer]) => `const ${variableName} = (${initializer.getText(sourceFile)});`).join("\n");
|
|
@@ -38909,54 +38904,54 @@ const extractVitePluginConfigContents = (content) => {
|
|
|
38909
38904
|
}
|
|
38910
38905
|
return;
|
|
38911
38906
|
}
|
|
38912
|
-
if (
|
|
38907
|
+
if (_react_doctor_require_typescript_default.isIdentifier(unwrappedExpression) && !visitedIdentifiers.has(unwrappedExpression.text)) {
|
|
38913
38908
|
const initializer = variableInitializers.get(unwrappedExpression.text);
|
|
38914
38909
|
if (!initializer) return;
|
|
38915
38910
|
collectPluginExpression(initializer, variableInitializers, isPluginNameShadowed, new Set(visitedIdentifiers).add(unwrappedExpression.text));
|
|
38916
38911
|
return;
|
|
38917
38912
|
}
|
|
38918
|
-
if (
|
|
38919
|
-
for (const element of unwrappedExpression.elements) collectPluginExpression(
|
|
38913
|
+
if (_react_doctor_require_typescript_default.isArrayLiteralExpression(unwrappedExpression)) {
|
|
38914
|
+
for (const element of unwrappedExpression.elements) collectPluginExpression(_react_doctor_require_typescript_default.isSpreadElement(element) ? element.expression : element, variableInitializers, isPluginNameShadowed, visitedIdentifiers);
|
|
38920
38915
|
return;
|
|
38921
38916
|
}
|
|
38922
|
-
if (
|
|
38917
|
+
if (_react_doctor_require_typescript_default.isConditionalExpression(unwrappedExpression)) {
|
|
38923
38918
|
collectPluginExpression(unwrappedExpression.whenTrue, variableInitializers, isPluginNameShadowed, visitedIdentifiers);
|
|
38924
38919
|
collectPluginExpression(unwrappedExpression.whenFalse, variableInitializers, isPluginNameShadowed, visitedIdentifiers);
|
|
38925
38920
|
return;
|
|
38926
38921
|
}
|
|
38927
|
-
if (
|
|
38922
|
+
if (_react_doctor_require_typescript_default.isBinaryExpression(unwrappedExpression) && (unwrappedExpression.operatorToken.kind === _react_doctor_require_typescript_default.SyntaxKind.AmpersandAmpersandToken || unwrappedExpression.operatorToken.kind === _react_doctor_require_typescript_default.SyntaxKind.BarBarToken || unwrappedExpression.operatorToken.kind === _react_doctor_require_typescript_default.SyntaxKind.QuestionQuestionToken)) {
|
|
38928
38923
|
collectPluginExpression(unwrappedExpression.left, variableInitializers, isPluginNameShadowed, visitedIdentifiers);
|
|
38929
38924
|
collectPluginExpression(unwrappedExpression.right, variableInitializers, isPluginNameShadowed, visitedIdentifiers);
|
|
38930
38925
|
}
|
|
38931
38926
|
};
|
|
38932
38927
|
const collectConfigPlugins = (expression, variableInitializers, isPluginNameShadowed, visitedIdentifiers = /* @__PURE__ */ new Set()) => {
|
|
38933
38928
|
const unwrappedExpression = unwrapExpression(expression);
|
|
38934
|
-
if (
|
|
38929
|
+
if (_react_doctor_require_typescript_default.isIdentifier(unwrappedExpression) && !visitedIdentifiers.has(unwrappedExpression.text)) {
|
|
38935
38930
|
const initializer = variableInitializers.get(unwrappedExpression.text);
|
|
38936
38931
|
if (!initializer) return;
|
|
38937
38932
|
collectConfigPlugins(initializer, variableInitializers, isPluginNameShadowed, new Set(visitedIdentifiers).add(unwrappedExpression.text));
|
|
38938
38933
|
return;
|
|
38939
38934
|
}
|
|
38940
|
-
if (
|
|
38935
|
+
if (_react_doctor_require_typescript_default.isCallExpression(unwrappedExpression)) {
|
|
38941
38936
|
const calledExpression = unwrapExpression(unwrappedExpression.expression);
|
|
38942
|
-
if (!
|
|
38937
|
+
if (!_react_doctor_require_typescript_default.isIdentifier(calledExpression) || calledExpression.text !== "defineConfig") return;
|
|
38943
38938
|
const configArgument = unwrappedExpression.arguments[0];
|
|
38944
38939
|
if (!configArgument) return;
|
|
38945
38940
|
const unwrappedArgument = unwrapExpression(configArgument);
|
|
38946
|
-
if (
|
|
38947
|
-
let callbackPluginNameShadowed = isPluginNameShadowed || unwrappedArgument.parameters.some((parameter) =>
|
|
38948
|
-
if (!
|
|
38941
|
+
if (_react_doctor_require_typescript_default.isArrowFunction(unwrappedArgument) || _react_doctor_require_typescript_default.isFunctionExpression(unwrappedArgument)) {
|
|
38942
|
+
let callbackPluginNameShadowed = isPluginNameShadowed || unwrappedArgument.parameters.some((parameter) => _react_doctor_require_typescript_default.isIdentifier(parameter.name) && parameter.name.text === pluginName);
|
|
38943
|
+
if (!_react_doctor_require_typescript_default.isBlock(unwrappedArgument.body)) {
|
|
38949
38944
|
collectConfigPlugins(unwrappedArgument.body, variableInitializers, callbackPluginNameShadowed);
|
|
38950
38945
|
return;
|
|
38951
38946
|
}
|
|
38952
38947
|
const callbackVariableInitializers = new Map(variableInitializers);
|
|
38953
38948
|
for (const statement of unwrappedArgument.body.statements) {
|
|
38954
|
-
if (
|
|
38955
|
-
if (!
|
|
38949
|
+
if (_react_doctor_require_typescript_default.isVariableStatement(statement)) for (const declaration of statement.declarationList.declarations) {
|
|
38950
|
+
if (!_react_doctor_require_typescript_default.isIdentifier(declaration.name)) continue;
|
|
38956
38951
|
if (declaration.name.text === pluginName) callbackPluginNameShadowed = true;
|
|
38957
38952
|
if (declaration.initializer) callbackVariableInitializers.set(declaration.name.text, declaration.initializer);
|
|
38958
38953
|
}
|
|
38959
|
-
if (
|
|
38954
|
+
if (_react_doctor_require_typescript_default.isReturnStatement(statement) && statement.expression) {
|
|
38960
38955
|
collectConfigPlugins(statement.expression, callbackVariableInitializers, callbackPluginNameShadowed);
|
|
38961
38956
|
return;
|
|
38962
38957
|
}
|
|
@@ -38966,10 +38961,10 @@ const extractVitePluginConfigContents = (content) => {
|
|
|
38966
38961
|
collectConfigPlugins(unwrappedArgument, variableInitializers, isPluginNameShadowed);
|
|
38967
38962
|
return;
|
|
38968
38963
|
}
|
|
38969
|
-
if (!
|
|
38964
|
+
if (!_react_doctor_require_typescript_default.isObjectLiteralExpression(unwrappedExpression)) return;
|
|
38970
38965
|
for (const property of unwrappedExpression.properties) {
|
|
38971
|
-
if (
|
|
38972
|
-
if (
|
|
38966
|
+
if (_react_doctor_require_typescript_default.isPropertyAssignment(property) && (_react_doctor_require_typescript_default.isIdentifier(property.name) && property.name.text === "plugins" || _react_doctor_require_typescript_default.isStringLiteral(property.name) && property.name.text === "plugins")) collectPluginExpression(property.initializer, variableInitializers, isPluginNameShadowed);
|
|
38967
|
+
if (_react_doctor_require_typescript_default.isShorthandPropertyAssignment(property) && property.name.text === "plugins") collectPluginExpression(property.name, variableInitializers, isPluginNameShadowed);
|
|
38973
38968
|
}
|
|
38974
38969
|
};
|
|
38975
38970
|
collectConfigPlugins(exportAssignment.expression, topLevelVariableInitializers, false);
|
|
@@ -39093,24 +39088,24 @@ const TARO_ARRAY_SELECTION_METHODS = new Set([
|
|
|
39093
39088
|
"splice"
|
|
39094
39089
|
]);
|
|
39095
39090
|
const getPropertyName$2 = (propertyName) => {
|
|
39096
|
-
if (
|
|
39091
|
+
if (_react_doctor_require_typescript_default.isIdentifier(propertyName) || _react_doctor_require_typescript_default.isStringLiteral(propertyName) || _react_doctor_require_typescript_default.isNoSubstitutionTemplateLiteral(propertyName)) return propertyName.text;
|
|
39097
39092
|
};
|
|
39098
39093
|
const unwrapConfigExpression = (expression) => {
|
|
39099
|
-
if (
|
|
39100
|
-
if (
|
|
39094
|
+
if (_react_doctor_require_typescript_default.isParenthesizedExpression(expression) || _react_doctor_require_typescript_default.isAsExpression(expression) || _react_doctor_require_typescript_default.isSatisfiesExpression(expression)) return unwrapConfigExpression(expression.expression);
|
|
39095
|
+
if (_react_doctor_require_typescript_default.isCallExpression(expression)) {
|
|
39101
39096
|
const [configArgument] = expression.arguments;
|
|
39102
39097
|
return configArgument ? unwrapConfigExpression(configArgument) : expression;
|
|
39103
39098
|
}
|
|
39104
39099
|
return expression;
|
|
39105
39100
|
};
|
|
39106
39101
|
const unwrapArrayExpression = (expression) => {
|
|
39107
|
-
if (
|
|
39102
|
+
if (_react_doctor_require_typescript_default.isParenthesizedExpression(expression) || _react_doctor_require_typescript_default.isAsExpression(expression) || _react_doctor_require_typescript_default.isSatisfiesExpression(expression)) return unwrapArrayExpression(expression.expression);
|
|
39108
39103
|
return expression;
|
|
39109
39104
|
};
|
|
39110
39105
|
const getPropertyInitializer = (objectLiteral, propertyNames) => {
|
|
39111
39106
|
for (const property of objectLiteral.properties) {
|
|
39112
|
-
if (
|
|
39113
|
-
if (!
|
|
39107
|
+
if (_react_doctor_require_typescript_default.isShorthandPropertyAssignment(property) && propertyNames.has(property.name.text)) return property.name;
|
|
39108
|
+
if (!_react_doctor_require_typescript_default.isPropertyAssignment(property)) continue;
|
|
39114
39109
|
const propertyName = getPropertyName$2(property.name);
|
|
39115
39110
|
if (propertyName && propertyNames.has(propertyName)) return property.initializer;
|
|
39116
39111
|
}
|
|
@@ -39118,16 +39113,16 @@ const getPropertyInitializer = (objectLiteral, propertyNames) => {
|
|
|
39118
39113
|
const collectArrayElements = (expression, variableInitializers, pushedElements, visitedIdentifiers = /* @__PURE__ */ new Set()) => {
|
|
39119
39114
|
if (!expression) return [];
|
|
39120
39115
|
const unwrappedExpression = unwrapArrayExpression(expression);
|
|
39121
|
-
if (
|
|
39122
|
-
if (
|
|
39123
|
-
if (
|
|
39124
|
-
if (
|
|
39116
|
+
if (_react_doctor_require_typescript_default.isArrayLiteralExpression(unwrappedExpression)) return [...unwrappedExpression.elements];
|
|
39117
|
+
if (_react_doctor_require_typescript_default.isConditionalExpression(unwrappedExpression)) return [...collectArrayElements(unwrappedExpression.whenTrue, variableInitializers, pushedElements, visitedIdentifiers), ...collectArrayElements(unwrappedExpression.whenFalse, variableInitializers, pushedElements, visitedIdentifiers)];
|
|
39118
|
+
if (_react_doctor_require_typescript_default.isCallExpression(unwrappedExpression) && _react_doctor_require_typescript_default.isPropertyAccessExpression(unwrappedExpression.expression) && TARO_ARRAY_SELECTION_METHODS.has(unwrappedExpression.expression.name.text)) return collectArrayElements(unwrappedExpression.expression.expression, variableInitializers, pushedElements, visitedIdentifiers);
|
|
39119
|
+
if (_react_doctor_require_typescript_default.isIdentifier(unwrappedExpression) && !visitedIdentifiers.has(unwrappedExpression.text)) {
|
|
39125
39120
|
const nextVisitedIdentifiers = new Set(visitedIdentifiers).add(unwrappedExpression.text);
|
|
39126
39121
|
return [...collectArrayElements(variableInitializers.get(unwrappedExpression.text), variableInitializers, pushedElements, nextVisitedIdentifiers), ...pushedElements.get(unwrappedExpression.text) ?? []];
|
|
39127
39122
|
}
|
|
39128
39123
|
return [];
|
|
39129
39124
|
};
|
|
39130
|
-
const collectPagePaths = (expression, variableInitializers, pushedElements) => collectArrayElements(expression, variableInitializers, pushedElements).flatMap((element) =>
|
|
39125
|
+
const collectPagePaths = (expression, variableInitializers, pushedElements) => collectArrayElements(expression, variableInitializers, pushedElements).flatMap((element) => _react_doctor_require_typescript_default.isStringLiteral(element) || _react_doctor_require_typescript_default.isNoSubstitutionTemplateLiteral(element) ? [element.text] : []);
|
|
39131
39126
|
const resolvePageEntries = (configDirectory, pagePaths) => pagePaths.flatMap((pagePath) => {
|
|
39132
39127
|
const resolvedEntry = resolveEntryWithExtensions(resolve(configDirectory, pagePath));
|
|
39133
39128
|
return resolvedEntry ? [resolvedEntry] : [];
|
|
@@ -39136,9 +39131,9 @@ const collectConfigPageEntries = (configDirectory, configObject, variableInitial
|
|
|
39136
39131
|
const entries = resolvePageEntries(configDirectory, collectPagePaths(getPropertyInitializer(configObject, new Set(["pages"])), variableInitializers, pushedElements));
|
|
39137
39132
|
const subPackagesExpression = getPropertyInitializer(configObject, new Set(["subPackages", "subpackages"]));
|
|
39138
39133
|
for (const subPackageElement of collectArrayElements(subPackagesExpression, variableInitializers, pushedElements)) {
|
|
39139
|
-
if (!
|
|
39134
|
+
if (!_react_doctor_require_typescript_default.isObjectLiteralExpression(subPackageElement)) continue;
|
|
39140
39135
|
const rootExpression = getPropertyInitializer(subPackageElement, new Set(["root"]));
|
|
39141
|
-
if (!rootExpression || !
|
|
39136
|
+
if (!rootExpression || !_react_doctor_require_typescript_default.isStringLiteral(rootExpression) && !_react_doctor_require_typescript_default.isNoSubstitutionTemplateLiteral(rootExpression)) continue;
|
|
39142
39137
|
const subPackagePages = collectPagePaths(getPropertyInitializer(subPackageElement, new Set(["pages"])), variableInitializers, pushedElements).map((pagePath) => `${rootExpression.text}/${pagePath}`);
|
|
39143
39138
|
entries.push(...resolvePageEntries(configDirectory, subPackagePages));
|
|
39144
39139
|
}
|
|
@@ -39147,56 +39142,56 @@ const collectConfigPageEntries = (configDirectory, configObject, variableInitial
|
|
|
39147
39142
|
const collectVariableInitializers = (sourceFile) => {
|
|
39148
39143
|
const variableInitializers = /* @__PURE__ */ new Map();
|
|
39149
39144
|
for (const statement of sourceFile.statements) {
|
|
39150
|
-
if (!
|
|
39151
|
-
for (const declaration of statement.declarationList.declarations) if (
|
|
39145
|
+
if (!_react_doctor_require_typescript_default.isVariableStatement(statement)) continue;
|
|
39146
|
+
for (const declaration of statement.declarationList.declarations) if (_react_doctor_require_typescript_default.isIdentifier(declaration.name) && declaration.initializer) variableInitializers.set(declaration.name.text, declaration.initializer);
|
|
39152
39147
|
}
|
|
39153
39148
|
return variableInitializers;
|
|
39154
39149
|
};
|
|
39155
39150
|
const collectShadowedBindingNames = (bindingName, topLevelVariableNames) => {
|
|
39156
|
-
if (
|
|
39157
|
-
return bindingName.elements.flatMap((bindingElement) =>
|
|
39151
|
+
if (_react_doctor_require_typescript_default.isIdentifier(bindingName)) return topLevelVariableNames.has(bindingName.text) ? [bindingName.text] : [];
|
|
39152
|
+
return bindingName.elements.flatMap((bindingElement) => _react_doctor_require_typescript_default.isBindingElement(bindingElement) ? collectShadowedBindingNames(bindingElement.name, topLevelVariableNames) : []);
|
|
39158
39153
|
};
|
|
39159
39154
|
const collectPushedElements = (sourceFile, topLevelVariableNames) => {
|
|
39160
39155
|
const pushedElements = /* @__PURE__ */ new Map();
|
|
39161
39156
|
const visitNode = (node, shadowedNames) => {
|
|
39162
|
-
if (
|
|
39157
|
+
if (_react_doctor_require_typescript_default.isFunctionDeclaration(node) || _react_doctor_require_typescript_default.isFunctionExpression(node) || _react_doctor_require_typescript_default.isArrowFunction(node) || _react_doctor_require_typescript_default.isMethodDeclaration(node) || _react_doctor_require_typescript_default.isGetAccessorDeclaration(node) || _react_doctor_require_typescript_default.isSetAccessorDeclaration(node) || _react_doctor_require_typescript_default.isConstructorDeclaration(node)) return;
|
|
39163
39158
|
let nextShadowedNames = shadowedNames;
|
|
39164
39159
|
const shadowBindingNames = (bindingNames) => {
|
|
39165
39160
|
const newlyShadowedNames = bindingNames.flatMap((bindingName) => collectShadowedBindingNames(bindingName, topLevelVariableNames));
|
|
39166
39161
|
if (newlyShadowedNames.length > 0) nextShadowedNames = new Set([...nextShadowedNames, ...newlyShadowedNames]);
|
|
39167
39162
|
};
|
|
39168
|
-
if (
|
|
39169
|
-
if (!
|
|
39163
|
+
if (_react_doctor_require_typescript_default.isBlock(node)) shadowBindingNames(node.statements.flatMap((statement) => {
|
|
39164
|
+
if (!_react_doctor_require_typescript_default.isVariableStatement(statement) || !(statement.declarationList.flags & _react_doctor_require_typescript_default.NodeFlags.BlockScoped)) return [];
|
|
39170
39165
|
return statement.declarationList.declarations.map((declaration) => declaration.name);
|
|
39171
39166
|
}));
|
|
39172
|
-
if (
|
|
39173
|
-
if (
|
|
39167
|
+
if (_react_doctor_require_typescript_default.isCatchClause(node) && node.variableDeclaration) shadowBindingNames([node.variableDeclaration.name]);
|
|
39168
|
+
if (_react_doctor_require_typescript_default.isForStatement(node) || _react_doctor_require_typescript_default.isForInStatement(node) || _react_doctor_require_typescript_default.isForOfStatement(node)) {
|
|
39174
39169
|
const initializer = node.initializer;
|
|
39175
|
-
if (initializer &&
|
|
39170
|
+
if (initializer && _react_doctor_require_typescript_default.isVariableDeclarationList(initializer) && initializer.flags & _react_doctor_require_typescript_default.NodeFlags.BlockScoped) shadowBindingNames(initializer.declarations.map((declaration) => declaration.name));
|
|
39176
39171
|
}
|
|
39177
|
-
if (
|
|
39172
|
+
if (_react_doctor_require_typescript_default.isCallExpression(node) && _react_doctor_require_typescript_default.isPropertyAccessExpression(node.expression) && node.expression.name.text === "push" && _react_doctor_require_typescript_default.isIdentifier(node.expression.expression) && topLevelVariableNames.has(node.expression.expression.text) && !nextShadowedNames.has(node.expression.expression.text)) {
|
|
39178
39173
|
const identifier = node.expression.expression.text;
|
|
39179
39174
|
const existingElements = pushedElements.get(identifier) ?? [];
|
|
39180
39175
|
existingElements.push(...node.arguments);
|
|
39181
39176
|
pushedElements.set(identifier, existingElements);
|
|
39182
39177
|
}
|
|
39183
|
-
|
|
39178
|
+
_react_doctor_require_typescript_default.forEachChild(node, (childNode) => visitNode(childNode, nextShadowedNames));
|
|
39184
39179
|
};
|
|
39185
39180
|
visitNode(sourceFile, /* @__PURE__ */ new Set());
|
|
39186
39181
|
return pushedElements;
|
|
39187
39182
|
};
|
|
39188
39183
|
const extractConfigObject = (sourceFile, variableInitializers) => {
|
|
39189
39184
|
for (const statement of sourceFile.statements) {
|
|
39190
|
-
if (!
|
|
39185
|
+
if (!_react_doctor_require_typescript_default.isExportAssignment(statement) || statement.isExportEquals) continue;
|
|
39191
39186
|
let expression = unwrapConfigExpression(statement.expression);
|
|
39192
39187
|
const visitedIdentifiers = /* @__PURE__ */ new Set();
|
|
39193
|
-
while (
|
|
39188
|
+
while (_react_doctor_require_typescript_default.isIdentifier(expression) && !visitedIdentifiers.has(expression.text)) {
|
|
39194
39189
|
visitedIdentifiers.add(expression.text);
|
|
39195
39190
|
const initializer = variableInitializers.get(expression.text);
|
|
39196
39191
|
if (!initializer) break;
|
|
39197
39192
|
expression = unwrapConfigExpression(initializer);
|
|
39198
39193
|
}
|
|
39199
|
-
if (
|
|
39194
|
+
if (_react_doctor_require_typescript_default.isObjectLiteralExpression(expression)) return expression;
|
|
39200
39195
|
}
|
|
39201
39196
|
};
|
|
39202
39197
|
const extractTaroPageEntries = (directory, dependencies) => {
|
|
@@ -39209,7 +39204,7 @@ const extractTaroPageEntries = (directory, dependencies) => {
|
|
|
39209
39204
|
});
|
|
39210
39205
|
for (const configPath of configPaths) try {
|
|
39211
39206
|
const sourceText = readFileSync(configPath, "utf8");
|
|
39212
|
-
const sourceFile =
|
|
39207
|
+
const sourceFile = _react_doctor_require_typescript_default.createSourceFile(configPath, sourceText, _react_doctor_require_typescript_default.ScriptTarget.Latest, true);
|
|
39213
39208
|
const variableInitializers = collectVariableInitializers(sourceFile);
|
|
39214
39209
|
const pushedElements = collectPushedElements(sourceFile, new Set(variableInitializers.keys()));
|
|
39215
39210
|
const configObject = extractConfigObject(sourceFile, variableInitializers);
|
|
@@ -39680,20 +39675,20 @@ const extractJestModuleNameMapperAliases = (content, configDirectory) => {
|
|
|
39680
39675
|
const extractWebpackModuleDirectories = (content, configDirectory) => {
|
|
39681
39676
|
const moduleDirectories = [];
|
|
39682
39677
|
const moduleDirectoryNames = [];
|
|
39683
|
-
const sourceFile =
|
|
39678
|
+
const sourceFile = _react_doctor_require_typescript_default.createSourceFile("webpack.config.ts", content, _react_doctor_require_typescript_default.ScriptTarget.Latest, true, _react_doctor_require_typescript_default.ScriptKind.TS);
|
|
39684
39679
|
const variableInitializers = /* @__PURE__ */ new Map();
|
|
39685
39680
|
for (const statement of sourceFile.statements) {
|
|
39686
|
-
if (!
|
|
39687
|
-
for (const declaration of statement.declarationList.declarations) if (
|
|
39681
|
+
if (!_react_doctor_require_typescript_default.isVariableStatement(statement)) continue;
|
|
39682
|
+
for (const declaration of statement.declarationList.declarations) if (_react_doctor_require_typescript_default.isIdentifier(declaration.name) && declaration.initializer) variableInitializers.set(declaration.name.text, declaration.initializer);
|
|
39688
39683
|
}
|
|
39689
39684
|
const unwrapExpression = (expression) => {
|
|
39690
|
-
if (
|
|
39685
|
+
if (_react_doctor_require_typescript_default.isParenthesizedExpression(expression) || _react_doctor_require_typescript_default.isAsExpression(expression) || _react_doctor_require_typescript_default.isSatisfiesExpression(expression)) return unwrapExpression(expression.expression);
|
|
39691
39686
|
return expression;
|
|
39692
39687
|
};
|
|
39693
39688
|
const resolveObjectExpression = (expression, visitedIdentifiers = /* @__PURE__ */ new Set()) => {
|
|
39694
39689
|
const unwrappedExpression = unwrapExpression(expression);
|
|
39695
|
-
if (
|
|
39696
|
-
if (
|
|
39690
|
+
if (_react_doctor_require_typescript_default.isObjectLiteralExpression(unwrappedExpression)) return unwrappedExpression;
|
|
39691
|
+
if (_react_doctor_require_typescript_default.isIdentifier(unwrappedExpression) && !visitedIdentifiers.has(unwrappedExpression.text)) {
|
|
39697
39692
|
const initializer = variableInitializers.get(unwrappedExpression.text);
|
|
39698
39693
|
if (!initializer) return void 0;
|
|
39699
39694
|
return resolveObjectExpression(initializer, new Set(visitedIdentifiers).add(unwrappedExpression.text));
|
|
@@ -39701,82 +39696,82 @@ const extractWebpackModuleDirectories = (content, configDirectory) => {
|
|
|
39701
39696
|
};
|
|
39702
39697
|
const collectModules = (resolveObject) => {
|
|
39703
39698
|
for (const property of resolveObject.properties) {
|
|
39704
|
-
if (!
|
|
39705
|
-
const propertyName =
|
|
39699
|
+
if (!_react_doctor_require_typescript_default.isPropertyAssignment(property)) continue;
|
|
39700
|
+
const propertyName = _react_doctor_require_typescript_default.isIdentifier(property.name) || _react_doctor_require_typescript_default.isStringLiteral(property.name) ? property.name.text : void 0;
|
|
39706
39701
|
if (propertyName !== "modules" && propertyName !== "modulesDirectories") continue;
|
|
39707
|
-
if (!
|
|
39702
|
+
if (!_react_doctor_require_typescript_default.isArrayLiteralExpression(property.initializer)) continue;
|
|
39708
39703
|
for (const element of property.initializer.elements) {
|
|
39709
|
-
if (
|
|
39704
|
+
if (_react_doctor_require_typescript_default.isStringLiteral(element) || _react_doctor_require_typescript_default.isNoSubstitutionTemplateLiteral(element)) {
|
|
39710
39705
|
if (element.text === "node_modules") continue;
|
|
39711
39706
|
if (element.text.startsWith(".") || element.text.includes("/")) moduleDirectories.push(resolveConfigPathValue(element.text, configDirectory));
|
|
39712
39707
|
else moduleDirectoryNames.push(element.text);
|
|
39713
39708
|
continue;
|
|
39714
39709
|
}
|
|
39715
|
-
if (!
|
|
39710
|
+
if (!_react_doctor_require_typescript_default.isCallExpression(element)) continue;
|
|
39716
39711
|
const calledExpression = element.expression;
|
|
39717
|
-
if (!
|
|
39718
|
-
const pathSegments = element.arguments.slice(1).flatMap((argument) =>
|
|
39712
|
+
if (!_react_doctor_require_typescript_default.isPropertyAccessExpression(calledExpression) || !_react_doctor_require_typescript_default.isIdentifier(calledExpression.expression) || calledExpression.expression.text !== "path" || calledExpression.name.text !== "resolve" && calledExpression.name.text !== "join") continue;
|
|
39713
|
+
const pathSegments = element.arguments.slice(1).flatMap((argument) => _react_doctor_require_typescript_default.isStringLiteral(argument) || _react_doctor_require_typescript_default.isNoSubstitutionTemplateLiteral(argument) ? [argument.text] : []);
|
|
39719
39714
|
if (pathSegments.length > 0) moduleDirectories.push(resolve(configDirectory, ...pathSegments));
|
|
39720
39715
|
}
|
|
39721
39716
|
}
|
|
39722
39717
|
};
|
|
39723
39718
|
const collectConfigExpression = (expression, visitedIdentifiers = /* @__PURE__ */ new Set()) => {
|
|
39724
39719
|
const unwrappedExpression = unwrapExpression(expression);
|
|
39725
|
-
if (
|
|
39720
|
+
if (_react_doctor_require_typescript_default.isBinaryExpression(unwrappedExpression) && unwrappedExpression.operatorToken.kind === _react_doctor_require_typescript_default.SyntaxKind.EqualsToken) {
|
|
39726
39721
|
collectConfigExpression(unwrappedExpression.right, visitedIdentifiers);
|
|
39727
39722
|
return;
|
|
39728
39723
|
}
|
|
39729
|
-
if (
|
|
39724
|
+
if (_react_doctor_require_typescript_default.isIdentifier(unwrappedExpression)) {
|
|
39730
39725
|
if (visitedIdentifiers.has(unwrappedExpression.text)) return;
|
|
39731
39726
|
const initializer = variableInitializers.get(unwrappedExpression.text);
|
|
39732
39727
|
if (!initializer) return;
|
|
39733
39728
|
collectConfigExpression(initializer, new Set(visitedIdentifiers).add(unwrappedExpression.text));
|
|
39734
39729
|
return;
|
|
39735
39730
|
}
|
|
39736
|
-
if (
|
|
39737
|
-
for (const element of unwrappedExpression.elements) if (
|
|
39731
|
+
if (_react_doctor_require_typescript_default.isArrayLiteralExpression(unwrappedExpression)) {
|
|
39732
|
+
for (const element of unwrappedExpression.elements) if (_react_doctor_require_typescript_default.isSpreadElement(element)) collectConfigExpression(element.expression, visitedIdentifiers);
|
|
39738
39733
|
else collectConfigExpression(element, visitedIdentifiers);
|
|
39739
39734
|
return;
|
|
39740
39735
|
}
|
|
39741
|
-
if (
|
|
39736
|
+
if (_react_doctor_require_typescript_default.isConditionalExpression(unwrappedExpression)) {
|
|
39742
39737
|
collectConfigExpression(unwrappedExpression.whenTrue, visitedIdentifiers);
|
|
39743
39738
|
collectConfigExpression(unwrappedExpression.whenFalse, visitedIdentifiers);
|
|
39744
39739
|
return;
|
|
39745
39740
|
}
|
|
39746
|
-
if (
|
|
39747
|
-
if (!
|
|
39741
|
+
if (_react_doctor_require_typescript_default.isArrowFunction(unwrappedExpression) || _react_doctor_require_typescript_default.isFunctionExpression(unwrappedExpression)) {
|
|
39742
|
+
if (!_react_doctor_require_typescript_default.isBlock(unwrappedExpression.body)) {
|
|
39748
39743
|
collectConfigExpression(unwrappedExpression.body, visitedIdentifiers);
|
|
39749
39744
|
return;
|
|
39750
39745
|
}
|
|
39751
|
-
for (const statement of unwrappedExpression.body.statements) if (
|
|
39746
|
+
for (const statement of unwrappedExpression.body.statements) if (_react_doctor_require_typescript_default.isReturnStatement(statement) && statement.expression) collectConfigExpression(statement.expression, visitedIdentifiers);
|
|
39752
39747
|
return;
|
|
39753
39748
|
}
|
|
39754
|
-
if (!
|
|
39749
|
+
if (!_react_doctor_require_typescript_default.isObjectLiteralExpression(unwrappedExpression)) return;
|
|
39755
39750
|
for (const property of unwrappedExpression.properties) {
|
|
39756
|
-
if (
|
|
39751
|
+
if (_react_doctor_require_typescript_default.isSpreadAssignment(property)) {
|
|
39757
39752
|
collectConfigExpression(property.expression, visitedIdentifiers);
|
|
39758
39753
|
continue;
|
|
39759
39754
|
}
|
|
39760
|
-
if (
|
|
39755
|
+
if (_react_doctor_require_typescript_default.isShorthandPropertyAssignment(property) && property.name.text === "resolve") {
|
|
39761
39756
|
const resolveObject = resolveObjectExpression(property.name);
|
|
39762
39757
|
if (resolveObject) collectModules(resolveObject);
|
|
39763
39758
|
continue;
|
|
39764
39759
|
}
|
|
39765
|
-
if (!
|
|
39766
|
-
if ((
|
|
39760
|
+
if (!_react_doctor_require_typescript_default.isPropertyAssignment(property)) continue;
|
|
39761
|
+
if ((_react_doctor_require_typescript_default.isIdentifier(property.name) || _react_doctor_require_typescript_default.isStringLiteral(property.name) ? property.name.text : void 0) !== "resolve") continue;
|
|
39767
39762
|
const resolveObject = resolveObjectExpression(property.initializer);
|
|
39768
39763
|
if (resolveObject) collectModules(resolveObject);
|
|
39769
39764
|
}
|
|
39770
39765
|
};
|
|
39771
|
-
const isModuleExports = (expression) =>
|
|
39766
|
+
const isModuleExports = (expression) => _react_doctor_require_typescript_default.isPropertyAccessExpression(expression) && _react_doctor_require_typescript_default.isIdentifier(expression.expression) && expression.expression.text === "module" && expression.name.text === "exports";
|
|
39772
39767
|
const collectModuleExportsAssignment = (expression) => {
|
|
39773
|
-
if (
|
|
39768
|
+
if (_react_doctor_require_typescript_default.isBinaryExpression(expression) && expression.operatorToken.kind === _react_doctor_require_typescript_default.SyntaxKind.EqualsToken) if (isModuleExports(expression.left)) collectConfigExpression(expression.right);
|
|
39774
39769
|
else collectModuleExportsAssignment(expression.right);
|
|
39775
39770
|
};
|
|
39776
39771
|
for (const statement of sourceFile.statements) {
|
|
39777
|
-
if (
|
|
39778
|
-
if (
|
|
39779
|
-
if (
|
|
39772
|
+
if (_react_doctor_require_typescript_default.isExportAssignment(statement) && !statement.isExportEquals) collectConfigExpression(statement.expression);
|
|
39773
|
+
if (_react_doctor_require_typescript_default.isExpressionStatement(statement)) collectModuleExportsAssignment(statement.expression);
|
|
39774
|
+
if (_react_doctor_require_typescript_default.isVariableStatement(statement)) {
|
|
39780
39775
|
for (const declaration of statement.declarationList.declarations) if (declaration.initializer) collectModuleExportsAssignment(declaration.initializer);
|
|
39781
39776
|
}
|
|
39782
39777
|
}
|
|
@@ -40540,20 +40535,20 @@ const extractImportSpecifiers = (sourceText) => {
|
|
|
40540
40535
|
};
|
|
40541
40536
|
const extractStylelintPluginSpecifiers = (sourceText) => {
|
|
40542
40537
|
const specifiers = [];
|
|
40543
|
-
const sourceFile =
|
|
40538
|
+
const sourceFile = _react_doctor_require_typescript_default.createSourceFile("stylelint.config.mjs", sourceText, _react_doctor_require_typescript_default.ScriptTarget.Latest, true, _react_doctor_require_typescript_default.ScriptKind.TS);
|
|
40544
40539
|
const collectStringLiterals = (node) => {
|
|
40545
|
-
if (
|
|
40540
|
+
if (_react_doctor_require_typescript_default.isStringLiteralLike(node)) {
|
|
40546
40541
|
specifiers.push(node.text);
|
|
40547
40542
|
return;
|
|
40548
40543
|
}
|
|
40549
|
-
|
|
40544
|
+
_react_doctor_require_typescript_default.forEachChild(node, collectStringLiterals);
|
|
40550
40545
|
};
|
|
40551
40546
|
const visitNode = (node) => {
|
|
40552
|
-
if (
|
|
40547
|
+
if (_react_doctor_require_typescript_default.isPropertyAssignment(node) && (_react_doctor_require_typescript_default.isIdentifier(node.name) || _react_doctor_require_typescript_default.isStringLiteralLike(node.name)) && node.name.text === "plugins") {
|
|
40553
40548
|
collectStringLiterals(node.initializer);
|
|
40554
40549
|
return;
|
|
40555
40550
|
}
|
|
40556
|
-
|
|
40551
|
+
_react_doctor_require_typescript_default.forEachChild(node, visitNode);
|
|
40557
40552
|
};
|
|
40558
40553
|
visitNode(sourceFile);
|
|
40559
40554
|
return specifiers;
|
|
@@ -41012,17 +41007,17 @@ const isPathInsideDirectoryOrEqual = (candidatePath, directoryPath) => {
|
|
|
41012
41007
|
//#region ../core/src/project-analysis/collect/static-globby-entries.ts
|
|
41013
41008
|
const getCalledName = (expression) => {
|
|
41014
41009
|
const unwrappedExpression = unwrapTypescriptExpression(expression);
|
|
41015
|
-
if (
|
|
41016
|
-
if (
|
|
41010
|
+
if (_react_doctor_require_typescript_default.isIdentifier(unwrappedExpression)) return unwrappedExpression.text;
|
|
41011
|
+
if (_react_doctor_require_typescript_default.isPropertyAccessExpression(unwrappedExpression)) return unwrappedExpression.name.text;
|
|
41017
41012
|
};
|
|
41018
41013
|
const isImportMetaUrl = (expression) => {
|
|
41019
41014
|
const unwrappedExpression = unwrapTypescriptExpression(expression);
|
|
41020
|
-
return
|
|
41015
|
+
return _react_doctor_require_typescript_default.isPropertyAccessExpression(unwrappedExpression) && unwrappedExpression.name.text === "url" && _react_doctor_require_typescript_default.isMetaProperty(unwrappedExpression.expression) && unwrappedExpression.expression.keywordToken === _react_doctor_require_typescript_default.SyntaxKind.ImportKeyword;
|
|
41021
41016
|
};
|
|
41022
41017
|
const evaluateDirectoryExpression = (expression, context, seenIdentifiers = /* @__PURE__ */ new Set()) => {
|
|
41023
41018
|
const unwrappedExpression = unwrapTypescriptExpression(expression);
|
|
41024
|
-
if (
|
|
41025
|
-
if (
|
|
41019
|
+
if (_react_doctor_require_typescript_default.isStringLiteralLike(unwrappedExpression)) return resolve(dirname(context.entryFilePath), unwrappedExpression.text);
|
|
41020
|
+
if (_react_doctor_require_typescript_default.isIdentifier(unwrappedExpression)) {
|
|
41026
41021
|
if (unwrappedExpression.text === "__dirname") return dirname(context.entryFilePath);
|
|
41027
41022
|
if (seenIdentifiers.has(unwrappedExpression.text)) return void 0;
|
|
41028
41023
|
const initializer = context.variableDeclarations.get(unwrappedExpression.text);
|
|
@@ -41031,10 +41026,10 @@ const evaluateDirectoryExpression = (expression, context, seenIdentifiers = /* @
|
|
|
41031
41026
|
nextSeenIdentifiers.add(unwrappedExpression.text);
|
|
41032
41027
|
return evaluateDirectoryExpression(initializer, context, nextSeenIdentifiers);
|
|
41033
41028
|
}
|
|
41034
|
-
if (
|
|
41035
|
-
if (!
|
|
41029
|
+
if (_react_doctor_require_typescript_default.isPropertyAccessExpression(unwrappedExpression) && unwrappedExpression.name.text === "dirname" && _react_doctor_require_typescript_default.isMetaProperty(unwrappedExpression.expression) && unwrappedExpression.expression.keywordToken === _react_doctor_require_typescript_default.SyntaxKind.ImportKeyword) return dirname(context.entryFilePath);
|
|
41030
|
+
if (!_react_doctor_require_typescript_default.isCallExpression(unwrappedExpression)) return void 0;
|
|
41036
41031
|
const calledName = getCalledName(unwrappedExpression.expression);
|
|
41037
|
-
if (calledName === "cwd" &&
|
|
41032
|
+
if (calledName === "cwd" && _react_doctor_require_typescript_default.isPropertyAccessExpression(unwrappedExpression.expression) && _react_doctor_require_typescript_default.isIdentifier(unwrappedExpression.expression.expression) && unwrappedExpression.expression.expression.text === "process") return context.projectRoot;
|
|
41038
41033
|
if (calledName === "fileURLToPath" && unwrappedExpression.arguments[0] && isImportMetaUrl(unwrappedExpression.arguments[0])) return context.entryFilePath;
|
|
41039
41034
|
if (calledName === "dirname" && unwrappedExpression.arguments[0]) {
|
|
41040
41035
|
const evaluatedPath = evaluateDirectoryExpression(unwrappedExpression.arguments[0], context, seenIdentifiers);
|
|
@@ -41048,19 +41043,19 @@ const evaluateDirectoryExpression = (expression, context, seenIdentifiers = /* @
|
|
|
41048
41043
|
const pathSegments = [];
|
|
41049
41044
|
for (const segmentExpression of segmentExpressions) {
|
|
41050
41045
|
const unwrappedSegment = unwrapTypescriptExpression(segmentExpression);
|
|
41051
|
-
if (!
|
|
41046
|
+
if (!_react_doctor_require_typescript_default.isStringLiteralLike(unwrappedSegment)) return void 0;
|
|
41052
41047
|
pathSegments.push(unwrappedSegment.text);
|
|
41053
41048
|
}
|
|
41054
41049
|
return calledName === "join" ? join(baseDirectory, ...pathSegments) : resolve(baseDirectory, ...pathSegments);
|
|
41055
41050
|
};
|
|
41056
41051
|
const collectStaticPatterns = (expression) => {
|
|
41057
41052
|
const unwrappedExpression = unwrapTypescriptExpression(expression);
|
|
41058
|
-
if (
|
|
41059
|
-
if (!
|
|
41053
|
+
if (_react_doctor_require_typescript_default.isStringLiteralLike(unwrappedExpression)) return [unwrappedExpression.text];
|
|
41054
|
+
if (!_react_doctor_require_typescript_default.isArrayLiteralExpression(unwrappedExpression)) return [];
|
|
41060
41055
|
const patterns = [];
|
|
41061
41056
|
for (const element of unwrappedExpression.elements) {
|
|
41062
41057
|
const unwrappedElement = unwrapTypescriptExpression(element);
|
|
41063
|
-
if (!
|
|
41058
|
+
if (!_react_doctor_require_typescript_default.isStringLiteralLike(unwrappedElement)) return [];
|
|
41064
41059
|
patterns.push(unwrappedElement.text);
|
|
41065
41060
|
}
|
|
41066
41061
|
return patterns;
|
|
@@ -41068,16 +41063,16 @@ const collectStaticPatterns = (expression) => {
|
|
|
41068
41063
|
const findCwdExpression = (expression) => {
|
|
41069
41064
|
if (!expression) return void 0;
|
|
41070
41065
|
const unwrappedExpression = unwrapTypescriptExpression(expression);
|
|
41071
|
-
if (!
|
|
41066
|
+
if (!_react_doctor_require_typescript_default.isObjectLiteralExpression(unwrappedExpression)) return void 0;
|
|
41072
41067
|
for (const property of unwrappedExpression.properties) {
|
|
41073
|
-
if (!
|
|
41074
|
-
if ((
|
|
41068
|
+
if (!_react_doctor_require_typescript_default.isPropertyAssignment(property)) continue;
|
|
41069
|
+
if ((_react_doctor_require_typescript_default.isIdentifier(property.name) || _react_doctor_require_typescript_default.isStringLiteralLike(property.name) ? property.name.text : void 0) === "cwd") return property.initializer;
|
|
41075
41070
|
}
|
|
41076
41071
|
};
|
|
41077
41072
|
const collectGlobbyLocalNames = (sourceFile) => {
|
|
41078
41073
|
const localNames = /* @__PURE__ */ new Set();
|
|
41079
41074
|
for (const statement of sourceFile.statements) {
|
|
41080
|
-
if (!
|
|
41075
|
+
if (!_react_doctor_require_typescript_default.isImportDeclaration(statement) || !_react_doctor_require_typescript_default.isStringLiteral(statement.moduleSpecifier) || statement.moduleSpecifier.text !== "globby" || !statement.importClause?.namedBindings || !_react_doctor_require_typescript_default.isNamedImports(statement.importClause.namedBindings)) continue;
|
|
41081
41076
|
for (const element of statement.importClause.namedBindings.elements) {
|
|
41082
41077
|
const importedName = element.propertyName?.text ?? element.name.text;
|
|
41083
41078
|
if (importedName === "globby" || importedName === "globbySync") localNames.add(element.name.text);
|
|
@@ -41088,8 +41083,8 @@ const collectGlobbyLocalNames = (sourceFile) => {
|
|
|
41088
41083
|
const collectVariableDeclarations = (sourceFile) => {
|
|
41089
41084
|
const declarations = /* @__PURE__ */ new Map();
|
|
41090
41085
|
const visitNode = (node) => {
|
|
41091
|
-
if (
|
|
41092
|
-
|
|
41086
|
+
if (_react_doctor_require_typescript_default.isVariableDeclaration(node) && _react_doctor_require_typescript_default.isIdentifier(node.name) && node.initializer) declarations.set(node.name.text, node.initializer);
|
|
41087
|
+
_react_doctor_require_typescript_default.forEachChild(node, visitNode);
|
|
41093
41088
|
};
|
|
41094
41089
|
visitNode(sourceFile);
|
|
41095
41090
|
return declarations;
|
|
@@ -41103,7 +41098,7 @@ const extractGlobbyEntriesFromFile = (entryFilePath, projectRoot) => {
|
|
|
41103
41098
|
return [];
|
|
41104
41099
|
}
|
|
41105
41100
|
if (!sourceText.includes("globby")) return [];
|
|
41106
|
-
const sourceFile =
|
|
41101
|
+
const sourceFile = _react_doctor_require_typescript_default.createSourceFile(entryFilePath, sourceText, _react_doctor_require_typescript_default.ScriptTarget.Latest, true, _react_doctor_require_typescript_default.ScriptKind.TSX);
|
|
41107
41102
|
const globbyLocalNames = collectGlobbyLocalNames(sourceFile);
|
|
41108
41103
|
if (globbyLocalNames.size === 0) return [];
|
|
41109
41104
|
const context = {
|
|
@@ -41114,7 +41109,7 @@ const extractGlobbyEntriesFromFile = (entryFilePath, projectRoot) => {
|
|
|
41114
41109
|
};
|
|
41115
41110
|
const entries = /* @__PURE__ */ new Set();
|
|
41116
41111
|
const visitNode = (node) => {
|
|
41117
|
-
if (
|
|
41112
|
+
if (_react_doctor_require_typescript_default.isCallExpression(node) && _react_doctor_require_typescript_default.isIdentifier(unwrapTypescriptExpression(node.expression)) && globbyLocalNames.has(unwrapTypescriptExpression(node.expression).getText()) && node.arguments[0]) {
|
|
41118
41113
|
const patterns = collectStaticPatterns(node.arguments[0]);
|
|
41119
41114
|
const cwdExpression = findCwdExpression(node.arguments[1]);
|
|
41120
41115
|
const workingDirectory = cwdExpression ? evaluateDirectoryExpression(cwdExpression, context) : dirname(entryFilePath);
|
|
@@ -41127,7 +41122,7 @@ const extractGlobbyEntriesFromFile = (entryFilePath, projectRoot) => {
|
|
|
41127
41122
|
})) if (isPathInsideDirectoryOrEqual(filePath, projectRoot) && DEFAULT_EXTENSIONS.some((extension) => filePath.endsWith(extension))) entries.add(filePath);
|
|
41128
41123
|
}
|
|
41129
41124
|
}
|
|
41130
|
-
|
|
41125
|
+
_react_doctor_require_typescript_default.forEachChild(node, visitNode);
|
|
41131
41126
|
};
|
|
41132
41127
|
visitNode(sourceFile);
|
|
41133
41128
|
return [...entries];
|
|
@@ -41635,7 +41630,7 @@ const extractReactEmailTemplateEntries = (directory) => {
|
|
|
41635
41630
|
//#endregion
|
|
41636
41631
|
//#region ../core/src/project-analysis/utils/parse-typescript-config.ts
|
|
41637
41632
|
const parseTypeScriptConfig = (configPath, source) => {
|
|
41638
|
-
const parsedConfig =
|
|
41633
|
+
const parsedConfig = _react_doctor_require_typescript_default.parseConfigFileTextToJson(configPath, source);
|
|
41639
41634
|
return parsedConfig.error ? void 0 : parsedConfig.config;
|
|
41640
41635
|
};
|
|
41641
41636
|
//#endregion
|
|
@@ -42693,9 +42688,9 @@ const collectWebpackConfigModules = (configPath) => {
|
|
|
42693
42688
|
if (visitedModulePaths.has(modulePath)) continue;
|
|
42694
42689
|
visitedModulePaths.add(modulePath);
|
|
42695
42690
|
configModulePaths.push(modulePath);
|
|
42696
|
-
const sourceFile =
|
|
42691
|
+
const sourceFile = _react_doctor_require_typescript_default.createSourceFile(modulePath, readFileSync(modulePath, "utf-8"), _react_doctor_require_typescript_default.ScriptTarget.Latest, true);
|
|
42697
42692
|
for (const statement of sourceFile.statements) {
|
|
42698
|
-
if (!
|
|
42693
|
+
if (!_react_doctor_require_typescript_default.isImportDeclaration(statement) || !_react_doctor_require_typescript_default.isStringLiteral(statement.moduleSpecifier)) continue;
|
|
42699
42694
|
const specifier = statement.moduleSpecifier.text;
|
|
42700
42695
|
if (!specifier.startsWith(".")) continue;
|
|
42701
42696
|
const importedModulePath = resolveEntryWithExtensions(resolve(dirname(modulePath), specifier));
|
|
@@ -42708,7 +42703,7 @@ const extractComputedWebpackEntries = (configPath, projectDirectory) => {
|
|
|
42708
42703
|
const entries = [];
|
|
42709
42704
|
for (const modulePath of collectWebpackConfigModules(configPath)) {
|
|
42710
42705
|
const sourceText = readFileSync(modulePath, "utf-8");
|
|
42711
|
-
const sourceFile =
|
|
42706
|
+
const sourceFile = _react_doctor_require_typescript_default.createSourceFile(modulePath, sourceText, _react_doctor_require_typescript_default.ScriptTarget.Latest, true);
|
|
42712
42707
|
const program = parseOxcProgram(modulePath, sourceText);
|
|
42713
42708
|
if (program) visitOxcAstWithBindings(program, (node, bindingNames) => {
|
|
42714
42709
|
if (node.type === "FunctionDeclaration" || node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression") return false;
|
|
@@ -42720,30 +42715,30 @@ const extractComputedWebpackEntries = (configPath, projectDirectory) => {
|
|
|
42720
42715
|
});
|
|
42721
42716
|
const objectInitializers = /* @__PURE__ */ new Map();
|
|
42722
42717
|
for (const statement of sourceFile.statements) {
|
|
42723
|
-
if (!
|
|
42724
|
-
for (const declaration of statement.declarationList.declarations) if (
|
|
42718
|
+
if (!_react_doctor_require_typescript_default.isVariableStatement(statement)) continue;
|
|
42719
|
+
for (const declaration of statement.declarationList.declarations) if (_react_doctor_require_typescript_default.isIdentifier(declaration.name) && declaration.initializer && _react_doctor_require_typescript_default.isObjectLiteralExpression(declaration.initializer)) objectInitializers.set(declaration.name.text, declaration.initializer);
|
|
42725
42720
|
}
|
|
42726
42721
|
const exportedObjects = sourceFile.statements.flatMap((statement) => {
|
|
42727
42722
|
let exportedExpression;
|
|
42728
|
-
if (
|
|
42729
|
-
else if (
|
|
42723
|
+
if (_react_doctor_require_typescript_default.isExportAssignment(statement)) exportedExpression = statement.expression;
|
|
42724
|
+
else if (_react_doctor_require_typescript_default.isExpressionStatement(statement) && _react_doctor_require_typescript_default.isBinaryExpression(statement.expression) && statement.expression.operatorToken.kind === _react_doctor_require_typescript_default.SyntaxKind.EqualsToken && _react_doctor_require_typescript_default.isPropertyAccessExpression(statement.expression.left) && _react_doctor_require_typescript_default.isIdentifier(statement.expression.left.expression) && statement.expression.left.expression.text === "module" && statement.expression.left.name.text === "exports") exportedExpression = statement.expression.right;
|
|
42730
42725
|
if (!exportedExpression) return [];
|
|
42731
|
-
if (
|
|
42732
|
-
if (
|
|
42726
|
+
if (_react_doctor_require_typescript_default.isObjectLiteralExpression(exportedExpression)) return [exportedExpression];
|
|
42727
|
+
if (_react_doctor_require_typescript_default.isIdentifier(exportedExpression)) {
|
|
42733
42728
|
const objectInitializer = objectInitializers.get(exportedExpression.text);
|
|
42734
42729
|
return objectInitializer ? [objectInitializer] : [];
|
|
42735
42730
|
}
|
|
42736
42731
|
return [];
|
|
42737
42732
|
});
|
|
42738
42733
|
for (const exportedObject of exportedObjects) {
|
|
42739
|
-
const entryProperty = exportedObject.properties.find((property) =>
|
|
42734
|
+
const entryProperty = exportedObject.properties.find((property) => _react_doctor_require_typescript_default.isPropertyAssignment(property) && (_react_doctor_require_typescript_default.isIdentifier(property.name) && property.name.text === "entry" || _react_doctor_require_typescript_default.isStringLiteral(property.name) && property.name.text === "entry"));
|
|
42740
42735
|
const pathSegments = [];
|
|
42741
|
-
if (entryProperty &&
|
|
42742
|
-
for (const argument of entryProperty.initializer.arguments) if (
|
|
42736
|
+
if (entryProperty && _react_doctor_require_typescript_default.isCallExpression(entryProperty.initializer)) {
|
|
42737
|
+
for (const argument of entryProperty.initializer.arguments) if (_react_doctor_require_typescript_default.isStringLiteral(argument) || _react_doctor_require_typescript_default.isNoSubstitutionTemplateLiteral(argument)) pathSegments.push(argument.text);
|
|
42743
42738
|
}
|
|
42744
|
-
const entryCallExpression = entryProperty &&
|
|
42745
|
-
const entryPathObjectName = entryCallExpression &&
|
|
42746
|
-
const entryPathMethodName = entryCallExpression &&
|
|
42739
|
+
const entryCallExpression = entryProperty && _react_doctor_require_typescript_default.isCallExpression(entryProperty.initializer) ? entryProperty.initializer : void 0;
|
|
42740
|
+
const entryPathObjectName = entryCallExpression && _react_doctor_require_typescript_default.isPropertyAccessExpression(entryCallExpression.expression) && _react_doctor_require_typescript_default.isIdentifier(entryCallExpression.expression.expression) ? entryCallExpression.expression.expression.text : void 0;
|
|
42741
|
+
const entryPathMethodName = entryCallExpression && _react_doctor_require_typescript_default.isPropertyAccessExpression(entryCallExpression.expression) ? entryCallExpression.expression.name.text : void 0;
|
|
42747
42742
|
if (!entryProperty || !entryCallExpression || !entryPathObjectName || !entryPathMethodName || !/path/i.test(entryPathObjectName) || pathSegments.length !== entryCallExpression.arguments.length) continue;
|
|
42748
42743
|
const candidatePaths = entryPathObjectName === "path" && (entryPathMethodName === "join" || entryPathMethodName === "resolve") ? [resolve(dirname(modulePath), ...pathSegments)] : [resolve(projectDirectory, entryPathMethodName, ...pathSegments), resolve(projectDirectory, "src", entryPathMethodName, ...pathSegments)];
|
|
42749
42744
|
for (const candidatePath of candidatePaths) {
|
|
@@ -44538,20 +44533,8 @@ const isConfigFile = (filePath) => {
|
|
|
44538
44533
|
return KNOWN_CONFIG_PREFIXES.some((prefix) => fileName.startsWith(prefix));
|
|
44539
44534
|
};
|
|
44540
44535
|
//#endregion
|
|
44541
|
-
//#region ../core/src/project-info/constants.ts
|
|
44542
|
-
var import_picomatch = /* @__PURE__ */ __toESM(require_picomatch$2(), 1);
|
|
44543
|
-
const GIT_CHECK_ATTR_MAX_BUFFER_BYTES = 50 * 1024 * 1024;
|
|
44544
|
-
new Map(Object.entries({
|
|
44545
|
-
Security: "An attacker can read user data, act as your users, or run code you never shipped.",
|
|
44546
|
-
Bugs: "Real users hit crashes, wrong output, or state that silently corrupts.",
|
|
44547
|
-
Performance: "Users feel extra latency and wasted renders on every interaction.",
|
|
44548
|
-
Accessibility: "Users on screen readers, keyboards, or assistive tech get locked out.",
|
|
44549
|
-
Maintainability: "Every future change gets slower and riskier to make."
|
|
44550
|
-
}));
|
|
44551
|
-
const MAX_GLOB_PATTERN_LENGTH_CHARS = 1024;
|
|
44552
|
-
process.env.REACT_DOCTOR_CORE_VERSION;
|
|
44553
|
-
//#endregion
|
|
44554
44536
|
//#region ../core/src/utils/message-from-unknown.ts
|
|
44537
|
+
var import_picomatch = /* @__PURE__ */ __toESM(require_picomatch$2(), 1);
|
|
44555
44538
|
const messageFromUnknown = (error) => error instanceof Error ? error.message : String(error);
|
|
44556
44539
|
//#endregion
|
|
44557
44540
|
//#region ../core/src/utils/match-glob-pattern.ts
|
|
@@ -45449,18 +45432,18 @@ const collectDynamicBuildImports = (sourceFile, typeChecker) => {
|
|
|
45449
45432
|
const globNamespaceSymbols = /* @__PURE__ */ new Set();
|
|
45450
45433
|
const pathNamespaceSymbols = /* @__PURE__ */ new Set();
|
|
45451
45434
|
for (const statement of sourceFile.statements) {
|
|
45452
|
-
if (!
|
|
45435
|
+
if (!_react_doctor_require_typescript_default.isImportDeclaration(statement) || !_react_doctor_require_typescript_default.isStringLiteral(statement.moduleSpecifier) || !statement.importClause) continue;
|
|
45453
45436
|
const moduleName = statement.moduleSpecifier.text;
|
|
45454
45437
|
const namedBindings = statement.importClause.namedBindings;
|
|
45455
|
-
if (moduleName === "glob" && namedBindings &&
|
|
45438
|
+
if (moduleName === "glob" && namedBindings && _react_doctor_require_typescript_default.isNamespaceImport(namedBindings)) {
|
|
45456
45439
|
const globNamespaceSymbol = typeChecker.getSymbolAtLocation(namedBindings.name);
|
|
45457
45440
|
if (globNamespaceSymbol) globNamespaceSymbols.add(globNamespaceSymbol);
|
|
45458
45441
|
}
|
|
45459
|
-
if (moduleName === "path" && namedBindings &&
|
|
45442
|
+
if (moduleName === "path" && namedBindings && _react_doctor_require_typescript_default.isNamespaceImport(namedBindings)) {
|
|
45460
45443
|
const pathNamespaceSymbol = typeChecker.getSymbolAtLocation(namedBindings.name);
|
|
45461
45444
|
if (pathNamespaceSymbol) pathNamespaceSymbols.add(pathNamespaceSymbol);
|
|
45462
45445
|
}
|
|
45463
|
-
if (moduleName !== "tsup" || !namedBindings || !
|
|
45446
|
+
if (moduleName !== "tsup" || !namedBindings || !_react_doctor_require_typescript_default.isNamedImports(namedBindings)) continue;
|
|
45464
45447
|
for (const importSpecifier of namedBindings.elements) if ((importSpecifier.propertyName ?? importSpecifier.name).text === "build") {
|
|
45465
45448
|
const buildSymbol = typeChecker.getSymbolAtLocation(importSpecifier.name);
|
|
45466
45449
|
if (buildSymbol) buildSymbols.add(buildSymbol);
|
|
@@ -45473,18 +45456,18 @@ const collectDynamicBuildImports = (sourceFile, typeChecker) => {
|
|
|
45473
45456
|
};
|
|
45474
45457
|
};
|
|
45475
45458
|
const extractGlobPattern = (expression, imports, scriptDirectory, typeChecker) => {
|
|
45476
|
-
if (!
|
|
45459
|
+
if (!_react_doctor_require_typescript_default.isCallExpression(expression) || !_react_doctor_require_typescript_default.isPropertyAccessExpression(expression.expression) || expression.expression.name.text !== "sync" || !_react_doctor_require_typescript_default.isIdentifier(expression.expression.expression) || !hasMatchingSymbol(expression.expression.expression, imports.globNamespaceSymbols, typeChecker) || expression.arguments.length !== 1) return;
|
|
45477
45460
|
const patternExpression = expression.arguments[0];
|
|
45478
|
-
if (!
|
|
45461
|
+
if (!_react_doctor_require_typescript_default.isCallExpression(patternExpression) || !_react_doctor_require_typescript_default.isPropertyAccessExpression(patternExpression.expression) || patternExpression.expression.name.text !== "join" || !_react_doctor_require_typescript_default.isIdentifier(patternExpression.expression.expression) || !hasMatchingSymbol(patternExpression.expression.expression, imports.pathNamespaceSymbols, typeChecker) || patternExpression.arguments.length !== 2 || !_react_doctor_require_typescript_default.isIdentifier(patternExpression.arguments[0]) || patternExpression.arguments[0].text !== "__dirname" || !_react_doctor_require_typescript_default.isStringLiteral(patternExpression.arguments[1]) && !_react_doctor_require_typescript_default.isNoSubstitutionTemplateLiteral(patternExpression.arguments[1])) return;
|
|
45479
45462
|
const relativeGlobPattern = patternExpression.arguments[1].text;
|
|
45480
45463
|
if (!relativeGlobPattern.includes("*")) return void 0;
|
|
45481
45464
|
return toPosixPath(resolve(scriptDirectory, relativeGlobPattern));
|
|
45482
45465
|
};
|
|
45483
45466
|
const extractExcludedPathSubstring = (callback) => {
|
|
45484
|
-
if (callback.parameters.length !== 1 || !
|
|
45467
|
+
if (callback.parameters.length !== 1 || !_react_doctor_require_typescript_default.isIdentifier(callback.parameters[0].name)) return;
|
|
45485
45468
|
const filePathName = callback.parameters[0].name.text;
|
|
45486
|
-
const returnedExpression =
|
|
45487
|
-
if (!returnedExpression || !
|
|
45469
|
+
const returnedExpression = _react_doctor_require_typescript_default.isBlock(callback.body) ? callback.body.statements.length === 1 && _react_doctor_require_typescript_default.isReturnStatement(callback.body.statements[0]) ? callback.body.statements[0].expression : void 0 : callback.body;
|
|
45470
|
+
if (!returnedExpression || !_react_doctor_require_typescript_default.isPrefixUnaryExpression(returnedExpression) || returnedExpression.operator !== _react_doctor_require_typescript_default.SyntaxKind.ExclamationToken || !_react_doctor_require_typescript_default.isCallExpression(returnedExpression.operand) || !_react_doctor_require_typescript_default.isPropertyAccessExpression(returnedExpression.operand.expression) || returnedExpression.operand.expression.name.text !== "includes" || !_react_doctor_require_typescript_default.isIdentifier(returnedExpression.operand.expression.expression) || returnedExpression.operand.expression.expression.text !== filePathName || returnedExpression.operand.arguments.length !== 1 || !_react_doctor_require_typescript_default.isStringLiteral(returnedExpression.operand.arguments[0]) && !_react_doctor_require_typescript_default.isNoSubstitutionTemplateLiteral(returnedExpression.operand.arguments[0])) return;
|
|
45488
45471
|
return toPosixPath(returnedExpression.operand.arguments[0].text);
|
|
45489
45472
|
};
|
|
45490
45473
|
const extractFileCollection = (initializer, imports, scriptDirectory, typeChecker) => {
|
|
@@ -45493,7 +45476,7 @@ const extractFileCollection = (initializer, imports, scriptDirectory, typeChecke
|
|
|
45493
45476
|
excludedPathSubstrings: [],
|
|
45494
45477
|
globPattern: directGlobPattern
|
|
45495
45478
|
};
|
|
45496
|
-
if (!
|
|
45479
|
+
if (!_react_doctor_require_typescript_default.isCallExpression(initializer) || !_react_doctor_require_typescript_default.isPropertyAccessExpression(initializer.expression) || initializer.expression.name.text !== "filter" || initializer.arguments.length !== 1 || !_react_doctor_require_typescript_default.isArrowFunction(initializer.arguments[0]) && !_react_doctor_require_typescript_default.isFunctionExpression(initializer.arguments[0])) return;
|
|
45497
45480
|
const globPattern = extractGlobPattern(initializer.expression.expression, imports, scriptDirectory, typeChecker);
|
|
45498
45481
|
const excludedPathSubstring = extractExcludedPathSubstring(initializer.arguments[0]);
|
|
45499
45482
|
if (!globPattern || excludedPathSubstring === void 0) return void 0;
|
|
@@ -45502,36 +45485,36 @@ const extractFileCollection = (initializer, imports, scriptDirectory, typeChecke
|
|
|
45502
45485
|
globPattern
|
|
45503
45486
|
};
|
|
45504
45487
|
};
|
|
45505
|
-
const isPathNamespaceCall = (expression, methodName, imports, typeChecker) =>
|
|
45488
|
+
const isPathNamespaceCall = (expression, methodName, imports, typeChecker) => _react_doctor_require_typescript_default.isCallExpression(expression) && _react_doctor_require_typescript_default.isPropertyAccessExpression(expression.expression) && expression.expression.name.text === methodName && _react_doctor_require_typescript_default.isIdentifier(expression.expression.expression) && hasMatchingSymbol(expression.expression.expression, imports.pathNamespaceSymbols, typeChecker);
|
|
45506
45489
|
const hasMatchingOutputEntryPath = (callback, filePathName, outputEntryName, imports, typeChecker) => {
|
|
45507
|
-
if (!
|
|
45490
|
+
if (!_react_doctor_require_typescript_default.isBlock(callback.body)) return false;
|
|
45508
45491
|
const initializersByName = /* @__PURE__ */ new Map();
|
|
45509
45492
|
for (const statement of callback.body.statements) {
|
|
45510
|
-
if (!
|
|
45511
|
-
for (const declaration of statement.declarationList.declarations) if (
|
|
45493
|
+
if (!_react_doctor_require_typescript_default.isVariableStatement(statement)) continue;
|
|
45494
|
+
for (const declaration of statement.declarationList.declarations) if (_react_doctor_require_typescript_default.isIdentifier(declaration.name) && declaration.initializer) initializersByName.set(declaration.name.text, declaration.initializer);
|
|
45512
45495
|
}
|
|
45513
45496
|
const outputEntryInitializer = initializersByName.get(outputEntryName);
|
|
45514
45497
|
if (!outputEntryInitializer || !isPathNamespaceCall(outputEntryInitializer, "join", imports, typeChecker)) return false;
|
|
45515
45498
|
const outputFilenameExpression = outputEntryInitializer.arguments.at(-1);
|
|
45516
|
-
if (!outputFilenameExpression || !
|
|
45499
|
+
if (!outputFilenameExpression || !_react_doctor_require_typescript_default.isBinaryExpression(outputFilenameExpression) || outputFilenameExpression.operatorToken.kind !== _react_doctor_require_typescript_default.SyntaxKind.PlusToken || !_react_doctor_require_typescript_default.isStringLiteralLike(outputFilenameExpression.right) || outputFilenameExpression.right.text !== ".js" || !isPathNamespaceCall(outputFilenameExpression.left, "basename", imports, typeChecker) || outputFilenameExpression.left.arguments.length !== 2 || !_react_doctor_require_typescript_default.isIdentifier(outputFilenameExpression.left.arguments[0]) || !_react_doctor_require_typescript_default.isStringLiteralLike(outputFilenameExpression.left.arguments[1]) || outputFilenameExpression.left.arguments[1].text !== ".tsx") return false;
|
|
45517
45500
|
const basenameSourceName = outputFilenameExpression.left.arguments[0].text;
|
|
45518
45501
|
if (basenameSourceName === filePathName) return true;
|
|
45519
45502
|
const basenameSourceInitializer = initializersByName.get(basenameSourceName);
|
|
45520
|
-
return Boolean(basenameSourceInitializer && isPathNamespaceCall(basenameSourceInitializer, "relative", imports, typeChecker) && basenameSourceInitializer.arguments.length === 2 &&
|
|
45503
|
+
return Boolean(basenameSourceInitializer && isPathNamespaceCall(basenameSourceInitializer, "relative", imports, typeChecker) && basenameSourceInitializer.arguments.length === 2 && _react_doctor_require_typescript_default.isIdentifier(basenameSourceInitializer.arguments[1]) && basenameSourceInitializer.arguments[1].text === filePathName);
|
|
45521
45504
|
};
|
|
45522
45505
|
const findBuildInvocation = (callback, filePathName, imports, typeChecker) => {
|
|
45523
45506
|
let buildInvocation;
|
|
45524
45507
|
const visitNode = (node) => {
|
|
45525
|
-
if (
|
|
45526
|
-
const hasMatchingEntry = node.arguments[0].properties.some((property) =>
|
|
45527
|
-
const outDirectoryProperty = node.arguments[0].properties.find((property) =>
|
|
45528
|
-
const hasCommonJsFormat = node.arguments[0].properties.some((property) =>
|
|
45529
|
-
if (hasMatchingEntry && hasCommonJsFormat && outDirectoryProperty &&
|
|
45508
|
+
if (_react_doctor_require_typescript_default.isCallExpression(node) && _react_doctor_require_typescript_default.isAwaitExpression(node.parent) && _react_doctor_require_typescript_default.isIdentifier(node.expression) && hasMatchingSymbol(node.expression, imports.buildSymbols, typeChecker) && node.arguments.length === 1 && _react_doctor_require_typescript_default.isObjectLiteralExpression(node.arguments[0])) {
|
|
45509
|
+
const hasMatchingEntry = node.arguments[0].properties.some((property) => _react_doctor_require_typescript_default.isPropertyAssignment(property) && (_react_doctor_require_typescript_default.isIdentifier(property.name) && property.name.text === "entry" || _react_doctor_require_typescript_default.isStringLiteral(property.name) && property.name.text === "entry") && _react_doctor_require_typescript_default.isArrayLiteralExpression(property.initializer) && property.initializer.elements.length === 1 && _react_doctor_require_typescript_default.isIdentifier(property.initializer.elements[0]) && property.initializer.elements[0].text === filePathName);
|
|
45510
|
+
const outDirectoryProperty = node.arguments[0].properties.find((property) => _react_doctor_require_typescript_default.isPropertyAssignment(property) && (_react_doctor_require_typescript_default.isIdentifier(property.name) && property.name.text === "outDir" || _react_doctor_require_typescript_default.isStringLiteral(property.name) && property.name.text === "outDir"));
|
|
45511
|
+
const hasCommonJsFormat = node.arguments[0].properties.some((property) => _react_doctor_require_typescript_default.isPropertyAssignment(property) && (_react_doctor_require_typescript_default.isIdentifier(property.name) && property.name.text === "format" || _react_doctor_require_typescript_default.isStringLiteral(property.name) && property.name.text === "format") && _react_doctor_require_typescript_default.isStringLiteralLike(property.initializer) && property.initializer.text === "cjs");
|
|
45512
|
+
if (hasMatchingEntry && hasCommonJsFormat && outDirectoryProperty && _react_doctor_require_typescript_default.isPropertyAssignment(outDirectoryProperty) && _react_doctor_require_typescript_default.isCallExpression(outDirectoryProperty.initializer) && _react_doctor_require_typescript_default.isPropertyAccessExpression(outDirectoryProperty.initializer.expression) && outDirectoryProperty.initializer.expression.name.text === "dirname" && _react_doctor_require_typescript_default.isIdentifier(outDirectoryProperty.initializer.expression.expression) && hasMatchingSymbol(outDirectoryProperty.initializer.expression.expression, imports.pathNamespaceSymbols, typeChecker) && outDirectoryProperty.initializer.arguments.length === 1 && _react_doctor_require_typescript_default.isIdentifier(outDirectoryProperty.initializer.arguments[0]) && hasMatchingOutputEntryPath(callback, filePathName, outDirectoryProperty.initializer.arguments[0].text, imports, typeChecker)) buildInvocation = {
|
|
45530
45513
|
end: node.parent.end,
|
|
45531
45514
|
outputEntryName: outDirectoryProperty.initializer.arguments[0].text
|
|
45532
45515
|
};
|
|
45533
45516
|
}
|
|
45534
|
-
if (!buildInvocation)
|
|
45517
|
+
if (!buildInvocation) _react_doctor_require_typescript_default.forEachChild(node, visitNode);
|
|
45535
45518
|
};
|
|
45536
45519
|
visitNode(callback.body);
|
|
45537
45520
|
return buildInvocation;
|
|
@@ -45540,19 +45523,19 @@ const collectImportedNamespaceExportNames = (callback, buildInvocation, typeChec
|
|
|
45540
45523
|
const importedNamespaceDeclarationEndBySymbol = /* @__PURE__ */ new Map();
|
|
45541
45524
|
const exportNames = /* @__PURE__ */ new Set();
|
|
45542
45525
|
const collectNamespaceNames = (node) => {
|
|
45543
|
-
if (
|
|
45526
|
+
if (_react_doctor_require_typescript_default.isVariableDeclaration(node) && _react_doctor_require_typescript_default.isIdentifier(node.name) && node.initializer && _react_doctor_require_typescript_default.isAwaitExpression(node.initializer) && node.initializer.pos >= buildInvocation.end && _react_doctor_require_typescript_default.isCallExpression(node.initializer.expression) && node.initializer.expression.expression.kind === _react_doctor_require_typescript_default.SyntaxKind.ImportKeyword && node.initializer.expression.arguments.length === 1 && _react_doctor_require_typescript_default.isIdentifier(node.initializer.expression.arguments[0]) && node.initializer.expression.arguments[0].text === buildInvocation.outputEntryName) {
|
|
45544
45527
|
const namespaceSymbol = typeChecker.getSymbolAtLocation(node.name);
|
|
45545
45528
|
if (namespaceSymbol) importedNamespaceDeclarationEndBySymbol.set(namespaceSymbol, node.end);
|
|
45546
45529
|
}
|
|
45547
|
-
|
|
45530
|
+
_react_doctor_require_typescript_default.forEachChild(node, collectNamespaceNames);
|
|
45548
45531
|
};
|
|
45549
45532
|
collectNamespaceNames(callback.body);
|
|
45550
45533
|
const collectExportNames = (node) => {
|
|
45551
|
-
const namespaceSymbol = (
|
|
45534
|
+
const namespaceSymbol = (_react_doctor_require_typescript_default.isPropertyAccessExpression(node) || _react_doctor_require_typescript_default.isElementAccessExpression(node)) && _react_doctor_require_typescript_default.isIdentifier(node.expression) ? typeChecker.getSymbolAtLocation(node.expression) : void 0;
|
|
45552
45535
|
const namespaceDeclarationEnd = namespaceSymbol ? importedNamespaceDeclarationEndBySymbol.get(namespaceSymbol) : void 0;
|
|
45553
|
-
if (
|
|
45554
|
-
else if (
|
|
45555
|
-
|
|
45536
|
+
if (_react_doctor_require_typescript_default.isPropertyAccessExpression(node) && namespaceDeclarationEnd !== void 0 && node.pos >= namespaceDeclarationEnd) exportNames.add(node.name.text);
|
|
45537
|
+
else if (_react_doctor_require_typescript_default.isElementAccessExpression(node) && namespaceDeclarationEnd !== void 0 && node.pos >= namespaceDeclarationEnd && node.argumentExpression && _react_doctor_require_typescript_default.isStringLiteral(node.argumentExpression)) exportNames.add(node.argumentExpression.text);
|
|
45538
|
+
_react_doctor_require_typescript_default.forEachChild(node, collectExportNames);
|
|
45556
45539
|
};
|
|
45557
45540
|
collectExportNames(callback.body);
|
|
45558
45541
|
return exportNames;
|
|
@@ -45568,14 +45551,14 @@ const collectScriptConsumedExportKeys = (scriptPath, packageDirectory) => {
|
|
|
45568
45551
|
noLib: true,
|
|
45569
45552
|
noResolve: true
|
|
45570
45553
|
};
|
|
45571
|
-
const sourceFile =
|
|
45572
|
-
const compilerHost =
|
|
45554
|
+
const sourceFile = _react_doctor_require_typescript_default.createSourceFile(scriptPath, source, _react_doctor_require_typescript_default.ScriptTarget.Latest, true);
|
|
45555
|
+
const compilerHost = _react_doctor_require_typescript_default.createCompilerHost(compilerOptions);
|
|
45573
45556
|
const scriptIdentity = getFileIdentityKey(scriptPath);
|
|
45574
45557
|
const isScriptPath = (candidatePath) => getFileIdentityKey(candidatePath) === scriptIdentity;
|
|
45575
45558
|
compilerHost.fileExists = isScriptPath;
|
|
45576
45559
|
compilerHost.getSourceFile = (candidatePath) => isScriptPath(candidatePath) ? sourceFile : void 0;
|
|
45577
45560
|
compilerHost.readFile = (candidatePath) => isScriptPath(candidatePath) ? source : void 0;
|
|
45578
|
-
const program =
|
|
45561
|
+
const program = _react_doctor_require_typescript_default.createProgram({
|
|
45579
45562
|
rootNames: [scriptPath],
|
|
45580
45563
|
options: compilerOptions,
|
|
45581
45564
|
host: compilerHost
|
|
@@ -45587,22 +45570,22 @@ const collectScriptConsumedExportKeys = (scriptPath, packageDirectory) => {
|
|
|
45587
45570
|
if (imports.buildSymbols.size === 0 || imports.globNamespaceSymbols.size === 0 || imports.pathNamespaceSymbols.size === 0) return /* @__PURE__ */ new Set();
|
|
45588
45571
|
const collectionsBySymbol = /* @__PURE__ */ new Map();
|
|
45589
45572
|
const visitCollection = (node) => {
|
|
45590
|
-
if (
|
|
45573
|
+
if (_react_doctor_require_typescript_default.isVariableDeclaration(node) && _react_doctor_require_typescript_default.isIdentifier(node.name) && node.initializer) {
|
|
45591
45574
|
const collection = extractFileCollection(node.initializer, imports, dirname(scriptPath), typeChecker);
|
|
45592
45575
|
const collectionSymbol = typeChecker.getSymbolAtLocation(node.name);
|
|
45593
45576
|
if (collection && collectionSymbol) collectionsBySymbol.set(collectionSymbol, collection);
|
|
45594
45577
|
}
|
|
45595
|
-
|
|
45578
|
+
_react_doctor_require_typescript_default.forEachChild(node, visitCollection);
|
|
45596
45579
|
};
|
|
45597
45580
|
visitCollection(boundSourceFile);
|
|
45598
45581
|
const consumedExportKeys = /* @__PURE__ */ new Set();
|
|
45599
45582
|
const packageManifestIdentity = getFileIdentityKey(resolve(packageDirectory, "package.json"));
|
|
45600
45583
|
const visitMapCall = (node) => {
|
|
45601
|
-
if (
|
|
45584
|
+
if (_react_doctor_require_typescript_default.isCallExpression(node) && _react_doctor_require_typescript_default.isPropertyAccessExpression(node.expression) && node.expression.name.text === "map" && _react_doctor_require_typescript_default.isIdentifier(node.expression.expression) && node.arguments.length === 1 && (_react_doctor_require_typescript_default.isArrowFunction(node.arguments[0]) || _react_doctor_require_typescript_default.isFunctionExpression(node.arguments[0]))) {
|
|
45602
45585
|
const collectionSymbol = typeChecker.getSymbolAtLocation(node.expression.expression);
|
|
45603
45586
|
const collection = collectionSymbol ? collectionsBySymbol.get(collectionSymbol) : void 0;
|
|
45604
45587
|
const callback = node.arguments[0];
|
|
45605
|
-
if (collection && callback.parameters.length === 1 &&
|
|
45588
|
+
if (collection && callback.parameters.length === 1 && _react_doctor_require_typescript_default.isIdentifier(callback.parameters[0].name)) {
|
|
45606
45589
|
const buildInvocation = findBuildInvocation(callback, callback.parameters[0].name.text, imports, typeChecker);
|
|
45607
45590
|
if (!buildInvocation) return;
|
|
45608
45591
|
const exportNames = collectImportedNamespaceExportNames(callback, buildInvocation, typeChecker);
|
|
@@ -45621,7 +45604,7 @@ const collectScriptConsumedExportKeys = (scriptPath, packageDirectory) => {
|
|
|
45621
45604
|
}
|
|
45622
45605
|
}
|
|
45623
45606
|
}
|
|
45624
|
-
|
|
45607
|
+
_react_doctor_require_typescript_default.forEachChild(node, visitMapCall);
|
|
45625
45608
|
};
|
|
45626
45609
|
visitMapCall(boundSourceFile);
|
|
45627
45610
|
return consumedExportKeys;
|
|
@@ -45665,7 +45648,7 @@ const readPackageMetadata = (packageDirectory) => {
|
|
|
45665
45648
|
return;
|
|
45666
45649
|
}
|
|
45667
45650
|
};
|
|
45668
|
-
const hasNextraImport = (sourceFile) => sourceFile.statements.some((statement) =>
|
|
45651
|
+
const hasNextraImport = (sourceFile) => sourceFile.statements.some((statement) => _react_doctor_require_typescript_default.isImportDeclaration(statement) && _react_doctor_require_typescript_default.isStringLiteral(statement.moduleSpecifier) && statement.moduleSpecifier.text === "nextra");
|
|
45669
45652
|
const collectReferencedNextraThemeConfigPaths = (packageDirectory) => {
|
|
45670
45653
|
const referencedPaths = /* @__PURE__ */ new Set();
|
|
45671
45654
|
for (const configFilename of NEXT_CONFIG_FILENAMES) {
|
|
@@ -45677,16 +45660,16 @@ const collectReferencedNextraThemeConfigPaths = (packageDirectory) => {
|
|
|
45677
45660
|
} catch {
|
|
45678
45661
|
continue;
|
|
45679
45662
|
}
|
|
45680
|
-
const sourceFile =
|
|
45663
|
+
const sourceFile = _react_doctor_require_typescript_default.createSourceFile(configPath, content, _react_doctor_require_typescript_default.ScriptTarget.Latest, true, _react_doctor_require_typescript_default.ScriptKind.TS);
|
|
45681
45664
|
if (!hasNextraImport(sourceFile)) continue;
|
|
45682
45665
|
const visitNode = (node) => {
|
|
45683
|
-
if (
|
|
45684
|
-
if ((
|
|
45666
|
+
if (_react_doctor_require_typescript_default.isPropertyAssignment(node)) {
|
|
45667
|
+
if ((_react_doctor_require_typescript_default.isIdentifier(node.name) || _react_doctor_require_typescript_default.isStringLiteral(node.name) ? node.name.text : void 0) === "themeConfig" && (_react_doctor_require_typescript_default.isStringLiteral(node.initializer) || _react_doctor_require_typescript_default.isNoSubstitutionTemplateLiteral(node.initializer)) && node.initializer.text.startsWith(".")) {
|
|
45685
45668
|
const resolvedThemeConfigPath = resolveEntryWithExtensions(resolve(dirname(configPath), node.initializer.text));
|
|
45686
45669
|
if (resolvedThemeConfigPath) referencedPaths.add(toPosixPath(toFilesystemIdentityPath(resolve(resolvedThemeConfigPath))));
|
|
45687
45670
|
}
|
|
45688
45671
|
}
|
|
45689
|
-
|
|
45672
|
+
_react_doctor_require_typescript_default.forEachChild(node, visitNode);
|
|
45690
45673
|
};
|
|
45691
45674
|
visitNode(sourceFile);
|
|
45692
45675
|
}
|
|
@@ -46139,7 +46122,7 @@ const collectStaticModulePackageNames = (sourceText) => {
|
|
|
46139
46122
|
//#region ../core/src/project-analysis/utils/matches-package-import-reference.ts
|
|
46140
46123
|
const collectPackageImportNames = (content) => {
|
|
46141
46124
|
const packageNames = collectStaticModulePackageNames(content);
|
|
46142
|
-
const sourceFile =
|
|
46125
|
+
const sourceFile = _react_doctor_require_typescript_default.createSourceFile("package-reference.ts", content, _react_doctor_require_typescript_default.ScriptTarget.Latest, true, _react_doctor_require_typescript_default.ScriptKind.TS);
|
|
46143
46126
|
for (const typeReferenceDirective of sourceFile.typeReferenceDirectives) {
|
|
46144
46127
|
const packageName = extractPackageName(typeReferenceDirective.fileName);
|
|
46145
46128
|
if (packageName) packageNames.add(packageName);
|
|
@@ -46149,8 +46132,8 @@ const collectPackageImportNames = (content) => {
|
|
|
46149
46132
|
//#endregion
|
|
46150
46133
|
//#region ../core/src/project-analysis/utils/get-object-literal-element-name.ts
|
|
46151
46134
|
const getObjectLiteralElementName = (property) => {
|
|
46152
|
-
if (!
|
|
46153
|
-
return
|
|
46135
|
+
if (!_react_doctor_require_typescript_default.isPropertyAssignment(property) && !_react_doctor_require_typescript_default.isShorthandPropertyAssignment(property)) return;
|
|
46136
|
+
return _react_doctor_require_typescript_default.isIdentifier(property.name) || _react_doctor_require_typescript_default.isStringLiteral(property.name) ? property.name.text : void 0;
|
|
46154
46137
|
};
|
|
46155
46138
|
//#endregion
|
|
46156
46139
|
//#region ../core/src/project-analysis/utils/collect-config-plugin-map-package-names.ts
|
|
@@ -46158,23 +46141,23 @@ const collectConfigPluginMapPackageNames = (expression) => {
|
|
|
46158
46141
|
const packageNames = /* @__PURE__ */ new Set();
|
|
46159
46142
|
const collectExpression = (currentExpression) => {
|
|
46160
46143
|
const unwrappedExpression = unwrapTypescriptExpression(currentExpression);
|
|
46161
|
-
if (
|
|
46144
|
+
if (_react_doctor_require_typescript_default.isConditionalExpression(unwrappedExpression)) {
|
|
46162
46145
|
collectExpression(unwrappedExpression.whenTrue);
|
|
46163
46146
|
collectExpression(unwrappedExpression.whenFalse);
|
|
46164
46147
|
return;
|
|
46165
46148
|
}
|
|
46166
|
-
if (
|
|
46167
|
-
|
|
46168
|
-
|
|
46169
|
-
|
|
46149
|
+
if (_react_doctor_require_typescript_default.isBinaryExpression(unwrappedExpression) && [
|
|
46150
|
+
_react_doctor_require_typescript_default.SyntaxKind.AmpersandAmpersandToken,
|
|
46151
|
+
_react_doctor_require_typescript_default.SyntaxKind.BarBarToken,
|
|
46152
|
+
_react_doctor_require_typescript_default.SyntaxKind.QuestionQuestionToken
|
|
46170
46153
|
].includes(unwrappedExpression.operatorToken.kind)) {
|
|
46171
46154
|
collectExpression(unwrappedExpression.left);
|
|
46172
46155
|
collectExpression(unwrappedExpression.right);
|
|
46173
46156
|
return;
|
|
46174
46157
|
}
|
|
46175
|
-
if (!
|
|
46158
|
+
if (!_react_doctor_require_typescript_default.isObjectLiteralExpression(unwrappedExpression)) return;
|
|
46176
46159
|
for (const property of unwrappedExpression.properties) {
|
|
46177
|
-
if (
|
|
46160
|
+
if (_react_doctor_require_typescript_default.isSpreadAssignment(property)) {
|
|
46178
46161
|
collectExpression(property.expression);
|
|
46179
46162
|
continue;
|
|
46180
46163
|
}
|
|
@@ -46197,16 +46180,16 @@ const STRUCTURED_TEXT_EXTENSIONS = new Set([
|
|
|
46197
46180
|
const BABEL_CONFIG_FILE_PATTERN = /(?:^|[/\\])(?:babel\.config\.[^/\\]+|\.babelrc(?:\.[^/\\]+)?)$/;
|
|
46198
46181
|
const BABEL_MODULE_PREFIX = "module:";
|
|
46199
46182
|
const isBabelPluginOrPresetSpecifier = (node) => {
|
|
46200
|
-
const parent =
|
|
46183
|
+
const parent = _react_doctor_require_typescript_default.isArrayLiteralExpression(node.parent) ? node.parent : void 0;
|
|
46201
46184
|
if (!parent) return false;
|
|
46202
|
-
const property = (parent.elements[0] === node &&
|
|
46185
|
+
const property = (parent.elements[0] === node && _react_doctor_require_typescript_default.isArrayLiteralExpression(parent.parent) ? parent.parent : parent).parent;
|
|
46203
46186
|
let ancestor = property;
|
|
46204
|
-
while (ancestor && !
|
|
46187
|
+
while (ancestor && !_react_doctor_require_typescript_default.isSourceFile(ancestor)) {
|
|
46205
46188
|
const parentNode = ancestor.parent;
|
|
46206
|
-
if (
|
|
46189
|
+
if (_react_doctor_require_typescript_default.isObjectLiteralExpression(ancestor) && _react_doctor_require_typescript_default.isArrayLiteralExpression(parentNode) && parentNode.elements[0] !== ancestor && _react_doctor_require_typescript_default.isStringLiteralLike(parentNode.elements[0])) return false;
|
|
46207
46190
|
ancestor = parentNode;
|
|
46208
46191
|
}
|
|
46209
|
-
return
|
|
46192
|
+
return _react_doctor_require_typescript_default.isPropertyAssignment(property) && (getObjectLiteralElementName(property) === "plugins" || getObjectLiteralElementName(property) === "presets");
|
|
46210
46193
|
};
|
|
46211
46194
|
const collectStructuredTextPackageReferences = (content) => {
|
|
46212
46195
|
const uncommentedContent = content.split("\n").map(stripCoffeeScriptComment).join("\n");
|
|
@@ -46219,16 +46202,16 @@ const collectStructuredTextPackageReferences = (content) => {
|
|
|
46219
46202
|
};
|
|
46220
46203
|
const collectPackageConfigReferences = (filePath, content) => {
|
|
46221
46204
|
if (STRUCTURED_TEXT_EXTENSIONS.has(extname(filePath))) return collectStructuredTextPackageReferences(content);
|
|
46222
|
-
const sourceFile =
|
|
46205
|
+
const sourceFile = _react_doctor_require_typescript_default.createSourceFile(filePath, content, _react_doctor_require_typescript_default.ScriptTarget.Latest, true, _react_doctor_require_typescript_default.ScriptKind.TS);
|
|
46223
46206
|
const packageNames = /* @__PURE__ */ new Set();
|
|
46224
46207
|
const visit = (node) => {
|
|
46225
|
-
if (
|
|
46226
|
-
if (
|
|
46208
|
+
if (_react_doctor_require_typescript_default.isPropertyAssignment(node) && getObjectLiteralElementName(node) === "plugins") for (const packageName of collectConfigPluginMapPackageNames(node.initializer)) packageNames.add(packageName);
|
|
46209
|
+
if (_react_doctor_require_typescript_default.isStringLiteralLike(node)) {
|
|
46227
46210
|
const packageName = extractPackageName(BABEL_CONFIG_FILE_PATTERN.test(filePath) && node.text.startsWith(BABEL_MODULE_PREFIX) && isBabelPluginOrPresetSpecifier(node) ? node.text.slice(7) : node.text);
|
|
46228
46211
|
if (packageName) packageNames.add(packageName);
|
|
46229
46212
|
return;
|
|
46230
46213
|
}
|
|
46231
|
-
|
|
46214
|
+
_react_doctor_require_typescript_default.forEachChild(node, visit);
|
|
46232
46215
|
};
|
|
46233
46216
|
visit(sourceFile);
|
|
46234
46217
|
return packageNames;
|
|
@@ -48456,21 +48439,21 @@ const extractPreviewRegistryNamesFromMdx = (sourceText) => {
|
|
|
48456
48439
|
//#endregion
|
|
48457
48440
|
//#region ../core/src/project-analysis/utils/are-source-files-structurally-equivalent.ts
|
|
48458
48441
|
const buildSourceStructure = (filePath, sourceText) => {
|
|
48459
|
-
const sourceFile =
|
|
48442
|
+
const sourceFile = _react_doctor_require_typescript_default.createSourceFile(filePath, sourceText, _react_doctor_require_typescript_default.ScriptTarget.Latest, true, filePath.endsWith("x") ? _react_doctor_require_typescript_default.ScriptKind.TSX : _react_doctor_require_typescript_default.ScriptKind.TS);
|
|
48460
48443
|
const structure = [];
|
|
48461
48444
|
const visitNode = (node, normalizeClassNames = false) => {
|
|
48462
48445
|
structure.push(String(node.kind));
|
|
48463
|
-
if (
|
|
48464
|
-
else if (
|
|
48465
|
-
else if (
|
|
48466
|
-
else if (
|
|
48467
|
-
else if (
|
|
48468
|
-
if (
|
|
48446
|
+
if (_react_doctor_require_typescript_default.isIdentifier(node)) structure.push(node.text);
|
|
48447
|
+
else if (_react_doctor_require_typescript_default.isStringLiteralLike(node)) structure.push(normalizeClassNames ? node.text.trim().split(/\s+/).sort().join(" ") : node.text);
|
|
48448
|
+
else if (_react_doctor_require_typescript_default.isNumericLiteral(node)) structure.push(node.text);
|
|
48449
|
+
else if (_react_doctor_require_typescript_default.isTemplateLiteralToken(node) || _react_doctor_require_typescript_default.isRegularExpressionLiteral(node) || _react_doctor_require_typescript_default.isBigIntLiteral(node)) structure.push(node.text);
|
|
48450
|
+
else if (_react_doctor_require_typescript_default.isJsxText(node)) structure.push(node.text.replace(/\s+/g, " ").trim());
|
|
48451
|
+
if (_react_doctor_require_typescript_default.isJsxAttribute(node) && _react_doctor_require_typescript_default.isIdentifier(node.name) && node.name.text === "className" && node.initializer && _react_doctor_require_typescript_default.isStringLiteral(node.initializer)) {
|
|
48469
48452
|
visitNode(node.name);
|
|
48470
48453
|
visitNode(node.initializer, true);
|
|
48471
48454
|
return;
|
|
48472
48455
|
}
|
|
48473
|
-
|
|
48456
|
+
_react_doctor_require_typescript_default.forEachChild(node, (childNode) => visitNode(childNode));
|
|
48474
48457
|
};
|
|
48475
48458
|
visitNode(sourceFile);
|
|
48476
48459
|
return structure.join("\0");
|
|
@@ -48484,8 +48467,8 @@ const buildScriptAnalysisKey = (scriptFile) => `${scriptFile.workingDirectory}\0
|
|
|
48484
48467
|
const resolveBuildReference = (reference, workingDirectory, projectRoot) => reference.startsWith("/") ? resolve(projectRoot, reference.replace(/^\/+/, "")) : resolve(workingDirectory, reference);
|
|
48485
48468
|
const getPropertyName$1 = (expression) => {
|
|
48486
48469
|
const unwrappedExpression = unwrapTypescriptExpression(expression);
|
|
48487
|
-
if (
|
|
48488
|
-
if (
|
|
48470
|
+
if (_react_doctor_require_typescript_default.isPropertyAccessExpression(unwrappedExpression)) return unwrappedExpression.name.text;
|
|
48471
|
+
if (_react_doctor_require_typescript_default.isElementAccessExpression(unwrappedExpression) && unwrappedExpression.argumentExpression && _react_doctor_require_typescript_default.isStringLiteralLike(unwrappedExpression.argumentExpression)) return unwrappedExpression.argumentExpression.text;
|
|
48489
48472
|
};
|
|
48490
48473
|
const resolveImportedScriptPath = (specifier, scriptFile, projectRoot) => {
|
|
48491
48474
|
const importedPath = specifier.startsWith(".") ? resolve(dirname(scriptFile.filePath), specifier) : specifier.startsWith("@/registry/") ? resolve(scriptFile.workingDirectory, "src/registry", specifier.slice(11)) : void 0;
|
|
@@ -48502,20 +48485,20 @@ const collectWebpackEntrySpecifiers = (filePath) => {
|
|
|
48502
48485
|
} catch {
|
|
48503
48486
|
return [];
|
|
48504
48487
|
}
|
|
48505
|
-
const sourceFile =
|
|
48488
|
+
const sourceFile = _react_doctor_require_typescript_default.createSourceFile(filePath, sourceText, _react_doctor_require_typescript_default.ScriptTarget.Latest, true, _react_doctor_require_typescript_default.ScriptKind.TS);
|
|
48506
48489
|
const specifiers = /* @__PURE__ */ new Set();
|
|
48507
48490
|
const collectStringLiterals = (node) => {
|
|
48508
|
-
if (
|
|
48491
|
+
if (_react_doctor_require_typescript_default.isStringLiteralLike(node) && node.text.startsWith(".")) {
|
|
48509
48492
|
specifiers.add(node.text);
|
|
48510
48493
|
return;
|
|
48511
48494
|
}
|
|
48512
|
-
|
|
48495
|
+
_react_doctor_require_typescript_default.forEachChild(node, collectStringLiterals);
|
|
48513
48496
|
};
|
|
48514
48497
|
const visitNode = (node) => {
|
|
48515
|
-
if (
|
|
48516
|
-
if (
|
|
48517
|
-
if (
|
|
48518
|
-
|
|
48498
|
+
if (_react_doctor_require_typescript_default.isPropertyAssignment(node) && (_react_doctor_require_typescript_default.isIdentifier(node.name) && node.name.text === "entry" || _react_doctor_require_typescript_default.isStringLiteralLike(node.name) && node.name.text === "entry")) collectStringLiterals(node.initializer);
|
|
48499
|
+
if (_react_doctor_require_typescript_default.isBinaryExpression(node) && node.operatorToken.kind === _react_doctor_require_typescript_default.SyntaxKind.EqualsToken && _react_doctor_require_typescript_default.isPropertyAccessExpression(node.left) && node.left.name.text === "entry") collectStringLiterals(node.right);
|
|
48500
|
+
if (_react_doctor_require_typescript_default.isCallExpression(node) && _react_doctor_require_typescript_default.isPropertyAccessExpression(node.expression) && node.expression.name.text === "concat" && node.getText(sourceFile).includes(".entry")) collectStringLiterals(node);
|
|
48501
|
+
_react_doctor_require_typescript_default.forEachChild(node, visitNode);
|
|
48519
48502
|
};
|
|
48520
48503
|
visitNode(sourceFile);
|
|
48521
48504
|
return [...specifiers];
|
|
@@ -48682,23 +48665,23 @@ const buildScriptAnalyses = (invokedScriptFiles, projectRoot) => {
|
|
|
48682
48665
|
} catch {
|
|
48683
48666
|
continue;
|
|
48684
48667
|
}
|
|
48685
|
-
const sourceFile =
|
|
48668
|
+
const sourceFile = _react_doctor_require_typescript_default.createSourceFile(scriptFile.filePath, content, _react_doctor_require_typescript_default.ScriptTarget.Latest, true, _react_doctor_require_typescript_default.ScriptKind.TS);
|
|
48686
48669
|
const localFunctions = /* @__PURE__ */ new Map();
|
|
48687
48670
|
const defaultExportExpressions = [];
|
|
48688
48671
|
for (const statement of sourceFile.statements) {
|
|
48689
|
-
if (
|
|
48672
|
+
if (_react_doctor_require_typescript_default.isFunctionDeclaration(statement) && statement.body) {
|
|
48690
48673
|
if (statement.name) localFunctions.set(statement.name.text, statement.body);
|
|
48691
|
-
if (statement.modifiers?.some((modifier) => modifier.kind ===
|
|
48674
|
+
if (statement.modifiers?.some((modifier) => modifier.kind === _react_doctor_require_typescript_default.SyntaxKind.DefaultKeyword)) localFunctions.set("default", statement.body);
|
|
48692
48675
|
}
|
|
48693
|
-
if (
|
|
48694
|
-
for (const declaration of statement.declarationList.declarations) if (
|
|
48676
|
+
if (_react_doctor_require_typescript_default.isVariableStatement(statement)) {
|
|
48677
|
+
for (const declaration of statement.declarationList.declarations) if (_react_doctor_require_typescript_default.isIdentifier(declaration.name) && declaration.initializer && (_react_doctor_require_typescript_default.isArrowFunction(declaration.initializer) || _react_doctor_require_typescript_default.isFunctionExpression(declaration.initializer))) localFunctions.set(declaration.name.text, declaration.initializer.body);
|
|
48695
48678
|
}
|
|
48696
|
-
if (
|
|
48679
|
+
if (_react_doctor_require_typescript_default.isExportAssignment(statement) && !statement.isExportEquals) defaultExportExpressions.push(statement.expression);
|
|
48697
48680
|
}
|
|
48698
48681
|
for (const defaultExportExpression of defaultExportExpressions) {
|
|
48699
48682
|
const unwrappedDefaultExport = unwrapTypescriptExpression(defaultExportExpression);
|
|
48700
|
-
if (
|
|
48701
|
-
else if (
|
|
48683
|
+
if (_react_doctor_require_typescript_default.isArrowFunction(unwrappedDefaultExport) || _react_doctor_require_typescript_default.isFunctionExpression(unwrappedDefaultExport)) localFunctions.set("default", unwrappedDefaultExport.body);
|
|
48684
|
+
else if (_react_doctor_require_typescript_default.isIdentifier(unwrappedDefaultExport)) {
|
|
48702
48685
|
const defaultFunctionBody = localFunctions.get(unwrappedDefaultExport.text);
|
|
48703
48686
|
if (defaultFunctionBody) localFunctions.set("default", defaultFunctionBody);
|
|
48704
48687
|
}
|
|
@@ -48712,7 +48695,7 @@ const buildScriptAnalyses = (invokedScriptFiles, projectRoot) => {
|
|
|
48712
48695
|
});
|
|
48713
48696
|
}
|
|
48714
48697
|
for (const analysis of analyses.values()) for (const statement of analysis.sourceFile.statements) {
|
|
48715
|
-
if (!
|
|
48698
|
+
if (!_react_doctor_require_typescript_default.isImportDeclaration(statement) || !_react_doctor_require_typescript_default.isStringLiteral(statement.moduleSpecifier)) continue;
|
|
48716
48699
|
const importClause = statement.importClause;
|
|
48717
48700
|
if (!importClause || importClause.isTypeOnly) continue;
|
|
48718
48701
|
const importedFilePath = resolveImportedScriptPath(statement.moduleSpecifier.text, analysis.scriptFile, projectRoot);
|
|
@@ -48726,7 +48709,7 @@ const buildScriptAnalyses = (invokedScriptFiles, projectRoot) => {
|
|
|
48726
48709
|
analysisKey: importedAnalysisKey,
|
|
48727
48710
|
exportName: "default"
|
|
48728
48711
|
});
|
|
48729
|
-
if (!importClause.namedBindings || !
|
|
48712
|
+
if (!importClause.namedBindings || !_react_doctor_require_typescript_default.isNamedImports(importClause.namedBindings)) continue;
|
|
48730
48713
|
for (const element of importClause.namedBindings.elements) {
|
|
48731
48714
|
if (element.isTypeOnly) continue;
|
|
48732
48715
|
analysis.importedFunctions.set(element.name.text, {
|
|
@@ -48748,11 +48731,11 @@ const buildScriptAnalyses = (invokedScriptFiles, projectRoot) => {
|
|
|
48748
48731
|
const visitLiveNode = (analysis, rootNode) => {
|
|
48749
48732
|
const visitNode = (node) => {
|
|
48750
48733
|
analysis.liveNodes.add(node);
|
|
48751
|
-
if (node !== rootNode && (
|
|
48752
|
-
if (
|
|
48734
|
+
if (node !== rootNode && (_react_doctor_require_typescript_default.isFunctionDeclaration(node) || _react_doctor_require_typescript_default.isFunctionExpression(node) || _react_doctor_require_typescript_default.isArrowFunction(node) || _react_doctor_require_typescript_default.isMethodDeclaration(node))) return;
|
|
48735
|
+
if (_react_doctor_require_typescript_default.isCallExpression(node)) {
|
|
48753
48736
|
const calledExpression = unwrapTypescriptExpression(node.expression);
|
|
48754
|
-
if (
|
|
48755
|
-
if (
|
|
48737
|
+
if (_react_doctor_require_typescript_default.isFunctionExpression(calledExpression) || _react_doctor_require_typescript_default.isArrowFunction(calledExpression)) queueFunctionBody(analysis, calledExpression.body);
|
|
48738
|
+
if (_react_doctor_require_typescript_default.isIdentifier(calledExpression)) {
|
|
48756
48739
|
const localFunctionBody = analysis.localFunctions.get(calledExpression.text);
|
|
48757
48740
|
if (localFunctionBody) queueFunctionBody(analysis, localFunctionBody);
|
|
48758
48741
|
const importedFunction = analysis.importedFunctions.get(calledExpression.text);
|
|
@@ -48762,10 +48745,10 @@ const buildScriptAnalyses = (invokedScriptFiles, projectRoot) => {
|
|
|
48762
48745
|
}
|
|
48763
48746
|
for (const argument of node.arguments) {
|
|
48764
48747
|
const unwrappedArgument = unwrapTypescriptExpression(argument);
|
|
48765
|
-
if (
|
|
48748
|
+
if (_react_doctor_require_typescript_default.isFunctionExpression(unwrappedArgument) || _react_doctor_require_typescript_default.isArrowFunction(unwrappedArgument)) queueFunctionBody(analysis, unwrappedArgument.body);
|
|
48766
48749
|
}
|
|
48767
48750
|
}
|
|
48768
|
-
|
|
48751
|
+
_react_doctor_require_typescript_default.forEachChild(node, visitNode);
|
|
48769
48752
|
};
|
|
48770
48753
|
visitNode(rootNode);
|
|
48771
48754
|
};
|
|
@@ -48790,18 +48773,18 @@ const findVariableDeclaration = (sourceFile, identifierName, usePosition) => {
|
|
|
48790
48773
|
let closestDeclaration;
|
|
48791
48774
|
const visitNode = (node) => {
|
|
48792
48775
|
if (node.getStart(sourceFile) >= usePosition) return;
|
|
48793
|
-
if (
|
|
48776
|
+
if (_react_doctor_require_typescript_default.isVariableDeclaration(node) && _react_doctor_require_typescript_default.isIdentifier(node.name)) {
|
|
48794
48777
|
if (node.name.text === identifierName) closestDeclaration = node;
|
|
48795
48778
|
}
|
|
48796
|
-
|
|
48779
|
+
_react_doctor_require_typescript_default.forEachChild(node, visitNode);
|
|
48797
48780
|
};
|
|
48798
48781
|
visitNode(sourceFile);
|
|
48799
48782
|
return closestDeclaration;
|
|
48800
48783
|
};
|
|
48801
48784
|
const evaluatePathExpression = (expression, analysis, projectRoot, seenIdentifiers = /* @__PURE__ */ new Set()) => {
|
|
48802
48785
|
const unwrappedExpression = unwrapTypescriptExpression(expression);
|
|
48803
|
-
if (
|
|
48804
|
-
if (
|
|
48786
|
+
if (_react_doctor_require_typescript_default.isStringLiteralLike(unwrappedExpression)) return resolveBuildReference(unwrappedExpression.text, analysis.scriptFile.workingDirectory, projectRoot);
|
|
48787
|
+
if (_react_doctor_require_typescript_default.isIdentifier(unwrappedExpression)) {
|
|
48805
48788
|
if (unwrappedExpression.text === "__dirname") return dirname(analysis.scriptFile.filePath);
|
|
48806
48789
|
if (seenIdentifiers.has(unwrappedExpression.text)) return void 0;
|
|
48807
48790
|
const declaration = findVariableDeclaration(analysis.sourceFile, unwrappedExpression.text, unwrappedExpression.getStart(analysis.sourceFile));
|
|
@@ -48810,8 +48793,8 @@ const evaluatePathExpression = (expression, analysis, projectRoot, seenIdentifie
|
|
|
48810
48793
|
nextSeenIdentifiers.add(unwrappedExpression.text);
|
|
48811
48794
|
return evaluatePathExpression(declaration.initializer, analysis, projectRoot, nextSeenIdentifiers);
|
|
48812
48795
|
}
|
|
48813
|
-
if (!
|
|
48814
|
-
if (
|
|
48796
|
+
if (!_react_doctor_require_typescript_default.isCallExpression(unwrappedExpression)) return void 0;
|
|
48797
|
+
if (_react_doctor_require_typescript_default.isPropertyAccessExpression(unwrappedExpression.expression) && _react_doctor_require_typescript_default.isIdentifier(unwrappedExpression.expression.expression) && unwrappedExpression.expression.expression.text === "process" && unwrappedExpression.expression.name.text === "cwd") return analysis.scriptFile.workingDirectory;
|
|
48815
48798
|
const pathMethodName = getPropertyName$1(unwrappedExpression.expression);
|
|
48816
48799
|
if (pathMethodName !== "join" && pathMethodName !== "resolve") return void 0;
|
|
48817
48800
|
const [baseExpression, ...segmentExpressions] = unwrappedExpression.arguments;
|
|
@@ -48821,7 +48804,7 @@ const evaluatePathExpression = (expression, analysis, projectRoot, seenIdentifie
|
|
|
48821
48804
|
const pathSegments = [];
|
|
48822
48805
|
for (const segmentExpression of segmentExpressions) {
|
|
48823
48806
|
const unwrappedSegment = unwrapTypescriptExpression(segmentExpression);
|
|
48824
|
-
if (!
|
|
48807
|
+
if (!_react_doctor_require_typescript_default.isStringLiteralLike(unwrappedSegment)) return void 0;
|
|
48825
48808
|
pathSegments.push(unwrappedSegment.text);
|
|
48826
48809
|
}
|
|
48827
48810
|
const rootRelativeSegment = pathSegments.find((pathSegment) => pathSegment.startsWith("/"));
|
|
@@ -48835,48 +48818,48 @@ const evaluatePathExpression = (expression, analysis, projectRoot, seenIdentifie
|
|
|
48835
48818
|
const expressionContainsIdentifier = (expression, identifierName) => {
|
|
48836
48819
|
let containsIdentifier = false;
|
|
48837
48820
|
const visitNode = (node) => {
|
|
48838
|
-
if (
|
|
48821
|
+
if (_react_doctor_require_typescript_default.isIdentifier(node) && node.text === identifierName) {
|
|
48839
48822
|
containsIdentifier = true;
|
|
48840
48823
|
return;
|
|
48841
48824
|
}
|
|
48842
|
-
if (!containsIdentifier)
|
|
48825
|
+
if (!containsIdentifier) _react_doctor_require_typescript_default.forEachChild(node, visitNode);
|
|
48843
48826
|
};
|
|
48844
48827
|
visitNode(expression);
|
|
48845
48828
|
return containsIdentifier;
|
|
48846
48829
|
};
|
|
48847
48830
|
const isConditionallyExecuted = (node, boundary) => {
|
|
48848
|
-
for (let ancestor = node.parent; ancestor && ancestor !== boundary; ancestor = ancestor.parent) if (
|
|
48831
|
+
for (let ancestor = node.parent; ancestor && ancestor !== boundary; ancestor = ancestor.parent) if (_react_doctor_require_typescript_default.isIfStatement(ancestor) || _react_doctor_require_typescript_default.isConditionalExpression(ancestor) || _react_doctor_require_typescript_default.isSwitchStatement(ancestor)) return true;
|
|
48849
48832
|
return false;
|
|
48850
48833
|
};
|
|
48851
48834
|
const analyzeDirectoryConsumer = (body, helperName, parameterName) => {
|
|
48852
48835
|
const directoryEntryCollectionNames = /* @__PURE__ */ new Set();
|
|
48853
48836
|
let unconditionallyConsumesEntries = false;
|
|
48854
48837
|
let recursivelyTraverses = false;
|
|
48855
|
-
const isDirectoryRead = (node) =>
|
|
48838
|
+
const isDirectoryRead = (node) => _react_doctor_require_typescript_default.isCallExpression(node) && getPropertyName$1(node.expression) === "readdirSync" && node.arguments[0] !== void 0 && _react_doctor_require_typescript_default.isIdentifier(unwrapTypescriptExpression(node.arguments[0])) && unwrapTypescriptExpression(node.arguments[0]).getText() === parameterName;
|
|
48856
48839
|
const visitNode = (node) => {
|
|
48857
|
-
if (
|
|
48858
|
-
if (
|
|
48840
|
+
if (_react_doctor_require_typescript_default.isVariableDeclaration(node) && _react_doctor_require_typescript_default.isIdentifier(node.name) && node.initializer && isDirectoryRead(unwrapTypescriptExpression(node.initializer))) directoryEntryCollectionNames.add(node.name.text);
|
|
48841
|
+
if (_react_doctor_require_typescript_default.isForOfStatement(node) && _react_doctor_require_typescript_default.isVariableDeclarationList(node.initializer)) {
|
|
48859
48842
|
const collectionExpression = unwrapTypescriptExpression(node.expression);
|
|
48860
|
-
if (isDirectoryRead(collectionExpression) ||
|
|
48843
|
+
if (isDirectoryRead(collectionExpression) || _react_doctor_require_typescript_default.isIdentifier(collectionExpression) && directoryEntryCollectionNames.has(collectionExpression.text)) {
|
|
48861
48844
|
const loopVariable = node.initializer.declarations[0]?.name;
|
|
48862
|
-
if (loopVariable &&
|
|
48845
|
+
if (loopVariable && _react_doctor_require_typescript_default.isIdentifier(loopVariable)) {
|
|
48863
48846
|
const entryDependentNames = new Set([loopVariable.text]);
|
|
48864
48847
|
const visitLoop = (loopNode) => {
|
|
48865
|
-
if (
|
|
48866
|
-
if (
|
|
48848
|
+
if (_react_doctor_require_typescript_default.isVariableDeclaration(loopNode) && _react_doctor_require_typescript_default.isIdentifier(loopNode.name) && loopNode.initializer && [...entryDependentNames].some((identifierName) => expressionContainsIdentifier(loopNode.initializer, identifierName))) entryDependentNames.add(loopNode.name.text);
|
|
48849
|
+
if (_react_doctor_require_typescript_default.isCallExpression(loopNode)) {
|
|
48867
48850
|
if (getPropertyName$1(loopNode.expression)?.match(/^(?:copyFile|readFile)(?:Sync)?$/) && loopNode.arguments.some((argument) => [...entryDependentNames].some((identifierName) => expressionContainsIdentifier(argument, identifierName)))) {
|
|
48868
48851
|
if (!isConditionallyExecuted(loopNode, node.statement)) unconditionallyConsumesEntries = true;
|
|
48869
48852
|
}
|
|
48870
48853
|
const calledExpression = unwrapTypescriptExpression(loopNode.expression);
|
|
48871
|
-
if (
|
|
48854
|
+
if (_react_doctor_require_typescript_default.isIdentifier(calledExpression) && calledExpression.text === helperName && loopNode.arguments.some((argument) => [...entryDependentNames].some((identifierName) => expressionContainsIdentifier(argument, identifierName)))) recursivelyTraverses = true;
|
|
48872
48855
|
}
|
|
48873
|
-
|
|
48856
|
+
_react_doctor_require_typescript_default.forEachChild(loopNode, visitLoop);
|
|
48874
48857
|
};
|
|
48875
48858
|
visitLoop(node.statement);
|
|
48876
48859
|
}
|
|
48877
48860
|
}
|
|
48878
48861
|
}
|
|
48879
|
-
|
|
48862
|
+
_react_doctor_require_typescript_default.forEachChild(node, visitNode);
|
|
48880
48863
|
};
|
|
48881
48864
|
visitNode(body);
|
|
48882
48865
|
return {
|
|
@@ -48886,11 +48869,11 @@ const analyzeDirectoryConsumer = (body, helperName, parameterName) => {
|
|
|
48886
48869
|
};
|
|
48887
48870
|
const collectRecursiveInputDirectories = (analysis, projectRoot, consumedFiles) => {
|
|
48888
48871
|
for (const node of analysis.liveNodes) {
|
|
48889
|
-
if (!
|
|
48872
|
+
if (!_react_doctor_require_typescript_default.isCallExpression(node) || !_react_doctor_require_typescript_default.isIdentifier(unwrapTypescriptExpression(node.expression))) continue;
|
|
48890
48873
|
const helperName = unwrapTypescriptExpression(node.expression).getText();
|
|
48891
48874
|
const helperBody = analysis.localFunctions.get(helperName);
|
|
48892
|
-
const helperDeclaration = [...analysis.sourceFile.statements].find((statement) =>
|
|
48893
|
-
if (!helperBody || !helperDeclaration || !
|
|
48875
|
+
const helperDeclaration = [...analysis.sourceFile.statements].find((statement) => _react_doctor_require_typescript_default.isFunctionDeclaration(statement) && statement.name?.text === helperName);
|
|
48876
|
+
if (!helperBody || !helperDeclaration || !_react_doctor_require_typescript_default.isFunctionDeclaration(helperDeclaration) || !helperDeclaration.parameters[0] || !_react_doctor_require_typescript_default.isIdentifier(helperDeclaration.parameters[0].name)) continue;
|
|
48894
48877
|
const directoryConsumption = analyzeDirectoryConsumer(helperBody, helperName, helperDeclaration.parameters[0].name.text);
|
|
48895
48878
|
if (!directoryConsumption.consumesAllEntries) continue;
|
|
48896
48879
|
const directoryArgument = node.arguments[0];
|
|
@@ -48901,9 +48884,9 @@ const collectRecursiveInputDirectories = (analysis, projectRoot, consumedFiles)
|
|
|
48901
48884
|
};
|
|
48902
48885
|
const evaluateCopySourceExpression = (expression, loopVariableName, loopVariableValue) => {
|
|
48903
48886
|
const unwrappedExpression = unwrapTypescriptExpression(expression);
|
|
48904
|
-
if (
|
|
48905
|
-
if (
|
|
48906
|
-
if (
|
|
48887
|
+
if (_react_doctor_require_typescript_default.isIdentifier(unwrappedExpression)) return unwrappedExpression.text === loopVariableName ? loopVariableValue : void 0;
|
|
48888
|
+
if (_react_doctor_require_typescript_default.isStringLiteralLike(unwrappedExpression)) return unwrappedExpression.text;
|
|
48889
|
+
if (_react_doctor_require_typescript_default.isTemplateExpression(unwrappedExpression)) {
|
|
48907
48890
|
let resolvedTemplate = unwrappedExpression.head.text;
|
|
48908
48891
|
for (const templateSpan of unwrappedExpression.templateSpans) {
|
|
48909
48892
|
const resolvedExpression = evaluateCopySourceExpression(templateSpan.expression, loopVariableName, loopVariableValue);
|
|
@@ -48912,7 +48895,7 @@ const evaluateCopySourceExpression = (expression, loopVariableName, loopVariable
|
|
|
48912
48895
|
}
|
|
48913
48896
|
return resolvedTemplate;
|
|
48914
48897
|
}
|
|
48915
|
-
if (
|
|
48898
|
+
if (_react_doctor_require_typescript_default.isBinaryExpression(unwrappedExpression) && unwrappedExpression.operatorToken.kind === _react_doctor_require_typescript_default.SyntaxKind.PlusToken) {
|
|
48916
48899
|
const leftValue = evaluateCopySourceExpression(unwrappedExpression.left, loopVariableName, loopVariableValue);
|
|
48917
48900
|
const rightValue = evaluateCopySourceExpression(unwrappedExpression.right, loopVariableName, loopVariableValue);
|
|
48918
48901
|
return leftValue === void 0 || rightValue === void 0 ? void 0 : `${leftValue}${rightValue}`;
|
|
@@ -48920,25 +48903,25 @@ const evaluateCopySourceExpression = (expression, loopVariableName, loopVariable
|
|
|
48920
48903
|
};
|
|
48921
48904
|
const collectCopiedSourceFiles = (analysis, projectRoot, consumedFiles) => {
|
|
48922
48905
|
for (const node of analysis.liveNodes) {
|
|
48923
|
-
if (!
|
|
48924
|
-
if (!
|
|
48906
|
+
if (!_react_doctor_require_typescript_default.isForOfStatement(node) || !analysis.liveNodes.has(node.statement)) continue;
|
|
48907
|
+
if (!_react_doctor_require_typescript_default.isVariableDeclarationList(node.initializer) || node.initializer.declarations.length !== 1 || !_react_doctor_require_typescript_default.isIdentifier(node.initializer.declarations[0].name) || !_react_doctor_require_typescript_default.isIdentifier(unwrapTypescriptExpression(node.expression))) continue;
|
|
48925
48908
|
const loopVariableName = node.initializer.declarations[0].name.text;
|
|
48926
48909
|
const arrayIdentifier = unwrapTypescriptExpression(node.expression);
|
|
48927
|
-
if (!
|
|
48910
|
+
if (!_react_doctor_require_typescript_default.isIdentifier(arrayIdentifier)) continue;
|
|
48928
48911
|
const arrayDeclaration = findVariableDeclaration(analysis.sourceFile, arrayIdentifier.text, node.getStart(analysis.sourceFile));
|
|
48929
|
-
if (!arrayDeclaration?.initializer || !
|
|
48912
|
+
if (!arrayDeclaration?.initializer || !_react_doctor_require_typescript_default.isArrayLiteralExpression(arrayDeclaration.initializer)) continue;
|
|
48930
48913
|
const values = arrayDeclaration.initializer.elements.flatMap((element) => {
|
|
48931
48914
|
const unwrappedElement = unwrapTypescriptExpression(element);
|
|
48932
|
-
return
|
|
48915
|
+
return _react_doctor_require_typescript_default.isStringLiteralLike(unwrappedElement) ? [unwrappedElement.text] : [];
|
|
48933
48916
|
});
|
|
48934
48917
|
const visitLoopBody = (loopNode) => {
|
|
48935
|
-
if (
|
|
48918
|
+
if (_react_doctor_require_typescript_default.isCallExpression(loopNode) && getPropertyName$1(loopNode.expression)?.match(/^copyFile(?:Sync)?$/) && loopNode.arguments[0]) for (const value of values) {
|
|
48936
48919
|
const sourceReference = evaluateCopySourceExpression(loopNode.arguments[0], loopVariableName, value);
|
|
48937
48920
|
if (!sourceReference) continue;
|
|
48938
48921
|
const sourcePath = resolveBuildReference(sourceReference, analysis.scriptFile.workingDirectory, projectRoot);
|
|
48939
48922
|
if (isPathInsideDirectoryOrEqual(sourcePath, projectRoot) && existsSync(sourcePath) && statSync(sourcePath).isFile() && SOURCE_FILE_EXTENSION_PATTERN.test(sourcePath)) consumedFiles.add(sourcePath);
|
|
48940
48923
|
}
|
|
48941
|
-
|
|
48924
|
+
_react_doctor_require_typescript_default.forEachChild(loopNode, visitLoopBody);
|
|
48942
48925
|
};
|
|
48943
48926
|
visitLoopBody(node.statement);
|
|
48944
48927
|
}
|
|
@@ -48947,56 +48930,56 @@ const expressionContainsString = (expression, value) => {
|
|
|
48947
48930
|
let containsString = false;
|
|
48948
48931
|
const visitNode = (node) => {
|
|
48949
48932
|
if (containsString) return;
|
|
48950
|
-
if (
|
|
48933
|
+
if (_react_doctor_require_typescript_default.isStringLiteralLike(node) && node.text === value) {
|
|
48951
48934
|
containsString = true;
|
|
48952
48935
|
return;
|
|
48953
48936
|
}
|
|
48954
|
-
|
|
48937
|
+
_react_doctor_require_typescript_default.forEachChild(node, visitNode);
|
|
48955
48938
|
};
|
|
48956
48939
|
visitNode(expression);
|
|
48957
48940
|
return containsString;
|
|
48958
48941
|
};
|
|
48959
48942
|
const collectObjectPathReferences = (expression, fileReferences) => {
|
|
48960
48943
|
const unwrappedExpression = unwrapTypescriptExpression(expression);
|
|
48961
|
-
if (
|
|
48944
|
+
if (_react_doctor_require_typescript_default.isStringLiteralLike(unwrappedExpression)) {
|
|
48962
48945
|
fileReferences.add(unwrappedExpression.text);
|
|
48963
48946
|
return;
|
|
48964
48947
|
}
|
|
48965
|
-
if (
|
|
48948
|
+
if (_react_doctor_require_typescript_default.isArrayLiteralExpression(unwrappedExpression)) {
|
|
48966
48949
|
for (const element of unwrappedExpression.elements) collectObjectPathReferences(element, fileReferences);
|
|
48967
48950
|
return;
|
|
48968
48951
|
}
|
|
48969
|
-
if (!
|
|
48952
|
+
if (!_react_doctor_require_typescript_default.isObjectLiteralExpression(unwrappedExpression)) return;
|
|
48970
48953
|
for (const property of unwrappedExpression.properties) {
|
|
48971
|
-
if (!
|
|
48972
|
-
if ((
|
|
48954
|
+
if (!_react_doctor_require_typescript_default.isPropertyAssignment(property)) continue;
|
|
48955
|
+
if ((_react_doctor_require_typescript_default.isIdentifier(property.name) || _react_doctor_require_typescript_default.isStringLiteralLike(property.name) ? property.name.text : void 0) === "path") collectObjectPathReferences(property.initializer, fileReferences);
|
|
48973
48956
|
}
|
|
48974
48957
|
};
|
|
48975
48958
|
const findStyleRegistryFanoutSources = (analysis, analyses) => {
|
|
48976
48959
|
for (const node of analysis.liveNodes) {
|
|
48977
|
-
if (!
|
|
48960
|
+
if (!_react_doctor_require_typescript_default.isForOfStatement(node) || !_react_doctor_require_typescript_default.isVariableDeclarationList(node.initializer) || node.initializer.declarations.length !== 1 || !_react_doctor_require_typescript_default.isIdentifier(node.initializer.declarations[0].name) || !_react_doctor_require_typescript_default.isIdentifier(unwrapTypescriptExpression(node.expression))) continue;
|
|
48978
48961
|
const styleVariableName = node.initializer.declarations[0].name.text;
|
|
48979
48962
|
const styleCollectionExpression = unwrapTypescriptExpression(node.expression);
|
|
48980
|
-
if (!
|
|
48963
|
+
if (!_react_doctor_require_typescript_default.isIdentifier(styleCollectionExpression)) continue;
|
|
48981
48964
|
const stylesImport = analysis.importedFunctions.get(styleCollectionExpression.text);
|
|
48982
48965
|
const stylesAnalysis = stylesImport ? analyses.get(stylesImport.analysisKey) : void 0;
|
|
48983
48966
|
if (!stylesAnalysis) continue;
|
|
48984
48967
|
let registryAnalysis;
|
|
48985
48968
|
const visitStyleLoop = (loopNode) => {
|
|
48986
|
-
if (registryAnalysis || !
|
|
48987
|
-
if (!registryAnalysis)
|
|
48969
|
+
if (registryAnalysis || !_react_doctor_require_typescript_default.isForOfStatement(loopNode)) {
|
|
48970
|
+
if (!registryAnalysis) _react_doctor_require_typescript_default.forEachChild(loopNode, visitStyleLoop);
|
|
48988
48971
|
return;
|
|
48989
48972
|
}
|
|
48990
|
-
if (!
|
|
48991
|
-
|
|
48973
|
+
if (!_react_doctor_require_typescript_default.isVariableDeclarationList(loopNode.initializer) || loopNode.initializer.declarations.length !== 1 || !_react_doctor_require_typescript_default.isIdentifier(loopNode.initializer.declarations[0].name) || !_react_doctor_require_typescript_default.isIdentifier(unwrapTypescriptExpression(loopNode.expression))) {
|
|
48974
|
+
_react_doctor_require_typescript_default.forEachChild(loopNode, visitStyleLoop);
|
|
48992
48975
|
return;
|
|
48993
48976
|
}
|
|
48994
48977
|
const registryItemName = loopNode.initializer.declarations[0].name.text;
|
|
48995
48978
|
const registryCollectionExpression = unwrapTypescriptExpression(loopNode.expression);
|
|
48996
|
-
if (!
|
|
48979
|
+
if (!_react_doctor_require_typescript_default.isIdentifier(registryCollectionExpression)) return;
|
|
48997
48980
|
const normalizedLoopBodyText = loopNode.statement.getText(analysis.sourceFile).replace(/\s/g, "");
|
|
48998
48981
|
if (!normalizedLoopBodyText.includes(`src/registry/\${${styleVariableName}.name}/`) || !normalizedLoopBodyText.includes(`${registryItemName}.files`) || !/\$\{[A-Za-z_$][\w$]*\.path\}/.test(normalizedLoopBodyText)) {
|
|
48999
|
-
|
|
48982
|
+
_react_doctor_require_typescript_default.forEachChild(loopNode, visitStyleLoop);
|
|
49000
48983
|
return;
|
|
49001
48984
|
}
|
|
49002
48985
|
const registryImport = analysis.importedFunctions.get(registryCollectionExpression.text);
|
|
@@ -49013,10 +48996,10 @@ const collectRegistryFileReferences = (registryAnalysis, analyses) => {
|
|
|
49013
48996
|
const registryFileReferences = /* @__PURE__ */ new Set();
|
|
49014
48997
|
const collectRegistryModule = (moduleAnalysis) => {
|
|
49015
48998
|
const visitNode = (node) => {
|
|
49016
|
-
if (
|
|
49017
|
-
if ((
|
|
48999
|
+
if (_react_doctor_require_typescript_default.isPropertyAssignment(node)) {
|
|
49000
|
+
if ((_react_doctor_require_typescript_default.isIdentifier(node.name) || _react_doctor_require_typescript_default.isStringLiteralLike(node.name) ? node.name.text : void 0) === "files") collectObjectPathReferences(node.initializer, registryFileReferences);
|
|
49018
49001
|
}
|
|
49019
|
-
|
|
49002
|
+
_react_doctor_require_typescript_default.forEachChild(node, visitNode);
|
|
49020
49003
|
};
|
|
49021
49004
|
visitNode(moduleAnalysis.sourceFile);
|
|
49022
49005
|
};
|
|
@@ -49030,11 +49013,11 @@ const collectRegistryFileReferences = (registryAnalysis, analyses) => {
|
|
|
49030
49013
|
const collectRegistryStyleNames = (stylesAnalysis) => {
|
|
49031
49014
|
const styleNames = /* @__PURE__ */ new Set();
|
|
49032
49015
|
const visitNode = (node) => {
|
|
49033
|
-
if (
|
|
49016
|
+
if (_react_doctor_require_typescript_default.isPropertyAssignment(node) && (_react_doctor_require_typescript_default.isIdentifier(node.name) || _react_doctor_require_typescript_default.isStringLiteralLike(node.name)) && node.name.text === "name") {
|
|
49034
49017
|
const styleNameExpression = unwrapTypescriptExpression(node.initializer);
|
|
49035
|
-
if (
|
|
49018
|
+
if (_react_doctor_require_typescript_default.isStringLiteralLike(styleNameExpression)) styleNames.add(styleNameExpression.text);
|
|
49036
49019
|
}
|
|
49037
|
-
|
|
49020
|
+
_react_doctor_require_typescript_default.forEachChild(node, visitNode);
|
|
49038
49021
|
};
|
|
49039
49022
|
visitNode(stylesAnalysis.sourceFile);
|
|
49040
49023
|
return styleNames;
|
|
@@ -49048,7 +49031,7 @@ const collectResolvedRegistryFiles = (registryFileReferences, styleNames, regist
|
|
|
49048
49031
|
const collectRegistryMetadataConsumedFiles = (analyses, projectRoot, consumedFiles) => {
|
|
49049
49032
|
for (const analysis of analyses.values()) {
|
|
49050
49033
|
if (!basename(analysis.scriptFile.filePath).includes("registry")) continue;
|
|
49051
|
-
if (![...analysis.liveNodes].some((node) =>
|
|
49034
|
+
if (![...analysis.liveNodes].some((node) => _react_doctor_require_typescript_default.isCallExpression(node) && getPropertyName$1(node.expression)?.match(/^readFile(?:Sync)?$/) && node.arguments[0] !== void 0 && expressionContainsString(node.arguments[0], "src/registry"))) continue;
|
|
49052
49035
|
const registryImport = analysis.importedFunctions.get("registry");
|
|
49053
49036
|
const stylesImport = analysis.importedFunctions.get("styles");
|
|
49054
49037
|
const registryAnalysis = registryImport ? analyses.get(registryImport.analysisKey) : void 0;
|
|
@@ -49069,7 +49052,7 @@ const nodeContainsNode = (rootNode, targetNode) => {
|
|
|
49069
49052
|
containsNode = true;
|
|
49070
49053
|
return;
|
|
49071
49054
|
}
|
|
49072
|
-
if (!containsNode)
|
|
49055
|
+
if (!containsNode) _react_doctor_require_typescript_default.forEachChild(node, visitNode);
|
|
49073
49056
|
};
|
|
49074
49057
|
visitNode(rootNode);
|
|
49075
49058
|
return containsNode;
|
|
@@ -49078,11 +49061,11 @@ const findAssignedVariableName = (analysis, targetNode) => {
|
|
|
49078
49061
|
let variableName;
|
|
49079
49062
|
let smallestInitializerWidth = Number.POSITIVE_INFINITY;
|
|
49080
49063
|
const visitNode = (node) => {
|
|
49081
|
-
if (
|
|
49064
|
+
if (_react_doctor_require_typescript_default.isVariableDeclaration(node) && _react_doctor_require_typescript_default.isIdentifier(node.name) && node.initializer && nodeContainsNode(node.initializer, targetNode) && node.initializer.end - node.initializer.pos < smallestInitializerWidth) {
|
|
49082
49065
|
variableName = node.name.text;
|
|
49083
49066
|
smallestInitializerWidth = node.initializer.end - node.initializer.pos;
|
|
49084
49067
|
}
|
|
49085
|
-
|
|
49068
|
+
_react_doctor_require_typescript_default.forEachChild(node, visitNode);
|
|
49086
49069
|
};
|
|
49087
49070
|
visitNode(analysis.sourceFile);
|
|
49088
49071
|
return variableName;
|
|
@@ -49090,29 +49073,29 @@ const findAssignedVariableName = (analysis, targetNode) => {
|
|
|
49090
49073
|
const recursivelyReadsManifestWildcards = (analysis, readCall) => {
|
|
49091
49074
|
const registryVariableName = findAssignedVariableName(analysis, readCall);
|
|
49092
49075
|
if (!registryVariableName) return false;
|
|
49093
|
-
const hasDirectRecursiveRead = [...analysis.liveNodes].some((node) =>
|
|
49076
|
+
const hasDirectRecursiveRead = [...analysis.liveNodes].some((node) => _react_doctor_require_typescript_default.isCallExpression(node) && _react_doctor_require_typescript_default.isIdentifier(unwrapTypescriptExpression(node.expression)) && unwrapTypescriptExpression(node.expression).getText() === "walk" && node.arguments.length >= 1 && _react_doctor_require_typescript_default.isIdentifier(unwrapTypescriptExpression(node.arguments[0])) && unwrapTypescriptExpression(node.arguments[0]).getText() === "sourceBase");
|
|
49094
49077
|
const sourceBaseDeclaration = findVariableDeclaration(analysis.sourceFile, "sourceBase", analysis.sourceFile.end);
|
|
49095
49078
|
if (hasDirectRecursiveRead && sourceBaseDeclaration?.initializer && sourceBaseDeclaration.initializer.getText(analysis.sourceFile).includes(registryVariableName) && sourceBaseDeclaration.initializer.getText(analysis.sourceFile).includes("split")) return true;
|
|
49096
49079
|
const collectionNames = new Set([registryVariableName]);
|
|
49097
|
-
for (const node of analysis.liveNodes) if (
|
|
49080
|
+
for (const node of analysis.liveNodes) if (_react_doctor_require_typescript_default.isVariableDeclaration(node) && _react_doctor_require_typescript_default.isIdentifier(node.name) && node.initializer && _react_doctor_require_typescript_default.isPropertyAccessExpression(unwrapTypescriptExpression(node.initializer))) {
|
|
49098
49081
|
const propertyAccess = unwrapTypescriptExpression(node.initializer);
|
|
49099
|
-
if (
|
|
49082
|
+
if (_react_doctor_require_typescript_default.isPropertyAccessExpression(propertyAccess) && _react_doctor_require_typescript_default.isIdentifier(propertyAccess.expression) && collectionNames.has(propertyAccess.expression.text)) collectionNames.add(node.name.text);
|
|
49100
49083
|
}
|
|
49101
49084
|
for (const node of analysis.liveNodes) {
|
|
49102
|
-
if (!
|
|
49085
|
+
if (!_react_doctor_require_typescript_default.isForOfStatement(node) || !_react_doctor_require_typescript_default.isVariableDeclarationList(node.initializer) || node.initializer.declarations.length !== 1 || !_react_doctor_require_typescript_default.isIdentifier(node.initializer.declarations[0].name) || !_react_doctor_require_typescript_default.isIdentifier(unwrapTypescriptExpression(node.expression))) continue;
|
|
49103
49086
|
const collectionExpression = unwrapTypescriptExpression(node.expression);
|
|
49104
|
-
if (!
|
|
49087
|
+
if (!_react_doctor_require_typescript_default.isIdentifier(collectionExpression) || !collectionNames.has(collectionExpression.text)) continue;
|
|
49105
49088
|
const componentName = node.initializer.declarations[0].name.text;
|
|
49106
49089
|
let hasRecursiveFileLoop = false;
|
|
49107
49090
|
const visitOuterLoop = (outerNode) => {
|
|
49108
|
-
if (
|
|
49091
|
+
if (_react_doctor_require_typescript_default.isForOfStatement(outerNode) && _react_doctor_require_typescript_default.isPropertyAccessExpression(unwrapTypescriptExpression(outerNode.expression))) {
|
|
49109
49092
|
const filesExpression = unwrapTypescriptExpression(outerNode.expression);
|
|
49110
|
-
if (
|
|
49093
|
+
if (_react_doctor_require_typescript_default.isPropertyAccessExpression(filesExpression) && _react_doctor_require_typescript_default.isIdentifier(filesExpression.expression) && filesExpression.expression.text === componentName && filesExpression.name.text === "files") {
|
|
49111
49094
|
const innerLoopText = outerNode.statement.getText(analysis.sourceFile);
|
|
49112
49095
|
if (/\.includes\(\s*["']\*["']\s*\)/.test(innerLoopText) && /\.split\(\s*["']\*["']\s*\)/.test(innerLoopText) && /\bwalk\s*\(\s*sourceBase\s*,\s*sourceBase\s*\)/.test(innerLoopText)) hasRecursiveFileLoop = true;
|
|
49113
49096
|
}
|
|
49114
49097
|
}
|
|
49115
|
-
if (!hasRecursiveFileLoop)
|
|
49098
|
+
if (!hasRecursiveFileLoop) _react_doctor_require_typescript_default.forEachChild(outerNode, visitOuterLoop);
|
|
49116
49099
|
};
|
|
49117
49100
|
visitOuterLoop(node.statement);
|
|
49118
49101
|
if (hasRecursiveFileLoop) return true;
|
|
@@ -49121,7 +49104,7 @@ const recursivelyReadsManifestWildcards = (analysis, readCall) => {
|
|
|
49121
49104
|
};
|
|
49122
49105
|
const collectReferencedManifestFiles = (analysis, projectRoot, consumedFiles) => {
|
|
49123
49106
|
for (const node of analysis.liveNodes) {
|
|
49124
|
-
if (!
|
|
49107
|
+
if (!_react_doctor_require_typescript_default.isCallExpression(node) || !getPropertyName$1(node.expression)?.match(/^readFile(?:Sync)?$/) || !node.arguments[0]) continue;
|
|
49125
49108
|
const manifestPath = evaluatePathExpression(node.arguments[0], analysis, projectRoot);
|
|
49126
49109
|
if (!manifestPath || basename(manifestPath) !== "registry.json") continue;
|
|
49127
49110
|
if (!isPathInsideDirectoryOrEqual(manifestPath, projectRoot)) continue;
|
|
@@ -49312,46 +49295,46 @@ const collectParcelHtmlEntryPaths = (rootDirectory) => {
|
|
|
49312
49295
|
} catch {
|
|
49313
49296
|
continue;
|
|
49314
49297
|
}
|
|
49315
|
-
const sourceFile =
|
|
49298
|
+
const sourceFile = _react_doctor_require_typescript_default.createSourceFile(scriptPath, sourceText, _react_doctor_require_typescript_default.ScriptTarget.Latest, true, _react_doctor_require_typescript_default.ScriptKind.TS);
|
|
49316
49299
|
const parcelConstructorNames = /* @__PURE__ */ new Set();
|
|
49317
49300
|
const variableInitializers = /* @__PURE__ */ new Map();
|
|
49318
49301
|
for (const statement of sourceFile.statements) {
|
|
49319
|
-
if (
|
|
49302
|
+
if (_react_doctor_require_typescript_default.isImportDeclaration(statement) && _react_doctor_require_typescript_default.isStringLiteralLike(statement.moduleSpecifier) && statement.moduleSpecifier.text === "parcel-bundler") {
|
|
49320
49303
|
const importClause = statement.importClause;
|
|
49321
49304
|
if (importClause?.name) parcelConstructorNames.add(importClause.name.text);
|
|
49322
49305
|
}
|
|
49323
|
-
if (!
|
|
49306
|
+
if (!_react_doctor_require_typescript_default.isVariableStatement(statement)) continue;
|
|
49324
49307
|
for (const declaration of statement.declarationList.declarations) {
|
|
49325
|
-
if (!
|
|
49308
|
+
if (!_react_doctor_require_typescript_default.isIdentifier(declaration.name) || !declaration.initializer) continue;
|
|
49326
49309
|
variableInitializers.set(declaration.name.text, declaration.initializer);
|
|
49327
|
-
if (
|
|
49310
|
+
if (_react_doctor_require_typescript_default.isCallExpression(declaration.initializer) && _react_doctor_require_typescript_default.isIdentifier(declaration.initializer.expression) && declaration.initializer.expression.text === "require" && declaration.initializer.arguments.length === 1 && _react_doctor_require_typescript_default.isStringLiteralLike(declaration.initializer.arguments[0]) && declaration.initializer.arguments[0].text === "parcel-bundler") parcelConstructorNames.add(declaration.name.text);
|
|
49328
49311
|
}
|
|
49329
49312
|
}
|
|
49330
49313
|
if (parcelConstructorNames.size === 0) continue;
|
|
49331
49314
|
const evaluateEntryExpression = (expression, visitedIdentifiers = /* @__PURE__ */ new Set()) => {
|
|
49332
|
-
if (
|
|
49333
|
-
if (
|
|
49334
|
-
if (
|
|
49315
|
+
if (_react_doctor_require_typescript_default.isStringLiteralLike(expression)) return [expression.text];
|
|
49316
|
+
if (_react_doctor_require_typescript_default.isArrayLiteralExpression(expression)) return expression.elements.flatMap((element) => _react_doctor_require_typescript_default.isExpression(element) ? evaluateEntryExpression(element, visitedIdentifiers) : []);
|
|
49317
|
+
if (_react_doctor_require_typescript_default.isIdentifier(expression)) {
|
|
49335
49318
|
if (visitedIdentifiers.has(expression.text)) return [];
|
|
49336
49319
|
const initializer = variableInitializers.get(expression.text);
|
|
49337
49320
|
if (!initializer) return [];
|
|
49338
49321
|
return evaluateEntryExpression(initializer, new Set(visitedIdentifiers).add(expression.text));
|
|
49339
49322
|
}
|
|
49340
|
-
if (
|
|
49341
|
-
const pathSegments = expression.arguments.slice(1).flatMap((argument) =>
|
|
49323
|
+
if (_react_doctor_require_typescript_default.isCallExpression(expression) && _react_doctor_require_typescript_default.isPropertyAccessExpression(expression.expression) && (expression.expression.name.text === "join" || expression.expression.name.text === "resolve") && expression.arguments.length > 1 && _react_doctor_require_typescript_default.isIdentifier(expression.arguments[0]) && expression.arguments[0].text === "__dirname" && expression.arguments.slice(1).every(_react_doctor_require_typescript_default.isStringLiteralLike)) {
|
|
49324
|
+
const pathSegments = expression.arguments.slice(1).flatMap((argument) => _react_doctor_require_typescript_default.isStringLiteralLike(argument) ? [argument.text] : []);
|
|
49342
49325
|
return [resolve(dirname(scriptPath), ...pathSegments)];
|
|
49343
49326
|
}
|
|
49344
49327
|
return [];
|
|
49345
49328
|
};
|
|
49346
49329
|
const visitNode = (node) => {
|
|
49347
|
-
if (
|
|
49330
|
+
if (_react_doctor_require_typescript_default.isNewExpression(node) && _react_doctor_require_typescript_default.isIdentifier(node.expression) && parcelConstructorNames.has(node.expression.text) && node.arguments?.[0]) for (const entrySpecifier of evaluateEntryExpression(node.arguments[0])) {
|
|
49348
49331
|
const entryPattern = isAbsolute(entrySpecifier) ? entrySpecifier : resolve(dirname(scriptPath), entrySpecifier);
|
|
49349
49332
|
for (const htmlEntryPath of import_out.default.sync(entryPattern.replaceAll("\\", "/"), {
|
|
49350
49333
|
absolute: true,
|
|
49351
49334
|
onlyFiles: true
|
|
49352
49335
|
})) if (/\.html?$/i.test(htmlEntryPath)) htmlEntryPaths.add(htmlEntryPath);
|
|
49353
49336
|
}
|
|
49354
|
-
|
|
49337
|
+
_react_doctor_require_typescript_default.forEachChild(node, visitNode);
|
|
49355
49338
|
};
|
|
49356
49339
|
visitNode(sourceFile);
|
|
49357
49340
|
}
|
|
@@ -49397,22 +49380,22 @@ const isConsumedStringLiteral = (node) => {
|
|
|
49397
49380
|
let currentNode = node;
|
|
49398
49381
|
while (currentNode.parent) {
|
|
49399
49382
|
const parentNode = currentNode.parent;
|
|
49400
|
-
if (
|
|
49401
|
-
if (
|
|
49383
|
+
if (_react_doctor_require_typescript_default.isCallExpression(parentNode) || _react_doctor_require_typescript_default.isNewExpression(parentNode) || _react_doctor_require_typescript_default.isPropertyAssignment(parentNode) || _react_doctor_require_typescript_default.isExportAssignment(parentNode) || _react_doctor_require_typescript_default.isReturnStatement(parentNode)) return true;
|
|
49384
|
+
if (_react_doctor_require_typescript_default.isVariableDeclaration(parentNode) || _react_doctor_require_typescript_default.isExpressionStatement(parentNode) || _react_doctor_require_typescript_default.isSourceFile(parentNode)) return false;
|
|
49402
49385
|
currentNode = parentNode;
|
|
49403
49386
|
}
|
|
49404
49387
|
return false;
|
|
49405
49388
|
};
|
|
49406
49389
|
const matchesExecutableNodeModulesPackageReference = (content, packageName) => {
|
|
49407
|
-
const sourceFile =
|
|
49390
|
+
const sourceFile = _react_doctor_require_typescript_default.createSourceFile("node-modules-reference.ts", content, _react_doctor_require_typescript_default.ScriptTarget.Latest, true, _react_doctor_require_typescript_default.ScriptKind.TS);
|
|
49408
49391
|
let isMatched = false;
|
|
49409
49392
|
const visit = (node) => {
|
|
49410
49393
|
if (isMatched) return;
|
|
49411
|
-
if (
|
|
49394
|
+
if (_react_doctor_require_typescript_default.isStringLiteralLike(node) && isConsumedStringLiteral(node) && matchesNodeModulesPackageReference(node.text, packageName)) {
|
|
49412
49395
|
isMatched = true;
|
|
49413
49396
|
return;
|
|
49414
49397
|
}
|
|
49415
|
-
|
|
49398
|
+
_react_doctor_require_typescript_default.forEachChild(node, visit);
|
|
49416
49399
|
};
|
|
49417
49400
|
visit(sourceFile);
|
|
49418
49401
|
return isMatched;
|
|
@@ -49472,14 +49455,14 @@ const collectTwoslashPackageNames = (sourceText) => {
|
|
|
49472
49455
|
const packageNames = /* @__PURE__ */ new Set();
|
|
49473
49456
|
for (const source of sources) try {
|
|
49474
49457
|
for (const packageName of collectStaticModulePackageNames(source)) packageNames.add(packageName);
|
|
49475
|
-
const sourceFile =
|
|
49458
|
+
const sourceFile = _react_doctor_require_typescript_default.createSourceFile("twoslash-source.js", source, _react_doctor_require_typescript_default.ScriptTarget.Latest, true, _react_doctor_require_typescript_default.ScriptKind.JS);
|
|
49476
49459
|
const visitNode = (node) => {
|
|
49477
|
-
for (const tag of
|
|
49478
|
-
if (!
|
|
49460
|
+
for (const tag of _react_doctor_require_typescript_default.getJSDocTags(node)) {
|
|
49461
|
+
if (!_react_doctor_require_typescript_default.isJSDocImportTag(tag) || !_react_doctor_require_typescript_default.isStringLiteralLike(tag.moduleSpecifier)) continue;
|
|
49479
49462
|
const packageName = extractPackageName(tag.moduleSpecifier.text);
|
|
49480
49463
|
if (packageName) packageNames.add(packageName);
|
|
49481
49464
|
}
|
|
49482
|
-
|
|
49465
|
+
_react_doctor_require_typescript_default.forEachChild(node, visitNode);
|
|
49483
49466
|
};
|
|
49484
49467
|
visitNode(sourceFile);
|
|
49485
49468
|
} catch {
|
|
@@ -49533,27 +49516,27 @@ const KARMA_BROWSER_PACKAGES = new Map([
|
|
|
49533
49516
|
["Safari", ["karma-safari-launcher"]]
|
|
49534
49517
|
]);
|
|
49535
49518
|
const collectExpressionStrings = (expression, identifierStrings, strings) => {
|
|
49536
|
-
if (
|
|
49519
|
+
if (_react_doctor_require_typescript_default.isStringLiteralLike(expression)) {
|
|
49537
49520
|
strings.add(expression.text);
|
|
49538
49521
|
return;
|
|
49539
49522
|
}
|
|
49540
|
-
if (
|
|
49523
|
+
if (_react_doctor_require_typescript_default.isIdentifier(expression)) {
|
|
49541
49524
|
for (const value of identifierStrings.get(expression.text) ?? []) strings.add(value);
|
|
49542
49525
|
return;
|
|
49543
49526
|
}
|
|
49544
|
-
if (
|
|
49545
|
-
for (const element of expression.elements) if (
|
|
49527
|
+
if (_react_doctor_require_typescript_default.isArrayLiteralExpression(expression)) {
|
|
49528
|
+
for (const element of expression.elements) if (_react_doctor_require_typescript_default.isSpreadElement(element)) collectExpressionStrings(element.expression, identifierStrings, strings);
|
|
49546
49529
|
else collectExpressionStrings(element, identifierStrings, strings);
|
|
49547
49530
|
return;
|
|
49548
49531
|
}
|
|
49549
|
-
if (
|
|
49532
|
+
if (_react_doctor_require_typescript_default.isConditionalExpression(expression)) {
|
|
49550
49533
|
collectExpressionStrings(expression.whenTrue, identifierStrings, strings);
|
|
49551
49534
|
collectExpressionStrings(expression.whenFalse, identifierStrings, strings);
|
|
49552
49535
|
return;
|
|
49553
49536
|
}
|
|
49554
|
-
if (
|
|
49555
|
-
for (const property of expression.properties) if (
|
|
49556
|
-
else if (
|
|
49537
|
+
if (_react_doctor_require_typescript_default.isObjectLiteralExpression(expression)) {
|
|
49538
|
+
for (const property of expression.properties) if (_react_doctor_require_typescript_default.isPropertyAssignment(property)) collectExpressionStrings(property.initializer, identifierStrings, strings);
|
|
49539
|
+
else if (_react_doctor_require_typescript_default.isShorthandPropertyAssignment(property)) for (const value of identifierStrings.get(property.name.text) ?? []) strings.add(value);
|
|
49557
49540
|
}
|
|
49558
49541
|
};
|
|
49559
49542
|
const collectIdentifierStrings = (sourceFile) => {
|
|
@@ -49564,21 +49547,21 @@ const collectIdentifierStrings = (sourceFile) => {
|
|
|
49564
49547
|
identifierStrings.set(identifierName, strings);
|
|
49565
49548
|
};
|
|
49566
49549
|
const visit = (node) => {
|
|
49567
|
-
if (
|
|
49568
|
-
if (
|
|
49569
|
-
|
|
49550
|
+
if (_react_doctor_require_typescript_default.isVariableDeclaration(node) && _react_doctor_require_typescript_default.isIdentifier(node.name) && node.initializer) addExpression(node.name.text, node.initializer);
|
|
49551
|
+
if (_react_doctor_require_typescript_default.isBinaryExpression(node) && node.operatorToken.kind === _react_doctor_require_typescript_default.SyntaxKind.EqualsToken && _react_doctor_require_typescript_default.isIdentifier(node.left)) addExpression(node.left.text, node.right);
|
|
49552
|
+
_react_doctor_require_typescript_default.forEachChild(node, visit);
|
|
49570
49553
|
};
|
|
49571
49554
|
visit(sourceFile);
|
|
49572
49555
|
return identifierStrings;
|
|
49573
49556
|
};
|
|
49574
49557
|
const collectPropertyStrings = (property, identifierStrings) => {
|
|
49575
49558
|
const strings = /* @__PURE__ */ new Set();
|
|
49576
|
-
if (
|
|
49577
|
-
else if (
|
|
49559
|
+
if (_react_doctor_require_typescript_default.isPropertyAssignment(property)) collectExpressionStrings(property.initializer, identifierStrings, strings);
|
|
49560
|
+
else if (_react_doctor_require_typescript_default.isShorthandPropertyAssignment(property)) for (const value of identifierStrings.get(property.name.text) ?? []) strings.add(value);
|
|
49578
49561
|
return strings;
|
|
49579
49562
|
};
|
|
49580
49563
|
const extractKarmaConfigPackageReferences = (content, declaredPackageNames) => {
|
|
49581
|
-
const sourceFile =
|
|
49564
|
+
const sourceFile = _react_doctor_require_typescript_default.createSourceFile("karma.config.ts", content, _react_doctor_require_typescript_default.ScriptTarget.Latest, true, _react_doctor_require_typescript_default.ScriptKind.TS);
|
|
49582
49565
|
const identifierStrings = collectIdentifierStrings(sourceFile);
|
|
49583
49566
|
const referencedPackages = /* @__PURE__ */ new Set();
|
|
49584
49567
|
const propertyPackageMaps = new Map([
|
|
@@ -49588,12 +49571,12 @@ const extractKarmaConfigPackageReferences = (content, declaredPackageNames) => {
|
|
|
49588
49571
|
["browsers", KARMA_BROWSER_PACKAGES]
|
|
49589
49572
|
]);
|
|
49590
49573
|
const visit = (node) => {
|
|
49591
|
-
if (
|
|
49574
|
+
if (_react_doctor_require_typescript_default.isObjectLiteralExpression(node)) for (const property of node.properties) {
|
|
49592
49575
|
const packageMap = propertyPackageMaps.get(getObjectLiteralElementName(property) ?? "");
|
|
49593
49576
|
if (!packageMap) continue;
|
|
49594
49577
|
for (const token of collectPropertyStrings(property, identifierStrings)) for (const packageName of packageMap.get(token) ?? []) if (declaredPackageNames.has(packageName)) referencedPackages.add(packageName);
|
|
49595
49578
|
}
|
|
49596
|
-
|
|
49579
|
+
_react_doctor_require_typescript_default.forEachChild(node, visit);
|
|
49597
49580
|
};
|
|
49598
49581
|
visit(sourceFile);
|
|
49599
49582
|
return [...referencedPackages];
|
|
@@ -49610,23 +49593,23 @@ const hasExpoReactServerFunctions = (rootDirectory) => {
|
|
|
49610
49593
|
//#endregion
|
|
49611
49594
|
//#region ../core/src/project-analysis/utils/has-antfu-eslint-react-config.ts
|
|
49612
49595
|
const hasReactEnabled = (expression) => {
|
|
49613
|
-
if (!
|
|
49614
|
-
return expression.properties.some((property) =>
|
|
49596
|
+
if (!_react_doctor_require_typescript_default.isObjectLiteralExpression(expression)) return false;
|
|
49597
|
+
return expression.properties.some((property) => _react_doctor_require_typescript_default.isPropertyAssignment(property) && (_react_doctor_require_typescript_default.isIdentifier(property.name) && property.name.text === "react" || _react_doctor_require_typescript_default.isStringLiteralLike(property.name) && property.name.text === "react") && (property.initializer.kind === _react_doctor_require_typescript_default.SyntaxKind.TrueKeyword || _react_doctor_require_typescript_default.isObjectLiteralExpression(property.initializer)));
|
|
49615
49598
|
};
|
|
49616
49599
|
const hasAntfuEslintReactConfig = (content) => {
|
|
49617
49600
|
const virtualFilePath = "eslint.config.ts";
|
|
49618
|
-
const sourceFile =
|
|
49601
|
+
const sourceFile = _react_doctor_require_typescript_default.createSourceFile(virtualFilePath, content, _react_doctor_require_typescript_default.ScriptTarget.Latest, true, _react_doctor_require_typescript_default.ScriptKind.TS);
|
|
49619
49602
|
const compilerOptions = {
|
|
49620
49603
|
allowJs: true,
|
|
49621
49604
|
noLib: true,
|
|
49622
49605
|
noResolve: true,
|
|
49623
|
-
target:
|
|
49606
|
+
target: _react_doctor_require_typescript_default.ScriptTarget.Latest
|
|
49624
49607
|
};
|
|
49625
|
-
const compilerHost =
|
|
49608
|
+
const compilerHost = _react_doctor_require_typescript_default.createCompilerHost(compilerOptions);
|
|
49626
49609
|
compilerHost.fileExists = (candidatePath) => candidatePath === virtualFilePath;
|
|
49627
49610
|
compilerHost.getSourceFile = (candidatePath) => candidatePath === virtualFilePath ? sourceFile : void 0;
|
|
49628
49611
|
compilerHost.readFile = (candidatePath) => candidatePath === virtualFilePath ? content : void 0;
|
|
49629
|
-
const program =
|
|
49612
|
+
const program = _react_doctor_require_typescript_default.createProgram({
|
|
49630
49613
|
rootNames: [virtualFilePath],
|
|
49631
49614
|
options: compilerOptions,
|
|
49632
49615
|
host: compilerHost
|
|
@@ -49636,24 +49619,24 @@ const hasAntfuEslintReactConfig = (content) => {
|
|
|
49636
49619
|
const typeChecker = program.getTypeChecker();
|
|
49637
49620
|
const antfuFactorySymbols = /* @__PURE__ */ new Set();
|
|
49638
49621
|
for (const statement of boundSourceFile.statements) {
|
|
49639
|
-
if (!
|
|
49622
|
+
if (!_react_doctor_require_typescript_default.isImportDeclaration(statement) || !_react_doctor_require_typescript_default.isStringLiteralLike(statement.moduleSpecifier) || statement.moduleSpecifier.text !== "@antfu/eslint-config" || !statement.importClause?.name) continue;
|
|
49640
49623
|
const factorySymbol = typeChecker.getSymbolAtLocation(statement.importClause.name);
|
|
49641
49624
|
if (factorySymbol) antfuFactorySymbols.add(factorySymbol);
|
|
49642
49625
|
}
|
|
49643
49626
|
let isReactEnabled = false;
|
|
49644
49627
|
const visit = (node) => {
|
|
49645
49628
|
if (isReactEnabled) return;
|
|
49646
|
-
if (
|
|
49647
|
-
if (
|
|
49629
|
+
if (_react_doctor_require_typescript_default.isFunctionLike(node)) return;
|
|
49630
|
+
if (_react_doctor_require_typescript_default.isCallExpression(node) && node.arguments[0] && hasReactEnabled(node.arguments[0])) {
|
|
49648
49631
|
const factorySymbol = typeChecker.getSymbolAtLocation(node.expression);
|
|
49649
49632
|
if (factorySymbol && antfuFactorySymbols.has(factorySymbol)) {
|
|
49650
49633
|
isReactEnabled = true;
|
|
49651
49634
|
return;
|
|
49652
49635
|
}
|
|
49653
49636
|
}
|
|
49654
|
-
|
|
49637
|
+
_react_doctor_require_typescript_default.forEachChild(node, visit);
|
|
49655
49638
|
};
|
|
49656
|
-
for (const statement of boundSourceFile.statements) if (
|
|
49639
|
+
for (const statement of boundSourceFile.statements) if (_react_doctor_require_typescript_default.isExportAssignment(statement)) visit(statement.expression);
|
|
49657
49640
|
return isReactEnabled;
|
|
49658
49641
|
};
|
|
49659
49642
|
//#endregion
|
|
@@ -51106,32 +51089,32 @@ const SUPPORTED_GLOBAL_VALUES = new Set([
|
|
|
51106
51089
|
"writeable"
|
|
51107
51090
|
]);
|
|
51108
51091
|
const getStaticProperty = (objectExpression, propertyName) => objectExpression.properties.find((property) => {
|
|
51109
|
-
if (
|
|
51110
|
-
const name =
|
|
51111
|
-
return (
|
|
51092
|
+
if (_react_doctor_require_typescript_default.isSpreadAssignment(property)) return false;
|
|
51093
|
+
const name = _react_doctor_require_typescript_default.isComputedPropertyName(property.name) ? unwrapTypescriptExpression(property.name.expression) : property.name;
|
|
51094
|
+
return (_react_doctor_require_typescript_default.isIdentifier(name) || _react_doctor_require_typescript_default.isStringLiteralLike(name)) && name.text === propertyName;
|
|
51112
51095
|
}) ?? null;
|
|
51113
|
-
const hasNonLiteralComputedProperty = (objectExpression) => objectExpression.properties.some((property) => !
|
|
51096
|
+
const hasNonLiteralComputedProperty = (objectExpression) => objectExpression.properties.some((property) => !_react_doctor_require_typescript_default.isSpreadAssignment(property) && _react_doctor_require_typescript_default.isComputedPropertyName(property.name) && !_react_doctor_require_typescript_default.isStringLiteralLike(unwrapTypescriptExpression(property.name.expression)));
|
|
51114
51097
|
const getStaticPropertyAssignment = (objectExpression, propertyName) => {
|
|
51115
51098
|
const property = getStaticProperty(objectExpression, propertyName);
|
|
51116
|
-
return property &&
|
|
51099
|
+
return property && _react_doctor_require_typescript_default.isPropertyAssignment(property) ? property : null;
|
|
51117
51100
|
};
|
|
51118
51101
|
const getRequireModuleSpecifier = (expression) => {
|
|
51119
51102
|
const unwrappedExpression = unwrapTypescriptExpression(expression);
|
|
51120
|
-
if (
|
|
51121
|
-
if (!
|
|
51103
|
+
if (_react_doctor_require_typescript_default.isPropertyAccessExpression(unwrappedExpression) && unwrappedExpression.name.text === "default") return getRequireModuleSpecifier(unwrappedExpression.expression);
|
|
51104
|
+
if (!_react_doctor_require_typescript_default.isCallExpression(unwrappedExpression) || !_react_doctor_require_typescript_default.isIdentifier(unwrappedExpression.expression) || unwrappedExpression.expression.text !== "require" || unwrappedExpression.arguments.length !== 1) return null;
|
|
51122
51105
|
const moduleSpecifier = unwrappedExpression.arguments[0];
|
|
51123
|
-
return moduleSpecifier &&
|
|
51106
|
+
return moduleSpecifier && _react_doctor_require_typescript_default.isStringLiteralLike(moduleSpecifier) ? moduleSpecifier.text : null;
|
|
51124
51107
|
};
|
|
51125
51108
|
const getRequiredPropertyModuleSpecifier = (expression, propertyName) => {
|
|
51126
51109
|
const unwrappedExpression = unwrapTypescriptExpression(expression);
|
|
51127
|
-
return
|
|
51110
|
+
return _react_doctor_require_typescript_default.isPropertyAccessExpression(unwrappedExpression) && unwrappedExpression.name.text === propertyName ? getRequireModuleSpecifier(unwrappedExpression.expression) : null;
|
|
51128
51111
|
};
|
|
51129
|
-
const isCommonJsExportAssignment = (node, sourceFile) =>
|
|
51112
|
+
const isCommonJsExportAssignment = (node, sourceFile) => _react_doctor_require_typescript_default.isBinaryExpression(node) && node.operatorToken.kind === _react_doctor_require_typescript_default.SyntaxKind.EqualsToken && (node.left.getText(sourceFile) === "module.exports" || node.left.getText(sourceFile) === "exports.default");
|
|
51130
51113
|
const isTopLevelExpression = (node) => {
|
|
51131
51114
|
let ancestor = node.parent;
|
|
51132
|
-
while (ancestor && !
|
|
51133
|
-
if (
|
|
51134
|
-
if (!
|
|
51115
|
+
while (ancestor && !_react_doctor_require_typescript_default.isSourceFile(ancestor)) {
|
|
51116
|
+
if (_react_doctor_require_typescript_default.isExpressionStatement(ancestor)) return _react_doctor_require_typescript_default.isSourceFile(ancestor.parent);
|
|
51117
|
+
if (!_react_doctor_require_typescript_default.isParenthesizedExpression(ancestor) && !_react_doctor_require_typescript_default.isAsExpression(ancestor) && !_react_doctor_require_typescript_default.isSatisfiesExpression(ancestor) && !_react_doctor_require_typescript_default.isNonNullExpression(ancestor) && !_react_doctor_require_typescript_default.isTypeAssertionExpression(ancestor) && !_react_doctor_require_typescript_default.isAwaitExpression(ancestor)) return false;
|
|
51135
51118
|
ancestor = ancestor.parent;
|
|
51136
51119
|
}
|
|
51137
51120
|
return false;
|
|
@@ -51139,21 +51122,21 @@ const isTopLevelExpression = (node) => {
|
|
|
51139
51122
|
const isInsideActiveConfigProperty = (node, propertyName, sourceFile, esbuildBindings, esbuildNamespaceBindings) => {
|
|
51140
51123
|
let ancestor = node.parent;
|
|
51141
51124
|
let didFindConfigProperty = false;
|
|
51142
|
-
while (ancestor && !
|
|
51143
|
-
if (!didFindConfigProperty && !
|
|
51144
|
-
if (
|
|
51145
|
-
const isConfigProperty = (
|
|
51125
|
+
while (ancestor && !_react_doctor_require_typescript_default.isSourceFile(ancestor)) {
|
|
51126
|
+
if (!didFindConfigProperty && !_react_doctor_require_typescript_default.isArrayLiteralExpression(ancestor) && !_react_doctor_require_typescript_default.isParenthesizedExpression(ancestor) && !_react_doctor_require_typescript_default.isAsExpression(ancestor) && !_react_doctor_require_typescript_default.isSatisfiesExpression(ancestor) && !_react_doctor_require_typescript_default.isNonNullExpression(ancestor) && !_react_doctor_require_typescript_default.isTypeAssertionExpression(ancestor) && !_react_doctor_require_typescript_default.isPropertyAssignment(ancestor)) return false;
|
|
51127
|
+
if (_react_doctor_require_typescript_default.isPropertyAssignment(ancestor)) {
|
|
51128
|
+
const isConfigProperty = (_react_doctor_require_typescript_default.isIdentifier(ancestor.name) || _react_doctor_require_typescript_default.isStringLiteralLike(ancestor.name)) && ancestor.name.text === propertyName;
|
|
51146
51129
|
if (didFindConfigProperty || !isConfigProperty) return false;
|
|
51147
|
-
if (!
|
|
51130
|
+
if (!_react_doctor_require_typescript_default.isObjectLiteralExpression(ancestor.parent) || ancestor.parent.properties.some(_react_doctor_require_typescript_default.isSpreadAssignment)) return false;
|
|
51148
51131
|
didFindConfigProperty = true;
|
|
51149
51132
|
ancestor = ancestor.parent;
|
|
51150
51133
|
continue;
|
|
51151
51134
|
}
|
|
51152
51135
|
if (didFindConfigProperty) {
|
|
51153
|
-
if (
|
|
51136
|
+
if (_react_doctor_require_typescript_default.isExportAssignment(ancestor)) return true;
|
|
51154
51137
|
if (isCommonJsExportAssignment(ancestor, sourceFile)) return isTopLevelExpression(ancestor);
|
|
51155
|
-
if (propertyName === "plugins" &&
|
|
51156
|
-
if (!(
|
|
51138
|
+
if (propertyName === "plugins" && _react_doctor_require_typescript_default.isCallExpression(ancestor) && (_react_doctor_require_typescript_default.isIdentifier(ancestor.expression) ? esbuildBindings.has(ancestor.expression.text) : _react_doctor_require_typescript_default.isPropertyAccessExpression(ancestor.expression) && ancestor.expression.name.text === "build" && (_react_doctor_require_typescript_default.isIdentifier(ancestor.expression.expression) && esbuildNamespaceBindings.has(ancestor.expression.expression.text) || getRequireModuleSpecifier(ancestor.expression.expression) === "esbuild"))) return isTopLevelExpression(ancestor);
|
|
51139
|
+
if (!(_react_doctor_require_typescript_default.isObjectLiteralExpression(ancestor) || _react_doctor_require_typescript_default.isParenthesizedExpression(ancestor) || _react_doctor_require_typescript_default.isAsExpression(ancestor) || _react_doctor_require_typescript_default.isSatisfiesExpression(ancestor) || _react_doctor_require_typescript_default.isNonNullExpression(ancestor) || _react_doctor_require_typescript_default.isTypeAssertionExpression(ancestor) || _react_doctor_require_typescript_default.isCallExpression(ancestor) && _react_doctor_require_typescript_default.isIdentifier(ancestor.expression) && ancestor.expression.text === "defineConfig")) return false;
|
|
51157
51140
|
}
|
|
51158
51141
|
ancestor = ancestor.parent;
|
|
51159
51142
|
}
|
|
@@ -51163,21 +51146,21 @@ const getGlobalsPathFromActiveAutoImportCall = (callExpression, packageDirectory
|
|
|
51163
51146
|
const optionsExpression = callExpression.arguments[0];
|
|
51164
51147
|
if (!optionsExpression) return null;
|
|
51165
51148
|
const unwrappedOptions = unwrapTypescriptExpression(optionsExpression);
|
|
51166
|
-
if (!
|
|
51167
|
-
if (unwrappedOptions.properties.some(
|
|
51149
|
+
if (!_react_doctor_require_typescript_default.isObjectLiteralExpression(unwrappedOptions)) return null;
|
|
51150
|
+
if (unwrappedOptions.properties.some(_react_doctor_require_typescript_default.isSpreadAssignment) || hasNonLiteralComputedProperty(unwrappedOptions)) return null;
|
|
51168
51151
|
if (getStaticProperty(unwrappedOptions, "include") || getStaticProperty(unwrappedOptions, "exclude")) return null;
|
|
51169
51152
|
const eslintrcProperty = getStaticPropertyAssignment(unwrappedOptions, "eslintrc");
|
|
51170
51153
|
if (!eslintrcProperty) return null;
|
|
51171
51154
|
const eslintrcExpression = unwrapTypescriptExpression(eslintrcProperty.initializer);
|
|
51172
|
-
if (!
|
|
51173
|
-
if (eslintrcExpression.properties.some(
|
|
51155
|
+
if (!_react_doctor_require_typescript_default.isObjectLiteralExpression(eslintrcExpression)) return null;
|
|
51156
|
+
if (eslintrcExpression.properties.some(_react_doctor_require_typescript_default.isSpreadAssignment) || hasNonLiteralComputedProperty(eslintrcExpression)) return null;
|
|
51174
51157
|
const enabledProperty = getStaticPropertyAssignment(eslintrcExpression, "enabled");
|
|
51175
|
-
if (!enabledProperty || unwrapTypescriptExpression(enabledProperty.initializer).kind !==
|
|
51158
|
+
if (!enabledProperty || unwrapTypescriptExpression(enabledProperty.initializer).kind !== _react_doctor_require_typescript_default.SyntaxKind.TrueKeyword) return null;
|
|
51176
51159
|
const filepathProperty = getStaticProperty(eslintrcExpression, "filepath");
|
|
51177
51160
|
if (!filepathProperty) return path$1.join(packageDirectory, DEFAULT_ESLINT_GLOBALS_PATH);
|
|
51178
|
-
if (!
|
|
51161
|
+
if (!_react_doctor_require_typescript_default.isPropertyAssignment(filepathProperty)) return null;
|
|
51179
51162
|
const filepathExpression = unwrapTypescriptExpression(filepathProperty.initializer);
|
|
51180
|
-
return
|
|
51163
|
+
return _react_doctor_require_typescript_default.isStringLiteralLike(filepathExpression) ? path$1.resolve(packageDirectory, filepathExpression.text) : null;
|
|
51181
51164
|
};
|
|
51182
51165
|
const collectGlobalsPathsFromConfig = (configPath, packageDirectory) => {
|
|
51183
51166
|
let sourceText;
|
|
@@ -51189,12 +51172,12 @@ const collectGlobalsPathsFromConfig = (configPath, packageDirectory) => {
|
|
|
51189
51172
|
globalsPaths: []
|
|
51190
51173
|
};
|
|
51191
51174
|
}
|
|
51192
|
-
const sourceFile =
|
|
51175
|
+
const sourceFile = _react_doctor_require_typescript_default.createSourceFile(configPath, sourceText, _react_doctor_require_typescript_default.ScriptTarget.Latest, true);
|
|
51193
51176
|
const autoImportBindings = /* @__PURE__ */ new Map();
|
|
51194
51177
|
const esbuildBindings = /* @__PURE__ */ new Set();
|
|
51195
51178
|
const esbuildNamespaceBindings = /* @__PURE__ */ new Set();
|
|
51196
51179
|
for (const statement of sourceFile.statements) {
|
|
51197
|
-
if (
|
|
51180
|
+
if (_react_doctor_require_typescript_default.isImportDeclaration(statement) && _react_doctor_require_typescript_default.isStringLiteralLike(statement.moduleSpecifier)) {
|
|
51198
51181
|
const moduleSpecifier = statement.moduleSpecifier.text;
|
|
51199
51182
|
if (AUTO_IMPORT_ADAPTER_PATTERN.test(moduleSpecifier)) {
|
|
51200
51183
|
const defaultBinding = statement.importClause?.name;
|
|
@@ -51204,23 +51187,23 @@ const collectGlobalsPathsFromConfig = (configPath, packageDirectory) => {
|
|
|
51204
51187
|
const defaultBinding = statement.importClause?.name;
|
|
51205
51188
|
if (defaultBinding) esbuildNamespaceBindings.add(defaultBinding.text);
|
|
51206
51189
|
const namedBindings = statement.importClause?.namedBindings;
|
|
51207
|
-
if (namedBindings &&
|
|
51190
|
+
if (namedBindings && _react_doctor_require_typescript_default.isNamedImports(namedBindings)) {
|
|
51208
51191
|
for (const importSpecifier of namedBindings.elements) if ((importSpecifier.propertyName ?? importSpecifier.name).text === "build") esbuildBindings.add(importSpecifier.name.text);
|
|
51209
51192
|
}
|
|
51210
|
-
if (namedBindings &&
|
|
51193
|
+
if (namedBindings && _react_doctor_require_typescript_default.isNamespaceImport(namedBindings)) esbuildNamespaceBindings.add(namedBindings.name.text);
|
|
51211
51194
|
}
|
|
51212
51195
|
}
|
|
51213
|
-
if (!
|
|
51196
|
+
if (!_react_doctor_require_typescript_default.isVariableStatement(statement)) continue;
|
|
51214
51197
|
for (const declaration of statement.declarationList.declarations) {
|
|
51215
51198
|
if (!declaration.initializer) continue;
|
|
51216
|
-
const declarationName =
|
|
51199
|
+
const declarationName = _react_doctor_require_typescript_default.isIdentifier(declaration.name) ? declaration.name.text : null;
|
|
51217
51200
|
const moduleSpecifier = getRequireModuleSpecifier(declaration.initializer);
|
|
51218
51201
|
if (declarationName && moduleSpecifier && AUTO_IMPORT_ADAPTER_PATTERN.test(moduleSpecifier)) autoImportBindings.set(declarationName, moduleSpecifier);
|
|
51219
51202
|
if (moduleSpecifier === "esbuild") {
|
|
51220
51203
|
if (declarationName) esbuildNamespaceBindings.add(declarationName);
|
|
51221
|
-
if (
|
|
51204
|
+
if (_react_doctor_require_typescript_default.isObjectBindingPattern(declaration.name)) for (const bindingElement of declaration.name.elements) {
|
|
51222
51205
|
const importedName = bindingElement.propertyName ?? bindingElement.name;
|
|
51223
|
-
if (
|
|
51206
|
+
if (_react_doctor_require_typescript_default.isIdentifier(importedName) && importedName.text === "build" && _react_doctor_require_typescript_default.isIdentifier(bindingElement.name)) esbuildBindings.add(bindingElement.name.text);
|
|
51224
51207
|
}
|
|
51225
51208
|
}
|
|
51226
51209
|
if (declarationName && getRequiredPropertyModuleSpecifier(declaration.initializer, "build") === "esbuild") esbuildBindings.add(declarationName);
|
|
@@ -51230,8 +51213,8 @@ const collectGlobalsPathsFromConfig = (configPath, packageDirectory) => {
|
|
|
51230
51213
|
let didFindActiveAutoImport = false;
|
|
51231
51214
|
let didFindUnsafeActiveAutoImport = false;
|
|
51232
51215
|
const visit = (node) => {
|
|
51233
|
-
if (
|
|
51234
|
-
const moduleSpecifier =
|
|
51216
|
+
if (_react_doctor_require_typescript_default.isCallExpression(node)) {
|
|
51217
|
+
const moduleSpecifier = _react_doctor_require_typescript_default.isIdentifier(node.expression) ? autoImportBindings.get(node.expression.text) : getRequireModuleSpecifier(node.expression);
|
|
51235
51218
|
if (moduleSpecifier && AUTO_IMPORT_ADAPTER_PATTERN.test(moduleSpecifier)) {
|
|
51236
51219
|
if (isInsideActiveConfigProperty(node, moduleSpecifier.endsWith("/astro") ? "integrations" : "plugins", sourceFile, esbuildBindings, esbuildNamespaceBindings)) {
|
|
51237
51220
|
didFindActiveAutoImport = true;
|
|
@@ -51241,7 +51224,7 @@ const collectGlobalsPathsFromConfig = (configPath, packageDirectory) => {
|
|
|
51241
51224
|
}
|
|
51242
51225
|
}
|
|
51243
51226
|
}
|
|
51244
|
-
|
|
51227
|
+
_react_doctor_require_typescript_default.forEachChild(node, visit);
|
|
51245
51228
|
};
|
|
51246
51229
|
visit(sourceFile);
|
|
51247
51230
|
return {
|
|
@@ -51322,7 +51305,7 @@ const GENERATED_AUTO_IMPORT_MARKER = "Generated by unplugin-auto-import";
|
|
|
51322
51305
|
const AUTO_IMPORT_SOURCE_BINDING_PATTERN = /\bconst\s+([A-Za-z_$][\w$]*)\s*:\s*typeof\s+import\(["']([^"']+)["']\)\[["']([^"']+)["']\]/g;
|
|
51323
51306
|
const isNonReferenceIdentifier = (identifier) => {
|
|
51324
51307
|
const parent = identifier.parent;
|
|
51325
|
-
return (
|
|
51308
|
+
return (_react_doctor_require_typescript_default.isVariableDeclaration(parent) || _react_doctor_require_typescript_default.isParameter(parent) || _react_doctor_require_typescript_default.isFunctionDeclaration(parent) || _react_doctor_require_typescript_default.isFunctionExpression(parent) || _react_doctor_require_typescript_default.isClassDeclaration(parent) || _react_doctor_require_typescript_default.isClassExpression(parent) || _react_doctor_require_typescript_default.isImportClause(parent) || _react_doctor_require_typescript_default.isImportSpecifier(parent) || _react_doctor_require_typescript_default.isNamespaceImport(parent) || _react_doctor_require_typescript_default.isBindingElement(parent)) && parent.name === identifier || _react_doctor_require_typescript_default.isImportSpecifier(parent) && parent.propertyName === identifier || _react_doctor_require_typescript_default.isBindingElement(parent) && parent.propertyName === identifier || _react_doctor_require_typescript_default.isJsxAttribute(parent) && parent.name === identifier || (_react_doctor_require_typescript_default.isPropertyAccessExpression(parent) || _react_doctor_require_typescript_default.isPropertyAssignment(parent) || _react_doctor_require_typescript_default.isPropertyDeclaration(parent) || _react_doctor_require_typescript_default.isMethodDeclaration(parent) || _react_doctor_require_typescript_default.isMethodSignature(parent) || _react_doctor_require_typescript_default.isPropertySignature(parent)) && parent.name === identifier || _react_doctor_require_typescript_default.isQualifiedName(parent) && parent.right === identifier;
|
|
51326
51309
|
};
|
|
51327
51310
|
const collectUnboundGlobalNames = (filePath, candidateGlobalNames) => {
|
|
51328
51311
|
let source;
|
|
@@ -51331,19 +51314,19 @@ const collectUnboundGlobalNames = (filePath, candidateGlobalNames) => {
|
|
|
51331
51314
|
} catch {
|
|
51332
51315
|
return /* @__PURE__ */ new Set();
|
|
51333
51316
|
}
|
|
51334
|
-
const sourceFile =
|
|
51317
|
+
const sourceFile = _react_doctor_require_typescript_default.createSourceFile(filePath, source, _react_doctor_require_typescript_default.ScriptTarget.Latest, true);
|
|
51335
51318
|
const compilerOptions = {
|
|
51336
51319
|
allowJs: true,
|
|
51337
|
-
jsx:
|
|
51320
|
+
jsx: _react_doctor_require_typescript_default.JsxEmit.Preserve,
|
|
51338
51321
|
noLib: true,
|
|
51339
51322
|
noResolve: true,
|
|
51340
|
-
target:
|
|
51323
|
+
target: _react_doctor_require_typescript_default.ScriptTarget.Latest
|
|
51341
51324
|
};
|
|
51342
|
-
const compilerHost =
|
|
51325
|
+
const compilerHost = _react_doctor_require_typescript_default.createCompilerHost(compilerOptions);
|
|
51343
51326
|
compilerHost.fileExists = (candidatePath) => candidatePath === filePath;
|
|
51344
51327
|
compilerHost.getSourceFile = (candidatePath) => candidatePath === filePath ? sourceFile : void 0;
|
|
51345
51328
|
compilerHost.readFile = (candidatePath) => candidatePath === filePath ? source : void 0;
|
|
51346
|
-
const program =
|
|
51329
|
+
const program = _react_doctor_require_typescript_default.createProgram({
|
|
51347
51330
|
rootNames: [filePath],
|
|
51348
51331
|
options: compilerOptions,
|
|
51349
51332
|
host: compilerHost
|
|
@@ -51353,10 +51336,10 @@ const collectUnboundGlobalNames = (filePath, candidateGlobalNames) => {
|
|
|
51353
51336
|
if (!boundSourceFile) return /* @__PURE__ */ new Set();
|
|
51354
51337
|
const unboundGlobalNames = /* @__PURE__ */ new Set();
|
|
51355
51338
|
const visitNode = (node) => {
|
|
51356
|
-
if (
|
|
51357
|
-
if (!(
|
|
51339
|
+
if (_react_doctor_require_typescript_default.isIdentifier(node) && candidateGlobalNames.has(node.text) && !isNonReferenceIdentifier(node)) {
|
|
51340
|
+
if (!(_react_doctor_require_typescript_default.isShorthandPropertyAssignment(node.parent) ? typeChecker.getShorthandAssignmentValueSymbol(node.parent) : typeChecker.getSymbolAtLocation(node))) unboundGlobalNames.add(node.text);
|
|
51358
51341
|
}
|
|
51359
|
-
|
|
51342
|
+
_react_doctor_require_typescript_default.forEachChild(node, visitNode);
|
|
51360
51343
|
};
|
|
51361
51344
|
visitNode(boundSourceFile);
|
|
51362
51345
|
return unboundGlobalNames;
|
|
@@ -51529,7 +51512,7 @@ const hasUnparseableCompilerConfig = (packageRootDirectory) => {
|
|
|
51529
51512
|
return configNames.some((configName) => {
|
|
51530
51513
|
const configPath = join(packageRootDirectory, configName);
|
|
51531
51514
|
try {
|
|
51532
|
-
return
|
|
51515
|
+
return _react_doctor_require_typescript_default.parseConfigFileTextToJson(configPath, readFileSync(configPath, "utf8")).error !== void 0;
|
|
51533
51516
|
} catch {
|
|
51534
51517
|
return true;
|
|
51535
51518
|
}
|
|
@@ -51902,4 +51885,4 @@ startProjectAnalysisWorker();
|
|
|
51902
51885
|
export {};
|
|
51903
51886
|
|
|
51904
51887
|
//# sourceMappingURL=project-analysis-worker.js.map
|
|
51905
|
-
//# debugId=
|
|
51888
|
+
//# debugId=a64790d6-0fbf-5baf-969b-f9980583a72d
|