@powerlines/nx 0.11.269 → 0.11.270

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 (204) hide show
  1. package/README.md +29 -31
  2. package/dist/src/base/base-executor.d.mts +1 -1
  3. package/dist/src/base/base-executor.d.ts +1 -1
  4. package/dist/src/base/base-executor.js +78 -3
  5. package/dist/src/base/base-executor.mjs +75 -3
  6. package/dist/src/base/base-executor.mjs.map +1 -0
  7. package/dist/src/base/base-executor.schema.d.mts +117 -2
  8. package/dist/src/base/base-executor.schema.d.mts.map +1 -0
  9. package/dist/src/base/base-executor.schema.d.ts +117 -2
  10. package/dist/src/base/base-executor.schema.d.ts.map +1 -0
  11. package/dist/src/base/base-executor.untyped.d.mts +1 -1
  12. package/dist/src/base/base-executor.untyped.d.ts +1 -1
  13. package/dist/src/base/base-executor.untyped.js +135 -2
  14. package/dist/src/base/base-executor.untyped.mjs +135 -2
  15. package/dist/src/base/base-executor.untyped.mjs.map +1 -0
  16. package/dist/src/base/index.d.mts +1 -3
  17. package/dist/src/base/index.d.ts +1 -1
  18. package/dist/src/base/index.js +4 -5
  19. package/dist/src/base/index.mjs +2 -4
  20. package/dist/src/base-executor-Bj63x9OE.d.ts +28 -0
  21. package/dist/src/base-executor-Bj63x9OE.d.ts.map +1 -0
  22. package/dist/src/base-executor-D6POztG2.d.mts +28 -0
  23. package/dist/src/base-executor-D6POztG2.d.mts.map +1 -0
  24. package/dist/src/base-executor.untyped-D4R6pki2.d.ts +7 -0
  25. package/dist/src/base-executor.untyped-D4R6pki2.d.ts.map +1 -0
  26. package/dist/src/base-executor.untyped-hmlG6oyC.d.mts +7 -0
  27. package/dist/src/base-executor.untyped-hmlG6oyC.d.mts.map +1 -0
  28. package/dist/src/chunk-BE-pF4vm.js +34 -0
  29. package/dist/src/{constants-BvODbBl8.d.ts → constants-CbG11Mby.d.ts} +1 -1
  30. package/dist/src/constants-CbG11Mby.d.ts.map +1 -0
  31. package/dist/src/{constants-ByputsG8.d.mts → constants-VDvVnoLC.d.mts} +1 -1
  32. package/dist/src/constants-VDvVnoLC.d.mts.map +1 -0
  33. package/dist/src/executors/build/executor.d.mts +2 -16
  34. package/dist/src/executors/build/executor.d.mts.map +1 -1
  35. package/dist/src/executors/build/executor.d.ts +2 -16
  36. package/dist/src/executors/build/executor.d.ts.map +1 -1
  37. package/dist/src/executors/build/executor.js +6 -7
  38. package/dist/src/executors/build/executor.mjs +4 -6
  39. package/dist/src/executors/build/executor.mjs.map +1 -1
  40. package/dist/src/executors/build/untyped.d.mts +2 -2
  41. package/dist/src/executors/build/untyped.d.mts.map +1 -1
  42. package/dist/src/executors/build/untyped.d.ts +2 -2
  43. package/dist/src/executors/build/untyped.d.ts.map +1 -1
  44. package/dist/src/executors/build/untyped.js +3 -4
  45. package/dist/src/executors/build/untyped.mjs +1 -2
  46. package/dist/src/executors/build/untyped.mjs.map +1 -1
  47. package/dist/src/executors/clean/executor.d.mts +2 -13
  48. package/dist/src/executors/clean/executor.d.mts.map +1 -1
  49. package/dist/src/executors/clean/executor.d.ts +2 -13
  50. package/dist/src/executors/clean/executor.d.ts.map +1 -1
  51. package/dist/src/executors/clean/executor.js +4 -6
  52. package/dist/src/executors/clean/executor.mjs +2 -4
  53. package/dist/src/executors/clean/executor.mjs.map +1 -1
  54. package/dist/src/executors/clean/untyped.d.mts +2 -2
  55. package/dist/src/executors/clean/untyped.d.mts.map +1 -1
  56. package/dist/src/executors/clean/untyped.d.ts +2 -2
  57. package/dist/src/executors/clean/untyped.d.ts.map +1 -1
  58. package/dist/src/executors/clean/untyped.js +3 -3
  59. package/dist/src/executors/clean/untyped.mjs +1 -1
  60. package/dist/src/executors/docs/executor.d.mts +2 -15
  61. package/dist/src/executors/docs/executor.d.mts.map +1 -1
  62. package/dist/src/executors/docs/executor.d.ts +2 -15
  63. package/dist/src/executors/docs/executor.d.ts.map +1 -1
  64. package/dist/src/executors/docs/executor.js +4 -6
  65. package/dist/src/executors/docs/executor.mjs +2 -4
  66. package/dist/src/executors/docs/executor.mjs.map +1 -1
  67. package/dist/src/executors/docs/untyped.d.mts +2 -2
  68. package/dist/src/executors/docs/untyped.d.mts.map +1 -1
  69. package/dist/src/executors/docs/untyped.d.ts +2 -2
  70. package/dist/src/executors/docs/untyped.d.ts.map +1 -1
  71. package/dist/src/executors/docs/untyped.js +3 -4
  72. package/dist/src/executors/docs/untyped.mjs +1 -2
  73. package/dist/src/executors/docs/untyped.mjs.map +1 -1
  74. package/dist/src/executors/lint/executor.d.mts +2 -15
  75. package/dist/src/executors/lint/executor.d.mts.map +1 -1
  76. package/dist/src/executors/lint/executor.d.ts +2 -15
  77. package/dist/src/executors/lint/executor.d.ts.map +1 -1
  78. package/dist/src/executors/lint/executor.js +4 -6
  79. package/dist/src/executors/lint/executor.mjs +2 -4
  80. package/dist/src/executors/lint/executor.mjs.map +1 -1
  81. package/dist/src/executors/lint/untyped.d.mts +2 -2
  82. package/dist/src/executors/lint/untyped.d.mts.map +1 -1
  83. package/dist/src/executors/lint/untyped.d.ts +2 -2
  84. package/dist/src/executors/lint/untyped.d.ts.map +1 -1
  85. package/dist/src/executors/lint/untyped.js +3 -4
  86. package/dist/src/executors/lint/untyped.mjs +1 -2
  87. package/dist/src/executors/lint/untyped.mjs.map +1 -1
  88. package/dist/src/executors/prepare/executor.d.mts +2 -15
  89. package/dist/src/executors/prepare/executor.d.mts.map +1 -1
  90. package/dist/src/executors/prepare/executor.d.ts +2 -15
  91. package/dist/src/executors/prepare/executor.d.ts.map +1 -1
  92. package/dist/src/executors/prepare/executor.js +6 -7
  93. package/dist/src/executors/prepare/executor.mjs +4 -6
  94. package/dist/src/executors/prepare/executor.mjs.map +1 -1
  95. package/dist/src/executors/prepare/untyped.d.mts +2 -2
  96. package/dist/src/executors/prepare/untyped.d.mts.map +1 -1
  97. package/dist/src/executors/prepare/untyped.d.ts +2 -2
  98. package/dist/src/executors/prepare/untyped.d.ts.map +1 -1
  99. package/dist/src/executors/prepare/untyped.js +26 -3
  100. package/dist/src/executors/prepare/untyped.mjs +26 -3
  101. package/dist/src/executors/prepare/untyped.mjs.map +1 -0
  102. package/dist/src/generators/sync/generator.d.mts.map +1 -1
  103. package/dist/src/generators/sync/generator.d.ts.map +1 -1
  104. package/dist/src/generators/sync/generator.js +5 -6
  105. package/dist/src/generators/sync/generator.mjs +1 -2
  106. package/dist/src/generators/sync/generator.mjs.map +1 -1
  107. package/dist/src/generators/sync/untyped.d.mts +2 -2
  108. package/dist/src/generators/sync/untyped.d.mts.map +1 -1
  109. package/dist/src/generators/sync/untyped.d.ts +2 -2
  110. package/dist/src/generators/sync/untyped.d.ts.map +1 -1
  111. package/dist/src/generators/sync/untyped.js +1 -1
  112. package/dist/src/helpers/constants.d.mts +1 -1
  113. package/dist/src/helpers/constants.d.ts +1 -1
  114. package/dist/src/helpers/constants.js +34 -2
  115. package/dist/src/helpers/constants.mjs +33 -2
  116. package/dist/src/helpers/constants.mjs.map +1 -0
  117. package/dist/src/helpers/index.d.mts +2 -3
  118. package/dist/src/helpers/index.d.ts +2 -2
  119. package/dist/src/helpers/index.js +7 -8
  120. package/dist/src/helpers/index.mjs +2 -4
  121. package/dist/src/helpers/plugin-utilities.d.mts +1 -1
  122. package/dist/src/helpers/plugin-utilities.d.ts +1 -1
  123. package/dist/src/helpers/plugin-utilities.js +274 -5
  124. package/dist/src/helpers/plugin-utilities.mjs +270 -3
  125. package/dist/src/helpers/plugin-utilities.mjs.map +1 -0
  126. package/dist/src/index.d.mts +4 -7
  127. package/dist/src/index.d.ts +4 -4
  128. package/dist/src/index.js +11 -12
  129. package/dist/src/index.mjs +5 -7
  130. package/dist/src/plugin/index.d.mts +1 -1
  131. package/dist/src/plugin/index.d.mts.map +1 -1
  132. package/dist/src/plugin/index.d.ts +1 -1
  133. package/dist/src/plugin/index.d.ts.map +1 -1
  134. package/dist/src/plugin/index.js +3 -3
  135. package/dist/src/plugin/index.mjs +1 -2
  136. package/dist/src/plugin/index.mjs.map +1 -1
  137. package/dist/src/{plugin-DIj3oU64.d.mts → plugin-B_ZGdX7U.d.mts} +1 -1
  138. package/dist/src/plugin-B_ZGdX7U.d.mts.map +1 -0
  139. package/dist/src/{plugin-DN475itb.d.ts → plugin-DpyutMl2.d.ts} +1 -1
  140. package/dist/src/plugin-DpyutMl2.d.ts.map +1 -0
  141. package/dist/src/{plugin-utilities-Bz3Muyag.d.mts → plugin-utilities-Cg-Ccp4C.d.mts} +2 -3
  142. package/dist/src/plugin-utilities-Cg-Ccp4C.d.mts.map +1 -0
  143. package/dist/src/{plugin-utilities-CeMy-9YQ.d.ts → plugin-utilities-CmfuC3TZ.d.ts} +2 -3
  144. package/dist/src/plugin-utilities-CmfuC3TZ.d.ts.map +1 -0
  145. package/dist/src/types/index.d.mts +1 -1
  146. package/dist/src/types/index.d.ts +1 -1
  147. package/dist/src/types/plugin.d.mts +1 -1
  148. package/dist/src/types/plugin.d.ts +1 -1
  149. package/package.json +4 -4
  150. package/dist/src/base-B7jekb-W.js +0 -0
  151. package/dist/src/base-BRSa-clf.mjs +0 -1
  152. package/dist/src/base-executor-CWToCKgJ.d.ts +0 -2195
  153. package/dist/src/base-executor-CWToCKgJ.d.ts.map +0 -1
  154. package/dist/src/base-executor-Cc27ehGx.js +0 -4881
  155. package/dist/src/base-executor-DPB5qlkm.mjs +0 -4863
  156. package/dist/src/base-executor-DPB5qlkm.mjs.map +0 -1
  157. package/dist/src/base-executor-PhChSWwR.mjs +0 -4863
  158. package/dist/src/base-executor-PhChSWwR.mjs.map +0 -1
  159. package/dist/src/base-executor-tG-B1UsT.js +0 -4881
  160. package/dist/src/base-executor-xsZuLKpp.d.mts +0 -2197
  161. package/dist/src/base-executor-xsZuLKpp.d.mts.map +0 -1
  162. package/dist/src/base-executor.schema-BaaDD_VU.d.ts +0 -130
  163. package/dist/src/base-executor.schema-BaaDD_VU.d.ts.map +0 -1
  164. package/dist/src/base-executor.schema-CYPLsYvI.d.mts +0 -130
  165. package/dist/src/base-executor.schema-CYPLsYvI.d.mts.map +0 -1
  166. package/dist/src/base-executor.untyped-7SvGKXcO.d.mts +0 -7
  167. package/dist/src/base-executor.untyped-7SvGKXcO.d.mts.map +0 -1
  168. package/dist/src/base-executor.untyped-C1pQETnQ.mjs +0 -136
  169. package/dist/src/base-executor.untyped-C1pQETnQ.mjs.map +0 -1
  170. package/dist/src/base-executor.untyped-Cz1Zw_02.js +0 -141
  171. package/dist/src/base-executor.untyped-DBccuF6E.d.ts +0 -7
  172. package/dist/src/base-executor.untyped-DBccuF6E.d.ts.map +0 -1
  173. package/dist/src/base-executor.untyped-DCiPQvRf.d.ts +0 -7
  174. package/dist/src/base-executor.untyped-DCiPQvRf.d.ts.map +0 -1
  175. package/dist/src/base-executor.untyped-imww7Gm9.d.mts +0 -7
  176. package/dist/src/base-executor.untyped-imww7Gm9.d.mts.map +0 -1
  177. package/dist/src/config-CGQhS8tm.js +0 -239
  178. package/dist/src/config-LoR-NIJg.mjs +0 -147
  179. package/dist/src/config-LoR-NIJg.mjs.map +0 -1
  180. package/dist/src/constants-BvODbBl8.d.ts.map +0 -1
  181. package/dist/src/constants-ByputsG8.d.mts.map +0 -1
  182. package/dist/src/constants-CKuImMYn.js +0 -39
  183. package/dist/src/constants-DzvoYj5w.mjs +0 -34
  184. package/dist/src/constants-DzvoYj5w.mjs.map +0 -1
  185. package/dist/src/helpers-B78f0Oey.js +0 -0
  186. package/dist/src/helpers-j01T2doK.mjs +0 -1
  187. package/dist/src/index-7rWKHdox.d.mts +0 -1
  188. package/dist/src/index-CB5PSF-Q.d.ts +0 -1
  189. package/dist/src/index-CDDzqahH.d.ts +0 -1
  190. package/dist/src/index-CsuikFeJ.d.mts +0 -1
  191. package/dist/src/index-LhFpnU-f.d.mts +0 -1
  192. package/dist/src/index-g0mugXoV.d.ts +0 -1
  193. package/dist/src/plugin-BnaFlFmT.js +0 -0
  194. package/dist/src/plugin-DIj3oU64.d.mts.map +0 -1
  195. package/dist/src/plugin-DN475itb.d.ts.map +0 -1
  196. package/dist/src/plugin-DRjpXVSI.mjs +0 -1
  197. package/dist/src/plugin-utilities-ByTgFCEW.js +0 -287
  198. package/dist/src/plugin-utilities-Bz3Muyag.d.mts.map +0 -1
  199. package/dist/src/plugin-utilities-CeMy-9YQ.d.ts.map +0 -1
  200. package/dist/src/plugin-utilities-DamtoOxO.mjs +0 -270
  201. package/dist/src/plugin-utilities-DamtoOxO.mjs.map +0 -1
  202. package/dist/src/untyped-BzuygGwJ.mjs +0 -27
  203. package/dist/src/untyped-BzuygGwJ.mjs.map +0 -1
  204. package/dist/src/untyped-CB-jtwm-.js +0 -32
