Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
chrmarti committed Dec 7, 2022
1 parent a8c9775 commit 70fbc3a
Show file tree
Hide file tree
Showing 10 changed files with 1,084 additions and 938 deletions.
53 changes: 27 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,54 +57,55 @@
"scripts/updateUID.Dockerfile"
],
"devDependencies": {
"@types/chai": "^4.3.0",
"@types/chai": "^4.3.4",
"@types/chalk": "^2.2.0",
"@types/follow-redirects": "^1.13.1",
"@types/follow-redirects": "^1.14.1",
"@types/js-yaml": "^4.0.5",
"@types/mocha": "^9.1.0",
"@types/mocha": "^10.0.1",
"@types/ncp": "^2.0.5",
"@types/node": "^16.11.7",
"@types/node": "^18.11.11",
"@types/pull-stream": "^3.6.2",
"@types/recursive-readdir": "^2.2.1",
"@types/semver": "^7.3.9",
"@types/semver": "^7.3.13",
"@types/shell-quote": "^1.7.1",
"@types/tar": "^6.1.1",
"@types/yargs": "^17.0.8",
"@typescript-eslint/eslint-plugin": "^4.31.2",
"@typescript-eslint/parser": "^4.31.2",
"chai": "^4.3.4",
"@types/tar": "^6.1.3",
"@types/yargs": "^17.0.16",
"@typescript-eslint/eslint-plugin": "^5.45.1",
"@typescript-eslint/experimental-utils": "^5.45.1",
"@typescript-eslint/parser": "^5.45.1",
"chai": "^4.3.7",
"copyfiles": "^2.4.1",
"esbuild": "^0.13.14",
"eslint": "^7.32.0",
"esbuild": "^0.16.1",
"eslint": "^8.29.0",
"event-stream": "^4.0.1",
"gulp-eslint": "^6.0.0",
"gulp-filter": "^7.0.0",
"mocha": "^9.2.1",
"mocha": "^10.1.0",
"npm-run-all": "^4.1.5",
"p-all": "^4.0.0",
"rimraf": "^3.0.2",
"ts-node": "^10.4.0",
"typescript": "^4.5.5",
"ts-node": "^10.9.1",
"typescript": "^4.9.3",
"typescript-formatter": "^7.2.2",
"vinyl": "^2.2.1",
"vinyl": "^3.0.0",
"vinyl-fs": "^3.0.3"
},
"dependencies": {
"chalk": "^4",
"follow-redirects": "^1.14.8",
"chalk": "^5.1.2",
"follow-redirects": "^1.15.2",
"js-yaml": "^4.1.0",
"jsonc-parser": "^3.0.0",
"jsonc-parser": "^3.2.0",
"ncp": "^2.0.0",
"node-pty": "^0.10.1",
"proxy-agent": "^5.0.0",
"pull-stream": "^3.6.14",
"recursive-readdir": "^2.2.2",
"semver": "^7.3.5",
"shell-quote": "^1.7.3",
"pull-stream": "^3.7.0",
"recursive-readdir": "^2.2.3",
"semver": "^7.3.8",
"shell-quote": "^1.7.4",
"stream-to-pull-stream": "^1.7.3",
"tar": "^6.1.11",
"tar": "^6.1.12",
"vscode-dev-containers": "https://github.com/microsoft/vscode-dev-containers/releases/download/v0.245.2/vscode-dev-containers-0.245.2.tgz",
"vscode-uri": "^3.0.3",
"yargs": "~17.0.1"
"vscode-uri": "^3.0.6",
"yargs": "~17.6.2"
}
}
8 changes: 4 additions & 4 deletions src/spec-common/cliHost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ export interface CLIHost {
readDir(dirpath: string): Promise<string[]>;
readDirWithTypes?(dirpath: string): Promise<[string, FileTypeBitmask][]>;
getUsername(): Promise<string>;
getuid(): Promise<number>;
getgid(): Promise<number>;
getuid?: () => Promise<number>;
getgid?: () => Promise<number>;
toCommonURI(filePath: string): Promise<URI | undefined>;
connect: ConnectFunction;
reconnect?(): Promise<void>;
Expand Down Expand Up @@ -80,8 +80,8 @@ function createLocalCLIHostFromExecFunctions(localCwd: string, exec: ExecFunctio
},
readDir: readLocalDir,
getUsername: getLocalUsername,
getuid: async () => process.getuid(),
getgid: async () => process.getgid(),
getuid: process.platform === 'linux' || process.platform === 'darwin' ? async () => process.getuid!() : undefined,
getgid: process.platform === 'linux' || process.platform === 'darwin' ? async () => process.getgid!() : undefined,
toCommonURI: async (filePath) => URI.file(filePath),
connect,
};
Expand Down
2 changes: 1 addition & 1 deletion src/spec-common/commonUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ export async function loadNativeModule<T>(moduleName: string): Promise<T | undef
export type PlatformSwitch<T> = T | { posix: T; win32: T };

