Socket
Socket
Sign inDemoInstall

cosmiconfig

Package Overview
Dependencies
16
Maintainers
3
Versions
56
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 8.3.3 to 8.3.4

18

dist/Explorer.js

@@ -7,4 +7,4 @@ "use strict";

exports.Explorer = void 0;
const promises_1 = __importDefault(require("node:fs/promises"));
const node_path_1 = __importDefault(require("node:path"));
const promises_1 = __importDefault(require("fs/promises"));
const path_1 = __importDefault(require("path"));
const path_type_1 = require("path-type");

@@ -19,3 +19,3 @@ const ExplorerBase_js_1 = require("./ExplorerBase.js");

async load(filepath) {
filepath = node_path_1.default.resolve(filepath);
filepath = path_1.default.resolve(filepath);
const load = async () => {

@@ -38,4 +38,4 @@ return await this.config.transform(await this.#readConfiguration(filepath));

}
const stopDir = node_path_1.default.resolve(this.config.stopDir);
from = node_path_1.default.resolve(from);
const stopDir = path_1.default.resolve(this.config.stopDir);
from = path_1.default.resolve(from);
const search = async () => {

@@ -45,3 +45,3 @@ /* istanbul ignore if -- @preserve */

for (const place of this.config.searchPlaces) {
const filepath = node_path_1.default.join(from, place);
const filepath = path_1.default.join(from, place);
try {

@@ -62,3 +62,3 @@ const result = await this.#readConfiguration(filepath);

}
const dir = node_path_1.default.dirname(from);
const dir = path_1.default.dirname(from);
if (from !== stopDir && from !== dir) {

@@ -86,6 +86,6 @@ from = dir;

}
if (node_path_1.default.basename(filepath) === 'package.json') {
if (path_1.default.basename(filepath) === 'package.json') {
return ((0, util_js_1.getPropertyByPath)((0, loaders_js_1.loadJson)(filepath, contents), this.config.packageProp) ?? null);
}
const extension = node_path_1.default.extname(filepath);
const extension = path_1.default.extname(filepath);
try {

@@ -92,0 +92,0 @@ const loader = this.config.loaders[extension || 'noExt'] ??

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

exports.getExtensionDescription = exports.ExplorerBase = void 0;
const node_path_1 = __importDefault(require("node:path"));
const path_1 = __importDefault(require("path"));
const util_js_1 = require("./util.js");

@@ -32,3 +32,3 @@ /**

for (const place of config.searchPlaces) {
const extension = node_path_1.default.extname(place);
const extension = path_1.default.extname(place);
const loader = this.config.loaders[extension || 'noExt'] ??

@@ -35,0 +35,0 @@ this.config.loaders['default'];

@@ -7,4 +7,4 @@ "use strict";

exports.ExplorerSync = void 0;
const node_fs_1 = __importDefault(require("node:fs"));
const node_path_1 = __importDefault(require("node:path"));
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
const path_type_1 = require("path-type");

@@ -19,3 +19,3 @@ const ExplorerBase_js_1 = require("./ExplorerBase.js");

load(filepath) {
filepath = node_path_1.default.resolve(filepath);
filepath = path_1.default.resolve(filepath);
const load = () => {

@@ -38,4 +38,4 @@ return this.config.transform(this.#readConfiguration(filepath));

}
const stopDir = node_path_1.default.resolve(this.config.stopDir);
from = node_path_1.default.resolve(from);
const stopDir = path_1.default.resolve(this.config.stopDir);
from = path_1.default.resolve(from);
const search = () => {

@@ -45,3 +45,3 @@ /* istanbul ignore if -- @preserve */

for (const place of this.config.searchPlaces) {
const filepath = node_path_1.default.join(from, place);
const filepath = path_1.default.join(from, place);
try {

@@ -62,3 +62,3 @@ const result = this.#readConfiguration(filepath);

}
const dir = node_path_1.default.dirname(from);
const dir = path_1.default.dirname(from);
if (from !== stopDir && from !== dir) {

@@ -79,3 +79,3 @@ from = dir;

#readConfiguration(filepath) {
const contents = node_fs_1.default.readFileSync(filepath, 'utf8');
const contents = fs_1.default.readFileSync(filepath, 'utf8');
return this.toCosmiconfigResult(filepath, this.#loadConfiguration(filepath, contents));

@@ -87,6 +87,6 @@ }

}
if (node_path_1.default.basename(filepath) === 'package.json') {
if (path_1.default.basename(filepath) === 'package.json') {
return ((0, util_js_1.getPropertyByPath)((0, loaders_js_1.loadJson)(filepath, contents), this.config.packageProp) ?? null);
}
const extension = node_path_1.default.extname(filepath);
const extension = path_1.default.extname(filepath);
try {

@@ -93,0 +93,0 @@ const loader = this.config.loaders[extension || 'noExt'] ??

@@ -23,3 +23,3 @@ "use strict";

__exportStar(require("./types.js"), exports);
const node_os_1 = __importDefault(require("node:os"));
const os_1 = __importDefault(require("os"));
const Explorer_js_1 = require("./Explorer.js");

@@ -116,3 +116,3 @@ const ExplorerSync_js_1 = require("./ExplorerSync.js");

ignoreEmptySearchPlaces: true,
stopDir: node_os_1.default.homedir(),
stopDir: os_1.default.homedir(),
cache: true,

@@ -156,3 +156,3 @@ transform: identity,

ignoreEmptySearchPlaces: true,
stopDir: node_os_1.default.homedir(),
stopDir: os_1.default.homedir(),
cache: true,

@@ -159,0 +159,0 @@ transform: identity,

@@ -8,6 +8,6 @@ "use strict";

exports.loadTs = exports.loadTsSync = exports.loadYaml = exports.loadJson = exports.loadJs = exports.loadJsSync = void 0;
const node_fs_1 = require("node:fs");
const promises_1 = require("node:fs/promises");
const node_path_1 = __importDefault(require("node:path"));
const node_url_1 = require("node:url");
const fs_1 = require("fs");
const promises_1 = require("fs/promises");
const path_1 = __importDefault(require("path"));
const url_1 = require("url");
let importFresh;

@@ -23,3 +23,3 @@ const loadJsSync = function loadJsSync(filepath) {

try {
const { href } = (0, node_url_1.pathToFileURL)(filepath);
const { href } = (0, url_1.pathToFileURL)(filepath);
return (await import(href)).default;

@@ -68,3 +68,3 @@ }

try {
const config = resolveTsConfig(node_path_1.default.dirname(filepath)) ?? {};
const config = resolveTsConfig(path_1.default.dirname(filepath)) ?? {};
config.compilerOptions = {

@@ -78,3 +78,3 @@ ...config.compilerOptions,

content = typescript.transpileModule(content, config).outputText;
(0, node_fs_1.writeFileSync)(compiledFilepath, content);
(0, fs_1.writeFileSync)(compiledFilepath, content);
return (0, exports.loadJsSync)(compiledFilepath, content).default;

@@ -87,4 +87,4 @@ }

finally {
if ((0, node_fs_1.existsSync)(compiledFilepath)) {
(0, node_fs_1.rmSync)(compiledFilepath);
if ((0, fs_1.existsSync)(compiledFilepath)) {
(0, fs_1.rmSync)(compiledFilepath);
}

@@ -100,3 +100,3 @@ }

try {
const config = resolveTsConfig(node_path_1.default.dirname(filepath)) ?? {};
const config = resolveTsConfig(path_1.default.dirname(filepath)) ?? {};
config.compilerOptions = {

@@ -111,3 +111,3 @@ ...config.compilerOptions,

await (0, promises_1.writeFile)(compiledFilepath, content);
const { href } = (0, node_url_1.pathToFileURL)(compiledFilepath);
const { href } = (0, url_1.pathToFileURL)(compiledFilepath);
return (await import(href)).default;

@@ -120,3 +120,3 @@ }

finally {
if ((0, node_fs_1.existsSync)(compiledFilepath)) {
if ((0, fs_1.existsSync)(compiledFilepath)) {
await (0, promises_1.rm)(compiledFilepath);

@@ -123,0 +123,0 @@ }

{
"name": "cosmiconfig",
"version": "8.3.3",
"version": "8.3.4",
"description": "Find and load configuration from a package.json property, rc file, TypeScript module, and more!",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc