Skip to content

Commit a405a9b

Browse files
bartlomiejuclaude
andcommitted
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) <noreply@anthropic.com>
1 parent 895bcac commit a405a9b

5 files changed

Lines changed: 56 additions & 12 deletions

File tree

packages/fresh/src/dev/builder.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ export type ResolvedBuildConfig = Required<Omit<BuildOptions, "sourceMap">> & {
109109
sourceMap?: FreshBundleOptions["sourceMap"];
110110
};
111111

112+
/**
113+
* @deprecated Use the Vite plugin (`@fresh/plugin-vite`) instead.
114+
* The Builder class will be removed in a future version of Fresh.
115+
*/
112116
// deno-lint-ignore no-explicit-any
113117
export class Builder<State = any> {
114118
#transformer: FileTransformer;

packages/fresh/src/dev/mod.ts

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
1-
export {
2-
Builder,
3-
type BuildOptions,
4-
type ResolvedBuildConfig,
5-
} from "./builder.ts";
6-
export {
7-
type OnTransformArgs,
8-
type OnTransformOptions,
9-
type TransformFn,
10-
} from "./file_transformer.ts";
1+
/**
2+
* @deprecated Use the Vite plugin (`@fresh/plugin-vite`) instead.
3+
* The Builder API will be removed in a future version of Fresh.
4+
*/
5+
export { Builder } from "./builder.ts";
6+
/**
7+
* @deprecated Use the Vite plugin (`@fresh/plugin-vite`) instead.
8+
*/
9+
export type { BuildOptions } from "./builder.ts";
10+
/**
11+
* @deprecated Use the Vite plugin (`@fresh/plugin-vite`) instead.
12+
*/
13+
export type { ResolvedBuildConfig } from "./builder.ts";
14+
/**
15+
* @deprecated Use the Vite plugin (`@fresh/plugin-vite`) instead.
16+
*/
17+
export type { OnTransformArgs } from "./file_transformer.ts";
18+
/**
19+
* @deprecated Use the Vite plugin (`@fresh/plugin-vite`) instead.
20+
*/
21+
export type { OnTransformOptions } from "./file_transformer.ts";
22+
/**
23+
* @deprecated Use the Vite plugin (`@fresh/plugin-vite`) instead.
24+
*/
25+
export type { TransformFn } from "./file_transformer.ts";

packages/init/src/init.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ ${colors.rgb8("OPTIONS:", 3)}
6161
${colors.rgb8("--tailwind", 2)} Use Tailwind for styling
6262
${colors.rgb8("--vscode", 2)} Setup project for VS Code
6363
${colors.rgb8("--docker", 2)} Setup Project to use Docker
64-
${colors.rgb8("--builder", 2)} Setup with builder instead of vite
64+
${colors.rgb8("--builder", 2)} (Deprecated) Setup with builder instead of vite
6565
${colors.rgb8("--help, -h", 2)} Show this help message
6666
`;
6767

@@ -141,6 +141,15 @@ export async function initProject(
141141

142142
const useVite = !flags.builder;
143143

144+
if (flags.builder) {
145+
console.log(
146+
"\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).",
147+
"color: yellow; font-weight: bold",
148+
"",
149+
);
150+
console.log();
151+
}
152+
144153
const useDocker = flags.docker;
145154
let useTailwind = flags.tailwind || false;
146155
if (flags.tailwind == null) {

packages/plugin-tailwindcss-v3/src/mod.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import cssnano from "cssnano";
55
import autoprefixer from "autoprefixer";
66
import * as path from "@std/path";
77

8+
/**
9+
* @deprecated Use the Vite plugin with `@tailwindcss/vite` instead.
10+
*/
811
export interface AutoprefixerOptions {
912
/** environment for `Browserslist` */
1013
env?: string;
@@ -46,10 +49,17 @@ export interface AutoprefixerOptions {
4649
ignoreUnknownVersions?: boolean;
4750
}
4851

52+
/**
53+
* @deprecated Use the Vite plugin with `@tailwindcss/vite` instead.
54+
*/
4955
export interface TailwindPluginOptions {
5056
autoprefixer?: AutoprefixerOptions;
5157
}
5258

59+
/**
60+
* @deprecated Use the Vite plugin with `@tailwindcss/vite` instead.
61+
* This plugin is only compatible with the legacy Builder API.
62+
*/
5363
export function tailwind(
5464
builder: Builder,
5565
options: TailwindPluginOptions = {},

packages/plugin-tailwindcss/src/mod.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,15 @@ import twPostcss from "@tailwindcss/postcss";
33
import postcss from "postcss";
44
import type { TailwindPluginOptions } from "./types.ts";
55

6-
// Re-export types for public API
6+
/**
7+
* @deprecated Use the Vite plugin with `@tailwindcss/vite` instead.
8+
*/
79
export type { TailwindPluginOptions } from "./types.ts";
810

11+
/**
12+
* @deprecated Use the Vite plugin with `@tailwindcss/vite` instead.
13+
* This plugin is only compatible with the legacy Builder API.
14+
*/
915
export function tailwind(
1016
builder: Builder,
1117
options: TailwindPluginOptions = {},

0 commit comments

Comments
 (0)