Socket
Socket
Sign inDemoInstall

@ganache/options

Package Overview
Dependencies
Maintainers
4
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ganache/options - npm Package Compare versions

Comparing version 0.9.0 to 0.9.1

1

lib/index.js

@@ -21,3 +21,2 @@ "use strict";

__exportStar(require("./src/create"), exports);
__exportStar(require("./src/constants"), exports);
//# sourceMappingURL=index.js.map
"use strict";
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _OptionsConfig_defaults;
Object.defineProperty(exports, "__esModule", { value: true });

@@ -30,3 +18,2 @@ exports.OptionsConfig = void 0;

const config = (target[namespace] = target[namespace] || {});
const flavor = options.flavor;
const suppliedOptions = new Set();

@@ -58,3 +45,3 @@ const entries = Object.entries(def);

else if ((0, utils_1.hasOwn)(propDefinition, "default")) {
config[key] = propDefinition.default(config, flavor);
config[key] = propDefinition.default(config);
}

@@ -77,3 +64,3 @@ }

else if ((0, utils_1.hasOwn)(propDefinition, "default")) {
config[key] = propDefinition.default(config, flavor);
config[key] = propDefinition.default(config);
}

@@ -85,8 +72,7 @@ }

constructor(defaults) {
_OptionsConfig_defaults.set(this, void 0);
__classPrivateFieldSet(this, _OptionsConfig_defaults, defaults, "f");
this.defaults = defaults;
}
normalize(options) {
const out = {};
Object.entries(__classPrivateFieldGet(this, _OptionsConfig_defaults, "f")).forEach(([namespace, definition]) => {
Object.entries(this.defaults).forEach(([namespace, definition]) => {
fill(options, out, definition, namespace);

@@ -98,3 +84,2 @@ });

exports.OptionsConfig = OptionsConfig;
_OptionsConfig_defaults = new WeakMap();
//# sourceMappingURL=create.js.map

12

package.json

@@ -6,6 +6,6 @@ {

},
"version": "0.9.0",
"version": "0.9.1",
"description": "Ganache's server/provider options TypeScript types",
"author": "David Murdoch <david@trufflesuite.com> (https://davidmurdoch.com)",
"homepage": "https://github.com/trufflesuite/ganache/tree/develop/src/packages/options#readme",
"homepage": "https://github.com/trufflesuite/ganache/tree/develop/packages/options#readme",
"license": "MIT",

@@ -25,3 +25,3 @@ "main": "lib/index.js",

"url": "https://github.com/trufflesuite/ganache.git",
"directory": "src/packages/options"
"directory": "packages/options"
},

@@ -50,3 +50,3 @@ "scripts": {

"dependencies": {
"@ganache/utils": "0.9.0",
"@ganache/utils": "0.9.1",
"bip39": "3.0.4",

@@ -60,5 +60,5 @@ "seedrandom": "3.0.5"

"ts-node": "10.9.1",
"typescript": "4.7.4"
"typescript": "5.1.6"
},
"gitHead": "cb66fef410b40d628acfd97f32e6b300e6f9f562"
"gitHead": "d4618893aaa38a41e2c4d51a603f7048b8635be1"
}

@@ -6,3 +6,2 @@ export * from "./src/base";

export * from "./src/create";
export * from "./src/constants";
//# sourceMappingURL=index.d.ts.map
import { NoUnion } from "./types";
declare type PrimitiveCliTypes = string | number | boolean;
export declare type CliTypes = PrimitiveCliTypes | PrimitiveCliTypes[] | string[] | number[] | boolean[];
export declare type CliTypeMap<T> = T extends string ? "string" : T extends number ? "number" : T extends boolean ? "boolean" : T extends NoUnion<infer I>[] ? I extends PrimitiveCliTypes ? `array:${CliTypeMap<I>}` : never : T extends any[] ? "array" : never;
export declare type YargsPrimitiveCliTypeStrings = CliTypeMap<PrimitiveCliTypes> | "array";
type PrimitiveCliTypes = string | number | boolean;
export type CliTypes = PrimitiveCliTypes | PrimitiveCliTypes[] | string[] | number[] | boolean[];
export type CliTypeMap<T> = T extends string ? "string" : T extends number ? "number" : T extends boolean ? "boolean" : T extends NoUnion<infer I>[] ? I extends PrimitiveCliTypes ? `array:${CliTypeMap<I>}` : never : T extends any[] ? "array" : never;
export type YargsPrimitiveCliTypeStrings = CliTypeMap<PrimitiveCliTypes> | "array";
export declare namespace Base {

@@ -7,0 +7,0 @@ type Option = {

import { Definitions, ExternalConfig, InternalConfig } from "./definition";
import { Base } from "./base";
export declare type NamespacedOptions = {
export type NamespacedOptions = {
[key: string]: Base.Config;
};
export declare type ProviderOptions<O extends NamespacedOptions> = Partial<{
export type ProviderOptions<O extends NamespacedOptions> = Partial<{
[K in keyof O]: ExternalConfig<O[K]>;
}>;
export declare type InternalOptions<O extends NamespacedOptions> = {
export type InternalOptions<O extends NamespacedOptions> = {
[K in keyof O]: InternalConfig<O[K]>;
};
export declare type Defaults<O extends NamespacedOptions> = {
export type Defaults<O extends NamespacedOptions> = {
[K in keyof O]: Definitions<O[K]>;
};
export declare class OptionsConfig<O extends NamespacedOptions> {
#private;
readonly defaults: Defaults<O>;
constructor(defaults: Defaults<O>);

@@ -18,0 +18,0 @@ normalize(options: ProviderOptions<O>): InternalOptions<O>;

@@ -5,28 +5,29 @@ import { Base, CliTypeMap, CliTypes } from "./base";

import { UnionToIntersection } from "./types";
declare type Normalize<C extends Base.Config, N extends OptionName<C> = OptionName<C>> = (rawInput: OptionRawType<C, N>, config: Readonly<InternalConfig<C>>) => OptionType<C, N>;
export declare type ExternalConfig<C extends Base.Config> = Partial<ExclusiveGroupUnionAndUnconstrainedPlus<C, "rawType">>;
export declare type InternalConfig<C extends Base.Config> = ExclusiveGroupUnionAndUnconstrainedPlus<C, "type">;
export declare type Definitions<C extends Base.Config> = {
[N in OptionName<C>]: {
readonly normalize: Normalize<C, N>;
readonly cliDescription: string;
readonly disableInCLI?: boolean;
readonly cliAliases?: string[];
readonly cliChoices?: string[] | number[];
readonly implies?: ReadonlyArray<Exclude<OptionName<C>, N>>;
} & (C[ExclusiveGroupsByName<C, N>] extends never ? {} : {
readonly conflicts: ExclusiveGroupsByName<C, N>[];
}) & (void extends OptionHasCliType<C, N> ? {
readonly cliType?: CliTypeMap<CliTypes> | null;
} : {
readonly cliType?: CliTypeMap<OptionCliType<C, N>> | null;
readonly cliCoerce?: (cliType: OptionCliType<C, N>) => OptionRawType<C, N>;
}) & (void extends OptionHasDefault<C, N> ? {} : {
readonly default: (config: InternalConfig<C>, flavor: string) => OptionType<C, N>;
readonly defaultDescription?: string;
}) & (void extends OptionHasLegacy<C, N> ? {} : {
readonly legacyName: UnionToIntersection<keyof Legacy<C, N>>;
});
type Normalize<C extends Base.Config, N extends OptionName<C> = OptionName<C>> = (rawInput: OptionRawType<C, N>, config: Readonly<InternalConfig<C>>) => OptionType<C, N>;
export type ExternalConfig<C extends Base.Config> = Partial<ExclusiveGroupUnionAndUnconstrainedPlus<C, "rawType">>;
export type InternalConfig<C extends Base.Config> = ExclusiveGroupUnionAndUnconstrainedPlus<C, "type">;
export type Definition<C extends Base.Config, N extends OptionName<C>> = {
readonly normalize: Normalize<C, N>;
readonly cliDescription: string;
readonly disableInCLI?: boolean;
readonly cliAliases?: string[];
readonly cliChoices?: string[] | number[];
readonly implies?: ReadonlyArray<Exclude<OptionName<C>, N>>;
} & (C[ExclusiveGroupsByName<C, N>] extends never ? {} : {
readonly conflicts: ExclusiveGroupsByName<C, N>[];
}) & (void extends OptionHasCliType<C, N> ? {
readonly cliType?: CliTypeMap<CliTypes> | null;
} : {
readonly cliType?: CliTypeMap<OptionCliType<C, N>> | null;
readonly cliCoerce?: (cliType: OptionCliType<C, N>) => OptionRawType<C, N>;
}) & (void extends OptionHasDefault<C, N> ? {} : {
readonly default: (config: InternalConfig<C>) => OptionType<C, N>;
readonly defaultDescription?: string;
}) & (void extends OptionHasLegacy<C, N> ? {} : {
readonly legacyName: UnionToIntersection<keyof Legacy<C, N>>;
});
export type Definitions<C extends Base.Config> = {
[N in OptionName<C>]: Definition<C, N>;
};
export {};
//# sourceMappingURL=definition.d.ts.map
import { Base } from "./base";
import { OptionName, Option, ExclusiveGroupIndex, ExclusiveGroups, Options, OptionType, OptionRawType } from "./getters";
declare type UnconstrainedOptions<C extends Base.Config> = Omit<Options<C>, ExclusiveGroupOptionName<C>>;
declare type UnconstrainedOptionName<C extends Base.Config> = string & keyof UnconstrainedOptions<C>;
declare type UnconstrainedOptionsByType<C extends Base.Config, T extends "type" | "rawType"> = {
type UnconstrainedOptions<C extends Base.Config> = Omit<Options<C>, ExclusiveGroupOptionName<C>>;
type UnconstrainedOptionName<C extends Base.Config> = string & keyof UnconstrainedOptions<C>;
type UnconstrainedOptionsByType<C extends Base.Config, T extends "type" | "rawType"> = {
[N in UnconstrainedOptionName<C>]: T extends "type" ? OptionType<C, N> : OptionRawType<C, N>;
};
declare type ExclusiveGroupOptionPairs<C extends Base.Config, G extends unknown[]> = G extends [] ? [] : G extends [infer N, ...infer R] ? [
type ExclusiveGroupOptionPairs<C extends Base.Config, G extends unknown[]> = G extends [] ? [] : G extends [infer N, ...infer R] ? [
[

@@ -15,11 +15,11 @@ N,

] : never;
declare type ExclusiveGroupOptionNameOption<C extends Base.Config, N> = N extends OptionName<C> ? Option<C, N> : never;
declare type PairsToMapping<T extends unknown[]> = T extends [] ? {} : T extends [[infer N, infer O], ...infer R] ? {
type ExclusiveGroupOptionNameOption<C extends Base.Config, N> = N extends OptionName<C> ? Option<C, N> : never;
type PairsToMapping<T extends unknown[]> = T extends [] ? {} : T extends [[infer N, infer O], ...infer R] ? {
[N_ in string & N]: O;
} & PairsToMapping<R> : never;
declare type RequireOnly<T, K extends keyof T> = Pick<T, K> & Partial<Omit<T, K>>;
declare type ExclusiveGroupOptionalUnionByName<C extends Base.Config, GRP extends ExclusiveGroup<C>, M extends OptionName<C>, T extends "rawType" | "type"> = {
type RequireOnly<T, K extends keyof T> = Pick<T, K> & Partial<Omit<T, K>>;
type ExclusiveGroupOptionalUnionByName<C extends Base.Config, GRP extends ExclusiveGroup<C>, M extends OptionName<C>, T extends "rawType" | "type"> = {
[K in keyof RequireOnly<ExclusiveGroupOptionsByGroup<C, GRP>, M>]: K extends M ? T extends "type" ? OptionType<C, M> : OptionRawType<C, M> : never;
};
declare type Combine<C extends Base.Config, O extends unknown, GRP extends ExclusiveGroup<C>, T extends "rawType" | "type"> = {
type Combine<C extends Base.Config, O extends unknown, GRP extends ExclusiveGroup<C>, T extends "rawType" | "type"> = {
[N in keyof GRP]: GRP[N] extends OptionName<C> ? {

@@ -31,5 +31,5 @@ [Key in keyof (ExclusiveGroupOptionalUnionByName<C, GRP, GRP[N], T> & UnconstrainedOptionsByType<C, T> & O)]: Key extends keyof ExclusiveGroupOptionalUnionByName<C, GRP, GRP[N], T> ? ExclusiveGroupOptionalUnionByName<C, GRP, GRP[N], T>[Key] : Key extends keyof UnconstrainedOptionsByType<C, T> ? UnconstrainedOptionsByType<C, T>[Key] : Key extends keyof O ? O[Key] : never;

} ? I : never;
export declare type ExclusiveGroupsByName<C extends Base.Config, N extends OptionName<C>, GRPS extends ExclusiveGroups<C> = ExclusiveGroups<C>> = GRPS extends [infer GRP, ...infer Rest] ? GRP extends unknown[] ? N extends DeepTupleToUnion<GRP> ? Exclude<DeepTupleToUnion<GRP>, N> : Rest extends any[] ? ExclusiveGroupsByName<C, N, Rest> : never : never : never;
declare type IsNeverType<T> = [T] extends [never] ? true : never;
export declare type ExclusiveGroupUnionAndUnconstrainedPlus<C extends Base.Config, T extends "rawType" | "type", GRPS extends ExclusiveGroups<C> = ExclusiveGroups<C>, O extends unknown[] = []> = GRPS extends [infer GRP, ...infer Rest] ? GRP extends ExclusiveGroup<C> ? Rest extends any[] ? O extends [] ? ExclusiveGroupUnionAndUnconstrainedPlus<C, T, Rest, UnionToTuple<Combine<C, {}, GRP, T>>> : ExclusiveGroupUnionAndUnconstrainedPlus<C, T, Rest, UnionToTuple<{
export type ExclusiveGroupsByName<C extends Base.Config, N extends OptionName<C>, GRPS extends ExclusiveGroups<C> = ExclusiveGroups<C>> = GRPS extends [infer GRP, ...infer Rest] ? GRP extends unknown[] ? N extends DeepTupleToUnion<GRP> ? Exclude<DeepTupleToUnion<GRP>, N> : Rest extends any[] ? ExclusiveGroupsByName<C, N, Rest> : never : never : never;
type IsNeverType<T> = [T] extends [never] ? true : never;
export type ExclusiveGroupUnionAndUnconstrainedPlus<C extends Base.Config, T extends "rawType" | "type", GRPS extends ExclusiveGroups<C> = ExclusiveGroups<C>, O extends unknown[] = []> = GRPS extends [infer GRP, ...infer Rest] ? GRP extends ExclusiveGroup<C> ? Rest extends any[] ? O extends [] ? ExclusiveGroupUnionAndUnconstrainedPlus<C, T, Rest, UnionToTuple<Combine<C, {}, GRP, T>>> : ExclusiveGroupUnionAndUnconstrainedPlus<C, T, Rest, UnionToTuple<{
[OK in keyof Omit<O, keyof []>]: Combine<C, O[OK], GRP, T>;

@@ -43,8 +43,8 @@ } extends {

} : I : never;
export declare type UnionToTuple<T> = ((T extends any ? (t: T) => T : never) extends infer U ? (U extends any ? (u: U) => any : never) extends (v: infer V) => any ? V : never : never) extends (_: any) => infer W ? [...UnionToTuple<Exclude<T, W>>, W] : [];
declare type ExclusiveGroup<C extends Base.Config, K extends ExclusiveGroupIndex<C> = ExclusiveGroupIndex<C>> = ExclusiveGroups<C>[K];
declare type ExclusiveGroupOptionName<C extends Base.Config, K extends ExclusiveGroupIndex<C> = ExclusiveGroupIndex<C>> = Extract<OptionName<C>, DeepTupleToUnion<ExclusiveGroup<C, K>>>;
declare type DeepTupleToUnion<T extends unknown[]> = T extends [] ? never : T extends [infer N, ...infer R] ? N extends unknown[] ? DeepTupleToUnion<N> | DeepTupleToUnion<R> : N | DeepTupleToUnion<R> : never;
declare type ExclusiveGroupOptionsByGroup<C extends Base.Config, G extends ExclusiveGroup<C>> = PairsToMapping<ExclusiveGroupOptionPairs<C, G>>;
export type UnionToTuple<T> = ((T extends any ? (t: T) => T : never) extends infer U ? (U extends any ? (u: U) => any : never) extends (v: infer V) => any ? V : never : never) extends (_: any) => infer W ? [...UnionToTuple<Exclude<T, W>>, W] : [];
type ExclusiveGroup<C extends Base.Config, K extends ExclusiveGroupIndex<C> = ExclusiveGroupIndex<C>> = ExclusiveGroups<C>[K];
type ExclusiveGroupOptionName<C extends Base.Config, K extends ExclusiveGroupIndex<C> = ExclusiveGroupIndex<C>> = Extract<OptionName<C>, DeepTupleToUnion<ExclusiveGroup<C, K>>>;
type DeepTupleToUnion<T extends unknown[]> = T extends [] ? never : T extends [infer N, ...infer R] ? N extends unknown[] ? DeepTupleToUnion<N> | DeepTupleToUnion<R> : N | DeepTupleToUnion<R> : never;
type ExclusiveGroupOptionsByGroup<C extends Base.Config, G extends ExclusiveGroup<C>> = PairsToMapping<ExclusiveGroupOptionPairs<C, G>>;
export {};
//# sourceMappingURL=exclusive.d.ts.map
import { Base } from "./base";
export declare type Options<C extends Base.Config> = C["options"];
export declare type ExclusiveGroups<C extends Base.Config> = C["exclusiveGroups"];
export declare type OptionName<C extends Base.Config> = keyof Options<C> & string;
export declare type ExclusiveGroupIndex<C extends Base.Config> = number & keyof ExclusiveGroups<C>;
export declare type Option<C extends Base.Config, N extends OptionName<C> = OptionName<C>> = Options<C>[N];
export declare type OptionRawType<C extends Base.Config, N extends OptionName<C> = OptionName<C>> = void extends Option<C, N>["rawType"] ? Option<C, N>["type"] : Option<C, N>["rawType"];
export declare type OptionCliType<C extends Base.Config, N extends OptionName<C> = OptionName<C>> = void extends Option<C, N>["cliType"] ? Option<C, N>["type"] : Option<C, N>["cliType"];
export declare type OptionType<C extends Base.Config, N extends OptionName<C> = OptionName<C>> = Option<C, N>["type"];
export declare type OptionHasDefault<C extends Base.Config, N extends OptionName<C> = OptionName<C>> = Option<C, N>["hasDefault"];
export declare type OptionHasCliType<C extends Base.Config, N extends OptionName<C> = OptionName<C>> = Option<C, N>["cliType"];
export declare type OptionHasLegacy<C extends Base.Config, N extends OptionName<C> = OptionName<C>> = Option<C, N>["legacy"];
export declare type LegacyOptions<C extends Base.Config> = {
export type Options<C extends Base.Config> = C["options"];
export type ExclusiveGroups<C extends Base.Config> = C["exclusiveGroups"];
export type OptionName<C extends Base.Config> = keyof Options<C> & string;
export type ExclusiveGroupIndex<C extends Base.Config> = number & keyof ExclusiveGroups<C>;
export type Option<C extends Base.Config, N extends OptionName<C> = OptionName<C>> = Options<C>[N];
export type OptionRawType<C extends Base.Config, N extends OptionName<C> = OptionName<C>> = void extends Option<C, N>["rawType"] ? Option<C, N>["type"] : Option<C, N>["rawType"];
export type OptionCliType<C extends Base.Config, N extends OptionName<C> = OptionName<C>> = void extends Option<C, N>["cliType"] ? Option<C, N>["type"] : Option<C, N>["cliType"];
export type OptionType<C extends Base.Config, N extends OptionName<C> = OptionName<C>> = Option<C, N>["type"];
export type OptionHasDefault<C extends Base.Config, N extends OptionName<C> = OptionName<C>> = Option<C, N>["hasDefault"];
export type OptionHasCliType<C extends Base.Config, N extends OptionName<C> = OptionName<C>> = Option<C, N>["cliType"];
export type OptionHasLegacy<C extends Base.Config, N extends OptionName<C> = OptionName<C>> = Option<C, N>["legacy"];
export type LegacyOptions<C extends Base.Config> = {
[K in OptionName<C>]: Option<C, K> extends {

@@ -18,3 +18,3 @@ legacy: any;

}[OptionName<C>];
export declare type Legacy<C extends Base.Config, N extends OptionName<C>> = Option<C, N>["legacy"];
export type Legacy<C extends Base.Config, N extends OptionName<C>> = Option<C, N>["legacy"];
//# sourceMappingURL=getters.d.ts.map

@@ -1,3 +0,3 @@

export declare type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
export declare type NoUnion<Key> = [Key] extends [boolean] ? boolean : [Key] extends [UnionToIntersection<Key>] ? Key : never;
export type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
export type NoUnion<Key> = [Key] extends [boolean] ? boolean : [Key] extends [UnionToIntersection<Key>] ? Key : never;
//# sourceMappingURL=types.d.ts.map

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

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

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