@powerlines/core 0.45.3 → 0.46.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.
- package/dist/constants/virtual-modules.cjs +4 -2
- package/dist/constants/virtual-modules.d.cts +1 -1
- package/dist/constants/virtual-modules.d.cts.map +1 -1
- package/dist/constants/virtual-modules.d.mts +1 -1
- package/dist/constants/virtual-modules.d.mts.map +1 -1
- package/dist/constants/virtual-modules.mjs +4 -2
- package/dist/constants/virtual-modules.mjs.map +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.mts +5 -5
- package/dist/lib/config.d.cts +2 -1
- package/dist/lib/config.d.cts.map +1 -1
- package/dist/lib/config.d.mts +2 -1
- package/dist/lib/config.d.mts.map +1 -1
- package/dist/lib/config.mjs.map +1 -1
- package/dist/lib/unplugin/module-resolution.cjs +10 -10
- package/dist/lib/unplugin/module-resolution.mjs +10 -10
- package/dist/lib/unplugin/module-resolution.mjs.map +1 -1
- package/dist/lib/unplugin/plugin.cjs +6 -6
- package/dist/lib/unplugin/plugin.mjs +6 -6
- package/dist/lib/unplugin/plugin.mjs.map +1 -1
- package/dist/plugin-utils/helpers.d.cts +10 -9
- package/dist/plugin-utils/helpers.d.cts.map +1 -1
- package/dist/plugin-utils/helpers.d.mts +10 -9
- package/dist/plugin-utils/helpers.d.mts.map +1 -1
- package/dist/plugin-utils/paths.cjs +6 -2
- package/dist/plugin-utils/paths.mjs +6 -2
- package/dist/plugin-utils/paths.mjs.map +1 -1
- package/dist/types/_internal.d.cts +3 -18
- package/dist/types/_internal.d.cts.map +1 -1
- package/dist/types/_internal.d.mts +3 -18
- package/dist/types/_internal.d.mts.map +1 -1
- package/dist/types/api.d.cts +4 -3
- package/dist/types/api.d.cts.map +1 -1
- package/dist/types/api.d.mts +4 -3
- package/dist/types/api.d.mts.map +1 -1
- package/dist/types/config.d.cts +106 -73
- package/dist/types/config.d.cts.map +1 -1
- package/dist/types/config.d.mts +106 -73
- package/dist/types/config.d.mts.map +1 -1
- package/dist/types/context.d.cts +66 -84
- package/dist/types/context.d.cts.map +1 -1
- package/dist/types/context.d.mts +66 -84
- package/dist/types/context.d.mts.map +1 -1
- package/dist/types/index.d.cts +4 -4
- package/dist/types/index.d.mts +4 -4
- package/dist/types/plugin.d.cts +3 -6
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts +3 -6
- package/dist/types/plugin.d.mts.map +1 -1
- package/dist/types/unplugin.d.cts +9 -9
- package/dist/types/unplugin.d.cts.map +1 -1
- package/dist/types/unplugin.d.mts +9 -9
- package/dist/types/unplugin.d.mts.map +1 -1
- package/package.json +14 -13
package/dist/types/context.d.cts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { ResolveOptions, VirtualFile, VirtualFileSystemInterface, WriteOptions } from "./fs.cjs";
|
|
2
1
|
import { Plugin } from "./plugin.cjs";
|
|
3
2
|
import { HooksList, HooksListItem } from "./hooks.cjs";
|
|
3
|
+
import { API } from "./api.cjs";
|
|
4
|
+
import { ResolveOptions, VirtualFile, VirtualFileSystemInterface, WriteOptions } from "./fs.cjs";
|
|
4
5
|
import { LogFn, LogLevelResolvedConfig, LogMessage, Logger, LoggerOptions } from "./logging.cjs";
|
|
5
6
|
import { ParsedTypeScriptConfig } from "./tsconfig.cjs";
|
|
6
|
-
import { EngineOptions, EnvironmentResolvedConfig, ExecutionOptions,
|
|
7
|
+
import { EngineOptions, EnvironmentResolvedConfig, ExecutionOptions, ParsedUserConfig, ResolvedConfig, ResolvedEntryTypeDefinition, UserConfig } from "./config.cjs";
|
|
8
|
+
import { DeepPartial, DeepReadonly, RequiredKeys } from "@stryke/types/base";
|
|
7
9
|
import { Jiti } from "jiti";
|
|
8
10
|
import { EnvPaths } from "@stryke/env/get-env-paths";
|
|
9
11
|
import { FetchRequestOptions } from "@stryke/http/fetch";
|
|
@@ -136,10 +138,6 @@ interface ResolveResult extends ExternalIdResult {
|
|
|
136
138
|
* This context provides the foundational structure for interacting with the Powerlines engine.
|
|
137
139
|
*/
|
|
138
140
|
interface BaseContext {
|
|
139
|
-
/**
|
|
140
|
-
* The options provided to the Powerlines process
|
|
141
|
-
*/
|
|
142
|
-
options: EngineOptions;
|
|
143
141
|
/**
|
|
144
142
|
* The timestamp when the context was initialized
|
|
145
143
|
*/
|
|
@@ -157,9 +155,9 @@ interface BaseContext {
|
|
|
157
155
|
*/
|
|
158
156
|
configFile: ParsedUserConfig;
|
|
159
157
|
/**
|
|
160
|
-
* The
|
|
158
|
+
* The options provided to the Powerlines process, resolved with default values and merged with any configuration provided by plugins or other sources. This is typically the final configuration used during the build process, but may also include additional options that are relevant to the context and its interactions with the Powerlines engine.
|
|
161
159
|
*/
|
|
162
|
-
|
|
160
|
+
options: RequiredKeys<EngineOptions, "mode" | "cwd" | "root" | "framework">;
|
|
163
161
|
/**
|
|
164
162
|
* The log level to use for the Powerlines processes.
|
|
165
163
|
*/
|
|
@@ -220,13 +218,6 @@ interface BaseContext {
|
|
|
220
218
|
* @returns A logger client instance that extends the current logger with the provided configuration options.
|
|
221
219
|
*/
|
|
222
220
|
extendLogger: (options: LoggerOptions, logFn?: LogFn) => Logger;
|
|
223
|
-
/**
|
|
224
|
-
* A function to create a deep clone of the context
|
|
225
|
-
*
|
|
226
|
-
* @remarks
|
|
227
|
-
* This function is used to create a copy of the context for a specific environment, allowing for environment-specific modifications without affecting the global context.
|
|
228
|
-
*/
|
|
229
|
-
clone: () => Promise<BaseContext>;
|
|
230
221
|
}
|
|
231
222
|
interface ExecutionStateItem {
|
|
232
223
|
/**
|
|
@@ -278,6 +269,23 @@ interface ExecutionState {
|
|
|
278
269
|
* This context is used during the execution of the Powerlines engine, providing access to the input user configurations.
|
|
279
270
|
*/
|
|
280
271
|
interface EngineContext extends BaseContext {
|
|
272
|
+
/**
|
|
273
|
+
* The initial options provided to the Powerlines process before any resolution or merging. This is typically the user configuration provided in the Powerlines configuration file, but may also include additional configuration options provided by plugins or other sources.
|
|
274
|
+
*/
|
|
275
|
+
readonly initialOptions: EngineOptions;
|
|
276
|
+
/**
|
|
277
|
+
* The options provided to the Powerlines process
|
|
278
|
+
*/
|
|
279
|
+
options: RequiredKeys<Omit<EngineOptions, "logLevel">, "name" | "root" | "cwd" | "mode" | "framework"> & {
|
|
280
|
+
/**
|
|
281
|
+
* The log level to use for logging messages during the build process. This can be a string indicating the log level or a more detailed configuration object that allows for specifying different log levels for different categories of logs.
|
|
282
|
+
*/
|
|
283
|
+
logLevel: LogLevelResolvedConfig;
|
|
284
|
+
};
|
|
285
|
+
/**
|
|
286
|
+
* The initial user configuration provided to the Powerlines process before any resolution or merging. This is typically the user configuration provided in the Powerlines configuration file, but may also include additional configuration options provided by plugins or other sources.
|
|
287
|
+
*/
|
|
288
|
+
readonly initialConfig: DeepPartial<UserConfig>;
|
|
281
289
|
/**
|
|
282
290
|
* A list of all command executions that will be run during the lifecycle of the engine
|
|
283
291
|
*/
|
|
@@ -291,22 +299,25 @@ interface EngineContext extends BaseContext {
|
|
|
291
299
|
*/
|
|
292
300
|
interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends BaseContext {
|
|
293
301
|
/**
|
|
294
|
-
* The options provided to the Powerlines process
|
|
295
|
-
*/
|
|
296
|
-
options: ExecutionOptions;
|
|
297
|
-
/**
|
|
298
|
-
* The input options used to initialize the context, which may be used when cloning the context to ensure the same configuration is applied to the new context
|
|
302
|
+
* The options provided to the Powerlines process, resolved with default values and merged with any configuration provided by plugins or other sources. This is typically the final configuration used during the build process, but may also include additional options that are relevant to the context and its interactions with the Powerlines engine.
|
|
299
303
|
*/
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* The initial configuration provided when initializing the context, which may be used during the setup process to ensure that the configuration is properly merged and applied to the context. This is typically the user configuration provided in the Powerlines configuration file, but may also include additional configuration options provided by plugins or other sources.
|
|
303
|
-
*/
|
|
304
|
-
initialConfig: InitialConfig<TResolvedConfig["userConfig"]>;
|
|
304
|
+
options: RequiredKeys<ExecutionOptions, "mode" | "cwd" | "root" | "framework" | "logLevel">;
|
|
305
305
|
/**
|
|
306
306
|
* An object containing the options provided to Powerlines
|
|
307
307
|
*/
|
|
308
|
-
config: Omit<TResolvedConfig["userConfig"], "output"> & Required<Pick<TResolvedConfig["userConfig"], "output">> & {
|
|
308
|
+
config: Omit<TResolvedConfig["userConfig"], "output"> & Required<Pick<TResolvedConfig["userConfig"], "output">> & Pick<TResolvedConfig, "cwd" | "root" | "mode" | "framework" | "configFile" | "name"> & {
|
|
309
|
+
/**
|
|
310
|
+
* The output configuration options for the Powerlines process, which may include settings related to the output directory, file naming conventions, and other options that affect how the compiled output is generated and structured. This is typically derived from the user configuration but may also include additional options provided by plugins or other sources.
|
|
311
|
+
*/
|
|
309
312
|
output: TResolvedConfig["output"];
|
|
313
|
+
/**
|
|
314
|
+
* The original configuration options that were provided by the user to the Powerlines process, which may be used during the configuration resolution process to ensure that the final configuration is properly merged and applied to the context. This is typically the user configuration provided in the Powerlines configuration file, but may also include additional configuration options provided by plugins or other sources.
|
|
315
|
+
*/
|
|
316
|
+
readonly initialConfig: DeepReadonly<TResolvedConfig["initialConfig"]>;
|
|
317
|
+
/**
|
|
318
|
+
* The configuration options that were provided inline to the Powerlines CLI.
|
|
319
|
+
*/
|
|
320
|
+
readonly inlineConfig: DeepReadonly<TResolvedConfig["inlineConfig"]>;
|
|
310
321
|
};
|
|
311
322
|
/**
|
|
312
323
|
* The metadata information
|
|
@@ -319,31 +330,31 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
|
|
|
319
330
|
/**
|
|
320
331
|
* The path to a directory where the reflection data buffers (used by the build processes) are stored
|
|
321
332
|
*/
|
|
322
|
-
dataPath: string;
|
|
333
|
+
readonly dataPath: string;
|
|
323
334
|
/**
|
|
324
335
|
* The path to a directory where the project cache (used by the build processes) is stored
|
|
325
336
|
*/
|
|
326
|
-
cachePath: string;
|
|
337
|
+
readonly cachePath: string;
|
|
327
338
|
/**
|
|
328
339
|
* The Powerlines artifacts directory
|
|
329
340
|
*/
|
|
330
|
-
artifactsPath: string;
|
|
341
|
+
readonly artifactsPath: string;
|
|
331
342
|
/**
|
|
332
343
|
* The path to the Powerlines builtin runtime modules directory
|
|
333
344
|
*/
|
|
334
|
-
builtinsPath: string;
|
|
345
|
+
readonly builtinsPath: string;
|
|
335
346
|
/**
|
|
336
347
|
* The path to the Powerlines entry modules directory
|
|
337
348
|
*/
|
|
338
|
-
entryPath: string;
|
|
349
|
+
readonly entryPath: string;
|
|
339
350
|
/**
|
|
340
351
|
* The path to the Powerlines infrastructure modules directory
|
|
341
352
|
*/
|
|
342
|
-
infrastructurePath: string;
|
|
353
|
+
readonly infrastructurePath: string;
|
|
343
354
|
/**
|
|
344
355
|
* The path to the Powerlines TypeScript declaration files directory
|
|
345
356
|
*/
|
|
346
|
-
typesPath: string;
|
|
357
|
+
readonly typesPath: string;
|
|
347
358
|
/**
|
|
348
359
|
* The project's `package.json` file content
|
|
349
360
|
*/
|
|
@@ -551,23 +562,12 @@ type Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = Omit<Unr
|
|
|
551
562
|
* The fully resolved Powerlines configuration
|
|
552
563
|
*/
|
|
553
564
|
config: TResolvedConfig;
|
|
554
|
-
/**
|
|
555
|
-
* Initialize the context with the provided configuration options
|
|
556
|
-
*/
|
|
557
|
-
setup: () => Promise<void>;
|
|
558
|
-
/**
|
|
559
|
-
* A function to create a deep clone of the context
|
|
560
|
-
*
|
|
561
|
-
* @remarks
|
|
562
|
-
* This function is used to create a copy of the context for a specific environment, allowing for environment-specific modifications without affecting the global context.
|
|
563
|
-
*/
|
|
564
|
-
clone: () => Promise<Context<TResolvedConfig>>;
|
|
565
565
|
};
|
|
566
566
|
interface ExecutionContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig> {
|
|
567
567
|
/**
|
|
568
568
|
* The unique identifier of the execution context, which can be used for logging and other purposes to distinguish between different executions in the same process.
|
|
569
569
|
*/
|
|
570
|
-
id: string;
|
|
570
|
+
readonly id: string;
|
|
571
571
|
/**
|
|
572
572
|
* The expected plugins options for the Powerlines project.
|
|
573
573
|
*
|
|
@@ -575,14 +575,14 @@ interface ExecutionContext<TResolvedConfig extends ResolvedConfig = ResolvedConf
|
|
|
575
575
|
* This is a record of plugin identifiers to their respective options. This field is populated by the Powerlines engine during both plugin initialization and the `init` command.
|
|
576
576
|
*/
|
|
577
577
|
plugins: Plugin<PluginContext<TResolvedConfig>>[];
|
|
578
|
-
/**
|
|
579
|
-
* A function to add a plugin to the context and update the configuration options
|
|
580
|
-
*/
|
|
581
|
-
addPlugin: (plugin: Plugin<PluginContext<TResolvedConfig>>) => Promise<void>;
|
|
582
578
|
/**
|
|
583
579
|
* A table for storing the current context for each configured environment
|
|
584
580
|
*/
|
|
585
581
|
environments: Record<string, EnvironmentContext<TResolvedConfig>>;
|
|
582
|
+
/**
|
|
583
|
+
* A function to add a plugin to the context and update the configuration options
|
|
584
|
+
*/
|
|
585
|
+
addPlugin: (plugin: Plugin<PluginContext<TResolvedConfig>>) => Promise<void>;
|
|
586
586
|
/**
|
|
587
587
|
* Retrieves the context for a specific environment by name
|
|
588
588
|
*
|
|
@@ -632,26 +632,19 @@ interface ExecutionContext<TResolvedConfig extends ResolvedConfig = ResolvedConf
|
|
|
632
632
|
* @param environment - The environment configuration to use.
|
|
633
633
|
* @returns A new context instance with the updated environment.
|
|
634
634
|
*/
|
|
635
|
-
|
|
635
|
+
createEnvironment: (environment: EnvironmentResolvedConfig<TResolvedConfig>["environment"]) => Promise<EnvironmentContext<TResolvedConfig>>;
|
|
636
636
|
/**
|
|
637
637
|
* A function to merge all configured environments into a single context
|
|
638
638
|
*
|
|
639
639
|
* @returns A promise that resolves to the merged environment context.
|
|
640
640
|
*/
|
|
641
641
|
toEnvironment: () => Promise<EnvironmentContext<TResolvedConfig>>;
|
|
642
|
-
/**
|
|
643
|
-
* A function to create a deep clone of the context
|
|
644
|
-
*
|
|
645
|
-
* @remarks
|
|
646
|
-
* This function is used to create a copy of the context for a specific environment, allowing for environment-specific modifications without affecting the global context.
|
|
647
|
-
*/
|
|
648
|
-
clone: () => Promise<ExecutionContext<TResolvedConfig>>;
|
|
649
642
|
}
|
|
650
643
|
interface EnvironmentContextPlugin<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
|
|
651
644
|
/**
|
|
652
645
|
* The unique identifier of the plugin, which can be used for logging and other purposes to distinguish between different plugins in the same process.
|
|
653
646
|
*/
|
|
654
|
-
|
|
647
|
+
readonly id: string;
|
|
655
648
|
/**
|
|
656
649
|
* The plugin instance associated with this context, which can be used to access the plugin's options and other properties.
|
|
657
650
|
*/
|
|
@@ -668,11 +661,11 @@ type SelectHookResultItem<TContext extends PluginContext, TKey extends string> =
|
|
|
668
661
|
context: TContext;
|
|
669
662
|
};
|
|
670
663
|
type SelectHookResult<TContext extends PluginContext, TKey extends string> = SelectHookResultItem<TContext, TKey>[];
|
|
671
|
-
interface EnvironmentContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig
|
|
664
|
+
interface EnvironmentContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<EnvironmentResolvedConfig<TResolvedConfig>> {
|
|
672
665
|
/**
|
|
673
666
|
* The unique identifier of the environment associated with this context, which can be used for logging and other purposes to distinguish between different environments in the same process.
|
|
674
667
|
*/
|
|
675
|
-
id: string;
|
|
668
|
+
readonly id: string;
|
|
676
669
|
/**
|
|
677
670
|
* The expected plugins options for the Powerlines project.
|
|
678
671
|
*
|
|
@@ -680,46 +673,35 @@ interface EnvironmentContext<TResolvedConfig extends ResolvedConfig = ResolvedCo
|
|
|
680
673
|
* This is a record of plugin identifiers to their respective options. This field is populated by the Powerlines engine during both plugin initialization and the `init` command.
|
|
681
674
|
*/
|
|
682
675
|
plugins: EnvironmentContextPlugin<TResolvedConfig>[];
|
|
683
|
-
/**
|
|
684
|
-
* A function to add a plugin to the context and update the configuration options
|
|
685
|
-
*/
|
|
686
|
-
addPlugin: (plugin: Plugin<PluginContext<TResolvedConfig>>) => Promise<void>;
|
|
687
|
-
/**
|
|
688
|
-
* The environment specific resolved configuration
|
|
689
|
-
*/
|
|
690
|
-
environment: EnvironmentResolvedConfig;
|
|
691
676
|
/**
|
|
692
677
|
* A table holding references to hook functions registered by plugins
|
|
693
678
|
*/
|
|
694
679
|
hooks: HooksList<PluginContext<TResolvedConfig>>;
|
|
695
680
|
/**
|
|
696
|
-
*
|
|
681
|
+
* A function to add a plugin to the context and update the configuration options
|
|
697
682
|
*/
|
|
698
|
-
|
|
683
|
+
addPlugin: (plugin: Plugin<PluginContext<TResolvedConfig>>) => Promise<void>;
|
|
699
684
|
/**
|
|
700
|
-
*
|
|
701
|
-
*
|
|
702
|
-
* @remarks
|
|
703
|
-
* This function is used to create a copy of the context for a specific environment, allowing for environment-specific modifications without affecting the global context.
|
|
685
|
+
* Retrieves the hook handlers for a specific hook name
|
|
704
686
|
*/
|
|
705
|
-
|
|
687
|
+
selectHooks: <TKey extends string>(key: TKey, options?: SelectHooksOptions) => SelectHookResult<PluginContext<TResolvedConfig>, TKey>;
|
|
706
688
|
}
|
|
707
|
-
interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig
|
|
689
|
+
interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedConfig, TApi extends API<any> = API<any>> extends Context<EnvironmentResolvedConfig<TResolvedConfig>> {
|
|
708
690
|
/**
|
|
709
691
|
* The unique identifier of the plugin associated with this context, which can be used for logging and other purposes to distinguish between different plugins in the same process.
|
|
710
692
|
*/
|
|
711
|
-
id: string;
|
|
712
|
-
/**
|
|
713
|
-
* The environment specific resolved configuration
|
|
714
|
-
*/
|
|
715
|
-
environment: EnvironmentResolvedConfig;
|
|
693
|
+
readonly id: string;
|
|
716
694
|
/**
|
|
717
|
-
*
|
|
695
|
+
* The API instance available to the plugin during execution, which provides access to the shared context and the ability to call plugin hooks. This API is specific to the plugin and environment, allowing for environment-specific interactions with the Powerlines engine.
|
|
718
696
|
*
|
|
719
697
|
* @remarks
|
|
720
|
-
*
|
|
698
|
+
* The API instance provided in the plugin context may include additional functionality specific to command execution, and it extends the base API with any additional methods or properties that are relevant to the plugin's interactions with the Powerlines engine.
|
|
699
|
+
*/
|
|
700
|
+
readonly api: TApi;
|
|
701
|
+
/**
|
|
702
|
+
* The context for the environment associated with this plugin context, which provides access to the Powerlines engine and other utilities for interacting with the build process. This context is specific to the plugin and environment, allowing for environment-specific modifications without affecting the global context.
|
|
721
703
|
*/
|
|
722
|
-
|
|
704
|
+
readonly environment: EnvironmentContext;
|
|
723
705
|
}
|
|
724
706
|
type BuildPluginContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = UnpluginBuildContext & PluginContext<TResolvedConfig>;
|
|
725
707
|
type WithUnpluginBuildContext<TContext extends PluginContext> = UnpluginBuildContext & TContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.cts","names":[],"sources":["../../src/types/context.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.d.cts","names":[],"sources":["../../src/types/context.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;UAyDiB,QAAA;EAAA;;;EAIf,QAAA;EAAA;;;EAKA,OAAA;EAeA;;;EAVA,SAAA;EAkBe;;;EAbf,SAAA;EAagC;;;EARhC,QAAA;EASY;AAGd;;EAPE,UAAA;AAAA;AAAA,UAGe,QAAA,SAAiB,IAAA;EAChC,MAAA,EAAQ,IAAA;AAAA;AAAA,UAGO,iBAAA;EACf,IAAA;EACA,GAAA,EAAK,SAAA;AAAA;;;;UAMU,UAAA;EAST;;;EALN,EAAA;EAewB;;AAG1B;EAbE,IAAA,EAAM,WAAA;;;;EAKN,GAAA;EAUwB;;;EALxB,MAAA,GAAS,iBAAA;AAAA;AAAA,KAGC,eAAA,GAAkB,IAAA,CAAK,QAAA;EACjC,WAAA,QAAmB,OAAA;EACnB,aAAA,G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,GAAiB,cAAA,IACvC,oBAAA,GAAuB,aAAA,CAAc,eAAA;AAAA,KAE7B,wBAAA,kBAA0C,aAAA,IACpD,oBAAA,GAAuB,QAAA;AAAA"}
|
package/dist/types/context.d.mts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { ResolveOptions, VirtualFile, VirtualFileSystemInterface, WriteOptions } from "./fs.mjs";
|
|
2
1
|
import { Plugin } from "./plugin.mjs";
|
|
3
2
|
import { HooksList, HooksListItem } from "./hooks.mjs";
|
|
3
|
+
import { API } from "./api.mjs";
|
|
4
|
+
import { ResolveOptions, VirtualFile, VirtualFileSystemInterface, WriteOptions } from "./fs.mjs";
|
|
4
5
|
import { LogFn, LogLevelResolvedConfig, LogMessage, Logger, LoggerOptions } from "./logging.mjs";
|
|
5
6
|
import { ParsedTypeScriptConfig } from "./tsconfig.mjs";
|
|
6
|
-
import { EngineOptions, EnvironmentResolvedConfig, ExecutionOptions,
|
|
7
|
+
import { EngineOptions, EnvironmentResolvedConfig, ExecutionOptions, ParsedUserConfig, ResolvedConfig, ResolvedEntryTypeDefinition, UserConfig } from "./config.mjs";
|
|
7
8
|
import { ExternalIdResult, UnpluginBuildContext } from "unplugin";
|
|
8
9
|
import MagicString, { SourceMap } from "magic-string";
|
|
10
|
+
import { DeepPartial, DeepReadonly, RequiredKeys } from "@stryke/types/base";
|
|
9
11
|
import { Jiti } from "jiti";
|
|
10
12
|
import { EnvPaths } from "@stryke/env/get-env-paths";
|
|
11
13
|
import { FetchRequestOptions } from "@stryke/http/fetch";
|
|
@@ -136,10 +138,6 @@ interface ResolveResult extends ExternalIdResult {
|
|
|
136
138
|
* This context provides the foundational structure for interacting with the Powerlines engine.
|
|
137
139
|
*/
|
|
138
140
|
interface BaseContext {
|
|
139
|
-
/**
|
|
140
|
-
* The options provided to the Powerlines process
|
|
141
|
-
*/
|
|
142
|
-
options: EngineOptions;
|
|
143
141
|
/**
|
|
144
142
|
* The timestamp when the context was initialized
|
|
145
143
|
*/
|
|
@@ -157,9 +155,9 @@ interface BaseContext {
|
|
|
157
155
|
*/
|
|
158
156
|
configFile: ParsedUserConfig;
|
|
159
157
|
/**
|
|
160
|
-
* The
|
|
158
|
+
* The options provided to the Powerlines process, resolved with default values and merged with any configuration provided by plugins or other sources. This is typically the final configuration used during the build process, but may also include additional options that are relevant to the context and its interactions with the Powerlines engine.
|
|
161
159
|
*/
|
|
162
|
-
|
|
160
|
+
options: RequiredKeys<EngineOptions, "mode" | "cwd" | "root" | "framework">;
|
|
163
161
|
/**
|
|
164
162
|
* The log level to use for the Powerlines processes.
|
|
165
163
|
*/
|
|
@@ -220,13 +218,6 @@ interface BaseContext {
|
|
|
220
218
|
* @returns A logger client instance that extends the current logger with the provided configuration options.
|
|
221
219
|
*/
|
|
222
220
|
extendLogger: (options: LoggerOptions, logFn?: LogFn) => Logger;
|
|
223
|
-
/**
|
|
224
|
-
* A function to create a deep clone of the context
|
|
225
|
-
*
|
|
226
|
-
* @remarks
|
|
227
|
-
* This function is used to create a copy of the context for a specific environment, allowing for environment-specific modifications without affecting the global context.
|
|
228
|
-
*/
|
|
229
|
-
clone: () => Promise<BaseContext>;
|
|
230
221
|
}
|
|
231
222
|
interface ExecutionStateItem {
|
|
232
223
|
/**
|
|
@@ -278,6 +269,23 @@ interface ExecutionState {
|
|
|
278
269
|
* This context is used during the execution of the Powerlines engine, providing access to the input user configurations.
|
|
279
270
|
*/
|
|
280
271
|
interface EngineContext extends BaseContext {
|
|
272
|
+
/**
|
|
273
|
+
* The initial options provided to the Powerlines process before any resolution or merging. This is typically the user configuration provided in the Powerlines configuration file, but may also include additional configuration options provided by plugins or other sources.
|
|
274
|
+
*/
|
|
275
|
+
readonly initialOptions: EngineOptions;
|
|
276
|
+
/**
|
|
277
|
+
* The options provided to the Powerlines process
|
|
278
|
+
*/
|
|
279
|
+
options: RequiredKeys<Omit<EngineOptions, "logLevel">, "name" | "root" | "cwd" | "mode" | "framework"> & {
|
|
280
|
+
/**
|
|
281
|
+
* The log level to use for logging messages during the build process. This can be a string indicating the log level or a more detailed configuration object that allows for specifying different log levels for different categories of logs.
|
|
282
|
+
*/
|
|
283
|
+
logLevel: LogLevelResolvedConfig;
|
|
284
|
+
};
|
|
285
|
+
/**
|
|
286
|
+
* The initial user configuration provided to the Powerlines process before any resolution or merging. This is typically the user configuration provided in the Powerlines configuration file, but may also include additional configuration options provided by plugins or other sources.
|
|
287
|
+
*/
|
|
288
|
+
readonly initialConfig: DeepPartial<UserConfig>;
|
|
281
289
|
/**
|
|
282
290
|
* A list of all command executions that will be run during the lifecycle of the engine
|
|
283
291
|
*/
|
|
@@ -291,22 +299,25 @@ interface EngineContext extends BaseContext {
|
|
|
291
299
|
*/
|
|
292
300
|
interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends BaseContext {
|
|
293
301
|
/**
|
|
294
|
-
* The options provided to the Powerlines process
|
|
295
|
-
*/
|
|
296
|
-
options: ExecutionOptions;
|
|
297
|
-
/**
|
|
298
|
-
* The input options used to initialize the context, which may be used when cloning the context to ensure the same configuration is applied to the new context
|
|
302
|
+
* The options provided to the Powerlines process, resolved with default values and merged with any configuration provided by plugins or other sources. This is typically the final configuration used during the build process, but may also include additional options that are relevant to the context and its interactions with the Powerlines engine.
|
|
299
303
|
*/
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* The initial configuration provided when initializing the context, which may be used during the setup process to ensure that the configuration is properly merged and applied to the context. This is typically the user configuration provided in the Powerlines configuration file, but may also include additional configuration options provided by plugins or other sources.
|
|
303
|
-
*/
|
|
304
|
-
initialConfig: InitialConfig<TResolvedConfig["userConfig"]>;
|
|
304
|
+
options: RequiredKeys<ExecutionOptions, "mode" | "cwd" | "root" | "framework" | "logLevel">;
|
|
305
305
|
/**
|
|
306
306
|
* An object containing the options provided to Powerlines
|
|
307
307
|
*/
|
|
308
|
-
config: Omit<TResolvedConfig["userConfig"], "output"> & Required<Pick<TResolvedConfig["userConfig"], "output">> & {
|
|
308
|
+
config: Omit<TResolvedConfig["userConfig"], "output"> & Required<Pick<TResolvedConfig["userConfig"], "output">> & Pick<TResolvedConfig, "cwd" | "root" | "mode" | "framework" | "configFile" | "name"> & {
|
|
309
|
+
/**
|
|
310
|
+
* The output configuration options for the Powerlines process, which may include settings related to the output directory, file naming conventions, and other options that affect how the compiled output is generated and structured. This is typically derived from the user configuration but may also include additional options provided by plugins or other sources.
|
|
311
|
+
*/
|
|
309
312
|
output: TResolvedConfig["output"];
|
|
313
|
+
/**
|
|
314
|
+
* The original configuration options that were provided by the user to the Powerlines process, which may be used during the configuration resolution process to ensure that the final configuration is properly merged and applied to the context. This is typically the user configuration provided in the Powerlines configuration file, but may also include additional configuration options provided by plugins or other sources.
|
|
315
|
+
*/
|
|
316
|
+
readonly initialConfig: DeepReadonly<TResolvedConfig["initialConfig"]>;
|
|
317
|
+
/**
|
|
318
|
+
* The configuration options that were provided inline to the Powerlines CLI.
|
|
319
|
+
*/
|
|
320
|
+
readonly inlineConfig: DeepReadonly<TResolvedConfig["inlineConfig"]>;
|
|
310
321
|
};
|
|
311
322
|
/**
|
|
312
323
|
* The metadata information
|
|
@@ -319,31 +330,31 @@ interface UnresolvedContext<TResolvedConfig extends ResolvedConfig = ResolvedCon
|
|
|
319
330
|
/**
|
|
320
331
|
* The path to a directory where the reflection data buffers (used by the build processes) are stored
|
|
321
332
|
*/
|
|
322
|
-
dataPath: string;
|
|
333
|
+
readonly dataPath: string;
|
|
323
334
|
/**
|
|
324
335
|
* The path to a directory where the project cache (used by the build processes) is stored
|
|
325
336
|
*/
|
|
326
|
-
cachePath: string;
|
|
337
|
+
readonly cachePath: string;
|
|
327
338
|
/**
|
|
328
339
|
* The Powerlines artifacts directory
|
|
329
340
|
*/
|
|
330
|
-
artifactsPath: string;
|
|
341
|
+
readonly artifactsPath: string;
|
|
331
342
|
/**
|
|
332
343
|
* The path to the Powerlines builtin runtime modules directory
|
|
333
344
|
*/
|
|
334
|
-
builtinsPath: string;
|
|
345
|
+
readonly builtinsPath: string;
|
|
335
346
|
/**
|
|
336
347
|
* The path to the Powerlines entry modules directory
|
|
337
348
|
*/
|
|
338
|
-
entryPath: string;
|
|
349
|
+
readonly entryPath: string;
|
|
339
350
|
/**
|
|
340
351
|
* The path to the Powerlines infrastructure modules directory
|
|
341
352
|
*/
|
|
342
|
-
infrastructurePath: string;
|
|
353
|
+
readonly infrastructurePath: string;
|
|
343
354
|
/**
|
|
344
355
|
* The path to the Powerlines TypeScript declaration files directory
|
|
345
356
|
*/
|
|
346
|
-
typesPath: string;
|
|
357
|
+
readonly typesPath: string;
|
|
347
358
|
/**
|
|
348
359
|
* The project's `package.json` file content
|
|
349
360
|
*/
|
|
@@ -551,23 +562,12 @@ type Context<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = Omit<Unr
|
|
|
551
562
|
* The fully resolved Powerlines configuration
|
|
552
563
|
*/
|
|
553
564
|
config: TResolvedConfig;
|
|
554
|
-
/**
|
|
555
|
-
* Initialize the context with the provided configuration options
|
|
556
|
-
*/
|
|
557
|
-
setup: () => Promise<void>;
|
|
558
|
-
/**
|
|
559
|
-
* A function to create a deep clone of the context
|
|
560
|
-
*
|
|
561
|
-
* @remarks
|
|
562
|
-
* This function is used to create a copy of the context for a specific environment, allowing for environment-specific modifications without affecting the global context.
|
|
563
|
-
*/
|
|
564
|
-
clone: () => Promise<Context<TResolvedConfig>>;
|
|
565
565
|
};
|
|
566
566
|
interface ExecutionContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig> {
|
|
567
567
|
/**
|
|
568
568
|
* The unique identifier of the execution context, which can be used for logging and other purposes to distinguish between different executions in the same process.
|
|
569
569
|
*/
|
|
570
|
-
id: string;
|
|
570
|
+
readonly id: string;
|
|
571
571
|
/**
|
|
572
572
|
* The expected plugins options for the Powerlines project.
|
|
573
573
|
*
|
|
@@ -575,14 +575,14 @@ interface ExecutionContext<TResolvedConfig extends ResolvedConfig = ResolvedConf
|
|
|
575
575
|
* This is a record of plugin identifiers to their respective options. This field is populated by the Powerlines engine during both plugin initialization and the `init` command.
|
|
576
576
|
*/
|
|
577
577
|
plugins: Plugin<PluginContext<TResolvedConfig>>[];
|
|
578
|
-
/**
|
|
579
|
-
* A function to add a plugin to the context and update the configuration options
|
|
580
|
-
*/
|
|
581
|
-
addPlugin: (plugin: Plugin<PluginContext<TResolvedConfig>>) => Promise<void>;
|
|
582
578
|
/**
|
|
583
579
|
* A table for storing the current context for each configured environment
|
|
584
580
|
*/
|
|
585
581
|
environments: Record<string, EnvironmentContext<TResolvedConfig>>;
|
|
582
|
+
/**
|
|
583
|
+
* A function to add a plugin to the context and update the configuration options
|
|
584
|
+
*/
|
|
585
|
+
addPlugin: (plugin: Plugin<PluginContext<TResolvedConfig>>) => Promise<void>;
|
|
586
586
|
/**
|
|
587
587
|
* Retrieves the context for a specific environment by name
|
|
588
588
|
*
|
|
@@ -632,26 +632,19 @@ interface ExecutionContext<TResolvedConfig extends ResolvedConfig = ResolvedConf
|
|
|
632
632
|
* @param environment - The environment configuration to use.
|
|
633
633
|
* @returns A new context instance with the updated environment.
|
|
634
634
|
*/
|
|
635
|
-
|
|
635
|
+
createEnvironment: (environment: EnvironmentResolvedConfig<TResolvedConfig>["environment"]) => Promise<EnvironmentContext<TResolvedConfig>>;
|
|
636
636
|
/**
|
|
637
637
|
* A function to merge all configured environments into a single context
|
|
638
638
|
*
|
|
639
639
|
* @returns A promise that resolves to the merged environment context.
|
|
640
640
|
*/
|
|
641
641
|
toEnvironment: () => Promise<EnvironmentContext<TResolvedConfig>>;
|
|
642
|
-
/**
|
|
643
|
-
* A function to create a deep clone of the context
|
|
644
|
-
*
|
|
645
|
-
* @remarks
|
|
646
|
-
* This function is used to create a copy of the context for a specific environment, allowing for environment-specific modifications without affecting the global context.
|
|
647
|
-
*/
|
|
648
|
-
clone: () => Promise<ExecutionContext<TResolvedConfig>>;
|
|
649
642
|
}
|
|
650
643
|
interface EnvironmentContextPlugin<TResolvedConfig extends ResolvedConfig = ResolvedConfig> {
|
|
651
644
|
/**
|
|
652
645
|
* The unique identifier of the plugin, which can be used for logging and other purposes to distinguish between different plugins in the same process.
|
|
653
646
|
*/
|
|
654
|
-
|
|
647
|
+
readonly id: string;
|
|
655
648
|
/**
|
|
656
649
|
* The plugin instance associated with this context, which can be used to access the plugin's options and other properties.
|
|
657
650
|
*/
|
|
@@ -668,11 +661,11 @@ type SelectHookResultItem<TContext extends PluginContext, TKey extends string> =
|
|
|
668
661
|
context: TContext;
|
|
669
662
|
};
|
|
670
663
|
type SelectHookResult<TContext extends PluginContext, TKey extends string> = SelectHookResultItem<TContext, TKey>[];
|
|
671
|
-
interface EnvironmentContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig
|
|
664
|
+
interface EnvironmentContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<EnvironmentResolvedConfig<TResolvedConfig>> {
|
|
672
665
|
/**
|
|
673
666
|
* The unique identifier of the environment associated with this context, which can be used for logging and other purposes to distinguish between different environments in the same process.
|
|
674
667
|
*/
|
|
675
|
-
id: string;
|
|
668
|
+
readonly id: string;
|
|
676
669
|
/**
|
|
677
670
|
* The expected plugins options for the Powerlines project.
|
|
678
671
|
*
|
|
@@ -680,46 +673,35 @@ interface EnvironmentContext<TResolvedConfig extends ResolvedConfig = ResolvedCo
|
|
|
680
673
|
* This is a record of plugin identifiers to their respective options. This field is populated by the Powerlines engine during both plugin initialization and the `init` command.
|
|
681
674
|
*/
|
|
682
675
|
plugins: EnvironmentContextPlugin<TResolvedConfig>[];
|
|
683
|
-
/**
|
|
684
|
-
* A function to add a plugin to the context and update the configuration options
|
|
685
|
-
*/
|
|
686
|
-
addPlugin: (plugin: Plugin<PluginContext<TResolvedConfig>>) => Promise<void>;
|
|
687
|
-
/**
|
|
688
|
-
* The environment specific resolved configuration
|
|
689
|
-
*/
|
|
690
|
-
environment: EnvironmentResolvedConfig;
|
|
691
676
|
/**
|
|
692
677
|
* A table holding references to hook functions registered by plugins
|
|
693
678
|
*/
|
|
694
679
|
hooks: HooksList<PluginContext<TResolvedConfig>>;
|
|
695
680
|
/**
|
|
696
|
-
*
|
|
681
|
+
* A function to add a plugin to the context and update the configuration options
|
|
697
682
|
*/
|
|
698
|
-
|
|
683
|
+
addPlugin: (plugin: Plugin<PluginContext<TResolvedConfig>>) => Promise<void>;
|
|
699
684
|
/**
|
|
700
|
-
*
|
|
701
|
-
*
|
|
702
|
-
* @remarks
|
|
703
|
-
* This function is used to create a copy of the context for a specific environment, allowing for environment-specific modifications without affecting the global context.
|
|
685
|
+
* Retrieves the hook handlers for a specific hook name
|
|
704
686
|
*/
|
|
705
|
-
|
|
687
|
+
selectHooks: <TKey extends string>(key: TKey, options?: SelectHooksOptions) => SelectHookResult<PluginContext<TResolvedConfig>, TKey>;
|
|
706
688
|
}
|
|
707
|
-
interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends Context<TResolvedConfig
|
|
689
|
+
interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedConfig, TApi extends API<any> = API<any>> extends Context<EnvironmentResolvedConfig<TResolvedConfig>> {
|
|
708
690
|
/**
|
|
709
691
|
* The unique identifier of the plugin associated with this context, which can be used for logging and other purposes to distinguish between different plugins in the same process.
|
|
710
692
|
*/
|
|
711
|
-
id: string;
|
|
712
|
-
/**
|
|
713
|
-
* The environment specific resolved configuration
|
|
714
|
-
*/
|
|
715
|
-
environment: EnvironmentResolvedConfig;
|
|
693
|
+
readonly id: string;
|
|
716
694
|
/**
|
|
717
|
-
*
|
|
695
|
+
* The API instance available to the plugin during execution, which provides access to the shared context and the ability to call plugin hooks. This API is specific to the plugin and environment, allowing for environment-specific interactions with the Powerlines engine.
|
|
718
696
|
*
|
|
719
697
|
* @remarks
|
|
720
|
-
*
|
|
698
|
+
* The API instance provided in the plugin context may include additional functionality specific to command execution, and it extends the base API with any additional methods or properties that are relevant to the plugin's interactions with the Powerlines engine.
|
|
699
|
+
*/
|
|
700
|
+
readonly api: TApi;
|
|
701
|
+
/**
|
|
702
|
+
* The context for the environment associated with this plugin context, which provides access to the Powerlines engine and other utilities for interacting with the build process. This context is specific to the plugin and environment, allowing for environment-specific modifications without affecting the global context.
|
|
721
703
|
*/
|
|
722
|
-
|
|
704
|
+
readonly environment: EnvironmentContext;
|
|
723
705
|
}
|
|
724
706
|
type BuildPluginContext<TResolvedConfig extends ResolvedConfig = ResolvedConfig> = UnpluginBuildContext & PluginContext<TResolvedConfig>;
|
|
725
707
|
type WithUnpluginBuildContext<TContext extends PluginContext> = UnpluginBuildContext & TContext;
|