@powerlines/engine 0.0.2

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 (70) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +303 -0
  3. package/dist/_internal/worker.cjs +4824 -0
  4. package/dist/_internal/worker.d.cts +38 -0
  5. package/dist/_internal/worker.d.cts.map +1 -0
  6. package/dist/_internal/worker.d.mts +38 -0
  7. package/dist/_internal/worker.d.mts.map +1 -0
  8. package/dist/_internal/worker.mjs +4785 -0
  9. package/dist/_internal/worker.mjs.map +1 -0
  10. package/dist/api.cjs +1265 -0
  11. package/dist/api.d.cts +265 -0
  12. package/dist/api.d.cts.map +1 -0
  13. package/dist/api.d.mts +265 -0
  14. package/dist/api.d.mts.map +1 -0
  15. package/dist/api.mjs +1261 -0
  16. package/dist/api.mjs.map +1 -0
  17. package/dist/base-context-BUnL_9z8.mjs +241 -0
  18. package/dist/base-context-BUnL_9z8.mjs.map +1 -0
  19. package/dist/base-context-CFvO2N9I.cjs +248 -0
  20. package/dist/chunk-C0xms8kb.cjs +34 -0
  21. package/dist/context/index.cjs +11 -0
  22. package/dist/context/index.d.cts +658 -0
  23. package/dist/context/index.d.cts.map +1 -0
  24. package/dist/context/index.d.mts +658 -0
  25. package/dist/context/index.d.mts.map +1 -0
  26. package/dist/context/index.mjs +5 -0
  27. package/dist/engine-context-BuD9AGfd.mjs +41 -0
  28. package/dist/engine-context-BuD9AGfd.mjs.map +1 -0
  29. package/dist/engine-context-NO6enYev.cjs +45 -0
  30. package/dist/execution-context-BxANz9k2.cjs +2600 -0
  31. package/dist/execution-context-CNhvjS52.mjs +2556 -0
  32. package/dist/execution-context-CNhvjS52.mjs.map +1 -0
  33. package/dist/fs-D1nIP45P.mjs +226 -0
  34. package/dist/fs-D1nIP45P.mjs.map +1 -0
  35. package/dist/fs-XogSgMqT.cjs +262 -0
  36. package/dist/index.cjs +569 -0
  37. package/dist/index.d.cts +126 -0
  38. package/dist/index.d.cts.map +1 -0
  39. package/dist/index.d.mts +126 -0
  40. package/dist/index.d.mts.map +1 -0
  41. package/dist/index.mjs +568 -0
  42. package/dist/index.mjs.map +1 -0
  43. package/dist/schemas.cjs +9 -0
  44. package/dist/schemas.d.cts +127 -0
  45. package/dist/schemas.d.cts.map +1 -0
  46. package/dist/schemas.d.mts +127 -0
  47. package/dist/schemas.d.mts.map +1 -0
  48. package/dist/schemas.mjs +3 -0
  49. package/dist/storage/index.cjs +9 -0
  50. package/dist/storage/index.d.cts +419 -0
  51. package/dist/storage/index.d.cts.map +1 -0
  52. package/dist/storage/index.d.mts +419 -0
  53. package/dist/storage/index.d.mts.map +1 -0
  54. package/dist/storage/index.mjs +3 -0
  55. package/dist/ts-morph-BaLPVAdB.cjs +114 -0
  56. package/dist/ts-morph-D0CaA37w.mjs +102 -0
  57. package/dist/ts-morph-D0CaA37w.mjs.map +1 -0
  58. package/dist/tsconfig-Cstsoprg.mjs +155 -0
  59. package/dist/tsconfig-Cstsoprg.mjs.map +1 -0
  60. package/dist/tsconfig-DeyWQC2N.cjs +198 -0
  61. package/dist/typescript/index.cjs +13 -0
  62. package/dist/typescript/index.d.cts +106 -0
  63. package/dist/typescript/index.d.cts.map +1 -0
  64. package/dist/typescript/index.d.mts +106 -0
  65. package/dist/typescript/index.d.mts.map +1 -0
  66. package/dist/typescript/index.mjs +4 -0
  67. package/dist/virtual-BNdKVkRw.cjs +548 -0
  68. package/dist/virtual-gIlTc3Lj.mjs +513 -0
  69. package/dist/virtual-gIlTc3Lj.mjs.map +1 -0
  70. package/package.json +183 -0
