server/site_results_load.ts

Reads the results files the site renders from disk, at build time. It runs only in the server loads of the prerendered pages, so no results file and no schema reaches the client bundle: a page receives the validated data its load returns.

view source

Declarations
#

8 declarations

load_site_results
#

server/site_results_load.ts view source

(options: LoadSiteResultsOptions): SiteResults import {load_site_results} from '@ryanatkn/syntax-highlighter-bench/server/site_results_load.js';

Reads and validates the results the site renders. The fixture file is read only when fixture is set, so a default build never opens it.

options

returns

SiteResults

throws

  • Error - if a file is missing that must exist, or as `resolve_site_results` does

load_site_results_for_build
#

server/site_results_load.ts view source

(): SiteResults import {load_site_results_for_build} from '@ryanatkn/syntax-highlighter-bench/server/site_results_load.js';

The results for this process: the working directory's files, and its environment's choice.

returns

SiteResults

LoadSiteResultsOptions
#

server/site_results_load.ts view source

LoadSiteResultsOptions import type {LoadSiteResultsOptions} from '@ryanatkn/syntax-highlighter-bench/server/site_results_load.js';

Where the results files are, and whether to render the fixture.

dir

The repository root.

type string

fixture

Whether the fixture run is rendered in place of real results.

type boolean

SITE_DETERMINISTIC_PATH
#

server/site_results_load.ts view source

"results/deterministic.json" import {SITE_DETERMINISTIC_PATH} from '@ryanatkn/syntax-highlighter-bench/server/site_results_load.js';

The committed deterministic results, relative to the repository.

SITE_FIXTURE_ENV
#

server/site_results_load.ts view source

"BENCH_RESULTS_FIXTURE" import {SITE_FIXTURE_ENV} from '@ryanatkn/syntax-highlighter-bench/server/site_results_load.js';

The environment variable that makes a build or a dev server render the fixture run.

site_fixture_is_enabled
#

server/site_results_load.ts view source

(env: Record<string, string | undefined>): boolean import {site_fixture_is_enabled} from '@ryanatkn/syntax-highlighter-bench/server/site_results_load.js';

Whether an environment asks for the fixture run: the variable is exactly 1. Anything else, an unset variable included, is no.

env

type Record<string, string | undefined>

returns

boolean

SITE_FIXTURE_PATH
#

server/site_results_load.ts view source

"src/test/fixtures/results/fixture_run.json" import {SITE_FIXTURE_PATH} from '@ryanatkn/syntax-highlighter-bench/server/site_results_load.js';

The fixture run, whose numbers are invented, relative to the repository.

SITE_LATEST_PATH
#

server/site_results_load.ts view source

"results/latest.json" import {SITE_LATEST_PATH} from '@ryanatkn/syntax-highlighter-bench/server/site_results_load.js';

The latest published timed run, relative to the repository. Absent until one is published.

Depends on
#