@@ -1,2197 +0,0 @@
1
- import { t as BaseExecutorSchema } from "./base-executor.schema-CYPLsYvI.mjs";
2
- import { ResolveOptions } from "@stryke/fs/resolve";
3
- import ts from "typescript";
4
- import "c12";
5
- import { LogLevelLabel } from "@storm-software/config-tools/types";
6
- import { EnvPaths } from "@stryke/env/get-env-paths";
7
- import { FetchRequestOptions } from "@stryke/http/fetch";
8
- import { CompatibilityDateSpec, CompatibilityDates } from "compatx";
9
- import { ParseResult, ParserOptions } from "oxc-parser";
10
- import { RequestInfo, Response } from "undici";
11
- import { Jiti } from "jiti";
12
- import "@stryke/capnp";
13
- import { SourceMap } from "magic-string";
14
- import { ExternalIdResult, HookFilter, TransformResult, UnpluginBuildContext, UnpluginContext, UnpluginMessage, UnpluginOptions } from "unplugin";
15
- import { ExecutorContext, PromiseExecutor } from "@nx/devkit";
16
- import { StormWorkspaceConfig } from "@storm-software/config/types";
17
- import { BaseExecutorResult } from "@storm-software/workspace-tools/types";
18
- import { Format } from "@storm-software/build-tools/types";
19
- import { AnyFunction, MaybePromise, NonUndefined } from "@stryke/types/base";
20
- import { TypeDefinition, TypeDefinitionParameter } from "@stryke/types/configuration";
21
- import { AssetGlob } from "@stryke/types/file";
22
- import { PreviewOptions, ResolvedPreviewOptions } from "vite";
23
- import { PackageJson } from "@stryke/types/package-json";
24
- import { Range } from "semver";
25
- import { ArrayValues } from "@stryke/types/array";
26
- import { LoadResult } from "rollup";
27
- import { CompilerOptions, TsConfigJson } from "@stryke/types/tsconfig";
28
-
29
- //#region ../core/src/types/fs.d.ts
30
- type StoragePreset = "fs" | "virtual";
31
- /**
32
- * Interface defining the methods and properties for a storage adapter.
33
- */
34
- interface StorageAdapter {
35
- /**
36
- * A name identifying the storage adapter type.
37
- */
38
- name: string;
39
- /**
40
- * The storage preset for the adapter.
41
- *
42
- * @remarks
43
- * This can be used as an alternate way to identify the type of storage being used.
44
- */
45
- preset?: StoragePreset | null;
46
- /**
47
- * Checks if a key exists in the storage.
48
- *
49
- * @param key - The key to check for existence.
50
- * @returns A promise that resolves to `true` if the key exists, otherwise `false`.
51
- */
52
- exists: (key: string) => Promise<boolean>;
53
- /**
54
- * Synchronously checks if a key exists in the storage.
55
- *
56
- * @param key - The key to check for existence.
57
- * @returns Returns `true` if the key exists, otherwise `false`.
58
- */
59
- existsSync: (key: string) => boolean;
60
- /**
61
- * Read a value associated with a key from the storage.
62
- *
63
- * @param key - The key to read the value for.
64
- * @returns A promise that resolves to the value if found, otherwise `null`.
65
- */
66
- get: (key: string) => Promise<string | null>;
67
- /**
68
- * Synchronously reads the value associated with a key from the storage.
69
- *
70
- * @param key - The key to read the value for.
71
- * @returns The value if found, otherwise `null`.
72
- */
73
- getSync: (key: string) => string | null;
74
- /**
75
- * Writes a value to the storage for the given key.
76
- *
77
- * @param key - The key to associate the value with.
78
- * @param value - The value to store.
79
- */
80
- set: (key: string, value: string) => Promise<void>;
81
- /**
82
- * Synchronously writes a value to the storage for the given key.
83
- *
84
- * @param key - The key to associate the value with.
85
- * @param value - The value to store.
86
- */
87
- setSync: (key: string, value: string) => void;
88
- /**
89
- * Removes a value from the storage.
90
- *
91
- * @param key - The key whose value should be removed.
92
- */
93
- remove: (key: string) => Promise<void>;
94
- /**
95
- * Synchronously removes a value from the storage.
96
- *
97
- * @param key - The key whose value should be removed.
98
- */
99
- removeSync: (key: string) => void;
100
- /**
101
- * Creates a directory at the specified path.
102
- *
103
- * @param dirPath - The path of the directory to create.
104
- */
105
- mkdir: (dirPath: string) => Promise<void>;
106
- /**
107
- * Synchronously creates a directory at the specified path.
108
- *
109
- * @param dirPath - The path of the directory to create.
110
- */
111
- mkdirSync: (dirPath: string) => void;
112
- /**
113
- * Remove all entries from the storage that match the provided base path.
114
- *
115
- * @param base - The base path or prefix to clear entries from.
116
- */
117
- clear: (base?: string) => Promise<void>;
118
- /**
119
- * Synchronously remove all entries from the storage that match the provided base path.
120
- *
121
- * @param base - The base path or prefix to clear entries from.
122
- */
123
- clearSync: (base?: string) => void;
124
- /**
125
- * Lists all keys under the provided base path.
126
- *
127
- * @param base - The base path or prefix to list keys from.
128
- * @returns A promise resolving to the list of keys.
129
- */
130
- list: (base?: string) => Promise<string[]>;
131
- /**
132
- * Synchronously lists all keys under the provided base path.
133
- *
134
- * @param base - The base path or prefix to list keys from.
135
- * @returns The list of keys.
136
- */
137
- listSync: (base?: string) => string[];
138
- /**
139
- * Checks if the given key is a directory.
140
- *
141
- * @param key - The key to check.
142
- * @returns A promise that resolves to `true` if the key is a directory, otherwise `false`.
143
- */
144
- isDirectory: (key: string) => Promise<boolean>;
145
- /**
146
- * Synchronously checks if the given key is a directory.
147
- *
148
- * @param key - The key to check.
149
- * @returns `true` if the key is a directory, otherwise `false`.
150
- */
151
- isDirectorySync: (key: string) => boolean;
152
- /**
153
- * Checks if the given key is a file.
154
- *
155
- * @param key - The key to check.
156
- * @returns A promise that resolves to `true` if the key is a file, otherwise `false`.
157
- */
158
- isFile: (key: string) => Promise<boolean>;
159
- /**
160
- * Synchronously checks if the given key is a file.
161
- *
162
- * @param key - The key to check.
163
- * @returns `true` if the key is a file, otherwise `false`.
164
- */
165
- isFileSync: (key: string) => boolean;
166
- /**
167
- * Releases any resources held by the storage adapter.
168
- */
169
- dispose: () => MaybePromise<void>;
170
- }
171
- /**
172
- * A mapping of file paths to storage adapter names and their corresponding {@link StorageAdapter} instances.
173
- */
174
- type StoragePort = Record<string, StorageAdapter>;
175
- interface VirtualFileMetadata {
176
- /**
177
- * The identifier for the file data.
178
- */
179
- id: string;
180
- /**
181
- * The timestamp of the virtual file.
182
- */
183
- timestamp: number;
184
- /**
185
- * The type of the file.
186
- *
187
- * @remarks
188
- * This string represents the purpose/function of the file in the virtual file system. A potential list of variants includes:
189
- * - `builtin`: Indicates that the file is a built-in module provided by the system.
190
- * - `entry`: Indicates that the file is an entry point for execution.
191
- * - `infrastructure`: Indicates that the file is an infrastructure module used by the system during deployments.
192
- * - `normal`: Indicates that the file is a standard file without any special role.
193
- */
194
- type: string;
195
- /**
196
- * Additional metadata associated with the file.
197
- */
198
- properties: Record<string, string | undefined>;
199
- }
200
- interface VirtualFileData {
201
- /**
202
- * The identifier for the file data.
203
- */
204
- id?: string;
205
- /**
206
- * The contents of the virtual file.
207
- */
208
- code: string;
209
- /**
210
- * The type of the file.
211
- *
212
- * @remarks
213
- * This string represents the purpose/function of the file in the virtual file system. A potential list of variants includes:
214
- * - `builtin`: Indicates that the file is a built-in module provided by the system.
215
- * - `entry`: Indicates that the file is an entry point for execution.
216
- * - `infrastructure`: Indicates that the file is an infrastructure module used by the system during deployments.
217
- * - `normal`: Indicates that the file is a standard file without any special role.
218
- */
219
- type?: string;
220
- /**
221
- * Additional metadata associated with the file.
222
- */
223
- properties?: Record<string, string | undefined>;
224
- }
225
- interface VirtualFile extends Required<VirtualFileData>, VirtualFileMetadata {
226
- /**
227
- * An additional name for the file.
228
- */
229
- path: string;
230
- /**
231
- * The timestamp of the virtual file.
232
- */
233
- timestamp: number;
234
- }
235
- interface WriteOptions {
236
- /**
237
- * Should the file skip formatting before being written?
238
- *
239
- * @defaultValue false
240
- */
241
- skipFormat?: boolean;
242
- /**
243
- * The storage preset or adapter name for the output file.
244
- *
245
- * @remarks
246
- * If not specified, the output mode will be determined by the provided `output.mode` value.
247
- */
248
- storage?: StoragePreset | string;
249
- /**
250
- * Additional metadata for the file.
251
- */
252
- meta?: Partial<VirtualFileMetadata>;
253
- }
254
- interface ResolveOptions$1 extends ResolveOptions {
255
- /**
256
- * If true, the module is being resolved as an entry point.
257
- */
258
- isEntry?: boolean;
259
- /**
260
- * If true, the resolver will skip alias resolution when resolving modules.
261
- */
262
- skipAlias?: boolean;
263
- /**
264
- * If true, the resolver will skip using the cache when resolving modules.
265
- */
266
- skipCache?: boolean;
267
- /**
268
- * An array of external modules or patterns to exclude from resolution.
269
- */
270
- external?: (string | RegExp)[];
271
- /**
272
- * An array of modules or patterns to include in the resolution, even if they are marked as external.
273
- */
274
- noExternal?: (string | RegExp)[];
275
- /**
276
- * An array of patterns to match when resolving modules.
277
- */
278
- skipNodeModulesBundle?: boolean;
279
- /**
280
- * If true, the resolver will treat the module as a file.
281
- */
282
- isFile?: boolean;
283
- }
284
- interface VirtualFileSystemInterface {
285
- /**
286
- * The underlying file metadata.
287
- */
288
- metadata: Readonly<Record<string, VirtualFileMetadata>>;
289
- /**
290
- * A map of file paths to their module ids.
291
- */
292
- ids: Readonly<Record<string, string>>;
293
- /**
294
- * A map of module ids to their file paths.
295
- */
296
- paths: Readonly<Record<string, string>>;
297
- /**
298
- * Checks if a file exists in the virtual file system (VFS).
299
- *
300
- * @param path - The path or id of the file.
301
- * @returns `true` if the file exists, otherwise `false`.
302
- */
303
- exists: (path: string) => Promise<boolean>;
304
- /**
305
- * Synchronously Checks if a file exists in the virtual file system (VFS).
306
- *
307
- * @param path - The path or id of the file.
308
- * @returns `true` if the file exists, otherwise `false`.
309
- */
310
- existsSync: (path: string) => boolean;
311
- /**
312
- * Checks if a file is virtual in the virtual file system (VFS).
313
- *
314
- * @param path - The path or id of the file.
315
- * @returns `true` if the file is virtual, otherwise `false`.
316
- */
317
- isVirtual: (path: string) => boolean;
318
- /**
319
- * Checks if the given key is a directory.
320
- *
321
- * @param key - The key to check.
322
- * @returns A promise that resolves to `true` if the key is a directory, otherwise `false`.
323
- */
324
- isDirectory: (key: string) => Promise<boolean>;
325
- /**
326
- * Synchronously checks if the given key is a directory.
327
- *
328
- * @param key - The key to check.
329
- * @returns `true` if the key is a directory, otherwise `false`.
330
- */
331
- isDirectorySync: (key: string) => boolean;
332
- /**
333
- * Checks if the given key is a file.
334
- *
335
- * @param key - The key to check.
336
- * @returns A promise that resolves to `true` if the key is a file, otherwise `false`.
337
- */
338
- isFile: (key: string) => Promise<boolean>;
339
- /**
340
- * Synchronously checks if the given key is a file.
341
- *
342
- * @param key - The key to check.
343
- * @returns `true` if the key is a file, otherwise `false`.
344
- */
345
- isFileSync: (key: string) => boolean;
346
- /**
347
- * Gets the metadata of a file in the virtual file system (VFS).
348
- *
349
- * @param path - The path or id of the file.
350
- * @returns The metadata of the file if it exists, otherwise undefined.
351
- */
352
- getMetadata: (path: string) => VirtualFileMetadata | undefined;
353
- /**
354
- * Lists files in a given path.
355
- *
356
- * @param path - The path to list files from.
357
- * @returns An array of file names in the specified path.
358
- */
359
- listSync: (path: string) => string[];
360
- /**
361
- * Lists files in a given path.
362
- *
363
- * @param path - The path to list files from.
364
- * @returns An array of file names in the specified path.
365
- */
366
- list: (path: string) => Promise<string[]>;
367
- /**
368
- * Removes a file or symbolic link in the virtual file system (VFS).
369
- *
370
- * @param path - The path to the file to remove.
371
- * @returns A promise that resolves when the file is removed.
372
- */
373
- removeSync: (path: string) => void;
374
- /**
375
- * Asynchronously removes a file or symbolic link in the virtual file system (VFS).
376
- *
377
- * @param path - The path to the file to remove.
378
- * @returns A promise that resolves when the file is removed.
379
- */
380
- remove: (path: string) => Promise<void>;
381
- /**
382
- * Reads a file from the virtual file system (VFS).
383
- *
384
- * @param path - The path or id of the file.
385
- * @returns The contents of the file if it exists, otherwise undefined.
386
- */
387
- read: (path: string) => Promise<string | undefined>;
388
- /**
389
- * Reads a file from the virtual file system (VFS).
390
- *
391
- * @param path - The path or id of the file.
392
- */
393
- readSync: (path: string) => string | undefined;
394
- /**
395
- * Writes a file to the virtual file system (VFS).
396
- *
397
- * @param path - The path to the file.
398
- * @param data - The contents of the file.
399
- * @param options - Options for writing the file.
400
- * @returns A promise that resolves when the file is written.
401
- */
402
- write: (path: string, data: string, options?: WriteOptions) => Promise<void>;
403
- /**
404
- * Writes a file to the virtual file system (VFS).
405
- *
406
- * @param path - The path to the file.
407
- * @param data - The contents of the file.
408
- * @param options - Options for writing the file.
409
- */
410
- writeSync: (path: string, data: string, options?: WriteOptions) => void;
411
- /**
412
- * Creates a directory at the specified path.
413
- *
414
- * @param dirPath - The path of the directory to create.
415
- */
416
- mkdir: (dirPath: string) => Promise<void>;
417
- /**
418
- * Synchronously creates a directory at the specified path.
419
- *
420
- * @param dirPath - The path of the directory to create.
421
- */
422
- mkdirSync: (dirPath: string) => void;
423
- /**
424
- * Moves a file from one path to another in the virtual file system (VFS).
425
- *
426
- * @param srcPath - The source path to move
427
- * @param destPath - The destination path to move to
428
- */
429
- move: (srcPath: string, destPath: string) => Promise<void>;
430
- /**
431
- * Synchronously moves a file from one path to another in the virtual file system (VFS).
432
- *
433
- * @param srcPath - The source path to move
434
- * @param destPath - The destination path to move to
435
- */
436
- moveSync: (srcPath: string, destPath: string) => void;
437
- /**
438
- * Copies a file from one path to another in the virtual file system (VFS).
439
- *
440
- * @param srcPath - The source path to copy
441
- * @param destPath - The destination path to copy to
442
- */
443
- copy: (srcPath: string | URL | Omit<AssetGlob, "output">, destPath: string | URL) => Promise<void>;
444
- /**
445
- * Synchronously copies a file from one path to another in the virtual file system (VFS).
446
- *
447
- * @param srcPath - The source path to copy
448
- * @param destPath - The destination path to copy to
449
- */
450
- copySync: (srcPath: string | URL | Omit<AssetGlob, "output">, destPath: string | URL) => void;
451
- /**
452
- * Glob files in the virtual file system (VFS) based on the provided pattern(s).
453
- *
454
- * @param pattern - A pattern (or multiple patterns) to use to determine the file paths to return
455
- * @returns An array of file paths matching the provided pattern(s)
456
- */
457
- glob: (patterns: string | Omit<AssetGlob, "output"> | (string | Omit<AssetGlob, "output">)[]) => Promise<string[]>;
458
- /**
459
- * Synchronously glob files in the virtual file system (VFS) based on the provided pattern(s).
460
- *
461
- * @param pattern - A pattern (or multiple patterns) to use to determine the file paths to return
462
- * @returns An array of file paths matching the provided pattern(s)
463
- */
464
- globSync: (patterns: string | Omit<AssetGlob, "output"> | (string | Omit<AssetGlob, "output">)[]) => string[];
465
- /**
466
- * A helper function to resolve modules using the Jiti resolver
467
- *
468
- * @remarks
469
- * This function can be used to resolve modules relative to the project root directory.
470
- *
471
- * @example
472
- * ```ts
473
- * const resolvedPath = await context.resolve("some-module", "/path/to/importer");
474
- * ```
475
- *
476
- * @param id - The module to resolve.
477
- * @param importer - An optional path to the importer module.
478
- * @param options - Additional resolution options.
479
- * @returns A promise that resolves to the resolved module path.
480
- */
481
- resolve: (id: string, importer?: string, options?: ResolveOptions$1) => Promise<string | undefined>;
482
- /**
483
- * A synchronous helper function to resolve modules using the Jiti resolver
484
- *
485
- * @remarks
486
- * This function can be used to resolve modules relative to the project root directory.
487
- *
488
- * @example
489
- * ```ts
490
- * const resolvedPath = context.resolveSync("some-module", "/path/to/importer");
491
- * ```
492
- *
493
- * @param id - The module to resolve.
494
- * @param importer - An optional path to the importer module.
495
- * @param options - Additional resolution options.
496
- * @returns The resolved module path.
497
- */
498
- resolveSync: (id: string, importer?: string, options?: ResolveOptions$1) => string | undefined;
499
- /**
500
- * Resolves a given module ID using the configured aliases.
501
- *
502
- * @remarks
503
- * This function can be used to map module IDs to different paths based on the alias configuration.
504
- *
505
- * @param id - The module ID to resolve.
506
- * @returns The resolved module ID - after applying any configured aliases (this will be the same as the input ID if no aliases match).
507
- */
508
- resolveAlias: (id: string) => string;
509
- /**
510
- * Disposes of the virtual file system (VFS), writes any virtual file changes to disk, and releases any associated resources.
511
- */
512
- dispose: () => Promise<void>;
513
- }
514
- //#endregion
515
- //#region ../core/src/constants/commands.d.ts
516
- declare const SUPPORTED_COMMANDS: readonly ["new", "clean", "prepare", "lint", "test", "build", "docs", "deploy", "finalize"];
517
- //#endregion
518
- //#region ../core/src/types/commands.d.ts
519
- type CommandType = ArrayValues<typeof SUPPORTED_COMMANDS>;
520
- //#endregion
521
- //#region ../core/src/types/api.d.ts
522
- /**
523
- * Powerlines API Interface
524
- */
525
- interface API<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
526
- /**
527
- * The Powerlines shared API context
528
- */
529
- context: APIContext<TResolvedConfig>;
530
- /**
531
- * Prepare the Powerlines API
532
- *
533
- * @remarks
534
- * This method will prepare the Powerlines API for use, initializing any necessary resources.
535
- *
536
- * @param inlineConfig - The inline configuration for the prepare command
537
- */
538
- prepare: (inlineConfig: PrepareInlineConfig | NewInlineConfig | CleanInlineConfig | BuildInlineConfig | LintInlineConfig | DocsInlineConfig | DeployInlineConfig) => Promise<void>;
539
- /**
540
- * Create a new Powerlines project
541
- *
542
- * @remarks
543
- * This method will create a new Powerlines project in the current directory.
544
- *
545
- * @param inlineConfig - The inline configuration for the new command
546
- * @returns A promise that resolves when the project has been created
547
- */
548
- new: (inlineConfig: NewInlineConfig) => Promise<void>;
549
- /**
550
- * Clean any previously prepared artifacts
551
- *
552
- * @remarks
553
- * This method will remove the previous Powerlines artifacts from the project.
554
- *
555
- * @param inlineConfig - The inline configuration for the clean command
556
- * @returns A promise that resolves when the clean command has completed
557
- */
558
- clean: (inlineConfig: CleanInlineConfig | PrepareInlineConfig) => Promise<void>;
559
- /**
560
- * Lint the project source code
561
- *
562
- * @param inlineConfig - The inline configuration for the lint command
563
- * @returns A promise that resolves when the lint command has completed
564
- */
565
- lint: (inlineConfig: LintInlineConfig) => Promise<void>;
566
- /**
567
- * Build the project
568
- *
569
- * @remarks
570
- * This method will build the Powerlines project, generating the necessary artifacts.
571
- *
572
- * @param inlineConfig - The inline configuration for the build command
573
- * @returns A promise that resolves when the build command has completed
574
- */
575
- build: (inlineConfig: BuildInlineConfig) => Promise<void>;
576
- /**
577
- * Prepare the documentation for the project
578
- *
579
- * @param inlineConfig - The inline configuration for the docs command
580
- * @returns A promise that resolves when the documentation generation has completed
581
- */
582
- docs: (inlineConfig: DocsInlineConfig) => Promise<void>;
583
- /**
584
- * Deploy the project source code
585
- *
586
- * @remarks
587
- * This method will prepare and build the Powerlines project, generating the necessary artifacts for the deployment.
588
- *
589
- * @param inlineConfig - The inline configuration for the deploy command
590
- */
591
- deploy: (inlineConfig: DeployInlineConfig) => Promise<void>;
592
- /**
593
- * Finalization process
594
- *
595
- * @remarks
596
- * This step includes any final processes or clean up required by Powerlines. It will be run after each Powerlines command.
597
- *
598
- * @returns A promise that resolves when the finalization process has completed
599
- */
600
- finalize: () => Promise<void>;
601
- /**
602
- * Invokes the configured plugin hooks
603
- *
604
- * @remarks
605
- * By default, it will call the `"pre"`, `"normal"`, and `"post"` ordered hooks in sequence
606
- *
607
- * @param hook - The hook to call
608
- * @param options - The options to provide to the hook
609
- * @param args - The arguments to pass to the hook
610
- * @returns The result of the hook call
611
- */
612
- callHook: <TKey$1 extends string>(hook: TKey$1, options: CallHookOptions & {
613
- environment?: string | EnvironmentContext<TResolvedConfig>;
614
- }, ...args: InferHookParameters<PluginContext<TResolvedConfig>, TKey$1>) => Promise<InferHookReturnType<PluginContext<TResolvedConfig>, TKey$1> | undefined>;
615
- }
616
- //#endregion
617
- //#region ../core/src/types/unplugin.d.ts
618
- type UnpluginBuilderVariant = "rollup" | "webpack" | "rspack" | "vite" | "esbuild" | "farm" | "unloader" | "rolldown" | "bun";
619
- type BuilderVariant = UnpluginBuilderVariant | "tsup" | "tsdown" | "unbuild";
620
- type InferUnpluginVariant<TBuildVariant extends BuilderVariant> = TBuildVariant extends "tsup" ? "esbuild" : TBuildVariant extends "tsdown" ? "rolldown" : TBuildVariant extends "unbuild" ? "rollup" : TBuildVariant;
621
- interface UnpluginOptions$1<TContext extends Context = Context> extends UnpluginOptions {
622
- /**
623
- * An API object that can be used for inter-plugin communication.
624
- *
625
- * @see https://rollupjs.org/plugin-development/#direct-plugin-communication
626
- */
627
- api: API<TContext["config"]>;
628
- }
629
- type InferUnpluginOptions<TContext extends Context = Context, TBuilderVariant$1 extends BuilderVariant = BuilderVariant, TUnpluginVariant extends InferUnpluginVariant<TBuilderVariant$1> = InferUnpluginVariant<TBuilderVariant$1>> = { [TKey in keyof Required<UnpluginOptions$1<TContext>>[TUnpluginVariant]]?: Required<UnpluginOptions$1<TContext>>[TUnpluginVariant][TKey] extends infer THandler | {
630
- handler: infer THandler;
631
- } ? THandler extends ((this: infer TOriginalContext, ...args: infer TArgs) => infer TReturn) ? PluginHook<(this: TOriginalContext & TContext, ...args: TArgs) => MaybePromise<TReturn>, keyof HookFilter> : Required<UnpluginOptions$1<TContext>>[TUnpluginVariant][TKey] : Required<UnpluginOptions$1<TContext>>[TUnpluginVariant][TKey] };
632
- //#endregion
633
- //#region ../core/src/types/plugin.d.ts
634
- interface PluginHookObject<THookFunction extends AnyFunction, TFilter extends keyof HookFilter = never> {
635
- /**
636
- * The order in which the plugin should be applied.
637
- */
638
- order?: "pre" | "post" | null | undefined;
639
- /**
640
- * A filter to determine when the hook should be called.
641
- */
642
- filter?: Pick<HookFilter, TFilter>;
643
- /**
644
- * The hook function to be called.
645
- */
646
- handler: THookFunction;
647
- }
648
- type PluginHook<THookFunction extends AnyFunction, TFilter extends keyof HookFilter = never> = THookFunction | PluginHookObject<THookFunction, TFilter>;
649
- /**
650
- * A result returned by the plugin from the `types` hook that describes the declaration types output file.
651
- */
652
- interface TypesResult {
653
- directives?: string[];
654
- code: string;
655
- }
656
- interface Hooks<TContext extends PluginContext> {
657
- /**
658
- * A function that returns configuration options to be merged with the build context's options.
659
- *
660
- * @remarks
661
- * Modify config before it's resolved. The hook can either mutate {@link Context.config} on the passed-in context directly, or return a partial config object that will be deeply merged into existing config.
662
- *
663
- * @warning User plugins are resolved before running this hook so injecting other plugins inside the config hook will have no effect.
664
- *
665
- * @see https://vitejs.dev/guide/api-plugin#config
666
- *
667
- * @param this - The build context.
668
- * @param config - The partial configuration object to be modified.
669
- * @returns A promise that resolves to a partial configuration object.
670
- */
671
- config: (this: UnresolvedContext<TContext["config"]>) => MaybePromise<DeepPartial$1<TContext["config"]> & Record<string, any>>;
672
- /**
673
- * Modify environment configs before it's resolved. The hook can either mutate the passed-in environment config directly, or return a partial config object that will be deeply merged into existing config.
674
- *
675
- * @remarks
676
- * This hook is called for each environment with a partially resolved environment config that already accounts for the default environment config values set at the root level. If plugins need to modify the config of a given environment, they should do it in this hook instead of the config hook. Leaving the config hook only for modifying the root default environment config.
677
- *
678
- * @see https://vitejs.dev/guide/api-plugin#configenvironment
679
- *
680
- * @param this - The build context.
681
- * @param name - The name of the environment being configured.
682
- * @param environment - The Vite-like environment object containing information about the current build environment.
683
- * @returns A promise that resolves when the hook is complete.
684
- */
685
- configEnvironment: (this: TContext, name: string, environment: EnvironmentConfig) => MaybePromise<Partial<EnvironmentResolvedConfig> | undefined | null>;
686
- /**
687
- * A hook that is called when the plugin is resolved.
688
- *
689
- * @see https://vitejs.dev/guide/api-plugin#configresolved
690
- *
691
- * @param this - The build context.
692
- * @returns A promise that resolves when the hook is complete.
693
- */
694
- configResolved: (this: TContext) => MaybePromise<void>;
695
- /**
696
- * A hook that is called to overwrite the generated declaration types file (.d.ts). The generated type definitions should describe the built-in modules/logic added during the `prepare` task.
697
- *
698
- * @param this - The build context.
699
- * @param code - The source code to generate types for.
700
- * @returns A promise that resolves when the hook is complete.
701
- */
702
- types: (this: TContext, code: string) => MaybePromise<TypesResult | string | undefined | null>;
703
- /**
704
- * A hook that is called at the start of the build process.
705
- *
706
- * @param this - The build context and unplugin build context.
707
- * @returns A promise that resolves when the hook is complete.
708
- */
709
- buildStart: (this: BuildPluginContext<TContext["config"]> & TContext) => MaybePromise<void>;
710
- /**
711
- * A hook that is called at the end of the build process.
712
- *
713
- * @param this - The build context and unplugin build context.
714
- * @returns A promise that resolves when the hook is complete.
715
- */
716
- buildEnd: (this: BuildPluginContext<TContext["config"]> & TContext) => MaybePromise<void>;
717
- /**
718
- * A hook that is called to transform the source code.
719
- *
720
- * @param this - The build context, unplugin build context, and unplugin context.
721
- * @param code - The source code to transform.
722
- * @param id - The identifier of the source code.
723
- * @returns A promise that resolves when the hook is complete.
724
- */
725
- transform: (this: BuildPluginContext<TContext["config"]> & TContext, code: string, id: string) => MaybePromise<TransformResult>;
726
- /**
727
- * A hook that is called to load the source code.
728
- *
729
- * @param this - The build context, unplugin build context, and unplugin context.
730
- * @param id - The identifier of the source code.
731
- * @returns A promise that resolves when the hook is complete.
732
- */
733
- load: (this: BuildPluginContext<TContext["config"]> & TContext, id: string) => MaybePromise<LoadResult>;
734
- /**
735
- * A hook that is called to resolve the identifier of the source code.
736
- *
737
- * @param this - The build context, unplugin build context, and unplugin context.
738
- * @param id - The identifier of the source code.
739
- * @param importer - The importer of the source code.
740
- * @param options - The options for resolving the identifier.
741
- * @returns A promise that resolves when the hook is complete.
742
- */
743
- resolveId: (this: BuildPluginContext<TContext["config"]> & TContext, id: string, importer: string | undefined, options: {
744
- isEntry: boolean;
745
- }) => MaybePromise<string | ResolveResult | null | undefined>;
746
- /**
747
- * A hook that is called to write the bundle to disk.
748
- *
749
- * @param this - The build context.
750
- * @returns A promise that resolves when the hook is complete.
751
- */
752
- writeBundle: (this: TContext) => MaybePromise<void>;
753
- }
754
- type PluginHookFunctions<TContext extends PluginContext> = { [TCommandType in CommandType]: (this: TContext) => MaybePromise<void> } & Hooks<TContext>;
755
- type PluginHooks<TContext extends PluginContext> = { [TPluginHook in keyof PluginHookFunctions<TContext>]?: PluginHook<PluginHookFunctions<TContext>[TPluginHook]> } & {
756
- transform: PluginHook<PluginHookFunctions<TContext>["transform"], "code" | "id">;
757
- load: PluginHook<PluginHookFunctions<TContext>["load"], "id">;
758
- resolveId: PluginHook<PluginHookFunctions<TContext>["resolveId"], "id">;
759
- };
760
- type DeepPartial$1<T> = { [K in keyof T]?: DeepPartial$1<T[K]> };
761
- type Plugin<TContext extends PluginContext<ResolvedConfig> = PluginContext<ResolvedConfig>> = Partial<PluginHooks<TContext>> & {
762
- /**
763
- * The name of the plugin, for use in deduplication, error messages and logs.
764
- */
765
- name: string;
766
- /**
767
- * An API object that can be used for inter-plugin communication.
768
- *
769
- * @see https://rollupjs.org/plugin-development/#direct-plugin-communication
770
- */
771
- api?: Record<string, any>;
772
- /**
773
- * Enforce plugin invocation tier similar to webpack loaders. Hooks ordering is still subject to the `order` property in the hook object.
774
- *
775
- * @remarks
776
- * The Plugin invocation order is as follows:
777
- * - `enforce: 'pre'` plugins
778
- * - `order: 'pre'` plugin hooks
779
- * - any other plugins (normal)
780
- * - `order: 'post'` plugin hooks
781
- * - `enforce: 'post'` plugins
782
- *
783
- * @see https://vitejs.dev/guide/api-plugin.html#plugin-ordering
784
- * @see https://rollupjs.org/plugin-development/#build-hooks
785
- * @see https://webpack.js.org/concepts/loaders/#enforce---pre-and-post
786
- * @see https://esbuild.github.io/plugins/#concepts
787
- */
788
- enforce?: "pre" | "post";
789
- /**
790
- * A function to determine if two plugins are the same and can be de-duplicated.
791
- *
792
- * @remarks
793
- * If this is not provided, plugins are de-duplicated by comparing their names.
794
- *
795
- * @param other - The other plugin to compare against.
796
- * @returns `true` if the two plugins are the same, `false` otherwise.
797
- */
798
- dedupe?: false | ((other: Plugin<any>) => boolean);
799
- /**
800
- * A list of pre-requisite plugins that must be loaded before this plugin can be used.
801
- */
802
- /**
803
- * Define environments where this plugin should be active. By default, the plugin is active in all environments.
804
- *
805
- * @param environment - The environment to check.
806
- * @returns `true` if the plugin should be active in the specified environment, `false` otherwise.
807
- */
808
- applyToEnvironment?: (environment: EnvironmentResolvedConfig) => boolean | PluginConfig<TContext>;
809
- /**
810
- * A function that returns configuration options to be merged with the build context's options.
811
- *
812
- * @remarks
813
- * Modify config before it's resolved. The hook can either mutate {@link Context.config} on the passed-in context directly, or return a partial config object that will be deeply merged into existing config.
814
- *
815
- * @warning User plugins are resolved before running this hook so injecting other plugins inside the config hook will have no effect. If you want to add plugins, consider doing so in the {@link Plugin.dependsOn} property instead.
816
- *
817
- * @see https://vitejs.dev/guide/api-plugin#config
818
- *
819
- * @param this - The build context.
820
- * @param config - The partial configuration object to be modified.
821
- * @returns A promise that resolves to a partial configuration object.
822
- */
823
- config?: PluginHook<(this: UnresolvedContext<TContext["config"]>) => MaybePromise<DeepPartial$1<TContext["config"]> & Record<string, any>>> | (DeepPartial$1<TContext["config"]> & Record<string, any>);
824
- } & { [TBuilderVariant in BuilderVariant]?: InferUnpluginOptions<TContext, TBuilderVariant> };
825
- type PluginHookFields<TContext extends PluginContext = PluginContext> = keyof PluginHookFunctions<TContext>;
826
- //#endregion
827
- //#region ../core/src/types/hooks.d.ts
828
- type HookListOrders = "preOrdered" | "preEnforced" | "normal" | "postEnforced" | "postOrdered";
829
- type UnpluginHookFunctions<TContext extends PluginContext = PluginContext, TUnpluginBuilderVariant$1 extends UnpluginBuilderVariant = UnpluginBuilderVariant, TField$1 extends keyof Required<UnpluginOptions>[TUnpluginBuilderVariant$1] = keyof Required<UnpluginOptions>[TUnpluginBuilderVariant$1]> = Required<UnpluginOptions>[TUnpluginBuilderVariant$1][TField$1] extends infer THandler | {
830
- handler: infer THandler;
831
- } ? THandler extends ((this: infer THandlerOriginalContext, ...args: infer THandlerArgs) => infer THandlerReturn) ? (this: THandlerOriginalContext & WithUnpluginBuildContext<TContext>, ...args: THandlerArgs) => THandlerReturn : THandler extends {
832
- handler: infer THandlerFunction;
833
- } ? THandlerFunction extends ((this: infer THandlerFunctionOriginalContext, ...args: infer THandlerFunctionArgs) => infer THandlerFunctionReturn) ? (this: THandlerFunctionOriginalContext & WithUnpluginBuildContext<TContext>, ...args: THandlerFunctionArgs) => THandlerFunctionReturn : never : never : never;
834
- interface PluginHooksListItem<TContext extends PluginContext = PluginContext, TFields extends PluginHookFields<TContext> = PluginHookFields<TContext>> {
835
- plugin: Plugin<TContext>;
836
- handler: PluginHookFunctions<TContext>[TFields];
837
- }
838
- type PluginHooksList<TContext extends PluginContext = PluginContext, TFields extends PluginHookFields<TContext> = PluginHookFields<TContext>> = { [TKey in HookListOrders]?: PluginHooksListItem<TContext, TFields>[] | undefined };
839
- interface UnpluginHooksListItem<TContext extends PluginContext = PluginContext, TUnpluginBuilderVariant$1 extends UnpluginBuilderVariant = UnpluginBuilderVariant, TField$1 extends keyof Required<UnpluginOptions>[TUnpluginBuilderVariant$1] = keyof Required<UnpluginOptions>[TUnpluginBuilderVariant$1]> {
840
- plugin: Plugin<TContext>;
841
- handler: UnpluginHookFunctions<TContext, TUnpluginBuilderVariant$1, TField$1>;
842
- }
843
- type UnpluginHookList<TContext extends PluginContext = PluginContext, TUnpluginBuilderVariant$1 extends UnpluginBuilderVariant = UnpluginBuilderVariant, TField$1 extends keyof UnpluginOptions[TUnpluginBuilderVariant$1] = keyof UnpluginOptions[TUnpluginBuilderVariant$1]> = { [TKey in HookListOrders]?: UnpluginHooksListItem<TContext, TUnpluginBuilderVariant$1, TField$1>[] | undefined };
844
- type UnpluginHookVariantField<TContext extends PluginContext = PluginContext, TUnpluginBuilderVariant$1 extends UnpluginBuilderVariant = UnpluginBuilderVariant> = { [TKey in keyof UnpluginOptions[TUnpluginBuilderVariant$1]]?: UnpluginHookList<TContext, TUnpluginBuilderVariant$1, TKey> };
845
- type UnpluginHookVariant<TContext extends PluginContext = PluginContext> = { [TKey in UnpluginBuilderVariant]?: UnpluginHookVariantField<TContext, TKey> };
846
- type HookFields<TContext extends PluginContext = PluginContext> = PluginHookFields<TContext> | UnpluginBuilderVariant;
847
- type HooksList<TContext extends PluginContext = PluginContext> = { [TField in HookFields<TContext>]?: TField extends PluginHookFields<TContext> ? PluginHooksList<TContext, TField> : TField extends UnpluginBuilderVariant ? UnpluginHookVariant<TContext>[TField] : never };
848
- type InferHooksListItem<TContext extends PluginContext, TKey$1 extends string> = TKey$1 extends `${infer TUnpluginBuilderVariant}:${infer TUnpluginField}` ? TUnpluginBuilderVariant extends UnpluginBuilderVariant ? TUnpluginField extends keyof Required<UnpluginOptions>[TUnpluginBuilderVariant] ? UnpluginHooksListItem<TContext, TUnpluginBuilderVariant, TUnpluginField> : never : never : TKey$1 extends keyof PluginHookFunctions<TContext> ? PluginHooksListItem<TContext, TKey$1> : never;
849
- type InferHookFunction<TContext extends PluginContext, TKey$1 extends string> = TKey$1 extends `${infer TUnpluginBuilderVariant}:${infer TUnpluginField}` ? TUnpluginBuilderVariant extends UnpluginBuilderVariant ? TUnpluginField extends keyof Required<UnpluginOptions>[TUnpluginBuilderVariant] ? UnpluginHookFunctions<TContext, TUnpluginBuilderVariant, TUnpluginField> : never : never : TKey$1 extends keyof PluginHookFunctions<TContext> ? PluginHookFunctions<TContext>[TKey$1] : never;
850
- type InferHookReturnType<TContext extends PluginContext, TKey$1 extends string> = ReturnType<InferHookFunction<TContext, TKey$1>>;
851
- type InferHookParameters<TContext extends PluginContext, TKey$1 extends string> = Parameters<InferHookFunction<TContext, TKey$1>>;
852
- type CallHookOptions = SelectHooksOptions & (({
853
- /**
854
- * Whether to call the hooks sequentially or in parallel.
855
- *
856
- * @defaultValue true
857
- */
858
- sequential?: true;
859
- } & ({
860
- /**
861
- * How to handle multiple return values from hooks.
862
- * - "merge": Merge all non-undefined return values (if they are objects).
863
- * - "first": Return the first non-undefined value.
864
- * - "last": Return the last non-undefined value.
865
- *
866
- * @remarks
867
- * Merging only works if the return values are objects.
868
- *
869
- * @defaultValue "merge"
870
- */
871
- result: "first";
872
- } | ({
873
- /**
874
- * An indicator specifying if the results of the previous hook should be provided as the **first** parameter of the next hook function, or a function to process the result of the previous hook function and pass the returned value as the next hook's **first** parameter
875
- */
876
- asNextParam?: false | ((previousResult: any) => MaybePromise<any>);
877
- } & ({
878
- /**
879
- * How to handle multiple return values from hooks.
880
- * - "merge": Merge all non-undefined return values (if they are objects).
881
- * - "first": Return the first non-undefined value.
882
- * - "last": Return the last non-undefined value.
883
- *
884
- * @remarks
885
- * Merging only works if the return values are objects.
886
- *
887
- * @defaultValue "merge"
888
- */
889
- result?: "merge";
890
- /**
891
- * A custom function to merge multiple return values from hooks.
892
- *
893
- * @remarks
894
- * If not provided, the {@link mergeResults} function will be used by default, which merges string results by concatenation and object results by deep merging.
895
- *
896
- * @param currentResult - The current hook result to merge with the previous results.
897
- * @param previousResults - The previous hook results to merge with the current result.
898
- * @returns The merged result.
899
- */
900
- merge?: <T>(currentResult: T, previousResults: T[]) => T[];
901
- } | {
902
- /**
903
- * How to handle multiple return values from hooks.
904
- * - "merge": Merge all non-undefined return values (if they are objects).
905
- * - "first": Return the first non-undefined value.
906
- * - "last": Return the last non-undefined value.
907
- *
908
- * @remarks
909
- * Merging only works if the return values are objects.
910
- *
911
- * @defaultValue "merge"
912
- */
913
- result?: "last";
914
- })))) | {
915
- /**
916
- * Whether to call the hooks sequentially or in parallel.
917
- */
918
- sequential: false;
919
- });
920
- //#endregion
921
- //#region ../core/src/types/tsconfig.d.ts
922
- type ReflectionMode = "default" | "explicit" | "never";
923
- type RawReflectionMode = ReflectionMode | "" | boolean | string | string[] | undefined;
924
- /**
925
- * Defines the level of reflection to be used during the transpilation process.
926
- *
927
- * @remarks
928
- * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
929
- * - `minimal` - Only the essential type information is captured.
930
- * - `normal` - Additional type information is captured, including some contextual data.
931
- * - `verbose` - All available type information is captured, including detailed contextual data.
932
- */
933
- type ReflectionLevel = "minimal" | "normal" | "verbose";
934
- interface DeepkitOptions {
935
- /**
936
- * Either true to activate reflection for all files compiled using this tsconfig,
937
- * or a list of globs/file paths relative to this tsconfig.json.
938
- * Globs/file paths can be prefixed with a ! to exclude them.
939
- */
940
- reflection?: RawReflectionMode;
941
- /**
942
- * Defines the level of reflection to be used during the transpilation process.
943
- *
944
- * @remarks
945
- * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
946
- * - `minimal` - Only the essential type information is captured.
947
- * - `normal` - Additional type information is captured, including some contextual data.
948
- * - `verbose` - All available type information is captured, including detailed contextual data.
949
- */
950
- reflectionLevel?: ReflectionLevel;
951
- }
952
- type TSCompilerOptions = CompilerOptions & DeepkitOptions;
953
- /**
954
- * The TypeScript compiler configuration.
955
- *
956
- * @see https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
957
- */
958
- interface TSConfig extends Omit<TsConfigJson, "reflection"> {
959
- /**
960
- * Either true to activate reflection for all files compiled using this tsconfig,
961
- * or a list of globs/file paths relative to this tsconfig.json.
962
- * Globs/file paths can be prefixed with a ! to exclude them.
963
- */
964
- reflection?: RawReflectionMode;
965
- /**
966
- * Defines the level of reflection to be used during the transpilation process.
967
- *
968
- * @remarks
969
- * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
970
- * - `minimal` - Only the essential type information is captured.
971
- * - `normal` - Additional type information is captured, including some contextual data.
972
- * - `verbose` - All available type information is captured, including detailed contextual data.
973
- */
974
- reflectionLevel?: ReflectionLevel;
975
- /**
976
- * Instructs the TypeScript compiler how to compile `.ts` files.
977
- */
978
- compilerOptions?: TSCompilerOptions;
979
- }
980
- type ParsedTypeScriptConfig = ts.ParsedCommandLine & {
981
- originalTsconfigJson: TsConfigJson;
982
- tsconfigJson: TSConfig;
983
- tsconfigFilePath: string;
984
- };
985
- //#endregion
986
- //#region ../core/src/types/context.d.ts
987
- interface MetaInfo {
988
- /**
989
- * The checksum generated from the resolved options
990
- */
991
- checksum: string;
992
- /**
993
- * The build id
994
- */
995
- buildId: string;
996
- /**
997
- * The release id
998
- */
999
- releaseId: string;
1000
- /**
1001
- * The build timestamp
1002
- */
1003
- timestamp: number;
1004
- /**
1005
- * A hash that represents the path to the project root directory
1006
- */
1007
- rootHash: string;
1008
- /**
1009
- * A hash that represents the path to the configuration root directory
1010
- */
1011
- configHash: string;
1012
- }
1013
- interface Resolver extends Jiti {
1014
- plugin: Jiti;
1015
- }
1016
- interface TransformResult$1 {
1017
- code: string;
1018
- map: SourceMap | null;
1019
- }
1020
- interface SelectHooksOptions {
1021
- order?: "pre" | "post" | "normal";
1022
- }
1023
- /**
1024
- * Options for initializing or updating the context with new configuration values
1025
- */
1026
- interface InitContextOptions {
1027
- /**
1028
- * If false, the plugin will be loaded after all other plugins.
1029
- *
1030
- * @defaultValue true
1031
- */
1032
- isHighPriority: boolean;
1033
- }
1034
- /**
1035
- * Options for fetch requests made via the context's {@link Context.fetch} method
1036
- */
1037
- interface FetchOptions extends FetchRequestOptions {
1038
- /**
1039
- * An indicator specifying that the request should bypass any caching
1040
- */
1041
- skipCache?: boolean;
1042
- }
1043
- /**
1044
- * Options for parsing code using [Oxc-Parser](https://github.com/oxc/oxc)
1045
- */
1046
- interface ParseOptions extends ParserOptions {
1047
- /**
1048
- * When true this allows return statements to be outside functions to e.g. support parsing CommonJS code.
1049
- */
1050
- allowReturnOutsideFunction?: boolean;
1051
- }
1052
- interface EmitOptions extends WriteOptions {
1053
- /**
1054
- * The file extension to use when emitting the file
1055
- */
1056
- extension?: string;
1057
- /**
1058
- * If true, will emit the file using {@link UnpluginBuildContext.emitFile | the bundler's emit function}.
1059
- */
1060
- emitWithBundler?: boolean;
1061
- needsCodeReference?: Parameters<UnpluginBuildContext["emitFile"]>[0]["needsCodeReference"];
1062
- originalFileName?: Parameters<UnpluginBuildContext["emitFile"]>[0]["originalFileName"];
1063
- }
1064
- /**
1065
- * Options for emitting entry virtual files
1066
- */
1067
- type EmitEntryOptions = EmitOptions & Omit<ResolvedEntryTypeDefinition, "file">;
1068
- interface ResolveResult extends ExternalIdResult {
1069
- /**
1070
- * A flag indicating whether the resolved module is part of the generated runtime modules
1071
- */
1072
- virtual?: boolean;
1073
- }
1074
- /**
1075
- * The unresolved Powerlines context.
1076
- *
1077
- * @remarks
1078
- * This context is used before the user configuration has been fully resolved after the `config`.
1079
- */
1080
- interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
1081
- /**
1082
- * The Storm workspace configuration
1083
- */
1084
- workspaceConfig: WorkspaceConfig;
1085
- /**
1086
- * An object containing the options provided to Powerlines
1087
- */
1088
- config: Omit<TResolvedConfig["userConfig"], "output"> & Required<Pick<TResolvedConfig["userConfig"], "output">> & {
1089
- output: TResolvedConfig["output"];
1090
- };
1091
- /**
1092
- * A logging function for the Powerlines engine
1093
- */
1094
- log: LogFn;
1095
- /**
1096
- * A logging function for fatal messages
1097
- */
1098
- fatal: (message: string | UnpluginMessage) => void;
1099
- /**
1100
- * A logging function for error messages
1101
- */
1102
- error: (message: string | UnpluginMessage) => void;
1103
- /**
1104
- * A logging function for warning messages
1105
- */
1106
- warn: (message: string | UnpluginMessage) => void;
1107
- /**
1108
- * A logging function for informational messages
1109
- */
1110
- info: (message: string | UnpluginMessage) => void;
1111
- /**
1112
- * A logging function for debug messages
1113
- */
1114
- debug: (message: string | UnpluginMessage) => void;
1115
- /**
1116
- * A logging function for trace messages
1117
- */
1118
- trace: (message: string | UnpluginMessage) => void;
1119
- /**
1120
- * The metadata information
1121
- */
1122
- meta: MetaInfo;
1123
- /**
1124
- * The metadata information currently written to disk
1125
- */
1126
- persistedMeta?: MetaInfo;
1127
- /**
1128
- * The Powerlines artifacts directory
1129
- */
1130
- artifactsPath: string;
1131
- /**
1132
- * The path to the Powerlines builtin runtime modules directory
1133
- */
1134
- builtinsPath: string;
1135
- /**
1136
- * The path to the Powerlines entry modules directory
1137
- */
1138
- entryPath: string;
1139
- /**
1140
- * The path to the Powerlines infrastructure modules directory
1141
- */
1142
- infrastructurePath: string;
1143
- /**
1144
- * The path to the Powerlines TypeScript declaration files directory
1145
- */
1146
- dtsPath: string;
1147
- /**
1148
- * The path to a directory where the reflection data buffers (used by the build processes) are stored
1149
- */
1150
- dataPath: string;
1151
- /**
1152
- * The path to a directory where the project cache (used by the build processes) is stored
1153
- */
1154
- cachePath: string;
1155
- /**
1156
- * The Powerlines environment paths
1157
- */
1158
- envPaths: EnvPaths;
1159
- /**
1160
- * The file system path to the Powerlines package installation
1161
- */
1162
- powerlinesPath: string;
1163
- /**
1164
- * The relative path to the Powerlines workspace root directory
1165
- */
1166
- relativeToWorkspaceRoot: string;
1167
- /**
1168
- * The project's `package.json` file content
1169
- */
1170
- packageJson: PackageJson & Record<string, any>;
1171
- /**
1172
- * The project's `project.json` file content
1173
- */
1174
- projectJson?: Record<string, any>;
1175
- /**
1176
- * The dependency installations required by the project
1177
- */
1178
- dependencies: Record<string, string | Range>;
1179
- /**
1180
- * The development dependency installations required by the project
1181
- */
1182
- devDependencies: Record<string, string | Range>;
1183
- /**
1184
- * The parsed TypeScript configuration from the `tsconfig.json` file
1185
- */
1186
- tsconfig: ParsedTypeScriptConfig;
1187
- /**
1188
- * The entry points of the source code
1189
- */
1190
- entry: ResolvedEntryTypeDefinition[];
1191
- /**
1192
- * The virtual file system manager used during the build process to reference generated runtime files
1193
- */
1194
- fs: VirtualFileSystemInterface;
1195
- /**
1196
- * The Jiti module resolver
1197
- */
1198
- resolver: Resolver;
1199
- /**
1200
- * The builtin module id that exist in the Powerlines virtual file system
1201
- */
1202
- builtins: string[];
1203
- /**
1204
- * The alias mappings for the project used during module resolution
1205
- *
1206
- * @remarks
1207
- * This includes both the built-in module aliases as well as any custom aliases defined in the build configuration.
1208
- */
1209
- alias: Record<string, string>;
1210
- /**
1211
- * A function to perform HTTP fetch requests
1212
- *
1213
- * @remarks
1214
- * This function uses a caching layer to avoid duplicate requests during the Powerlines process.
1215
- *
1216
- * @example
1217
- * ```ts
1218
- * const response = await context.fetch("https://api.example.com/data");
1219
- * const data = await response.json();
1220
- * ```
1221
- *
1222
- * @see https://github.com/nodejs/undici
1223
- *
1224
- * @param input - The URL to fetch.
1225
- * @param options - The fetch request options.
1226
- * @returns A promise that resolves to a response returned by the fetch.
1227
- */
1228
- fetch: (input: RequestInfo, options?: FetchOptions) => Promise<Response>;
1229
- /**
1230
- * Parse code using [Oxc-Parser](https://github.com/oxc/oxc) into an (ESTree-compatible)[https://github.com/estree/estree] AST object.
1231
- *
1232
- * @remarks
1233
- * This function can be used to parse TypeScript code into an AST for further analysis or transformation.
1234
- *
1235
- * @example
1236
- * ```ts
1237
- * const ast = context.parse("const x: number = 42;");
1238
- * ```
1239
- *
1240
- * @see https://rollupjs.org/plugin-development/#this-parse
1241
- * @see https://github.com/oxc/oxc
1242
- *
1243
- * @param code - The source code to parse.
1244
- * @param options - The options to pass to the parser.
1245
- * @returns An (ESTree-compatible)[https://github.com/estree/estree] AST object.
1246
- */
1247
- parse: (code: string, options?: ParseOptions) => Promise<ParseResult>;
1248
- /**
1249
- * A helper function to resolve modules using the Jiti resolver
1250
- *
1251
- * @remarks
1252
- * This function can be used to resolve modules relative to the project root directory.
1253
- *
1254
- * @example
1255
- * ```ts
1256
- * const resolvedPath = await context.resolve("some-module", "/path/to/importer");
1257
- * ```
1258
- *
1259
- * @param id - The module to resolve.
1260
- * @param importer - An optional path to the importer module.
1261
- * @param options - Additional resolution options.
1262
- * @returns A promise that resolves to the resolved module path.
1263
- */
1264
- resolve: (id: string, importer?: string, options?: ResolveOptions$1) => Promise<ResolveResult | undefined>;
1265
- /**
1266
- * A helper function to load modules using the Jiti resolver
1267
- *
1268
- * @remarks
1269
- * This function can be used to load modules relative to the project root directory.
1270
- *
1271
- * @example
1272
- * ```ts
1273
- * const module = await context.load("some-module", "/path/to/importer");
1274
- * ```
1275
- *
1276
- * @param id - The module to load.
1277
- * @returns A promise that resolves to the loaded module.
1278
- */
1279
- load: (id: string) => Promise<TransformResult$1 | undefined>;
1280
- /**
1281
- * The Powerlines builtin virtual files
1282
- */
1283
- getBuiltins: () => Promise<VirtualFile[]>;
1284
- /**
1285
- * Resolves a file and writes it to the VFS if it does not already exist
1286
- *
1287
- * @param code - The source code of the file
1288
- * @param path - The path to write the file to
1289
- * @param options - Additional options for writing the file
1290
- */
1291
- emit: (code: string, path: string, options?: EmitOptions) => Promise<void>;
1292
- /**
1293
- * Synchronously resolves a file and writes it to the VFS if it does not already exist
1294
- *
1295
- * @param code - The source code of the file
1296
- * @param path - The path to write the file to
1297
- * @param options - Additional options for writing the file
1298
- */
1299
- emitSync: (code: string, path: string, options?: EmitOptions) => void;
1300
- /**
1301
- * Resolves a builtin virtual file and writes it to the VFS if it does not already exist
1302
- *
1303
- * @param code - The source code of the builtin file
1304
- * @param id - The unique identifier of the builtin file
1305
- * @param options - Additional options for writing the builtin file
1306
- */
1307
- emitBuiltin: (code: string, id: string, options?: EmitOptions) => Promise<void>;
1308
- /**
1309
- * Synchronously resolves a builtin virtual file and writes it to the VFS if it does not already exist
1310
- *
1311
- * @param code - The source code of the builtin file
1312
- * @param id - The unique identifier of the builtin file
1313
- * @param options - Additional options for writing the builtin file
1314
- */
1315
- emitBuiltinSync: (code: string, id: string, options?: EmitOptions) => void;
1316
- /**
1317
- * Resolves a entry virtual file and writes it to the VFS if it does not already exist
1318
- *
1319
- * @param code - The source code of the entry file
1320
- * @param path - An optional path to write the entry file to
1321
- * @param options - Additional options for writing the entry file
1322
- */
1323
- emitEntry: (code: string, path: string, options?: EmitEntryOptions) => Promise<void>;
1324
- /**
1325
- * Synchronously resolves a entry virtual file and writes it to the VFS if it does not already exist
1326
- *
1327
- * @param code - The source code of the entry file
1328
- * @param path - An optional path to write the entry file to
1329
- * @param options - Additional options for writing the entry file
1330
- */
1331
- emitEntrySync: (code: string, path: string, options?: EmitEntryOptions) => void;
1332
- /**
1333
- * Resolves a infrastructure virtual file and writes it to the VFS if it does not already exist
1334
- *
1335
- * @param code - The source code of the infrastructure file
1336
- * @param id - The unique identifier of the infrastructure file
1337
- * @param options - Additional options for writing the infrastructure file
1338
- */
1339
- emitInfrastructure: (code: string, id: string, options?: EmitOptions) => Promise<void>;
1340
- /**
1341
- * Synchronously resolves a infrastructure virtual file and writes it to the VFS if it does not already exist
1342
- *
1343
- * @param code - The source code of the infrastructure file
1344
- * @param id - The unique identifier of the infrastructure file
1345
- * @param options - Additional options for writing the infrastructure file
1346
- */
1347
- emitInfrastructureSync: (code: string, id: string, options?: EmitOptions) => void;
1348
- /**
1349
- * A function to update the context fields using a new user configuration options
1350
- */
1351
- withUserConfig: (userConfig: UserConfig, options?: InitContextOptions) => Promise<void>;
1352
- /**
1353
- * A function to update the context fields using inline configuration options
1354
- */
1355
- withInlineConfig: (inlineConfig: InlineConfig, options?: InitContextOptions) => Promise<void>;
1356
- /**
1357
- * Create a new logger instance
1358
- *
1359
- * @param name - The name to use for the logger instance
1360
- * @returns A logger function
1361
- */
1362
- createLog: (name: string | null) => LogFn;
1363
- /**
1364
- * Extend the current logger instance with a new name
1365
- *
1366
- * @param name - The name to use for the extended logger instance
1367
- * @returns A logger function
1368
- */
1369
- extendLog: (name: string) => LogFn;
1370
- /**
1371
- * Generates a checksum representing the current context state
1372
- *
1373
- * @returns A promise that resolves to a string representing the checksum
1374
- */
1375
- generateChecksum: () => Promise<string>;
1376
- }
1377
- type Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = Omit<UnresolvedContext<TResolvedConfig>, "config"> & {
1378
- /**
1379
- * The fully resolved Powerlines configuration
1380
- */
1381
- config: TResolvedConfig;
1382
- };
1383
- interface APIContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig> {
1384
- /**
1385
- * The expected plugins options for the Powerlines project.
1386
- *
1387
- * @remarks
1388
- * This is a record of plugin identifiers to their respective options. This field is populated by the Powerlines engine during both plugin initialization and the `init` command.
1389
- */
1390
- plugins: Plugin<PluginContext<TResolvedConfig>>[];
1391
- /**
1392
- * A function to add a plugin to the context and update the configuration options
1393
- */
1394
- addPlugin: (plugin: Plugin<PluginContext<TResolvedConfig>>) => Promise<void>;
1395
- /**
1396
- * A table for storing the current context for each configured environment
1397
- */
1398
- environments: Record<string, EnvironmentContext<TResolvedConfig>>;
1399
- /**
1400
- * Retrieves the context for a specific environment by name
1401
- *
1402
- * @throws Will throw an error if the environment does not exist
1403
- *
1404
- * @param name - The name of the environment to retrieve. If not provided, the default environment is returned.
1405
- * @returns A promise that resolves to the environment context.
1406
- *
1407
- * @example
1408
- * ```ts
1409
- * const devEnv = await apiContext.getEnvironment("development");
1410
- * const defaultEnv = await apiContext.getEnvironment();
1411
- * ```
1412
- */
1413
- getEnvironment: (name?: string) => Promise<EnvironmentContext<TResolvedConfig>>;
1414
- /**
1415
- * Safely retrieves the context for a specific environment by name
1416
- *
1417
- * @param name - The name of the environment to retrieve. If not provided, the default environment is returned.
1418
- * @returns A promise that resolves to the environment context, or undefined if the environment does not exist.
1419
- *
1420
- * @example
1421
- * ```ts
1422
- * const devEnv = await apiContext.getEnvironmentSafe("development");
1423
- * const defaultEnv = await apiContext.getEnvironmentSafe();
1424
- * ```
1425
- *
1426
- * @remarks
1427
- * This method is similar to `getEnvironment`, but it returns `undefined` instead of throwing an error if the specified environment does not exist.
1428
- * This can be useful in scenarios where the existence of an environment is optional or uncertain.
1429
- *
1430
- * ```ts
1431
- * const testEnv = await apiContext.getEnvironmentSafe("test");
1432
- * if (testEnv) {
1433
- * // Environment exists, safe to use it
1434
- * } else {
1435
- * // Environment does not exist, handle accordingly
1436
- * }
1437
- * ```
1438
- *
1439
- * Using this method helps avoid unhandled exceptions in cases where an environment might not be defined.
1440
- */
1441
- getEnvironmentSafe: (name?: string) => Promise<EnvironmentContext<TResolvedConfig> | undefined>;
1442
- /**
1443
- * A function to copy the context and update the fields for a specific environment
1444
- *
1445
- * @param environment - The environment configuration to use.
1446
- * @returns A new context instance with the updated environment.
1447
- */
1448
- in: (environment: EnvironmentResolvedConfig) => Promise<EnvironmentContext<TResolvedConfig>>;
1449
- /**
1450
- * A function to merge all configured environments into a single context
1451
- *
1452
- * @returns A promise that resolves to the merged environment context.
1453
- */
1454
- toEnvironment: () => Promise<EnvironmentContext<TResolvedConfig>>;
1455
- }
1456
- interface EnvironmentContextPlugin<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
1457
- plugin: Plugin<PluginContext<TResolvedConfig>>;
1458
- context: PluginContext<TResolvedConfig>;
1459
- }
1460
- type SelectHookResultItem<TContext extends PluginContext, TKey$1 extends string> = InferHooksListItem<TContext, TKey$1> & {
1461
- context: TContext;
1462
- };
1463
- type SelectHookResult<TContext extends PluginContext, TKey$1 extends string> = SelectHookResultItem<TContext, TKey$1>[];
1464
- interface EnvironmentContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig> {
1465
- /**
1466
- * The expected plugins options for the Powerlines project.
1467
- *
1468
- * @remarks
1469
- * This is a record of plugin identifiers to their respective options. This field is populated by the Powerlines engine during both plugin initialization and the `init` command.
1470
- */
1471
- plugins: EnvironmentContextPlugin<TResolvedConfig>[];
1472
- /**
1473
- * A function to add a plugin to the context and update the configuration options
1474
- */
1475
- addPlugin: (plugin: Plugin<PluginContext<TResolvedConfig>>) => Promise<void>;
1476
- /**
1477
- * The environment specific resolved configuration
1478
- */
1479
- environment: EnvironmentResolvedConfig;
1480
- /**
1481
- * A table holding references to hook functions registered by plugins
1482
- */
1483
- hooks: HooksList<PluginContext<TResolvedConfig>>;
1484
- /**
1485
- * Retrieves the hook handlers for a specific hook name
1486
- */
1487
- selectHooks: <TKey$1 extends string>(key: TKey$1, options?: SelectHooksOptions) => SelectHookResult<PluginContext<TResolvedConfig>, TKey$1>;
1488
- }
1489
- interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig>, UnpluginContext {
1490
- /**
1491
- * The environment specific resolved configuration
1492
- */
1493
- environment: EnvironmentResolvedConfig;
1494
- /**
1495
- * An alternative property name for the {@link log} property
1496
- *
1497
- * @remarks
1498
- * This is provided for compatibility with other logging libraries that expect a `logger` property.
1499
- */
1500
- logger: LogFn;
1501
- }
1502
- type BuildPluginContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = UnpluginBuildContext & PluginContext<TResolvedConfig>;
1503
- type WithUnpluginBuildContext<TContext extends PluginContext> = UnpluginBuildContext & TContext;
1504
- //#endregion
1505
- //#region ../core/src/types/config.d.ts
1506
- type LogLevel = "error" | "warn" | "info" | "debug" | "trace";
1507
- type LogFn = (type: LogLevelLabel, ...args: string[]) => void;
1508
- /**
1509
- * The {@link StormWorkspaceConfig | configuration} object for an entire Powerlines workspace
1510
- */
1511
- type WorkspaceConfig = Partial<StormWorkspaceConfig> & Required<Pick<StormWorkspaceConfig, "workspaceRoot">>;
1512
- type PluginFactory<in out TContext extends PluginContext = PluginContext, TOptions = any> = (options: TOptions) => MaybePromise<Plugin<TContext> | Plugin<TContext>[]>;
1513
- /**
1514
- * A configuration tuple for a Powerlines plugin.
1515
- */
1516
- type PluginConfigTuple<TContext extends PluginContext = PluginContext, TOptions = any> = [string | PluginFactory<TContext, TOptions>, TOptions] | [Plugin<TContext>];
1517
- /**
1518
- * A configuration object for a Powerlines plugin.
1519
- */
1520
- type PluginConfigObject<TContext extends PluginContext = PluginContext, TOptions = any> = {
1521
- plugin: string | PluginFactory<TContext, TOptions>;
1522
- options: TOptions;
1523
- } | {
1524
- plugin: Plugin<TContext>;
1525
- options?: never;
1526
- };
1527
- /**
1528
- * A configuration tuple for a Powerlines plugin.
1529
- */
1530
- type PluginConfig<TContext extends PluginContext = PluginContext> = string | PluginFactory<TContext, void> | Plugin<TContext> | PluginConfigTuple<TContext> | PluginConfigObject<TContext> | Promise<PluginConfig<TContext>> | PluginConfig<TContext>[];
1531
- type ProjectType = "application" | "library";
1532
- /**
1533
- * The configuration options for resolving modules in a Powerlines project.
1534
- */
1535
- interface ResolveConfig {
1536
- /**
1537
- * List of fields in `package.json` to try when resolving a package's entry point. Note this takes lower precedence than conditional exports resolved from the exports field: if an entry point is successfully resolved from exports, the main field will be ignored.
1538
- *
1539
- * @defaultValue `["browser", "module", "jsnext:main", "jsnext"]`
1540
- *
1541
- * @see https://vite.dev/config/shared-options#resolve-mainfields
1542
- */
1543
- mainFields?: string[];
1544
- /**
1545
- * Array of strings indicating what conditions should be allowed when resolving [conditional exports](https://nodejs.org/api/packages.html#packages_conditional_exports) from a package.
1546
- *
1547
- * @defaultValue `["import", "require", "default"]`
1548
- *
1549
- * @see https://vite.dev/config/shared-options#resolve-conditions
1550
- */
1551
- conditions?: string[];
1552
- /**
1553
- * List of file extensions to try for imports that omit extensions. Note it is NOT recommended to omit extensions for custom import types (e.g. .vue) since it can interfere with IDE and type support.
1554
- *
1555
- * @defaultValue `[".mjs", ".js", ".mts", ".ts", ".jsx", ".tsx", ".json"]`
1556
- *
1557
- * @see https://vite.dev/config/shared-options#resolve-extensions
1558
- */
1559
- extensions?: string[];
1560
- /**
1561
- * Array of strings indicating what modules should be deduplicated to a single version in the build.
1562
- *
1563
- * @remarks
1564
- * This option is useful for ensuring that only one version of a module is included in the bundle, which can help reduce bundle size and avoid conflicts. If you have duplicated copies of the same dependency in your app (likely due to hoisting or linked packages in monorepos), use this option to force Powerlines to always resolve listed dependencies to the same copy (from project root).
1565
- *
1566
- * @see https://vite.dev/config/shared-options#resolve-dedupe
1567
- */
1568
- dedupe?: string[];
1569
- /**
1570
- * The alias mappings to use for module resolution during the build process.
1571
- *
1572
- * @remarks
1573
- * This option allows you to define custom path aliases for modules, which can be useful for simplifying imports and managing dependencies.
1574
- *
1575
- * @example
1576
- * ```ts
1577
- * {
1578
- * alias: {
1579
- * "@utils": "./src/utils",
1580
- * "@components": "./src/components"
1581
- * }
1582
- * }
1583
- * ```
1584
- *
1585
- * @see https://vite.dev/config/shared-options#resolve-alias
1586
- * @see https://github.com/rollup/plugins/tree/master/packages/alias
1587
- */
1588
- alias?: Record<string, string> | Array<{
1589
- find: string | RegExp;
1590
- replacement: string;
1591
- }>;
1592
- /**
1593
- * Enabling this setting causes Powerlines to determine file identity by the original file path (i.e. the path without following symlinks) instead of the real file path (i.e. the path after following symlinks).
1594
- *
1595
- * @defaultValue false
1596
- *
1597
- * @see https://esbuild.github.io/api/#preserve-symlinks
1598
- * @see https://rollupjs.org/configuration-options/#preservesymlinks
1599
- * @see https://webpack.js.org/configuration/resolve/#resolvesymlinks
1600
- * @see https://rolldown.rs/reference/InputOptions.resolve#symlinks
1601
- * @see https://vite.dev/config/shared-options#resolve-preservesymlinks
1602
- */
1603
- preserveSymlinks?: boolean;
1604
- /**
1605
- * A list of modules that should not be bundled, even if they are external dependencies.
1606
- *
1607
- * @remarks
1608
- * This option is useful for excluding specific modules from the bundle, such as Node.js built-in modules or other libraries that should not be bundled.
1609
- */
1610
- external?: (string | RegExp)[];
1611
- /**
1612
- * A list of modules that should always be bundled, even if they are external dependencies.
1613
- */
1614
- noExternal?: (string | RegExp)[];
1615
- /**
1616
- * Should the Powerlines CLI processes skip bundling the `node_modules` directory?
1617
- */
1618
- skipNodeModulesBundle?: boolean;
1619
- }
1620
- interface OutputConfig {
1621
- /**
1622
- * The path to output the final compiled files to
1623
- *
1624
- * @remarks
1625
- * If a value is not provided, Powerlines will attempt to:
1626
- * 1. Use the `outDir` value in the `tsconfig.json` file.
1627
- * 2. Use the `dist` directory in the project root directory.
1628
- *
1629
- * @defaultValue "dist/\{projectRoot\}"
1630
- */
1631
- outputPath?: string;
1632
- /**
1633
- * The output directory path for the project build.
1634
- *
1635
- * @remarks
1636
- * This path is used to determine where the built files will be placed after the build process completes. This will be used in scenarios where the monorepo uses TSConfig paths to link packages together.
1637
- *
1638
- * @defaultValue "\{projectRoot\}/dist"
1639
- */
1640
- buildPath?: string;
1641
- /**
1642
- * The folder where the generated runtime artifacts will be located
1643
- *
1644
- * @remarks
1645
- * This folder will contain all runtime artifacts and builtins generated during the "prepare" phase.
1646
- *
1647
- * @defaultValue "\{projectRoot\}/.powerlines"
1648
- */
1649
- artifactsPath?: string;
1650
- /**
1651
- * The path of the generated runtime declaration file relative to the workspace root.
1652
- *
1653
- * @defaultValue "\{projectRoot\}/powerlines.d.ts"
1654
- */
1655
- dts?: string | false;
1656
- /**
1657
- * The module format of the output files
1658
- *
1659
- * @remarks
1660
- * This option can be a single format or an array of formats. If an array is provided, multiple builds will be generated for each format.
1661
- *
1662
- * @defaultValue "esm"
1663
- */
1664
- format?: Format | Format[];
1665
- /**
1666
- * Generate source maps for the output files
1667
- *
1668
- * @remarks
1669
- * This option can be a boolean or a string specifying the type of source map to generate. If set to `true`, external source maps will be generated. If set to `"inline"`, source maps will be included in the output files as data URIs. If set to `"hidden"`, external source maps will be generated but not referenced in the output files.
1670
- */
1671
- sourceMap?: boolean | "inline" | "hidden";
1672
- /**
1673
- * A list of assets to copy to the output directory
1674
- *
1675
- * @remarks
1676
- * The assets can be specified as a string (path to the asset) or as an object with a `glob` property (to match multiple files). The paths are relative to the project root directory.
1677
- */
1678
- assets?: Array<string | AssetGlob>;
1679
- /**
1680
- * Whether to overwrite previously generated files in the artifacts directory during the build process.
1681
- *
1682
- * @remarks
1683
- * When set to `true`, Powerlines will overwrite any existing files in the artifacts directory with the newly generated files during the build process. When set to `false`, Powerlines will skip generating files that already exist in the artifacts directory, which can help speed up the build process by avoiding unnecessary file writes. This option is only relevant when the {@link OutputConfig.storage | storage option} is configured to use an adapter that writes files to the local file system. If using a `virtual` storage adapter, this option has no effect.
1684
- *
1685
- * @defaultValue true
1686
- */
1687
- overwrite?: boolean;
1688
- /**
1689
- * A string preset or a custom {@link StoragePort} to provide fine-grained control over generated/output file storage.
1690
- *
1691
- * @remarks
1692
- * If a string preset is provided, it must be one of the following values:
1693
- * - `"fs"`: Uses the local file system for storage.
1694
- * - `"virtual"`: Uses an in-memory virtual file system for storage.
1695
- *
1696
- * If a custom {@link StoragePort} is provided, it will be used for all file storage operations during the build process.
1697
- *
1698
- * @defaultValue "virtual"
1699
- */
1700
- storage?: StoragePort | StoragePreset;
1701
- }
1702
- interface Config {
1703
- /**
1704
- * Defines entries and location(s) of entry modules for the bundle. Relative paths are resolved based on the `root` option.
1705
- */
1706
- input: TypeDefinitionParameter | TypeDefinitionParameter[] | Record<string, TypeDefinitionParameter | TypeDefinitionParameter[]>;
1707
- /**
1708
- * Configuration for the output files generated by processing the source code
1709
- */
1710
- output?: OutputConfig;
1711
- /**
1712
- * Configuration for module resolution during processing of the source code
1713
- */
1714
- resolve?: ResolveConfig;
1715
- /**
1716
- * The platform to build the project for
1717
- *
1718
- * @defaultValue "neutral"
1719
- */
1720
- platform?: "node" | "browser" | "neutral";
1721
- /**
1722
- * Define global constant replacements. Entries will be defined as globals during dev and statically replaced during build.
1723
- *
1724
- * @remarks
1725
- * This option allows you to specify global constants that will be replaced in the code during the build process. It is similar to the `define` option in esbuild and Vite, enabling you to replace specific identifiers with constant expressions at build time.
1726
- *
1727
- * @example
1728
- * ```ts
1729
- * {
1730
- * define: {
1731
- * __VERSION__: '"1.0.0"',
1732
- * __DEV__: 'process.env.NODE_ENV !== "production"'
1733
- * }
1734
- * }
1735
- * ```
1736
- *
1737
- * @see https://esbuild.github.io/api/#define
1738
- * @see https://vitejs.dev/config/build-options.html#define
1739
- * @see https://github.com/rollup/plugins/tree/master/packages/replace
1740
- */
1741
- define?: Record<string, any>;
1742
- /**
1743
- * Global variables that will have import statements injected where necessary
1744
- *
1745
- * @remarks
1746
- * This option allows you to specify global variables that should be automatically imported from specified modules whenever they are used in the code. This is particularly useful for polyfilling Node.js globals in a browser environment.
1747
- *
1748
- * @example
1749
- * ```ts
1750
- * {
1751
- * inject: {
1752
- * process: 'process/browser',
1753
- * Buffer: ['buffer', 'Buffer'],
1754
- * }
1755
- * }
1756
- * ```
1757
- *
1758
- * @see https://github.com/rollup/plugins/tree/master/packages/inject
1759
- */
1760
- inject?: Record<string, string | string[]>;
1761
- /**
1762
- * The path to the tsconfig file to be used by the compiler
1763
- *
1764
- * @remarks
1765
- * If a value is not provided, the plugin will attempt to find the `tsconfig.json` file in the project root directory. The parsed tsconfig compiler options will be merged with the {@link Options.tsconfigRaw} value (if provided).
1766
- *
1767
- * @defaultValue "\{projectRoot\}/tsconfig.json"
1768
- */
1769
- tsconfig?: string;
1770
- /**
1771
- * The raw {@link TSConfig} object to be used by the compiler. This object will be merged with the `tsconfig.json` file.
1772
- *
1773
- * @see https://www.typescriptlang.org/tsconfig
1774
- *
1775
- * @remarks
1776
- * If populated, this option takes higher priority than `tsconfig`
1777
- */
1778
- tsconfigRaw?: TSConfig;
1779
- }
1780
- interface EnvironmentConfig extends Config {
1781
- /**
1782
- * Configuration options for the preview server
1783
- */
1784
- preview?: PreviewOptions;
1785
- /**
1786
- * A flag indicating whether the build is for a Server-Side Rendering environment.
1787
- */
1788
- ssr?: boolean;
1789
- /**
1790
- * Define if this environment is used for Server-Side Rendering
1791
- *
1792
- * @defaultValue "server" (if it isn't the client environment)
1793
- */
1794
- consumer?: "client" | "server";
1795
- }
1796
- interface UserConfig extends Config {
1797
- /**
1798
- * The root directory of the project
1799
- */
1800
- root: string;
1801
- /**
1802
- * The name of the project
1803
- */
1804
- name?: string;
1805
- /**
1806
- * The project display title
1807
- *
1808
- * @remarks
1809
- * This option is used in documentation generation and other places where a human-readable title is needed.
1810
- */
1811
- title?: string;
1812
- /**
1813
- * A description of the project
1814
- *
1815
- * @remarks
1816
- * If this option is not provided, the build process will try to use the \`description\` value from the `\package.json\` file.
1817
- */
1818
- description?: string;
1819
- /**
1820
- * The organization or author of the project
1821
- *
1822
- * @remarks
1823
- * If this option is not provided, the build process will try to use the \`author\` value from the \`package.json\` file. If the \`author\` value cannot be determined, the {@link name | name configuration} will be used.
1824
- */
1825
- organization?: string;
1826
- /**
1827
- * The date to use for compatibility checks
1828
- *
1829
- * @remarks
1830
- * This date can be used by plugins and build processes to determine compatibility with certain features or APIs. It is recommended to set this date to the date when the project was last known to be compatible with the desired features or APIs. If no value is provided, the latest compatibility date will be used.
1831
- *
1832
- * @see https://developers.cloudflare.com/pages/platform/compatibility-dates/
1833
- * @see https://docs.netlify.com/configure-builds/get-started/#set-a-compatibility-date
1834
- * @see https://github.com/unjs/compatx
1835
- */
1836
- compatibilityDate?: CompatibilityDateSpec;
1837
- /**
1838
- * The log level to use for the Powerlines processes.
1839
- *
1840
- * @defaultValue "info"
1841
- */
1842
- logLevel?: LogLevel | null;
1843
- /**
1844
- * A custom logger function to use for logging messages
1845
- */
1846
- customLogger?: LogFn;
1847
- /**
1848
- * Explicitly set a mode to run in. This mode will be used at various points throughout the Powerlines processes, such as when compiling the source code.
1849
- *
1850
- * @defaultValue "production"
1851
- */
1852
- mode?: "development" | "test" | "production";
1853
- /**
1854
- * The type of project being built
1855
- *
1856
- * @defaultValue "application"
1857
- */
1858
- projectType?: ProjectType;
1859
- /**
1860
- * A path to a custom configuration file to be used instead of the default `storm.json`, `powerlines.config.js`, or `powerlines.config.ts` files.
1861
- *
1862
- * @remarks
1863
- * This option is useful for running Powerlines commands with different configuration files, such as in CI/CD environments or when testing different configurations.
1864
- */
1865
- configFile?: string;
1866
- /**
1867
- * Should the Powerlines processes automatically install missing package dependencies?
1868
- *
1869
- * @remarks
1870
- * When set to `true`, Powerlines will attempt to install any missing dependencies using the package manager detected in the project (e.g., npm, yarn, pnpm). This can be useful for ensuring that all required packages are available during the build and preparation phases.
1871
- *
1872
- * @defaultValue false
1873
- */
1874
- autoInstall?: boolean;
1875
- /**
1876
- * Should the compiler processes skip any improvements that make use of cache?
1877
- *
1878
- * @defaultValue false
1879
- */
1880
- skipCache?: boolean;
1881
- /**
1882
- * A list of resolvable paths to plugins used during the build process
1883
- */
1884
- plugins?: PluginConfig<any>[];
1885
- /**
1886
- * Environment-specific configurations
1887
- */
1888
- environments?: Record<string, EnvironmentConfig>;
1889
- /**
1890
- * Should a single `build` process be ran for each environment?
1891
- *
1892
- * @remarks
1893
- * This option determines how environments are managed during the `build` process. The available options are:
1894
- *
1895
- * - `false`: A separate build is ran for each environment.
1896
- * - `true`: A single build is ran for all environments.
1897
- *
1898
- * @defaultValue false
1899
- */
1900
- singleBuild?: boolean;
1901
- /**
1902
- * A string identifier that allows a child framework or tool to identify itself when using Powerlines.
1903
- *
1904
- * @remarks
1905
- * If no values are provided for {@link OutputConfig.dts | output.dts} or {@link OutputConfig.artifactsPath | output.artifactsFolder}, this value will be used as the default.
1906
- *
1907
- * @defaultValue "powerlines"
1908
- */
1909
- framework?: string;
1910
- }
1911
- type InitialUserConfig<TUserConfig extends UserConfig = UserConfig> = Partial<TUserConfig> & {
1912
- root: string;
1913
- };
1914
- type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "deploy" | "clean";
1915
- /**
1916
- * The configuration provided while executing Powerlines commands.
1917
- */
1918
- type InlineConfig<TUserConfig extends UserConfig = UserConfig> = Partial<TUserConfig> & {
1919
- /**
1920
- * A string identifier for the Powerlines command being executed
1921
- */
1922
- command: PowerlinesCommand;
1923
- };
1924
- type NewInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfig<TUserConfig> & Required<Pick<InlineConfig<TUserConfig>, "root">> & {
1925
- /**
1926
- * A string identifier for the Powerlines command being executed
1927
- */
1928
- command: "new";
1929
- /**
1930
- * The package name (from the \`package.json\`) for the project that will be used in the \`new\` command to create a new project based on this configuration
1931
- */
1932
- packageName?: string;
1933
- };
1934
- type CleanInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfig<TUserConfig> & {
1935
- /**
1936
- * A string identifier for the Powerlines command being executed
1937
- */
1938
- command: "clean";
1939
- };
1940
- type PrepareInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfig<TUserConfig> & {
1941
- /**
1942
- * A string identifier for the Powerlines command being executed
1943
- */
1944
- command: "prepare";
1945
- };
1946
- type BuildInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfig<TUserConfig> & {
1947
- /**
1948
- * A string identifier for the Powerlines command being executed
1949
- */
1950
- command: "build";
1951
- };
1952
- type LintInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfig<TUserConfig> & {
1953
- /**
1954
- * A string identifier for the Powerlines command being executed
1955
- */
1956
- command: "lint";
1957
- };
1958
- type DocsInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfig<TUserConfig> & {
1959
- /**
1960
- * A string identifier for the Powerlines command being executed
1961
- */
1962
- command: "docs";
1963
- };
1964
- type DeployInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfig<TUserConfig> & {
1965
- /**
1966
- * A string identifier for the Powerlines command being executed
1967
- */
1968
- command: "deploy";
1969
- };
1970
- interface ResolvedEntryTypeDefinition extends TypeDefinition {
1971
- /**
1972
- * The user provided entry point in the source code
1973
- */
1974
- input?: TypeDefinition;
1975
- /**
1976
- * An optional name to use in the package export during the build process
1977
- */
1978
- output?: string;
1979
- }
1980
- type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "ssr" | "preview"> & Required<Pick<EnvironmentConfig, "consumer" | "ssr">> & {
1981
- /**
1982
- * The name of the environment
1983
- */
1984
- name: string;
1985
- /**
1986
- * Configuration options for the preview server
1987
- */
1988
- preview?: ResolvedPreviewOptions;
1989
- };
1990
- /**
1991
- * The configuration options for resolving modules in a Powerlines project.
1992
- */
1993
- type ResolveResolvedConfig = Required<Omit<ResolveConfig, "external" | "noExternal">> & {
1994
- /**
1995
- * A list of modules that should not be bundled, even if they are external dependencies.
1996
- *
1997
- * @remarks
1998
- * This option is useful for excluding specific modules from the bundle, such as Node.js built-in modules or other libraries that should not be bundled.
1999
- */
2000
- external?: string[];
2001
- /**
2002
- * A list of modules that should always be bundled, even if they are external dependencies.
2003
- */
2004
- noExternal?: string[];
2005
- };
2006
- type ResolvedAssetGlob = AssetGlob & Required<Pick<AssetGlob, "input">>;
2007
- type OutputResolvedConfig = Required<Omit<OutputConfig, "assets" | "storage"> & {
2008
- assets: ResolvedAssetGlob[];
2009
- }> & Pick<OutputConfig, "storage">;
2010
- /**
2011
- * The resolved options for the Powerlines project configuration.
2012
- */
2013
- type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "root" | "name" | "title" | "organization" | "compatibilityDate" | "plugins" | "mode" | "environments" | "tsconfig" | "platform" | "projectType" | "input" | "output" | "resolve" | "logLevel" | "framework"> & Required<Pick<TUserConfig, "root" | "name" | "title" | "organization" | "compatibilityDate" | "plugins" | "mode" | "environments" | "input" | "tsconfig" | "platform" | "projectType" | "framework">> & {
2014
- /**
2015
- * The output configuration options to use for the build process
2016
- */
2017
- output: OutputResolvedConfig;
2018
- /**
2019
- * Configuration for module resolution during processing of the source code
2020
- */
2021
- resolve: ResolveResolvedConfig;
2022
- /**
2023
- * The date to use for compatibility checks
2024
- *
2025
- * @remarks
2026
- * This date can be used by plugins and build processes to determine compatibility with certain features or APIs. It is recommended to set this date to the date when the project was last known to be compatible with the desired features or APIs.
2027
- *
2028
- * @see https://developers.cloudflare.com/pages/platform/compatibility-dates/
2029
- * @see https://docs.netlify.com/configure-builds/get-started/#set-a-compatibility-date
2030
- * @see https://github.com/unjs/compatx
2031
- */
2032
- compatibilityDate: CompatibilityDates;
2033
- /**
2034
- * The configuration options that were provided inline to the Powerlines CLI.
2035
- */
2036
- inlineConfig: InlineConfig<TUserConfig>;
2037
- /**
2038
- * The original configuration options that were provided by the user to the Powerlines process.
2039
- */
2040
- userConfig: TUserConfig;
2041
- /**
2042
- * A string identifier for the Powerlines command being executed.
2043
- */
2044
- command: NonUndefined<InlineConfig<TUserConfig>["command"]>;
2045
- /**
2046
- * The log level to use for the Powerlines processes.
2047
- *
2048
- * @defaultValue "info"
2049
- */
2050
- logLevel: LogLevel | null;
2051
- };
2052
- //#endregion
2053
- //#region ../powerlines/src/api.d.ts
2054
- /**
2055
- * The Powerlines API class
2056
- *
2057
- * @remarks
2058
- * This class is responsible for managing the Powerlines project lifecycle, including initialization, building, and finalization.
2059
- *
2060
- * @public
2061
- */
2062
- declare class PowerlinesAPI<TResolvedConfig extends ResolvedConfig = ResolvedConfig> implements API<TResolvedConfig>, AsyncDisposable {
2063
- #private;
2064
- /**
2065
- * The Powerlines context
2066
- */
2067
- get context(): APIContext<TResolvedConfig>;
2068
- /**
2069
- * Create a new Powerlines API instance
2070
- *
2071
- * @param context - The Powerlines context
2072
- */
2073
- private constructor();
2074
- /**
2075
- * Initialize a Powerlines API instance
2076
- *
2077
- * @param workspaceRoot - The directory of the underlying workspace the Powerlines project exists in
2078
- * @param config - An object containing the configuration required to run Powerlines tasks.
2079
- * @returns A new instance of the Powerlines API
2080
- */
2081
- static from<TResolvedConfig extends ResolvedConfig = ResolvedConfig>(workspaceRoot: string, config: InitialUserConfig<TResolvedConfig["userConfig"]>): Promise<PowerlinesAPI<TResolvedConfig>>;
2082
- /**
2083
- * Prepare the Powerlines API
2084
- *
2085
- * @remarks
2086
- * This method will prepare the Powerlines API for use, initializing any necessary resources.
2087
- *
2088
- * @param inlineConfig - The inline configuration for the prepare command
2089
- */
2090
- prepare(inlineConfig?: PrepareInlineConfig | NewInlineConfig | CleanInlineConfig | BuildInlineConfig | LintInlineConfig | DocsInlineConfig | DeployInlineConfig): Promise<void>;
2091
- /**
2092
- * Create a new Powerlines project
2093
- *
2094
- * @remarks
2095
- * This method will create a new Powerlines project in the current directory.
2096
- *
2097
- * @param inlineConfig - The inline configuration for the new command
2098
- * @returns A promise that resolves when the project has been created
2099
- */
2100
- new(inlineConfig: NewInlineConfig): Promise<void>;
2101
- /**
2102
- * Clean any previously prepared artifacts
2103
- *
2104
- * @remarks
2105
- * This method will remove the previous Powerlines artifacts from the project.
2106
- *
2107
- * @param inlineConfig - The inline configuration for the clean command
2108
- * @returns A promise that resolves when the clean command has completed
2109
- */
2110
- clean(inlineConfig?: CleanInlineConfig | PrepareInlineConfig): Promise<void>;
2111
- /**
2112
- * Lint the project
2113
- *
2114
- * @param inlineConfig - The inline configuration for the lint command
2115
- * @returns A promise that resolves when the lint command has completed
2116
- */
2117
- lint(inlineConfig?: LintInlineConfig | BuildInlineConfig): Promise<void>;
2118
- /**
2119
- * Build the project
2120
- *
2121
- * @remarks
2122
- * This method will build the Powerlines project, generating the necessary artifacts.
2123
- *
2124
- * @param inlineConfig - The inline configuration for the build command
2125
- * @returns A promise that resolves when the build command has completed
2126
- */
2127
- build(inlineConfig?: BuildInlineConfig): Promise<void>;
2128
- /**
2129
- * Prepare the documentation for the project
2130
- *
2131
- * @param inlineConfig - The inline configuration for the docs command
2132
- * @returns A promise that resolves when the documentation generation has completed
2133
- */
2134
- docs(inlineConfig?: DocsInlineConfig): Promise<void>;
2135
- /**
2136
- * Deploy the project source code
2137
- *
2138
- * @remarks
2139
- * This method will prepare and build the Powerlines project, generating the necessary artifacts for the deployment.
2140
- *
2141
- * @param inlineConfig - The inline configuration for the deploy command
2142
- */
2143
- deploy(inlineConfig?: DeployInlineConfig): Promise<void>;
2144
- /**
2145
- * Finalization process
2146
- *
2147
- * @remarks
2148
- * This step includes any final processes or clean up required by Powerlines. It will be run after each Powerlines command.
2149
- *
2150
- * @returns A promise that resolves when the finalization process has completed
2151
- */
2152
- finalize(): Promise<void>;
2153
- /**
2154
- * Invokes the configured plugin hooks
2155
- *
2156
- * @remarks
2157
- * By default, it will call the `"pre"`, `"normal"`, and `"post"` ordered hooks in sequence
2158
- *
2159
- * @param hook - The hook to call
2160
- * @param options - The options to provide to the hook
2161
- * @param args - The arguments to pass to the hook
2162
- * @returns The result of the hook call
2163
- */
2164
- callHook<TKey$1 extends string>(hook: TKey$1, options: CallHookOptions & {
2165
- environment?: string | EnvironmentContext<TResolvedConfig>;
2166
- }, ...args: InferHookParameters<PluginContext<TResolvedConfig>, TKey$1>): Promise<ReturnType<InferHookFunction<PluginContext<TResolvedConfig>, TKey$1>> | undefined>;
2167
- /**
2168
- * Dispose of the Powerlines API instance
2169
- *
2170
- * @remarks
2171
- * This method will finalize the Powerlines API instance, cleaning up any resources used.
2172
- */
2173
- [Symbol.asyncDispose](): Promise<void>;
2174
- }
2175
- //#endregion
2176
- //#region src/base/base-executor.d.ts
2177
- type PowerlinesExecutorContext<TCommand extends PowerlinesCommand = PowerlinesCommand, TExecutorSchema extends BaseExecutorSchema = BaseExecutorSchema> = ExecutorContext & {
2178
- projectName: string;
2179
- command: TCommand;
2180
- options: TExecutorSchema;
2181
- inlineConfig: InlineConfig;
2182
- workspaceConfig: StormWorkspaceConfig;
2183
- };
2184
- /**
2185
- * A utility function to create a Powerlines executor that can be used with the `withRunExecutor` function.
2186
- *
2187
- * @remarks
2188
- * This function is designed to simplify the creation of Powerlines executors by providing a consistent interface and error handling.
2189
- *
2190
- * @param command - The command that the executor will handle (e.g., "new", "prepare", "build", etc.).
2191
- * @param executorFn - The function that will be executed when the command is run.
2192
- * @returns A Promise that resolves to the result of the executor function.
2193
- */
2194
- declare function withExecutor<TCommand extends PowerlinesCommand = PowerlinesCommand, TExecutorSchema extends BaseExecutorSchema = BaseExecutorSchema>(command: TCommand, executorFn: (context: PowerlinesExecutorContext<TCommand, TExecutorSchema>, api: PowerlinesAPI) => Promise<BaseExecutorResult | null | undefined> | BaseExecutorResult | null | undefined): PromiseExecutor<TExecutorSchema>;
2195
- //#endregion
2196
- export { withExecutor as n, PowerlinesAPI as r, PowerlinesExecutorContext as t };
2197
- //# sourceMappingURL=base-executor-xsZuLKpp.d.mts.map