react-doctor 0.9.12-dev.ffc2d14 → 0.9.13-dev.1239043
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/README.md +33 -0
- package/dist/active-run-trace-dlIZeEvb.js +18 -0
- package/dist/active-scan-abort-registry-DwG6tSPy.js +28 -0
- package/dist/{build-section-divider-BuOtLrzK.js → build-section-divider-C09RcJrc.js} +8 -22
- package/dist/{ci-DVVsf25h.js → ci-CUgNjCr-.js} +12 -11
- package/dist/cli.js +116 -35
- package/dist/{design-Y1pcA2uj.js → design-CX2j8ubS.js} +4 -4
- package/dist/{devtools-D8NTVj81.js → devtools-CC2PAZ85.js} +3 -3
- package/dist/{exit-gracefully-DnXGONjj.js → exit-gracefully-cGJM2g3O.js} +15 -9
- package/dist/get-east-asian-width-Bv2TD3Xj.js +444 -0
- package/dist/{report-error-MGKyeIns.js → handle-error-BCI-Nv3P.js} +18 -68
- package/dist/index.d.ts +32 -0
- package/dist/index.js +628 -301
- package/dist/{inspect-g3_lzs3l.js → inspect-Dq5krKWG.js} +41 -29
- package/dist/{install-02Lq6wKC.js → install-C0aiZKgf.js} +9 -8
- package/dist/{install-doctor-script-DmEWQpVJ.js → install-doctor-script-CaTIms0r.js} +7 -449
- package/dist/{install-github-workflow-Dx6Pl9Wl.js → install-github-workflow-DjPgXVqg.js} +10 -6
- package/dist/{install-react-doctor-CMCXgenA.js → install-react-doctor-C-PVDWXv.js} +8 -8
- package/dist/{run-scan-app-CDDu7P32.js → jsx-runtime-D_A4d39v.js} +280 -2774
- package/dist/path-format-DnHpmJwG.js +9 -0
- package/dist/{print-branded-header-kbvWYuGv.js → print-branded-header-Dz0SwyHQ.js} +4 -4
- package/dist/project-analysis-worker.js +59 -54
- package/dist/prompt-runtime-scan-url-BXdY2Opw.js +240 -0
- package/dist/{read-object-file-Cwhr9OIi.js → read-object-file-CmMGK1uu.js} +4 -4
- package/dist/{record-metric-CFfsgcVs.js → record-metric-B6T_Ej33.js} +592 -250
- package/dist/report-error-DwL3b99q.js +64 -0
- package/dist/{report-workflow-result-DGg9xopH.js → report-workflow-result-5PueDIAr.js} +5 -5
- package/dist/{resolve-scope-CXS-5jLR.js → resolve-scope-CTlLl7e6.js} +8 -10
- package/dist/{rules-CThlosPx.js → rules-DEbHKRag.js} +6 -6
- package/dist/run-scan-app-D3huvmXJ.js +2517 -0
- package/dist/runtime-scan/browser-probe.iife.js +855 -0
- package/dist/runtime-scan-CHFAEYg3.js +770 -0
- package/dist/sanitize-runtime-url-Bbq40iIp.js +76 -0
- package/dist/scan-C7sCm7wi.js +47 -0
- package/dist/{should-fail-scan-gate-C0Bo5Gqy.js → should-fail-scan-gate-CfG_ppAV.js} +50 -117
- package/dist/{should-skip-prompts-BqrtVX4G.js → should-skip-prompts-BuNtAVEs.js} +4 -4
- package/dist/should-use-tui-B-lCjXVG.js +25 -0
- package/dist/skills/improve-threejs/SKILL.md +102 -0
- package/dist/skills/performance/SKILL.md +113 -0
- package/dist/skills/react-doctor/SKILL.md +6 -0
- package/dist/{unref-stdin-BxyvqsOy.js → telemetry-runtime-BF83aBFL.js} +55 -25
- package/dist/unref-stdin-SK3WfwxS.js +12 -0
- package/dist/{version-S-8vvWFi.js → version-C27gr4Qj.js} +4 -4
- package/dist/{why-DXfx0oL9.js → why-CYRkZ2VY.js} +4 -4
- package/dist/with-run-span-CdsXSJgE.js +110 -0
- package/package.json +9 -6
- package/dist/scan-4I1mvxBO.js +0 -53
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/cli/utils/path-format.ts
|
|
2
|
+
|
|
3
|
+
!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]="0330366c-931b-5aad-9410-de708cd22f46")}catch(e){}}();
|
|
4
|
+
const toForwardSlashes = (filePath) => filePath.replaceAll("\\", "/");
|
|
5
|
+
//#endregion
|
|
6
|
+
export { toForwardSlashes as t };
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=path-format-DnHpmJwG.js.map
|
|
9
|
+
//# debugId=0330366c-931b-5aad-9410-de708cd22f46
|
|
@@ -1,6 +1,6 @@
|
|
|
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]="
|
|
3
|
-
import {
|
|
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]="b38b1905-c03d-5b17-8787-a274af96f23e")}catch(e){}}();
|
|
3
|
+
import { An as gen, Kt as highlighter, Tn as log, _ as VERSION } from "./record-metric-B6T_Ej33.js";
|
|
4
4
|
//#region src/cli/utils/print-branded-header.ts
|
|
5
5
|
/**
|
|
6
6
|
* Single branded line every command prints first when not in JSON
|
|
@@ -18,5 +18,5 @@ const printBrandedHeader = gen(function* () {
|
|
|
18
18
|
//#endregion
|
|
19
19
|
export { printBrandedHeader as t };
|
|
20
20
|
|
|
21
|
-
//# sourceMappingURL=print-branded-header-
|
|
22
|
-
//# debugId=
|
|
21
|
+
//# sourceMappingURL=print-branded-header-Dz0SwyHQ.js.map
|
|
22
|
+
//# debugId=b38b1905-c03d-5b17-8787-a274af96f23e
|
|
@@ -1,5 +1,5 @@
|
|
|
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]="36894edb-acbd-5c90-9ce2-80c54b021bfb")}catch(e){}}();
|
|
3
3
|
import { i as __toESM, n as __exportAll, r as __require, t as __commonJSMin } from "./chunk-ChKA3wi6.js";
|
|
4
4
|
import { n as require_picomatch$2, t as require_semver } from "./semver-DFtnEmN-.js";
|
|
5
5
|
import { builtinModules } from "node:module";
|
|
@@ -9,12 +9,12 @@ import path, { basename, dirname, extname, isAbsolute, join, parse, posix, relat
|
|
|
9
9
|
import * as fs$1 from "node:fs";
|
|
10
10
|
import { existsSync, readFileSync, readdirSync, realpathSync, statSync } from "node:fs";
|
|
11
11
|
import ts from "typescript";
|
|
12
|
+
import { parseSync } from "oxc-parser";
|
|
12
13
|
import { ResolverFactory } from "oxc-resolver";
|
|
13
14
|
import { devNull } from "node:os";
|
|
14
15
|
import { parseJSONC, parseTOML, parseYAML } from "confbox";
|
|
15
16
|
import { readFile } from "node:fs/promises";
|
|
16
17
|
import { parse as parse$1 } from "@astrojs/compiler/sync";
|
|
17
|
-
import { parseSync } from "oxc-parser";
|
|
18
18
|
//#region ../core/src/project-analysis/constants.ts
|
|
19
19
|
const DEFAULT_EXTENSIONS = [
|
|
20
20
|
".ts",
|
|
@@ -38057,6 +38057,13 @@ const discoverMobileEntryPoints = (directory) => {
|
|
|
38057
38057
|
}
|
|
38058
38058
|
};
|
|
38059
38059
|
//#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
|
|
38060
38067
|
//#region ../core/src/project-analysis/collect/expo-config-plugin-entries.ts
|
|
38061
38068
|
const EXPO_CONFIG_FILE_GLOBS = ["app.config.{ts,mts,cts,js,mjs,cjs}", "app.json"];
|
|
38062
38069
|
const NESTED_EXPO_CONFIG_FILE_GLOBS = [
|
|
@@ -38102,11 +38109,6 @@ const addExpoPluginEntry = (entries, packageNamePlugins, rootDirectory, configDi
|
|
|
38102
38109
|
const getPropertyName$4 = (name) => {
|
|
38103
38110
|
if (ts.isIdentifier(name) || ts.isStringLiteral(name) || ts.isNumericLiteral(name)) return name.text;
|
|
38104
38111
|
};
|
|
38105
|
-
const unwrapExpression = (expression) => {
|
|
38106
|
-
let currentExpression = expression;
|
|
38107
|
-
while (ts.isParenthesizedExpression(currentExpression)) currentExpression = currentExpression.expression;
|
|
38108
|
-
return currentExpression;
|
|
38109
|
-
};
|
|
38110
38112
|
const collectExpoPluginPathsFromArray = (array, entries, packageNamePlugins, rootDirectory, configDirectory) => {
|
|
38111
38113
|
for (const element of array.elements) {
|
|
38112
38114
|
if (ts.isStringLiteral(element) || ts.isNoSubstitutionTemplateLiteral(element)) {
|
|
@@ -38129,14 +38131,14 @@ const collectExpoPluginPathsFromConfigObject = (objectLiteral, entries, packageN
|
|
|
38129
38131
|
};
|
|
38130
38132
|
const collectReturnedExpoConfigPluginPaths = (body, entries, packageNamePlugins, rootDirectory, configDirectory) => {
|
|
38131
38133
|
if (!ts.isBlock(body)) {
|
|
38132
|
-
const expression =
|
|
38134
|
+
const expression = unwrapTypescriptExpression(body);
|
|
38133
38135
|
if (ts.isObjectLiteralExpression(expression)) collectExpoPluginPathsFromConfigObject(expression, entries, packageNamePlugins, rootDirectory, configDirectory);
|
|
38134
38136
|
return;
|
|
38135
38137
|
}
|
|
38136
38138
|
const visit = (node) => {
|
|
38137
38139
|
if (ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) || ts.isArrowFunction(node)) return;
|
|
38138
38140
|
if (ts.isReturnStatement(node) && node.expression) {
|
|
38139
|
-
const expression =
|
|
38141
|
+
const expression = unwrapTypescriptExpression(node.expression);
|
|
38140
38142
|
if (ts.isObjectLiteralExpression(expression)) collectExpoPluginPathsFromConfigObject(expression, entries, packageNamePlugins, rootDirectory, configDirectory);
|
|
38141
38143
|
return;
|
|
38142
38144
|
}
|
|
@@ -38145,7 +38147,7 @@ const collectReturnedExpoConfigPluginPaths = (body, entries, packageNamePlugins,
|
|
|
38145
38147
|
visit(body);
|
|
38146
38148
|
};
|
|
38147
38149
|
const collectExpoPluginPathsFromConfigExpression = (expression, entries, packageNamePlugins, rootDirectory, configDirectory, bindings, seenIdentifiers = /* @__PURE__ */ new Set()) => {
|
|
38148
|
-
const configExpression =
|
|
38150
|
+
const configExpression = unwrapTypescriptExpression(expression);
|
|
38149
38151
|
if (ts.isObjectLiteralExpression(configExpression)) {
|
|
38150
38152
|
collectExpoPluginPathsFromConfigObject(configExpression, entries, packageNamePlugins, rootDirectory, configDirectory);
|
|
38151
38153
|
return;
|
|
@@ -40999,13 +41001,6 @@ const extractSupabaseFunctionEntries = (rootDirectory) => import_out.default.syn
|
|
|
40999
41001
|
onlyFiles: true
|
|
41000
41002
|
});
|
|
41001
41003
|
//#endregion
|
|
41002
|
-
//#region ../core/src/utils/unwrap-typescript-expression.ts
|
|
41003
|
-
const unwrapTypescriptExpression = (expression) => {
|
|
41004
|
-
let currentExpression = expression;
|
|
41005
|
-
while (ts.isParenthesizedExpression(currentExpression) || ts.isAsExpression(currentExpression) || ts.isSatisfiesExpression(currentExpression) || ts.isNonNullExpression(currentExpression) || ts.isTypeAssertionExpression(currentExpression)) currentExpression = currentExpression.expression;
|
|
41006
|
-
return currentExpression;
|
|
41007
|
-
};
|
|
41008
|
-
//#endregion
|
|
41009
41004
|
//#region ../core/src/project-analysis/utils/is-path-inside-directory-or-equal.ts
|
|
41010
41005
|
const isPathInsideDirectoryOrEqual = (candidatePath, directoryPath) => {
|
|
41011
41006
|
const normalizedCandidatePath = posix.normalize(toPosixPath(candidatePath));
|
|
@@ -42091,7 +42086,7 @@ const resolveEntries = async (config) => {
|
|
|
42091
42086
|
onlyFiles: true
|
|
42092
42087
|
}));
|
|
42093
42088
|
}
|
|
42094
|
-
if (isEligible
|
|
42089
|
+
if (isEligible) {
|
|
42095
42090
|
const workspacePackageJsonEntries = await extractPackageJsonEntries(resolve(workspacePackage.directory, "package.json"));
|
|
42096
42091
|
if (workspacePackageJsonEntries.some((entryPath) => existsSync(entryPath))) {
|
|
42097
42092
|
workspaceEntries.push(...workspacePackageJsonEntries);
|
|
@@ -44078,7 +44073,11 @@ const FRAMEWORK_PATTERNS = [
|
|
|
44078
44073
|
enablers: ["sanity", "@sanity/cli"],
|
|
44079
44074
|
enablerPrefixes: ["@sanity/"],
|
|
44080
44075
|
entryPatterns: [],
|
|
44081
|
-
alwaysUsed: [
|
|
44076
|
+
alwaysUsed: [
|
|
44077
|
+
"sanity.config.{ts,js}",
|
|
44078
|
+
"sanity.cli.{ts,js}",
|
|
44079
|
+
"sanity.blueprint.{ts,js}"
|
|
44080
|
+
]
|
|
44082
44081
|
},
|
|
44083
44082
|
{
|
|
44084
44083
|
enablers: ["astro"],
|
|
@@ -46087,47 +46086,53 @@ const collectPackageLockPackageMetadata = (searchRoots, resolutionDirectory, dec
|
|
|
46087
46086
|
return metadataByPackageName;
|
|
46088
46087
|
};
|
|
46089
46088
|
//#endregion
|
|
46090
|
-
//#region ../core/src/project-analysis/utils/collect-static-module-
|
|
46091
|
-
const
|
|
46092
|
-
|
|
46093
|
-
|
|
46094
|
-
|
|
46095
|
-
|
|
46096
|
-
|
|
46097
|
-
};
|
|
46098
|
-
const
|
|
46099
|
-
|
|
46100
|
-
|
|
46101
|
-
|
|
46089
|
+
//#region ../core/src/project-analysis/utils/collect-static-module-specifiers.ts
|
|
46090
|
+
const getStaticModuleSpecifier = (value) => {
|
|
46091
|
+
if (!isOxcAstNode(value)) return void 0;
|
|
46092
|
+
if (typeof value.value === "string") return value.value;
|
|
46093
|
+
if (value.type === "TemplateLiteral" && Array.isArray(value.expressions) && value.expressions.length === 0 && Array.isArray(value.quasis) && isOxcAstNode(value.quasis[0]) && value.quasis[0].value && typeof value.quasis[0].value === "object" && "cooked" in value.quasis[0].value && typeof value.quasis[0].value.cooked === "string") return value.quasis[0].value.cooked;
|
|
46094
|
+
};
|
|
46095
|
+
const collectStaticModuleSpecifiers = (sourceText, options = {}) => {
|
|
46096
|
+
const { filePath = "module.tsx", includeTypeOnly = true } = options;
|
|
46097
|
+
const parsedModule = parseSync(filePath, sourceText, { sourceType: "unambiguous" });
|
|
46098
|
+
const moduleSpecifiers = /* @__PURE__ */ new Set();
|
|
46099
|
+
const addSpecifier = (value) => {
|
|
46100
|
+
const moduleSpecifier = getStaticModuleSpecifier(value);
|
|
46101
|
+
if (moduleSpecifier) moduleSpecifiers.add(moduleSpecifier);
|
|
46102
46102
|
};
|
|
46103
|
-
|
|
46104
|
-
for (const staticExport of parsedModule.module.staticExports) for (const entry of staticExport.entries) if (entry.moduleRequest) addSpecifier(entry.moduleRequest.value);
|
|
46105
|
-
const visitNode = (value, isInTypeScriptModuleBlock = false) => {
|
|
46103
|
+
const visitNode = (value) => {
|
|
46106
46104
|
if (Array.isArray(value)) {
|
|
46107
|
-
for (const child of value) visitNode(child
|
|
46105
|
+
for (const child of value) visitNode(child);
|
|
46108
46106
|
return;
|
|
46109
46107
|
}
|
|
46110
46108
|
if (!isOxcAstNode(value)) return;
|
|
46111
|
-
if (
|
|
46112
|
-
const
|
|
46113
|
-
|
|
46114
|
-
|
|
46115
|
-
if (value.type === "
|
|
46116
|
-
const
|
|
46117
|
-
|
|
46118
|
-
|
|
46119
|
-
if (value.type === "
|
|
46120
|
-
|
|
46121
|
-
|
|
46122
|
-
|
|
46123
|
-
if (value.type === "
|
|
46124
|
-
|
|
46125
|
-
|
|
46126
|
-
}
|
|
46127
|
-
const childIsInTypeScriptModuleBlock = isInTypeScriptModuleBlock || value.type === "TSModuleBlock";
|
|
46128
|
-
for (const child of Object.values(value)) visitNode(child, childIsInTypeScriptModuleBlock);
|
|
46109
|
+
if (value.type === "ImportDeclaration") {
|
|
46110
|
+
const specifiers = Array.isArray(value.specifiers) ? value.specifiers : [];
|
|
46111
|
+
const hasRuntimeSpecifier = specifiers.some((specifier) => !isOxcAstNode(specifier) || specifier.importKind !== "type");
|
|
46112
|
+
if (includeTypeOnly || value.importKind !== "type" && (specifiers.length === 0 || hasRuntimeSpecifier)) addSpecifier(value.source);
|
|
46113
|
+
} else if (value.type === "ExportNamedDeclaration") {
|
|
46114
|
+
const specifiers = Array.isArray(value.specifiers) ? value.specifiers : [];
|
|
46115
|
+
const hasRuntimeSpecifier = specifiers.some((specifier) => !isOxcAstNode(specifier) || specifier.exportKind !== "type");
|
|
46116
|
+
if (includeTypeOnly || value.exportKind !== "type" && (specifiers.length === 0 || hasRuntimeSpecifier)) addSpecifier(value.source);
|
|
46117
|
+
} else if (value.type === "ExportAllDeclaration" || value.type === "ImportExpression") {
|
|
46118
|
+
if (includeTypeOnly || value.exportKind !== "type") addSpecifier(value.source);
|
|
46119
|
+
} else if (value.type === "TSImportType") {
|
|
46120
|
+
if (includeTypeOnly) addSpecifier(value.source);
|
|
46121
|
+
} else if (value.type === "TSExternalModuleReference") addSpecifier(value.expression);
|
|
46122
|
+
else if (value.type === "CallExpression" && isOxcAstNode(value.callee) && value.callee.type === "Identifier" && value.callee.name === "require" && Array.isArray(value.arguments) && value.arguments.length > 0) addSpecifier(value.arguments[0]);
|
|
46123
|
+
for (const child of Object.values(value)) visitNode(child);
|
|
46129
46124
|
};
|
|
46130
46125
|
visitNode(parsedModule.program);
|
|
46126
|
+
return moduleSpecifiers;
|
|
46127
|
+
};
|
|
46128
|
+
//#endregion
|
|
46129
|
+
//#region ../core/src/project-analysis/utils/collect-static-module-package-names.ts
|
|
46130
|
+
const collectStaticModulePackageNames = (sourceText) => {
|
|
46131
|
+
const packageNames = /* @__PURE__ */ new Set();
|
|
46132
|
+
for (const specifier of collectStaticModuleSpecifiers(sourceText, { filePath: "package-reference.tsx" })) {
|
|
46133
|
+
const packageName = extractPackageName(specifier);
|
|
46134
|
+
if (packageName) packageNames.add(packageName);
|
|
46135
|
+
}
|
|
46131
46136
|
return packageNames;
|
|
46132
46137
|
};
|
|
46133
46138
|
//#endregion
|
|
@@ -51897,4 +51902,4 @@ startProjectAnalysisWorker();
|
|
|
51897
51902
|
export {};
|
|
51898
51903
|
|
|
51899
51904
|
//# sourceMappingURL=project-analysis-worker.js.map
|
|
51900
|
-
//# debugId=
|
|
51905
|
+
//# debugId=36894edb-acbd-5c90-9ce2-80c54b021bfb
|
|
@@ -0,0 +1,240 @@
|
|
|
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]="0e2a8ba7-061d-5991-a7ae-c9adab00340e")}catch(e){}}();
|
|
3
|
+
import { t as unrefStdin } from "./unref-stdin-SK3WfwxS.js";
|
|
4
|
+
import { a as RUNTIME_SCAN_LOCAL_DEV_PORTS, t as sanitizeRuntimeUrl, u as RUNTIME_SCAN_MAX_STRING_LENGTH } from "./sanitize-runtime-url-Bbq40iIp.js";
|
|
5
|
+
import { a as useExitOnCtrlC, c as Spinner, d as useInput, h as Box, i as import_react, m as Text, n as registerMountedTuiRenderer, o as terminalSymbols, p as render, r as useStdoutDimensions, s as isPrintableInput, t as require_jsx_runtime } from "./jsx-runtime-D_A4d39v.js";
|
|
6
|
+
import * as http from "node:http";
|
|
7
|
+
//#region src/cli/runtime-scan/detect-local-runtime-urls.ts
|
|
8
|
+
const LOCAL_HTTP_HOSTS = ["127.0.0.1", "::1"];
|
|
9
|
+
const probeLocalHttpHost = (port, host) => new Promise((resolve) => {
|
|
10
|
+
let didResolve = false;
|
|
11
|
+
const resolveOnce = (isReachable) => {
|
|
12
|
+
if (didResolve) return;
|
|
13
|
+
didResolve = true;
|
|
14
|
+
resolve(isReachable);
|
|
15
|
+
};
|
|
16
|
+
const request = http.request({
|
|
17
|
+
agent: false,
|
|
18
|
+
host,
|
|
19
|
+
method: "HEAD",
|
|
20
|
+
path: "/",
|
|
21
|
+
port
|
|
22
|
+
}, (response) => {
|
|
23
|
+
response.resume();
|
|
24
|
+
resolveOnce(true);
|
|
25
|
+
});
|
|
26
|
+
request.setTimeout(300, () => request.destroy());
|
|
27
|
+
request.on("error", () => resolveOnce(false));
|
|
28
|
+
request.on("close", () => resolveOnce(false));
|
|
29
|
+
request.end();
|
|
30
|
+
});
|
|
31
|
+
const probeLocalHttpPort = async (port) => {
|
|
32
|
+
if (!(await Promise.all(LOCAL_HTTP_HOSTS.map((host) => probeLocalHttpHost(port, host)))).some(Boolean)) return null;
|
|
33
|
+
return {
|
|
34
|
+
port,
|
|
35
|
+
url: `http://localhost:${port}`
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
const detectLocalRuntimeUrls = async (ports = RUNTIME_SCAN_LOCAL_DEV_PORTS) => {
|
|
39
|
+
const probeResults = await Promise.all(ports.map(probeLocalHttpPort));
|
|
40
|
+
const suggestions = [];
|
|
41
|
+
for (const probeResult of probeResults) if (probeResult !== null) suggestions.push(probeResult);
|
|
42
|
+
return suggestions;
|
|
43
|
+
};
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/cli/ink/prompt-runtime-scan-url.tsx
|
|
46
|
+
var import_jsx_runtime = require_jsx_runtime();
|
|
47
|
+
const RuntimeScanUrlPrompt = ({ discoverLocalUrls = detectLocalRuntimeUrls, onSubmit }) => {
|
|
48
|
+
const [mode, setMode] = (0, import_react.useState)("select");
|
|
49
|
+
const [suggestions, setSuggestions] = (0, import_react.useState)([]);
|
|
50
|
+
const [isDetecting, setIsDetecting] = (0, import_react.useState)(true);
|
|
51
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react.useState)(0);
|
|
52
|
+
const [url, setUrl] = (0, import_react.useState)("");
|
|
53
|
+
const [validationMessage, setValidationMessage] = (0, import_react.useState)(null);
|
|
54
|
+
const { columns: terminalColumns, rows: terminalRows } = useStdoutDimensions();
|
|
55
|
+
useExitOnCtrlC();
|
|
56
|
+
(0, import_react.useEffect)(() => {
|
|
57
|
+
let isMounted = true;
|
|
58
|
+
discoverLocalUrls().then((detectedSuggestions) => {
|
|
59
|
+
if (!isMounted) return;
|
|
60
|
+
setSuggestions(detectedSuggestions);
|
|
61
|
+
setIsDetecting(false);
|
|
62
|
+
}, () => {
|
|
63
|
+
if (isMounted) setIsDetecting(false);
|
|
64
|
+
});
|
|
65
|
+
return () => {
|
|
66
|
+
isMounted = false;
|
|
67
|
+
};
|
|
68
|
+
}, [discoverLocalUrls]);
|
|
69
|
+
const updateUrl = (nextUrl) => {
|
|
70
|
+
setUrl(nextUrl.slice(0, RUNTIME_SCAN_MAX_STRING_LENGTH));
|
|
71
|
+
setValidationMessage(null);
|
|
72
|
+
};
|
|
73
|
+
useInput((input, key) => {
|
|
74
|
+
if (mode === "select") {
|
|
75
|
+
const optionCount = suggestions.length + 1;
|
|
76
|
+
if (key.escape || input === "q") return onSubmit(null);
|
|
77
|
+
if (key.upArrow || input === "k") return setSelectedIndex(Math.max(0, selectedIndex - 1));
|
|
78
|
+
if (key.downArrow || input === "j") return setSelectedIndex(Math.min(optionCount - 1, selectedIndex + 1));
|
|
79
|
+
if (key.return) {
|
|
80
|
+
const selectedSuggestion = suggestions[selectedIndex];
|
|
81
|
+
if (selectedSuggestion !== void 0) return onSubmit(selectedSuggestion.url);
|
|
82
|
+
setMode("custom");
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (isPrintableInput(input) && !key.ctrl && !key.meta) {
|
|
86
|
+
setMode("custom");
|
|
87
|
+
updateUrl(input);
|
|
88
|
+
}
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (key.escape) return setMode("select");
|
|
92
|
+
if (key.backspace || key.delete) return updateUrl(url.slice(0, -1));
|
|
93
|
+
if (key.ctrl && input === "u") return updateUrl("");
|
|
94
|
+
if (key.return) {
|
|
95
|
+
const trimmedUrl = url.trim();
|
|
96
|
+
try {
|
|
97
|
+
sanitizeRuntimeUrl(trimmedUrl);
|
|
98
|
+
onSubmit(trimmedUrl);
|
|
99
|
+
} catch {
|
|
100
|
+
setValidationMessage("Enter an absolute URL starting with http:// or https://.");
|
|
101
|
+
}
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
if (isPrintableInput(input) && !key.ctrl && !key.meta) updateUrl(url + input);
|
|
105
|
+
});
|
|
106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
107
|
+
alignItems: "center",
|
|
108
|
+
height: terminalRows,
|
|
109
|
+
justifyContent: "center",
|
|
110
|
+
width: terminalColumns,
|
|
111
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
112
|
+
borderColor: "magenta",
|
|
113
|
+
borderStyle: "round",
|
|
114
|
+
flexDirection: "column",
|
|
115
|
+
paddingX: 1,
|
|
116
|
+
width: Math.min(terminalColumns, 72),
|
|
117
|
+
children: [
|
|
118
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
119
|
+
color: "magenta",
|
|
120
|
+
bold: true,
|
|
121
|
+
children: "React Doctor"
|
|
122
|
+
}),
|
|
123
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
124
|
+
bold: true,
|
|
125
|
+
children: "Choose an app to scan"
|
|
126
|
+
}),
|
|
127
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
128
|
+
dimColor: true,
|
|
129
|
+
children: "We’ll open Chrome and scan one interaction."
|
|
130
|
+
}),
|
|
131
|
+
mode === "select" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
132
|
+
flexDirection: "column",
|
|
133
|
+
marginTop: 1,
|
|
134
|
+
children: [
|
|
135
|
+
isDetecting ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
|
|
136
|
+
dimColor: true,
|
|
137
|
+
children: [
|
|
138
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
139
|
+
color: "cyan",
|
|
140
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, { type: "dots" })
|
|
141
|
+
}),
|
|
142
|
+
" ",
|
|
143
|
+
"Looking for local apps…"
|
|
144
|
+
]
|
|
145
|
+
}) : null,
|
|
146
|
+
!isDetecting && suggestions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
147
|
+
dimColor: true,
|
|
148
|
+
children: "No local HTTP apps detected."
|
|
149
|
+
}) : null,
|
|
150
|
+
suggestions.map((suggestion, suggestionIndex) => {
|
|
151
|
+
const isSelected = suggestionIndex === selectedIndex;
|
|
152
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
|
|
153
|
+
bold: isSelected,
|
|
154
|
+
color: isSelected ? "cyan" : void 0,
|
|
155
|
+
children: [
|
|
156
|
+
isSelected ? terminalSymbols.pointer : terminalSymbols.pointerSmall,
|
|
157
|
+
" ",
|
|
158
|
+
suggestion.url,
|
|
159
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
160
|
+
dimColor: true,
|
|
161
|
+
children: " detected"
|
|
162
|
+
})
|
|
163
|
+
]
|
|
164
|
+
}, suggestion.url);
|
|
165
|
+
}),
|
|
166
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
|
|
167
|
+
bold: selectedIndex === suggestions.length,
|
|
168
|
+
color: selectedIndex === suggestions.length ? "cyan" : void 0,
|
|
169
|
+
children: [
|
|
170
|
+
selectedIndex === suggestions.length ? terminalSymbols.pointer : terminalSymbols.pointerSmall,
|
|
171
|
+
" ",
|
|
172
|
+
"Enter another URL"
|
|
173
|
+
]
|
|
174
|
+
}),
|
|
175
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
176
|
+
marginTop: 1,
|
|
177
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
178
|
+
dimColor: true,
|
|
179
|
+
children: "↑↓ choose · Enter continue · Esc cancel"
|
|
180
|
+
})
|
|
181
|
+
})
|
|
182
|
+
]
|
|
183
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Box, {
|
|
184
|
+
flexDirection: "column",
|
|
185
|
+
marginTop: 1,
|
|
186
|
+
children: [
|
|
187
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
188
|
+
dimColor: true,
|
|
189
|
+
children: "App URL"
|
|
190
|
+
}),
|
|
191
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Text, {
|
|
192
|
+
wrap: "truncate-end",
|
|
193
|
+
children: [
|
|
194
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
195
|
+
color: "cyan",
|
|
196
|
+
children: "› "
|
|
197
|
+
}),
|
|
198
|
+
url,
|
|
199
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
200
|
+
inverse: true,
|
|
201
|
+
children: " "
|
|
202
|
+
})
|
|
203
|
+
]
|
|
204
|
+
}),
|
|
205
|
+
validationMessage === null ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
206
|
+
color: "red",
|
|
207
|
+
children: validationMessage
|
|
208
|
+
}),
|
|
209
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Box, {
|
|
210
|
+
marginTop: 1,
|
|
211
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Text, {
|
|
212
|
+
dimColor: true,
|
|
213
|
+
children: "Enter continue · Esc back · Ctrl+U clear"
|
|
214
|
+
})
|
|
215
|
+
})
|
|
216
|
+
]
|
|
217
|
+
})
|
|
218
|
+
]
|
|
219
|
+
})
|
|
220
|
+
});
|
|
221
|
+
};
|
|
222
|
+
const promptRuntimeScanUrl = () => new Promise((resolve) => {
|
|
223
|
+
let disposeRenderer = () => {};
|
|
224
|
+
const submitUrl = (url) => {
|
|
225
|
+
disposeRenderer();
|
|
226
|
+
unrefStdin();
|
|
227
|
+
resolve(url);
|
|
228
|
+
};
|
|
229
|
+
disposeRenderer = registerMountedTuiRenderer(render(/* @__PURE__ */ (0, import_jsx_runtime.jsx)(RuntimeScanUrlPrompt, { onSubmit: submitUrl }), {
|
|
230
|
+
alternateScreen: true,
|
|
231
|
+
exitOnCtrlC: false,
|
|
232
|
+
stdin: process.stdin,
|
|
233
|
+
stdout: process.stderr
|
|
234
|
+
}));
|
|
235
|
+
});
|
|
236
|
+
//#endregion
|
|
237
|
+
export { promptRuntimeScanUrl };
|
|
238
|
+
|
|
239
|
+
//# sourceMappingURL=prompt-runtime-scan-url-BXdY2Opw.js.map
|
|
240
|
+
//# debugId=0e2a8ba7-061d-5991-a7ae-c9adab00340e
|
|
@@ -1,6 +1,6 @@
|
|
|
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]="
|
|
3
|
-
import {
|
|
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]="846c0e2f-eb25-5791-9f0b-a559abc18de8")}catch(e){}}();
|
|
3
|
+
import { Sr as isPlainObject } from "./record-metric-B6T_Ej33.js";
|
|
4
4
|
import * as fs$1 from "node:fs";
|
|
5
5
|
import { parseJSON5 } from "confbox";
|
|
6
6
|
//#region src/cli/utils/read-object-file.ts
|
|
@@ -20,5 +20,5 @@ const readObjectFile = (filePath) => {
|
|
|
20
20
|
//#endregion
|
|
21
21
|
export { readObjectFile as t };
|
|
22
22
|
|
|
23
|
-
//# sourceMappingURL=read-object-file-
|
|
24
|
-
//# debugId=
|
|
23
|
+
//# sourceMappingURL=read-object-file-CmMGK1uu.js.map
|
|
24
|
+
//# debugId=846c0e2f-eb25-5791-9f0b-a559abc18de8
|