Skip to content

Commit fc9a5ec

Browse files
committed
successfully compiles but vscode still does not support ESM extensions (see microsoft/vscode#130367)
1 parent fb0e1b7 commit fc9a5ec

24 files changed

+1457
-1029
lines changed

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ module.exports = {
146146
"eol-last": "off",
147147
"eqeqeq": [
148148
"error",
149-
"always"
149+
"smart"
150150
],
151151
"guard-for-in": "error",
152152
"id-denylist": "error",

package-lock.json

Lines changed: 1322 additions & 910 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"name": "vs-verification-toolbox",
33
"version": "1.0.0",
44
"description": "Useful component to build VS Code extensions for verifiers.",
5-
"main": "out/index.js",
5+
"type": "module",
6+
"exports": "./out/index.js",
67
"activationEvents": [
78
"this property is required to run vs code tests"
89
],
@@ -25,15 +26,17 @@
2526
"npm",
2627
"node"
2728
],
28-
"author": "Julian Dunskus",
29+
"author": {
30+
"name": "Chair of Programming Methodology, ETH Zurich"
31+
},
2932
"license": "MPL-2.0",
3033
"bugs": {
3134
"url": "https://github.com/viperproject/vs-verification-toolbox/issues"
3235
},
3336
"homepage": "https://github.com/viperproject/vs-verification-toolbox#readme",
3437
"engines": {
3538
"vscode": "^1.43.0",
36-
"node": "*"
39+
"node": ">=18"
3740
},
3841
"devDependencies": {
3942
"@types/fs-extra": "^11.0.4",
@@ -61,6 +64,6 @@
6164
"@octokit/rest": "^20.0.2",
6265
"extract-zip": "^2.0.0",
6366
"fs-extra": "^11.2.0",
64-
"got": "^11.8.6"
67+
"got": "^14.4.4"
6568
}
6669
}

src/dependencies/Dependency.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as path from 'path';
22

3-
import { ConfirmResult, InstallResult, Success } from './';
4-
import { Location, ProgressListener } from '../util';
3+
import { ConfirmResult, InstallResult, Success } from './index.js';
4+
import { Location, ProgressListener } from '../util/index.js';
55

