import { InlineConfig } from 'vite'; import { C as CoreTaujsConfig, T as TaujsViteOverride } from './types-Ce1QlQ5E.js'; declare function resolveEntryFile(clientRoot: string, stem: string, exists?: (absPath: string) => boolean): string; /** * τjs [ taujs ] Orchestration System * (c) 2024-present Aoede Ltd * Author: John Smith * * Licensed under the MIT License - attribution appreciated. * Part of the τjs [ taujs ] system for declarative, build-time orchestration of microfrontend applications, * including CSR, SSR, streaming, and middleware composition. */ /** * RFC 0005 (VS3): the shared Vite merge engine. * * One engine, two invariant profiles (dev/build), one precedence chain: * `framework -> config.vite -> taujsBuild.vite`. The protected-field sets are DECLARED DATA * (`BUILD_PROFILE`/`DEV_PROFILE`), not inline conditionals, so dev (VS4) and build read the same * merge/protection semantics from a single place. Programmatic layers win FIELD conflicts while * unrelated declarative fields survive; conflicts between two USER layers are surfaced per field at * warn level (mere coexistence is silent). Framework defaults being overridden by a user layer is * normal operation and never warns. */ /** * Core invariants for τjs builds. * These fields are non-negotiable to maintain framework integrity. */ type FrameworkInvariant = { root: string; base: string; publicDir: string | false; build: { outDir: string; manifest: boolean; ssr?: any; ssrManifest: boolean; format?: string; target?: string | string[]; rollupOptions: { input: Record; }; }; }; /** * Extract and validate framework invariants from config. * Used during merge to ensure user config doesn't violate critical paths. */ declare function getFrameworkInvariants(config: InlineConfig): FrameworkInvariant; declare const normalisePlugins: (p: any) => any[]; /** * τjs [ taujs ] Orchestration System * (c) 2024-present Aoede Ltd * Author: John Smith * * Licensed under the MIT License - attribution appreciated. * Part of the τjs [ taujs ] system for declarative, build-time orchestration of microfrontend applications, * including CSR, SSR, streaming, and middleware composition. */ type ViteBuildContext = { appId: string; entryPoint: string; isSSRBuild: boolean; clientRoot: string; }; declare function resolveInputs(isSSRBuild: boolean, mainExists: boolean, paths: { server: string; client: string; main: string; }): Record; /** * User-supplied vite config override. * Can be a static config object or a function that receives build context. * * **Allowed customisations:** * - `plugins`: Appended to framework plugin list * - `define`: Shallow-merged with framework defines * - `css.preprocessorOptions`: Deep-merged by preprocessor engine (scss, less, etc.) * - `build.sourcemap`, `minify`, `terserOptions`: Direct overrides * - `build.rollupOptions.external`: Direct override * - `build.rollupOptions.output.manualChunks`: Merged into output config * - `resolve.*` (except `alias`): Merged with framework resolve config * - `esbuild`, `logLevel`: Direct overrides * * `optimizeDeps` and `server.*` are development-only and are stripped from every build config * SILENTLY - `config.vite` is one declaration feeding the dev server and every build, so warning * here would report ordinary configuration as misuse. Declare them on `vite` in `taujs.config.ts` * for the dev server. * * **Protected fields (warned when supplied, never applied):** * - `root`, `base`, `publicDir`, `appType`, `configFile`: Framework-controlled * - `build.outDir`: Framework manages `dist/client` vs `dist/ssr` separation * - `build.emptyOutDir`: Framework-controlled - a filtered build empties the directory itself, * preserving declared descendants, so an override would either double-empty or strand stale output * - `build.ssr`, `ssrManifest`, `format`, `target`, `manifest`: Framework-controlled for SSR integrity * (`ssrManifest` is pinned OFF: browser asset information comes from the client `manifest`) * - `build.rollupOptions.input`: Framework manages entry points * - `resolve.alias`: Use the top-level `alias` in `taujs.config.ts` (or the `taujsBuild()` option) instead * * @example * ```ts * // Static config * vite: { * plugins: [visualizer()], * build: { sourcemap: 'inline' } * } * * // Function-based (conditional per app/mode) * vite: ({ isSSRBuild, entryPoint }) => ({ * plugins: isSSRBuild ? [] : [visualizer()], * logLevel: entryPoint === 'admin' ? 'info' : 'warn' * }) * ``` */ type ViteConfigOverride = Partial | ((ctx: ViteBuildContext) => Partial); /** * Merge a single legacy `taujsBuild({ vite })` override into the framework config through the shared * build engine (VS3). Retained for backward compatibility and unit coverage; the multi-layer chain * (`config.vite` -> `taujsBuild.vite`) is composed in `taujsBuild` via {@link composeViteConfig}. * * Strategy is unchanged: framework invariants win, safe extension points (plugins, define, * css.preprocessorOptions) merge, tuning fields override, and protected fields are rejected with a * warning. `optimizeDeps` is dev-only and never reaches the returned build config. * * Returns a config safe to pass directly to vite.build(). */ declare function mergeViteConfig(framework: InlineConfig, userOverride?: ViteConfigOverride, context?: ViteBuildContext): InlineConfig; type AppFilter = { selectedIds: Set | null; raw: string | undefined; }; declare function resolveAppFilter(argv: readonly string[], env: NodeJS.ProcessEnv): AppFilter; declare function taujsBuild({ config, projectRoot, clientBaseDir, isSSRBuild, alias: userAlias, vite: userViteConfig, }: { config: CoreTaujsConfig & { vite?: TaujsViteOverride; }; projectRoot: string; clientBaseDir: string; isSSRBuild?: boolean; /** * Top-level alias overrides. Use this instead of `vite.resolve.alias`. * User aliases are merged with framework defaults; user values win on conflicts. * * Framework provides: * - `@client`: Resolves to current app's root * - `@server`: Resolves to `src/server` * - `@shared`: Resolves to `src/shared` * * @example * ```ts * alias: { * '@utils': './src/utils', * '@server': './custom-server', // overrides framework default * } * ``` */ alias?: Record; /** User-supplied Vite config overrides (plugins, tuning, etc.) */ vite?: ViteConfigOverride; }): Promise; export { type FrameworkInvariant, type ViteBuildContext, type ViteConfigOverride, getFrameworkInvariants, mergeViteConfig, normalisePlugins, resolveAppFilter, resolveEntryFile, resolveInputs, taujsBuild };