@windwalker-io/fusion-next 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,316 @@
1
+ import { Arguments } from 'yargs';
2
+ import { ConfigEnv } from 'vite';
3
+ import { default as default_2 } from 'node:crypto';
4
+ import { NormalizedOutputOptions } from 'rollup';
5
+ import { OutputBundle } from 'rollup';
6
+ import { Plugin as Plugin_2 } from 'vite';
7
+ import { PluginOption } from 'vite';
8
+ import { PreRenderedAsset } from 'rollup';
9
+ import { PreRenderedChunk } from 'rollup';
10
+ import { UserConfig } from 'vite';
11
+ import { ViteDevServer } from 'vite';
12
+
13
+ export declare function alias(src: string, dest: string): void;
14
+
15
+ export declare let builder: ConfigBuilder;
16
+
17
+ export declare class BuildTask {
18
+ input: string;
19
+ group?: string | undefined;
20
+ id: string;
21
+ output?: string | ((chunkInfo: PreRenderedChunk) => any);
22
+ postCallbacks: ((options: NormalizedOutputOptions, bundle: OutputBundle) => MaybePromise<any>)[];
23
+ constructor(input: string, group?: string | undefined);
24
+ dest(output?: string | ((chunkInfo: PreRenderedChunk) => any)): this;
25
+ addPostCallback(callback: () => void): this;
26
+ normalizeOutput(output: string, ext?: string): string;
27
+ static toFileId(input: string, group?: string): string;
28
+ }
29
+
30
+ export declare function callback(handler: CallbackHandler): CallbackProcessor;
31
+
32
+ export declare function callbackAfterBuild(handler: CallbackHandler): CallbackProcessor;
33
+
34
+ declare type CallbackHandler = (taskName: string, builder: ConfigBuilder) => MaybePromise<any>;
35
+
36
+ declare class CallbackProcessor implements ProcessorInterface {
37
+ constructor(
38
+ /** @internal */
39
+ handler: CallbackHandler,
40
+ /** @internal */
41
+ afterBuild?: boolean);
42
+ config(taskName: string, builder: ConfigBuilder): MaybePromise<any>;
43
+ preview(): MaybePromise<ProcessorPreview[]>;
44
+ }
45
+
46
+ export declare function chunkDir(dir: string): void;
47
+
48
+ export declare function clean(...paths: string[]): void;
49
+
50
+ export declare class ConfigBuilder {
51
+ config: UserConfig;
52
+ env: ConfigEnv;
53
+ fusionOptions: FusionPluginOptions;
54
+ server: ViteDevServer | null;
55
+ static globalOverrideConfig: UserConfig;
56
+ overrideConfig: UserConfig;
57
+ entryFileNamesCallbacks: ((chunkInfo: PreRenderedChunk) => string | undefined | void)[];
58
+ chunkFileNamesCallbacks: ((chunkInfo: PreRenderedChunk) => string | undefined | void)[];
59
+ assetFileNamesCallbacks: ((chunkInfo: PreRenderedAsset) => string | undefined | void)[];
60
+ moveTasks: FileTasks;
61
+ copyTasks: FileTasks;
62
+ linkTasks: FileTasks<'link'>;
63
+ postBuildCallbacks: ((options: NormalizedOutputOptions, bundle: OutputBundle) => MaybePromise<void>)[];
64
+ resolveIdCallbacks: Exclude<Plugin_2['resolveId'], undefined>[];
65
+ loadCallbacks: Exclude<Plugin_2['load'], undefined>[];
66
+ watches: WatchTask[];
67
+ cleans: string[];
68
+ tasks: Map<string, BuildTask>;
69
+ constructor(config: UserConfig, env: ConfigEnv, fusionOptions: FusionPluginOptions);
70
+ merge(override: UserConfig | ((config: UserConfig) => UserConfig)): this;
71
+ private getDefaultOutput;
72
+ private getChunkDir;
73
+ private getChunkNameFromTask;
74
+ ensurePath(path: string, def?: any): this;
75
+ get(path: string): any;
76
+ set(path: string, value: any): this;
77
+ addTask(input: string, group?: string): BuildTask;
78
+ addCleans(...paths: string[]): this;
79
+ relativePath(to: string): string;
80
+ debug(): void;
81
+ }
82
+
83
+ export declare function configureBuilder(handler: (builder: ConfigBuilder) => void): void;
84
+
85
+ export declare function copy(input: TaskInput, dest: string): CopyProcessor;
86
+
87
+ export declare function copyGlob(src: string, dest: string): Promise<void>;
88
+
89
+ declare class CopyProcessor implements ProcessorInterface {
90
+ input: TaskInput;
91
+ dest: string;
92
+ constructor(input: TaskInput, dest: string);
93
+ config(taskName: string, builder: ConfigBuilder): MaybePromise<void>;
94
+ preview(): MaybePromise<ProcessorPreview[]>;
95
+ }
96
+
97
+ export declare function css(input: TaskInput, output?: TaskOutput, options?: CssOptions): CssProcessor;
98
+
99
+ declare type CssOptions = ProcessorOptions & {
100
+ clean?: boolean;
101
+ rebase?: boolean;
102
+ };
103
+
104
+ declare class CssProcessor implements ProcessorInterface {
105
+ protected input: TaskInput;
106
+ protected output?: TaskOutput | undefined;
107
+ protected options: CssOptions;
108
+ constructor(input: TaskInput, output?: TaskOutput | undefined, options?: CssOptions);
109
+ config(taskName: string, builder: ConfigBuilder): BuildTask[];
110
+ preview(): MaybePromise<ProcessorPreview[]>;
111
+ }
112
+
113
+ declare const _default: {
114
+ useFusion: typeof useFusion;
115
+ configureBuilder: typeof configureBuilder;
116
+ overrideViteConfig: typeof overrideViteConfig;
117
+ overrideOptions: typeof overrideOptions;
118
+ outDir: typeof outDir;
119
+ chunkDir: typeof chunkDir;
120
+ alias: typeof alias;
121
+ externals: typeof externals;
122
+ plugin: typeof plugin;
123
+ clean: typeof clean;
124
+ fullReloads: typeof fullReloads;
125
+ params: RunnerCliParams;
126
+ isVerbose: boolean;
127
+ isDev: boolean;
128
+ isProd: boolean;
129
+ isWindows: typeof fusion.isWindows;
130
+ shortHash: typeof fusion.shortHash;
131
+ copyGlob: typeof fusion.copyGlob;
132
+ moveGlob: typeof fusion.moveGlob;
133
+ symlink: typeof fusion.symlink;
134
+ fileToId: typeof fusion.fileToId;
135
+ getGlobBaseFromPattern: typeof fusion.getGlobBaseFromPattern;
136
+ css: typeof fusion.css;
137
+ js: typeof fusion.js;
138
+ move: typeof fusion.move;
139
+ copy: typeof fusion.copy;
140
+ link: typeof fusion.link;
141
+ callback: typeof fusion.callback;
142
+ callbackAfterBuild: typeof fusion.callbackAfterBuild;
143
+ };
144
+ export default _default;
145
+
146
+ export declare function externals(...externals: (string | RegExp)[]): void;
147
+
148
+ declare type ExtraViteOptions = OverrideOptions<ConfigBuilder>;
149
+
150
+ declare type FileTask<T extends keyof FileTaskOptionTypes = 'none'> = {
151
+ src: string;
152
+ dest: string;
153
+ options: FileTaskOptionTypes[T];
154
+ };
155
+
156
+ declare type FileTaskOptionTypes = {
157
+ 'none': any;
158
+ 'move': any;
159
+ 'copy': any;
160
+ 'link': LinkOptions;
161
+ };
162
+
163
+ declare type FileTasks<T extends keyof FileTaskOptionTypes = 'none'> = FileTask<T>[];
164
+
165
+ export declare function fileToId(input: string, group?: string): string;
166
+
167
+ export declare function fullReloads(...paths: string[]): void;
168
+
169
+ declare namespace fusion {
170
+ export {
171
+ isVerbose,
172
+ isDev,
173
+ isProd,
174
+ params,
175
+ isWindows,
176
+ shortHash,
177
+ copyGlob,
178
+ moveGlob,
179
+ symlink,
180
+ fileToId,
181
+ getGlobBaseFromPattern,
182
+ FusionPlugin,
183
+ MaybePromise,
184
+ MaybeArray,
185
+ BuildTask,
186
+ ConfigBuilder,
187
+ css,
188
+ js,
189
+ move,
190
+ copy,
191
+ link,
192
+ callback,
193
+ callbackAfterBuild,
194
+ ProcessorPreview,
195
+ ProcessorInterface
196
+ }
197
+ }
198
+
199
+ declare type Fusionfile = Record<string, any> | (() => Promise<Record<string, any>>);
200
+
201
+ export declare type FusionPlugin = PluginOption & {
202
+ buildConfig?: (builder: ConfigBuilder) => MaybePromise<any>;
203
+ };
204
+
205
+ declare interface FusionPluginOptions {
206
+ fusionfile?: string | Fusionfile;
207
+ chunkDir?: string;
208
+ chunkNameObfuscation?: boolean;
209
+ plugins?: FusionPlugin[];
210
+ cliParams?: RunnerCliParams;
211
+ }
212
+
213
+ declare type FusionPluginOptionsUnresolved = FusionPluginOptions | string | (() => MaybePromise<Record<string, any>>);
214
+
215
+ export declare function getGlobBaseFromPattern(pattern: string): string;
216
+
217
+ export declare const isDev: boolean;
218
+
219
+ export declare const isProd: boolean;
220
+
221
+ export declare let isVerbose: boolean;
222
+
223
+ export declare function isWindows(): boolean;
224
+
225
+ export declare function js(input: TaskInput, output?: TaskOutput): ProcessorInterface;
226
+
227
+ export declare function link(input: TaskInput, dest: string, options?: LinkOptions): LinkProcessor;
228
+
229
+ declare interface LinkOptions {
230
+ force?: boolean;
231
+ }
232
+
233
+ declare class LinkProcessor implements ProcessorInterface {
234
+ input: TaskInput;
235
+ dest: string;
236
+ options: LinkOptions;
237
+ constructor(input: TaskInput, dest: string, options?: LinkOptions);
238
+ config(taskName: string, builder: ConfigBuilder): MaybePromise<void>;
239
+ preview(): MaybePromise<ProcessorPreview[]>;
240
+ }
241
+
242
+ export declare type MaybeArray<T> = T | T[];
243
+
244
+ export declare type MaybePromise<T> = T | Promise<T>;
245
+
246
+ export declare function move(input: TaskInput, dest: string): MoveProcessor;
247
+
248
+ export declare function moveGlob(src: string, dest: string): Promise<void>;
249
+
250
+ declare class MoveProcessor implements ProcessorInterface {
251
+ input: TaskInput;
252
+ dest: string;
253
+ constructor(input: TaskInput, dest: string);
254
+ config(taskName: string, builder: ConfigBuilder): MaybePromise<void>;
255
+ preview(): MaybePromise<ProcessorPreview[]>;
256
+ }
257
+
258
+ export declare function outDir(outDir: string): void;
259
+
260
+ declare type OverrideOptions<T> = Partial<T> | ((options: Partial<T>) => T | undefined);
261
+
262
+ export declare function overrideOptions(options: FusionPluginOptions): FusionPluginOptions;
263
+
264
+ export declare function overrideViteConfig(config: UserConfig | null): void;
265
+
266
+ export declare let params: RunnerCliParams | undefined;
267
+
268
+ export declare function plugin(...plugins: FusionPlugin[]): void;
269
+
270
+ export declare interface ProcessorInterface {
271
+ config(taskName: string, builder: ConfigBuilder): MaybePromise<any>;
272
+ preview(): MaybePromise<ProcessorPreview[]>;
273
+ }
274
+
275
+ declare interface ProcessorOptions {
276
+ vite?: ExtraViteOptions;
277
+ verbose?: boolean;
278
+ }
279
+
280
+ export declare type ProcessorPreview = {
281
+ input: string;
282
+ output: string;
283
+ extra?: Record<string, any>;
284
+ };
285
+
286
+ declare type RunnerCliOptions = {
287
+ cwd?: string;
288
+ l?: boolean;
289
+ list?: boolean;
290
+ c?: string;
291
+ config?: string;
292
+ v?: number;
293
+ verbose?: number;
294
+ serverFile?: string;
295
+ s?: string;
296
+ };
297
+
298
+ declare type RunnerCliParams = Arguments<RunnerCliOptions>;
299
+
300
+ export declare function shortHash(bufferOrString: default_2.BinaryLike, short?: number | null): string;
301
+
302
+ export declare function symlink(target: string, link: string, force?: boolean): Promise<void>;
303
+
304
+ declare type TaskInput = string | string[];
305
+
306
+ declare type TaskOutput = string;
307
+
308
+ export declare function useFusion(fusionOptions?: FusionPluginOptionsUnresolved, tasks?: string | string[]): PluginOption;
309
+
310
+ declare type WatchTask = string | {
311
+ file: string;
312
+ moduleFile: string;
313
+ updateType: 'js-update' | 'css-update' | 'full-reload';
314
+ };
315
+
316
+ export { }