Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

app-conf

Package Overview
Dependencies
Maintainers
3
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

app-conf - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0

_readFile.js

34

entries.js

@@ -7,5 +7,3 @@ "use strict";

const fs$readFile = promisify(require("fs").readFile);
const j = require("path").join;
const realpath = promisify(require("fs").realpath);
const resolvePath = require("path").resolve;

@@ -21,13 +19,2 @@

function readFile(path) {
return realpath(path).then(function (path) {
return fs$readFile(path).then(function (buffer) {
return {
path,
content: buffer,
};
});
});
}
function ignoreAccessErrors(error) {

@@ -49,3 +36,3 @@ if (error.code !== "EACCES") {

dir: (opts) => opts.appDir,
read: (_, dir) => dir && pMap(glob(j(dir, "config.*")), readFile),
list: (_, dir) => dir && glob(j(dir, "config.*")),
},

@@ -57,3 +44,3 @@

dir: (opts) => j("/etc", opts.appName),
read: (_, dir) => pMap(glob(j(dir, "config.*")), readFile),
list: (_, dir) => glob(j(dir, "config.*")),
},

@@ -68,3 +55,3 @@

},
read: (_, dir) => dir && pMap(glob(j(dir, "config.*")), readFile),
list: (_, dir) => dir && glob(j(dir, "config.*")),
},

@@ -76,3 +63,3 @@

name: "local",
read(opts) {
list(opts) {
const { appName } = opts;

@@ -91,12 +78,9 @@

return pMap(
pMap(paths.reverse(), (path) =>
glob(path, {
silent: true,
}).catch(ignoreAccessErrors),
).then(flatten),
readFile,
);
return pMap(paths.reverse(), (path) =>
glob(path, {
silent: true,
}).catch(ignoreAccessErrors),
).then(flatten);
},
},
];

@@ -16,2 +16,3 @@ "use strict";

const pMap = require("./_pMap");
const readFile = require("./_readFile");
const UnknownFormatError = require("./unknown-format-error");

@@ -60,11 +61,9 @@ const unserialize = require("./serializers").unserialize;

const dir = typeof dirFn === "function" ? dirFn(entryOpts) : dirFn;
return entry.read(entryOpts, dir) || [];
return entry.list(entryOpts, dir) || [];
})
.then((files) => {
files = flatten(files);
return pMap(files, (file) => {
return pMap(files, async (file) => {
try {
const data = unserialize(file);
debug(file.path);
return resolvePaths(data, dirname(file.path));
return await parse(file);
} catch (error) {

@@ -93,2 +92,12 @@ if (!(ignoreUnknownFormats && error instanceof UnknownFormatError)) {

async function parse(path) {
const file = await readFile(path);
const data = unserialize(file);
debug(file.path);
return resolvePaths(data, dirname(file.path));
}
exports.parse = parse;
// ===================================================================
exports.watch = function watch({ appName, initialLoad = false, ...opts }, cb) {

@@ -95,0 +104,0 @@ return new Promise((resolve, reject) => {

{
"name": "app-conf",
"version": "3.0.0",
"version": "3.1.0",
"license": "ISC",

@@ -17,2 +17,3 @@ "author": "Julien Fontanet <julien.fontanet@isonoe.net> (http://julien.isonoe.net/)",

"_merge.js",
"_readFile.js",
"cli.js",

@@ -19,0 +20,0 @@ "entries.js",

@@ -102,2 +102,12 @@ # app-conf

### `parse(path)`
> Low level function which parses a file using app-conf logic, automatically handling formats and resolving paths.
```js
const parseConfig = require("app-conf").parse;
const config = await parseConfig("config.toml");
```
### CLI

@@ -104,0 +114,0 @@

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