Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 31 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
* @import { DomStackOpts as DomStackOpts, Results, SiteData } from './lib/builder.js'
* @import { Stats } from 'node:fs'
* @import { FSWatcher } from 'chokidar'
* @import { AsyncLayoutFunction, LayoutFunction } from './lib/build-pages/page-data.js'
* @import { PageFunction, AsyncPageFunction } from './lib/build-pages/page-builders/page-writer.js'
* @import { AsyncLayoutFunction, LayoutFunction, LayoutFunctionParams } from './lib/build-pages/page-data.js'
* @import { PageFunction, AsyncPageFunction, PageFunctionParams } from './lib/build-pages/page-builders/page-writer.js'
* @import { TemplateFunction } from './lib/build-pages/page-builders/template-builder.js'
* @import { TemplateAsyncIterator } from './lib/build-pages/page-builders/template-builder.js'
* @import { TemplateOutputOverride } from './lib/build-pages/page-builders/template-builder.js'
* @import { GlobalDataFunction, AsyncGlobalDataFunction, WorkerBuildStepResult } from './lib/build-pages/index.js'
* @import { GlobalDataFunction, AsyncGlobalDataFunction, WorkerBuildStepResult, GlobalDataFunctionParams } from './lib/build-pages/index.js'
* @import { BuildOptions, BuildContext } from 'esbuild'
* @import { PageInfo, TemplateInfo } from './lib/identify-pages.js'
*/
Expand Down Expand Up @@ -49,6 +49,8 @@ import { resolveVars } from './lib/build-pages/resolve-vars.js'
import { ensureDest } from './lib/helpers/ensure-dest.js'
import { DomStackAggregateError } from './lib/helpers/domstack-aggregate-error.js'

export { PageData } from './lib/build-pages/page-data.js'

Comment thread
bcomnes marked this conversation as resolved.
/**
* @typedef {BuildOptions} BuildOptions
*/
Expand Down Expand Up @@ -103,6 +105,32 @@ import { DomStackAggregateError } from './lib/helpers/domstack-aggregate-error.j
* @typedef {TemplateOutputOverride} TemplateOutputOverride
*/

/**
* @typedef {PageInfo} PageInfo
*/

/**
* @typedef {TemplateInfo} TemplateInfo
*/

/**
* @template {Record<string, any>} T - The type of variables passed to the layout function
* @template [U=any] U - The return type of the page function
* @template [V=string] V - The return type of the layout function
* @typedef {LayoutFunctionParams<T, U, V>} LayoutFunctionParams
*/

/**
* @typedef {GlobalDataFunctionParams} GlobalDataFunctionParams
*/

/**
* @template {Record<string, any>} T - The type of variables passed to the page function
* @template [U=any] U - The return type of the page function
* @typedef {PageFunctionParams<T, U>} PageFunctionParams
*/
Comment thread
bcomnes marked this conversation as resolved.


const DEFAULT_IGNORES = /** @type {const} */ ([
'.*',
'coverage',
Expand Down
7 changes: 1 addition & 6 deletions lib/build-pages/page-builders/template-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,11 @@ import { writeFile, mkdir } from 'fs/promises'
* } - The results of a template build
*/

/**
* @template {Record<string, any>} T - The type of variables for the template function parameters
* @typedef {Parameters<TemplateFunction<T>>} TemplateFunctionParams
*/

/**
* Callback for rendering a template with an async iterator.
* @template T - The type of variables for the template async iterator
* @callback TemplateAsyncIterator
* @param {TemplateFunctionParams<T>[0]} params - Parameters of the template function.
* @param {Parameters<TemplateFunction<T>>[0]} params - Parameters of the template function.
Comment thread
bcomnes marked this conversation as resolved.
Outdated
* @returns {AsyncIterable<TemplateOutputOverride>}
Comment thread
bcomnes marked this conversation as resolved.
*/

Expand Down
Loading