powerlines 0.41.5 → 0.41.7

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