Skip to main content

Module: @kosko/generate

Table of contents#

Enumerations#

Classes#

Interfaces#

Functions#

generate#

generate(options: GenerateOptions): Promise<Result>

Finds components with glob patterns in the specified path and returns exported values from each components.

Extension names is optional in options.components because it's appended automatically. (e.g. foo => foo?(.{js,json}))

Extensions are from require.extensions. You can require ts-node/register to add support for .ts extension.

Parameters:#

NameType
optionsGenerateOptions

Returns: Promise<Result>

Defined in: packages/generate/src/generate.ts:50


print#

print(result: Result, __namedParameters: PrintOptions): void

Print result to a stream.

Parameters:#

NameType
resultResult
__namedParametersPrintOptions

Returns: void

Defined in: packages/generate/src/print.ts:56


resolve#

resolve(value: unknown, options?: ResolveOptions): Promise<readonly Manifest[]>

Flattens the input value and validate each values. Throws ValidationError when an error occurred during validation.

The value can be a:

  • Object
  • Array
  • Promise
  • Function
  • Async function

Parameters:#

NameType
valueunknown
optionsResolveOptions

Returns: Promise<readonly Manifest[]>

Defined in: packages/generate/src/resolve.ts:51