# core/loaders/search.loader.ts

> 24 lines of code and 2 definitions.

Tree: Bane's Lab Build Scripts
Language: typescript
Layer: infrastructure
Canonical: https://banes-lab.com/anatomy/build-scripts#file-build-scripts-core-loaders-search-loader-ts
Source text: https://banes-lab.com/source/build-scripts/core/loaders/search.loader.ts.txt

Listed in [core/loaders](https://banes-lab.com/api/source/build-scripts/core/loaders.md), after [core/loaders/reference.loader.ts](https://banes-lab.com/source/build-scripts/core/loaders/reference.loader.ts.md) and before [core/loaders/site.loader.ts](https://banes-lab.com/source/build-scripts/core/loaders/site.loader.ts.md).

## Definitions

- `searchAssetOf` (lexical_declaration, line 7, exported)
- `[pages, positions, evidence, definitions]` (lexical_declaration, line 11, exported)

## Contained in

- [core/loaders](https://banes-lab.com/anatomy/build-scripts/folder-build-scripts-core-loaders.md)

## Source

```typescript
import type { PositionSources, SearchAsset, SearchPage, SearchPositions } from "@banes-lab/web/types/search.types.js";
import type { DefinitionLocation } from "@banes-lab/web/types/anatomy.types.js";
import type { Evidence } from "@banes-lab/web/types/evidence.types.js";
import type { ModuleImporter } from "#types/loader.types";
import { RUNNER_MODULES } from "#configuration/constants/loader.constants";

export const searchAssetOf = async function searchAssetOf(
    runner: ModuleImporter,
    route: readonly string[],
): Promise<SearchAsset> {
    const [pages, positions, evidence, definitions] = await Promise.all([
        runner.import<{ readonly searchPages: () => Promise<readonly SearchPage[]> }>(RUNNER_MODULES.corpus.path),
        runner.import<{ readonly positionsOf: (input: PositionSources) => SearchPositions }>(
            RUNNER_MODULES.search.path,
        ),
        runner.import<{ readonly EVIDENCE: readonly Evidence[] }>(RUNNER_MODULES.evidenceConstants.path),
        runner.import<{ readonly listDefinitions: () => readonly DefinitionLocation[] }>(
            RUNNER_MODULES.definitions.path,
        ),
    ]);
    return {
        definitions: definitions.listDefinitions(),
        positions: positions.positionsOf({ evidence: evidence.EVIDENCE, pages: await pages.searchPages(), route }),
    };
};
```
