New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@esconf/core

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@esconf/core

配置文件加载工具

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
11
175%
Maintainers
1
Weekly downloads
 
Created
Source

@esconf/core

配置文件加载工具

API 设计参考自 antfu/unconfig

esconf 在使用时更像 unocss 需要 core + presets 形式组合

npm version npm downloads bundle size install size license

安装

# ✨ Auto-detect
npx nypm install @esconf/core

# npm
npm install @esconf/core

# yarn
yarn add @esconf/core

# pnpm
pnpm install @esconf/core

# bun
bun install @esconf/core

# deno
deno install @esconf/core

简单使用

import { loadConfig } from '@esconf/core'
import { jsParser, tomlParser, tsParser, yamlParser } from '@esconf/preset-mini'

const config = await loadConfig({
    // 数组越靠前配置文件的优先级越高
    layers: [
      {
        // load from vrx.config.{mts,ts}
        files: ['vrx.config'],
        extensions: ['mts', 'ts'],
        parser: tsParser(),
      },
      {
        // load from vrx.config.{js,mjs}
        files: ['vrx.config'],
        extensions: ['js', 'mjs'],
        parser: jsParser(),
      },
      {
        // load from vrx.{yaml,yml}
        files: ['vrx'],
        extensions: ['yaml', 'yml'],
        parser: yamlParser(),
      },
      {
        name: 'toml',
         // load from vrx.toml
        files: ['vrx'],
        extensions: ['toml'],
        parser: tomlParser(),
      },
    ],
    // 配置默认值
    default: { defaultValue: 'value' },
    cwd: process.cwd(),
    // 如果某个 layer 命名了,可以用 layer 的名称在运行时排除
    excludeLayer: ['toml'],
    // 如果 excludeLayer 的 类型时 funcition ,则可以根据 layer 配置的特征自行决定运行时是否排除
    excludeLayer: (layer) => layer.extensions.includes('yaml')
  })

鸣谢

  • antfu/unconfig

贡献者

Published under the MIT license. Made by @Colourlessglow and community 💛

🤖 auto updated with automd

FAQs

Package last updated on 21 May 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts