@spinajs/configuration
Advanced tools
Comparing version 2.0.50 to 2.0.51
@@ -1,2 +0,2 @@ | ||
import { ConfigurationSource, IConfigLike } from '@spinajs/configuration-common'; | ||
import { ConfigurationSource } from '@spinajs/configuration-common'; | ||
export declare abstract class BaseFileSource extends ConfigurationSource { | ||
@@ -14,10 +14,10 @@ protected RunApp?: string; | ||
constructor(RunApp?: string, CustomConfigPaths?: string[], appBaseDir?: string); | ||
protected load(extension: string, callback: (file: string) => Promise<unknown>): Promise<{}>; | ||
protected load(extension: string, callback: (file: string) => Promise<any>): Promise<{}>; | ||
} | ||
export declare class JsFileSource extends BaseFileSource { | ||
Load(): Promise<IConfigLike>; | ||
Load(): Promise<any>; | ||
} | ||
export declare class JsonFileSource extends BaseFileSource { | ||
Load(): Promise<IConfigLike>; | ||
Load(): Promise<any>; | ||
} | ||
//# sourceMappingURL=sources.d.ts.map |
@@ -7,2 +7,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
}; | ||
/* eslint-disable @typescript-eslint/no-unsafe-argument */ | ||
/* eslint-disable @typescript-eslint/no-unsafe-call */ | ||
/* eslint-disable @typescript-eslint/require-await */ | ||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ | ||
/* eslint-disable @typescript-eslint/no-unsafe-return */ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
import { Injectable, DI } from '@spinajs/di'; | ||
@@ -82,2 +88,3 @@ import glob from 'glob'; | ||
const common = await this.load('!(*.dev|*.prod).{cjs,js}', _load); | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
const dEnv = DI.get('process.env') ?? process.env; | ||
@@ -90,7 +97,8 @@ const fExt = dEnv.NODE_ENV && dEnv.NODE_ENV === 'development' ? '*.dev.{cjs,js}' : '*.prod.{cjs,js}'; | ||
InternalLogger.trace(`Trying to load file ${file}`, 'Configuration'); | ||
const res = (await import(`file://${file}`)); | ||
// eslint-disable -next-line security/detect-non-literal-require | ||
const res = await import(`file://${file}`); | ||
return res.default; | ||
} | ||
catch (err) { | ||
InternalLogger.error(err, `error loading configuration file ${file}`, 'configuration'); | ||
InternalLogger.error(err, `error loading configuration file ${file}`); | ||
return null; | ||
@@ -108,2 +116,3 @@ } | ||
const common = await this.load('!(*.dev|*.prod).json', _load); | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
const dEnv = DI.get('process.env') ?? process.env; | ||
@@ -116,3 +125,3 @@ const fExt = dEnv.NODE_ENV && dEnv.NODE_ENV === 'development' ? '*.dev.json' : '*.prod.json'; | ||
InternalLogger.trace(`Trying to load file ${file}`, 'Configuration'); | ||
return Promise.resolve(JSON.parse(fs.readFileSync(file, 'utf-8'))); | ||
return JSON.parse(fs.readFileSync(file, 'utf-8')); | ||
} | ||
@@ -119,0 +128,0 @@ catch (err) { |
{ | ||
"name": "@spinajs/configuration", | ||
"version": "2.0.50", | ||
"version": "2.0.51", | ||
"description": "framework configuration module", | ||
@@ -22,4 +22,4 @@ "exports": "./lib/index.js", | ||
"preversion": "npm run lint", | ||
"version": "npm run format && git add -A src", | ||
"postinstall": "npm run build" | ||
"version": "npm run format && git add -A src" | ||
}, | ||
@@ -26,0 +26,0 @@ "files": [ |
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
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
49370
671
0