/// /// /// /// import type { IntrinsicCustomElements, PageRoute, } from '@/../build/_brisa/types'; import type { BunPlugin, Server, ServerWebSocket, TLSOptions } from 'bun'; import type * as CSS from 'csstype'; import type * as tls from 'node:tls'; declare module 'bun' { interface Env { /** * Description: * * The `BRISA_BUILD_FOLDER` is the path to the build folder. * * Useful to compile C ABI libraries inside the build folder. * * Docs: * * - [How to use `BRISA_BUILD_FOLDER`](https://brisa.build/building-your-application/configuring/zig-rust-c-files#create-a-jsts-bridge) */ BRISA_BUILD_FOLDER: string; } } export type InternalConstants = { BRISA_DIR: string; IS_BUILD_PROCESS: boolean; IS_SERVE_PROCESS: boolean; WORKSPACE: string; SRC_DIR: string; BUILD_DIR: string; ROOT_DIR: string; IS_PRODUCTION: boolean; IS_DEVELOPMENT: boolean; JS_RUNTIME: 'bun' | 'node' | 'deno'; PAGE_404: string; PAGE_500: string; VERSION: string; RESERVED_PAGES: string[]; PORT: number; ASSETS_DIR: string; PAGES_DIR: string; LOG_PREFIX: { WAIT: string; READY: string; INFO: string; ERROR: string; WARN: string; TICK: string; }; REGEX: Record; HEADERS: { CACHE_CONTROL: string; }; }; // Project constants need to be refresed on hot-reload (DEV) export type ProjectConstants = { CSS_FILES: string[]; CONFIG: Configuration; I18N_CONFIG: I18nConfig; WEB_CONTEXT_PLUGINS: any[]; LOCALES_SET: Set; IS_STATIC_EXPORT: boolean; MODULES: { middleware?: any; i18n?: any; config?: any; integrations?: any; layoutModule?: any; pages: Record; apiEndpoints: Record; websocket?: any; cssFiles: string[]; actions: any; }; }; /** * Internal types used by Brisa and output adapters. */ export type BrisaConstants = InternalConstants & ProjectConstants; /** * Description: * * Request context is a set of utilities to use within your server components with the context of the request. */ export interface RequestContext extends Request { /** * Description: * * The store is a map where you can store any value and use it in any server part: * middleware, layout, page, components, api, etc. * * Example setting a value: * * ```ts * store.set('count', 0); * ``` * * Example getting a value: * * ```ts *
{store.get('count')}
* ``` * * Docs: * * - [How to use `store`](https://brisa.build/building-your-application/components-details/server-components#store-store-method) */ store: Map & { /** * Description: * * The `transferToClient` method is used to transfer the store values to the client. * * Example: * * ```ts * store.transferToClient(['count']); * ``` * * Docs: * * - [How to use `transferToClient`](https://brisa.build/building-your-application/data-management/fetching#share-server-web-data-between-components) */ transferToClient: (keys: string[], options?: TransferOptions) => void; }; /** * Description: * * The `useContext` method is used to consume a context value. * * Example: * * ```tsx * const foo = useContext(context); * *
{foo.value}
* ``` * * Docs: * * - [How to use `useContext`](https://brisa.build/building-your-application/components-details/context) */ useContext: (context: BrisaContext) => { value: T }; /** * * Description: * * The `indicate` method is used to get control of the * "processing state" of the server action. * * It's necessary to link the indicator with the server action * via the `indicate[Event]` attribute. * * When the attribute "indicator" * is used, the "brisa-request" class is added to the element during * the processing state. Useful to show a spinner, disable a button, etc. All * via CSS. * * Example: * * ```tsx * const incrementing = indicate('increment'); * * return ( * * ); * ``` * * Example of CSS: * * ```css * button.brisa-request { * pointer-events: none; * cursor: not-allowed; * background-color: rgba(0,0,0,0.1); * } * .spinner, .btn-text.brisa-request { * display: none; * } * .spinner.brisa-request { * display: inline; * } * ``` * * Docs: * * - [How to use `indicate`](https://brisa.build/api-reference/components/request-context#indicate) */ indicate: (actionName: string) => IndicatorSignal; /** * Description: * * The `useId` method will generate a unique identifier for each invocation. * * A common use case for consistent IDs are forms, where