refactor(@angular/cli): convert ini and @yarnpkg/lockfile usage from require to import

The removal of require usage supports the eventual shift to an ESM output for the CLI package.
This commit is contained in:
Charles Lyding 2021-08-24 14:57:32 -04:00 committed by Filipe Silva
parent 6f4bf38e9c
commit 266233c66e
2 changed files with 12 additions and 2 deletions

View File

@ -6,6 +6,16 @@
* found in the LICENSE file at https://angular.io/license
*/
declare module '@yarnpkg/lockfile' {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function parse(data: string): Record<string, any>;
}
declare module 'ini' {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export function parse(data: string): Record<string, any>;
}
declare module 'npm-pick-manifest' {
function pickManifest(
metadata: import('../utilities/package-metadata').PackageMetadata,

View File

@ -7,13 +7,13 @@
*/
import { logging } from '@angular-devkit/core';
import * as lockfile from '@yarnpkg/lockfile';
import { existsSync, readFileSync } from 'fs';
import * as ini from 'ini';
import { homedir } from 'os';
import * as path from 'path';
import { JsonSchemaForNpmPackageJsonFiles } from './package-json';
const lockfile = require('@yarnpkg/lockfile');
const ini = require('ini');
const pacote = require('pacote');
const npmPackageJsonCache = new Map<string, Promise<Partial<NpmRepositoryPackageJson>>>();