@powerlines/plugin-env 0.15.2 → 0.15.4

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 (231) hide show
  1. package/dist/components/docs.cjs +3 -70
  2. package/dist/components/docs.d.cts +1 -8
  3. package/dist/components/docs.d.mts +1 -8
  4. package/dist/components/docs.mjs +2 -68
  5. package/dist/components/env.cjs +4 -574
  6. package/dist/components/env.d.cts +2 -19
  7. package/dist/components/env.d.mts +3 -19
  8. package/dist/components/env.mjs +2 -570
  9. package/dist/components/index.cjs +7 -5
  10. package/dist/components/index.d.cts +4 -2
  11. package/dist/components/index.d.mts +5 -2
  12. package/dist/components/index.mjs +4 -2
  13. package/dist/{plugin-alloy/src/types/components.d.cts → components-8W0Zgj0y.d.mts} +2 -1
  14. package/dist/components-C9bYrQVK.cjs +0 -0
  15. package/dist/components-CNIQFfeK.mjs +1 -0
  16. package/dist/create-reflection-resource-BNYxBgW2.mjs +9846 -0
  17. package/dist/create-reflection-resource-BWYhmX7O.cjs +10085 -0
  18. package/dist/docs-5r844zC1.d.mts +9 -0
  19. package/dist/docs-B66b9li3.mjs +219 -0
  20. package/dist/docs-_MmTNBQX.d.cts +9 -0
  21. package/dist/docs-hBlKCRWK.cjs +224 -0
  22. package/dist/env-BPodCdD1.d.cts +116 -0
  23. package/dist/env-IQvgnabX.mjs +1578 -0
  24. package/dist/env-cO4BUDn1.cjs +1596 -0
  25. package/dist/env-zhzvpUI5.d.mts +98 -0
  26. package/dist/index-BXxhKmeA.d.mts +1 -0
  27. package/dist/index-Cc7fCJU9.d.mts +1 -0
  28. package/dist/index-CqdNToYT.d.cts +1 -0
  29. package/dist/index-DWPDThxu.d.cts +1 -0
  30. package/dist/index.cjs +702 -77
  31. package/dist/index.d.cts +185 -12
  32. package/dist/index.d.mts +190 -17
  33. package/dist/index.mjs +648 -28
  34. package/dist/{deepkit/schemas/reflection.d.mts → plugin-BaInAuAh.d.mts} +326 -59
  35. package/dist/{deepkit/schemas/reflection.d.cts → plugin-BwuEBScL.d.cts} +268 -1
  36. package/dist/plugin-D3B5E_Hg.mjs +1 -0
  37. package/dist/plugin-D5qyQPqC.cjs +0 -0
  38. package/dist/resolved-BZG2cwRG.d.cts +1789 -0
  39. package/dist/resolved-V5COsfDu.d.mts +1791 -0
  40. package/dist/runtime-Bisl_1Ja.cjs +0 -0
  41. package/dist/runtime-Q8Ni8SeN.d.cts +794 -0
  42. package/dist/runtime-azNoeKr-.mjs +1 -0
  43. package/dist/runtime-qZ0Z2kEd.d.mts +794 -0
  44. package/dist/types/index.cjs +3 -0
  45. package/dist/types/index.d.cts +4 -2
  46. package/dist/types/index.d.mts +5 -2
  47. package/dist/types/index.mjs +4 -0
  48. package/dist/types/plugin.cjs +1 -0
  49. package/dist/types/plugin.d.cts +3 -156
  50. package/dist/types/plugin.d.mts +4 -158
  51. package/dist/types/plugin.mjs +2 -0
  52. package/dist/types/runtime.cjs +1 -0
  53. package/dist/types/runtime.d.cts +2 -793
  54. package/dist/types/runtime.d.mts +2 -793
  55. package/dist/types/runtime.mjs +2 -0
  56. package/dist/types-DwElXV6q.mjs +1 -0
  57. package/dist/types-MYBaygjr.cjs +0 -0
  58. package/package.json +7 -7
  59. package/dist/_virtual/rolldown_runtime.cjs +0 -37
  60. package/dist/_virtual/rolldown_runtime.mjs +0 -29
  61. package/dist/babel/index.cjs +0 -1
  62. package/dist/babel/index.d.mts +0 -1
  63. package/dist/babel/index.mjs +0 -3
  64. package/dist/babel/plugin.cjs +0 -121
  65. package/dist/babel/plugin.d.cts +0 -7
  66. package/dist/babel/plugin.d.mts +0 -9
  67. package/dist/babel/plugin.mjs +0 -119
  68. package/dist/deepkit/schemas/reflection.cjs +0 -3940
  69. package/dist/deepkit/schemas/reflection.mjs +0 -3938
  70. package/dist/deepkit/schemas/reflection2.cjs +0 -4112
  71. package/dist/deepkit/schemas/reflection2.mjs +0 -4110
  72. package/dist/deepkit/src/capnp.cjs +0 -913
  73. package/dist/deepkit/src/capnp.mjs +0 -911
  74. package/dist/deepkit/src/esbuild-plugin.cjs +0 -47
  75. package/dist/deepkit/src/esbuild-plugin.mjs +0 -46
  76. package/dist/deepkit/src/reflect-type.cjs +0 -22
  77. package/dist/deepkit/src/reflect-type.mjs +0 -20
  78. package/dist/deepkit/src/resolve-reflections.cjs +0 -16
  79. package/dist/deepkit/src/resolve-reflections.mjs +0 -15
  80. package/dist/deepkit/src/transformer.cjs +0 -52
  81. package/dist/deepkit/src/transformer.mjs +0 -49
  82. package/dist/deepkit/src/transpile.cjs +0 -29
  83. package/dist/deepkit/src/transpile.mjs +0 -27
  84. package/dist/deepkit/src/types.d.cts +0 -10
  85. package/dist/deepkit/src/types.d.mts +0 -10
  86. package/dist/deepkit/src/utilities.cjs +0 -66
  87. package/dist/deepkit/src/utilities.mjs +0 -65
  88. package/dist/deepkit/src/vendor/type-compiler/index.cjs +0 -38
  89. package/dist/deepkit/src/vendor/type-compiler/index.mjs +0 -19
  90. package/dist/deepkit/src/vendor/type.cjs +0 -20
  91. package/dist/deepkit/src/vendor/type.d.cts +0 -7
  92. package/dist/deepkit/src/vendor/type.d.mts +0 -7
  93. package/dist/deepkit/src/vendor/type.mjs +0 -11
  94. package/dist/helpers/automd-generator.cjs +0 -22
  95. package/dist/helpers/automd-generator.mjs +0 -21
  96. package/dist/helpers/create-reflection-resource.cjs +0 -55
  97. package/dist/helpers/create-reflection-resource.d.cts +0 -15
  98. package/dist/helpers/create-reflection-resource.d.mts +0 -15
  99. package/dist/helpers/create-reflection-resource.mjs +0 -54
  100. package/dist/helpers/index.cjs +0 -6
  101. package/dist/helpers/index.d.mts +0 -6
  102. package/dist/helpers/index.mjs +0 -8
  103. package/dist/helpers/load.cjs +0 -83
  104. package/dist/helpers/load.d.cts +0 -35
  105. package/dist/helpers/load.d.mts +0 -36
  106. package/dist/helpers/load.mjs +0 -80
  107. package/dist/helpers/persistence.cjs +0 -214
  108. package/dist/helpers/persistence.d.cts +0 -84
  109. package/dist/helpers/persistence.d.mts +0 -84
  110. package/dist/helpers/persistence.mjs +0 -202
  111. package/dist/helpers/reflect.cjs +0 -111
  112. package/dist/helpers/reflect.d.cts +0 -46
  113. package/dist/helpers/reflect.d.mts +0 -46
  114. package/dist/helpers/reflect.mjs +0 -103
  115. package/dist/helpers/source-file-env.cjs +0 -28
  116. package/dist/helpers/source-file-env.d.cts +0 -8
  117. package/dist/helpers/source-file-env.d.mts +0 -8
  118. package/dist/helpers/source-file-env.mjs +0 -26
  119. package/dist/helpers/template-helpers.cjs +0 -42
  120. package/dist/helpers/template-helpers.d.cts +0 -15
  121. package/dist/helpers/template-helpers.d.mts +0 -15
  122. package/dist/helpers/template-helpers.mjs +0 -41
  123. package/dist/plugin-alloy/src/core/components/output.cjs +0 -45
  124. package/dist/plugin-alloy/src/core/components/output.mjs +0 -44
  125. package/dist/plugin-alloy/src/core/components/single-line-comment.cjs +0 -22
  126. package/dist/plugin-alloy/src/core/components/single-line-comment.mjs +0 -21
  127. package/dist/plugin-alloy/src/core/components/source-file.cjs +0 -64
  128. package/dist/plugin-alloy/src/core/components/source-file.d.cts +0 -23
  129. package/dist/plugin-alloy/src/core/components/source-file.d.mts +0 -23
  130. package/dist/plugin-alloy/src/core/components/source-file.mjs +0 -62
  131. package/dist/plugin-alloy/src/core/contexts/context.cjs +0 -60
  132. package/dist/plugin-alloy/src/core/contexts/context.mjs +0 -54
  133. package/dist/plugin-alloy/src/core/contexts/index.cjs +0 -2
  134. package/dist/plugin-alloy/src/core/contexts/index.mjs +0 -4
  135. package/dist/plugin-alloy/src/core/contexts/reflection.cjs +0 -46
  136. package/dist/plugin-alloy/src/core/contexts/reflection.mjs +0 -42
  137. package/dist/plugin-alloy/src/helpers/refkey.cjs +0 -16
  138. package/dist/plugin-alloy/src/helpers/refkey.mjs +0 -15
  139. package/dist/plugin-alloy/src/index.cjs +0 -93
  140. package/dist/plugin-alloy/src/index.mjs +0 -91
  141. package/dist/plugin-alloy/src/markdown/components/markdown-file.cjs +0 -115
  142. package/dist/plugin-alloy/src/markdown/components/markdown-file.mjs +0 -114
  143. package/dist/plugin-alloy/src/markdown/components/markdown-table.cjs +0 -39
  144. package/dist/plugin-alloy/src/markdown/components/markdown-table.mjs +0 -38
  145. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.cjs +0 -18
  146. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.mjs +0 -17
  147. package/dist/plugin-alloy/src/types/components.d.mts +0 -25
  148. package/dist/plugin-alloy/src/types/index.d.mts +0 -2
  149. package/dist/plugin-alloy/src/types/plugin.d.cts +0 -37
  150. package/dist/plugin-alloy/src/types/plugin.d.mts +0 -37
  151. package/dist/plugin-alloy/src/typescript/components/builtin-file.cjs +0 -57
  152. package/dist/plugin-alloy/src/typescript/components/builtin-file.d.cts +0 -25
  153. package/dist/plugin-alloy/src/typescript/components/builtin-file.d.mts +0 -26
  154. package/dist/plugin-alloy/src/typescript/components/builtin-file.mjs +0 -56
  155. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.cjs +0 -126
  156. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.mjs +0 -124
  157. package/dist/plugin-alloy/src/typescript/components/tsdoc.cjs +0 -442
  158. package/dist/plugin-alloy/src/typescript/components/tsdoc.d.cts +0 -27
  159. package/dist/plugin-alloy/src/typescript/components/tsdoc.d.mts +0 -28
  160. package/dist/plugin-alloy/src/typescript/components/tsdoc.mjs +0 -433
  161. package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +0 -194
  162. package/dist/plugin-alloy/src/typescript/components/typescript-file.d.cts +0 -14
  163. package/dist/plugin-alloy/src/typescript/components/typescript-file.d.mts +0 -15
  164. package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +0 -191
  165. package/dist/plugin-alloy/src/typescript/components/typescript-interface.cjs +0 -68
  166. package/dist/plugin-alloy/src/typescript/components/typescript-interface.d.cts +0 -11
  167. package/dist/plugin-alloy/src/typescript/components/typescript-interface.d.mts +0 -12
  168. package/dist/plugin-alloy/src/typescript/components/typescript-interface.mjs +0 -67
  169. package/dist/plugin-alloy/src/typescript/components/typescript-object.cjs +0 -124
  170. package/dist/plugin-alloy/src/typescript/components/typescript-object.mjs +0 -123
  171. package/dist/plugin-automd/src/index.cjs +0 -101
  172. package/dist/plugin-automd/src/index.mjs +0 -98
  173. package/dist/plugin-automd/src/types/plugin.d.cts +0 -38
  174. package/dist/plugin-automd/src/types/plugin.d.mts +0 -40
  175. package/dist/plugin-automd/src/types/toc.d.cts +0 -33
  176. package/dist/plugin-automd/src/types/toc.d.mts +0 -33
  177. package/dist/plugin-babel/src/helpers/ast-utils.cjs +0 -10
  178. package/dist/plugin-babel/src/helpers/ast-utils.mjs +0 -9
  179. package/dist/plugin-babel/src/helpers/create-plugin.cjs +0 -41
  180. package/dist/plugin-babel/src/helpers/create-plugin.mjs +0 -39
  181. package/dist/plugin-babel/src/helpers/filters.cjs +0 -23
  182. package/dist/plugin-babel/src/helpers/filters.mjs +0 -21
  183. package/dist/plugin-babel/src/helpers/index.cjs +0 -5
  184. package/dist/plugin-babel/src/helpers/index.mjs +0 -7
  185. package/dist/plugin-babel/src/helpers/module-helpers.cjs +0 -38
  186. package/dist/plugin-babel/src/helpers/module-helpers.mjs +0 -35
  187. package/dist/plugin-babel/src/helpers/options.cjs +0 -50
  188. package/dist/plugin-babel/src/helpers/options.mjs +0 -47
  189. package/dist/plugin-babel/src/index.cjs +0 -91
  190. package/dist/plugin-babel/src/index.mjs +0 -89
  191. package/dist/plugin-babel/src/types/index.d.mts +0 -1
  192. package/dist/plugin-babel/src/types/plugin.d.cts +0 -15
  193. package/dist/plugin-babel/src/types/plugin.d.mts +0 -15
  194. package/dist/powerlines/schemas/fs.d.mts +0 -1
  195. package/dist/powerlines/src/api.d.mts +0 -7
  196. package/dist/powerlines/src/index.d.mts +0 -12
  197. package/dist/powerlines/src/internal/helpers/hooks.d.mts +0 -5
  198. package/dist/powerlines/src/lib/build/esbuild.cjs +0 -102
  199. package/dist/powerlines/src/lib/build/esbuild.mjs +0 -100
  200. package/dist/powerlines/src/lib/entry.cjs +0 -12
  201. package/dist/powerlines/src/lib/entry.mjs +0 -14
  202. package/dist/powerlines/src/lib/logger.cjs +0 -41
  203. package/dist/powerlines/src/lib/logger.mjs +0 -39
  204. package/dist/powerlines/src/lib/utilities/bundle.cjs +0 -35
  205. package/dist/powerlines/src/lib/utilities/bundle.mjs +0 -34
  206. package/dist/powerlines/src/lib/utilities/resolve.cjs +0 -30
  207. package/dist/powerlines/src/lib/utilities/resolve.mjs +0 -29
  208. package/dist/powerlines/src/plugin-utils/paths.cjs +0 -1
  209. package/dist/powerlines/src/plugin-utils/paths.mjs +0 -3
  210. package/dist/powerlines/src/types/api.d.mts +0 -5
  211. package/dist/powerlines/src/types/babel.d.cts +0 -23
  212. package/dist/powerlines/src/types/babel.d.mts +0 -23
  213. package/dist/powerlines/src/types/build.d.cts +0 -145
  214. package/dist/powerlines/src/types/build.d.mts +0 -147
  215. package/dist/powerlines/src/types/commands.d.cts +0 -8
  216. package/dist/powerlines/src/types/commands.d.mts +0 -9
  217. package/dist/powerlines/src/types/config.d.cts +0 -380
  218. package/dist/powerlines/src/types/config.d.mts +0 -381
  219. package/dist/powerlines/src/types/context.d.cts +0 -414
  220. package/dist/powerlines/src/types/context.d.mts +0 -416
  221. package/dist/powerlines/src/types/fs.d.cts +0 -486
  222. package/dist/powerlines/src/types/fs.d.mts +0 -486
  223. package/dist/powerlines/src/types/hooks.d.mts +0 -2
  224. package/dist/powerlines/src/types/index.d.mts +0 -12
  225. package/dist/powerlines/src/types/plugin.d.cts +0 -231
  226. package/dist/powerlines/src/types/plugin.d.mts +0 -231
  227. package/dist/powerlines/src/types/resolved.d.cts +0 -82
  228. package/dist/powerlines/src/types/resolved.d.mts +0 -83
  229. package/dist/powerlines/src/types/tsconfig.d.cts +0 -69
  230. package/dist/powerlines/src/types/tsconfig.d.mts +0 -69
  231. package/dist/powerlines/src/types/unplugin.d.mts +0 -7