@@ -0,0 +1,658 @@
1
+ import { BaseContext, Context, EmitEntryOptions, EmitOptions, EngineContext, EngineOptions, EnvironmentContext, EnvironmentContextPlugin, EnvironmentResolvedConfig, ExecutionContext, ExecutionOptions, FetchOptions, HooksList, InlineConfig, LogFn, LogLevel, Logger, MetaInfo, ParseOptions, ParsedTypeScriptConfig, ParsedUserConfig, Plugin, PluginContext, ResolveOptions, ResolveResult, ResolvedConfig, ResolvedEngineOptions, ResolvedEntryTypeDefinition, ResolvedExecutionOptions, Resolver, SelectHookResult, SelectHooksOptions, TransformResult, UserConfig, VirtualFile, VirtualFileSystemInterface } from "@powerlines/core";
2
+ import { EnvPaths } from "@stryke/env/get-env-paths";
3
+ import { UnpluginMessage } from "unplugin";
4
+ import { Unstable_ContextInternal, Unstable_EnvironmentContext, Unstable_PluginContext } from "@powerlines/core/types/_internal";
5
+ import { PackageJson } from "@stryke/types/package-json";
6
+ import { FlatCache } from "flat-cache";
7
+ import { ParseResult } from "oxc-parser";
8
+ import { Range } from "semver";
9
+ import { RequestInfo, Response } from "undici";
10
+
11
+ //#region src/context/base-context.d.ts
12
+ declare class PowerlinesBaseContext implements BaseContext {
13
+ #private;
14
+ /**
15
+ * The path to the Powerlines package
16
+ */
17
+ powerlinesPath: string;
18
+ /**
19
+ * The module resolver for the project
20
+ */
21
+ resolver: Resolver;
22
+ /**
23
+ * The options provided to the Powerlines process
24
+ */
25
+ options: ResolvedEngineOptions;
26
+ /**
27
+ * The parsed configuration file for the project
28
+ */
29
+ configFile: ParsedUserConfig;
30
+ /**
31
+ * A timestamp representing when the context was initialized
32
+ */
33
+ get timestamp(): Date;
34
+ get logLevel(): LogLevel | null;
35
+ set logLevel(level: LogLevel | null);
36
+ /**
37
+ * The logger function
38
+ */
39
+ get log(): LogFn;
40
+ /**
41
+ * The environment paths for the project
42
+ */
43
+ get envPaths(): EnvPaths;
44
+ /**
45
+ * Creates a clone of the current context with the same configuration and workspace settings. This can be useful for running multiple builds in parallel or for creating isolated contexts for different parts of the build process.
46
+ *
47
+ * @remarks
48
+ * The cloned context will have the same configuration and workspace settings as the original context, but will have a different build ID, release ID, and timestamp. The virtual file system and caches will also be separate between the original and cloned contexts.
49
+ *
50
+ * @returns A promise that resolves to the cloned context.
51
+ */
52
+ clone(): Promise<BaseContext>;
53
+ /**
54
+ * A logging function for fatal messages
55
+ *
56
+ * @param message - The message to log.
57
+ */
58
+ fatal(message: string | UnpluginMessage): void;
59
+ /**
60
+ * A logging function for error messages
61
+ *
62
+ * @param message - The message to log.
63
+ */
64
+ error(message: string | UnpluginMessage): void;
65
+ /**
66
+ * A logging function for warning messages
67
+ *
68
+ * @param message - The message to log.
69
+ */
70
+ warn(message: string | UnpluginMessage): void;
71
+ /**
72
+ * A logging function for informational messages
73
+ *
74
+ * @param message - The message to log.
75
+ */
76
+ info(message: string | UnpluginMessage): void;
77
+ /**
78
+ * A logging function for debug messages
79
+ *
80
+ * @param message - The message to log.
81
+ */
82
+ debug(message: string | UnpluginMessage): void;
83
+ /**
84
+ * A logging function for trace messages
85
+ *
86
+ * @param message - The message to log.
87
+ */
88
+ trace(message: string | UnpluginMessage): void;
89
+ /**
90
+ * A function to create a timer for measuring the duration of asynchronous operations
91
+ *
92
+ * @example
93
+ * ```ts
94
+ * const stopTimer = context.timer("Your Async Operation");
95
+ * await performAsyncOperation();
96
+ * stopTimer(); // "Your Async Operation completed in 123.45 milliseconds"
97
+ * ```
98
+ *
99
+ * @param name - The name of the timer.
100
+ * @returns A function that, when called, stops the timer and logs the duration.
101
+ */
102
+ timer(name: string): () => void;
103
+ /**
104
+ * Create a new logger instance
105
+ *
106
+ * @param name - The name to use for the logger instance
107
+ * @returns A logger function
108
+ */
109
+ createLog(name?: string | null): LogFn;
110
+ /**
111
+ * Extend the current logger instance with a new name
112
+ *
113
+ * @param name - The name to use for the extended logger instance
114
+ * @returns A logger function
115
+ */
116
+ extendLog(name: string): LogFn;
117
+ /**
118
+ * A logger function specific to this context
119
+ */
120
+ protected logger: Logger;
121
+ /**
122
+ * Initialize the context with the provided configuration options
123
+ *
124
+ * @remarks
125
+ * This method will set up the resolver and load the user configuration file based on the provided options. It is called during the construction of the context and can also be called when cloning the context to ensure that the new context has the same configuration and resolver setup.
126
+ *
127
+ * @param options - The configuration options to initialize the context with
128
+ */
129
+ protected init(options?: Partial<EngineOptions>): Promise<void>;
130
+ }
131
+ //#endregion
132
+ //#region src/context/context.d.ts
133
+ declare class PowerlinesContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends PowerlinesBaseContext implements Context<TResolvedConfig> {
134
+ #private;
135
+ /**
136
+ * Create a new Storm context from the workspace root and user config.
137
+ *
138
+ * @param options - The options for resolving the context.
139
+ * @returns A promise that resolves to the new context.
140
+ */
141
+ static fromOptions<TResolvedConfig extends ResolvedConfig = ResolvedConfig>(options: ResolvedExecutionOptions): Promise<Context<TResolvedConfig>>;
142
+ /**
143
+ * The options provided to the Powerlines process
144
+ */
145
+ options: ResolvedExecutionOptions;
146
+ /**
147
+ * An object containing the dependencies that should be installed for the project
148
+ */
149
+ dependencies: Record<string, string | Range>;
150
+ /**
151
+ * An object containing the development dependencies that should be installed for the project
152
+ */
153
+ devDependencies: Record<string, string | Range>;
154
+ /**
155
+ * The persisted meta information about the current build
156
+ */
157
+ persistedMeta: MetaInfo | undefined;
158
+ /**
159
+ * The parsed `package.json` file for the project
160
+ */
161
+ packageJson: PackageJson;
162
+ /**
163
+ * The parsed `project.json` file for the project
164
+ */
165
+ projectJson: Record<string, any> | undefined;
166
+ /**
167
+ * The resolved tsconfig file paths for the project
168
+ */
169
+ resolvePatterns: RegExp[];
170
+ /**
171
+ * Internal context fields and methods
172
+ *
173
+ * @danger
174
+ * This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.
175
+ *
176
+ * @internal
177
+ */
178
+ get $$internal(): Unstable_ContextInternal<TResolvedConfig>;
179
+ /**
180
+ * Internal context fields and methods
181
+ *
182
+ * @danger
183
+ * This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.
184
+ *
185
+ * @internal
186
+ */
187
+ set $$internal(value: Unstable_ContextInternal<TResolvedConfig>);
188
+ /**
189
+ * The resolved entry type definitions for the project
190
+ */
191
+ get entry(): ResolvedEntryTypeDefinition[];
192
+ /**
193
+ * The TypeScript configuration parsed from the tsconfig file
194
+ */
195
+ get tsconfig(): ParsedTypeScriptConfig;
196
+ /**
197
+ * Sets the TypeScript configuration parsed from the tsconfig file
198
+ */
199
+ set tsconfig(value: ParsedTypeScriptConfig);
200
+ /**
201
+ * The virtual file system interface for the project
202
+ */
203
+ get fs(): VirtualFileSystemInterface;
204
+ /**
205
+ * Get the checksum of the project's current state
206
+ */
207
+ get checksum(): string | null;
208
+ /**
209
+ * The meta information about the current build
210
+ */
211
+ get meta(): MetaInfo;
212
+ /**
213
+ * The resolved configuration options
214
+ */
215
+ get config(): TResolvedConfig;
216
+ /**
217
+ * Get the path to the artifacts directory for the project
218
+ */
219
+ get artifactsPath(): string;
220
+ /**
221
+ * Get the path to the builtin modules used by the project
222
+ */
223
+ get builtinsPath(): string;
224
+ /**
225
+ * Get the path to the entry directory for the project
226
+ */
227
+ get entryPath(): string;
228
+ /**
229
+ * Get the path to the infrastructure modules used by the project
230
+ */
231
+ get infrastructurePath(): string;
232
+ /**
233
+ * Get the path to the data directory for the project
234
+ */
235
+ get dataPath(): string;
236
+ /**
237
+ * Get the path to the cache directory for the project
238
+ */
239
+ get cachePath(): string;
240
+ /**
241
+ * Get the path to the generated declaration file for the project
242
+ */
243
+ get typesPath(): string;
244
+ /**
245
+ * Get the project root relative to the workspace root
246
+ */
247
+ get relativeToWorkspaceRoot(): string;
248
+ /**
249
+ * The builtin module id that exist in the Powerlines virtual file system
250
+ */
251
+ get builtins(): string[];
252
+ /**
253
+ * The alias mappings for the project used during module resolution
254
+ *
255
+ * @remarks
256
+ * This includes both the built-in module aliases as well as any custom aliases defined in the build configuration.
257
+ */
258
+ get alias(): Record<string, string>;
259
+ /**
260
+ * Gets the parser cache.
261
+ */
262
+ protected get parserCache(): FlatCache;
263
+ /**
264
+ * Gets the request cache.
265
+ */
266
+ protected get requestCache(): FlatCache;
267
+ /**
268
+ * The entry points that exist in the Powerlines virtual file system
269
+ */
270
+ protected get resolvedEntry(): ResolvedEntryTypeDefinition[];
271
+ /**
272
+ * Creates a new StormContext instance.
273
+ *
274
+ * @param options - The options to use for creating the context, including the resolved configuration and workspace settings.
275
+ */
276
+ protected constructor(options: ResolvedExecutionOptions);
277
+ /**
278
+ * Creates a clone of the current context with the same configuration and workspace settings. This can be useful for running multiple builds in parallel or for creating isolated contexts for different parts of the build process.
279
+ *
280
+ * @remarks
281
+ * The cloned context will have the same configuration and workspace settings as the original context, but will have a different build ID, release ID, and timestamp. The virtual file system and caches will also be separate between the original and cloned contexts.
282
+ *
283
+ * @returns A promise that resolves to the cloned context.
284
+ */
285
+ clone(): Promise<Context<TResolvedConfig>>;
286
+ /**
287
+ * Create a new logger instance
288
+ *
289
+ * @param name - The name to use for the logger instance
290
+ * @returns A logger function
291
+ */
292
+ createLog(name?: string | null): LogFn;
293
+ /**
294
+ * A function to perform HTTP fetch requests
295
+ *
296
+ * @remarks
297
+ * This function uses a caching layer to avoid duplicate requests during the Powerlines process.
298
+ *
299
+ * @example
300
+ * ```ts
301
+ * const response = await context.fetch("https://api.example.com/data");
302
+ * const data = await response.json();
303
+ * ```
304
+ *
305
+ * @see https://github.com/nodejs/undici
306
+ *
307
+ * @param input - The URL to fetch.
308
+ * @param options - The fetch request options.
309
+ * @returns A promise that resolves to a response returned by the fetch.
310
+ */
311
+ fetch(input: RequestInfo, options?: FetchOptions): Promise<Response>;
312
+ /**
313
+ * Parse code using [Oxc-Parser](https://github.com/oxc/oxc) into an (ESTree-compatible)[https://github.com/estree/estree] AST object.
314
+ *
315
+ * @remarks
316
+ * This function can be used to parse TypeScript code into an AST for further analysis or transformation.
317
+ *
318
+ * @example
319
+ * ```ts
320
+ * const ast = context.parse("const x: number = 42;");
321
+ * ```
322
+ *
323
+ * @see https://rollupjs.org/plugin-development/#this-parse
324
+ * @see https://github.com/oxc/oxc
325
+ *
326
+ * @param code - The source code to parse.
327
+ * @param options - The options to pass to the parser.
328
+ * @returns An (ESTree-compatible)[https://github.com/estree/estree] AST object.
329
+ */
330
+ parse(code: string, options?: ParseOptions): Promise<ParseResult>;
331
+ /**
332
+ * A helper function to resolve modules in the Virtual File System
333
+ *
334
+ * @remarks
335
+ * This function can be used to resolve modules relative to the project root directory.
336
+ *
337
+ * @example
338
+ * ```ts
339
+ * const resolved = await context.resolve("some-module", "/path/to/importer");
340
+ * ```
341
+ *
342
+ * @param id - The module to resolve.
343
+ * @param importer - An optional path to the importer module.
344
+ * @param options - Additional resolution options.
345
+ * @returns A promise that resolves to the resolved module path.
346
+ */
347
+ resolve(id: string, importer?: string, options?: ResolveOptions): Promise<ResolveResult | undefined>;
348
+ /**
349
+ * A helper function to load modules from the Virtual File System
350
+ *
351
+ * @remarks
352
+ * This function can be used to load modules relative to the project root directory.
353
+ *
354
+ * @example
355
+ * ```ts
356
+ * const module = await context.load("some-module", "/path/to/importer");
357
+ * ```
358
+ *
359
+ * @param id - The module to load.
360
+ * @returns A promise that resolves to the loaded module.
361
+ */
362
+ load(id: string): Promise<TransformResult | undefined>;
363
+ /**
364
+ * Get the builtin virtual files that exist in the Powerlines virtual file system
365
+ */
366
+ getBuiltins(): Promise<VirtualFile[]>;
367
+ /**
368
+ * Resolves a file and writes it to the VFS if it does not already exist
369
+ *
370
+ * @param code - The source code of the file
371
+ * @param path - The path to write the file to
372
+ * @param options - Additional options for writing the file
373
+ */
374
+ emit(code: string, path: string, options?: EmitOptions): Promise<void>;
375
+ /**
376
+ * Synchronously resolves a file and writes it to the VFS if it does not already exist
377
+ *
378
+ * @param code - The source code of the file
379
+ * @param path - The path to write the file to
380
+ * @param options - Additional options for writing the file
381
+ */
382
+ emitSync(code: string, path: string, options?: EmitOptions): void;
383
+ /**
384
+ * Resolves a entry virtual file and writes it to the VFS if it does not already exist
385
+ *
386
+ * @param code - The source code of the entry file
387
+ * @param path - A path to write the entry file to
388
+ * @param options - Optional write file options
389
+ */
390
+ emitEntry(code: string, path: string, options?: EmitEntryOptions): Promise<void>;
391
+ /**
392
+ * Synchronously resolves a entry virtual file and writes it to the VFS if it does not already exist
393
+ *
394
+ * @param code - The source code of the entry file
395
+ * @param path - A path to write the entry file to
396
+ * @param options - Optional write file options
397
+ */
398
+ emitEntrySync(code: string, path: string, options?: EmitEntryOptions): void;
399
+ /**
400
+ * Resolves a builtin virtual file and writes it to the VFS if it does not already exist
401
+ *
402
+ * @param code - The source code of the builtin file
403
+ * @param id - The unique identifier of the builtin file
404
+ * @param options - Optional write file options
405
+ */
406
+ emitBuiltin(code: string, id: string, options?: EmitOptions): Promise<void>;
407
+ /**
408
+ * Synchronously resolves a builtin virtual file and writes it to the VFS if it does not already exist
409
+ *
410
+ * @param code - The source code of the builtin file
411
+ * @param id - The unique identifier of the builtin file
412
+ * @param options - Optional write file options
413
+ */
414
+ emitBuiltinSync(code: string, id: string, options?: EmitOptions): void;
415
+ /**
416
+ * Resolves a builtin virtual file and writes it to the VFS if it does not already exist
417
+ *
418
+ * @param code - The source code of the builtin file
419
+ * @param id - The unique identifier of the builtin file
420
+ * @param options - Optional write file options
421
+ */
422
+ emitInfrastructure(code: string, id: string, options?: EmitOptions): Promise<void>;
423
+ /**
424
+ * Synchronously resolves an infrastructure virtual file and writes it to the VFS if it does not already exist
425
+ *
426
+ * @param code - The source code of the infrastructure file
427
+ * @param id - The unique identifier of the infrastructure file
428
+ * @param options - Optional write file options
429
+ */
430
+ emitInfrastructureSync(code: string, id: string, options?: EmitOptions): void;
431
+ /**
432
+ * Generates a checksum representing the current context state
433
+ *
434
+ * @param root - The root directory of the project to generate the checksum for
435
+ * @returns A promise that resolves to a string representing the checksum
436
+ */
437
+ generateChecksum(root?: string): Promise<string>;
438
+ /**
439
+ * Initialize the context with the provided configuration options
440
+ *
441
+ * @param config - The partial configuration options to initialize the context with
442
+ */
443
+ setup(config: UserConfig | InlineConfig): Promise<void>;
444
+ /**
445
+ * The resolved configuration for this context
446
+ */
447
+ protected resolvedConfig: TResolvedConfig;
448
+ /**
449
+ * Creates a clone of the current context with the same configuration and workspace settings. This can be useful for running multiple builds in parallel or for creating isolated contexts for different parts of the build process.
450
+ *
451
+ * @remarks
452
+ * The cloned context will have the same configuration and workspace settings as the original context, but will have a different build ID, release ID, and timestamp. The virtual file system and caches will also be separate between the original and cloned contexts.
453
+ *
454
+ * @returns The cloned context.
455
+ */
456
+ protected copyTo(context: Context<TResolvedConfig>): Context<TResolvedConfig>;
457
+ /**
458
+ * Initialize the context with the provided configuration options
459
+ *
460
+ * @remarks
461
+ * This method will set up the resolver and load the user configuration file based on the provided options. It is called during the construction of the context and can also be called when cloning the context to ensure that the new context has the same configuration and resolver setup.
462
+ *
463
+ * @param options - The configuration options to initialize the context with
464
+ */
465
+ protected init(options?: Partial<ExecutionOptions>): Promise<void>;
466
+ }
467
+ //#endregion
468
+ //#region src/context/engine-context.d.ts
469
+ declare class PowerlinesEngineContext extends PowerlinesBaseContext implements EngineContext {
470
+ #private;
471
+ /**
472
+ * Creates a new instance of the PowerlinesEngineContext class.
473
+ *
474
+ * @param options - The options to initialize the context with.
475
+ * @returns A promise that resolves to an instance of the PowerlinesEngineContext class.
476
+ */
477
+ static fromOptions(options: EngineOptions): Promise<PowerlinesEngineContext>;
478
+ /**
479
+ * A list of all command executions that will be run during the lifecycle of the engine
480
+ *
481
+ * @returns An array of ResolvedExecutionOptions representing each execution context for the engine.
482
+ */
483
+ get executions(): ResolvedExecutionOptions[];
484
+ }
485
+ //#endregion
486
+ //#region src/context/environment-context.d.ts
487
+ declare class PowerlinesEnvironmentContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends PowerlinesContext<TResolvedConfig> implements EnvironmentContext<TResolvedConfig> {
488
+ #private;
489
+ /**
490
+ * Create a new context from the config.
491
+ *
492
+ * @param options - The resolved execution options.
493
+ * @param config - The user configuration options.
494
+ * @returns A promise that resolves to the new context.
495
+ */
496
+ static fromConfig<TResolvedConfig extends ResolvedConfig = ResolvedConfig>(options: ResolvedExecutionOptions, config: TResolvedConfig): Promise<PowerlinesEnvironmentContext<TResolvedConfig>>;
497
+ /**
498
+ * The resolved environment configuration
499
+ */
500
+ environment: EnvironmentResolvedConfig;
501
+ /**
502
+ * The list of plugins applied to this environment
503
+ */
504
+ plugins: EnvironmentContextPlugin<TResolvedConfig>[];
505
+ /**
506
+ * Create a new logger instance
507
+ *
508
+ * @param name - The name to use for the logger instance
509
+ * @returns A logger function
510
+ */
511
+ createLog(name?: string | null): LogFn;
512
+ /**
513
+ * The hooks registered by plugins in this environment
514
+ */
515
+ get hooks(): Record<string, HooksList<PluginContext<TResolvedConfig>>>;
516
+ /**
517
+ * Creates a clone of the current context with the same configuration and workspace settings. This can be useful for running multiple builds in parallel or for creating isolated contexts for different parts of the build process.
518
+ *
519
+ * @remarks
520
+ * The cloned context will have the same configuration and workspace settings as the original context, but will have a different build ID, release ID, and timestamp. The virtual file system and caches will also be separate between the original and cloned contexts.
521
+ *
522
+ * @returns A promise that resolves to the cloned context.
523
+ */
524
+ clone(): Promise<EnvironmentContext<TResolvedConfig>>;
525
+ addPlugin(plugin: Plugin<PluginContext<TResolvedConfig>>): Promise<void>;
526
+ /**
527
+ * Retrieves the hook handlers for a specific hook name
528
+ */
529
+ selectHooks<TKey extends string>(key: TKey, options?: SelectHooksOptions): SelectHookResult<PluginContext<TResolvedConfig>, TKey>;
530
+ protected constructor(options: ResolvedExecutionOptions, config: TResolvedConfig);
531
+ /**
532
+ * Creates a clone of the current context with the same configuration and workspace settings. This can be useful for running multiple builds in parallel or for creating isolated contexts for different parts of the build process.
533
+ *
534
+ * @remarks
535
+ * The cloned context will have the same configuration and workspace settings as the original context, but will have a different build ID, release ID, and timestamp. The virtual file system and caches will also be separate between the original and cloned contexts.
536
+ *
537
+ * @returns The cloned context.
538
+ */
539
+ protected copyTo(context: EnvironmentContext<TResolvedConfig>): EnvironmentContext<TResolvedConfig>;
540
+ }
541
+ //#endregion
542
+ //#region src/context/execution-context.d.ts
543
+ declare class PowerlinesExecutionContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends PowerlinesContext<TResolvedConfig> implements ExecutionContext<TResolvedConfig> {
544
+ #private;
545
+ /**
546
+ * Create a new Storm context from the workspace root and user config.
547
+ *
548
+ * @param options - The options for resolving the context.
549
+ * @returns A promise that resolves to the new context.
550
+ */
551
+ static fromOptions<TResolvedConfig extends ResolvedConfig = ResolvedConfig>(options: ResolvedExecutionOptions): Promise<ExecutionContext<TResolvedConfig>>;
552
+ /**
553
+ * Create a new Storm context from the workspace root and user config.
554
+ *
555
+ * @param options - The options for resolving the context.
556
+ * @returns A promise that resolves to the new context.
557
+ */
558
+ static fromConfig<TResolvedConfig extends ResolvedConfig = ResolvedConfig>(options: ResolvedExecutionOptions, config: InlineConfig): Promise<ExecutionContext<TResolvedConfig>>;
559
+ /**
560
+ * Internal context fields and methods
561
+ *
562
+ * @danger
563
+ * This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.
564
+ *
565
+ * @internal
566
+ */
567
+ get $$internal(): Unstable_ContextInternal<TResolvedConfig>;
568
+ /**
569
+ * Internal context fields and methods
570
+ *
571
+ * @danger
572
+ * This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.
573
+ *
574
+ * @internal
575
+ */
576
+ set $$internal(value: Unstable_ContextInternal<TResolvedConfig>);
577
+ /**
578
+ * A record of all environments by name
579
+ */
580
+ get environments(): Record<string, Unstable_EnvironmentContext<TResolvedConfig>>;
581
+ get plugins(): Array<Plugin<PluginContext<TResolvedConfig>>>;
582
+ /**
583
+ * Creates a new instance.
584
+ *
585
+ * @param options - The options to use for creating the context, including the resolved configuration and workspace settings.
586
+ */
587
+ protected constructor(options: ResolvedExecutionOptions);
588
+ /**
589
+ * Creates a clone of the current context with the same configuration and workspace settings. This can be useful for running multiple builds in parallel or for creating isolated contexts for different parts of the build process.
590
+ *
591
+ * @remarks
592
+ * The cloned context will have the same configuration and workspace settings as the original context, but will have a different build ID, release ID, and timestamp. The virtual file system and caches will also be separate between the original and cloned contexts.
593
+ *
594
+ * @returns A promise that resolves to the cloned context.
595
+ */
596
+ clone(): Promise<ExecutionContext<TResolvedConfig>>;
597
+ /**
598
+ * Initialize the context with the provided configuration options
599
+ *
600
+ * @param options - The resolved execution options to use for initialization.
601
+ */
602
+ init(options: ResolvedExecutionOptions): Promise<void>;
603
+ /**
604
+ * A function to copy the context and update the fields for a specific environment
605
+ *
606
+ * @param environment - The environment configuration to use.
607
+ * @returns A new context instance with the updated environment.
608
+ */
609
+ in(environment: EnvironmentResolvedConfig): Promise<Unstable_EnvironmentContext<TResolvedConfig>>;
610
+ /**
611
+ * Update the context using a new inline configuration options
612
+ *
613
+ * @param config - The new inline configuration options.
614
+ */
615
+ setup(config: UserConfig | InlineConfig): Promise<void>;
616
+ /**
617
+ * Add a plugin to the API context and all environments
618
+ *
619
+ * @param plugin - The plugin to add.
620
+ */
621
+ addPlugin(plugin: Plugin<PluginContext<TResolvedConfig>>): Promise<void>;
622
+ /**
623
+ * Get an environment by name, or the default environment if no name is provided
624
+ *
625
+ * @param name - The name of the environment to retrieve.
626
+ * @returns The requested environment context.
627
+ */
628
+ getEnvironment(name?: string): Promise<EnvironmentContext<TResolvedConfig>>;
629
+ /**
630
+ * A safe version of `getEnvironment` that returns `undefined` if the environment is not found
631
+ *
632
+ * @param name - The name of the environment to retrieve.
633
+ * @returns The requested environment context or `undefined` if not found.
634
+ */
635
+ getEnvironmentSafe(name?: string): Promise<EnvironmentContext<TResolvedConfig> | undefined>;
636
+ /**
637
+ * A function to merge all configured environments into a single context.
638
+ *
639
+ * @remarks
640
+ * If only one environment is configured, that environment will be returned directly.
641
+ *
642
+ * @returns A promise that resolves to a merged/global environment context.
643
+ */
644
+ toEnvironment(): Promise<EnvironmentContext<TResolvedConfig>>;
645
+ }
646
+ //#endregion
647
+ //#region src/context/plugin-context.d.ts
648
+ /**
649
+ * Create a Proxy-based PluginContext
650
+ *
651
+ * @param plugin - The plugin instance
652
+ * @param environment - The environment context
653
+ * @returns The proxied plugin context
654
+ */
655
+ declare function createPluginContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig>(plugin: Plugin<PluginContext<TResolvedConfig>>, environment: Unstable_EnvironmentContext<TResolvedConfig>): Unstable_PluginContext<TResolvedConfig>;
656
+ //#endregion
657
+ export { PowerlinesBaseContext, PowerlinesContext, PowerlinesEngineContext, PowerlinesEnvironmentContext, PowerlinesExecutionContext, createPluginContext };
658
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/context/base-context.ts","../../src/context/context.ts","../../src/context/engine-context.ts","../../src/context/environment-context.ts","../../src/context/execution-context.ts","../../src/context/plugin-context.ts"],"mappings":";;;;;;;;;;;cA0Ca,qBAAA,YAAiC,WAAA;EAAA;;;;EAQrC,cAAA;;;AART;EAaS,QAAA,EAAW,QAAA;;;;EAKX,OAAA,EAAU,qBAAA;EAUO;;;EALjB,UAAA,EAAa,gBAAA;EAmCG;;;EAAA,IA9BZ,SAAA,CAAA,GAAa,IAAA;EAAA,IAIb,QAAA,CAAA,GAAY,QAAA;EAAA,IAIZ,QAAA,CAAS,KAAA,EAAO,QAAA;EAsFG;;;EAAA,IA/EnB,GAAA,CAAA,GAAO,KAAA;EA+Jc;;;EAAA,IAhJrB,QAAA,CAAA,GAAY,QAAA;EAiKkC;;;;;;;;EAjJ5C,KAAA,CAAA,GAAS,OAAA,CAAQ,WAAA;EAxDvB;;;;;EAoEA,KAAA,CAAM,OAAA,WAAkB,eAAA;EAtDpB;;;;;EAkEJ,KAAA,CAAM,OAAA,WAAkB,eAAA;EAvDb;;;;;EAmEX,IAAA,CAAK,OAAA,WAAkB,eAAA;EAxBvB;;;;;EAoCA,IAAA,CAAK,OAAA,WAAkB,eAAA;EAZvB;;;;;EAwBA,KAAA,CAAM,OAAA,WAAkB,eAAA;EAAxB;;;;;EAYA,KAAA,CAAM,OAAA,WAAkB,eAAA;EAoBxB;;;;;;;;;;;;;EAAA,KAAA,CAAM,IAAA;EAqD4C;;;;;;EA9BlD,SAAA,CAAU,IAAA,mBAA6B,KAAA;EC9GlB;;;;;;ED2HrB,SAAA,CAAU,IAAA,WAAe,KAAA;ECrCrB;;;EAAA,UD4CD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