"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "packages/angular/cli/utilities/package-metadata.ts" between
angular-cli-12.1.2.tar.gz and angular-cli-12.1.3.tar.gz

About: Angular CLI is a command line interface for Angular.

package-metadata.ts  (angular-cli-12.1.2):package-metadata.ts  (angular-cli-12.1.3)
skipping to change at line 134 skipping to change at line 134
const root = path.parse(cwd).root; const root = path.parse(cwd).root;
for (let curDir = path.dirname(cwd); curDir && curDir !== root; curDir = pat h.dirname(curDir)) { for (let curDir = path.dirname(cwd); curDir && curDir !== root; curDir = pat h.dirname(curDir)) {
projectConfigLocations.unshift(path.join(curDir, dotFilename)); projectConfigLocations.unshift(path.join(curDir, dotFilename));
} }
} }
if (showPotentials) { if (showPotentials) {
logger.info(`Locating potential ${baseFilename} files:`); logger.info(`Locating potential ${baseFilename} files:`);
} }
const options: PackageManagerOptions = {}; let rcOptions: PackageManagerOptions = {};
for (const location of [...defaultConfigLocations, ...projectConfigLocations]) { for (const location of [...defaultConfigLocations, ...projectConfigLocations]) {
if (existsSync(location)) { if (existsSync(location)) {
if (showPotentials) { if (showPotentials) {
logger.info(`Trying '${location}'...found.`); logger.info(`Trying '${location}'...found.`);
} }
const data = readFileSync(location, 'utf8'); const data = readFileSync(location, 'utf8');
// Normalize RC options that are needed by 'npm-registry-fetch'. // Normalize RC options that are needed by 'npm-registry-fetch'.
// See: https://github.com/npm/npm-registry-fetch/blob/ebddbe78a5f67118c1f 7af2e02c8a22bcaf9e850/index.js#L99-L126 // See: https://github.com/npm/npm-registry-fetch/blob/ebddbe78a5f67118c1f 7af2e02c8a22bcaf9e850/index.js#L99-L126
const rcConfig: PackageManagerOptions = yarn ? lockfile.parse(data) : ini. parse(data); const rcConfig: PackageManagerOptions = yarn ? lockfile.parse(data) : ini. parse(data);
for (const [key, value] of Object.entries(rcConfig)) {
let substitutedValue = value;
// Substitute any environment variable references. rcOptions = normalizeOptions(rcConfig, location);
if (typeof value === 'string') { }
substitutedValue = value.replace(/\$\{([^\}]+)\}/, (_, name) => proces }
s.env[name] || '');
}
switch (key) { const envVariablesOptions: PackageManagerOptions = {};
// Unless auth options are scope with the registry url it appears that for (const [key, value] of Object.entries(process.env)) {
npm-registry-fetch ignores them, if (!value) {
// even though they are documented. continue;
// https://github.com/npm/npm-registry-fetch/blob/8954f61d8d703e5eb7f3 }
d93c9b40488f8b1b62ac/README.md
// https://github.com/npm/npm-registry-fetch/blob/8954f61d8d703e5eb7f3 let normalizedName = key.toLowerCase();
d93c9b40488f8b1b62ac/auth.js#L45-L91 if (normalizedName.startsWith('npm_config_')) {
case '_authToken': normalizedName = normalizedName.substring(11);
case 'token': } else if (yarn && normalizedName.startsWith('yarn_')) {
case 'username': normalizedName = normalizedName.substring(5);
case 'password': } else {
case '_auth': continue;
case 'auth': }
options['forceAuth'] ??= {};
options['forceAuth'][key] = substitutedValue; normalizedName = normalizedName.replace(/(?!^)_/g, '-'); // don't replace _
break; at the start of the key.s
case 'noproxy': envVariablesOptions[normalizedName] = value;
case 'no-proxy': }
options['noProxy'] = substitutedValue;
break; return {
case 'maxsockets': ...rcOptions,
options['maxSockets'] = substitutedValue; ...normalizeOptions(envVariablesOptions),
break; };
case 'https-proxy': }
case 'proxy':
options['proxy'] = substitutedValue; function normalizeOptions(
break; rawOptions: PackageManagerOptions,
case 'strict-ssl': location = process.cwd(),
options['strictSSL'] = substitutedValue; ): PackageManagerOptions {
break; const options: PackageManagerOptions = {};
case 'local-address':
options['localAddress'] = substitutedValue; for (const [key, value] of Object.entries(rawOptions)) {
break; let substitutedValue = value;
case 'cafile':
if (typeof substitutedValue === 'string') { // Substitute any environment variable references.
const cafile = path.resolve(path.dirname(location), substitutedVal if (typeof value === 'string') {
ue); substitutedValue = value.replace(/\$\{([^\}]+)\}/, (_, name) => process.en
try { v[name] || '');
options['ca'] = readFileSync(cafile, 'utf8').replace(/\r?\n/g, ' }
\n');
} catch {} switch (key) {
} // Unless auth options are scope with the registry url it appears that npm
break; -registry-fetch ignores them,
default: // even though they are documented.
options[key] = substitutedValue; // https://github.com/npm/npm-registry-fetch/blob/8954f61d8d703e5eb7f3d93c
break; 9b40488f8b1b62ac/README.md
// https://github.com/npm/npm-registry-fetch/blob/8954f61d8d703e5eb7f3d93c
9b40488f8b1b62ac/auth.js#L45-L91
case '_authToken':
case 'token':
case 'username':
case 'password':
case '_auth':
case 'auth':
options['forceAuth'] ??= {};
options['forceAuth'][key] = substitutedValue;
break;
case 'noproxy':
case 'no-proxy':
options['noProxy'] = substitutedValue;
break;
case 'maxsockets':
options['maxSockets'] = substitutedValue;
break;
case 'https-proxy':
case 'proxy':
options['proxy'] = substitutedValue;
break;
case 'strict-ssl':
options['strictSSL'] = substitutedValue;
break;
case 'local-address':
options['localAddress'] = substitutedValue;
break;
case 'cafile':
if (typeof substitutedValue === 'string') {
const cafile = path.resolve(path.dirname(location), substitutedValue);
try {
options['ca'] = readFileSync(cafile, 'utf8').replace(/\r?\n/g, '\n')
;
} catch {}
} }
} break;
default:
options[key] = substitutedValue;
break;
} }
} }
return options; return options;
} }
function normalizeManifest(rawManifest: { name: string; version: string }): Pack ageManifest { function normalizeManifest(rawManifest: { name: string; version: string }): Pack ageManifest {
// TODO: Fully normalize and sanitize // TODO: Fully normalize and sanitize
return { return {
skipping to change at line 279 skipping to change at line 313
export async function fetchPackageManifest( export async function fetchPackageManifest(
name: string, name: string,
logger: logging.LoggerApi, logger: logging.LoggerApi,
options: { options: {
registry?: string; registry?: string;
usingYarn?: boolean; usingYarn?: boolean;
verbose?: boolean; verbose?: boolean;
} = {}, } = {},
): Promise<PackageManifest> { ): Promise<PackageManifest> {
const { usingYarn = false, verbose = false, registry } = options; const { usingYarn = false, verbose = false, registry } = options;
ensureNpmrc(logger, usingYarn, verbose); ensureNpmrc(logger, usingYarn, verbose);
const response = await pacote.manifest(name, { const response = await pacote.manifest(name, {
fullMetadata: true, fullMetadata: true,
...npmrc, ...npmrc,
...(registry ? { registry } : {}), ...(registry ? { registry } : {}),
}); });
return normalizeManifest(response); return normalizeManifest(response);
} }
skipping to change at line 306 skipping to change at line 339
usingYarn?: boolean; usingYarn?: boolean;
verbose?: boolean; verbose?: boolean;
} = {}, } = {},
): Promise<Partial<NpmRepositoryPackageJson>> { ): Promise<Partial<NpmRepositoryPackageJson>> {
const cachedResponse = npmPackageJsonCache.get(packageName); const cachedResponse = npmPackageJsonCache.get(packageName);
if (cachedResponse) { if (cachedResponse) {
return cachedResponse; return cachedResponse;
} }
const { usingYarn = false, verbose = false, registry } = options; const { usingYarn = false, verbose = false, registry } = options;
ensureNpmrc(logger, usingYarn, verbose);
if (!npmrc) {
try {
npmrc = readOptions(logger, false, verbose);
} catch {}
if (usingYarn) {
try {
npmrc = { ...npmrc, ...readOptions(logger, true, verbose) };
} catch {}
}
}
const resultPromise: Promise<NpmRepositoryPackageJson> = pacote.packument(pack ageName, { const resultPromise: Promise<NpmRepositoryPackageJson> = pacote.packument(pack ageName, {
fullMetadata: true, fullMetadata: true,
...npmrc, ...npmrc,
...(registry ? { registry } : {}), ...(registry ? { registry } : {}),
}); });
// TODO: find some way to test this // TODO: find some way to test this
const response = resultPromise.catch((err) => { const response = resultPromise.catch((err) => {
logger.warn(err.message || err); logger.warn(err.message || err);
 End of changes. 7 change blocks. 
69 lines changed or deleted 91 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)