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