cleanup(environment): remove unused layer inventory

This commit is contained in:
Tianyi Cui
2026-08-07 23:30:03 +08:00
parent 95366f6197
commit 2c532f3b2c
3 changed files with 6 additions and 48 deletions
-15
View File
@@ -35,13 +35,6 @@ export interface EnvironmentEntry {
path?: string
}
/** One environment layer's identity, for diagnostics. */
export interface EnvironmentLayer {
source: EnvironmentSource
/** Absolute path of the file behind this layer; absent for `process`. */
path?: string
}
/**
* The frozen environment of one launch. Construct through
* {@link createEnvironmentSnapshot}; nothing mutates it afterwards, so a
@@ -65,8 +58,6 @@ export interface EnvironmentSnapshot {
* @returns the first matching entry, or `undefined`.
*/
getFrom(name: string, sources: readonly EnvironmentSource[]): EnvironmentEntry | undefined
/** The layers this snapshot was built from, most trusted first. */
readonly layers: readonly EnvironmentLayer[]
}
/**
@@ -121,12 +112,6 @@ export function createEnvironmentSnapshot(layers: readonly EnvironmentLayerInput
return {
get: name => getFrom(name, ENVIRONMENT_SOURCES),
getFrom,
layers: ENVIRONMENT_SOURCES
.filter(source => bySource.has(source))
.map((source): EnvironmentLayer => {
const path = bySource.get(source)?.path
return { source, ...path === undefined ? {} : { path } }
}),
}
}