From 2d24543380dfc4d54e76b582536b52226af133c8 Mon Sep 17 00:00:00 2001 From: Christof Marti Date: Wed, 15 Nov 2023 15:37:52 +0100 Subject: [PATCH] Remove unused code --- src/spec-common/commonUtils.ts | 3 - src/spec-common/git.ts | 9 --- .../configurationCommonUtils.ts | 2 +- .../containerFeaturesConfiguration.ts | 16 ----- src/spec-configuration/editableFiles.ts | 18 ----- src/spec-node/configContainer.ts | 4 +- src/spec-node/dockerfileUtils.ts | 4 -- src/spec-node/utils.ts | 3 +- src/spec-shutdown/dockerUtils.ts | 52 -------------- src/spec-shutdown/shutdownUtils.ts | 16 ----- src/spec-utils/event.ts | 31 -------- src/spec-utils/log.ts | 10 --- src/spec-utils/types.ts | 6 -- src/spec-utils/workspaces.ts | 71 ------------------- 14 files changed, 4 insertions(+), 241 deletions(-) delete mode 100644 src/spec-shutdown/shutdownUtils.ts delete mode 100644 src/spec-utils/types.ts diff --git a/src/spec-common/commonUtils.ts b/src/spec-common/commonUtils.ts index 5d5f1c0c7..0e23fafc7 100644 --- a/src/spec-common/commonUtils.ts +++ b/src/spec-common/commonUtils.ts @@ -70,9 +70,6 @@ export function equalPaths(platform: NodeJS.Platform, a: string, b: string) { return a.toLowerCase() === b.toLowerCase(); } -export const tsnode = path.join(__dirname, '..', '..', 'node_modules', '.bin', 'ts-node'); -export const isTsnode = path.basename(process.argv[0]) === 'ts-node' || process.argv.indexOf('ts-node/register') !== -1; - export async function runCommandNoPty(options: { exec: ExecFunction; cmd: string; diff --git a/src/spec-common/git.ts b/src/spec-common/git.ts index dcab2036a..4bbf50730 100644 --- a/src/spec-common/git.ts +++ b/src/spec-common/git.ts @@ -31,12 +31,3 @@ export async function findGitRootFolder(cliHost: FileHost | CLIHost, folderPath: return undefined; } } - -export interface GitCloneOptions { - url: string; - tokenEnvVar?: string; - branch?: string; - recurseSubmodules?: boolean; - env?: NodeJS.ProcessEnv; - fullClone?: boolean; -} diff --git a/src/spec-configuration/configurationCommonUtils.ts b/src/spec-configuration/configurationCommonUtils.ts index 9e45d613b..371125f52 100644 --- a/src/spec-configuration/configurationCommonUtils.ts +++ b/src/spec-configuration/configurationCommonUtils.ts @@ -10,7 +10,7 @@ import { URI } from 'vscode-uri'; import { CLIHostDocuments } from './editableFiles'; import { FileHost } from '../spec-utils/pfs'; -export { FileHost, FileTypeBitmask } from '../spec-utils/pfs'; +export { FileHost } from '../spec-utils/pfs'; const enum CharCode { Slash = 47, diff --git a/src/spec-configuration/containerFeaturesConfiguration.ts b/src/spec-configuration/containerFeaturesConfiguration.ts index f82b57646..51ae98890 100644 --- a/src/spec-configuration/containerFeaturesConfiguration.ts +++ b/src/spec-configuration/containerFeaturesConfiguration.ts @@ -157,15 +157,6 @@ export interface GithubSourceInformation extends BaseSourceInformation { userFeatureIdWithoutVersion: string; } -export interface GithubSourceInformationInput { - owner: string; - repo: string; - ref?: string; - sha?: string; - tag?: string; -} - - export interface FeatureSet { features: Feature[]; internalVersion?: string; @@ -193,13 +184,6 @@ export interface GithubApiReleaseAsset { updated_at: string; } -// Supports the `node` layer by collapsing all the individual features into a single `features` array. -// Regardless of their origin. -// Information is lost, but for the node layer we need not care about which set a given feature came from. -export interface CollapsedFeaturesConfig { - allFeatures: Feature[]; -} - export interface ContainerFeatureInternalParams { extensionPath: string; cacheFolder: string; diff --git a/src/spec-configuration/editableFiles.ts b/src/spec-configuration/editableFiles.ts index eb8d303b5..d233a15fc 100644 --- a/src/spec-configuration/editableFiles.ts +++ b/src/spec-configuration/editableFiles.ts @@ -161,21 +161,3 @@ export function createDocuments(fileHost: FileHost, shellServer?: ShellServer): export interface ShellServer { exec(cmd: string, options?: { logOutput?: boolean; stdin?: Buffer }): Promise<{ stdout: string; stderr: string }>; } - -const editQueues = new Map Promise)[]>(); - -export async function runEdit(uri: URI, edit: () => Promise) { - const uriString = uri.toString(); - let queue = editQueues.get(uriString); - if (!queue) { - editQueues.set(uriString, queue = []); - } - queue.push(edit); - if (queue.length === 1) { - while (queue.length) { - await queue[0](); - queue.shift(); - } - editQueues.delete(uriString); - } -} diff --git a/src/spec-node/configContainer.ts b/src/spec-node/configContainer.ts index dddd08d58..ea94fe4ea 100644 --- a/src/spec-node/configContainer.ts +++ b/src/spec-node/configContainer.ts @@ -9,7 +9,7 @@ import * as jsonc from 'jsonc-parser'; import { openDockerfileDevContainer } from './singleContainer'; import { openDockerComposeDevContainer } from './dockerCompose'; -import { ResolverResult, DockerResolverParameters, isDockerFileConfig, runInitializeCommand, createDocuments, getWorkspaceConfiguration, BindMountConsistency, uriToFsPath, DevContainerAuthority, isDevContainerAuthority, SubstituteConfig, SubstitutedConfig, addSubstitution, envListToObj, findContainerAndIdLabels } from './utils'; +import { ResolverResult, DockerResolverParameters, isDockerFileConfig, runInitializeCommand, getWorkspaceConfiguration, BindMountConsistency, uriToFsPath, DevContainerAuthority, isDevContainerAuthority, SubstituteConfig, SubstitutedConfig, addSubstitution, envListToObj, findContainerAndIdLabels } from './utils'; import { beforeContainerSubstitute, substitute } from '../spec-common/variableSubstitution'; import { ContainerError } from '../spec-common/errors'; import { Workspace, workspaceFromPath, isWorkspacePath } from '../spec-utils/workspaces'; @@ -20,8 +20,8 @@ import { getDefaultDevContainerConfigPath, getDevContainerConfigPathIn } from '. import { DevContainerConfig, DevContainerFromDockerComposeConfig, DevContainerFromDockerfileConfig, DevContainerFromImageConfig, updateFromOldProperties } from '../spec-configuration/configuration'; import { ensureNoDisallowedFeatures } from './disallowedFeatures'; import { DockerCLIParameters } from '../spec-shutdown/dockerUtils'; +import { createDocuments } from '../spec-configuration/editableFiles'; -export { getWellKnownDevContainerPaths as getPossibleDevContainerPaths } from '../spec-configuration/configurationCommonUtils'; export async function resolve(params: DockerResolverParameters, configFile: URI | undefined, overrideConfigFile: URI | undefined, providedIdLabels: string[] | undefined, additionalFeatures: Record>): Promise { if (configFile && !/\/\.?devcontainer\.json$/.test(configFile.path)) { diff --git a/src/spec-node/dockerfileUtils.ts b/src/spec-node/dockerfileUtils.ts index 2e25ced9e..0f34476c7 100644 --- a/src/spec-node/dockerfileUtils.ts +++ b/src/spec-node/dockerfileUtils.ts @@ -6,10 +6,6 @@ import * as semver from 'semver'; import { Mount } from '../spec-configuration/containerFeaturesConfiguration'; -export { getConfigFilePath, getDockerfilePath, isDockerFileConfig, resolveConfigFilePath } from '../spec-configuration/configuration'; -export { uriToFsPath, parentURI } from '../spec-configuration/configurationCommonUtils'; -export { CLIHostDocuments, Documents, createDocuments, Edit, fileDocuments, RemoteDocuments } from '../spec-configuration/editableFiles'; - const findFromLines = new RegExp(/^(?\s*FROM.*)/, 'gmi'); const parseFromLine = /FROM\s+(?--platform=\S+\s+)?(?"?[^\s]+"?)(\s+AS\s+(?