66
/**
77
* Manages the installation for a dependency, maintaining separate installations for each source (in a folder using their name).

src/dependencies/FileDownloader.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import * as fs from 'fs-extra';
2-
import * as path from 'path';
2+
import * as path from 'node:path';
33
import got, { Headers, Options, Progress } from 'got';
44
import * as stream from 'stream';
55
import { promisify } from 'util';
66

7-
import { Canceled, ConfirmResult, DependencyInstaller, InstallResult, Success } from './';
8-
import { Location, ProgressListener } from '../util';
7+
import { Canceled, ConfirmResult, DependencyInstaller, InstallResult, Success } from './index.js';
8+
import { Location, ProgressListener } from '../util/index.js';
99

1010

1111
const pipeline = promisify(stream.pipeline);

src/dependencies/GitHubReleaseAsset.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ export class GitHubReleaseAsset {
2828
// get the first release which corresponds to the latest pre- or non-pre-release.
2929
// note that draft releases do not show up for unauthenticated users
3030
// see https://octokit.github.io/rest.js/v18#repos-list-releases
31-
let listReleasesParams: RestEndpointMethodTypes["repos"]["listReleases"]["parameters"] = {
32-
owner: owner,
33-
repo: repo,
34-
}
31+
const listReleasesParams: RestEndpointMethodTypes["repos"]["listReleases"]["parameters"] = {
32+
owner,
33+
repo,
34+
};
3535
if (token == null) {
3636
listReleasesParams.per_page = 1;
3737
listReleasesParams.page = 1;
@@ -88,7 +88,7 @@ export class GitHubReleaseAsset {
8888
* @param token personal access token, OAuth token, installation access token, or JSON Web Token for GitHub App authentication
8989
*/
9090
private static buildOctokit(token?: string): Octokit {
91-
if (token) {
91+
if (token != null) {
9292
return new Octokit({
9393
auth: token,
9494
});

src/dependencies/GitHubZipExtractor.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
import * as path from 'path';
2-
3-
import { ConfirmResult, DependencyInstaller, FileDownloader, InstallerSequence, InstallResult, Success, ZipExtractor } from './';
4-
import { Location, ProgressListener } from '../util';
1+
import { ConfirmResult, DependencyInstaller, FileDownloader, InstallerSequence, InstallResult, Success, ZipExtractor } from './index.js';
2+
import { Location, ProgressListener } from '../util/index.js';
53

64
/**
75
* Extension of RemoteZipExtractor with the following features:
86
* - no remote URL needed at construction time: a (potentially expensive) computation of the remote URL is only
9-
* performed when a download will actually take place.
7+
* performed when a download will actually take place.
108
* - the correct header for downloading a GitHub release asset is set
119
* - if a GitHub token is provided it is used to perform the download as an authenticated user
1210
*/
@@ -32,8 +30,8 @@ export class GitHubZipExtractor implements DependencyInstaller {
3230
const downloadHeaders: Record<string, string | string[] | undefined> = {
3331
"Accept": "application/octet-stream"
3432
};
35-
if (this.token) {
36-
downloadHeaders["Authorization"] = `token ${this.token}`;
33+
if (this.token != null) {
34+
downloadHeaders.Authorization = `token ${this.token}`;
3735
}
3836

3937
// lazily initialize sequence:

src/dependencies/InstallResult.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable no-underscore-dangle */
12
export interface InstallResult<T> {
23
isSuccess(): boolean;
34
}
@@ -7,8 +8,8 @@ export class Success<T> implements InstallResult<T> {
78
private readonly _value: T;
89

910
/**
10-
* @param t non-null
11-
*/
11+
* @param t non-null
12+
*/
1213
constructor(t: T) {
1314
if (t == null) {
1415
throw new Error(`Invalid argument: Success(v) can only be constructed with a non-null value`);

src/dependencies/InstallerSequence.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { ConfirmResult, DependencyInstaller, InstallResult, Success } from './';
2-
import { Location, ProgressListener } from '../util';
1+
import { ConfirmResult, DependencyInstaller, InstallResult, Success } from './index.js';
2+
import { Location, ProgressListener } from '../util/index.js';
33

44
export class InstallerSequence {
55
constructor(readonly installers: DependencyInstaller[]) {
@@ -16,17 +16,17 @@ export class InstallerSequence {
1616

1717
public async install(location: Location, shouldUpdate: boolean, progressListener: ProgressListener, confirm:() => Promise<ConfirmResult>): Promise<InstallResult<Location>> {
1818
let index = 0;
19-
let firstConfirmPromise: Promise<ConfirmResult> | undefined = undefined;
19+
let firstConfirmPromise: Promise<ConfirmResult> | undefined;
2020
let result: InstallResult<Location> = new Success(location);
2121
const total = this.installers.length;
2222
for (const installer of this.installers) {
23-
function intermediateListener(fraction: number, message: string) {
23+
const intermediateListener = (fraction: number, message: string) => {
2424
progressListener(
2525
(index + fraction) / total,
2626
`${message} (step ${index + 1} of ${total})`
2727
);
28-
}
29-
function intermediateConfirm(): Promise<ConfirmResult> {
28+
};
29+
const intermediateConfirm = () => {
3030
// only ask once
3131
if (firstConfirmPromise == null) {
3232
firstConfirmPromise = confirm();
@@ -35,7 +35,7 @@ export class InstallerSequence {
3535
// return same promise:
3636
return firstConfirmPromise;
3737
}
38-
}
38+
};
3939

4040
if (result instanceof Success) {
4141
// continue with next installer

src/dependencies/LocalReference.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as fs from 'fs-extra';
22

3-
import { ConfirmResult, DependencyInstaller, InstallResult, Success } from './';
4-
import { Location, ProgressListener } from '../util';
3+
import { ConfirmResult, DependencyInstaller, InstallResult, Success } from './index.js';
4+
import { Location, ProgressListener } from '../util/index.js';
55

66
export class LocalReference implements DependencyInstaller {
77
constructor(

0 commit comments

Comments
 (0)