@milkee/d 0.1.0 → 0.2.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.
Files changed (2) hide show
  1. package/index.d.ts +56 -1
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -20,6 +20,40 @@ interface CoffeeOptions {
20
20
  watch?: boolean;
21
21
  }
22
22
 
23
+ /**
24
+ * Describes the compilation results passed to a plugin's executor function.
25
+ */
26
+ interface CompilationResult {
27
+ /**
28
+ * The complete configuration object loaded from `coffee.config.cjs`.
29
+ * (Typed as `any` to prevent circular type definitions, but it conforms to the `Config` interface).
30
+ */
31
+ config: any;
32
+
33
+ /**
34
+ * An array of absolute paths to the compiled .js and .js.map files.
35
+ */
36
+ compiledFiles: string[];
37
+
38
+ /**
39
+ * The stdout from the coffee compiler.
40
+ * (Note: In watch mode, this will be a placeholder string like '(watch mode)').
41
+ */
42
+ stdout: string;
43
+
44
+ /**
45
+ * The stderr from the coffee compiler.
46
+ */
47
+ stderr: string;
48
+ }
49
+
50
+ /**
51
+ * Defines the function returned by a plugin's setup function.
52
+ * This function is executed by Milkee after a successful compilation.
53
+ * It can be synchronous or asynchronous (return a Promise).
54
+ */
55
+ type PluginExecutor = (result: CompilationResult) => void | Promise<void>;
56
+
23
57
  /**
24
58
  * (Optional) Additional options/plugins for the Milkee builder.
25
59
  */
@@ -34,7 +68,28 @@ interface MilkeeConfig {
34
68
  */
35
69
  confirm?: boolean;
36
70
  };
37
- plugins?: any[];
71
+ /**
72
+ * (Optional) An array of plugin executor functions.
73
+ *
74
+ * A plugin executor is the function *returned* by your plugin's setup function
75
+ * (which is what you `require` in your config).
76
+ *
77
+ * @example
78
+ * // coffee.config.cjs
79
+ * const myPlugin = require('./plugins/my-plugin.js');
80
+ *
81
+ * module.exports = {
82
+ * // ...
83
+ * milkee: {
84
+ * plugins: [
85
+ * // This call returns the PluginExecutor
86
+ * myPlugin({ option: 'value' }),
87
+ * // ...
88
+ * ]
89
+ * }
90
+ * }
91
+ */
92
+ plugins?: PluginExecutor[];
38
93
  }
39
94
 
40
95
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milkee/d",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Milkee config types.",
5
5
  "main": "",
6
6
  "types": "index.d.ts",