@@ -0,0 +1,1791 @@
1
+ import "c12";
2
+ import { PluginItem, PluginObj, PluginPass, transformAsync } from "@babel/core";
3
+ import { LogLevelLabel } from "@storm-software/config-tools/types";
4
+ import { BabelAPI } from "@babel/helper-plugin-utils";
5
+ import { ResolveOptions } from "@stryke/fs/resolve";
6
+ import "esbuild";
7
+ import ts from "typescript";
8
+ import { FunctionLike, MaybePromise, NonUndefined } from "@stryke/types/base";
9
+ import { AssetGlob } from "@stryke/types/file";
10
+ import { TypeDefinition, TypeDefinitionParameter } from "@stryke/types/configuration";
11
+ import { PreviewOptions, ResolvedPreviewOptions } from "vite";
12
+ import { Format } from "@storm-software/build-tools/types";
13
+ import { StormWorkspaceConfig } from "@storm-software/config/types";
14
+ import { DateString } from "compatx";
15
+ import { EnvPaths } from "@stryke/env/get-env-paths";
16
+ import { FetchRequestOptions } from "@stryke/http/fetch";
17
+ import { PackageJson } from "@stryke/types/package-json";
18
+ import { Jiti } from "jiti";
19
+ import { SourceMap } from "magic-string";
20
+ import { ParseResult, ParserOptions } from "oxc-parser";
21
+ import { Range } from "semver";
22
+ import { Project } from "ts-morph";
23
+ import { RequestInfo, Response } from "undici";
24
+ import { ExternalIdResult, HookFilter, TransformResult, UnpluginBuildContext, UnpluginContext, UnpluginMessage, UnpluginOptions } from "unplugin";
25
+ import { ArrayValues } from "@stryke/types/array";
26
+ import { CompilerOptions, TsConfigJson } from "@stryke/types/tsconfig";
27
+
28
+ //#region ../powerlines/src/types/fs.d.ts
29
+ type StoragePreset = "fs" | "virtual";
30
+ /**
31
+ * Interface defining the methods and properties for a storage adapter.
32
+ */
33
+ interface StorageAdapter {
34
+ /**
35
+ * A name identifying the storage adapter type.
36
+ */
37
+ name: string;
38
+ /**
39
+ * The storage preset for the adapter.
40
+ *
41
+ * @remarks
42
+ * This can be used as an alternate way to identify the type of storage being used.
43
+ */
44
+ preset?: StoragePreset | null;
45
+ /**
46
+ * Checks if a key exists in the storage.
47
+ *
48
+ * @param key - The key to check for existence.
49
+ * @returns A promise that resolves to `true` if the key exists, otherwise `false`.
50
+ */
51
+ exists: (key: string) => Promise<boolean>;
52
+ /**
53
+ * Synchronously checks if a key exists in the storage.
54
+ *
55
+ * @param key - The key to check for existence.
56
+ * @returns Returns `true` if the key exists, otherwise `false`.
57
+ */
58
+ existsSync: (key: string) => boolean;
59
+ /**
60
+ * Read a value associated with a key from the storage.
61
+ *
62
+ * @param key - The key to read the value for.
63
+ * @returns A promise that resolves to the value if found, otherwise `null`.
64
+ */
65
+ get: (key: string) => Promise<string | null>;
66
+ /**
67
+ * Synchronously reads the value associated with a key from the storage.
68
+ *
69
+ * @param key - The key to read the value for.
70
+ * @returns The value if found, otherwise `null`.
71
+ */
72
+ getSync: (key: string) => string | null;
73
+ /**
74
+ * Writes a value to the storage for the given key.
75
+ *
76
+ * @param key - The key to associate the value with.
77
+ * @param value - The value to store.
78
+ */
79
+ set: (key: string, value: string) => Promise<void>;
80
+ /**
81
+ * Synchronously writes a value to the storage for the given key.
82
+ *
83
+ * @param key - The key to associate the value with.
84
+ * @param value - The value to store.
85
+ */
86
+ setSync: (key: string, value: string) => void;
87
+ /**
88
+ * Removes a value from the storage.
89
+ *
90
+ * @param key - The key whose value should be removed.
91
+ */
92
+ remove: (key: string) => Promise<void>;
93
+ /**
94
+ * Synchronously removes a value from the storage.
95
+ *
96
+ * @param key - The key whose value should be removed.
97
+ */
98
+ removeSync: (key: string) => void;
99
+ /**
100
+ * Creates a directory at the specified path.
101
+ *
102
+ * @param dirPath - The path of the directory to create.
103
+ */
104
+ mkdir: (dirPath: string) => Promise<void>;
105
+ /**
106
+ * Synchronously creates a directory at the specified path.
107
+ *
108
+ * @param dirPath - The path of the directory to create.
109
+ */
110
+ mkdirSync: (dirPath: string) => void;
111
+ /**
112
+ * Remove all entries from the storage that match the provided base path.
113
+ *
114
+ * @param base - The base path or prefix to clear entries from.
115
+ */
116
+ clear: (base?: string) => Promise<void>;
117
+ /**
118
+ * Synchronously remove all entries from the storage that match the provided base path.
119
+ *
120
+ * @param base - The base path or prefix to clear entries from.
121
+ */
122
+ clearSync: (base?: string) => void;
123
+ /**
124
+ * Lists all keys under the provided base path.
125
+ *
126
+ * @param base - The base path or prefix to list keys from.
127
+ * @returns A promise resolving to the list of keys.
128
+ */
129
+ list: (base?: string) => Promise<string[]>;
130
+ /**
131
+ * Synchronously lists all keys under the provided base path.
132
+ *
133
+ * @param base - The base path or prefix to list keys from.
134
+ * @returns The list of keys.
135
+ */
136
+ listSync: (base?: string) => string[];
137
+ /**
138
+ * Checks if the given key is a directory.
139
+ *
140
+ * @param key - The key to check.
141
+ * @returns A promise that resolves to `true` if the key is a directory, otherwise `false`.
142
+ */
143
+ isDirectory: (key: string) => Promise<boolean>;
144
+ /**
145
+ * Synchronously checks if the given key is a directory.
146
+ *
147
+ * @param key - The key to check.
148
+ * @returns `true` if the key is a directory, otherwise `false`.
149
+ */
150
+ isDirectorySync: (key: string) => boolean;
151
+ /**
152
+ * Checks if the given key is a file.
153
+ *
154
+ * @param key - The key to check.
155
+ * @returns A promise that resolves to `true` if the key is a file, otherwise `false`.
156
+ */
157
+ isFile: (key: string) => Promise<boolean>;
158
+ /**
159
+ * Synchronously checks if the given key is a file.
160
+ *
161
+ * @param key - The key to check.
162
+ * @returns `true` if the key is a file, otherwise `false`.
163
+ */
164
+ isFileSync: (key: string) => boolean;
165
+ /**
166
+ * Releases any resources held by the storage adapter.
167
+ */
168
+ dispose: () => MaybePromise<void>;
169
+ }
170
+ /**
171
+ * A mapping of file paths to storage adapter names and their corresponding {@link StorageAdapter} instances.
172
+ */
173
+ type StoragePort = Record<string, StorageAdapter>;
174
+ interface VirtualFileMetadata {
175
+ /**
176
+ * The identifier for the file data.
177
+ */
178
+ id: string;
179
+ /**
180
+ * The timestamp of the virtual file.
181
+ */
182
+ timestamp: number;
183
+ /**
184
+ * The type of the file.
185
+ *
186
+ * @remarks
187
+ * This string represents the purpose/function of the file in the virtual file system. A potential list of variants includes:
188
+ * - `builtin`: Indicates that the file is a built-in module provided by the system.
189
+ * - `entry`: Indicates that the file is an entry point for execution.
190
+ * - `normal`: Indicates that the file is a standard file without any special role.
191
+ */
192
+ type: string;
193
+ /**
194
+ * Additional metadata associated with the file.
195
+ */
196
+ properties: Record<string, string | undefined>;
197
+ }
198
+ interface VirtualFileData {
199
+ /**
200
+ * The identifier for the file data.
201
+ */
202
+ id?: string;
203
+ /**
204
+ * The contents of the virtual file.
205
+ */
206
+ code: string;
207
+ /**
208
+ * The type of the file.
209
+ *
210
+ * @remarks
211
+ * This string represents the purpose/function of the file in the virtual file system. A potential list of variants includes:
212
+ * - `builtin`: Indicates that the file is a built-in module provided by the system.
213
+ * - `entry`: Indicates that the file is an entry point for execution.
214
+ * - `normal`: Indicates that the file is a standard file without any special role.
215
+ */
216
+ type?: string;
217
+ /**
218
+ * Additional metadata associated with the file.
219
+ */
220
+ properties?: Record<string, string | undefined>;
221
+ }
222
+ interface VirtualFile extends Required<VirtualFileData>, VirtualFileMetadata {
223
+ /**
224
+ * An additional name for the file.
225
+ */
226
+ path: string;
227
+ /**
228
+ * The timestamp of the virtual file.
229
+ */
230
+ timestamp: number;
231
+ }
232
+ interface WriteOptions {
233
+ /**
234
+ * Should the file skip formatting before being written?
235
+ *
236
+ * @defaultValue false
237
+ */
238
+ skipFormat?: boolean;
239
+ /**
240
+ * The storage preset or adapter name for the output file.
241
+ *
242
+ * @remarks
243
+ * If not specified, the output mode will be determined by the provided `output.mode` value.
244
+ */
245
+ storage?: StoragePreset | string;
246
+ /**
247
+ * Additional metadata for the file.
248
+ */
249
+ meta?: Partial<VirtualFileMetadata>;
250
+ }
251
+ interface ResolveOptions$1 extends ResolveOptions {
252
+ /**
253
+ * If true, the module is being resolved as an entry point.
254
+ */
255
+ isEntry?: boolean;
256
+ /**
257
+ * If true, the resolver will skip alias resolution when resolving modules.
258
+ */
259
+ skipAlias?: boolean;
260
+ /**
261
+ * If true, the resolver will skip using the cache when resolving modules.
262
+ */
263
+ skipCache?: boolean;
264
+ /**
265
+ * An array of external modules or patterns to exclude from resolution.
266
+ */
267
+ external?: (string | RegExp)[];
268
+ /**
269
+ * An array of modules or patterns to include in the resolution, even if they are marked as external.
270
+ */
271
+ noExternal?: (string | RegExp)[];
272
+ /**
273
+ * An array of patterns to match when resolving modules.
274
+ */
275
+ skipNodeModulesBundle?: boolean;
276
+ }
277
+ interface VirtualFileSystemInterface {
278
+ /**
279
+ * The underlying file metadata.
280
+ */
281
+ metadata: Readonly<Record<string, VirtualFileMetadata>>;
282
+ /**
283
+ * A map of file paths to their module ids.
284
+ */
285
+ ids: Readonly<Record<string, string>>;
286
+ /**
287
+ * A map of module ids to their file paths.
288
+ */
289
+ paths: Readonly<Record<string, string>>;
290
+ /**
291
+ * Checks if a file exists in the virtual file system (VFS).
292
+ *
293
+ * @param path - The path or id of the file.
294
+ * @returns `true` if the file exists, otherwise `false`.
295
+ */
296
+ exists: (path: string) => Promise<boolean>;
297
+ /**
298
+ * Synchronously Checks if a file exists in the virtual file system (VFS).
299
+ *
300
+ * @param path - The path or id of the file.
301
+ * @returns `true` if the file exists, otherwise `false`.
302
+ */
303
+ existsSync: (path: string) => boolean;
304
+ /**
305
+ * Checks if a file is virtual in the virtual file system (VFS).
306
+ *
307
+ * @param path - The path or id of the file.
308
+ * @returns `true` if the file is virtual, otherwise `false`.
309
+ */
310
+ isVirtual: (path: string) => boolean;
311
+ /**
312
+ * Checks if the given key is a directory.
313
+ *
314
+ * @param key - The key to check.
315
+ * @returns A promise that resolves to `true` if the key is a directory, otherwise `false`.
316
+ */
317
+ isDirectory: (key: string) => Promise<boolean>;
318
+ /**
319
+ * Synchronously checks if the given key is a directory.
320
+ *
321
+ * @param key - The key to check.
322
+ * @returns `true` if the key is a directory, otherwise `false`.
323
+ */
324
+ isDirectorySync: (key: string) => boolean;
325
+ /**
326
+ * Checks if the given key is a file.
327
+ *
328
+ * @param key - The key to check.
329
+ * @returns A promise that resolves to `true` if the key is a file, otherwise `false`.
330
+ */
331
+ isFile: (key: string) => Promise<boolean>;
332
+ /**
333
+ * Synchronously checks if the given key is a file.
334
+ *
335
+ * @param key - The key to check.
336
+ * @returns `true` if the key is a file, otherwise `false`.
337
+ */
338
+ isFileSync: (key: string) => boolean;
339
+ /**
340
+ * Gets the metadata of a file in the virtual file system (VFS).
341
+ *
342
+ * @param path - The path or id of the file.
343
+ * @returns The metadata of the file if it exists, otherwise undefined.
344
+ */
345
+ getMetadata: (path: string) => VirtualFileMetadata | undefined;
346
+ /**
347
+ * Lists files in a given path.
348
+ *
349
+ * @param path - The path to list files from.
350
+ * @returns An array of file names in the specified path.
351
+ */
352
+ listSync: (path: string) => string[];
353
+ /**
354
+ * Lists files in a given path.
355
+ *
356
+ * @param path - The path to list files from.
357
+ * @returns An array of file names in the specified path.
358
+ */
359
+ list: (path: string) => Promise<string[]>;
360
+ /**
361
+ * Removes a file or symbolic link in the virtual file system (VFS).
362
+ *
363
+ * @param path - The path to the file to remove.
364
+ * @returns A promise that resolves when the file is removed.
365
+ */
366
+ removeSync: (path: string) => void;
367
+ /**
368
+ * Asynchronously removes a file or symbolic link in the virtual file system (VFS).
369
+ *
370
+ * @param path - The path to the file to remove.
371
+ * @returns A promise that resolves when the file is removed.
372
+ */
373
+ remove: (path: string) => Promise<void>;
374
+ /**
375
+ * Reads a file from the virtual file system (VFS).
376
+ *
377
+ * @param path - The path or id of the file.
378
+ * @returns The contents of the file if it exists, otherwise undefined.
379
+ */
380
+ read: (path: string) => Promise<string | undefined>;
381
+ /**
382
+ * Reads a file from the virtual file system (VFS).
383
+ *
384
+ * @param path - The path or id of the file.
385
+ */
386
+ readSync: (path: string) => string | undefined;
387
+ /**
388
+ * Writes a file to the virtual file system (VFS).
389
+ *
390
+ * @param path - The path to the file.
391
+ * @param data - The contents of the file.
392
+ * @param options - Options for writing the file.
393
+ * @returns A promise that resolves when the file is written.
394
+ */
395
+ write: (path: string, data: string, options?: WriteOptions) => Promise<void>;
396
+ /**
397
+ * Writes a file to the virtual file system (VFS).
398
+ *
399
+ * @param path - The path to the file.
400
+ * @param data - The contents of the file.
401
+ * @param options - Options for writing the file.
402
+ */
403
+ writeSync: (path: string, data: string, options?: WriteOptions) => void;
404
+ /**
405
+ * Creates a directory at the specified path.
406
+ *
407
+ * @param dirPath - The path of the directory to create.
408
+ */
409
+ mkdir: (dirPath: string) => Promise<void>;
410
+ /**
411
+ * Synchronously creates a directory at the specified path.
412
+ *
413
+ * @param dirPath - The path of the directory to create.
414
+ */
415
+ mkdirSync: (dirPath: string) => void;
416
+ /**
417
+ * Moves a file from one path to another in the virtual file system (VFS).
418
+ *
419
+ * @param srcPath - The source path to move
420
+ * @param destPath - The destination path to move to
421
+ */
422
+ move: (srcPath: string, destPath: string) => Promise<void>;
423
+ /**
424
+ * Synchronously moves a file from one path to another in the virtual file system (VFS).
425
+ *
426
+ * @param srcPath - The source path to move
427
+ * @param destPath - The destination path to move to
428
+ */
429
+ moveSync: (srcPath: string, destPath: string) => void;
430
+ /**
431
+ * Copies a file from one path to another in the virtual file system (VFS).
432
+ *
433
+ * @param srcPath - The source path to copy
434
+ * @param destPath - The destination path to copy to
435
+ */
436
+ copy: (srcPath: string | URL | Omit<AssetGlob, "output">, destPath: string | URL) => Promise<void>;
437
+ /**
438
+ * Synchronously copies a file from one path to another in the virtual file system (VFS).
439
+ *
440
+ * @param srcPath - The source path to copy
441
+ * @param destPath - The destination path to copy to
442
+ */
443
+ copySync: (srcPath: string | URL | Omit<AssetGlob, "output">, destPath: string | URL) => void;
444
+ /**
445
+ * Glob files in the virtual file system (VFS) based on the provided pattern(s).
446
+ *
447
+ * @param pattern - A pattern (or multiple patterns) to use to determine the file paths to return
448
+ * @returns An array of file paths matching the provided pattern(s)
449
+ */
450
+ glob: (patterns: string | Omit<AssetGlob, "output"> | (string | Omit<AssetGlob, "output">)[]) => Promise<string[]>;
451
+ /**
452
+ * Synchronously glob files in the virtual file system (VFS) based on the provided pattern(s).
453
+ *
454
+ * @param pattern - A pattern (or multiple patterns) to use to determine the file paths to return
455
+ * @returns An array of file paths matching the provided pattern(s)
456
+ */
457
+ globSync: (patterns: string | Omit<AssetGlob, "output"> | (string | Omit<AssetGlob, "output">)[]) => string[];
458
+ /**
459
+ * A helper function to resolve modules using the Jiti resolver
460
+ *
461
+ * @remarks
462
+ * This function can be used to resolve modules relative to the project root directory.
463
+ *
464
+ * @example
465
+ * ```ts
466
+ * const resolvedPath = await context.resolve("some-module", "/path/to/importer");
467
+ * ```
468
+ *
469
+ * @param id - The module to resolve.
470
+ * @param importer - An optional path to the importer module.
471
+ * @param options - Additional resolution options.
472
+ * @returns A promise that resolves to the resolved module path.
473
+ */
474
+ resolve: (id: string, importer?: string, options?: ResolveOptions$1) => Promise<string | undefined>;
475
+ /**
476
+ * A synchronous helper function to resolve modules using the Jiti resolver
477
+ *
478
+ * @remarks
479
+ * This function can be used to resolve modules relative to the project root directory.
480
+ *
481
+ * @example
482
+ * ```ts
483
+ * const resolvedPath = context.resolveSync("some-module", "/path/to/importer");
484
+ * ```
485
+ *
486
+ * @param id - The module to resolve.
487
+ * @param importer - An optional path to the importer module.
488
+ * @param options - Additional resolution options.
489
+ * @returns The resolved module path.
490
+ */
491
+ resolveSync: (id: string, importer?: string, options?: ResolveOptions$1) => string | undefined;
492
+ /**
493
+ * Resolves a given module ID using the configured aliases.
494
+ *
495
+ * @remarks
496
+ * This function can be used to map module IDs to different paths based on the alias configuration.
497
+ *
498
+ * @param id - The module ID to resolve.
499
+ * @returns The resolved module ID - after applying any configured aliases (this will be the same as the input ID if no aliases match).
500
+ */
501
+ resolveAlias: (id: string) => string;
502
+ /**
503
+ * Disposes of the virtual file system (VFS), writes any virtual file changes to disk, and releases any associated resources.
504
+ */
505
+ dispose: () => Promise<void>;
506
+ }
507
+ //#endregion
508
+ //#region ../powerlines/src/types/build.d.ts
509
+ type UnpluginBuildVariant = "rollup" | "webpack" | "rspack" | "vite" | "esbuild" | "farm" | "unloader" | "rolldown";
510
+ interface BuildConfig {
511
+ /**
512
+ * The platform to build the project for
513
+ *
514
+ * @defaultValue "neutral"
515
+ */
516
+ platform?: "node" | "browser" | "neutral";
517
+ /**
518
+ * Array of strings indicating the polyfills to include for the build.
519
+ *
520
+ * @remarks
521
+ * This option allows you to specify which polyfills should be included in the build process to ensure compatibility with the target environment. The paths for the polyfills can use placeholder tokens (the `replacePathTokens` helper function will be used to resolve the actual values).
522
+ *
523
+ * @example
524
+ * ```ts
525
+ * {
526
+ * polyfill: ['{projectRoot}/custom-polyfill.ts']
527
+ * }
528
+ * ```
529
+ */
530
+ polyfill?: string[];
531
+ /**
532
+ * Array of strings indicating the order in which fields in a package.json file should be resolved to determine the entry point for a module.
533
+ *
534
+ * @defaultValue `['browser', 'module', 'jsnext:main', 'jsnext']`
535
+ */
536
+ mainFields?: string[];
537
+ /**
538
+ * Array of strings indicating what conditions should be used for module resolution.
539
+ */
540
+ conditions?: string[];
541
+ /**
542
+ * Array of strings indicating what file extensions should be used for module resolution.
543
+ *
544
+ * @defaultValue `['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json']`
545
+ */
546
+ extensions?: string[];
547
+ /**
548
+ * Array of strings indicating what modules should be deduplicated to a single version in the build.
549
+ *
550
+ * @remarks
551
+ * 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.
552
+ */
553
+ dedupe?: string[];
554
+ /**
555
+ * Array of strings or regular expressions that indicate what modules are builtin for the environment.
556
+ */
557
+ builtins?: (string | RegExp)[];
558
+ /**
559
+ * Define global variable replacements.
560
+ *
561
+ * @remarks
562
+ * 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.
563
+ *
564
+ * @example
565
+ * ```ts
566
+ * {
567
+ * define: {
568
+ * __VERSION__: '"1.0.0"',
569
+ * __DEV__: 'process.env.NODE_ENV !== "production"'
570
+ * }
571
+ * }
572
+ * ```
573
+ *
574
+ * @see https://esbuild.github.io/api/#define
575
+ * @see https://vitejs.dev/config/build-options.html#define
576
+ * @see https://github.com/rollup/plugins/tree/master/packages/replace
577
+ */
578
+ define?: Record<string, any>;
579
+ /**
580
+ * Global variables that will have import statements injected where necessary
581
+ *
582
+ * @remarks
583
+ * 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.
584
+ *
585
+ * @example
586
+ * ```ts
587
+ * {
588
+ * inject: {
589
+ * process: 'process/browser',
590
+ * Buffer: ['buffer', 'Buffer'],
591
+ * }
592
+ * }
593
+ * ```
594
+ *
595
+ * @see https://github.com/rollup/plugins/tree/master/packages/inject
596
+ */
597
+ inject?: Record<string, string | string[]>;
598
+ /**
599
+ * The alias mappings to use for module resolution during the build process.
600
+ *
601
+ * @remarks
602
+ * This option allows you to define custom path aliases for modules, which can be useful for simplifying imports and managing dependencies.
603
+ *
604
+ * @example
605
+ * ```ts
606
+ * {
607
+ * alias: {
608
+ * "@utils": "./src/utils",
609
+ * "@components": "./src/components"
610
+ * }
611
+ * }
612
+ * ```
613
+ *
614
+ * @see https://github.com/rollup/plugins/tree/master/packages/alias
615
+ */
616
+ alias?: Record<string, string> | Array<{
617
+ find: string | RegExp;
618
+ replacement: string;
619
+ }>;
620
+ /**
621
+ * A list of modules that should not be bundled, even if they are external dependencies.
622
+ *
623
+ * @remarks
624
+ * 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.
625
+ */
626
+ external?: (string | RegExp)[];
627
+ /**
628
+ * A list of modules that should always be bundled, even if they are external dependencies.
629
+ */
630
+ noExternal?: (string | RegExp)[];
631
+ /**
632
+ * Should the Powerlines CLI processes skip bundling the `node_modules` directory?
633
+ */
634
+ skipNodeModulesBundle?: boolean;
635
+ /**
636
+ * If true, `process.env` referenced in code will be preserved as-is and evaluated in runtime. Otherwise, it is statically replaced as an empty object.
637
+ *
638
+ * @defaultValue false
639
+ */
640
+ keepProcessEnv?: boolean;
641
+ /**
642
+ * An optional set of override options to apply to the selected build variant.
643
+ *
644
+ * @remarks
645
+ * This option allows you to provide configuration options with the guarantee that they will **not** be overridden and will take precedence over other build configurations.
646
+ */
647
+ override?: Record<string, any>;
648
+ }
649
+ type BuildResolvedConfig = Omit<BuildConfig, "override">;
650
+ //#endregion
651
+ //#region ../powerlines/src/types/commands.d.ts
652
+ declare const SUPPORTED_COMMANDS: readonly ["new", "clean", "prepare", "lint", "test", "build", "docs", "deploy", "finalize"];
653
+ type CommandType = ArrayValues<typeof SUPPORTED_COMMANDS>;
654
+ //#endregion
655
+ //#region ../powerlines/src/types/plugin.d.ts
656
+ interface PluginHookObject<THookFunction extends FunctionLike, TFilter extends keyof HookFilter = never> {
657
+ /**
658
+ * The order in which the plugin should be applied.
659
+ */
660
+ order?: "pre" | "post" | null | undefined;
661
+ /**
662
+ * A filter to determine when the hook should be called.
663
+ */
664
+ filter?: Pick<HookFilter, TFilter>;
665
+ /**
666
+ * The hook function to be called.
667
+ */
668
+ handler: THookFunction;
669
+ }
670
+ type PluginHook<THookFunction extends FunctionLike, TFilter extends keyof HookFilter = never> = THookFunction | PluginHookObject<THookFunction, TFilter>;
671
+ /**
672
+ * A result returned by the plugin from the `types` hook that describes the declaration types output file.
673
+ */
674
+ interface TypesResult {
675
+ directives?: string[];
676
+ code: string;
677
+ }
678
+ type DeepPartial$1<T> = { [K in keyof T]?: DeepPartial$1<T[K]> };
679
+ type ConfigResult<TContext extends PluginContext = PluginContext> = DeepPartial$1<TContext["config"]> & Record<string, any>;
680
+ interface BasePluginHookFunctions<TContext extends PluginContext = PluginContext> extends Record<CommandType, (this: TContext) => MaybePromise<void>> {
681
+ /**
682
+ * A function that returns configuration options to be merged with the build context's options.
683
+ *
684
+ * @remarks
685
+ * 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.
686
+ *
687
+ * @warning User plugins are resolved before running this hook so injecting other plugins inside the config hook will have no effect.
688
+ *
689
+ * @see https://vitejs.dev/guide/api-plugin#config
690
+ *
691
+ * @param this - The build context.
692
+ * @param config - The partial configuration object to be modified.
693
+ * @returns A promise that resolves to a partial configuration object.
694
+ */
695
+ config: (this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>;
696
+ /**
697
+ * 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.
698
+ *
699
+ * @remarks
700
+ * 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.
701
+ *
702
+ * @see https://vitejs.dev/guide/api-plugin#configenvironment
703
+ *
704
+ * @param this - The build context.
705
+ * @param name - The name of the environment being configured.
706
+ * @param environment - The Vite-like environment object containing information about the current build environment.
707
+ * @returns A promise that resolves when the hook is complete.
708
+ */
709
+ configEnvironment: (this: TContext, name: string, environment: EnvironmentConfig) => MaybePromise<Partial<EnvironmentResolvedConfig> | undefined | null>;
710
+ /**
711
+ * A hook that is called when the plugin is resolved.
712
+ *
713
+ * @see https://vitejs.dev/guide/api-plugin#configresolved
714
+ *
715
+ * @param this - The build context.
716
+ * @returns A promise that resolves when the hook is complete.
717
+ */
718
+ configResolved: (this: TContext) => MaybePromise<void>;
719
+ /**
720
+ * 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.
721
+ *
722
+ * @param this - The build context.
723
+ * @param code - The source code to generate types for.
724
+ * @returns A promise that resolves when the hook is complete.
725
+ */
726
+ types: (this: TContext, code: string) => MaybePromise<TypesResult | string | undefined | null>;
727
+ /**
728
+ * A hook that is called at the start of the build process.
729
+ *
730
+ * @param this - The build context and unplugin build context.
731
+ * @returns A promise that resolves when the hook is complete.
732
+ */
733
+ buildStart: (this: BuildPluginContext<TContext["config"]> & TContext) => MaybePromise<void>;
734
+ /**
735
+ * A hook that is called at the end of the build process.
736
+ *
737
+ * @param this - The build context and unplugin build context.
738
+ * @returns A promise that resolves when the hook is complete.
739
+ */
740
+ buildEnd: (this: BuildPluginContext<TContext["config"]> & TContext) => MaybePromise<void>;
741
+ /**
742
+ * A hook that is called to transform the source code.
743
+ *
744
+ * @param this - The build context, unplugin build context, and unplugin context.
745
+ * @param code - The source code to transform.
746
+ * @param id - The identifier of the source code.
747
+ * @returns A promise that resolves when the hook is complete.
748
+ */
749
+ transform: (this: BuildPluginContext<TContext["config"]> & TContext, code: string, id: string) => MaybePromise<TransformResult>;
750
+ /**
751
+ * A hook that is called to load the source code.
752
+ *
753
+ * @param this - The build context, unplugin build context, and unplugin context.
754
+ * @param id - The identifier of the source code.
755
+ * @returns A promise that resolves when the hook is complete.
756
+ */
757
+ load: (this: BuildPluginContext<TContext["config"]> & TContext, id: string) => MaybePromise<TransformResult>;
758
+ /**
759
+ * A hook that is called to resolve the identifier of the source code.
760
+ *
761
+ * @param this - The build context, unplugin build context, and unplugin context.
762
+ * @param id - The identifier of the source code.
763
+ * @param importer - The importer of the source code.
764
+ * @param options - The options for resolving the identifier.
765
+ * @returns A promise that resolves when the hook is complete.
766
+ */
767
+ resolveId: (this: BuildPluginContext<TContext["config"]> & TContext, id: string, importer: string | undefined, options: {
768
+ isEntry: boolean;
769
+ }) => MaybePromise<string | ExternalIdResult | null | undefined>;
770
+ /**
771
+ * A hook that is called to write the bundle to disk.
772
+ *
773
+ * @param this - The build context.
774
+ * @returns A promise that resolves when the hook is complete.
775
+ */
776
+ writeBundle: (this: TContext) => MaybePromise<void>;
777
+ }
778
+ type BuildPlugin<TContext extends PluginContext = PluginContext, TBuildVariant$1 extends UnpluginBuildVariant = UnpluginBuildVariant, TOptions extends Required<UnpluginOptions>[TBuildVariant$1] = Required<UnpluginOptions>[TBuildVariant$1]> = { [TKey in keyof TOptions]: TOptions[TKey] extends FunctionLike ? (this: ThisParameterType<TOptions[TKey]> & TContext, ...args: Parameters<TOptions[TKey]>) => ReturnType<TOptions[TKey]> | MaybePromise<ReturnType<TOptions[TKey]>> : TOptions[TKey] };
779
+ type PluginHooks<TContext extends PluginContext = PluginContext> = { [TKey in keyof BasePluginHookFunctions<TContext>]: PluginHook<BasePluginHookFunctions<TContext>[TKey]> } & {
780
+ /**
781
+ * A function that returns configuration options to be merged with the build context's options.
782
+ *
783
+ * @remarks
784
+ * 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.
785
+ *
786
+ * @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.
787
+ *
788
+ * @see https://vitejs.dev/guide/api-plugin#config
789
+ *
790
+ * @param this - The build context.
791
+ * @param config - The partial configuration object to be modified.
792
+ * @returns A promise that resolves to a partial configuration object.
793
+ */
794
+ config: PluginHook<(this: UnresolvedContext<TContext["config"]>) => MaybePromise<ConfigResult<TContext>>> | ConfigResult<TContext>;
795
+ /**
796
+ * A hook that is called to transform the source code.
797
+ *
798
+ * @param this - The build context, unplugin build context, and unplugin context.
799
+ * @param code - The source code to transform.
800
+ * @param id - The identifier of the source code.
801
+ * @returns A promise that resolves when the hook is complete.
802
+ */
803
+ transform: PluginHook<(this: BuildPluginContext<TContext["config"]> & TContext, code: string, id: string) => MaybePromise<TransformResult>, "code" | "id">;
804
+ /**
805
+ * A hook that is called to load the source code.
806
+ *
807
+ * @param this - The build context, unplugin build context, and unplugin context.
808
+ * @param id - The identifier of the source code.
809
+ * @returns A promise that resolves when the hook is complete.
810
+ */
811
+ load: PluginHook<(this: BuildPluginContext<TContext["config"]> & TContext, id: string) => MaybePromise<TransformResult>, "id">;
812
+ /**
813
+ * A hook that is called to resolve the identifier of the source code.
814
+ *
815
+ * @param this - The build context, unplugin build context, and unplugin context.
816
+ * @param id - The identifier of the source code.
817
+ * @param importer - The importer of the source code.
818
+ * @param options - The options for resolving the identifier.
819
+ * @returns A promise that resolves when the hook is complete.
820
+ */
821
+ resolveId: PluginHook<(this: BuildPluginContext<TContext["config"]> & TContext, id: string, importer: string | undefined, options: {
822
+ isEntry: boolean;
823
+ }) => MaybePromise<string | ExternalIdResult | null | undefined>, "id">;
824
+ };
825
+ type PluginBuildPlugins<TContext extends PluginContext = PluginContext> = { [TBuildVariant in UnpluginBuildVariant]?: BuildPlugin<TContext, TBuildVariant> };
826
+ interface Plugin<TContext extends PluginContext<ResolvedConfig> = PluginContext<ResolvedConfig>> extends Partial<PluginHooks<TContext>>, PluginBuildPlugins<TContext> {
827
+ /**
828
+ * The name of the plugin, for use in deduplication, error messages and logs.
829
+ */
830
+ name: string;
831
+ /**
832
+ * An API object that can be used for inter-plugin communication.
833
+ *
834
+ * @see https://rollupjs.org/plugin-development/#direct-plugin-communication
835
+ */
836
+ api?: Record<string, any>;
837
+ /**
838
+ * Enforce plugin invocation tier similar to webpack loaders. Hooks ordering is still subject to the `order` property in the hook object.
839
+ *
840
+ * @remarks
841
+ * The Plugin invocation order is as follows:
842
+ * - `enforce: 'pre'` plugins
843
+ * - `order: 'pre'` plugin hooks
844
+ * - any other plugins (normal)
845
+ * - `order: 'post'` plugin hooks
846
+ * - `enforce: 'post'` plugins
847
+ *
848
+ * @see https://vitejs.dev/guide/api-plugin.html#plugin-ordering
849
+ * @see https://rollupjs.org/plugin-development/#build-hooks
850
+ * @see https://webpack.js.org/concepts/loaders/#enforce---pre-and-post
851
+ * @see https://esbuild.github.io/plugins/#concepts
852
+ */
853
+ enforce?: "pre" | "post";
854
+ /**
855
+ * A function to determine if two plugins are the same and can be de-duplicated.
856
+ *
857
+ * @remarks
858
+ * If this is not provided, plugins are de-duplicated by comparing their names.
859
+ *
860
+ * @param other - The other plugin to compare against.
861
+ * @returns `true` if the two plugins are the same, `false` otherwise.
862
+ */
863
+ dedupe?: false | ((other: Plugin<any>) => boolean);
864
+ /**
865
+ * A list of pre-requisite plugins that must be loaded before this plugin can be used.
866
+ */
867
+ /**
868
+ * Define environments where this plugin should be active. By default, the plugin is active in all environments.
869
+ *
870
+ * @param environment - The environment to check.
871
+ * @returns `true` if the plugin should be active in the specified environment, `false` otherwise.
872
+ */
873
+ applyToEnvironment?: (environment: EnvironmentResolvedConfig) => boolean | PluginConfig<TContext>;
874
+ }
875
+ //#endregion
876
+ //#region ../powerlines/src/types/tsconfig.d.ts
877
+ type ReflectionMode = "default" | "explicit" | "never";
878
+ type RawReflectionMode = ReflectionMode | "" | boolean | string | string[] | undefined;
879
+ /**
880
+ * Defines the level of reflection to be used during the transpilation process.
881
+ *
882
+ * @remarks
883
+ * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
884
+ * - `minimal` - Only the essential type information is captured.
885
+ * - `normal` - Additional type information is captured, including some contextual data.
886
+ * - `verbose` - All available type information is captured, including detailed contextual data.
887
+ */
888
+ type ReflectionLevel = "minimal" | "normal" | "verbose";
889
+ interface DeepkitOptions {
890
+ /**
891
+ * Either true to activate reflection for all files compiled using this tsconfig,
892
+ * or a list of globs/file paths relative to this tsconfig.json.
893
+ * Globs/file paths can be prefixed with a ! to exclude them.
894
+ */
895
+ reflection?: RawReflectionMode;
896
+ /**
897
+ * Defines the level of reflection to be used during the transpilation process.
898
+ *
899
+ * @remarks
900
+ * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
901
+ * - `minimal` - Only the essential type information is captured.
902
+ * - `normal` - Additional type information is captured, including some contextual data.
903
+ * - `verbose` - All available type information is captured, including detailed contextual data.
904
+ */
905
+ reflectionLevel?: ReflectionLevel;
906
+ }
907
+ type TSCompilerOptions = CompilerOptions & DeepkitOptions;
908
+ /**
909
+ * The TypeScript compiler configuration.
910
+ *
911
+ * @see https://www.typescriptlang.org/docs/handbook/tsconfig-json.html
912
+ */
913
+ interface TSConfig extends Omit<TsConfigJson, "reflection"> {
914
+ /**
915
+ * Either true to activate reflection for all files compiled using this tsconfig,
916
+ * or a list of globs/file paths relative to this tsconfig.json.
917
+ * Globs/file paths can be prefixed with a ! to exclude them.
918
+ */
919
+ reflection?: RawReflectionMode;
920
+ /**
921
+ * Defines the level of reflection to be used during the transpilation process.
922
+ *
923
+ * @remarks
924
+ * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values:
925
+ * - `minimal` - Only the essential type information is captured.
926
+ * - `normal` - Additional type information is captured, including some contextual data.
927
+ * - `verbose` - All available type information is captured, including detailed contextual data.
928
+ */
929
+ reflectionLevel?: ReflectionLevel;
930
+ /**
931
+ * Instructs the TypeScript compiler how to compile `.ts` files.
932
+ */
933
+ compilerOptions?: TSCompilerOptions;
934
+ }
935
+ type ParsedTypeScriptConfig = ts.ParsedCommandLine & {
936
+ originalTsconfigJson: TsConfigJson;
937
+ tsconfigJson: TSConfig;
938
+ tsconfigFilePath: string;
939
+ };
940
+ //#endregion
941
+ //#region ../powerlines/src/types/context.d.ts
942
+ /**
943
+ * The severity level of a {@link LogRecord}.
944
+ */
945
+ type LogLevel = "debug" | "info" | "warning" | "error" | "fatal";
946
+ declare const LogLevel: {
947
+ DEBUG: LogLevel;
948
+ INFO: LogLevel;
949
+ WARNING: LogLevel;
950
+ ERROR: LogLevel;
951
+ FATAL: LogLevel;
952
+ };
953
+ interface MetaInfo {
954
+ /**
955
+ * The checksum generated from the resolved options
956
+ */
957
+ checksum: string;
958
+ /**
959
+ * The build id
960
+ */
961
+ buildId: string;
962
+ /**
963
+ * The release id
964
+ */
965
+ releaseId: string;
966
+ /**
967
+ * The build timestamp
968
+ */
969
+ timestamp: number;
970
+ /**
971
+ * A hash that represents the path to the project root directory
972
+ */
973
+ projectRootHash: string;
974
+ /**
975
+ * A hash that represents the path to the project root directory
976
+ */
977
+ configHash: string;
978
+ }
979
+ interface Resolver extends Jiti {
980
+ plugin: Jiti;
981
+ }
982
+ interface TransformResult$1 {
983
+ code: string;
984
+ map: SourceMap | null;
985
+ }
986
+ /**
987
+ * Options for initializing or updating the context with new configuration values
988
+ */
989
+ interface InitContextOptions {
990
+ /**
991
+ * If false, the plugin will be loaded after all other plugins.
992
+ *
993
+ * @defaultValue true
994
+ */
995
+ isHighPriority: boolean;
996
+ }
997
+ /**
998
+ * Options for fetch requests made via the context's {@link Context.fetch} method
999
+ */
1000
+ interface FetchOptions extends FetchRequestOptions {
1001
+ /**
1002
+ * An indicator specifying that the request should bypass any caching
1003
+ */
1004
+ skipCache?: boolean;
1005
+ }
1006
+ /**
1007
+ * Options for parsing code using [Oxc-Parser](https://github.com/oxc/oxc)
1008
+ */
1009
+ interface ParseOptions extends ParserOptions {
1010
+ /**
1011
+ * When true this allows return statements to be outside functions to e.g. support parsing CommonJS code.
1012
+ */
1013
+ allowReturnOutsideFunction?: boolean;
1014
+ }
1015
+ interface EmitOptions extends WriteOptions {
1016
+ /**
1017
+ * If true, will emit the file using {@link UnpluginBuildContext.emitFile | the bundler's emit function}.
1018
+ */
1019
+ emitWithBundler?: boolean;
1020
+ needsCodeReference?: Parameters<UnpluginBuildContext["emitFile"]>[0]["needsCodeReference"];
1021
+ originalFileName?: Parameters<UnpluginBuildContext["emitFile"]>[0]["originalFileName"];
1022
+ }
1023
+ /**
1024
+ * Options for emitting entry virtual files
1025
+ */
1026
+ type EmitEntryOptions = EmitOptions & Omit<ResolvedEntryTypeDefinition, "file">;
1027
+ /**
1028
+ * The unresolved Powerlines context.
1029
+ *
1030
+ * @remarks
1031
+ * This context is used before the user configuration has been fully resolved after the `config`.
1032
+ */
1033
+ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
1034
+ /**
1035
+ * The Storm workspace configuration
1036
+ */
1037
+ workspaceConfig: WorkspaceConfig;
1038
+ /**
1039
+ * An object containing the options provided to Powerlines
1040
+ */
1041
+ config: Omit<TResolvedConfig["userConfig"], "build" | "output"> & Required<Pick<TResolvedConfig["userConfig"], "build" | "output">> & {
1042
+ projectRoot: NonUndefined<TResolvedConfig["userConfig"]["root"]>;
1043
+ sourceRoot: NonUndefined<TResolvedConfig["userConfig"]["sourceRoot"]>;
1044
+ output: TResolvedConfig["output"];
1045
+ };
1046
+ /**
1047
+ * A logging function for the Powerlines engine
1048
+ */
1049
+ log: LogFn;
1050
+ /**
1051
+ * A logging function for fatal messages
1052
+ */
1053
+ fatal: (message: string | UnpluginMessage) => void;
1054
+ /**
1055
+ * A logging function for error messages
1056
+ */
1057
+ error: (message: string | UnpluginMessage) => void;
1058
+ /**
1059
+ * A logging function for warning messages
1060
+ */
1061
+ warn: (message: string | UnpluginMessage) => void;
1062
+ /**
1063
+ * A logging function for informational messages
1064
+ */
1065
+ info: (message: string | UnpluginMessage) => void;
1066
+ /**
1067
+ * A logging function for debug messages
1068
+ */
1069
+ debug: (message: string | UnpluginMessage) => void;
1070
+ /**
1071
+ * A logging function for trace messages
1072
+ */
1073
+ trace: (message: string | UnpluginMessage) => void;
1074
+ /**
1075
+ * The metadata information
1076
+ */
1077
+ meta: MetaInfo;
1078
+ /**
1079
+ * The metadata information currently written to disk
1080
+ */
1081
+ persistedMeta?: MetaInfo;
1082
+ /**
1083
+ * The Powerlines artifacts directory
1084
+ */
1085
+ artifactsPath: string;
1086
+ /**
1087
+ * The path to the Powerlines builtin runtime modules directory
1088
+ */
1089
+ builtinsPath: string;
1090
+ /**
1091
+ * The path to the Powerlines entry modules directory
1092
+ */
1093
+ entryPath: string;
1094
+ /**
1095
+ * The path to the Powerlines TypeScript declaration files directory
1096
+ */
1097
+ dtsPath: string;
1098
+ /**
1099
+ * The path to a directory where the reflection data buffers (used by the build processes) are stored
1100
+ */
1101
+ dataPath: string;
1102
+ /**
1103
+ * The path to a directory where the project cache (used by the build processes) is stored
1104
+ */
1105
+ cachePath: string;
1106
+ /**
1107
+ * The Powerlines environment paths
1108
+ */
1109
+ envPaths: EnvPaths;
1110
+ /**
1111
+ * The file system path to the Powerlines package installation
1112
+ */
1113
+ powerlinesPath: string;
1114
+ /**
1115
+ * The relative path to the Powerlines workspace root directory
1116
+ */
1117
+ relativeToWorkspaceRoot: string;
1118
+ /**
1119
+ * The project's `package.json` file content
1120
+ */
1121
+ packageJson: PackageJson & Record<string, any>;
1122
+ /**
1123
+ * The project's `project.json` file content
1124
+ */
1125
+ projectJson?: Record<string, any>;
1126
+ /**
1127
+ * The dependency installations required by the project
1128
+ */
1129
+ dependencies: Record<string, string | Range>;
1130
+ /**
1131
+ * The development dependency installations required by the project
1132
+ */
1133
+ devDependencies: Record<string, string | Range>;
1134
+ /**
1135
+ * The parsed TypeScript configuration from the `tsconfig.json` file
1136
+ */
1137
+ tsconfig: ParsedTypeScriptConfig;
1138
+ /**
1139
+ * The entry points of the source code
1140
+ */
1141
+ entry: ResolvedEntryTypeDefinition[];
1142
+ /**
1143
+ * The virtual file system manager used during the build process to reference generated runtime files
1144
+ */
1145
+ fs: VirtualFileSystemInterface;
1146
+ /**
1147
+ * The Jiti module resolver
1148
+ */
1149
+ resolver: Resolver;
1150
+ /**
1151
+ * The builtin module id that exist in the Powerlines virtual file system
1152
+ */
1153
+ builtins: string[];
1154
+ /**
1155
+ * The {@link Project} instance used for type reflection and module manipulation
1156
+ *
1157
+ * @see https://ts-morph.com/
1158
+ *
1159
+ * @remarks
1160
+ * This instance is created lazily on first access.
1161
+ */
1162
+ program: Project;
1163
+ /**
1164
+ * A function to perform HTTP fetch requests
1165
+ *
1166
+ * @remarks
1167
+ * This function uses a caching layer to avoid duplicate requests during the Powerlines process.
1168
+ *
1169
+ * @example
1170
+ * ```ts
1171
+ * const response = await context.fetch("https://api.example.com/data");
1172
+ * const data = await response.json();
1173
+ * ```
1174
+ *
1175
+ * @see https://github.com/nodejs/undici
1176
+ *
1177
+ * @param input - The URL to fetch.
1178
+ * @param options - The fetch request options.
1179
+ * @returns A promise that resolves to a response returned by the fetch.
1180
+ */
1181
+ fetch: (input: RequestInfo, options?: FetchOptions) => Promise<Response>;
1182
+ /**
1183
+ * Parse code using [Oxc-Parser](https://github.com/oxc/oxc) into an (ESTree-compatible)[https://github.com/estree/estree] AST object.
1184
+ *
1185
+ * @remarks
1186
+ * This function can be used to parse TypeScript code into an AST for further analysis or transformation.
1187
+ *
1188
+ * @example
1189
+ * ```ts
1190
+ * const ast = context.parse("const x: number = 42;");
1191
+ * ```
1192
+ *
1193
+ * @see https://rollupjs.org/plugin-development/#this-parse
1194
+ * @see https://github.com/oxc/oxc
1195
+ *
1196
+ * @param code - The source code to parse.
1197
+ * @param options - The options to pass to the parser.
1198
+ * @returns An (ESTree-compatible)[https://github.com/estree/estree] AST object.
1199
+ */
1200
+ parse: (code: string, options?: ParseOptions) => Promise<ParseResult>;
1201
+ /**
1202
+ * A helper function to resolve modules using the Jiti resolver
1203
+ *
1204
+ * @remarks
1205
+ * This function can be used to resolve modules relative to the project root directory.
1206
+ *
1207
+ * @example
1208
+ * ```ts
1209
+ * const resolvedPath = await context.resolve("some-module", "/path/to/importer");
1210
+ * ```
1211
+ *
1212
+ * @param id - The module to resolve.
1213
+ * @param importer - An optional path to the importer module.
1214
+ * @param options - Additional resolution options.
1215
+ * @returns A promise that resolves to the resolved module path.
1216
+ */
1217
+ resolve: (id: string, importer?: string, options?: ResolveOptions$1) => Promise<ExternalIdResult | undefined>;
1218
+ /**
1219
+ * A helper function to load modules using the Jiti resolver
1220
+ *
1221
+ * @remarks
1222
+ * This function can be used to load modules relative to the project root directory.
1223
+ *
1224
+ * @example
1225
+ * ```ts
1226
+ * const module = await context.load("some-module", "/path/to/importer");
1227
+ * ```
1228
+ *
1229
+ * @param id - The module to load.
1230
+ * @returns A promise that resolves to the loaded module.
1231
+ */
1232
+ load: (id: string) => Promise<TransformResult$1 | undefined>;
1233
+ /**
1234
+ * The Powerlines builtin virtual files
1235
+ */
1236
+ getBuiltins: () => Promise<VirtualFile[]>;
1237
+ /**
1238
+ * Resolves a file and writes it to the VFS if it does not already exist
1239
+ *
1240
+ * @param code - The source code of the file
1241
+ * @param path - The path to write the file to
1242
+ * @param options - Additional options for writing the file
1243
+ */
1244
+ emit: (code: string, path: string, options?: EmitOptions) => Promise<void>;
1245
+ /**
1246
+ * Synchronously resolves a file and writes it to the VFS if it does not already exist
1247
+ *
1248
+ * @param code - The source code of the file
1249
+ * @param path - The path to write the file to
1250
+ * @param options - Additional options for writing the file
1251
+ */
1252
+ emitSync: (code: string, path: string, options?: EmitOptions) => void;
1253
+ /**
1254
+ * Resolves a builtin virtual file and writes it to the VFS if it does not already exist
1255
+ *
1256
+ * @param code - The source code of the builtin file
1257
+ * @param id - The unique identifier of the builtin file
1258
+ * @param path - An optional path to write the builtin file to
1259
+ * @param options - Additional options for writing the builtin file
1260
+ */
1261
+ emitBuiltin: (code: string, id: string, path?: string, options?: EmitOptions) => Promise<void>;
1262
+ /**
1263
+ * Synchronously resolves a builtin virtual file and writes it to the VFS if it does not already exist
1264
+ *
1265
+ * @param code - The source code of the builtin file
1266
+ * @param id - The unique identifier of the builtin file
1267
+ * @param path - An optional path to write the builtin file to
1268
+ * @param options - Additional options for writing the builtin file
1269
+ */
1270
+ emitBuiltinSync: (code: string, id: string, path?: string, options?: EmitOptions) => void;
1271
+ /**
1272
+ * Resolves a entry virtual file and writes it to the VFS if it does not already exist
1273
+ *
1274
+ * @param code - The source code of the entry file
1275
+ * @param path - An optional path to write the entry file to
1276
+ * @param options - Additional options for writing the entry file
1277
+ */
1278
+ emitEntry: (code: string, path: string, options?: EmitEntryOptions) => Promise<void>;
1279
+ /**
1280
+ * Synchronously resolves a entry virtual file and writes it to the VFS if it does not already exist
1281
+ *
1282
+ * @param code - The source code of the entry file
1283
+ * @param path - An optional path to write the entry file to
1284
+ * @param options - Additional options for writing the entry file
1285
+ */
1286
+ emitEntrySync: (code: string, path: string, options?: EmitEntryOptions) => void;
1287
+ /**
1288
+ * A function to update the context fields using a new user configuration options
1289
+ */
1290
+ withUserConfig: (userConfig: UserConfig, options?: InitContextOptions) => Promise<void>;
1291
+ /**
1292
+ * A function to update the context fields using inline configuration options
1293
+ */
1294
+ withInlineConfig: (inlineConfig: InlineConfig, options?: InitContextOptions) => Promise<void>;
1295
+ /**
1296
+ * Create a new logger instance
1297
+ *
1298
+ * @param name - The name to use for the logger instance
1299
+ * @returns A logger function
1300
+ */
1301
+ createLog: (name: string | null) => LogFn;
1302
+ /**
1303
+ * Extend the current logger instance with a new name
1304
+ *
1305
+ * @param name - The name to use for the extended logger instance
1306
+ * @returns A logger function
1307
+ */
1308
+ extendLog: (name: string) => LogFn;
1309
+ /**
1310
+ * Generates a checksum representing the current context state
1311
+ *
1312
+ * @returns A promise that resolves to a string representing the checksum
1313
+ */
1314
+ generateChecksum: () => Promise<string>;
1315
+ }
1316
+ type Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = Omit<UnresolvedContext<TResolvedConfig>, "config"> & {
1317
+ /**
1318
+ * The fully resolved Powerlines configuration
1319
+ */
1320
+ config: TResolvedConfig;
1321
+ };
1322
+ interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig>, UnpluginContext {
1323
+ /**
1324
+ * The environment specific resolved configuration
1325
+ */
1326
+ environment: EnvironmentResolvedConfig;
1327
+ /**
1328
+ * An alternative property name for the {@link log} property
1329
+ *
1330
+ * @remarks
1331
+ * This is provided for compatibility with other logging libraries that expect a `logger` property.
1332
+ */
1333
+ logger: LogFn;
1334
+ }
1335
+ type BuildPluginContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = UnpluginBuildContext & PluginContext<TResolvedConfig>;
1336
+ //#endregion
1337
+ //#region ../powerlines/src/types/babel.d.ts
1338
+ type BabelPluginPass<TState = unknown> = PluginPass & TState;
1339
+ type BabelTransformPluginFilter = (code: string, id: string) => boolean;
1340
+ type BabelTransformPlugin<TContext extends Context = Context, TOptions extends Record<string, any> = Record<string, any>, TState = unknown> = ((context: TContext) => (options: {
1341
+ name: string;
1342
+ log: LogFn;
1343
+ api: BabelAPI;
1344
+ options: TOptions;
1345
+ context: TContext;
1346
+ dirname: string;
1347
+ }) => PluginObj<TOptions & BabelPluginPass<TState>>) & {
1348
+ $$name: string;
1349
+ };
1350
+ type BabelTransformPluginOptions<TContext extends Context = Context, TOptions extends Record<string, any> = Record<string, any>, TState = unknown> = PluginItem | BabelTransformPlugin<TContext, TOptions, TState> | [BabelTransformPlugin<TContext, TOptions, TState>, TOptions] | [BabelTransformPlugin<TContext, TOptions, TState>, TOptions, BabelTransformPluginFilter];
1351
+ type DeclareBabelTransformPluginReturn<TContext extends Context = Context, TOptions extends Record<string, any> = Record<string, any>, TState = any> = Omit<BabelTransformPlugin<TContext, TOptions, TState>, "$$name"> & Required<Pick<BabelTransformPlugin<TContext, TOptions, TState>, "$$name">>;
1352
+ //#endregion
1353
+ //#region ../powerlines/src/types/config.d.ts
1354
+ type LogFn = (type: LogLevelLabel, ...args: string[]) => void;
1355
+ /**
1356
+ * The {@link StormWorkspaceConfig | configuration} object for an entire Powerlines workspace
1357
+ */
1358
+ type WorkspaceConfig = Partial<StormWorkspaceConfig> & Required<Pick<StormWorkspaceConfig, "workspaceRoot">>;
1359
+ type PluginFactory<in out TContext extends PluginContext = PluginContext, TOptions = any> = (options: TOptions) => MaybePromise<Plugin<TContext> | Plugin<TContext>[]>;
1360
+ /**
1361
+ * A configuration tuple for a Powerlines plugin.
1362
+ */
1363
+ type PluginConfigTuple<TContext extends PluginContext = PluginContext, TOptions = any> = [string | PluginFactory<TContext, TOptions>, TOptions] | [Plugin<TContext>];
1364
+ /**
1365
+ * A configuration object for a Powerlines plugin.
1366
+ */
1367
+ type PluginConfigObject<TContext extends PluginContext = PluginContext, TOptions = any> = {
1368
+ plugin: string | PluginFactory<TContext, TOptions>;
1369
+ options: TOptions;
1370
+ } | {
1371
+ plugin: Plugin<TContext>;
1372
+ options?: never;
1373
+ };
1374
+ /**
1375
+ * A configuration tuple for a Powerlines plugin.
1376
+ */
1377
+ type PluginConfig<TContext extends PluginContext = PluginContext> = string | PluginFactory<TContext, void> | Plugin<TContext> | PluginConfigTuple<TContext> | PluginConfigObject<TContext> | Promise<PluginConfig<TContext>> | PluginConfig<TContext>[];
1378
+ type ProjectType = "application" | "library";
1379
+ type BabelUserConfig = Parameters<typeof transformAsync>[1] & {
1380
+ /**
1381
+ * The Babel plugins to be used during the build process
1382
+ */
1383
+ plugins?: BabelTransformPluginOptions[];
1384
+ /**
1385
+ * The Babel presets to be used during the build process
1386
+ */
1387
+ presets?: BabelTransformPluginOptions[];
1388
+ };
1389
+ interface DeployConfig {
1390
+ /**
1391
+ * The deployment variant being used by the Powerlines engine.
1392
+ *
1393
+ * @example
1394
+ * ```ts
1395
+ * export default defineConfig({
1396
+ * deploy: {
1397
+ * variant: "cloudflare"
1398
+ * }
1399
+ * });
1400
+ *
1401
+ * ```
1402
+ */
1403
+ variant?: string;
1404
+ }
1405
+ interface OutputConfig {
1406
+ /**
1407
+ * The path to output the final compiled files to
1408
+ *
1409
+ * @remarks
1410
+ * If a value is not provided, Powerlines will attempt to:
1411
+ * 1. Use the `outDir` value in the `tsconfig.json` file.
1412
+ * 2. Use the `dist` directory in the project root directory.
1413
+ *
1414
+ * @defaultValue "dist/\{projectRoot\}"
1415
+ */
1416
+ outputPath?: string;
1417
+ /**
1418
+ * The output directory path for the project build.
1419
+ *
1420
+ * @remarks
1421
+ * 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.
1422
+ *
1423
+ * @defaultValue "\{projectRoot\}/dist"
1424
+ */
1425
+ buildPath?: string;
1426
+ /**
1427
+ * The folder where the generated runtime artifacts will be located
1428
+ *
1429
+ * @remarks
1430
+ * This folder will contain all runtime artifacts and builtins generated during the "prepare" phase.
1431
+ *
1432
+ * @defaultValue "\{projectRoot\}/.powerlines"
1433
+ */
1434
+ artifactsPath?: string;
1435
+ /**
1436
+ * The path of the generated runtime declaration file relative to the workspace root.
1437
+ *
1438
+ * @defaultValue "\{projectRoot\}/powerlines.d.ts"
1439
+ */
1440
+ dts?: string | false;
1441
+ /**
1442
+ * A prefix to use for identifying builtin modules
1443
+ *
1444
+ * @remarks
1445
+ * This prefix will be used to identify all builtin modules generated during the "prepare" phase. An example builtin ID for a module called `"utils"` would be `"{builtinPrefix}:utils"`.
1446
+ *
1447
+ * @defaultValue "powerlines"
1448
+ */
1449
+ builtinPrefix?: string;
1450
+ /**
1451
+ * The module format of the output files
1452
+ *
1453
+ * @remarks
1454
+ * 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.
1455
+ *
1456
+ * @defaultValue "esm"
1457
+ */
1458
+ format?: Format | Format[];
1459
+ /**
1460
+ * A list of assets to copy to the output directory
1461
+ *
1462
+ * @remarks
1463
+ * 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.
1464
+ */
1465
+ assets?: Array<string | AssetGlob>;
1466
+ /**
1467
+ * A string preset or a custom {@link StoragePort} to provide fine-grained control over generated/output file storage.
1468
+ *
1469
+ * @remarks
1470
+ * If a string preset is provided, it must be one of the following values:
1471
+ * - `"virtual"`: Uses the local file system for storage.
1472
+ * - `"fs"`: Uses an in-memory virtual file system for storage.
1473
+ *
1474
+ * If a custom {@link StoragePort} is provided, it will be used for all file storage operations during the build process.
1475
+ *
1476
+ * @defaultValue "virtual"
1477
+ */
1478
+ storage?: StoragePort | StoragePreset;
1479
+ }
1480
+ interface BaseConfig {
1481
+ /**
1482
+ * The entry point(s) for the application
1483
+ */
1484
+ entry?: TypeDefinitionParameter | TypeDefinitionParameter[];
1485
+ /**
1486
+ * Configuration for the output of the build process
1487
+ */
1488
+ output?: OutputConfig;
1489
+ /**
1490
+ * Configuration for cleaning the build artifacts
1491
+ *
1492
+ * @remarks
1493
+ * If set to `false`, the cleaning process will be disabled.
1494
+ */
1495
+ clean?: Record<string, any> | false;
1496
+ /**
1497
+ * Configuration for linting the source code
1498
+ *
1499
+ * @remarks
1500
+ * If set to `false`, linting will be disabled.
1501
+ */
1502
+ lint?: Record<string, any> | false;
1503
+ /**
1504
+ * Configuration for testing the source code
1505
+ *
1506
+ * @remarks
1507
+ * If set to `false`, testing will be disabled.
1508
+ */
1509
+ test?: Record<string, any> | false;
1510
+ /**
1511
+ * Configuration for the transformation of the source code
1512
+ */
1513
+ transform?: Record<string, any>;
1514
+ /**
1515
+ * Configuration provided to build processes
1516
+ *
1517
+ * @remarks
1518
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
1519
+ */
1520
+ build?: BuildConfig;
1521
+ /**
1522
+ * Configuration for documentation generation
1523
+ *
1524
+ * @remarks
1525
+ * This configuration will be used by the documentation generation plugins during the `docs` command.
1526
+ */
1527
+ docs?: Record<string, any>;
1528
+ /**
1529
+ * Configuration for deploying the source code
1530
+ *
1531
+ * @remarks
1532
+ * If set to `false`, the deployment will be disabled.
1533
+ */
1534
+ deploy?: DeployConfig | false;
1535
+ /**
1536
+ * The path to the tsconfig file to be used by the compiler
1537
+ *
1538
+ * @remarks
1539
+ * 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).
1540
+ *
1541
+ * @defaultValue "\{projectRoot\}/tsconfig.json"
1542
+ */
1543
+ tsconfig?: string;
1544
+ /**
1545
+ * The raw {@link TSConfig} object to be used by the compiler. This object will be merged with the `tsconfig.json` file.
1546
+ *
1547
+ * @see https://www.typescriptlang.org/tsconfig
1548
+ *
1549
+ * @remarks
1550
+ * If populated, this option takes higher priority than `tsconfig`
1551
+ */
1552
+ tsconfigRaw?: TSConfig;
1553
+ }
1554
+ interface EnvironmentConfig extends BaseConfig {
1555
+ /**
1556
+ * Configuration options for the preview server
1557
+ */
1558
+ preview?: PreviewOptions;
1559
+ /**
1560
+ * A flag indicating whether the build is for a Server-Side Rendering environment.
1561
+ */
1562
+ ssr?: boolean;
1563
+ /**
1564
+ * Define if this environment is used for Server-Side Rendering
1565
+ *
1566
+ * @defaultValue "server" (if it isn't the client environment)
1567
+ */
1568
+ consumer?: "client" | "server";
1569
+ }
1570
+ interface CommonUserConfig extends BaseConfig {
1571
+ /**
1572
+ * The name of the project
1573
+ */
1574
+ name?: string;
1575
+ /**
1576
+ * The project display title
1577
+ *
1578
+ * @remarks
1579
+ * This option is used in documentation generation and other places where a human-readable title is needed.
1580
+ */
1581
+ title?: string;
1582
+ /**
1583
+ * A description of the project
1584
+ *
1585
+ * @remarks
1586
+ * If this option is not provided, the build process will try to use the \`description\` value from the `\package.json\` file.
1587
+ */
1588
+ description?: string;
1589
+ /**
1590
+ * The date to use for compatibility checks
1591
+ *
1592
+ * @remarks
1593
+ * 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.
1594
+ *
1595
+ * @see https://developers.cloudflare.com/pages/platform/compatibility-dates/
1596
+ * @see https://docs.netlify.com/configure-builds/get-started/#set-a-compatibility-date
1597
+ * @see https://github.com/unjs/compatx
1598
+ */
1599
+ compatibilityDate?: DateString;
1600
+ /**
1601
+ * The log level to use for the Powerlines processes.
1602
+ *
1603
+ * @defaultValue "info"
1604
+ */
1605
+ logLevel?: LogLevelLabel | null;
1606
+ /**
1607
+ * A custom logger function to use for logging messages
1608
+ */
1609
+ customLogger?: LogFn;
1610
+ /**
1611
+ * 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.
1612
+ *
1613
+ * @defaultValue "production"
1614
+ */
1615
+ mode?: "development" | "test" | "production";
1616
+ /**
1617
+ * The type of project being built
1618
+ *
1619
+ * @defaultValue "application"
1620
+ */
1621
+ type?: ProjectType;
1622
+ /**
1623
+ * The root directory of the project
1624
+ */
1625
+ root: string;
1626
+ /**
1627
+ * The root directory of the project's source code
1628
+ *
1629
+ * @defaultValue "\{root\}/src"
1630
+ */
1631
+ sourceRoot?: string;
1632
+ /**
1633
+ * A path to a custom configuration file to be used instead of the default `storm.json`, `powerlines.config.js`, or `powerlines.config.ts` files.
1634
+ *
1635
+ * @remarks
1636
+ * This option is useful for running Powerlines commands with different configuration files, such as in CI/CD environments or when testing different configurations.
1637
+ */
1638
+ configFile?: string;
1639
+ /**
1640
+ * Should the Powerlines CLI processes skip installing missing packages?
1641
+ *
1642
+ * @remarks
1643
+ * This option is useful for CI/CD environments where the installation of packages is handled by a different process.
1644
+ *
1645
+ * @defaultValue false
1646
+ */
1647
+ skipInstalls?: boolean;
1648
+ /**
1649
+ * Should the compiler processes skip any improvements that make use of cache?
1650
+ *
1651
+ * @defaultValue false
1652
+ */
1653
+ skipCache?: boolean;
1654
+ /**
1655
+ * A list of resolvable paths to plugins used during the build process
1656
+ */
1657
+ plugins?: PluginConfig<any>[];
1658
+ /**
1659
+ * Environment-specific configurations
1660
+ */
1661
+ environments?: Record<string, EnvironmentConfig>;
1662
+ /**
1663
+ * Should a single `build` process be ran for each environment?
1664
+ *
1665
+ * @remarks
1666
+ * This option determines how environments are managed during the `build` process. The available options are:
1667
+ *
1668
+ * - `false`: A separate build is ran for each environment.
1669
+ * - `true`: A single build is ran for all environments.
1670
+ *
1671
+ * @defaultValue false
1672
+ */
1673
+ singleBuild?: boolean;
1674
+ /**
1675
+ * A string identifier that allows a child framework or tool to identify itself when using Powerlines.
1676
+ *
1677
+ * @remarks
1678
+ * If no values are provided for {@link OutputConfig.dts | output.dts}, {@link OutputConfig.builtinPrefix | output.builtinPrefix}, or {@link OutputConfig.artifactsPath | output.artifactsFolder}, this value will be used as the default.
1679
+ *
1680
+ * @defaultValue "powerlines"
1681
+ */
1682
+ framework?: string;
1683
+ }
1684
+ interface UserConfig<TBuildConfig extends BuildConfig = BuildConfig, TBuildResolvedConfig extends BuildResolvedConfig = BuildResolvedConfig, TBuildVariant$1 extends string = any> extends Omit<CommonUserConfig, "build"> {
1685
+ /**
1686
+ * Configuration provided to build processes
1687
+ *
1688
+ * @remarks
1689
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
1690
+ */
1691
+ build: Omit<TBuildConfig, "override"> & {
1692
+ /**
1693
+ * The build variant being used by the Powerlines engine.
1694
+ */
1695
+ variant?: TBuildVariant$1;
1696
+ /**
1697
+ * An optional set of override options to apply to the selected build variant.
1698
+ *
1699
+ * @remarks
1700
+ * This option allows you to provide configuration options with the guarantee that they will **not** be overridden and will take precedence over other build configurations.
1701
+ */
1702
+ override?: Partial<TBuildResolvedConfig>;
1703
+ };
1704
+ }
1705
+ type PowerlinesCommand = "new" | "prepare" | "build" | "lint" | "test" | "docs" | "deploy" | "clean";
1706
+ /**
1707
+ * The configuration provided while executing Powerlines commands.
1708
+ */
1709
+ type InlineConfig<TUserConfig extends UserConfig = UserConfig> = Partial<TUserConfig> & {
1710
+ /**
1711
+ * A string identifier for the Powerlines command being executed
1712
+ */
1713
+ command: PowerlinesCommand;
1714
+ };
1715
+ //#endregion
1716
+ //#region ../powerlines/src/types/resolved.d.ts
1717
+ interface ResolvedEntryTypeDefinition extends TypeDefinition {
1718
+ /**
1719
+ * The user provided entry point in the source code
1720
+ */
1721
+ input?: TypeDefinition;
1722
+ /**
1723
+ * An optional name to use in the package export during the build process
1724
+ */
1725
+ output?: string;
1726
+ }
1727
+ type BabelResolvedConfig = Omit<BabelUserConfig, "plugins" | "presets"> & Required<Pick<BabelUserConfig, "plugins" | "presets">>;
1728
+ type EnvironmentResolvedConfig = Omit<EnvironmentConfig, "consumer" | "ssr" | "preview"> & Required<Pick<EnvironmentConfig, "consumer" | "ssr">> & {
1729
+ /**
1730
+ * The name of the environment
1731
+ */
1732
+ name: string;
1733
+ /**
1734
+ * Configuration options for the preview server
1735
+ */
1736
+ preview?: ResolvedPreviewOptions;
1737
+ };
1738
+ type ResolvedAssetGlob = AssetGlob & Required<Pick<AssetGlob, "input">>;
1739
+ type OutputResolvedConfig = Required<Omit<OutputConfig, "assets" | "storage"> & {
1740
+ assets: ResolvedAssetGlob[];
1741
+ }> & Pick<OutputConfig, "storage">;
1742
+ /**
1743
+ * The resolved options for the Powerlines project configuration.
1744
+ */
1745
+ type ResolvedConfig<TUserConfig extends UserConfig = UserConfig> = Omit<TUserConfig, "name" | "title" | "compatibilityDate" | "plugins" | "mode" | "environments" | "platform" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "variant" | "type" | "output" | "logLevel" | "framework" | "sourceRoot"> & Required<Pick<TUserConfig, "name" | "title" | "compatibilityDate" | "plugins" | "mode" | "environments" | "tsconfig" | "lint" | "test" | "build" | "transform" | "deploy" | "framework" | "sourceRoot">> & {
1746
+ /**
1747
+ * The configuration options that were provided inline to the Powerlines CLI.
1748
+ */
1749
+ inlineConfig: InlineConfig<TUserConfig>;
1750
+ /**
1751
+ * The original configuration options that were provided by the user to the Powerlines process.
1752
+ */
1753
+ userConfig: TUserConfig;
1754
+ /**
1755
+ * A string identifier for the Powerlines command being executed.
1756
+ */
1757
+ command: NonUndefined<InlineConfig<TUserConfig>["command"]>;
1758
+ /**
1759
+ * The root directory of the project's source code
1760
+ *
1761
+ * @defaultValue "\{projectRoot\}/src"
1762
+ */
1763
+ sourceRoot: NonUndefined<TUserConfig["sourceRoot"]>;
1764
+ /**
1765
+ * The root directory of the project.
1766
+ */
1767
+ projectRoot: NonUndefined<TUserConfig["root"]>;
1768
+ /**
1769
+ * The type of project being built.
1770
+ */
1771
+ projectType: NonUndefined<TUserConfig["type"]>;
1772
+ /**
1773
+ * The output configuration options to use for the build process
1774
+ */
1775
+ output: OutputResolvedConfig;
1776
+ /**
1777
+ * Configuration provided to build processes
1778
+ *
1779
+ * @remarks
1780
+ * This configuration can be used by plugins during the `build` command. It will generally contain options specific to the selected {@link BuildVariant | build variant}.
1781
+ */
1782
+ build: Omit<TUserConfig["build"], "override"> & Required<Pick<Required<TUserConfig["build"]>, "override">>;
1783
+ /**
1784
+ * The log level to use for the Powerlines processes.
1785
+ *
1786
+ * @defaultValue "info"
1787
+ */
1788
+ logLevel: "error" | "warn" | "info" | "debug" | "trace" | null;
1789
+ };
1790
+ //#endregion
1791
+ export { UserConfig as a, LogLevel as c, Plugin as d, StoragePreset as f, BabelUserConfig as i, PluginContext as l, EnvironmentResolvedConfig as n, DeclareBabelTransformPluginReturn as o, ResolvedConfig as r, Context as s, BabelResolvedConfig as t, UnresolvedContext as u };