export function platformDispatch<T>(platform: NodeJS.Platform, platformSwitch: PlatformSwitch<T>) {
if (typeof platformSwitch !== 'string' && 'win32' in platformSwitch) {
if (platformSwitch && typeof platformSwitch === 'object' && 'win32' in platformSwitch) {
return platform === 'win32' ? platformSwitch.win32 : platformSwitch.posix;
}
return platformSwitch;
Expand Down
4 changes: 2 additions & 2 deletions src/spec-node/containerFeatures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,8 @@ export async function updateRemoteUserUID(params: DockerResolverParameters, merg
'-t', fixedImageName,
'--build-arg', `BASE_IMAGE=${imageName}`,
'--build-arg', `REMOTE_USER=${remoteUser}`,
'--build-arg', `NEW_UID=${await cliHost.getuid()}`,
'--build-arg', `NEW_GID=${await cliHost.getgid()}`,
'--build-arg', `NEW_UID=${await cliHost.getuid!()}`,
'--build-arg', `NEW_GID=${await cliHost.getgid!()}`,
'--build-arg', `IMAGE_USER=${imageUser}`,
emptyFolder,
];
Expand Down
4 changes: 2 additions & 2 deletions src/spec-node/imageMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ function mergeGpuRequirements(a: undefined | boolean | 'optional' | HostGPURequi
return b;
} else if (b === undefined || b === false) {
return a;
} else if (a === 'optional' && b === 'optional ') {
} else if (a === 'optional' && b === 'optional') {
return 'optional';
} else {
const aObject = asHostGPURequirements(a);
Expand Down Expand Up @@ -267,7 +267,7 @@ export function getDevcontainerMetadata(baseImageMetadata: SubstitutedConfig<Ima
};
}

function pick<T, K extends keyof T>(obj: T, keys: K[]) {
function pick<T extends object, K extends keyof T>(obj: T, keys: K[]) {
return keys.reduce((res, key) => {
if (key in obj) {
res[key] = obj[key];
Expand Down
7 changes: 4 additions & 3 deletions src/spec-node/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,18 +112,19 @@ export interface ResolverResult {
composeProjectName?: string;
}

export interface SubstitutedConfig<T> {
export interface SubstitutedConfig<T extends DevContainerConfig | ImageMetadataEntry[]> {
config: T;
raw: T;
substitute: SubstituteConfig;
}

export type SubstituteConfig = <U extends DevContainerConfig | ImageMetadataEntry>(value: U) => U;

export function addSubstitution<T>(config: SubstitutedConfig<T>, substitute: SubstituteConfig): SubstitutedConfig<T> {
export function addSubstitution<T extends DevContainerConfig | ImageMetadataEntry[]>(config: SubstitutedConfig<T>, substitute: SubstituteConfig): SubstitutedConfig<T> {
const substitute0 = config.substitute;
const subsConfig = config.config;
return {
config: substitute(config.config),
config: (Array.isArray(subsConfig) ? subsConfig.map(substitute) : substitute(subsConfig)) as T,
raw: config.raw,
substitute: value => substitute(substitute0(value)),
};
Expand Down
4 changes: 2 additions & 2 deletions src/test/container-features/featureHelpers.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { assert } from 'chai';
import * as path from 'path';
import { DevContainerFeature } from '../../spec-configuration/configuration';
import { DevContainerConfig, DevContainerFeature } from '../../spec-configuration/configuration';
import { OCIRef } from '../../spec-configuration/containerCollectionsOCI';
import { Feature, FeatureSet, getBackwardCompatibleFeatureId, getFeatureInstallWrapperScript, processFeatureIdentifier } from '../../spec-configuration/containerFeaturesConfiguration';
import { getSafeId, findContainerUsers } from '../../spec-node/containerFeatures';
Expand Down Expand Up @@ -637,7 +637,7 @@ describe('findContainerUsers', () => {
});
});

function configWithRaw<T>(config: T): SubstitutedConfig<T> {
function configWithRaw<T extends DevContainerConfig | ImageMetadataEntry[]>(config: T): SubstitutedConfig<T> {
return {
config,
raw: config,
Expand Down
8 changes: 4 additions & 4 deletions src/test/imageMetadata.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
import * as assert from 'assert';
import * as path from 'path';
import { URI } from 'vscode-uri';
import { HostGPURequirements } from '../spec-configuration/configuration';
import { DevContainerConfig, HostGPURequirements } from '../spec-configuration/configuration';
import { Feature, FeaturesConfig, FeatureSet, Mount } from '../spec-configuration/containerFeaturesConfiguration';
import { experimentalImageMetadataDefault } from '../spec-node/devContainers';
import { getDevcontainerMetadata, getDevcontainerMetadataLabel, getImageMetadata, getImageMetadataFromContainer, imageMetadataLabel, internalGetImageMetadata0, mergeConfiguration } from '../spec-node/imageMetadata';
import { getDevcontainerMetadata, getDevcontainerMetadataLabel, getImageMetadata, getImageMetadataFromContainer, ImageMetadataEntry, imageMetadataLabel, internalGetImageMetadata0, mergeConfiguration } from '../spec-node/imageMetadata';
import { SubstitutedConfig } from '../spec-node/utils';
import { ContainerDetails, ImageDetails } from '../spec-shutdown/dockerUtils';
import { nullLog } from '../spec-utils/log';
import { buildKitOptions, shellExec, testSubstitute } from './testUtils';

const pkg = require('../../package.json');

function configWithRaw<T>(raw: T): SubstitutedConfig<T> {
function configWithRaw<T extends DevContainerConfig | ImageMetadataEntry[]>(raw: T): SubstitutedConfig<T> {
return {
config: testSubstitute(raw),
config: (Array.isArray(raw) ? raw.map(testSubstitute) : testSubstitute(raw)) as T,
raw,
substitute: testSubstitute,
};
Expand Down
3 changes: 0 additions & 3 deletions src/test/testUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,6 @@ export async function commandMarkerTests(cli: string, workspaceFolder: string, e
}

export const testSubstitute: SubstituteConfig = value => {
if (Array.isArray(value)) {
return value.map(s => testSubstitute(s)) as any;
}
if ('id' in value) {
return {
...value,
Expand Down
Loading

0 comments on commit 70fbc3a

Please sign in to comment.