refactor: remove forwarding exports and redundant aliases

This commit is contained in:
morluto
2026-10-09 22:46:09 +08:00
parent 69c3b32a21
commit ad59531a96
416 changed files with 855 additions and 1208 deletions
+2 -4
View File
@@ -6,10 +6,8 @@ import type {
ProviderIdentity,
} from "../application/AnalysisProvider.js";
import { createAnalysisProfile } from "../domain/analysisProfile.js";
import type {
BinaryArchitecture,
BinaryTarget,
} from "../domain/binaryTarget.js";
import type { BinaryTarget } from "../domain/binaryTargetTypes.js";
import type { BinaryArchitecture } from "../domain/binaryTargetTypes.js";
import {
AnalysisCancelledError,
AnalysisCapabilityUnavailableError,
+1 -1
View File
@@ -8,7 +8,7 @@ import { HopperProcessError } from "../domain/hopperErrors.js";
import type { JsonValue } from "../domain/jsonValue.js";
import { ProviderCleanupError } from "../domain/providerCleanupError.js";
import { err, ok, type Result } from "../domain/result.js";
import type { Logger } from "../logger.js";
import type { Logger } from "pino";
import type { PrivateRuntimeRoot } from "../process/PrivateRuntimeRoot.js";
import type { ProcessCleanupResult } from "../process/ProcessOwnership.js";
import type { ProviderProcessSupervisor } from "../process/ProviderProcess.js";
+2 -3
View File
@@ -31,7 +31,8 @@ import {
import { err, ok, type Result } from "../domain/result.js";
import type { JsonValue } from "../domain/jsonValue.js";
import type { ProgressReporter } from "../application/ProgressReporter.js";
import { silentLogger, type Logger } from "../logger.js";
import { silentLogger } from "../logger.js";
import type { Logger } from "pino";
import { PrivateRuntimeRoot } from "../process/PrivateRuntimeRoot.js";
import { ProviderStartupDeadline } from "../process/ProviderDeadline.js";
import { ProviderRunLineage } from "../process/ProviderRunLineage.js";
@@ -63,8 +64,6 @@ import {
responseResult,
} from "./protocol.js";
export type { HopperServerInfo } from "./HopperSessionValues.js";
const SHUTDOWN_TIMEOUT_MS = 30_000;
const SESSION_ROOT = process.platform === "darwin" ? "/tmp" : tmpdir();
+1 -1
View File
@@ -12,7 +12,7 @@ import {
AnalysisOutputError,
} from "../domain/analysisErrorCore.js";
import { BinaryTargetError } from "../domain/configurationErrors.js";
import type { BinaryTarget } from "../domain/binaryTarget.js";
import type { BinaryTarget } from "../domain/binaryTargetTypes.js";
import type { JsonValue } from "../domain/jsonValue.js";
import type { FileOffsetPartialObservation } from "../domain/native/fileOffsetPartialObservation.js";
import {
+1 -1
View File
@@ -2,7 +2,7 @@ import { createHash } from "node:crypto";
import { open, type FileHandle } from "node:fs/promises";
import { z } from "zod";
import type { BinaryTarget } from "../domain/binaryTarget.js";
import type { BinaryTarget } from "../domain/binaryTargetTypes.js";
import { BinaryTargetError } from "../domain/configurationErrors.js";
import { AnalysisCancelledError } from "../domain/analysisErrorCore.js";
import {
+1 -1
View File
@@ -1,6 +1,6 @@
import { describe, expect, it } from "vitest";
import { parseConfig } from "../config.js";
import { parseConfig } from "../config/parseConfig.js";
import { silentLogger } from "../logger.js";
import { HopperProvider } from "./HopperProvider.js";
+8 -15
View File
@@ -14,9 +14,9 @@ import type {
ProviderTargetSupport,
} from "../application/AnalysisProvider.js";
import type { AnalysisProfileCommitment } from "../domain/analysisProfile.js";
import type { AppConfig } from "../config.js";
import type { BinaryTarget } from "../domain/binaryTarget.js";
import type { Logger } from "../logger.js";
import type { AppConfig } from "../config/types.js";
import type { BinaryTarget } from "../domain/binaryTargetTypes.js";
import type { Logger } from "pino";
import { AnalysisCapabilityUnavailableError } from "../domain/analysisErrorCore.js";
import { err, ok } from "../domain/result.js";
import { HopperApplicationLauncher } from "./BridgeLauncher.js";
@@ -34,13 +34,6 @@ import {
HOPPER_PROVIDER_IDENTITY,
} from "./HopperProviderCapabilities.js";
export {
HOPPER_PROVIDER_IDENTITY,
HOPPER_OPERATIONS,
} from "./HopperProviderCapabilities.js";
const IDENTITY = HOPPER_PROVIDER_IDENTITY;
/** Concrete analysis provider backed by REA's private Hopper bridge. */
export class HopperProvider implements AnalysisProviderCandidate {
private readonly environment: Readonly<NodeJS.ProcessEnv>;
@@ -61,7 +54,7 @@ export class HopperProvider implements AnalysisProviderCandidate {
}
identity(): ProviderIdentity {
return IDENTITY;
return HOPPER_PROVIDER_IDENTITY;
}
capabilities(): readonly CapabilityDescriptor[] {
@@ -143,7 +136,7 @@ export class HopperProvider implements AnalysisProviderCandidate {
return resolveHopperAnalysisProfile(target, {
launcherPath: this.config.hopperLauncherPath,
loaderArgsOverride: this.config.hopperLoaderArgs,
provider: IDENTITY,
provider: HOPPER_PROVIDER_IDENTITY,
...(options?.signal === undefined ? {} : { signal: options.signal }),
});
}
@@ -159,7 +152,7 @@ export class HopperProvider implements AnalysisProviderCandidate {
Promise.resolve(
err(
new AnalysisCapabilityUnavailableError(
IDENTITY.id,
HOPPER_PROVIDER_IDENTITY.id,
operation,
`Hopper cannot open ${target.kind} targets directly. Inventory or extract the artifact first.`,
),
@@ -178,7 +171,7 @@ export class HopperProvider implements AnalysisProviderCandidate {
Promise.resolve(
err(
new AnalysisCapabilityUnavailableError(
IDENTITY.id,
HOPPER_PROVIDER_IDENTITY.id,
operation,
"Hopper prepared-image profile is malformed; resolve the analysis profile again.",
),
@@ -202,7 +195,7 @@ export class HopperProvider implements AnalysisProviderCandidate {
execute: () => Promise.resolve(err(derivedLoaderArgs.error)),
close: () => Promise.resolve(ok(null)),
};
const executionProvider = profile?.provider ?? IDENTITY;
const executionProvider = profile?.provider ?? HOPPER_PROVIDER_IDENTITY;
const client = new HopperClient({
launcher: new HopperApplicationLauncher({
environment: this.environment,
+2 -2
View File
@@ -1,7 +1,7 @@
import { describe, expect, it } from "vitest";
import { parseConfig } from "../config.js";
import type { BinaryTarget } from "../domain/binaryTarget.js";
import { parseConfig } from "../config/parseConfig.js";
import type { BinaryTarget } from "../domain/binaryTargetTypes.js";
import { silentLogger } from "../logger.js";
import { HopperProvider } from "./HopperProvider.js";