Skip to content

Commit 6adf18b

Browse files
committed
ESM-only
1 parent 573a1e2 commit 6adf18b

12 files changed

+30
-34
lines changed

.eslintrc.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
],
1212
"rules": {
1313
"@typescript-eslint/prefer-ts-expect-error": 0,
14-
"@typescript-eslint/ban-ts-comment": 0
14+
"@typescript-eslint/ban-ts-comment": 0,
15+
"import/no-unresolved": "off"
1516
}
1617
}

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
{
22
"name": "@electron/get",
33
"version": "0.0.0-development",
4+
"type": "module",
45
"description": "Utility for downloading artifacts from different versions of Electron",
5-
"main": "dist/cjs/index.js",
6-
"module": "dist/esm/index.js",
76
"repository": "https://github.com/electron/get",
87
"author": "Samuel Attard",
98
"license": "MIT",
109
"publishConfig": {
1110
"provenance": true
1211
},
1312
"scripts": {
14-
"build": "tsc && tsc -p tsconfig.esm.json",
13+
"build": "tsc",
1514
"build:docs": "npx typedoc",
1615
"eslint": "eslint --ext .ts src test",
1716
"lint": "npm run prettier && npm run eslint",
@@ -46,6 +45,7 @@
4645
"@typescript-eslint/eslint-plugin": "^8.19.1",
4746
"@typescript-eslint/parser": "^8.0.0",
4847
"@vitest/coverage-v8": "3.0.3",
48+
"esbuild-plugin-file-path-extensions": "^2.1.4",
4949
"eslint": "^8.57.0",
5050
"eslint-config-prettier": "^6.15.0",
5151
"eslint-plugin-import": "^2.31.0",

src/GotDownloader.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import fs from 'node:fs';
77
import path from 'node:path';
88
import ProgressBar from 'progress';
99

10-
import { Downloader } from './Downloader';
10+
import { Downloader } from './Downloader.js';
1111

1212
const PROGRESS_BAR_DELAY_IN_SECONDS = 30;
1313

src/artifact-utils.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { ElectronArtifactDetails, MirrorOptions } from './types';
2-
import { ensureIsTruthyString, normalizeVersion } from './utils';
1+
import { ElectronArtifactDetails, MirrorOptions } from './types.js';
2+
import { ensureIsTruthyString, normalizeVersion } from './utils.js';
33

44
const BASE_URL = 'https://github.com/electron/electron/releases/download/';
55
const NIGHTLY_BASE_URL = 'https://github.com/electron/nightlies/releases/download/';

src/downloader-resolver.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { DownloadOptions } from './types';
2-
import { Downloader } from './Downloader';
1+
import { DownloadOptions } from './types.js';
2+
import { Downloader } from './Downloader.js';
33

44
// TODO: Resolve the downloader or default to GotDownloader
55
// Current thoughts are a dot-file traversal for something like
66
// ".electron.downloader" which would be a text file with the name of the
77
// npm module to import() and use as the downloader
8-
import { GotDownloader } from './GotDownloader';
8+
import { GotDownloader } from './GotDownloader.js';
99

1010
export async function getDownloaderForSystem(): Promise<Downloader<DownloadOptions>> {
1111
return new GotDownloader();

src/index.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@ import path from 'node:path';
44
import semver from 'semver';
55
import sumchecker from 'sumchecker';
66

7-
import { getArtifactFileName, getArtifactRemoteURL, getArtifactVersion } from './artifact-utils';
7+
import { getArtifactFileName, getArtifactRemoteURL, getArtifactVersion } from './artifact-utils.js';
88
import {
99
ElectronArtifactDetails,
1010
ElectronDownloadCacheMode,
1111
ElectronDownloadRequestOptions,
1212
ElectronGenericArtifactDetails,
1313
ElectronPlatformArtifactDetails,
1414
ElectronPlatformArtifactDetailsWithDefaults,
15-
} from './types';
16-
import { Cache } from './Cache';
17-
import { getDownloaderForSystem } from './downloader-resolver';
18-
import { initializeProxy } from './proxy';
15+
} from './types.js';
16+
import { Cache } from './Cache.js';
17+
import { getDownloaderForSystem } from './downloader-resolver.js';
18+
import { initializeProxy } from './proxy.js';
1919
import {
2020
withTempDirectoryIn,
2121
getHostArch,
@@ -27,11 +27,11 @@ import {
2727
effectiveCacheMode,
2828
shouldTryReadCache,
2929
TempDirCleanUpMode,
30-
} from './utils';
30+
} from './utils.js';
3131

32-
export { getHostArch } from './utils';
33-
export { initializeProxy } from './proxy';
34-
export * from './types';
32+
export { getHostArch } from './utils.js';
33+
export { initializeProxy } from './proxy.js';
34+
export * from './types.js';
3535

3636
const d = debug('@electron/get:index');
3737

src/proxy.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import debug from 'debug';
2-
import { getEnv, setEnv } from './utils';
2+
import { getEnv, setEnv } from './utils.js';
33

44
const d = debug('@electron/get:proxy');
55

src/types.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Downloader } from './Downloader';
2-
import { GotDownloader, GotDownloaderOptions } from './GotDownloader';
1+
import { Downloader } from './Downloader.js';
2+
import { GotDownloader, GotDownloaderOptions } from './GotDownloader.js';
33

44
export { Downloader, GotDownloader, GotDownloaderOptions };
55

src/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
ElectronDownloadCacheMode,
88
ElectronGenericArtifactDetails,
99
ElectronPlatformArtifactDetailsWithDefaults,
10-
} from './types';
10+
} from './types.js';
1111

1212
async function useAndRemoveDirectory<T>(
1313
directory: string,

tsconfig.esm.json

-8
This file was deleted.

tsconfig.json

+1-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22
"extends": "@tsconfig/node22/tsconfig.json",
33
"compilerOptions": {
44
"sourceMap": true,
5-
"outDir": "dist/cjs",
5+
"outDir": "dist",
66
"types": ["node"],
7-
"allowSyntheticDefaultImports": true,
8-
"declaration": true
97
},
108
"include": ["src"]
119
}

yarn.lock

+5
Original file line numberDiff line numberDiff line change
@@ -1185,6 +1185,11 @@ es6-error@^4.1.1:
11851185
resolved "https://registry.yarnpkg.com/es6-error/-/es6-error-4.1.1.tgz#9e3af407459deed47e9a91f9b885a84eb05c561d"
11861186
integrity sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==
11871187

1188+
esbuild-plugin-file-path-extensions@^2.1.4:
1189+
version "2.1.4"
1190+
resolved "https://registry.yarnpkg.com/esbuild-plugin-file-path-extensions/-/esbuild-plugin-file-path-extensions-2.1.4.tgz#cad9d1d3133e95146eeabd76fdf3956a66f6348b"
1191+
integrity sha512-lNjylaAsJMprYg28zjUyBivP3y0ms9b7RJZ5tdhDUFLa3sCbqZw4wDnbFUSmnyZYWhCYDPxxp7KkXM2TXGw3PQ==
1192+
11881193
esbuild@^0.24.2:
11891194
version "0.24.2"
11901195
resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.24.2.tgz#b5b55bee7de017bff5fb8a4e3e44f2ebe2c3567d"

0 commit comments

Comments
 (0)