@powerlines/plugin-unimport 0.1.57 → 0.1.59

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