@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
@@ -0,0 +1,414 @@
1
+ import { ResolveOptions, VirtualFile, VirtualFileSystemInterface, WriteOptions } from "./fs.cjs";
2
+ import { ParsedTypeScriptConfig } from "./tsconfig.cjs";
3
+ import { InlineConfig, LogFn, UserConfig, WorkspaceConfig } from "./config.cjs";
4
+ import { EnvironmentResolvedConfig, ResolvedConfig, ResolvedEntryTypeDefinition } from "./resolved.cjs";
5
+ import { NonUndefined } from "@stryke/types/base";
6
+ import { EnvPaths } from "@stryke/env/get-env-paths";
7
+ import { FetchRequestOptions } from "@stryke/http/fetch";
8
+ import { PackageJson } from "@stryke/types/package-json";
9
+ import { Jiti } from "jiti";
10
+ import { SourceMap } from "magic-string";
11
+ import { ParseResult, ParserOptions } from "oxc-parser";
12
+ import { Range } from "semver";
13
+ import { Project } from "ts-morph";
14
+ import { RequestInfo, Response } from "undici";
15
+ import { ExternalIdResult, UnpluginBuildContext, UnpluginContext, UnpluginMessage } from "unplugin";
16
+
17
+ //#region ../powerlines/src/types/context.d.ts
18
+
19
+ /**
20
+ * The severity level of a {@link LogRecord}.
21
+ */
22
+ type LogLevel = "debug" | "info" | "warning" | "error" | "fatal";
23
+ declare const LogLevel: {
24
+ DEBUG: LogLevel;
25
+ INFO: LogLevel;
26
+ WARNING: LogLevel;
27
+ ERROR: LogLevel;
28
+ FATAL: LogLevel;
29
+ };
30
+ interface MetaInfo {
31
+ /**
32
+ * The checksum generated from the resolved options
33
+ */
34
+ checksum: string;
35
+ /**
36
+ * The build id
37
+ */
38
+ buildId: string;
39
+ /**
40
+ * The release id
41
+ */
42
+ releaseId: string;
43
+ /**
44
+ * The build timestamp
45
+ */
46
+ timestamp: number;
47
+ /**
48
+ * A hash that represents the path to the project root directory
49
+ */
50
+ projectRootHash: string;
51
+ /**
52
+ * A hash that represents the path to the project root directory
53
+ */
54
+ configHash: string;
55
+ }
56
+ interface Resolver extends Jiti {
57
+ plugin: Jiti;
58
+ }
59
+ interface TransformResult$1 {
60
+ code: string;
61
+ map: SourceMap | null;
62
+ }
63
+ /**
64
+ * Options for initializing or updating the context with new configuration values
65
+ */
66
+ interface InitContextOptions {
67
+ /**
68
+ * If false, the plugin will be loaded after all other plugins.
69
+ *
70
+ * @defaultValue true
71
+ */
72
+ isHighPriority: boolean;
73
+ }
74
+ /**
75
+ * Options for fetch requests made via the context's {@link Context.fetch} method
76
+ */
77
+ interface FetchOptions extends FetchRequestOptions {
78
+ /**
79
+ * An indicator specifying that the request should bypass any caching
80
+ */
81
+ skipCache?: boolean;
82
+ }
83
+ /**
84
+ * Options for parsing code using [Oxc-Parser](https://github.com/oxc/oxc)
85
+ */
86
+ interface ParseOptions extends ParserOptions {
87
+ /**
88
+ * When true this allows return statements to be outside functions to e.g. support parsing CommonJS code.
89
+ */
90
+ allowReturnOutsideFunction?: boolean;
91
+ }
92
+ interface EmitOptions extends WriteOptions {
93
+ /**
94
+ * If true, will emit the file using {@link UnpluginBuildContext.emitFile | the bundler's emit function}.
95
+ */
96
+ emitWithBundler?: boolean;
97
+ needsCodeReference?: Parameters<UnpluginBuildContext["emitFile"]>[0]["needsCodeReference"];
98
+ originalFileName?: Parameters<UnpluginBuildContext["emitFile"]>[0]["originalFileName"];
99
+ }
100
+ /**
101
+ * Options for emitting entry virtual files
102
+ */
103
+ type EmitEntryOptions = EmitOptions & Omit<ResolvedEntryTypeDefinition, "file">;
104
+ /**
105
+ * The unresolved Powerlines context.
106
+ *
107
+ * @remarks
108
+ * This context is used before the user configuration has been fully resolved after the `config`.
109
+ */
110
+ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
111
+ /**
112
+ * The Storm workspace configuration
113
+ */
114
+ workspaceConfig: WorkspaceConfig;
115
+ /**
116
+ * An object containing the options provided to Powerlines
117
+ */
118
+ config: Omit<TResolvedConfig["userConfig"], "build" | "output"> & Required<Pick<TResolvedConfig["userConfig"], "build" | "output">> & {
119
+ projectRoot: NonUndefined<TResolvedConfig["userConfig"]["root"]>;
120
+ sourceRoot: NonUndefined<TResolvedConfig["userConfig"]["sourceRoot"]>;
121
+ output: TResolvedConfig["output"];
122
+ };
123
+ /**
124
+ * A logging function for the Powerlines engine
125
+ */
126
+ log: LogFn;
127
+ /**
128
+ * A logging function for fatal messages
129
+ */
130
+ fatal: (message: string | UnpluginMessage) => void;
131
+ /**
132
+ * A logging function for error messages
133
+ */
134
+ error: (message: string | UnpluginMessage) => void;
135
+ /**
136
+ * A logging function for warning messages
137
+ */
138
+ warn: (message: string | UnpluginMessage) => void;
139
+ /**
140
+ * A logging function for informational messages
141
+ */
142
+ info: (message: string | UnpluginMessage) => void;
143
+ /**
144
+ * A logging function for debug messages
145
+ */
146
+ debug: (message: string | UnpluginMessage) => void;
147
+ /**
148
+ * A logging function for trace messages
149
+ */
150
+ trace: (message: string | UnpluginMessage) => void;
151
+ /**
152
+ * The metadata information
153
+ */
154
+ meta: MetaInfo;
155
+ /**
156
+ * The metadata information currently written to disk
157
+ */
158
+ persistedMeta?: MetaInfo;
159
+ /**
160
+ * The Powerlines artifacts directory
161
+ */
162
+ artifactsPath: string;
163
+ /**
164
+ * The path to the Powerlines builtin runtime modules directory
165
+ */
166
+ builtinsPath: string;
167
+ /**
168
+ * The path to the Powerlines entry modules directory
169
+ */
170
+ entryPath: string;
171
+ /**
172
+ * The path to the Powerlines TypeScript declaration files directory
173
+ */
174
+ dtsPath: string;
175
+ /**
176
+ * The path to a directory where the reflection data buffers (used by the build processes) are stored
177
+ */
178
+ dataPath: string;
179
+ /**
180
+ * The path to a directory where the project cache (used by the build processes) is stored
181
+ */
182
+ cachePath: string;
183
+ /**
184
+ * The Powerlines environment paths
185
+ */
186
+ envPaths: EnvPaths;
187
+ /**
188
+ * The file system path to the Powerlines package installation
189
+ */
190
+ powerlinesPath: string;
191
+ /**
192
+ * The relative path to the Powerlines workspace root directory
193
+ */
194
+ relativeToWorkspaceRoot: string;
195
+ /**
196
+ * The project's `package.json` file content
197
+ */
198
+ packageJson: PackageJson & Record<string, any>;
199
+ /**
200
+ * The project's `project.json` file content
201
+ */
202
+ projectJson?: Record<string, any>;
203
+ /**
204
+ * The dependency installations required by the project
205
+ */
206
+ dependencies: Record<string, string | Range>;
207
+ /**
208
+ * The development dependency installations required by the project
209
+ */
210
+ devDependencies: Record<string, string | Range>;
211
+ /**
212
+ * The parsed TypeScript configuration from the `tsconfig.json` file
213
+ */
214
+ tsconfig: ParsedTypeScriptConfig;
215
+ /**
216
+ * The entry points of the source code
217
+ */
218
+ entry: ResolvedEntryTypeDefinition[];
219
+ /**
220
+ * The virtual file system manager used during the build process to reference generated runtime files
221
+ */
222
+ fs: VirtualFileSystemInterface;
223
+ /**
224
+ * The Jiti module resolver
225
+ */
226
+ resolver: Resolver;
227
+ /**
228
+ * The builtin module id that exist in the Powerlines virtual file system
229
+ */
230
+ builtins: string[];
231
+ /**
232
+ * The {@link Project} instance used for type reflection and module manipulation
233
+ *
234
+ * @see https://ts-morph.com/
235
+ *
236
+ * @remarks
237
+ * This instance is created lazily on first access.
238
+ */
239
+ program: Project;
240
+ /**
241
+ * A function to perform HTTP fetch requests
242
+ *
243
+ * @remarks
244
+ * This function uses a caching layer to avoid duplicate requests during the Powerlines process.
245
+ *
246
+ * @example
247
+ * ```ts
248
+ * const response = await context.fetch("https://api.example.com/data");
249
+ * const data = await response.json();
250
+ * ```
251
+ *
252
+ * @see https://github.com/nodejs/undici
253
+ *
254
+ * @param input - The URL to fetch.
255
+ * @param options - The fetch request options.
256
+ * @returns A promise that resolves to a response returned by the fetch.
257
+ */
258
+ fetch: (input: RequestInfo, options?: FetchOptions) => Promise<Response>;
259
+ /**
260
+ * Parse code using [Oxc-Parser](https://github.com/oxc/oxc) into an (ESTree-compatible)[https://github.com/estree/estree] AST object.
261
+ *
262
+ * @remarks
263
+ * This function can be used to parse TypeScript code into an AST for further analysis or transformation.
264
+ *
265
+ * @example
266
+ * ```ts
267
+ * const ast = context.parse("const x: number = 42;");
268
+ * ```
269
+ *
270
+ * @see https://rollupjs.org/plugin-development/#this-parse
271
+ * @see https://github.com/oxc/oxc
272
+ *
273
+ * @param code - The source code to parse.
274
+ * @param options - The options to pass to the parser.
275
+ * @returns An (ESTree-compatible)[https://github.com/estree/estree] AST object.
276
+ */
277
+ parse: (code: string, options?: ParseOptions) => Promise<ParseResult>;
278
+ /**
279
+ * A helper function to resolve modules using the Jiti resolver
280
+ *
281
+ * @remarks
282
+ * This function can be used to resolve modules relative to the project root directory.
283
+ *
284
+ * @example
285
+ * ```ts
286
+ * const resolvedPath = await context.resolve("some-module", "/path/to/importer");
287
+ * ```
288
+ *
289
+ * @param id - The module to resolve.
290
+ * @param importer - An optional path to the importer module.
291
+ * @param options - Additional resolution options.
292
+ * @returns A promise that resolves to the resolved module path.
293
+ */
294
+ resolve: (id: string, importer?: string, options?: ResolveOptions) => Promise<ExternalIdResult | undefined>;
295
+ /**
296
+ * A helper function to load modules using the Jiti resolver
297
+ *
298
+ * @remarks
299
+ * This function can be used to load modules relative to the project root directory.
300
+ *
301
+ * @example
302
+ * ```ts
303
+ * const module = await context.load("some-module", "/path/to/importer");
304
+ * ```
305
+ *
306
+ * @param id - The module to load.
307
+ * @returns A promise that resolves to the loaded module.
308
+ */
309
+ load: (id: string) => Promise<TransformResult$1 | undefined>;
310
+ /**
311
+ * The Powerlines builtin virtual files
312
+ */
313
+ getBuiltins: () => Promise<VirtualFile[]>;
314
+ /**
315
+ * Resolves a file and writes it to the VFS if it does not already exist
316
+ *
317
+ * @param code - The source code of the file
318
+ * @param path - The path to write the file to
319
+ * @param options - Additional options for writing the file
320
+ */
321
+ emit: (code: string, path: string, options?: EmitOptions) => Promise<void>;
322
+ /**
323
+ * Synchronously resolves a file and writes it to the VFS if it does not already exist
324
+ *
325
+ * @param code - The source code of the file
326
+ * @param path - The path to write the file to
327
+ * @param options - Additional options for writing the file
328
+ */
329
+ emitSync: (code: string, path: string, options?: EmitOptions) => void;
330
+ /**
331
+ * Resolves a builtin virtual file and writes it to the VFS if it does not already exist
332
+ *
333
+ * @param code - The source code of the builtin file
334
+ * @param id - The unique identifier of the builtin file
335
+ * @param path - An optional path to write the builtin file to
336
+ * @param options - Additional options for writing the builtin file
337
+ */
338
+ emitBuiltin: (code: string, id: string, path?: string, options?: EmitOptions) => Promise<void>;
339
+ /**
340
+ * Synchronously resolves a builtin virtual file and writes it to the VFS if it does not already exist
341
+ *
342
+ * @param code - The source code of the builtin file
343
+ * @param id - The unique identifier of the builtin file
344
+ * @param path - An optional path to write the builtin file to
345
+ * @param options - Additional options for writing the builtin file
346
+ */
347
+ emitBuiltinSync: (code: string, id: string, path?: string, options?: EmitOptions) => void;
348
+ /**
349
+ * Resolves a entry virtual file and writes it to the VFS if it does not already exist
350
+ *
351
+ * @param code - The source code of the entry file
352
+ * @param path - An optional path to write the entry file to
353
+ * @param options - Additional options for writing the entry file
354
+ */
355
+ emitEntry: (code: string, path: string, options?: EmitEntryOptions) => Promise<void>;
356
+ /**
357
+ * Synchronously resolves a entry virtual file and writes it to the VFS if it does not already exist
358
+ *
359
+ * @param code - The source code of the entry file
360
+ * @param path - An optional path to write the entry file to
361
+ * @param options - Additional options for writing the entry file
362
+ */
363
+ emitEntrySync: (code: string, path: string, options?: EmitEntryOptions) => void;
364
+ /**
365
+ * A function to update the context fields using a new user configuration options
366
+ */
367
+ withUserConfig: (userConfig: UserConfig, options?: InitContextOptions) => Promise<void>;
368
+ /**
369
+ * A function to update the context fields using inline configuration options
370
+ */
371
+ withInlineConfig: (inlineConfig: InlineConfig, options?: InitContextOptions) => Promise<void>;
372
+ /**
373
+ * Create a new logger instance
374
+ *
375
+ * @param name - The name to use for the logger instance
376
+ * @returns A logger function
377
+ */
378
+ createLog: (name: string | null) => LogFn;
379
+ /**
380
+ * Extend the current logger instance with a new name
381
+ *
382
+ * @param name - The name to use for the extended logger instance
383
+ * @returns A logger function
384
+ */
385
+ extendLog: (name: string) => LogFn;
386
+ /**
387
+ * Generates a checksum representing the current context state
388
+ *
389
+ * @returns A promise that resolves to a string representing the checksum
390
+ */
391
+ generateChecksum: () => Promise<string>;
392
+ }
393
+ type Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = Omit<UnresolvedContext<TResolvedConfig>, "config"> & {
394
+ /**
395
+ * The fully resolved Powerlines configuration
396
+ */
397
+ config: TResolvedConfig;
398
+ };
399
+ interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig>, UnpluginContext {
400
+ /**
401
+ * The environment specific resolved configuration
402
+ */
403
+ environment: EnvironmentResolvedConfig;
404
+ /**
405
+ * An alternative property name for the {@link log} property
406
+ *
407
+ * @remarks
408
+ * This is provided for compatibility with other logging libraries that expect a `logger` property.
409
+ */
410
+ logger: LogFn;
411
+ }
412
+ type BuildPluginContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = UnpluginBuildContext & PluginContext<TResolvedConfig>;
413
+ //#endregion
414
+ export { BuildPluginContext, Context, LogLevel, PluginContext, UnresolvedContext };