New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@backstage/config-loader

Package Overview
Dependencies
Maintainers
4
Versions
924
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@backstage/config-loader - npm Package Compare versions

Comparing version 0.1.1-alpha.16 to 0.1.1-alpha.17

40

dist/index.cjs.js

@@ -12,31 +12,4 @@ 'use strict';

function findRootPath(topPath) {
let path2 = topPath;
for (let i = 0; i < 1e3; i++) {
const packagePath = path.resolve(path2, "package.json");
const exists = fs.pathExistsSync(packagePath);
if (exists) {
try {
const data = fs.readJsonSync(packagePath);
if (data.name === "root" || data.name.includes("backstage-e2e")) {
return path2;
}
} catch (error) {
throw new Error(`Failed to parse package.json file while searching for root, ${error}`);
}
}
const newPath = path.dirname(path2);
if (newPath === path2) {
throw new Error(`No package.json with name "root" found as a parent of ${topPath}`);
}
path2 = newPath;
}
throw new Error(`Iteration limit reached when searching for root package.json at ${topPath}`);
}
async function resolveStaticConfig(options) {
let {configPath} = options;
if (!configPath) {
configPath = path.resolve(findRootPath(fs.realpathSync(process.cwd())), "app-config.yaml");
}
const configPath = path.resolve(options.rootPath, "app-config.yaml");
return [configPath];

@@ -128,3 +101,3 @@ }

try {
const parsedValue = JSON.parse(value);
const [, parsedValue] = safeJsonParse(value);
if (parsedValue === null) {

@@ -143,2 +116,9 @@ throw new Error("value may not be null");

}
function safeJsonParse(str) {
try {
return [null, JSON.parse(str)];
} catch (err) {
return [err, str];
}
}

@@ -226,3 +206,3 @@ const secretLoaderSchemas = {

}
async function loadConfig(options = {}) {
async function loadConfig(options) {
const configs = [];

@@ -229,0 +209,0 @@ configs.push(...readEnv(process.env));

import { AppConfig } from '@backstage/config';
declare type LoadConfigOptions = {
configPath?: string;
rootPath: string;
shouldReadSecrets?: boolean;
};
declare function loadConfig(options?: LoadConfigOptions): Promise<AppConfig[]>;
declare function loadConfig(options: LoadConfigOptions): Promise<AppConfig[]>;
export { LoadConfigOptions, loadConfig };
import fs from 'fs-extra';
import { resolve, dirname, basename, extname } from 'path';
import { resolve, basename, extname, dirname } from 'path';
import yaml2 from 'yaml';
import { object, string, lazy, array, ValidationError } from 'yup';
function findRootPath(topPath) {
let path2 = topPath;
for (let i = 0; i < 1e3; i++) {
const packagePath = resolve(path2, "package.json");
const exists = fs.pathExistsSync(packagePath);
if (exists) {
try {
const data = fs.readJsonSync(packagePath);
if (data.name === "root" || data.name.includes("backstage-e2e")) {
return path2;
}
} catch (error) {
throw new Error(`Failed to parse package.json file while searching for root, ${error}`);
}
}
const newPath = dirname(path2);
if (newPath === path2) {
throw new Error(`No package.json with name "root" found as a parent of ${topPath}`);
}
path2 = newPath;
}
throw new Error(`Iteration limit reached when searching for root package.json at ${topPath}`);
}
async function resolveStaticConfig(options) {
let {configPath} = options;
if (!configPath) {
configPath = resolve(findRootPath(fs.realpathSync(process.cwd())), "app-config.yaml");
}
const configPath = resolve(options.rootPath, "app-config.yaml");
return [configPath];

@@ -121,3 +94,3 @@ }

try {
const parsedValue = JSON.parse(value);
const [, parsedValue] = safeJsonParse(value);
if (parsedValue === null) {

@@ -136,2 +109,9 @@ throw new Error("value may not be null");

}
function safeJsonParse(str) {
try {
return [null, JSON.parse(str)];
} catch (err) {
return [err, str];
}
}

@@ -219,3 +199,3 @@ const secretLoaderSchemas = {

}
async function loadConfig(options = {}) {
async function loadConfig(options) {
const configs = [];

@@ -222,0 +202,0 @@ configs.push(...readEnv(process.env));

{
"name": "@backstage/config-loader",
"description": "Config loading functionality used by Backstage backend, and CLI",
"version": "0.1.1-alpha.16",
"version": "0.1.1-alpha.17",
"private": false,

@@ -33,3 +33,3 @@ "publishConfig": {

"dependencies": {
"@backstage/config": "^0.1.1-alpha.16",
"@backstage/config": "^0.1.1-alpha.17",
"fs-extra": "^9.0.0",

@@ -40,3 +40,3 @@ "yaml": "^1.9.2",

"devDependencies": {
"@types/jest": "^25.2.2",
"@types/jest": "^26.0.7",
"@types/node": "^12.0.0",

@@ -48,4 +48,4 @@ "@types/yup": "^0.28.2"

],
"gitHead": "8d58618eb2ff068f47509029216a2990e567f7fe",
"gitHead": "24ed336579226fc628f7f6ba38c0bb27f430b257",
"module": "dist/index.esm.js"
}
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