BREAKING(core): remove FreshBuilder interface (#2935)
Once can just use `Builder` for typing. --------- Co-authored-by: Marvin Hagemeister <marvin@deno.com>
This commit is contained in:
co-authored by
Marvin Hagemeister
parent
958b9528cc
commit
83da608504
@@ -1,10 +1,10 @@
|
|||||||
import type { TailwindPluginOptions } from "./types.ts";
|
import type { TailwindPluginOptions } from "./types.ts";
|
||||||
import { initTailwind } from "./compiler.ts";
|
import { initTailwind } from "./compiler.ts";
|
||||||
import type { FreshBuilder } from "fresh/dev";
|
import type { Builder } from "fresh/dev";
|
||||||
import type { App } from "fresh";
|
import type { App } from "fresh";
|
||||||
|
|
||||||
export function tailwind<T>(
|
export function tailwind<T>(
|
||||||
builder: FreshBuilder,
|
builder: Builder,
|
||||||
app: App<T>,
|
app: App<T>,
|
||||||
options: TailwindPluginOptions = {},
|
options: TailwindPluginOptions = {},
|
||||||
): void {
|
): void {
|
||||||
|
|||||||
+4
-13
@@ -35,24 +35,15 @@ export interface BuildOptions {
|
|||||||
target?: string | string[];
|
target?: string | string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FreshBuilder {
|
export class Builder {
|
||||||
onTransformStaticFile(
|
|
||||||
options: OnTransformOptions,
|
|
||||||
callback: TransformFn,
|
|
||||||
): void;
|
|
||||||
build<T>(app: App<T>, options?: BuildOptions): Promise<void>;
|
|
||||||
listen<T>(app: App<T>, options?: ListenOptions & BuildOptions): Promise<void>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Builder implements FreshBuilder {
|
|
||||||
#transformer = new FreshFileTransformer(fsAdapter);
|
#transformer = new FreshFileTransformer(fsAdapter);
|
||||||
#addedInternalTransforms = false;
|
#addedInternalTransforms = false;
|
||||||
#options: { target: string | string[] };
|
#options: Required<BuildOptions>;
|
||||||
#chunksReady = Promise.withResolvers<void>();
|
#chunksReady = Promise.withResolvers<void>();
|
||||||
|
|
||||||
constructor(options: BuildOptions = {}) {
|
constructor(options?: BuildOptions) {
|
||||||
this.#options = {
|
this.#options = {
|
||||||
target: options.target ?? ["chrome99", "firefox99", "safari15"],
|
target: options?.target ?? ["chrome99", "firefox99", "safari15"],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
export { Builder, type FreshBuilder } from "./builder.ts";
|
export { Builder } from "./builder.ts";
|
||||||
export {
|
export {
|
||||||
type OnTransformArgs,
|
type OnTransformArgs,
|
||||||
type OnTransformOptions,
|
type OnTransformOptions,
|
||||||
|
|||||||
Reference in New Issue
Block a user