Socket
Socket
Sign inDemoInstall

@ms-cloudpack/config

Package Overview
Dependencies
Maintainers
3
Versions
159
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ms-cloudpack/config - npm Package Compare versions

Comparing version 0.17.29 to 0.17.30

2

lib/readUserConfig.js

@@ -21,3 +21,3 @@ import { readJson } from '@ms-cloudpack/json-utilities';

for (const importSpecifier of extendsArray) {
const resolvedPath = await resolveParentConfig({ configPath, importSpecifier });
const resolvedPath = resolveParentConfig({ configPath, importSpecifier });
if (resolvedPath) {

@@ -24,0 +24,0 @@ const parentConfig = await readUserConfigInternal(resolvedPath);

@@ -10,3 +10,3 @@ /**

importSpecifier: string;
}): Promise<string | undefined>;
}): string | undefined;
//# sourceMappingURL=resolveParentConfig.d.ts.map

@@ -1,5 +0,6 @@

import { resolve } from '@ms-cloudpack/package-utilities';
import { parseImportString } from '@ms-cloudpack/path-string-parsing';
import fs from 'fs';
import path from 'path';
import { moduleResolve } from 'import-meta-resolve';
import { fileURLToPath, pathToFileURL } from 'url';
// Conditions used for resolution if the package has an exports map.
// More could be added later if desired ("default" is implicitly included).
const conditions = new Set(['import', 'require', 'node']);
/**

@@ -9,27 +10,14 @@ * Resolve an import specifier for a parent config file.

*/
export async function resolveParentConfig(params) {
export function resolveParentConfig(params) {
const { importSpecifier, configPath } = params;
let resolvedConfigPath;
if (importSpecifier.startsWith('.')) {
resolvedConfigPath = path.resolve(path.dirname(configPath), importSpecifier);
try {
const resolvedUrl = moduleResolve(importSpecifier, pathToFileURL(configPath), conditions);
resolvedConfigPath = fileURLToPath(resolvedUrl);
}
else {
const parsedImport = parseImportString(importSpecifier);
const resolvedPackage = await resolve(parsedImport.packageName, path.dirname(configPath));
if (resolvedPackage) {
resolvedConfigPath = path.join(resolvedPackage, parsedImport.importPath);
}
catch (err) {
console.warn(`Error resolving config "extends": "${importSpecifier}": ${err.message || err}`);
}
if (!resolvedConfigPath) {
console.warn(`Unable to resolve config "extends": "${importSpecifier}" from ${configPath}`);
return undefined;
}
// Explicitly check if the file exists and log a warning (so the user knows their config is wrong),
// rather than letting readJson quietly return nothing later.
if (!fs.existsSync(resolvedConfigPath)) {
console.warn(`Resolved config "extends": "${importSpecifier}" (from ${configPath}) to ${resolvedConfigPath}, but the file doesn't exist`);
return undefined;
}
return resolvedConfigPath;
}
//# sourceMappingURL=resolveParentConfig.js.map
{
"name": "@ms-cloudpack/config",
"version": "0.17.29",
"version": "0.17.30",
"description": "Configuration handling for cloudpack.",

@@ -17,7 +17,7 @@ "license": "MIT",

"dependencies": {
"@ms-cloudpack/bundler-types": "^0.24.4",
"@ms-cloudpack/config-types": "^0.5.0",
"@ms-cloudpack/bundler-types": "^0.24.5",
"@ms-cloudpack/config-types": "^0.5.1",
"@ms-cloudpack/json-utilities": "^0.1.4",
"@ms-cloudpack/package-utilities": "^5.10.4",
"@ms-cloudpack/path-string-parsing": "^1.1.3",
"@ms-cloudpack/package-utilities": "^5.10.5",
"import-meta-resolve": "^4.0.0",
"merge": "^2.1.1",

@@ -24,0 +24,0 @@ "semver": "^7.6.0"

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc