Socket
Socket
Sign inDemoInstall

@kosko/env

Package Overview
Dependencies
10
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.0-20240324064444 to 0.0.0-20240324074257

dist/index.d.ts.map

194

dist/index.d.ts
/**
* Manages environments in Kosko.
* Path patterns of environment files.
*
* @packageDocumentation
* @remarks
* Following tokens can be used in path patterns.
*
* - `#{environment}` - Environment name.
*
* - `#{component}` - Component name.
*
* @public
*/
export type { Paths } from "./paths";
export type { Reducer } from "./reduce";
export type { Environment, Loader, ReducerList } from "./environment/types";
export { createSyncLoaderReducers, createAsyncLoaderReducers } from "./environment/base";
export type { NodeEnvironmentOptions } from "./environment/node";
export { createAsyncEnvironment } from "./environment/async";
export { createSyncEnvironment } from "./environment/sync";
export { createNodeCJSEnvironment } from "./environment/node-cjs";
export { createNodeESMEnvironment } from "./environment/node-esm";
export { env as default } from "./environment/entry";
interface Paths {
/**
* Path pattern of global environment files.
*
* @defaultValue `environments/#{environment}`
*/
global: string;
/**
* Path pattern of component environment files.
*
* @defaultValue `environments/#{environment}/#{component}`
*/
component: string;
}
/**
* Describes a step in the variables overriding chain.
*
* @public
*/
interface Reducer {
/**
* Name of the reducer.
*/
name: string;
/**
* Overrides variables for the specified component.
* If component name is not specified then overrides only
* global variables.
*/
reduce(target: Record<string, any>, componentName?: string): Record<string, any>;
}
/**
* A collection of {@link Reducer}.
*
* @public
*/
interface ReducerList {
/**
* Returns a list of reducers.
*/
getReducers(): readonly Reducer[];
/**
* Updates reducer list with the return value of `callback`.
*/
setReducers(callback: (reducers: readonly Reducer[]) => Reducer[]): void;
/**
* Resets reducer list to the defaults.
*/
resetReducers(): void;
}
/**
* Contains environment context and can be used to fetch environment variables.
*
* @public
*/
interface Environment extends Pick<ReducerList, "setReducers" | "resetReducers"> {
/**
* Current working directory (CWD).
*
* @defaultValue `process.cwd()` on Node.js, or `/` on browsers.
*/
cwd: string;
/**
* Current environment.
*/
env?: string | string[];
/**
* Path patterns of environment files.
*/
paths: Paths;
/**
* File extensions of environments.
*/
extensions: string[];
/**
* Returns global variables.
*/
global(): any;
/**
* Returns component variables merged with global variables.
*
* @param name - Component name
*/
component(name: string): any;
}
/**
* Loads environment variables.
*
* @public
*/
interface Loader {
/**
* Returns global variables. If the returned value is an array, the
* value will be flattened.
*/
global(): any;
/**
* Returns component variables. If the returned value is an array,
* the value will be flattened.
*
* @param name - Component name
*/
component(name: string): any;
}
/**
* Returns the default reducers which load environment variables synchronously
* using the specified `loader`.
*
* @public
*/
declare function createSyncLoaderReducers(loader: Loader): Reducer[];
/**
* Returns the default reducers which load environment variables asynchronously
* using the specified `loader`.
*
* @public
*/
declare function createAsyncLoaderReducers(loader: Loader): Reducer[];
/**
* Options for creating a Node.js environment.
*
* @public
*/
interface NodeEnvironmentOptions {
/**
* Current working directory (CWD).
*
* @defaultValue `process.cwd()`
*/
cwd?: string;
}
/**
* Returns a new asynchronized {@link Environment}.
*
* @public
*/
declare function createAsyncEnvironment(): Environment;
/**
* Returns a new synchronized {@link Environment}.
*
* @public
*/
declare function createSyncEnvironment(): Environment;
/**
* Returns a new {@link Environment} which loads environment variables using
* Node.js's `require()` function.
*
* @public
*/
declare function createNodeCJSEnvironment(options?: NodeEnvironmentOptions): Environment;
/**
* Returns a new {@link Environment} which loads environment variables using
* ECMAScript module (ESM) `import()` function.
*
* @public
*/
declare function createNodeESMEnvironment(options?: NodeEnvironmentOptions): Environment;
/**
* @public
*/
declare const env: Environment;
export { type Environment, type Loader, type NodeEnvironmentOptions, type Paths, type Reducer, type ReducerList, createAsyncEnvironment, createAsyncLoaderReducers, createNodeCJSEnvironment, createNodeESMEnvironment, createSyncEnvironment, createSyncLoaderReducers, env as default };
//# sourceMappingURL=index.d.ts.map

12

package.json
{
"name": "@kosko/env",
"version": "0.0.0-20240324064444",
"version": "0.0.0-20240324074257",
"description": "Manage environemnts in kosko.",

@@ -49,5 +49,5 @@ "homepage": "https://kosko.dev",

"is-plain-object": "^5.0.0",
"@kosko/common-utils": "^0.0.0-20240324064444",
"@kosko/log": "^0.0.0-20240324064444",
"@kosko/require": "^0.0.0-20240324064444"
"@kosko/common-utils": "^0.0.0-20240324074257",
"@kosko/require": "^0.0.0-20240324074257",
"@kosko/log": "^0.0.0-20240324074257"
},

@@ -63,4 +63,4 @@ "jest": {

"@kosko/build-scripts": "^0.0.0",
"@kosko/jest-preset": "^0.0.0",
"@kosko/test-utils": "^0.0.0"
"@kosko/test-utils": "^0.0.0",
"@kosko/jest-preset": "^0.0.0"
},

@@ -67,0 +67,0 @@ "scripts": {

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