Socket
Socket
Sign inDemoInstall

cosmiconfig

Package Overview
Dependencies
24
Maintainers
2
Versions
56
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install
Previous12456Next

7.0.0

Diff

Changelog

Source

7.0.0

  • Breaking change: Add ${moduleName}rc.cjs and ${moduleName}.config.cjs to the default searchPlaces, to support users of "type": "module" in recent versions of Node.
  • Breaking change: Drop support for Node 8. Now requires Node 10+.
davidtheclark
published 6.0.0 •

Changelog

Source

6.0.0

  • Breaking change: The package now has named exports. See examples below.

  • Breaking change: Separate async and sync APIs, accessible from different named exports. If you used explorer.searchSync() or explorer.loadSync(), you'll now create a sync explorer with cosmiconfigSync(), then use explorerSync.search() and explorerSync.load().

    // OLD: cosmiconfig v5
    import cosmiconfig from 'cosmiconfig';
    
    const explorer = cosmiconfig('example');
    const searchAsyncResult = await explorer.search();
    const loadAsyncResult = await explorer.load('./file/to/load');
    const searchSyncResult = explorer.searchSync();
    const loadSyncResult = explorer.loadSync('./file/to/load');
    
    // NEW: cosmiconfig v6
    import { cosmiconfig, cosmiconfigSync } from 'cosmiconfig';
    
    const explorer = cosmiconfig('example');
    const searchAsyncResult = await explorer.search();
    const loadAsyncResult = await explorer.load('./file/to/load');
    
    const explorerSync = cosmiconfigSync('example');
    const searchSyncResult = explorerSync.search();
    const loadSyncResult = explorerSync.load('./file/to/load');
    
  • Breaking change: Remove support for Node 4 and 6. Requires Node 8+.

  • Breaking change: Use npm package yaml to parse YAML instead of npm package js-yaml.

  • Breaking change: Remove cosmiconfig.loaders and add named export defaultLoaders that exports the default loaders used for each extension.

    import { defaultLoaders } from 'cosmiconfig';
    
    console.log(Object.entries(defaultLoaders));
    // [
    //   [ '.js', [Function: loadJs] ],
    //   [ '.json', [Function: loadJson] ],
    //   [ '.yaml', [Function: loadYaml] ],
    //   [ '.yml', [Function: loadYaml] ],
    //   [ 'noExt', [Function: loadYaml] ]
    // ]
    
  • Migrate from Flowtype to Typescript.

  • Lazy load all default loaders.

davidtheclark
published 5.2.1 •

Changelog

Source

5.2.1

  • Chore: Upgrade js-yaml to avoid npm audit warning.
davidtheclark
published 5.2.0 •

Changelog

Source

5.2.0

  • Added: packageProp values can be arrays of strings, to allow for property names that include periods. (This was possible before, but not documented or deliberately supported.)
  • Chore: Replaced the lodash.get dependency with a locally defined function.
  • Chore: Upgrade js-yaml to avoid npm audit warning.
davidtheclark
published 5.1.0 •

Changelog

Source

5.1.0

  • Added: packageProp values can include periods to describe paths to nested objects within package.json.
davidtheclark
published 5.0.7 •

Changelog

Source

5.0.7

  • Fixed: JS loader bypasses Node's require cache, fixing a bug where updates to .js config files would not load even when Cosmiconfig was told not to cache.
davidtheclark
published 5.0.6 •

Changelog

Source

5.0.6

  • Fixed: Better error message if the end user tries an extension Cosmiconfig is not configured to understand.
davidtheclark
published 5.0.5 •

Changelog

Source

5.0.5

  • Fixed: load and loadSync work with paths relative to process.cwd().
davidtheclark
published 5.0.4 •

Changelog

Source

5.0.4

  • Fixed: rc files with .js extensions included in default searchPlaces.
sudo-suhas
published 5.0.3 •

Changelog

Source

5.0.3

  • Docs: Minor corrections to documentation. Released to update package documentation on npm.
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