@powerlines/plugin-nodejs 0.1.0 → 0.1.1

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