Socket
Socket
Sign inDemoInstall

c12

Package Overview
Dependencies
Maintainers
1
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

c12 - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

47

dist/index.d.ts

@@ -40,3 +40,2 @@ import { JITI } from 'jiti';

type UserInputConfig = Record<string, any>;
interface ConfigLayerMeta {

@@ -46,32 +45,29 @@ name?: string;

}
interface C12InputConfig {
$test?: UserInputConfig;
$development?: UserInputConfig;
$production?: UserInputConfig;
$env?: Record<string, UserInputConfig>;
$meta?: ConfigLayerMeta;
type UserInputConfig = Record<string, any>;
interface C12InputConfig<T extends UserInputConfig = UserInputConfig, MT extends ConfigLayerMeta = ConfigLayerMeta> {
$test?: T;
$development?: T;
$production?: T;
$env?: Record<string, T>;
$meta?: MT;
}
interface InputConfig extends C12InputConfig, UserInputConfig {
}
interface SourceOptions {
meta?: ConfigLayerMeta;
overrides?: UserInputConfig;
type InputConfig<T extends UserInputConfig = UserInputConfig, MT extends ConfigLayerMeta = ConfigLayerMeta> = C12InputConfig<T, MT> & T;
interface SourceOptions<T extends UserInputConfig = UserInputConfig, MT extends ConfigLayerMeta = ConfigLayerMeta> {
meta?: MT;
overrides?: T;
[key: string]: any;
}
interface ConfigLayer<T extends InputConfig = InputConfig> {
interface ConfigLayer<T extends UserInputConfig = UserInputConfig, MT extends ConfigLayerMeta = ConfigLayerMeta> {
config: T | null;
source?: string;
sourceOptions?: SourceOptions;
meta?: ConfigLayerMeta;
sourceOptions?: SourceOptions<T, MT>;
meta?: MT;
cwd?: string;
configFile?: string;
}
interface ResolvedConfig<T extends InputConfig = InputConfig> extends ConfigLayer<T> {
layers?: ConfigLayer<T>[];
interface ResolvedConfig<T extends UserInputConfig = UserInputConfig, MT extends ConfigLayerMeta = ConfigLayerMeta> extends ConfigLayer<T, MT> {
layers?: ConfigLayer<T, MT>[];
cwd?: string;
}
interface ResolveConfigOptions {
cwd: string;
}
interface LoadConfigOptions<T extends InputConfig = InputConfig> {
interface LoadConfigOptions<T extends UserInputConfig = UserInputConfig, MT extends ConfigLayerMeta = ConfigLayerMeta> {
name?: string;

@@ -88,3 +84,3 @@ cwd?: string;

overrides?: T;
resolve?: (id: string, options: LoadConfigOptions) => null | ResolvedConfig | Promise<ResolvedConfig | null>;
resolve?: (id: string, options: LoadConfigOptions<T, MT>) => null | undefined | ResolvedConfig<T, MT> | Promise<ResolvedConfig<T, MT> | undefined | null>;
jiti?: JITI;

@@ -96,4 +92,7 @@ jitiOptions?: JITIOptions;

}
declare function loadConfig<T extends InputConfig = InputConfig>(options: LoadConfigOptions<T>): Promise<ResolvedConfig<T>>;
type DefineConfig<T extends UserInputConfig = UserInputConfig, MT extends ConfigLayerMeta = ConfigLayerMeta> = (input: InputConfig<T, MT>) => InputConfig<T, MT>;
declare function createDefineConfig<T extends UserInputConfig = UserInputConfig, MT extends ConfigLayerMeta = ConfigLayerMeta>(): DefineConfig<T, MT>;
export { C12InputConfig, ConfigLayer, ConfigLayerMeta, DotenvOptions, Env, InputConfig, LoadConfigOptions, ResolveConfigOptions, ResolvedConfig, SourceOptions, UserInputConfig, loadConfig, loadDotenv, setupDotenv };
declare function loadConfig<T extends UserInputConfig = UserInputConfig, MT extends ConfigLayerMeta = ConfigLayerMeta>(options: LoadConfigOptions<T, MT>): Promise<ResolvedConfig<T, MT>>;
export { C12InputConfig, ConfigLayer, ConfigLayerMeta, DefineConfig, DotenvOptions, Env, InputConfig, LoadConfigOptions, ResolvedConfig, SourceOptions, UserInputConfig, createDefineConfig, loadConfig, loadDotenv, setupDotenv };
{
"name": "c12",
"version": "1.2.0",
"version": "1.3.0",
"description": "Smart Config Loader",

@@ -29,3 +29,4 @@ "repository": "unjs/c12",

"release": "changelogen --release && npm publish && git push --follow-tags",
"test": "vitest run --coverage"
"test": "vitest run --coverage && pnpm test:types",
"test:types": "tsc --noEmit"
},

@@ -36,19 +37,20 @@ "dependencies": {

"giget": "^1.1.2",
"jiti": "^1.17.2",
"jiti": "^1.18.2",
"mlly": "^1.2.0",
"pathe": "^1.1.0",
"pkg-types": "^1.0.2",
"rc9": "^2.0.1"
"rc9": "^2.1.0"
},
"devDependencies": {
"@vitest/coverage-c8": "^0.29.2",
"changelogen": "^0.5.1",
"eslint": "^8.36.0",
"@vitest/coverage-c8": "^0.30.1",
"changelogen": "^0.5.3",
"eslint": "^8.38.0",
"eslint-config-unjs": "^0.1.0",
"prettier": "^2.8.4",
"typescript": "^4.9.5",
"unbuild": "^1.1.2",
"vitest": "^0.29.2"
"expect-type": "^0.15.0",
"prettier": "^2.8.7",
"typescript": "^5.0.4",
"unbuild": "^1.2.1",
"vitest": "^0.30.1"
},
"packageManager": "pnpm@7.29.1"
}
"packageManager": "pnpm@8.2.0"
}

@@ -1,9 +0,9 @@

# c12
# ⚙️ c12
[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![Github Actions][github-actions-src]][github-actions-href]
[![Codecov][codecov-src]][codecov-href]
[![License][license-src]][license-href]
> Smart Configuration Loader
Smart Configuration Loader.

@@ -16,4 +16,5 @@ ## Features

- `.env` support with [dotenv](https://www.npmjs.com/package/dotenv)
- Support reading config from the nearest `package.json` file
- Support extending nested configurations from multiple local or git sources
- Reads config from the nearest `package.json` file
- [Extends configurations](https://github.com/unjs/c12#extending-configuration) from multiple local or git sources
- Overwrite with [environment-specific configuration](#environment-specific-configuration)

@@ -250,9 +251,9 @@ ## Usage

[npm-version-src]: https://img.shields.io/npm/v/c12?style=flat-square
[npm-version-src]: https://img.shields.io/npm/v/c12?style=flat&colorA=18181B&colorB=F0DB4F
[npm-version-href]: https://npmjs.com/package/c12
[npm-downloads-src]: https://img.shields.io/npm/dm/c12?style=flat-square
[npm-downloads-src]: https://img.shields.io/npm/dm/c12?style=flat&colorA=18181B&colorB=F0DB4F
[npm-downloads-href]: https://npmjs.com/package/c12
[github-actions-src]: https://img.shields.io/github/actions/workflow/status/unjs/c12/ci.yml?branch=main&style=flat-square
[github-actions-href]: https://github.com/unjs/c12/actions?query=workflow%3Aci
[codecov-src]: https://img.shields.io/codecov/c/gh/unjs/c12/main?style=flat-square
[codecov-src]: https://img.shields.io/codecov/c/gh/unjs/c12/main?style=flat&colorA=18181B&colorB=F0DB4F
[codecov-href]: https://codecov.io/gh/unjs/c12
[license-src]: https://img.shields.io/github/license/unjs/c12.svg?style=flat&colorA=18181B&colorB=F0DB4F
[license-href]: https://github.com/unjs/c12/blob/main/LICENSE

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc