react-doctor 0.9.13-dev.fd23edc → 0.9.13-dev.fd64d26
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-DqBNBmQx.js +80 -0
- package/dist/{ci-DjilJaw4.js → ci-C9VIuxer.js} +12 -12
- package/dist/cli.js +25 -26
- package/dist/constants-CKOk_Fa9.js +23 -0
- package/dist/{design-CXLKbARh.js → design-Bi2Vyiox.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-DTLgxZZ5.js → exit-gracefully-BECsBTnW.js} +7 -7
- package/dist/{get-east-asian-width-Bv2TD3Xj.js → get-east-asian-width-CM5BOEC-.js} +3 -3
- package/dist/{handle-error-BqaqFvmc.js → handle-error-Bpa6UIOi.js} +5 -5
- package/dist/index.js +2329 -1616
- package/dist/{inspect-BIfnzKGq.js → inspect-CIlLTl74.js} +25 -21
- package/dist/{install-nhJ65X-y.js → install-CWRhGRwA.js} +9 -9
- package/dist/{install-doctor-script-B1U08lUD.js → install-doctor-script-4bc7a9Xa.js} +5 -5
- package/dist/{install-github-workflow-CkOl0wCn.js → install-github-workflow-CApF2UUE.js} +5 -5
- package/dist/{install-react-doctor-Dm35Egex.js → install-react-doctor-5JVhuBwj.js} +8 -8
- package/dist/{jsx-runtime-C1t3eR6p.js → jsx-runtime-BiIKqx7W.js} +7 -7
- package/dist/oxlint-worker.d.ts +1 -0
- package/dist/oxlint-worker.js +135 -0
- package/dist/{print-branded-header-qOJiGkuW.js → print-branded-header-I68eir6S.js} +4 -4
- package/dist/project-analysis-worker.js +457 -470
- package/dist/{prompt-runtime-scan-url-m88LMtMP.js → prompt-runtime-scan-url-DTURCZJx.js} +5 -5
- package/dist/{read-object-file-Cv41FpZo.js → read-object-file-D_so7aRw.js} +4 -4
- package/dist/{record-metric-u8youmM2.js → record-metric-Cs3byi4j.js} +1823 -1059
- package/dist/{report-error-CkFgxJTQ.js → report-error-C6cwK5ek.js} +7 -7
- package/dist/{report-workflow-result-Wh1SQuOu.js → report-workflow-result-C__-WR2y.js} +5 -5
- package/dist/{resolve-scope-CHCpJtks.js → resolve-scope-Ded7Rst2.js} +6 -6
- package/dist/{rules-C30QFptP.js → rules-zE-OOAQv.js} +6 -6
- package/dist/{run-scan-app-yTBDucJ3.js → run-scan-app-vOe1geDj.js} +28 -22
- package/dist/{runtime-scan-VH25Yf8H.js → runtime-scan-BpV7bw6k.js} +14 -14
- package/dist/{sanitize-runtime-url-crVHbQlW.js → sanitize-runtime-url-Bz3numjM.js} +5 -5
- package/dist/{scan-CNSRWEtJ.js → scan-lvKKvrda.js} +9 -9
- package/dist/{semver-DFtnEmN-.js → semver-DlmXks31.js} +3 -3
- package/dist/{should-fail-scan-gate-Cw6KeoRT.js → should-fail-scan-gate-Chyg9-UY.js} +116 -72
- package/dist/{should-skip-prompts-B5zkkkKR.js → should-skip-prompts-DHnGjhIu.js} +4 -4
- package/dist/{should-use-tui-S9255AG_.js → should-use-tui-DXeiBj0r.js} +4 -4
- package/dist/{telemetry-runtime-B2rpGWMl.js → telemetry-runtime-C4xTDemQ.js} +153 -5
- package/dist/unwrap-typescript-expression-CbO_6kmC.js +14 -0
- package/dist/{version-KQbGQSGN.js → version-BEYXWT3R.js} +4 -4
- package/dist/{why-B-l2qTCV.js → why-Bd-soKyA.js} +4 -4
- package/dist/{with-run-span-Dk1M8cnH.js → with-run-span-B6t6uEzq.js} +5 -5
- package/package.json +4 -4
- package/dist/build-section-divider-CUtO-gXD.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) {
|
|
@@ -44073,7 +44068,11 @@ const FRAMEWORK_PATTERNS = [
|
|
|
44073
44068
|
enablers: ["sanity", "@sanity/cli"],
|
|
44074
44069
|
enablerPrefixes: ["@sanity/"],
|
|
44075
44070
|
entryPatterns: [],
|
|
44076
|
-
alwaysUsed: [
|
|
44071
|
+
alwaysUsed: [
|
|
44072
|
+
"sanity.config.{ts,js}",
|
|
44073
|
+
"sanity.cli.{ts,js}",
|
|
44074
|
+
"sanity.blueprint.{ts,js}"
|
|
44075
|
+
]
|
|
44077
44076
|
},
|
|
44078
44077
|
{
|
|
44079
44078
|
enablers: ["astro"],
|
|
@@ -44534,20 +44533,8 @@ const isConfigFile = (filePath) => {
|
|
|
44534
44533
|
return KNOWN_CONFIG_PREFIXES.some((prefix) => fileName.startsWith(prefix));
|
|
44535
44534
|
};
|
|
44536
44535
|
//#endregion
|
|
44537
|
-
//#region ../core/src/project-info/constants.ts
|
|
44538
|
-
var import_picomatch = /* @__PURE__ */ __toESM(require_picomatch$2(), 1);
|
|
44539
|
-
const GIT_CHECK_ATTR_MAX_BUFFER_BYTES = 50 * 1024 * 1024;
|
|
44540
|
-
new Map(Object.entries({
|
|
44541
|
-
Security: "An attacker can read user data, act as your users, or run code you never shipped.",
|
|
44542
|
-
Bugs: "Real users hit crashes, wrong output, or state that silently corrupts.",
|
|
44543
|
-
Performance: "Users feel extra latency and wasted renders on every interaction.",
|
|
44544
|
-
Accessibility: "Users on screen readers, keyboards, or assistive tech get locked out.",
|
|
44545
|
-
Maintainability: "Every future change gets slower and riskier to make."
|
|
44546
|
-
}));
|
|
44547
|
-
const MAX_GLOB_PATTERN_LENGTH_CHARS = 1024;
|
|
44548
|
-
process.env.REACT_DOCTOR_CORE_VERSION;
|
|
44549
|
-
//#endregion
|
|
44550
44536
|
//#region ../core/src/utils/message-from-unknown.ts
|
|
44537
|
+
var import_picomatch = /* @__PURE__ */ __toESM(require_picomatch$2(), 1);
|
|
44551
44538
|
const messageFromUnknown = (error) => error instanceof Error ? error.message : String(error);
|
|
44552
44539
|
//#endregion
|
|
44553
44540
|
//#region ../core/src/utils/match-glob-pattern.ts
|
|
@@ -45445,18 +45432,18 @@ const collectDynamicBuildImports = (sourceFile, typeChecker) => {
|
|
|
45445
45432
|
const globNamespaceSymbols = /* @__PURE__ */ new Set();
|
|
45446
45433
|
const pathNamespaceSymbols = /* @__PURE__ */ new Set();
|
|
45447
45434
|
for (const statement of sourceFile.statements) {
|
|
45448
|
-
if (!
|
|
45435
|
+
if (!_react_doctor_require_typescript_default.isImportDeclaration(statement) || !_react_doctor_require_typescript_default.isStringLiteral(statement.moduleSpecifier) || !statement.importClause) continue;
|
|
45449
45436
|
const moduleName = statement.moduleSpecifier.text;
|
|
45450
45437
|
const namedBindings = statement.importClause.namedBindings;
|
|
45451
|
-
if (moduleName === "glob" && namedBindings &&
|
|
45438
|
+
if (moduleName === "glob" && namedBindings && _react_doctor_require_typescript_default.isNamespaceImport(namedBindings)) {
|
|
45452
45439
|
const globNamespaceSymbol = typeChecker.getSymbolAtLocation(namedBindings.name);
|
|
45453
45440
|
if (globNamespaceSymbol) globNamespaceSymbols.add(globNamespaceSymbol);
|
|
45454
45441
|
}
|
|
45455
|
-
if (moduleName === "path" && namedBindings &&
|
|
45442
|
+
if (moduleName === "path" && namedBindings && _react_doctor_require_typescript_default.isNamespaceImport(namedBindings)) {
|
|
45456
45443
|
const pathNamespaceSymbol = typeChecker.getSymbolAtLocation(namedBindings.name);
|
|
45457
45444
|
if (pathNamespaceSymbol) pathNamespaceSymbols.add(pathNamespaceSymbol);
|
|
45458
45445
|
}
|
|
45459
|
-
if (moduleName !== "tsup" || !namedBindings || !
|
|
45446
|
+
if (moduleName !== "tsup" || !namedBindings || !_react_doctor_require_typescript_default.isNamedImports(namedBindings)) continue;
|
|
45460
45447
|
for (const importSpecifier of namedBindings.elements) if ((importSpecifier.propertyName ?? importSpecifier.name).text === "build") {
|
|
45461
45448
|
const buildSymbol = typeChecker.getSymbolAtLocation(importSpecifier.name);
|
|
45462
45449
|
if (buildSymbol) buildSymbols.add(buildSymbol);
|
|
@@ -45469,18 +45456,18 @@ const collectDynamicBuildImports = (sourceFile, typeChecker) => {
|
|
|
45469
45456
|
};
|
|
45470
45457
|
};
|
|
45471
45458
|
const extractGlobPattern = (expression, imports, scriptDirectory, typeChecker) => {
|
|
45472
|
-
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;
|
|
45473
45460
|
const patternExpression = expression.arguments[0];
|
|
45474
|
-
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;
|
|
45475
45462
|
const relativeGlobPattern = patternExpression.arguments[1].text;
|
|
45476
45463
|
if (!relativeGlobPattern.includes("*")) return void 0;
|
|
45477
45464
|
return toPosixPath(resolve(scriptDirectory, relativeGlobPattern));
|
|
45478
45465
|
};
|
|
45479
45466
|
const extractExcludedPathSubstring = (callback) => {
|
|
45480
|
-
if (callback.parameters.length !== 1 || !
|
|
45467
|
+
if (callback.parameters.length !== 1 || !_react_doctor_require_typescript_default.isIdentifier(callback.parameters[0].name)) return;
|
|
45481
45468
|
const filePathName = callback.parameters[0].name.text;
|
|
45482
|
-
const returnedExpression =
|
|
45483
|
-
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;
|
|
45484
45471
|
return toPosixPath(returnedExpression.operand.arguments[0].text);
|
|
45485
45472
|
};
|
|
45486
45473
|
const extractFileCollection = (initializer, imports, scriptDirectory, typeChecker) => {
|
|
@@ -45489,7 +45476,7 @@ const extractFileCollection = (initializer, imports, scriptDirectory, typeChecke
|
|
|
45489
45476
|
excludedPathSubstrings: [],
|
|
45490
45477
|
globPattern: directGlobPattern
|
|
45491
45478
|
};
|
|
45492
|
-
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;
|
|
45493
45480
|
const globPattern = extractGlobPattern(initializer.expression.expression, imports, scriptDirectory, typeChecker);
|
|
45494
45481
|
const excludedPathSubstring = extractExcludedPathSubstring(initializer.arguments[0]);
|
|
45495
45482
|
if (!globPattern || excludedPathSubstring === void 0) return void 0;
|
|
@@ -45498,36 +45485,36 @@ const extractFileCollection = (initializer, imports, scriptDirectory, typeChecke
|
|
|
45498
45485
|
globPattern
|
|
45499
45486
|
};
|
|
45500
45487
|
};
|
|
45501
|
-
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);
|
|
45502
45489
|
const hasMatchingOutputEntryPath = (callback, filePathName, outputEntryName, imports, typeChecker) => {
|
|
45503
|
-
if (!
|
|
45490
|
+
if (!_react_doctor_require_typescript_default.isBlock(callback.body)) return false;
|
|
45504
45491
|
const initializersByName = /* @__PURE__ */ new Map();
|
|
45505
45492
|
for (const statement of callback.body.statements) {
|
|
45506
|
-
if (!
|
|
45507
|
-
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);
|
|
45508
45495
|
}
|
|
45509
45496
|
const outputEntryInitializer = initializersByName.get(outputEntryName);
|
|
45510
45497
|
if (!outputEntryInitializer || !isPathNamespaceCall(outputEntryInitializer, "join", imports, typeChecker)) return false;
|
|
45511
45498
|
const outputFilenameExpression = outputEntryInitializer.arguments.at(-1);
|
|
45512
|
-
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;
|
|
45513
45500
|
const basenameSourceName = outputFilenameExpression.left.arguments[0].text;
|
|
45514
45501
|
if (basenameSourceName === filePathName) return true;
|
|
45515
45502
|
const basenameSourceInitializer = initializersByName.get(basenameSourceName);
|
|
45516
|
-
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);
|
|
45517
45504
|
};
|
|
45518
45505
|
const findBuildInvocation = (callback, filePathName, imports, typeChecker) => {
|
|
45519
45506
|
let buildInvocation;
|
|
45520
45507
|
const visitNode = (node) => {
|
|
45521
|
-
if (
|
|
45522
|
-
const hasMatchingEntry = node.arguments[0].properties.some((property) =>
|
|
45523
|
-
const outDirectoryProperty = node.arguments[0].properties.find((property) =>
|
|
45524
|
-
const hasCommonJsFormat = node.arguments[0].properties.some((property) =>
|
|
45525
|
-
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 = {
|
|
45526
45513
|
end: node.parent.end,
|
|
45527
45514
|
outputEntryName: outDirectoryProperty.initializer.arguments[0].text
|
|
45528
45515
|
};
|
|
45529
45516
|
}
|
|
45530
|
-
if (!buildInvocation)
|
|
45517
|
+
if (!buildInvocation) _react_doctor_require_typescript_default.forEachChild(node, visitNode);
|
|
45531
45518
|
};
|
|
45532
45519
|
visitNode(callback.body);
|
|
45533
45520
|
return buildInvocation;
|
|
@@ -45536,19 +45523,19 @@ const collectImportedNamespaceExportNames = (callback, buildInvocation, typeChec
|
|
|
45536
45523
|
const importedNamespaceDeclarationEndBySymbol = /* @__PURE__ */ new Map();
|
|
45537
45524
|
const exportNames = /* @__PURE__ */ new Set();
|
|
45538
45525
|
const collectNamespaceNames = (node) => {
|
|
45539
|
-
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) {
|
|
45540
45527
|
const namespaceSymbol = typeChecker.getSymbolAtLocation(node.name);
|
|
45541
45528
|
if (namespaceSymbol) importedNamespaceDeclarationEndBySymbol.set(namespaceSymbol, node.end);
|
|
45542
45529
|
}
|
|
45543
|
-
|
|
45530
|
+
_react_doctor_require_typescript_default.forEachChild(node, collectNamespaceNames);
|
|
45544
45531
|
};
|
|
45545
45532
|
collectNamespaceNames(callback.body);
|
|
45546
45533
|
const collectExportNames = (node) => {
|
|
45547
|
-
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;
|
|
45548
45535
|
const namespaceDeclarationEnd = namespaceSymbol ? importedNamespaceDeclarationEndBySymbol.get(namespaceSymbol) : void 0;
|
|
45549
|
-
if (
|
|
45550
|
-
else if (
|
|
45551
|
-
|
|
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);
|
|
45552
45539
|
};
|
|
45553
45540
|
collectExportNames(callback.body);
|
|
45554
45541
|
return exportNames;
|
|
@@ -45564,14 +45551,14 @@ const collectScriptConsumedExportKeys = (scriptPath, packageDirectory) => {
|
|
|
45564
45551
|
noLib: true,
|
|
45565
45552
|
noResolve: true
|
|
45566
45553
|
};
|
|
45567
|
-
const sourceFile =
|
|
45568
|
-
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);
|
|
45569
45556
|
const scriptIdentity = getFileIdentityKey(scriptPath);
|
|
45570
45557
|
const isScriptPath = (candidatePath) => getFileIdentityKey(candidatePath) === scriptIdentity;
|
|
45571
45558
|
compilerHost.fileExists = isScriptPath;
|
|
45572
45559
|
compilerHost.getSourceFile = (candidatePath) => isScriptPath(candidatePath) ? sourceFile : void 0;
|
|
45573
45560
|
compilerHost.readFile = (candidatePath) => isScriptPath(candidatePath) ? source : void 0;
|
|
45574
|
-
const program =
|
|
45561
|
+
const program = _react_doctor_require_typescript_default.createProgram({
|
|
45575
45562
|
rootNames: [scriptPath],
|
|
45576
45563
|
options: compilerOptions,
|
|
45577
45564
|
host: compilerHost
|
|
@@ -45583,22 +45570,22 @@ const collectScriptConsumedExportKeys = (scriptPath, packageDirectory) => {
|
|
|
45583
45570
|
if (imports.buildSymbols.size === 0 || imports.globNamespaceSymbols.size === 0 || imports.pathNamespaceSymbols.size === 0) return /* @__PURE__ */ new Set();
|
|
45584
45571
|
const collectionsBySymbol = /* @__PURE__ */ new Map();
|
|
45585
45572
|
const visitCollection = (node) => {
|
|
45586
|
-
if (
|
|
45573
|
+
if (_react_doctor_require_typescript_default.isVariableDeclaration(node) && _react_doctor_require_typescript_default.isIdentifier(node.name) && node.initializer) {
|
|
45587
45574
|
const collection = extractFileCollection(node.initializer, imports, dirname(scriptPath), typeChecker);
|
|
45588
45575
|
const collectionSymbol = typeChecker.getSymbolAtLocation(node.name);
|
|
45589
45576
|
if (collection && collectionSymbol) collectionsBySymbol.set(collectionSymbol, collection);
|
|
45590
45577
|
}
|
|
45591
|
-
|
|
45578
|
+
_react_doctor_require_typescript_default.forEachChild(node, visitCollection);
|
|
45592
45579
|
};
|
|
45593
45580
|
visitCollection(boundSourceFile);
|
|
45594
45581
|
const consumedExportKeys = /* @__PURE__ */ new Set();
|
|
45595
45582
|
const packageManifestIdentity = getFileIdentityKey(resolve(packageDirectory, "package.json"));
|
|
45596
45583
|
const visitMapCall = (node) => {
|
|
45597
|
-
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]))) {
|
|
45598
45585
|
const collectionSymbol = typeChecker.getSymbolAtLocation(node.expression.expression);
|
|
45599
45586
|
const collection = collectionSymbol ? collectionsBySymbol.get(collectionSymbol) : void 0;
|
|
45600
45587
|
const callback = node.arguments[0];
|
|
45601
|
-
if (collection && callback.parameters.length === 1 &&
|
|
45588
|
+
if (collection && callback.parameters.length === 1 && _react_doctor_require_typescript_default.isIdentifier(callback.parameters[0].name)) {
|
|
45602
45589
|
const buildInvocation = findBuildInvocation(callback, callback.parameters[0].name.text, imports, typeChecker);
|
|
45603
45590
|
if (!buildInvocation) return;
|
|
45604
45591
|
const exportNames = collectImportedNamespaceExportNames(callback, buildInvocation, typeChecker);
|
|
@@ -45617,7 +45604,7 @@ const collectScriptConsumedExportKeys = (scriptPath, packageDirectory) => {
|
|
|
45617
45604
|
}
|
|
45618
45605
|
}
|
|
45619
45606
|
}
|
|
45620
|
-
|
|
45607
|
+
_react_doctor_require_typescript_default.forEachChild(node, visitMapCall);
|
|
45621
45608
|
};
|
|
45622
45609
|
visitMapCall(boundSourceFile);
|
|
45623
45610
|
return consumedExportKeys;
|
|
@@ -45661,7 +45648,7 @@ const readPackageMetadata = (packageDirectory) => {
|
|
|
45661
45648
|
return;
|
|
45662
45649
|
}
|
|
45663
45650
|
};
|
|
45664
|
-
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");
|
|
45665
45652
|
const collectReferencedNextraThemeConfigPaths = (packageDirectory) => {
|
|
45666
45653
|
const referencedPaths = /* @__PURE__ */ new Set();
|
|
45667
45654
|
for (const configFilename of NEXT_CONFIG_FILENAMES) {
|
|
@@ -45673,16 +45660,16 @@ const collectReferencedNextraThemeConfigPaths = (packageDirectory) => {
|
|
|
45673
45660
|
} catch {
|
|
45674
45661
|
continue;
|
|
45675
45662
|
}
|
|
45676
|
-
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);
|
|
45677
45664
|
if (!hasNextraImport(sourceFile)) continue;
|
|
45678
45665
|
const visitNode = (node) => {
|
|
45679
|
-
if (
|
|
45680
|
-
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(".")) {
|
|
45681
45668
|
const resolvedThemeConfigPath = resolveEntryWithExtensions(resolve(dirname(configPath), node.initializer.text));
|
|
45682
45669
|
if (resolvedThemeConfigPath) referencedPaths.add(toPosixPath(toFilesystemIdentityPath(resolve(resolvedThemeConfigPath))));
|
|
45683
45670
|
}
|
|
45684
45671
|
}
|
|
45685
|
-
|
|
45672
|
+
_react_doctor_require_typescript_default.forEachChild(node, visitNode);
|
|
45686
45673
|
};
|
|
45687
45674
|
visitNode(sourceFile);
|
|
45688
45675
|
}
|
|
@@ -46135,7 +46122,7 @@ const collectStaticModulePackageNames = (sourceText) => {
|
|
|
46135
46122
|
//#region ../core/src/project-analysis/utils/matches-package-import-reference.ts
|
|
46136
46123
|
const collectPackageImportNames = (content) => {
|
|
46137
46124
|
const packageNames = collectStaticModulePackageNames(content);
|
|
46138
|
-
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);
|
|
46139
46126
|
for (const typeReferenceDirective of sourceFile.typeReferenceDirectives) {
|
|
46140
46127
|
const packageName = extractPackageName(typeReferenceDirective.fileName);
|
|
46141
46128
|
if (packageName) packageNames.add(packageName);
|
|
@@ -46145,8 +46132,8 @@ const collectPackageImportNames = (content) => {
|
|
|
46145
46132
|
//#endregion
|
|
46146
46133
|
//#region ../core/src/project-analysis/utils/get-object-literal-element-name.ts
|
|
46147
46134
|
const getObjectLiteralElementName = (property) => {
|
|
46148
|
-
if (!
|
|
46149
|
-
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;
|
|
46150
46137
|
};
|
|
46151
46138
|
//#endregion
|
|
46152
46139
|
//#region ../core/src/project-analysis/utils/collect-config-plugin-map-package-names.ts
|
|
@@ -46154,23 +46141,23 @@ const collectConfigPluginMapPackageNames = (expression) => {
|
|
|
46154
46141
|
const packageNames = /* @__PURE__ */ new Set();
|
|
46155
46142
|
const collectExpression = (currentExpression) => {
|
|
46156
46143
|
const unwrappedExpression = unwrapTypescriptExpression(currentExpression);
|
|
46157
|
-
if (
|
|
46144
|
+
if (_react_doctor_require_typescript_default.isConditionalExpression(unwrappedExpression)) {
|
|
46158
46145
|
collectExpression(unwrappedExpression.whenTrue);
|
|
46159
46146
|
collectExpression(unwrappedExpression.whenFalse);
|
|
46160
46147
|
return;
|
|
46161
46148
|
}
|
|
46162
|
-
if (
|
|
46163
|
-
|
|
46164
|
-
|
|
46165
|
-
|
|
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
|
|
46166
46153
|
].includes(unwrappedExpression.operatorToken.kind)) {
|
|
46167
46154
|
collectExpression(unwrappedExpression.left);
|
|
46168
46155
|
collectExpression(unwrappedExpression.right);
|
|
46169
46156
|
return;
|
|
46170
46157
|
}
|
|
46171
|
-
if (!
|
|
46158
|
+
if (!_react_doctor_require_typescript_default.isObjectLiteralExpression(unwrappedExpression)) return;
|
|
46172
46159
|
for (const property of unwrappedExpression.properties) {
|
|
46173
|
-
if (
|
|
46160
|
+
if (_react_doctor_require_typescript_default.isSpreadAssignment(property)) {
|
|
46174
46161
|
collectExpression(property.expression);
|
|
46175
46162
|
continue;
|
|
46176
46163
|
}
|
|
@@ -46193,16 +46180,16 @@ const STRUCTURED_TEXT_EXTENSIONS = new Set([
|
|
|
46193
46180
|
const BABEL_CONFIG_FILE_PATTERN = /(?:^|[/\\])(?:babel\.config\.[^/\\]+|\.babelrc(?:\.[^/\\]+)?)$/;
|
|
46194
46181
|
const BABEL_MODULE_PREFIX = "module:";
|
|
46195
46182
|
const isBabelPluginOrPresetSpecifier = (node) => {
|
|
46196
|
-
const parent =
|
|
46183
|
+
const parent = _react_doctor_require_typescript_default.isArrayLiteralExpression(node.parent) ? node.parent : void 0;
|
|
46197
46184
|
if (!parent) return false;
|
|
46198
|
-
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;
|
|
46199
46186
|
let ancestor = property;
|
|
46200
|
-
while (ancestor && !
|
|
46187
|
+
while (ancestor && !_react_doctor_require_typescript_default.isSourceFile(ancestor)) {
|
|
46201
46188
|
const parentNode = ancestor.parent;
|
|
46202
|
-
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;
|
|
46203
46190
|
ancestor = parentNode;
|
|
46204
46191
|
}
|
|
46205
|
-
return
|
|
46192
|
+
return _react_doctor_require_typescript_default.isPropertyAssignment(property) && (getObjectLiteralElementName(property) === "plugins" || getObjectLiteralElementName(property) === "presets");
|
|
46206
46193
|
};
|
|
46207
46194
|
const collectStructuredTextPackageReferences = (content) => {
|
|
46208
46195
|
const uncommentedContent = content.split("\n").map(stripCoffeeScriptComment).join("\n");
|
|
@@ -46215,16 +46202,16 @@ const collectStructuredTextPackageReferences = (content) => {
|
|
|
46215
46202
|
};
|
|
46216
46203
|
const collectPackageConfigReferences = (filePath, content) => {
|
|
46217
46204
|
if (STRUCTURED_TEXT_EXTENSIONS.has(extname(filePath))) return collectStructuredTextPackageReferences(content);
|
|
46218
|
-
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);
|
|
46219
46206
|
const packageNames = /* @__PURE__ */ new Set();
|
|
46220
46207
|
const visit = (node) => {
|
|
46221
|
-
if (
|
|
46222
|
-
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)) {
|
|
46223
46210
|
const packageName = extractPackageName(BABEL_CONFIG_FILE_PATTERN.test(filePath) && node.text.startsWith(BABEL_MODULE_PREFIX) && isBabelPluginOrPresetSpecifier(node) ? node.text.slice(7) : node.text);
|
|
46224
46211
|
if (packageName) packageNames.add(packageName);
|
|
46225
46212
|
return;
|
|
46226
46213
|
}
|
|
46227
|
-
|
|
46214
|
+
_react_doctor_require_typescript_default.forEachChild(node, visit);
|
|
46228
46215
|
};
|
|
46229
46216
|
visit(sourceFile);
|
|
46230
46217
|
return packageNames;
|
|
@@ -48452,21 +48439,21 @@ const extractPreviewRegistryNamesFromMdx = (sourceText) => {
|
|
|
48452
48439
|
//#endregion
|
|
48453
48440
|
//#region ../core/src/project-analysis/utils/are-source-files-structurally-equivalent.ts
|
|
48454
48441
|
const buildSourceStructure = (filePath, sourceText) => {
|
|
48455
|
-
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);
|
|
48456
48443
|
const structure = [];
|
|
48457
48444
|
const visitNode = (node, normalizeClassNames = false) => {
|
|
48458
48445
|
structure.push(String(node.kind));
|
|
48459
|
-
if (
|
|
48460
|
-
else if (
|
|
48461
|
-
else if (
|
|
48462
|
-
else if (
|
|
48463
|
-
else if (
|
|
48464
|
-
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)) {
|
|
48465
48452
|
visitNode(node.name);
|
|
48466
48453
|
visitNode(node.initializer, true);
|
|
48467
48454
|
return;
|
|
48468
48455
|
}
|
|
48469
|
-
|
|
48456
|
+
_react_doctor_require_typescript_default.forEachChild(node, (childNode) => visitNode(childNode));
|
|
48470
48457
|
};
|
|
48471
48458
|
visitNode(sourceFile);
|
|
48472
48459
|
return structure.join("\0");
|
|
@@ -48480,8 +48467,8 @@ const buildScriptAnalysisKey = (scriptFile) => `${scriptFile.workingDirectory}\0
|
|
|
48480
48467
|
const resolveBuildReference = (reference, workingDirectory, projectRoot) => reference.startsWith("/") ? resolve(projectRoot, reference.replace(/^\/+/, "")) : resolve(workingDirectory, reference);
|
|
48481
48468
|
const getPropertyName$1 = (expression) => {
|
|
48482
48469
|
const unwrappedExpression = unwrapTypescriptExpression(expression);
|
|
48483
|
-
if (
|
|
48484
|
-
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;
|
|
48485
48472
|
};
|
|
48486
48473
|
const resolveImportedScriptPath = (specifier, scriptFile, projectRoot) => {
|
|
48487
48474
|
const importedPath = specifier.startsWith(".") ? resolve(dirname(scriptFile.filePath), specifier) : specifier.startsWith("@/registry/") ? resolve(scriptFile.workingDirectory, "src/registry", specifier.slice(11)) : void 0;
|
|
@@ -48498,20 +48485,20 @@ const collectWebpackEntrySpecifiers = (filePath) => {
|
|
|
48498
48485
|
} catch {
|
|
48499
48486
|
return [];
|
|
48500
48487
|
}
|
|
48501
|
-
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);
|
|
48502
48489
|
const specifiers = /* @__PURE__ */ new Set();
|
|
48503
48490
|
const collectStringLiterals = (node) => {
|
|
48504
|
-
if (
|
|
48491
|
+
if (_react_doctor_require_typescript_default.isStringLiteralLike(node) && node.text.startsWith(".")) {
|
|
48505
48492
|
specifiers.add(node.text);
|
|
48506
48493
|
return;
|
|
48507
48494
|
}
|
|
48508
|
-
|
|
48495
|
+
_react_doctor_require_typescript_default.forEachChild(node, collectStringLiterals);
|
|
48509
48496
|
};
|
|
48510
48497
|
const visitNode = (node) => {
|
|
48511
|
-
if (
|
|
48512
|
-
if (
|
|
48513
|
-
if (
|
|
48514
|
-
|
|
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);
|
|
48515
48502
|
};
|
|
48516
48503
|
visitNode(sourceFile);
|
|
48517
48504
|
return [...specifiers];
|
|
@@ -48678,23 +48665,23 @@ const buildScriptAnalyses = (invokedScriptFiles, projectRoot) => {
|
|
|
48678
48665
|
} catch {
|
|
48679
48666
|
continue;
|
|
48680
48667
|
}
|
|
48681
|
-
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);
|
|
48682
48669
|
const localFunctions = /* @__PURE__ */ new Map();
|
|
48683
48670
|
const defaultExportExpressions = [];
|
|
48684
48671
|
for (const statement of sourceFile.statements) {
|
|
48685
|
-
if (
|
|
48672
|
+
if (_react_doctor_require_typescript_default.isFunctionDeclaration(statement) && statement.body) {
|
|
48686
48673
|
if (statement.name) localFunctions.set(statement.name.text, statement.body);
|
|
48687
|
-
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);
|
|
48688
48675
|
}
|
|
48689
|
-
if (
|
|
48690
|
-
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);
|
|
48691
48678
|
}
|
|
48692
|
-
if (
|
|
48679
|
+
if (_react_doctor_require_typescript_default.isExportAssignment(statement) && !statement.isExportEquals) defaultExportExpressions.push(statement.expression);
|
|
48693
48680
|
}
|
|
48694
48681
|
for (const defaultExportExpression of defaultExportExpressions) {
|
|
48695
48682
|
const unwrappedDefaultExport = unwrapTypescriptExpression(defaultExportExpression);
|
|
48696
|
-
if (
|
|
48697
|
-
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)) {
|
|
48698
48685
|
const defaultFunctionBody = localFunctions.get(unwrappedDefaultExport.text);
|
|
48699
48686
|
if (defaultFunctionBody) localFunctions.set("default", defaultFunctionBody);
|
|
48700
48687
|
}
|
|
@@ -48708,7 +48695,7 @@ const buildScriptAnalyses = (invokedScriptFiles, projectRoot) => {
|
|
|
48708
48695
|
});
|
|
48709
48696
|
}
|
|
48710
48697
|
for (const analysis of analyses.values()) for (const statement of analysis.sourceFile.statements) {
|
|
48711
|
-
if (!
|
|
48698
|
+
if (!_react_doctor_require_typescript_default.isImportDeclaration(statement) || !_react_doctor_require_typescript_default.isStringLiteral(statement.moduleSpecifier)) continue;
|
|
48712
48699
|
const importClause = statement.importClause;
|
|
48713
48700
|
if (!importClause || importClause.isTypeOnly) continue;
|
|
48714
48701
|
const importedFilePath = resolveImportedScriptPath(statement.moduleSpecifier.text, analysis.scriptFile, projectRoot);
|
|
@@ -48722,7 +48709,7 @@ const buildScriptAnalyses = (invokedScriptFiles, projectRoot) => {
|
|
|
48722
48709
|
analysisKey: importedAnalysisKey,
|
|
48723
48710
|
exportName: "default"
|
|
48724
48711
|
});
|
|
48725
|
-
if (!importClause.namedBindings || !
|
|
48712
|
+
if (!importClause.namedBindings || !_react_doctor_require_typescript_default.isNamedImports(importClause.namedBindings)) continue;
|
|
48726
48713
|
for (const element of importClause.namedBindings.elements) {
|
|
48727
48714
|
if (element.isTypeOnly) continue;
|
|
48728
48715
|
analysis.importedFunctions.set(element.name.text, {
|
|
@@ -48744,11 +48731,11 @@ const buildScriptAnalyses = (invokedScriptFiles, projectRoot) => {
|
|
|
48744
48731
|
const visitLiveNode = (analysis, rootNode) => {
|
|
48745
48732
|
const visitNode = (node) => {
|
|
48746
48733
|
analysis.liveNodes.add(node);
|
|
48747
|
-
if (node !== rootNode && (
|
|
48748
|
-
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)) {
|
|
48749
48736
|
const calledExpression = unwrapTypescriptExpression(node.expression);
|
|
48750
|
-
if (
|
|
48751
|
-
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)) {
|
|
48752
48739
|
const localFunctionBody = analysis.localFunctions.get(calledExpression.text);
|
|
48753
48740
|
if (localFunctionBody) queueFunctionBody(analysis, localFunctionBody);
|
|
48754
48741
|
const importedFunction = analysis.importedFunctions.get(calledExpression.text);
|
|
@@ -48758,10 +48745,10 @@ const buildScriptAnalyses = (invokedScriptFiles, projectRoot) => {
|
|
|
48758
48745
|
}
|
|
48759
48746
|
for (const argument of node.arguments) {
|
|
48760
48747
|
const unwrappedArgument = unwrapTypescriptExpression(argument);
|
|
48761
|
-
if (
|
|
48748
|
+
if (_react_doctor_require_typescript_default.isFunctionExpression(unwrappedArgument) || _react_doctor_require_typescript_default.isArrowFunction(unwrappedArgument)) queueFunctionBody(analysis, unwrappedArgument.body);
|
|
48762
48749
|
}
|
|
48763
48750
|
}
|
|
48764
|
-
|
|
48751
|
+
_react_doctor_require_typescript_default.forEachChild(node, visitNode);
|
|
48765
48752
|
};
|
|
48766
48753
|
visitNode(rootNode);
|
|
48767
48754
|
};
|
|
@@ -48786,18 +48773,18 @@ const findVariableDeclaration = (sourceFile, identifierName, usePosition) => {
|
|
|
48786
48773
|
let closestDeclaration;
|
|
48787
48774
|
const visitNode = (node) => {
|
|
48788
48775
|
if (node.getStart(sourceFile) >= usePosition) return;
|
|
48789
|
-
if (
|
|
48776
|
+
if (_react_doctor_require_typescript_default.isVariableDeclaration(node) && _react_doctor_require_typescript_default.isIdentifier(node.name)) {
|
|
48790
48777
|
if (node.name.text === identifierName) closestDeclaration = node;
|
|
48791
48778
|
}
|
|
48792
|
-
|
|
48779
|
+
_react_doctor_require_typescript_default.forEachChild(node, visitNode);
|
|
48793
48780
|
};
|
|
48794
48781
|
visitNode(sourceFile);
|
|
48795
48782
|
return closestDeclaration;
|
|
48796
48783
|
};
|
|
48797
48784
|
const evaluatePathExpression = (expression, analysis, projectRoot, seenIdentifiers = /* @__PURE__ */ new Set()) => {
|
|
48798
48785
|
const unwrappedExpression = unwrapTypescriptExpression(expression);
|
|
48799
|
-
if (
|
|
48800
|
-
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)) {
|
|
48801
48788
|
if (unwrappedExpression.text === "__dirname") return dirname(analysis.scriptFile.filePath);
|
|
48802
48789
|
if (seenIdentifiers.has(unwrappedExpression.text)) return void 0;
|
|
48803
48790
|
const declaration = findVariableDeclaration(analysis.sourceFile, unwrappedExpression.text, unwrappedExpression.getStart(analysis.sourceFile));
|
|
@@ -48806,8 +48793,8 @@ const evaluatePathExpression = (expression, analysis, projectRoot, seenIdentifie
|
|
|
48806
48793
|
nextSeenIdentifiers.add(unwrappedExpression.text);
|
|
48807
48794
|
return evaluatePathExpression(declaration.initializer, analysis, projectRoot, nextSeenIdentifiers);
|
|
48808
48795
|
}
|
|
48809
|
-
if (!
|
|
48810
|
-
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;
|
|
48811
48798
|
const pathMethodName = getPropertyName$1(unwrappedExpression.expression);
|
|
48812
48799
|
if (pathMethodName !== "join" && pathMethodName !== "resolve") return void 0;
|
|
48813
48800
|
const [baseExpression, ...segmentExpressions] = unwrappedExpression.arguments;
|
|
@@ -48817,7 +48804,7 @@ const evaluatePathExpression = (expression, analysis, projectRoot, seenIdentifie
|
|
|
48817
48804
|
const pathSegments = [];
|
|
48818
48805
|
for (const segmentExpression of segmentExpressions) {
|
|
48819
48806
|
const unwrappedSegment = unwrapTypescriptExpression(segmentExpression);
|
|
48820
|
-
if (!
|
|
48807
|
+
if (!_react_doctor_require_typescript_default.isStringLiteralLike(unwrappedSegment)) return void 0;
|
|
48821
48808
|
pathSegments.push(unwrappedSegment.text);
|
|
48822
48809
|
}
|
|
48823
48810
|
const rootRelativeSegment = pathSegments.find((pathSegment) => pathSegment.startsWith("/"));
|
|
@@ -48831,48 +48818,48 @@ const evaluatePathExpression = (expression, analysis, projectRoot, seenIdentifie
|
|
|
48831
48818
|
const expressionContainsIdentifier = (expression, identifierName) => {
|
|
48832
48819
|
let containsIdentifier = false;
|
|
48833
48820
|
const visitNode = (node) => {
|
|
48834
|
-
if (
|
|
48821
|
+
if (_react_doctor_require_typescript_default.isIdentifier(node) && node.text === identifierName) {
|
|
48835
48822
|
containsIdentifier = true;
|
|
48836
48823
|
return;
|
|
48837
48824
|
}
|
|
48838
|
-
if (!containsIdentifier)
|
|
48825
|
+
if (!containsIdentifier) _react_doctor_require_typescript_default.forEachChild(node, visitNode);
|
|
48839
48826
|
};
|
|
48840
48827
|
visitNode(expression);
|
|
48841
48828
|
return containsIdentifier;
|
|
48842
48829
|
};
|
|
48843
48830
|
const isConditionallyExecuted = (node, boundary) => {
|
|
48844
|
-
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;
|
|
48845
48832
|
return false;
|
|
48846
48833
|
};
|
|
48847
48834
|
const analyzeDirectoryConsumer = (body, helperName, parameterName) => {
|
|
48848
48835
|
const directoryEntryCollectionNames = /* @__PURE__ */ new Set();
|
|
48849
48836
|
let unconditionallyConsumesEntries = false;
|
|
48850
48837
|
let recursivelyTraverses = false;
|
|
48851
|
-
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;
|
|
48852
48839
|
const visitNode = (node) => {
|
|
48853
|
-
if (
|
|
48854
|
-
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)) {
|
|
48855
48842
|
const collectionExpression = unwrapTypescriptExpression(node.expression);
|
|
48856
|
-
if (isDirectoryRead(collectionExpression) ||
|
|
48843
|
+
if (isDirectoryRead(collectionExpression) || _react_doctor_require_typescript_default.isIdentifier(collectionExpression) && directoryEntryCollectionNames.has(collectionExpression.text)) {
|
|
48857
48844
|
const loopVariable = node.initializer.declarations[0]?.name;
|
|
48858
|
-
if (loopVariable &&
|
|
48845
|
+
if (loopVariable && _react_doctor_require_typescript_default.isIdentifier(loopVariable)) {
|
|
48859
48846
|
const entryDependentNames = new Set([loopVariable.text]);
|
|
48860
48847
|
const visitLoop = (loopNode) => {
|
|
48861
|
-
if (
|
|
48862
|
-
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)) {
|
|
48863
48850
|
if (getPropertyName$1(loopNode.expression)?.match(/^(?:copyFile|readFile)(?:Sync)?$/) && loopNode.arguments.some((argument) => [...entryDependentNames].some((identifierName) => expressionContainsIdentifier(argument, identifierName)))) {
|
|
48864
48851
|
if (!isConditionallyExecuted(loopNode, node.statement)) unconditionallyConsumesEntries = true;
|
|
48865
48852
|
}
|
|
48866
48853
|
const calledExpression = unwrapTypescriptExpression(loopNode.expression);
|
|
48867
|
-
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;
|
|
48868
48855
|
}
|
|
48869
|
-
|
|
48856
|
+
_react_doctor_require_typescript_default.forEachChild(loopNode, visitLoop);
|
|
48870
48857
|
};
|
|
48871
48858
|
visitLoop(node.statement);
|
|
48872
48859
|
}
|
|
48873
48860
|
}
|
|
48874
48861
|
}
|
|
48875
|
-
|
|
48862
|
+
_react_doctor_require_typescript_default.forEachChild(node, visitNode);
|
|
48876
48863
|
};
|
|
48877
48864
|
visitNode(body);
|
|
48878
48865
|
return {
|
|
@@ -48882,11 +48869,11 @@ const analyzeDirectoryConsumer = (body, helperName, parameterName) => {
|
|
|
48882
48869
|
};
|
|
48883
48870
|
const collectRecursiveInputDirectories = (analysis, projectRoot, consumedFiles) => {
|
|
48884
48871
|
for (const node of analysis.liveNodes) {
|
|
48885
|
-
if (!
|
|
48872
|
+
if (!_react_doctor_require_typescript_default.isCallExpression(node) || !_react_doctor_require_typescript_default.isIdentifier(unwrapTypescriptExpression(node.expression))) continue;
|
|
48886
48873
|
const helperName = unwrapTypescriptExpression(node.expression).getText();
|
|
48887
48874
|
const helperBody = analysis.localFunctions.get(helperName);
|
|
48888
|
-
const helperDeclaration = [...analysis.sourceFile.statements].find((statement) =>
|
|
48889
|
-
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;
|
|
48890
48877
|
const directoryConsumption = analyzeDirectoryConsumer(helperBody, helperName, helperDeclaration.parameters[0].name.text);
|
|
48891
48878
|
if (!directoryConsumption.consumesAllEntries) continue;
|
|
48892
48879
|
const directoryArgument = node.arguments[0];
|
|
@@ -48897,9 +48884,9 @@ const collectRecursiveInputDirectories = (analysis, projectRoot, consumedFiles)
|
|
|
48897
48884
|
};
|
|
48898
48885
|
const evaluateCopySourceExpression = (expression, loopVariableName, loopVariableValue) => {
|
|
48899
48886
|
const unwrappedExpression = unwrapTypescriptExpression(expression);
|
|
48900
|
-
if (
|
|
48901
|
-
if (
|
|
48902
|
-
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)) {
|
|
48903
48890
|
let resolvedTemplate = unwrappedExpression.head.text;
|
|
48904
48891
|
for (const templateSpan of unwrappedExpression.templateSpans) {
|
|
48905
48892
|
const resolvedExpression = evaluateCopySourceExpression(templateSpan.expression, loopVariableName, loopVariableValue);
|
|
@@ -48908,7 +48895,7 @@ const evaluateCopySourceExpression = (expression, loopVariableName, loopVariable
|
|
|
48908
48895
|
}
|
|
48909
48896
|
return resolvedTemplate;
|
|
48910
48897
|
}
|
|
48911
|
-
if (
|
|
48898
|
+
if (_react_doctor_require_typescript_default.isBinaryExpression(unwrappedExpression) && unwrappedExpression.operatorToken.kind === _react_doctor_require_typescript_default.SyntaxKind.PlusToken) {
|
|
48912
48899
|
const leftValue = evaluateCopySourceExpression(unwrappedExpression.left, loopVariableName, loopVariableValue);
|
|
48913
48900
|
const rightValue = evaluateCopySourceExpression(unwrappedExpression.right, loopVariableName, loopVariableValue);
|
|
48914
48901
|
return leftValue === void 0 || rightValue === void 0 ? void 0 : `${leftValue}${rightValue}`;
|
|
@@ -48916,25 +48903,25 @@ const evaluateCopySourceExpression = (expression, loopVariableName, loopVariable
|
|
|
48916
48903
|
};
|
|
48917
48904
|
const collectCopiedSourceFiles = (analysis, projectRoot, consumedFiles) => {
|
|
48918
48905
|
for (const node of analysis.liveNodes) {
|
|
48919
|
-
if (!
|
|
48920
|
-
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;
|
|
48921
48908
|
const loopVariableName = node.initializer.declarations[0].name.text;
|
|
48922
48909
|
const arrayIdentifier = unwrapTypescriptExpression(node.expression);
|
|
48923
|
-
if (!
|
|
48910
|
+
if (!_react_doctor_require_typescript_default.isIdentifier(arrayIdentifier)) continue;
|
|
48924
48911
|
const arrayDeclaration = findVariableDeclaration(analysis.sourceFile, arrayIdentifier.text, node.getStart(analysis.sourceFile));
|
|
48925
|
-
if (!arrayDeclaration?.initializer || !
|
|
48912
|
+
if (!arrayDeclaration?.initializer || !_react_doctor_require_typescript_default.isArrayLiteralExpression(arrayDeclaration.initializer)) continue;
|
|
48926
48913
|
const values = arrayDeclaration.initializer.elements.flatMap((element) => {
|
|
48927
48914
|
const unwrappedElement = unwrapTypescriptExpression(element);
|
|
48928
|
-
return
|
|
48915
|
+
return _react_doctor_require_typescript_default.isStringLiteralLike(unwrappedElement) ? [unwrappedElement.text] : [];
|
|
48929
48916
|
});
|
|
48930
48917
|
const visitLoopBody = (loopNode) => {
|
|
48931
|
-
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) {
|
|
48932
48919
|
const sourceReference = evaluateCopySourceExpression(loopNode.arguments[0], loopVariableName, value);
|
|
48933
48920
|
if (!sourceReference) continue;
|
|
48934
48921
|
const sourcePath = resolveBuildReference(sourceReference, analysis.scriptFile.workingDirectory, projectRoot);
|
|
48935
48922
|
if (isPathInsideDirectoryOrEqual(sourcePath, projectRoot) && existsSync(sourcePath) && statSync(sourcePath).isFile() && SOURCE_FILE_EXTENSION_PATTERN.test(sourcePath)) consumedFiles.add(sourcePath);
|
|
48936
48923
|
}
|
|
48937
|
-
|
|
48924
|
+
_react_doctor_require_typescript_default.forEachChild(loopNode, visitLoopBody);
|
|
48938
48925
|
};
|
|
48939
48926
|
visitLoopBody(node.statement);
|
|
48940
48927
|
}
|
|
@@ -48943,56 +48930,56 @@ const expressionContainsString = (expression, value) => {
|
|
|
48943
48930
|
let containsString = false;
|
|
48944
48931
|
const visitNode = (node) => {
|
|
48945
48932
|
if (containsString) return;
|
|
48946
|
-
if (
|
|
48933
|
+
if (_react_doctor_require_typescript_default.isStringLiteralLike(node) && node.text === value) {
|
|
48947
48934
|
containsString = true;
|
|
48948
48935
|
return;
|
|
48949
48936
|
}
|
|
48950
|
-
|
|
48937
|
+
_react_doctor_require_typescript_default.forEachChild(node, visitNode);
|
|
48951
48938
|
};
|
|
48952
48939
|
visitNode(expression);
|
|
48953
48940
|
return containsString;
|
|
48954
48941
|
};
|
|
48955
48942
|
const collectObjectPathReferences = (expression, fileReferences) => {
|
|
48956
48943
|
const unwrappedExpression = unwrapTypescriptExpression(expression);
|
|
48957
|
-
if (
|
|
48944
|
+
if (_react_doctor_require_typescript_default.isStringLiteralLike(unwrappedExpression)) {
|
|
48958
48945
|
fileReferences.add(unwrappedExpression.text);
|
|
48959
48946
|
return;
|
|
48960
48947
|
}
|
|
48961
|
-
if (
|
|
48948
|
+
if (_react_doctor_require_typescript_default.isArrayLiteralExpression(unwrappedExpression)) {
|
|
48962
48949
|
for (const element of unwrappedExpression.elements) collectObjectPathReferences(element, fileReferences);
|
|
48963
48950
|
return;
|
|
48964
48951
|
}
|
|
48965
|
-
if (!
|
|
48952
|
+
if (!_react_doctor_require_typescript_default.isObjectLiteralExpression(unwrappedExpression)) return;
|
|
48966
48953
|
for (const property of unwrappedExpression.properties) {
|
|
48967
|
-
if (!
|
|
48968
|
-
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);
|
|
48969
48956
|
}
|
|
48970
48957
|
};
|
|
48971
48958
|
const findStyleRegistryFanoutSources = (analysis, analyses) => {
|
|
48972
48959
|
for (const node of analysis.liveNodes) {
|
|
48973
|
-
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;
|
|
48974
48961
|
const styleVariableName = node.initializer.declarations[0].name.text;
|
|
48975
48962
|
const styleCollectionExpression = unwrapTypescriptExpression(node.expression);
|
|
48976
|
-
if (!
|
|
48963
|
+
if (!_react_doctor_require_typescript_default.isIdentifier(styleCollectionExpression)) continue;
|
|
48977
48964
|
const stylesImport = analysis.importedFunctions.get(styleCollectionExpression.text);
|
|
48978
48965
|
const stylesAnalysis = stylesImport ? analyses.get(stylesImport.analysisKey) : void 0;
|
|
48979
48966
|
if (!stylesAnalysis) continue;
|
|
48980
48967
|
let registryAnalysis;
|
|
48981
48968
|
const visitStyleLoop = (loopNode) => {
|
|
48982
|
-
if (registryAnalysis || !
|
|
48983
|
-
if (!registryAnalysis)
|
|
48969
|
+
if (registryAnalysis || !_react_doctor_require_typescript_default.isForOfStatement(loopNode)) {
|
|
48970
|
+
if (!registryAnalysis) _react_doctor_require_typescript_default.forEachChild(loopNode, visitStyleLoop);
|
|
48984
48971
|
return;
|
|
48985
48972
|
}
|
|
48986
|
-
if (!
|
|
48987
|
-
|
|
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);
|
|
48988
48975
|
return;
|
|
48989
48976
|
}
|
|
48990
48977
|
const registryItemName = loopNode.initializer.declarations[0].name.text;
|
|
48991
48978
|
const registryCollectionExpression = unwrapTypescriptExpression(loopNode.expression);
|
|
48992
|
-
if (!
|
|
48979
|
+
if (!_react_doctor_require_typescript_default.isIdentifier(registryCollectionExpression)) return;
|
|
48993
48980
|
const normalizedLoopBodyText = loopNode.statement.getText(analysis.sourceFile).replace(/\s/g, "");
|
|
48994
48981
|
if (!normalizedLoopBodyText.includes(`src/registry/\${${styleVariableName}.name}/`) || !normalizedLoopBodyText.includes(`${registryItemName}.files`) || !/\$\{[A-Za-z_$][\w$]*\.path\}/.test(normalizedLoopBodyText)) {
|
|
48995
|
-
|
|
48982
|
+
_react_doctor_require_typescript_default.forEachChild(loopNode, visitStyleLoop);
|
|
48996
48983
|
return;
|
|
48997
48984
|
}
|
|
48998
48985
|
const registryImport = analysis.importedFunctions.get(registryCollectionExpression.text);
|
|
@@ -49009,10 +48996,10 @@ const collectRegistryFileReferences = (registryAnalysis, analyses) => {
|
|
|
49009
48996
|
const registryFileReferences = /* @__PURE__ */ new Set();
|
|
49010
48997
|
const collectRegistryModule = (moduleAnalysis) => {
|
|
49011
48998
|
const visitNode = (node) => {
|
|
49012
|
-
if (
|
|
49013
|
-
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);
|
|
49014
49001
|
}
|
|
49015
|
-
|
|
49002
|
+
_react_doctor_require_typescript_default.forEachChild(node, visitNode);
|
|
49016
49003
|
};
|
|
49017
49004
|
visitNode(moduleAnalysis.sourceFile);
|
|
49018
49005
|
};
|
|
@@ -49026,11 +49013,11 @@ const collectRegistryFileReferences = (registryAnalysis, analyses) => {
|
|
|
49026
49013
|
const collectRegistryStyleNames = (stylesAnalysis) => {
|
|
49027
49014
|
const styleNames = /* @__PURE__ */ new Set();
|
|
49028
49015
|
const visitNode = (node) => {
|
|
49029
|
-
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") {
|
|
49030
49017
|
const styleNameExpression = unwrapTypescriptExpression(node.initializer);
|
|
49031
|
-
if (
|
|
49018
|
+
if (_react_doctor_require_typescript_default.isStringLiteralLike(styleNameExpression)) styleNames.add(styleNameExpression.text);
|
|
49032
49019
|
}
|
|
49033
|
-
|
|
49020
|
+
_react_doctor_require_typescript_default.forEachChild(node, visitNode);
|
|
49034
49021
|
};
|
|
49035
49022
|
visitNode(stylesAnalysis.sourceFile);
|
|
49036
49023
|
return styleNames;
|
|
@@ -49044,7 +49031,7 @@ const collectResolvedRegistryFiles = (registryFileReferences, styleNames, regist
|
|
|
49044
49031
|
const collectRegistryMetadataConsumedFiles = (analyses, projectRoot, consumedFiles) => {
|
|
49045
49032
|
for (const analysis of analyses.values()) {
|
|
49046
49033
|
if (!basename(analysis.scriptFile.filePath).includes("registry")) continue;
|
|
49047
|
-
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;
|
|
49048
49035
|
const registryImport = analysis.importedFunctions.get("registry");
|
|
49049
49036
|
const stylesImport = analysis.importedFunctions.get("styles");
|
|
49050
49037
|
const registryAnalysis = registryImport ? analyses.get(registryImport.analysisKey) : void 0;
|
|
@@ -49065,7 +49052,7 @@ const nodeContainsNode = (rootNode, targetNode) => {
|
|
|
49065
49052
|
containsNode = true;
|
|
49066
49053
|
return;
|
|
49067
49054
|
}
|
|
49068
|
-
if (!containsNode)
|
|
49055
|
+
if (!containsNode) _react_doctor_require_typescript_default.forEachChild(node, visitNode);
|
|
49069
49056
|
};
|
|
49070
49057
|
visitNode(rootNode);
|
|
49071
49058
|
return containsNode;
|
|
@@ -49074,11 +49061,11 @@ const findAssignedVariableName = (analysis, targetNode) => {
|
|
|
49074
49061
|
let variableName;
|
|
49075
49062
|
let smallestInitializerWidth = Number.POSITIVE_INFINITY;
|
|
49076
49063
|
const visitNode = (node) => {
|
|
49077
|
-
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) {
|
|
49078
49065
|
variableName = node.name.text;
|
|
49079
49066
|
smallestInitializerWidth = node.initializer.end - node.initializer.pos;
|
|
49080
49067
|
}
|
|
49081
|
-
|
|
49068
|
+
_react_doctor_require_typescript_default.forEachChild(node, visitNode);
|
|
49082
49069
|
};
|
|
49083
49070
|
visitNode(analysis.sourceFile);
|
|
49084
49071
|
return variableName;
|
|
@@ -49086,29 +49073,29 @@ const findAssignedVariableName = (analysis, targetNode) => {
|
|
|
49086
49073
|
const recursivelyReadsManifestWildcards = (analysis, readCall) => {
|
|
49087
49074
|
const registryVariableName = findAssignedVariableName(analysis, readCall);
|
|
49088
49075
|
if (!registryVariableName) return false;
|
|
49089
|
-
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");
|
|
49090
49077
|
const sourceBaseDeclaration = findVariableDeclaration(analysis.sourceFile, "sourceBase", analysis.sourceFile.end);
|
|
49091
49078
|
if (hasDirectRecursiveRead && sourceBaseDeclaration?.initializer && sourceBaseDeclaration.initializer.getText(analysis.sourceFile).includes(registryVariableName) && sourceBaseDeclaration.initializer.getText(analysis.sourceFile).includes("split")) return true;
|
|
49092
49079
|
const collectionNames = new Set([registryVariableName]);
|
|
49093
|
-
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))) {
|
|
49094
49081
|
const propertyAccess = unwrapTypescriptExpression(node.initializer);
|
|
49095
|
-
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);
|
|
49096
49083
|
}
|
|
49097
49084
|
for (const node of analysis.liveNodes) {
|
|
49098
|
-
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;
|
|
49099
49086
|
const collectionExpression = unwrapTypescriptExpression(node.expression);
|
|
49100
|
-
if (!
|
|
49087
|
+
if (!_react_doctor_require_typescript_default.isIdentifier(collectionExpression) || !collectionNames.has(collectionExpression.text)) continue;
|
|
49101
49088
|
const componentName = node.initializer.declarations[0].name.text;
|
|
49102
49089
|
let hasRecursiveFileLoop = false;
|
|
49103
49090
|
const visitOuterLoop = (outerNode) => {
|
|
49104
|
-
if (
|
|
49091
|
+
if (_react_doctor_require_typescript_default.isForOfStatement(outerNode) && _react_doctor_require_typescript_default.isPropertyAccessExpression(unwrapTypescriptExpression(outerNode.expression))) {
|
|
49105
49092
|
const filesExpression = unwrapTypescriptExpression(outerNode.expression);
|
|
49106
|
-
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") {
|
|
49107
49094
|
const innerLoopText = outerNode.statement.getText(analysis.sourceFile);
|
|
49108
49095
|
if (/\.includes\(\s*["']\*["']\s*\)/.test(innerLoopText) && /\.split\(\s*["']\*["']\s*\)/.test(innerLoopText) && /\bwalk\s*\(\s*sourceBase\s*,\s*sourceBase\s*\)/.test(innerLoopText)) hasRecursiveFileLoop = true;
|
|
49109
49096
|
}
|
|
49110
49097
|
}
|
|
49111
|
-
if (!hasRecursiveFileLoop)
|
|
49098
|
+
if (!hasRecursiveFileLoop) _react_doctor_require_typescript_default.forEachChild(outerNode, visitOuterLoop);
|
|
49112
49099
|
};
|
|
49113
49100
|
visitOuterLoop(node.statement);
|
|
49114
49101
|
if (hasRecursiveFileLoop) return true;
|
|
@@ -49117,7 +49104,7 @@ const recursivelyReadsManifestWildcards = (analysis, readCall) => {
|
|
|
49117
49104
|
};
|
|
49118
49105
|
const collectReferencedManifestFiles = (analysis, projectRoot, consumedFiles) => {
|
|
49119
49106
|
for (const node of analysis.liveNodes) {
|
|
49120
|
-
if (!
|
|
49107
|
+
if (!_react_doctor_require_typescript_default.isCallExpression(node) || !getPropertyName$1(node.expression)?.match(/^readFile(?:Sync)?$/) || !node.arguments[0]) continue;
|
|
49121
49108
|
const manifestPath = evaluatePathExpression(node.arguments[0], analysis, projectRoot);
|
|
49122
49109
|
if (!manifestPath || basename(manifestPath) !== "registry.json") continue;
|
|
49123
49110
|
if (!isPathInsideDirectoryOrEqual(manifestPath, projectRoot)) continue;
|
|
@@ -49308,46 +49295,46 @@ const collectParcelHtmlEntryPaths = (rootDirectory) => {
|
|
|
49308
49295
|
} catch {
|
|
49309
49296
|
continue;
|
|
49310
49297
|
}
|
|
49311
|
-
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);
|
|
49312
49299
|
const parcelConstructorNames = /* @__PURE__ */ new Set();
|
|
49313
49300
|
const variableInitializers = /* @__PURE__ */ new Map();
|
|
49314
49301
|
for (const statement of sourceFile.statements) {
|
|
49315
|
-
if (
|
|
49302
|
+
if (_react_doctor_require_typescript_default.isImportDeclaration(statement) && _react_doctor_require_typescript_default.isStringLiteralLike(statement.moduleSpecifier) && statement.moduleSpecifier.text === "parcel-bundler") {
|
|
49316
49303
|
const importClause = statement.importClause;
|
|
49317
49304
|
if (importClause?.name) parcelConstructorNames.add(importClause.name.text);
|
|
49318
49305
|
}
|
|
49319
|
-
if (!
|
|
49306
|
+
if (!_react_doctor_require_typescript_default.isVariableStatement(statement)) continue;
|
|
49320
49307
|
for (const declaration of statement.declarationList.declarations) {
|
|
49321
|
-
if (!
|
|
49308
|
+
if (!_react_doctor_require_typescript_default.isIdentifier(declaration.name) || !declaration.initializer) continue;
|
|
49322
49309
|
variableInitializers.set(declaration.name.text, declaration.initializer);
|
|
49323
|
-
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);
|
|
49324
49311
|
}
|
|
49325
49312
|
}
|
|
49326
49313
|
if (parcelConstructorNames.size === 0) continue;
|
|
49327
49314
|
const evaluateEntryExpression = (expression, visitedIdentifiers = /* @__PURE__ */ new Set()) => {
|
|
49328
|
-
if (
|
|
49329
|
-
if (
|
|
49330
|
-
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)) {
|
|
49331
49318
|
if (visitedIdentifiers.has(expression.text)) return [];
|
|
49332
49319
|
const initializer = variableInitializers.get(expression.text);
|
|
49333
49320
|
if (!initializer) return [];
|
|
49334
49321
|
return evaluateEntryExpression(initializer, new Set(visitedIdentifiers).add(expression.text));
|
|
49335
49322
|
}
|
|
49336
|
-
if (
|
|
49337
|
-
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] : []);
|
|
49338
49325
|
return [resolve(dirname(scriptPath), ...pathSegments)];
|
|
49339
49326
|
}
|
|
49340
49327
|
return [];
|
|
49341
49328
|
};
|
|
49342
49329
|
const visitNode = (node) => {
|
|
49343
|
-
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])) {
|
|
49344
49331
|
const entryPattern = isAbsolute(entrySpecifier) ? entrySpecifier : resolve(dirname(scriptPath), entrySpecifier);
|
|
49345
49332
|
for (const htmlEntryPath of import_out.default.sync(entryPattern.replaceAll("\\", "/"), {
|
|
49346
49333
|
absolute: true,
|
|
49347
49334
|
onlyFiles: true
|
|
49348
49335
|
})) if (/\.html?$/i.test(htmlEntryPath)) htmlEntryPaths.add(htmlEntryPath);
|
|
49349
49336
|
}
|
|
49350
|
-
|
|
49337
|
+
_react_doctor_require_typescript_default.forEachChild(node, visitNode);
|
|
49351
49338
|
};
|
|
49352
49339
|
visitNode(sourceFile);
|
|
49353
49340
|
}
|
|
@@ -49393,22 +49380,22 @@ const isConsumedStringLiteral = (node) => {
|
|
|
49393
49380
|
let currentNode = node;
|
|
49394
49381
|
while (currentNode.parent) {
|
|
49395
49382
|
const parentNode = currentNode.parent;
|
|
49396
|
-
if (
|
|
49397
|
-
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;
|
|
49398
49385
|
currentNode = parentNode;
|
|
49399
49386
|
}
|
|
49400
49387
|
return false;
|
|
49401
49388
|
};
|
|
49402
49389
|
const matchesExecutableNodeModulesPackageReference = (content, packageName) => {
|
|
49403
|
-
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);
|
|
49404
49391
|
let isMatched = false;
|
|
49405
49392
|
const visit = (node) => {
|
|
49406
49393
|
if (isMatched) return;
|
|
49407
|
-
if (
|
|
49394
|
+
if (_react_doctor_require_typescript_default.isStringLiteralLike(node) && isConsumedStringLiteral(node) && matchesNodeModulesPackageReference(node.text, packageName)) {
|
|
49408
49395
|
isMatched = true;
|
|
49409
49396
|
return;
|
|
49410
49397
|
}
|
|
49411
|
-
|
|
49398
|
+
_react_doctor_require_typescript_default.forEachChild(node, visit);
|
|
49412
49399
|
};
|
|
49413
49400
|
visit(sourceFile);
|
|
49414
49401
|
return isMatched;
|
|
@@ -49468,14 +49455,14 @@ const collectTwoslashPackageNames = (sourceText) => {
|
|
|
49468
49455
|
const packageNames = /* @__PURE__ */ new Set();
|
|
49469
49456
|
for (const source of sources) try {
|
|
49470
49457
|
for (const packageName of collectStaticModulePackageNames(source)) packageNames.add(packageName);
|
|
49471
|
-
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);
|
|
49472
49459
|
const visitNode = (node) => {
|
|
49473
|
-
for (const tag of
|
|
49474
|
-
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;
|
|
49475
49462
|
const packageName = extractPackageName(tag.moduleSpecifier.text);
|
|
49476
49463
|
if (packageName) packageNames.add(packageName);
|
|
49477
49464
|
}
|
|
49478
|
-
|
|
49465
|
+
_react_doctor_require_typescript_default.forEachChild(node, visitNode);
|
|
49479
49466
|
};
|
|
49480
49467
|
visitNode(sourceFile);
|
|
49481
49468
|
} catch {
|
|
@@ -49529,27 +49516,27 @@ const KARMA_BROWSER_PACKAGES = new Map([
|
|
|
49529
49516
|
["Safari", ["karma-safari-launcher"]]
|
|
49530
49517
|
]);
|
|
49531
49518
|
const collectExpressionStrings = (expression, identifierStrings, strings) => {
|
|
49532
|
-
if (
|
|
49519
|
+
if (_react_doctor_require_typescript_default.isStringLiteralLike(expression)) {
|
|
49533
49520
|
strings.add(expression.text);
|
|
49534
49521
|
return;
|
|
49535
49522
|
}
|
|
49536
|
-
if (
|
|
49523
|
+
if (_react_doctor_require_typescript_default.isIdentifier(expression)) {
|
|
49537
49524
|
for (const value of identifierStrings.get(expression.text) ?? []) strings.add(value);
|
|
49538
49525
|
return;
|
|
49539
49526
|
}
|
|
49540
|
-
if (
|
|
49541
|
-
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);
|
|
49542
49529
|
else collectExpressionStrings(element, identifierStrings, strings);
|
|
49543
49530
|
return;
|
|
49544
49531
|
}
|
|
49545
|
-
if (
|
|
49532
|
+
if (_react_doctor_require_typescript_default.isConditionalExpression(expression)) {
|
|
49546
49533
|
collectExpressionStrings(expression.whenTrue, identifierStrings, strings);
|
|
49547
49534
|
collectExpressionStrings(expression.whenFalse, identifierStrings, strings);
|
|
49548
49535
|
return;
|
|
49549
49536
|
}
|
|
49550
|
-
if (
|
|
49551
|
-
for (const property of expression.properties) if (
|
|
49552
|
-
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);
|
|
49553
49540
|
}
|
|
49554
49541
|
};
|
|
49555
49542
|
const collectIdentifierStrings = (sourceFile) => {
|
|
@@ -49560,21 +49547,21 @@ const collectIdentifierStrings = (sourceFile) => {
|
|
|
49560
49547
|
identifierStrings.set(identifierName, strings);
|
|
49561
49548
|
};
|
|
49562
49549
|
const visit = (node) => {
|
|
49563
|
-
if (
|
|
49564
|
-
if (
|
|
49565
|
-
|
|
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);
|
|
49566
49553
|
};
|
|
49567
49554
|
visit(sourceFile);
|
|
49568
49555
|
return identifierStrings;
|
|
49569
49556
|
};
|
|
49570
49557
|
const collectPropertyStrings = (property, identifierStrings) => {
|
|
49571
49558
|
const strings = /* @__PURE__ */ new Set();
|
|
49572
|
-
if (
|
|
49573
|
-
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);
|
|
49574
49561
|
return strings;
|
|
49575
49562
|
};
|
|
49576
49563
|
const extractKarmaConfigPackageReferences = (content, declaredPackageNames) => {
|
|
49577
|
-
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);
|
|
49578
49565
|
const identifierStrings = collectIdentifierStrings(sourceFile);
|
|
49579
49566
|
const referencedPackages = /* @__PURE__ */ new Set();
|
|
49580
49567
|
const propertyPackageMaps = new Map([
|
|
@@ -49584,12 +49571,12 @@ const extractKarmaConfigPackageReferences = (content, declaredPackageNames) => {
|
|
|
49584
49571
|
["browsers", KARMA_BROWSER_PACKAGES]
|
|
49585
49572
|
]);
|
|
49586
49573
|
const visit = (node) => {
|
|
49587
|
-
if (
|
|
49574
|
+
if (_react_doctor_require_typescript_default.isObjectLiteralExpression(node)) for (const property of node.properties) {
|
|
49588
49575
|
const packageMap = propertyPackageMaps.get(getObjectLiteralElementName(property) ?? "");
|
|
49589
49576
|
if (!packageMap) continue;
|
|
49590
49577
|
for (const token of collectPropertyStrings(property, identifierStrings)) for (const packageName of packageMap.get(token) ?? []) if (declaredPackageNames.has(packageName)) referencedPackages.add(packageName);
|
|
49591
49578
|
}
|
|
49592
|
-
|
|
49579
|
+
_react_doctor_require_typescript_default.forEachChild(node, visit);
|
|
49593
49580
|
};
|
|
49594
49581
|
visit(sourceFile);
|
|
49595
49582
|
return [...referencedPackages];
|
|
@@ -49606,23 +49593,23 @@ const hasExpoReactServerFunctions = (rootDirectory) => {
|
|
|
49606
49593
|
//#endregion
|
|
49607
49594
|
//#region ../core/src/project-analysis/utils/has-antfu-eslint-react-config.ts
|
|
49608
49595
|
const hasReactEnabled = (expression) => {
|
|
49609
|
-
if (!
|
|
49610
|
-
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)));
|
|
49611
49598
|
};
|
|
49612
49599
|
const hasAntfuEslintReactConfig = (content) => {
|
|
49613
49600
|
const virtualFilePath = "eslint.config.ts";
|
|
49614
|
-
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);
|
|
49615
49602
|
const compilerOptions = {
|
|
49616
49603
|
allowJs: true,
|
|
49617
49604
|
noLib: true,
|
|
49618
49605
|
noResolve: true,
|
|
49619
|
-
target:
|
|
49606
|
+
target: _react_doctor_require_typescript_default.ScriptTarget.Latest
|
|
49620
49607
|
};
|
|
49621
|
-
const compilerHost =
|
|
49608
|
+
const compilerHost = _react_doctor_require_typescript_default.createCompilerHost(compilerOptions);
|
|
49622
49609
|
compilerHost.fileExists = (candidatePath) => candidatePath === virtualFilePath;
|
|
49623
49610
|
compilerHost.getSourceFile = (candidatePath) => candidatePath === virtualFilePath ? sourceFile : void 0;
|
|
49624
49611
|
compilerHost.readFile = (candidatePath) => candidatePath === virtualFilePath ? content : void 0;
|
|
49625
|
-
const program =
|
|
49612
|
+
const program = _react_doctor_require_typescript_default.createProgram({
|
|
49626
49613
|
rootNames: [virtualFilePath],
|
|
49627
49614
|
options: compilerOptions,
|
|
49628
49615
|
host: compilerHost
|
|
@@ -49632,24 +49619,24 @@ const hasAntfuEslintReactConfig = (content) => {
|
|
|
49632
49619
|
const typeChecker = program.getTypeChecker();
|
|
49633
49620
|
const antfuFactorySymbols = /* @__PURE__ */ new Set();
|
|
49634
49621
|
for (const statement of boundSourceFile.statements) {
|
|
49635
|
-
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;
|
|
49636
49623
|
const factorySymbol = typeChecker.getSymbolAtLocation(statement.importClause.name);
|
|
49637
49624
|
if (factorySymbol) antfuFactorySymbols.add(factorySymbol);
|
|
49638
49625
|
}
|
|
49639
49626
|
let isReactEnabled = false;
|
|
49640
49627
|
const visit = (node) => {
|
|
49641
49628
|
if (isReactEnabled) return;
|
|
49642
|
-
if (
|
|
49643
|
-
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])) {
|
|
49644
49631
|
const factorySymbol = typeChecker.getSymbolAtLocation(node.expression);
|
|
49645
49632
|
if (factorySymbol && antfuFactorySymbols.has(factorySymbol)) {
|
|
49646
49633
|
isReactEnabled = true;
|
|
49647
49634
|
return;
|
|
49648
49635
|
}
|
|
49649
49636
|
}
|
|
49650
|
-
|
|
49637
|
+
_react_doctor_require_typescript_default.forEachChild(node, visit);
|
|
49651
49638
|
};
|
|
49652
|
-
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);
|
|
49653
49640
|
return isReactEnabled;
|
|
49654
49641
|
};
|
|
49655
49642
|
//#endregion
|
|
@@ -51102,32 +51089,32 @@ const SUPPORTED_GLOBAL_VALUES = new Set([
|
|
|
51102
51089
|
"writeable"
|
|
51103
51090
|
]);
|
|
51104
51091
|
const getStaticProperty = (objectExpression, propertyName) => objectExpression.properties.find((property) => {
|
|
51105
|
-
if (
|
|
51106
|
-
const name =
|
|
51107
|
-
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;
|
|
51108
51095
|
}) ?? null;
|
|
51109
|
-
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)));
|
|
51110
51097
|
const getStaticPropertyAssignment = (objectExpression, propertyName) => {
|
|
51111
51098
|
const property = getStaticProperty(objectExpression, propertyName);
|
|
51112
|
-
return property &&
|
|
51099
|
+
return property && _react_doctor_require_typescript_default.isPropertyAssignment(property) ? property : null;
|
|
51113
51100
|
};
|
|
51114
51101
|
const getRequireModuleSpecifier = (expression) => {
|
|
51115
51102
|
const unwrappedExpression = unwrapTypescriptExpression(expression);
|
|
51116
|
-
if (
|
|
51117
|
-
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;
|
|
51118
51105
|
const moduleSpecifier = unwrappedExpression.arguments[0];
|
|
51119
|
-
return moduleSpecifier &&
|
|
51106
|
+
return moduleSpecifier && _react_doctor_require_typescript_default.isStringLiteralLike(moduleSpecifier) ? moduleSpecifier.text : null;
|
|
51120
51107
|
};
|
|
51121
51108
|
const getRequiredPropertyModuleSpecifier = (expression, propertyName) => {
|
|
51122
51109
|
const unwrappedExpression = unwrapTypescriptExpression(expression);
|
|
51123
|
-
return
|
|
51110
|
+
return _react_doctor_require_typescript_default.isPropertyAccessExpression(unwrappedExpression) && unwrappedExpression.name.text === propertyName ? getRequireModuleSpecifier(unwrappedExpression.expression) : null;
|
|
51124
51111
|
};
|
|
51125
|
-
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");
|
|
51126
51113
|
const isTopLevelExpression = (node) => {
|
|
51127
51114
|
let ancestor = node.parent;
|
|
51128
|
-
while (ancestor && !
|
|
51129
|
-
if (
|
|
51130
|
-
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;
|
|
51131
51118
|
ancestor = ancestor.parent;
|
|
51132
51119
|
}
|
|
51133
51120
|
return false;
|
|
@@ -51135,21 +51122,21 @@ const isTopLevelExpression = (node) => {
|
|
|
51135
51122
|
const isInsideActiveConfigProperty = (node, propertyName, sourceFile, esbuildBindings, esbuildNamespaceBindings) => {
|
|
51136
51123
|
let ancestor = node.parent;
|
|
51137
51124
|
let didFindConfigProperty = false;
|
|
51138
|
-
while (ancestor && !
|
|
51139
|
-
if (!didFindConfigProperty && !
|
|
51140
|
-
if (
|
|
51141
|
-
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;
|
|
51142
51129
|
if (didFindConfigProperty || !isConfigProperty) return false;
|
|
51143
|
-
if (!
|
|
51130
|
+
if (!_react_doctor_require_typescript_default.isObjectLiteralExpression(ancestor.parent) || ancestor.parent.properties.some(_react_doctor_require_typescript_default.isSpreadAssignment)) return false;
|
|
51144
51131
|
didFindConfigProperty = true;
|
|
51145
51132
|
ancestor = ancestor.parent;
|
|
51146
51133
|
continue;
|
|
51147
51134
|
}
|
|
51148
51135
|
if (didFindConfigProperty) {
|
|
51149
|
-
if (
|
|
51136
|
+
if (_react_doctor_require_typescript_default.isExportAssignment(ancestor)) return true;
|
|
51150
51137
|
if (isCommonJsExportAssignment(ancestor, sourceFile)) return isTopLevelExpression(ancestor);
|
|
51151
|
-
if (propertyName === "plugins" &&
|
|
51152
|
-
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;
|
|
51153
51140
|
}
|
|
51154
51141
|
ancestor = ancestor.parent;
|
|
51155
51142
|
}
|
|
@@ -51159,21 +51146,21 @@ const getGlobalsPathFromActiveAutoImportCall = (callExpression, packageDirectory
|
|
|
51159
51146
|
const optionsExpression = callExpression.arguments[0];
|
|
51160
51147
|
if (!optionsExpression) return null;
|
|
51161
51148
|
const unwrappedOptions = unwrapTypescriptExpression(optionsExpression);
|
|
51162
|
-
if (!
|
|
51163
|
-
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;
|
|
51164
51151
|
if (getStaticProperty(unwrappedOptions, "include") || getStaticProperty(unwrappedOptions, "exclude")) return null;
|
|
51165
51152
|
const eslintrcProperty = getStaticPropertyAssignment(unwrappedOptions, "eslintrc");
|
|
51166
51153
|
if (!eslintrcProperty) return null;
|
|
51167
51154
|
const eslintrcExpression = unwrapTypescriptExpression(eslintrcProperty.initializer);
|
|
51168
|
-
if (!
|
|
51169
|
-
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;
|
|
51170
51157
|
const enabledProperty = getStaticPropertyAssignment(eslintrcExpression, "enabled");
|
|
51171
|
-
if (!enabledProperty || unwrapTypescriptExpression(enabledProperty.initializer).kind !==
|
|
51158
|
+
if (!enabledProperty || unwrapTypescriptExpression(enabledProperty.initializer).kind !== _react_doctor_require_typescript_default.SyntaxKind.TrueKeyword) return null;
|
|
51172
51159
|
const filepathProperty = getStaticProperty(eslintrcExpression, "filepath");
|
|
51173
51160
|
if (!filepathProperty) return path$1.join(packageDirectory, DEFAULT_ESLINT_GLOBALS_PATH);
|
|
51174
|
-
if (!
|
|
51161
|
+
if (!_react_doctor_require_typescript_default.isPropertyAssignment(filepathProperty)) return null;
|
|
51175
51162
|
const filepathExpression = unwrapTypescriptExpression(filepathProperty.initializer);
|
|
51176
|
-
return
|
|
51163
|
+
return _react_doctor_require_typescript_default.isStringLiteralLike(filepathExpression) ? path$1.resolve(packageDirectory, filepathExpression.text) : null;
|
|
51177
51164
|
};
|
|
51178
51165
|
const collectGlobalsPathsFromConfig = (configPath, packageDirectory) => {
|
|
51179
51166
|
let sourceText;
|
|
@@ -51185,12 +51172,12 @@ const collectGlobalsPathsFromConfig = (configPath, packageDirectory) => {
|
|
|
51185
51172
|
globalsPaths: []
|
|
51186
51173
|
};
|
|
51187
51174
|
}
|
|
51188
|
-
const sourceFile =
|
|
51175
|
+
const sourceFile = _react_doctor_require_typescript_default.createSourceFile(configPath, sourceText, _react_doctor_require_typescript_default.ScriptTarget.Latest, true);
|
|
51189
51176
|
const autoImportBindings = /* @__PURE__ */ new Map();
|
|
51190
51177
|
const esbuildBindings = /* @__PURE__ */ new Set();
|
|
51191
51178
|
const esbuildNamespaceBindings = /* @__PURE__ */ new Set();
|
|
51192
51179
|
for (const statement of sourceFile.statements) {
|
|
51193
|
-
if (
|
|
51180
|
+
if (_react_doctor_require_typescript_default.isImportDeclaration(statement) && _react_doctor_require_typescript_default.isStringLiteralLike(statement.moduleSpecifier)) {
|
|
51194
51181
|
const moduleSpecifier = statement.moduleSpecifier.text;
|
|
51195
51182
|
if (AUTO_IMPORT_ADAPTER_PATTERN.test(moduleSpecifier)) {
|
|
51196
51183
|
const defaultBinding = statement.importClause?.name;
|
|
@@ -51200,23 +51187,23 @@ const collectGlobalsPathsFromConfig = (configPath, packageDirectory) => {
|
|
|
51200
51187
|
const defaultBinding = statement.importClause?.name;
|
|
51201
51188
|
if (defaultBinding) esbuildNamespaceBindings.add(defaultBinding.text);
|
|
51202
51189
|
const namedBindings = statement.importClause?.namedBindings;
|
|
51203
|
-
if (namedBindings &&
|
|
51190
|
+
if (namedBindings && _react_doctor_require_typescript_default.isNamedImports(namedBindings)) {
|
|
51204
51191
|
for (const importSpecifier of namedBindings.elements) if ((importSpecifier.propertyName ?? importSpecifier.name).text === "build") esbuildBindings.add(importSpecifier.name.text);
|
|
51205
51192
|
}
|
|
51206
|
-
if (namedBindings &&
|
|
51193
|
+
if (namedBindings && _react_doctor_require_typescript_default.isNamespaceImport(namedBindings)) esbuildNamespaceBindings.add(namedBindings.name.text);
|
|
51207
51194
|
}
|
|
51208
51195
|
}
|
|
51209
|
-
if (!
|
|
51196
|
+
if (!_react_doctor_require_typescript_default.isVariableStatement(statement)) continue;
|
|
51210
51197
|
for (const declaration of statement.declarationList.declarations) {
|
|
51211
51198
|
if (!declaration.initializer) continue;
|
|
51212
|
-
const declarationName =
|
|
51199
|
+
const declarationName = _react_doctor_require_typescript_default.isIdentifier(declaration.name) ? declaration.name.text : null;
|
|
51213
51200
|
const moduleSpecifier = getRequireModuleSpecifier(declaration.initializer);
|
|
51214
51201
|
if (declarationName && moduleSpecifier && AUTO_IMPORT_ADAPTER_PATTERN.test(moduleSpecifier)) autoImportBindings.set(declarationName, moduleSpecifier);
|
|
51215
51202
|
if (moduleSpecifier === "esbuild") {
|
|
51216
51203
|
if (declarationName) esbuildNamespaceBindings.add(declarationName);
|
|
51217
|
-
if (
|
|
51204
|
+
if (_react_doctor_require_typescript_default.isObjectBindingPattern(declaration.name)) for (const bindingElement of declaration.name.elements) {
|
|
51218
51205
|
const importedName = bindingElement.propertyName ?? bindingElement.name;
|
|
51219
|
-
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);
|
|
51220
51207
|
}
|
|
51221
51208
|
}
|
|
51222
51209
|
if (declarationName && getRequiredPropertyModuleSpecifier(declaration.initializer, "build") === "esbuild") esbuildBindings.add(declarationName);
|
|
@@ -51226,8 +51213,8 @@ const collectGlobalsPathsFromConfig = (configPath, packageDirectory) => {
|
|
|
51226
51213
|
let didFindActiveAutoImport = false;
|
|
51227
51214
|
let didFindUnsafeActiveAutoImport = false;
|
|
51228
51215
|
const visit = (node) => {
|
|
51229
|
-
if (
|
|
51230
|
-
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);
|
|
51231
51218
|
if (moduleSpecifier && AUTO_IMPORT_ADAPTER_PATTERN.test(moduleSpecifier)) {
|
|
51232
51219
|
if (isInsideActiveConfigProperty(node, moduleSpecifier.endsWith("/astro") ? "integrations" : "plugins", sourceFile, esbuildBindings, esbuildNamespaceBindings)) {
|
|
51233
51220
|
didFindActiveAutoImport = true;
|
|
@@ -51237,7 +51224,7 @@ const collectGlobalsPathsFromConfig = (configPath, packageDirectory) => {
|
|
|
51237
51224
|
}
|
|
51238
51225
|
}
|
|
51239
51226
|
}
|
|
51240
|
-
|
|
51227
|
+
_react_doctor_require_typescript_default.forEachChild(node, visit);
|
|
51241
51228
|
};
|
|
51242
51229
|
visit(sourceFile);
|
|
51243
51230
|
return {
|
|
@@ -51318,7 +51305,7 @@ const GENERATED_AUTO_IMPORT_MARKER = "Generated by unplugin-auto-import";
|
|
|
51318
51305
|
const AUTO_IMPORT_SOURCE_BINDING_PATTERN = /\bconst\s+([A-Za-z_$][\w$]*)\s*:\s*typeof\s+import\(["']([^"']+)["']\)\[["']([^"']+)["']\]/g;
|
|
51319
51306
|
const isNonReferenceIdentifier = (identifier) => {
|
|
51320
51307
|
const parent = identifier.parent;
|
|
51321
|
-
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;
|
|
51322
51309
|
};
|
|
51323
51310
|
const collectUnboundGlobalNames = (filePath, candidateGlobalNames) => {
|
|
51324
51311
|
let source;
|
|
@@ -51327,19 +51314,19 @@ const collectUnboundGlobalNames = (filePath, candidateGlobalNames) => {
|
|
|
51327
51314
|
} catch {
|
|
51328
51315
|
return /* @__PURE__ */ new Set();
|
|
51329
51316
|
}
|
|
51330
|
-
const sourceFile =
|
|
51317
|
+
const sourceFile = _react_doctor_require_typescript_default.createSourceFile(filePath, source, _react_doctor_require_typescript_default.ScriptTarget.Latest, true);
|
|
51331
51318
|
const compilerOptions = {
|
|
51332
51319
|
allowJs: true,
|
|
51333
|
-
jsx:
|
|
51320
|
+
jsx: _react_doctor_require_typescript_default.JsxEmit.Preserve,
|
|
51334
51321
|
noLib: true,
|
|
51335
51322
|
noResolve: true,
|
|
51336
|
-
target:
|
|
51323
|
+
target: _react_doctor_require_typescript_default.ScriptTarget.Latest
|
|
51337
51324
|
};
|
|
51338
|
-
const compilerHost =
|
|
51325
|
+
const compilerHost = _react_doctor_require_typescript_default.createCompilerHost(compilerOptions);
|
|
51339
51326
|
compilerHost.fileExists = (candidatePath) => candidatePath === filePath;
|
|
51340
51327
|
compilerHost.getSourceFile = (candidatePath) => candidatePath === filePath ? sourceFile : void 0;
|
|
51341
51328
|
compilerHost.readFile = (candidatePath) => candidatePath === filePath ? source : void 0;
|
|
51342
|
-
const program =
|
|
51329
|
+
const program = _react_doctor_require_typescript_default.createProgram({
|
|
51343
51330
|
rootNames: [filePath],
|
|
51344
51331
|
options: compilerOptions,
|
|
51345
51332
|
host: compilerHost
|
|
@@ -51349,10 +51336,10 @@ const collectUnboundGlobalNames = (filePath, candidateGlobalNames) => {
|
|
|
51349
51336
|
if (!boundSourceFile) return /* @__PURE__ */ new Set();
|
|
51350
51337
|
const unboundGlobalNames = /* @__PURE__ */ new Set();
|
|
51351
51338
|
const visitNode = (node) => {
|
|
51352
|
-
if (
|
|
51353
|
-
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);
|
|
51354
51341
|
}
|
|
51355
|
-
|
|
51342
|
+
_react_doctor_require_typescript_default.forEachChild(node, visitNode);
|
|
51356
51343
|
};
|
|
51357
51344
|
visitNode(boundSourceFile);
|
|
51358
51345
|
return unboundGlobalNames;
|
|
@@ -51525,7 +51512,7 @@ const hasUnparseableCompilerConfig = (packageRootDirectory) => {
|
|
|
51525
51512
|
return configNames.some((configName) => {
|
|
51526
51513
|
const configPath = join(packageRootDirectory, configName);
|
|
51527
51514
|
try {
|
|
51528
|
-
return
|
|
51515
|
+
return _react_doctor_require_typescript_default.parseConfigFileTextToJson(configPath, readFileSync(configPath, "utf8")).error !== void 0;
|
|
51529
51516
|
} catch {
|
|
51530
51517
|
return true;
|
|
51531
51518
|
}
|
|
@@ -51898,4 +51885,4 @@ startProjectAnalysisWorker();
|
|
|
51898
51885
|
export {};
|
|
51899
51886
|
|
|
51900
51887
|
//# sourceMappingURL=project-analysis-worker.js.map
|
|
51901
|
-
//# debugId=
|
|
51888
|
+
//# debugId=a64790d6-0fbf-5baf-969b-f9980583a72d
|