function discoverControllers
Since 0.1.0
discoverControllers(
runtime: IRuntimeServices,
store?: MetadataStore,
importer?: ModuleImporter
): Promise<DiscoveryResult>

Discovers decorated classes by scanning a directory and importing files.

Before each import, the current controller/service keys are snapshotted; after the import, any newly-appeared keys are attributed to that file. This captures decorator side effects regardless of how the module exports its classes.

Parameters

Discovery configuration

runtime: IRuntimeServices

Runtime services for file I/O

optional
store: MetadataStore = metadataStore

Metadata store to diff against (defaults to the singleton)

optional
importer: ModuleImporter

Module loader (defaults to the global dynamic import)

Return Type

Discovered controllers, services, and any import errors

Usage

import { discoverControllers } from "decorator-plugin/src/index.ts";