|
1 | | -import {UsageError} from 'clipanion'; |
2 | | -import fs from 'fs'; |
3 | | -import path from 'path'; |
4 | | -import process from 'process'; |
5 | | -import semverRcompare from 'semver/functions/rcompare'; |
6 | | -import semverValid from 'semver/functions/valid'; |
7 | | -import semverValidRange from 'semver/ranges/valid'; |
8 | | - |
9 | | -import defaultConfig from '../config.json'; |
10 | | - |
11 | | -import * as corepackUtils from './corepackUtils'; |
12 | | -import * as debugUtils from './debugUtils'; |
13 | | -import * as folderUtils from './folderUtils'; |
14 | | -import type {NodeError} from './nodeUtils'; |
15 | | -import * as semverUtils from './semverUtils'; |
16 | | -import * as specUtils from './specUtils'; |
17 | | -import {Config, Descriptor, LazyLocator, Locator} from './types'; |
18 | | -import {SupportedPackageManagers, SupportedPackageManagerSet} from './types'; |
19 | | -import {isSupportedPackageManager, PackageManagerSpec} from './types'; |
| 1 | +import {UsageError} from 'clipanion'; |
| 2 | +import fs from 'fs'; |
| 3 | +import path from 'path'; |
| 4 | +import process from 'process'; |
| 5 | +import semverRcompare from 'semver/functions/rcompare.js'; |
| 6 | +import semverValid from 'semver/functions/valid.js'; |
| 7 | +import semverValidRange from 'semver/ranges/valid.js'; |
| 8 | + |
| 9 | +import defaultConfig from '../config.json' with {type: 'json'}; |
| 10 | + |
| 11 | +import * as corepackUtils from './corepackUtils.ts'; |
| 12 | +import * as debugUtils from './debugUtils.ts'; |
| 13 | +import * as folderUtils from './folderUtils.ts'; |
| 14 | +import type {NodeError} from './nodeUtils.ts'; |
| 15 | +import * as semverUtils from './semverUtils.ts'; |
| 16 | +import * as specUtils from './specUtils.ts'; |
| 17 | +import type {Config, Descriptor, LazyLocator, Locator} from './types.ts'; |
| 18 | +import type {SupportedPackageManagers} from './types.ts'; |
| 19 | +import {SupportedPackageManagerSet} from './types.ts'; |
| 20 | +import type {PackageManagerSpec} from './types.ts'; |
| 21 | +import {isSupportedPackageManager} from './types.ts'; |
20 | 22 |
|
21 | 23 | export type PreparedPackageManagerInfo = Awaited<ReturnType<Engine[`ensurePackageManager`]>>; |
22 | 24 |
|
@@ -94,7 +96,10 @@ export async function activatePackageManager(lastKnownGood: Record<string, strin |
94 | 96 | } |
95 | 97 |
|
96 | 98 | export class Engine { |
97 | | - constructor(public config: Config = defaultConfig as Config) { |
| 99 | + config: Config; |
| 100 | + |
| 101 | + constructor(config: Config = defaultConfig as Config) { |
| 102 | + this.config = config; |
98 | 103 | } |
99 | 104 |
|
100 | 105 | getPackageManagerFor(binaryName: string): SupportedPackageManagers | null { |
@@ -161,7 +166,7 @@ export class Engine { |
161 | 166 | async getDefaultDescriptors() { |
162 | 167 | const locators: Array<Descriptor> = []; |
163 | 168 |
|
164 | | - for (const name of SupportedPackageManagerSet as Set<SupportedPackageManagers>) |
| 169 | + for (const name of SupportedPackageManagerSet) |
165 | 170 | locators.push({name, range: await this.getDefaultVersion(name)}); |
166 | 171 |
|
167 | 172 | return locators; |
|
0 commit comments