From a405a9b69be366b4f6de263c393287cfd5a25852 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Wed, 8 Apr 2026 19:34:10 +0200 Subject: [PATCH 1/2] chore: deprecate legacy Builder API (#3635) Adds @deprecated JSDoc tags to all public exports in: - @fresh/core/dev (Builder, BuildOptions, ResolvedBuildConfig, etc.) - @fresh/plugin-tailwind (tailwind function, TailwindPluginOptions) - @fresh/plugin-tailwind-v3 (all exports) Also marks the --builder flag in @fresh/init as deprecated in help text and prints a warning when it's used. Closes #3635 Co-Authored-By: Claude Opus 4.6 (1M context) --- packages/fresh/src/dev/builder.ts | 4 +++ packages/fresh/src/dev/mod.ts | 35 ++++++++++++++++------- packages/init/src/init.ts | 11 ++++++- packages/plugin-tailwindcss-v3/src/mod.ts | 10 +++++++ packages/plugin-tailwindcss/src/mod.ts | 8 +++++- 5 files changed, 56 insertions(+), 12 deletions(-) diff --git a/packages/fresh/src/dev/builder.ts b/packages/fresh/src/dev/builder.ts index 69b3711583c..7a65b5393c7 100644 --- a/packages/fresh/src/dev/builder.ts +++ b/packages/fresh/src/dev/builder.ts @@ -109,6 +109,10 @@ export type ResolvedBuildConfig = Required> & { sourceMap?: FreshBundleOptions["sourceMap"]; }; +/** + * @deprecated Use the Vite plugin (`@fresh/plugin-vite`) instead. + * The Builder class will be removed in a future version of Fresh. + */ // deno-lint-ignore no-explicit-any export class Builder { #transformer: FileTransformer; diff --git a/packages/fresh/src/dev/mod.ts b/packages/fresh/src/dev/mod.ts index 002941bee7b..04e6feaa228 100644 --- a/packages/fresh/src/dev/mod.ts +++ b/packages/fresh/src/dev/mod.ts @@ -1,10 +1,25 @@ -export { - Builder, - type BuildOptions, - type ResolvedBuildConfig, -} from "./builder.ts"; -export { - type OnTransformArgs, - type OnTransformOptions, - type TransformFn, -} from "./file_transformer.ts"; +/** + * @deprecated Use the Vite plugin (`@fresh/plugin-vite`) instead. + * The Builder API will be removed in a future version of Fresh. + */ +export { Builder } from "./builder.ts"; +/** + * @deprecated Use the Vite plugin (`@fresh/plugin-vite`) instead. + */ +export type { BuildOptions } from "./builder.ts"; +/** + * @deprecated Use the Vite plugin (`@fresh/plugin-vite`) instead. + */ +export type { ResolvedBuildConfig } from "./builder.ts"; +/** + * @deprecated Use the Vite plugin (`@fresh/plugin-vite`) instead. + */ +export type { OnTransformArgs } from "./file_transformer.ts"; +/** + * @deprecated Use the Vite plugin (`@fresh/plugin-vite`) instead. + */ +export type { OnTransformOptions } from "./file_transformer.ts"; +/** + * @deprecated Use the Vite plugin (`@fresh/plugin-vite`) instead. + */ +export type { TransformFn } from "./file_transformer.ts"; diff --git a/packages/init/src/init.ts b/packages/init/src/init.ts index 53d97e70a9a..908335357c9 100644 --- a/packages/init/src/init.ts +++ b/packages/init/src/init.ts @@ -61,7 +61,7 @@ ${colors.rgb8("OPTIONS:", 3)} ${colors.rgb8("--tailwind", 2)} Use Tailwind for styling ${colors.rgb8("--vscode", 2)} Setup project for VS Code ${colors.rgb8("--docker", 2)} Setup Project to use Docker - ${colors.rgb8("--builder", 2)} Setup with builder instead of vite + ${colors.rgb8("--builder", 2)} (Deprecated) Setup with builder instead of vite ${colors.rgb8("--help, -h", 2)} Show this help message `; @@ -141,6 +141,15 @@ export async function initProject( const useVite = !flags.builder; + if (flags.builder) { + console.log( + "\n%cWarning:%c The --builder flag is deprecated. The Builder API will be removed in a future version of Fresh. Use Vite instead (the default).", + "color: yellow; font-weight: bold", + "", + ); + console.log(); + } + const useDocker = flags.docker; let useTailwind = flags.tailwind || false; if (flags.tailwind == null) { diff --git a/packages/plugin-tailwindcss-v3/src/mod.ts b/packages/plugin-tailwindcss-v3/src/mod.ts index 7ff05e10094..7b0afd316ba 100644 --- a/packages/plugin-tailwindcss-v3/src/mod.ts +++ b/packages/plugin-tailwindcss-v3/src/mod.ts @@ -5,6 +5,9 @@ import cssnano from "cssnano"; import autoprefixer from "autoprefixer"; import * as path from "@std/path"; +/** + * @deprecated Use the Vite plugin with `@tailwindcss/vite` instead. + */ export interface AutoprefixerOptions { /** environment for `Browserslist` */ env?: string; @@ -46,10 +49,17 @@ export interface AutoprefixerOptions { ignoreUnknownVersions?: boolean; } +/** + * @deprecated Use the Vite plugin with `@tailwindcss/vite` instead. + */ export interface TailwindPluginOptions { autoprefixer?: AutoprefixerOptions; } +/** + * @deprecated Use the Vite plugin with `@tailwindcss/vite` instead. + * This plugin is only compatible with the legacy Builder API. + */ export function tailwind( builder: Builder, options: TailwindPluginOptions = {}, diff --git a/packages/plugin-tailwindcss/src/mod.ts b/packages/plugin-tailwindcss/src/mod.ts index 6db172a80b5..d8c80efe314 100644 --- a/packages/plugin-tailwindcss/src/mod.ts +++ b/packages/plugin-tailwindcss/src/mod.ts @@ -3,9 +3,15 @@ import twPostcss from "@tailwindcss/postcss"; import postcss from "postcss"; import type { TailwindPluginOptions } from "./types.ts"; -// Re-export types for public API +/** + * @deprecated Use the Vite plugin with `@tailwindcss/vite` instead. + */ export type { TailwindPluginOptions } from "./types.ts"; +/** + * @deprecated Use the Vite plugin with `@tailwindcss/vite` instead. + * This plugin is only compatible with the legacy Builder API. + */ export function tailwind( builder: Builder, options: TailwindPluginOptions = {}, From 1c468fda19d9c6f8c3f8eb59182a8a001d07bfe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Wed, 8 Apr 2026 21:31:37 +0200 Subject: [PATCH 2/2] chore: format Co-Authored-By: Claude Opus 4.6 (1M context) --- packages/init/src/init.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/init/src/init.ts b/packages/init/src/init.ts index 908335357c9..77f34e7abbf 100644 --- a/packages/init/src/init.ts +++ b/packages/init/src/init.ts @@ -61,7 +61,9 @@ ${colors.rgb8("OPTIONS:", 3)} ${colors.rgb8("--tailwind", 2)} Use Tailwind for styling ${colors.rgb8("--vscode", 2)} Setup project for VS Code ${colors.rgb8("--docker", 2)} Setup Project to use Docker - ${colors.rgb8("--builder", 2)} (Deprecated) Setup with builder instead of vite + ${ + colors.rgb8("--builder", 2) +} (Deprecated) Setup with builder instead of vite ${colors.rgb8("--help, -h", 2)} Show this help message `;