-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.d.ts
More file actions
130 lines (119 loc) · 3.25 KB
/
Copy pathindex.d.ts
File metadata and controls
130 lines (119 loc) · 3.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
// These interfaces describe the nested parts of the configuration.
// They don't need to be exported themselves.
/**
* (Optional) Additional options for the CoffeeScript compiler.
* See `coffee --help` for all available options.
* Web: https://coffeescript.org/annotated-source/command.html
*/
interface CoffeeOptions {
/**
* The following options are supported:
*/
bare?: boolean;
join?: boolean;
map?: boolean;
inlineMap?: boolean;
noHeader?: boolean;
transpile?: boolean;
literate?: boolean;
watch?: boolean;
}
/**
* Describes the compilation results passed to a plugin's executor function.
*/
interface CompilationResult {
/**
* The complete configuration object loaded from `coffee.config.cjs`.
* (Typed as `any` to prevent circular type definitions, but it conforms to the `Config` interface).
*/
config: any;
/**
* An array of absolute paths to the compiled .js and .js.map files.
*/
compiledFiles: string[];
/**
* The stdout from the coffee compiler.
* (Note: In watch mode, this will be a placeholder string like '(watch mode)').
*/
stdout: string;
/**
* The stderr from the coffee compiler.
*/
stderr: string;
}
/**
* Defines the function returned by a plugin's setup function.
* This function is executed by Milkee after a successful compilation.
* It can be synchronous or asynchronous (return a Promise).
*/
type PluginExecutor = (result: CompilationResult) => void | Promise<void>;
/**
* Supported package managers.
*/
type PackageManager = 'npm' | 'pnpm' | 'yarn' | 'bun' | 'aube' | 'nub' | 'vlt' | 'bower';
/**
* (Optional) Additional options/plugins for the Milkee builder.
*/
interface MilkeeConfig {
/**
* Package manager used in this project.
* Auto-detected from lock files and `package.json#packageManager`, but can be overridden here.
*/
packageManager?: PackageManager;
options?: {
/**
* Ignore update notifications.
*/
ignoreUpdate?: boolean,
/**
* Before compiling, reset the directory.
*/
refresh?: boolean;
/**
* Before compiling, confirm "Do you want to Continue?"
*/
confirm?: boolean;
copy?: boolean;
};
/**
* (Optional) An array of plugin executor functions.
*
* A plugin executor is the function *returned* by your plugin's setup function
* (which is what you `require` in your config).
*
* @example
* // coffee.config.cjs
* const myPlugin = require('./plugins/my-plugin.js');
*
* module.exports = {
* // ...
* milkee: {
* plugins: [
* // This call returns the PluginExecutor
* myPlugin({ option: 'value' }),
* // ...
* ]
* }
* }
*/
plugins?: PluginExecutor[];
}
/**
* Defines the shape of the coffee.config.js configuration object for Milkee.
* This is the main type to be imported.
*/
export interface Config {
/**
* The entry point for compilation.
* This can be a single file or a directory.
*/
entry: string;
/**
* The output for the compiled JavaScript files.
* If 'options.join' is true, this should be a single file path (e.g., 'dist/app.js').
* If 'options.join' is false, this should be a directory (e.g., 'dist').
*/
output: string;
options?: CoffeeOptions;
milkee?: MilkeeConfig;
}