@contember/config-loader
Advanced tools
Comparing version 1.2.0-alpha.18 to 1.2.0-alpha.19
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const path_1 = require("path"); | ||
const fs_1 = require("fs"); | ||
const node_path_1 = require("node:path"); | ||
const fs = require("node:fs/promises"); | ||
const YamlAdapter_1 = require("./adapters/YamlAdapter"); | ||
@@ -16,3 +16,3 @@ const JsonAdapter_1 = require("./adapters/JsonAdapter"); | ||
async load(filename) { | ||
const ext = (0, path_1.extname)(filename); | ||
const ext = (0, node_path_1.extname)(filename); | ||
if (!ext) { | ||
@@ -25,5 +25,5 @@ throw new Loader.UnresolvedAdapterError(`File ${filename} does not have an extension.`); | ||
} | ||
const file = await fs_1.promises.readFile(filename, { encoding: 'utf8' }); | ||
const file = await fs.readFile(filename, { encoding: 'utf8' }); | ||
const config = this.adapters[extWithoutDot].parse(file); | ||
return await this.includeConfigs(config, (0, path_1.dirname)(filename)); | ||
return await this.includeConfigs(config, (0, node_path_1.dirname)(filename)); | ||
} | ||
@@ -51,3 +51,3 @@ async loadString(content, adapter) { | ||
return Merger_1.default.merge(...(await Promise.all((_include || []).map(async (file) => { | ||
const nestedConfig = await this.load((0, path_1.join)(baseDir, file)); | ||
const nestedConfig = await this.load((0, node_path_1.join)(baseDir, file)); | ||
if (typeof nestedConfig !== 'object' || nestedConfig === null) { | ||
@@ -54,0 +54,0 @@ throw new Loader.InvalidConfigError(`Only object configs can be included`); |
{ | ||
"name": "@contember/config-loader", | ||
"version": "1.2.0-alpha.18", | ||
"version": "1.2.0-alpha.19", | ||
"license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "main": "dist/src/index.js", |
@@ -1,3 +0,3 @@ | ||
import { dirname, extname, join } from 'path' | ||
import { promises as fs } from 'fs' | ||
import { dirname, extname, join } from 'node:path' | ||
import * as fs from 'node:fs/promises' | ||
import { YamlAdapter } from './adapters/YamlAdapter' | ||
@@ -4,0 +4,0 @@ import { JsonAdapter } from './adapters/JsonAdapter' |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
1
61806