Skip to content

Commit 64ea886

Browse files
committed
Use built-in UUID
1 parent 4080b06 commit 64ea886

5 files changed

Lines changed: 5 additions & 10 deletions

File tree

esbuild.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const watch = process.argv.indexOf('--watch') !== -1;
5757
minify,
5858
watch,
5959
platform: 'node',
60-
target: 'node14.14.0',
60+
target: 'node14.17.0',
6161
external: ['vscode-dev-containers'],
6262
mainFields: ['module', 'main'],
6363
outdir: 'dist',

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"license": "SEE LICENSE IN LICENSE.txt",
1717
"engines": {
18-
"node": ">=14.14.0"
18+
"node": ">=14.17.0"
1919
},
2020
"scripts": {
2121
"compile": "npm-run-all clean-dist definitions compile-dev",

src/spec-common/injectHeadless.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import * as path from 'path';
77
import * as fs from 'fs';
88
import { StringDecoder } from 'string_decoder';
99
import * as crypto from 'crypto';
10-
import { promisify } from 'util';
1110

1211
import { ContainerError, toErrorText, toWarningText } from './errors';
1312
import { launch, ShellServer } from './shellServer';
@@ -740,8 +739,7 @@ async function runUserEnvProbe(userEnvProbe: UserEnvProbe, params: { allowSystem
740739
try {
741740
// From VS Code's shellEnv.ts
742741

743-
const buffer = await promisify(crypto.randomBytes)(16);
744-
const mark = buffer.toString('hex');
742+
const mark = crypto.randomUUID();
745743
const regex = new RegExp(mark + '([^]*)' + mark);
746744
const systemShellUnix = containerProperties.shell;
747745
params.output.write(`userEnvProbe shell: ${systemShellUnix}`);

src/spec-configuration/editableFiles.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
import * as crypto from 'crypto';
77
import * as jsonc from 'jsonc-parser';
8-
import { promisify } from 'util';
98
import { URI } from 'vscode-uri';
109
import { uriToFsPath, FileHost } from './configurationCommonUtils';
1110
import { readLocalFile, writeLocalFile } from '../spec-utils/pfs';
@@ -108,8 +107,7 @@ export class RemoteDocuments implements Documents {
108107
case RemoteDocuments.scheme:
109108
try {
110109
if (!RemoteDocuments.nonce) {
111-
const buffer = await promisify(crypto.randomBytes)(20);
112-
RemoteDocuments.nonce = buffer.toString('hex');
110+
RemoteDocuments.nonce = crypto.randomUUID();
113111
}
114112
const result = jsonc.applyEdits(content, edits);
115113
const eof = `EOF-${RemoteDocuments.nonce}`;

src/spec-node/devContainers.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import { createNullPostCreate, finishBackgroundTasks, ResolverParameters, UserEn
1212
import { getCLIHost, loadNativeModule } from '../spec-common/commonUtils';
1313
import { resolve } from './configContainer';
1414
import { URI } from 'vscode-uri';
15-
import { promisify } from 'util';
1615
import { LogLevel, LogDimensions, toErrorText, createCombinedLog, createTerminalLog, Log, makeLog, LogFormat, createJSONLog, createPlainLog } from '../spec-utils/log';
1716
import { dockerComposeCLIConfig } from './dockerCompose';
1817
import { Mount } from '../spec-configuration/containerFeaturesConfiguration';
@@ -103,7 +102,7 @@ export async function createDockerParams(options: ProvisionOptions, disposables:
103102
const appRoot = undefined;
104103
const cwd = options.workspaceFolder || process.cwd();
105104
const cliHost = await getCLIHost(cwd, loadNativeModule);
106-
const sessionId = (await promisify(crypto.randomBytes)(20)).toString('hex'); // TODO: Somehow enable correlation.
105+
const sessionId = crypto.randomUUID();
107106

108107
const common: ResolverParameters = {
109108
prebuild: options.prebuild,

0 commit comments

Comments
 (0)