@powerlines/core 0.15.25 → 0.15.26
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/log-level.d.cts +1 -1
- package/dist/constants/log-level.d.mts +1 -1
- package/dist/context/environment-context.cjs +1 -1
- package/dist/context/environment-context.d.cts.map +1 -1
- package/dist/context/environment-context.d.mts.map +1 -1
- package/dist/context/environment-context.mjs +2 -2
- package/dist/context/environment-context.mjs.map +1 -1
- package/dist/context/execution-context.cjs +1 -1
- package/dist/context/execution-context.mjs +1 -1
- package/dist/context/execution-context.mjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/lib/config.cjs +0 -6
- package/dist/lib/config.d.cts +26 -5
- package/dist/lib/config.d.cts.map +1 -1
- package/dist/lib/config.d.mts +26 -5
- package/dist/lib/config.d.mts.map +1 -1
- package/dist/lib/config.mjs +0 -6
- package/dist/lib/config.mjs.map +1 -1
- package/dist/lib/context-helpers.d.cts +4 -4
- package/dist/lib/context-helpers.d.mts +4 -4
- package/dist/types/config.d.cts +21 -40
- package/dist/types/config.d.cts.map +1 -1
- package/dist/types/config.d.mts +21 -40
- package/dist/types/config.d.mts.map +1 -1
- package/dist/types/index.d.cts +1 -1
- package/dist/types/index.d.mts +1 -1
- package/package.json +6 -6
|
@@ -20,7 +20,7 @@ declare const LogCategories: {
|
|
|
20
20
|
readonly BABEL: "babel";
|
|
21
21
|
readonly COMMUNICATION: "communication";
|
|
22
22
|
};
|
|
23
|
-
declare const LOG_CATEGORIES_ARRAY: ("
|
|
23
|
+
declare const LOG_CATEGORIES_ARRAY: ("general" | "fs" | "performance" | "config" | "plugins" | "hooks" | "env" | "rpc" | "babel" | "communication")[];
|
|
24
24
|
declare const LOG_CATEGORIES: readonly ["general", "fs", "performance", "config", "plugins", "hooks", "env", "rpc", "communication", "babel"];
|
|
25
25
|
declare const DEFAULT_DEVELOPMENT_LOG_LEVEL: {
|
|
26
26
|
readonly general: "debug";
|
|
@@ -20,7 +20,7 @@ declare const LogCategories: {
|
|
|
20
20
|
readonly BABEL: "babel";
|
|
21
21
|
readonly COMMUNICATION: "communication";
|
|
22
22
|
};
|
|
23
|
-
declare const LOG_CATEGORIES_ARRAY: ("
|
|
23
|
+
declare const LOG_CATEGORIES_ARRAY: ("general" | "fs" | "performance" | "config" | "plugins" | "hooks" | "env" | "rpc" | "babel" | "communication")[];
|
|
24
24
|
declare const LOG_CATEGORIES: readonly ["general", "fs", "performance", "config", "plugins", "hooks", "env", "rpc", "communication", "babel"];
|
|
25
25
|
declare const DEFAULT_DEVELOPMENT_LOG_LEVEL: {
|
|
26
26
|
readonly general: "debug";
|
|
@@ -119,7 +119,7 @@ var PowerlinesEnvironmentContext = class PowerlinesEnvironmentContext extends re
|
|
|
119
119
|
* @internal
|
|
120
120
|
*/
|
|
121
121
|
async unstable_addPlugin(plugin) {
|
|
122
|
-
const plugins = await require_lib_plugins.resolvePlugins(this, plugin);
|
|
122
|
+
const plugins = await require_lib_plugins.resolvePlugins(this, plugin, { skipLogging: !!(this.environmentConfig?.name && this.environmentConfig.name !== "default" && this.environmentConfig.name !== "__global__") });
|
|
123
123
|
for (const plugin of plugins) {
|
|
124
124
|
let resolvedPlugin = plugin;
|
|
125
125
|
if ((0, _stryke_type_checks_is_function.isFunction)(plugin.applyToEnvironment)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment-context.d.cts","names":[],"sources":["../../src/context/environment-context.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"environment-context.d.cts","names":[],"sources":["../../src/context/environment-context.ts"],"mappings":";;;;;;cA2Da,4BAAA,yBACa,cAAA,GAAiB,cAAA,oCAGjC,iBAAA,CACN,yBAAA,CAA0B,eAAA,GAC1B,cAAA,aAES,kBAAA,CAAmB,eAAA,EAAiB,cAAA;EAAA;;;;;AARjD;;;;;SAgCsB,IAAA,yBACM,cAAA,GAAiB,cAAA,2BAAA,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AA,GAAe,yBAAA,CAA0B,eAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment-context.d.mts","names":[],"sources":["../../src/context/environment-context.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"environment-context.d.mts","names":[],"sources":["../../src/context/environment-context.ts"],"mappings":";;;;;;cA2Da,4BAAA,yBACa,cAAA,GAAiB,cAAA,oCAGjC,iBAAA,CACN,yBAAA,CAA0B,eAAA,GAC1B,cAAA,aAES,kBAAA,CAAmB,eAAA,EAAiB,cAAA;EAAA;;;;;AARjD;;;;;SAgCsB,IAAA,yBACM,cAAA,GAAiB,cAAA,2BAAA,CAGzC,SAAA,EAAW,gBAAA,CAAiB,eAAA,EAAiB,cAAA,GAC7C,OAAA,EAAS,gBAAA,EACT,MAAA,EAAQ,eAAA,EACR,gBAAA,EAAkB,sBAAA,CAChB,yBAAA,CAA0B,eAAA,KAE3B,OAAA,CAAQ,4BAAA,CAA6B,eAAA,EAAiB,cAAA;EArCvD;;;EAAA,UAkDiB,iBAAA,EAAmB,yBAAA,CAA0B,eAAA;EAtBtC;;;EA4BnB,OAAA,EAAS,iBAAA,CAAkB,eAAA,EAAiB,cAAA;EAzBtC;;;EAAA,IA8BF,EAAA,CAAA;EA1BP;;;EAAA,IAiCO,KAAA,CAAA,GAAS,MAAA,SAElB,SAAA,CAAU,aAAA,CAAc,eAAA,EAAiB,cAAA;EAjChC;;;;;;;;EAAA,IA8CA,kBAAA,CAAA,GAAsB,gBAAA,CAC/B,eAAA,EACA,cAAA;EAfU;;;;;;EA0BC,oBAAA,CACX,MAAA,EAAQ,yBAAA,CAA0B,eAAA,mBACjC,OAAA;EADO;;;;;;EAiBM,YAAA,CAAa,OAAA,EAAS,aAAA,GAAgB,MAAA;EA6BA;;;;;;EAhBtC,YAAA,CAAa,OAAA,EAAS,aAAA,GAAgB,MAAA;EAuHH;;;;;;;;EAxGtC,kBAAA,CACX,MAAA,EAAQ,YAAA,CAAa,aAAA,CAAc,eAAA,EAAiB,cAAA,KACnD,OAAA;EAqL2B;;;EAlFvB,WAAA,qBAAA,CACL,GAAA,EAAK,IAAA,EACL,OAAA,GAAU,kBAAA,GACT,gBAAA,CAAiB,aAAA,CAAc,eAAA,EAAiB,cAAA,GAAiB,IAAA;EAkGlC;;;;;;;;;;;;EAAA,UAxBzB,WAAA,CACP,SAAA,EAAW,gBAAA,CAAiB,eAAA,EAAiB,cAAA,GAC7C,OAAA,EAAS,gBAAA,EACT,MAAA,EAAQ,eAAA,EACR,gBAAA,EAAkB,sBAAA,CAChB,yBAAA,CAA0B,eAAA;EAlUnB;;;;;EAAA,UAqVQ,WAAA,CAAA,GAAe,yBAAA,CAA0B,eAAA;AAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_ENVIRONMENT } from "../constants/environments.mjs";
|
|
1
|
+
import { DEFAULT_ENVIRONMENT, GLOBAL_ENVIRONMENT } from "../constants/environments.mjs";
|
|
2
2
|
import { PLUGIN_NON_HOOK_FIELDS } from "../constants/plugin.mjs";
|
|
3
3
|
import { dedupeHooklist, isPlugin, isPluginConfig, isPluginHookField } from "../plugin-utils/helpers.mjs";
|
|
4
4
|
import { mergeConfig } from "../plugin-utils/merge.mjs";
|
|
@@ -117,7 +117,7 @@ var PowerlinesEnvironmentContext = class PowerlinesEnvironmentContext extends Po
|
|
|
117
117
|
* @internal
|
|
118
118
|
*/
|
|
119
119
|
async unstable_addPlugin(plugin) {
|
|
120
|
-
const plugins = await resolvePlugins(this, plugin);
|
|
120
|
+
const plugins = await resolvePlugins(this, plugin, { skipLogging: !!(this.environmentConfig?.name && this.environmentConfig.name !== "default" && this.environmentConfig.name !== "__global__") });
|
|
121
121
|
for (const plugin of plugins) {
|
|
122
122
|
let resolvedPlugin = plugin;
|
|
123
123
|
if (isFunction(plugin.applyToEnvironment)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment-context.mjs","names":["#hooks","#execution"],"sources":["../../src/context/environment-context.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { omit } from \"@stryke/helpers/omit\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { ArrayValues } from \"@stryke/types/array\";\nimport { uuid } from \"@stryke/unique-id/uuid\";\nimport { DEFAULT_ENVIRONMENT, PLUGIN_NON_HOOK_FIELDS } from \"../constants\";\nimport { extractHooks } from \"../lib/hooks\";\nimport { resolvePlugins } from \"../lib/plugins\";\nimport {\n dedupeHooklist,\n formatConfig,\n isPlugin,\n isPluginConfig,\n isPluginHookField,\n mergeConfig\n} from \"../plugin-utils\";\nimport type {\n EnvironmentContext,\n EnvironmentPlugin,\n EnvironmentResolvedConfig,\n ExecutionContext,\n ExecutionOptions,\n HooksList,\n HooksListItem,\n InferOverridableConfig,\n Logger,\n LoggerOptions,\n PluginConfig,\n PluginContext,\n ResolvedConfig,\n SelectHookResult,\n SelectHooksOptions\n} from \"../types\";\nimport { PowerlinesContext } from \"./context\";\nimport { createPluginContext } from \"./plugin-context\";\n\nexport class PowerlinesEnvironmentContext<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TSystemContext = unknown\n>\n extends PowerlinesContext<\n EnvironmentResolvedConfig<TResolvedConfig>,\n TSystemContext\n >\n implements EnvironmentContext<TResolvedConfig, TSystemContext>\n{\n /**\n * The hooks registered by plugins in this environment\n */\n #hooks: Record<\n string,\n HooksList<PluginContext<TResolvedConfig, TSystemContext>>\n > = {};\n\n /**\n * The execution context associated with this environment, which provides access to the project configuration, environment, and utility functions for performing the build. The execution context is used to manage the state and behavior of the build process across multiple environments, allowing for hooks to be called at different stages of the build and for environment-specific configurations to be applied.\n */\n #execution: ExecutionContext<TResolvedConfig, TSystemContext>;\n\n /**\n * Create a new context from the config.\n *\n * @param execution - The execution context for the build process, which provides access to the project configuration, environment, and utility functions for performing the build. The context is used to manage the state and behavior of the build process, allowing for hooks to be called at different stages of the build and for environment-specific configurations to be applied.\n * @param options - The resolved execution options.\n * @param config - The user configuration options.\n * @param overriddenConfig - The configuration options that should override all other configuration sources, such as CLI flags or environment variables. This is used to ensure that certain configuration values take precedence over any other settings defined in the user configuration or environment configuration, allowing for dynamic overrides based on the execution context.\n * @returns A promise that resolves to an instance of the PowerlinesEnvironmentContext class, initialized with the provided configuration and environment data.\n */\n public static async from<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TSystemContext = unknown\n >(\n execution: ExecutionContext<TResolvedConfig, TSystemContext>,\n options: ExecutionOptions,\n config: TResolvedConfig,\n overriddenConfig: InferOverridableConfig<\n EnvironmentResolvedConfig<TResolvedConfig>\n >\n ): Promise<PowerlinesEnvironmentContext<TResolvedConfig, TSystemContext>> {\n const context = new PowerlinesEnvironmentContext<\n TResolvedConfig,\n TSystemContext\n >(execution, options, config, overriddenConfig);\n await context.init();\n\n return context;\n }\n\n /**\n * The configuration options provided by plugins added by the user (and other plugins)\n */\n protected override environmentConfig: EnvironmentResolvedConfig<TResolvedConfig>[\"environment\"] =\n {} as EnvironmentResolvedConfig<TResolvedConfig>[\"environment\"];\n\n /**\n * The list of plugins applied to this environment\n */\n public plugins: EnvironmentPlugin<TResolvedConfig, TSystemContext>[] = [];\n\n /**\n * 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.\n */\n public get id(): string {\n return this.config.environment.id;\n }\n\n /**\n * The hooks registered by plugins in this environment\n */\n public get hooks(): Record<\n string,\n HooksList<PluginContext<TResolvedConfig, TSystemContext>>\n > {\n return this.#hooks;\n }\n\n /**\n * The execution context associated with this environment, which provides access to the project configuration, environment, and utility functions for performing the build. The execution context is used to manage the state and behavior of the build process across multiple environments, allowing for hooks to be called at different stages of the build and for environment-specific configurations to be applied.\n *\n * @danger\n * This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.\n *\n * @internal\n */\n public get unstable_execution(): ExecutionContext<\n TResolvedConfig,\n TSystemContext\n > {\n return this.#execution;\n }\n\n /**\n * A setter function to populate the environment config values provided during execution of the command, such as CLI flags or other parameters that may be relevant to the command being executed. This function can be used to update the context with the environment configuration values, which may be used during the configuration resolution process to ensure that the final configuration reflects both the user configuration and any environment configuration provided during execution.\n *\n * @param config - The environment configuration values to set.\n * @returns A promise that resolves when the environment configuration values have been set.\n */\n public async setEnvironmentConfig(\n config: EnvironmentResolvedConfig<TResolvedConfig>[\"environment\"]\n ): Promise<void> {\n this.logger.debug({\n meta: { category: \"config\" },\n message: `Updating environment configuration object: \\n${formatConfig(config)}`\n });\n\n this.environmentConfig = config;\n await this.resolveConfig();\n }\n\n /**\n * Create a new logger instance\n *\n * @param options - The configuration options to use for the logger instance, which can be used to customize the appearance and behavior of the log messages generated by the logger. This is typically the name of the plugin or module that is creating the logger instance.\n * @returns A logger client instance that can be used to generate log messages with consistent formatting and metadata.\n */\n public override createLogger(options: LoggerOptions): Logger {\n return super.createLogger({\n ...options,\n environment: this.environmentConfig?.name || this.config.environment?.name\n });\n }\n\n /**\n * Extend the base logger with additional configuration options\n *\n * @param options - The configuration options to extend the base logger with, which can be used to add additional metadata or customize the appearance of log messages generated by the logger. This is typically the name of the plugin or module that is creating the logger instance, as well as any additional metadata such as the plugin category or environment.\n * @returns A new logger client instance that extends the base logger with the provided configuration options.\n */\n public override extendLogger(options: LoggerOptions): Logger {\n return super.extendLogger({\n ...options,\n environment: this.environmentConfig?.name || this.config.environment?.name\n });\n }\n\n /**\n * A function used internally to add a plugin to the context and update the configuration options\n *\n * @danger\n * This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.\n *\n * @internal\n */\n public async unstable_addPlugin(\n plugin: PluginConfig<PluginContext<TResolvedConfig, TSystemContext>>\n ): Promise<void> {\n const plugins = await resolvePlugins<TResolvedConfig, TSystemContext>(\n this,\n plugin\n );\n for (const plugin of plugins) {\n let resolvedPlugin = plugin as EnvironmentPlugin<\n TResolvedConfig,\n TSystemContext\n >;\n if (isFunction(plugin.applyToEnvironment)) {\n const result = (await Promise.resolve(\n plugin.applyToEnvironment(this.config.environment) as Promise<any>\n )) as\n | boolean\n | PluginConfig<PluginContext<TResolvedConfig, TSystemContext>>;\n\n if (!result || (isObject(result) && Object.keys(result).length === 0)) {\n return;\n }\n\n if (\n isPluginConfig<PluginContext<TResolvedConfig, TSystemContext>>(result)\n ) {\n return this.unstable_addPlugin(result);\n }\n\n resolvedPlugin = (\n isPlugin<PluginContext<TResolvedConfig, TSystemContext>>(result)\n ? result\n : plugin\n ) as EnvironmentPlugin<TResolvedConfig, TSystemContext>;\n }\n\n const id = uuid();\n const context = createPluginContext<TResolvedConfig, TSystemContext>(\n id,\n resolvedPlugin,\n this\n );\n\n resolvedPlugin[\"~internal\"] = {\n id,\n context\n };\n\n this.plugins.push(resolvedPlugin);\n\n this.#hooks = Object.entries(\n Object.keys(resolvedPlugin)\n .filter(\n key =>\n key !== \"~internal\" &&\n !PLUGIN_NON_HOOK_FIELDS.includes(\n key as ArrayValues<typeof PLUGIN_NON_HOOK_FIELDS>\n )\n )\n .reduce(\n (ret, key) =>\n extractHooks<TResolvedConfig, TSystemContext>(\n context,\n ret,\n resolvedPlugin,\n key\n ),\n this.hooks\n )\n ).reduce(\n (ret, [key, value]) => {\n if (isSetObject(value)) {\n Object.entries(value).forEach(([type, list]) => {\n ret[key] ??= {};\n ret[key][type as keyof (typeof ret)[typeof key]] =\n dedupeHooklist<PluginContext<TResolvedConfig, TSystemContext>>(\n list\n );\n });\n }\n\n return ret;\n },\n {} as Record<\n string,\n HooksList<PluginContext<TResolvedConfig, TSystemContext>>\n >\n );\n }\n }\n\n /**\n * Retrieves the hook handlers for a specific hook name\n */\n public selectHooks<TKey extends string>(\n key: TKey,\n options?: SelectHooksOptions\n ): SelectHookResult<PluginContext<TResolvedConfig, TSystemContext>, TKey> {\n const result = [] as SelectHookResult<\n PluginContext<TResolvedConfig, TSystemContext>,\n TKey\n >;\n\n if (\n isPluginHookField<PluginContext<TResolvedConfig, TSystemContext>>(key) &&\n this.hooks[key]\n ) {\n if (this.hooks[key]) {\n if (options?.order) {\n const mapHooksToResult = (\n hooksList: HooksListItem<\n PluginContext<TResolvedConfig, TSystemContext>,\n TKey\n >[]\n ): SelectHookResult<\n PluginContext<TResolvedConfig, TSystemContext>,\n TKey\n > =>\n hooksList.map(hook => {\n const plugin = this.plugins.find(\n p => p.name === hook.plugin.name\n );\n if (!plugin) {\n throw new Error(\n `Could not find plugin context for plugin \"${\n hook.plugin.name\n }\".`\n );\n }\n\n return {\n handler: hook.handler,\n plugin: hook.plugin,\n context: plugin[\"~internal\"].context\n };\n });\n\n if (options?.order === \"pre\") {\n result.push(...mapHooksToResult(this.hooks[key].preOrdered ?? []));\n result.push(...mapHooksToResult(this.hooks[key].preEnforced ?? []));\n } else if (options?.order === \"post\") {\n result.push(...mapHooksToResult(this.hooks[key].postOrdered ?? []));\n result.push(\n ...mapHooksToResult(this.hooks[key].postEnforced ?? [])\n );\n } else {\n result.push(...mapHooksToResult(this.hooks[key].normal ?? []));\n }\n } else {\n result.push(...this.selectHooks(key, { order: \"pre\" }));\n result.push(...this.selectHooks(key, { order: \"normal\" }));\n result.push(...this.selectHooks(key, { order: \"post\" }));\n }\n }\n }\n\n return result;\n }\n\n /**\n * A function to add a plugin to the context and update the configuration options. This function is used internally when applying plugins to the environment, and it ensures that the plugin is added to the list of plugins in the context and that any hooks or configuration options provided by the plugin are properly integrated into the context's state.\n *\n * @remarks\n * This function is used internally when applying plugins to the environment, and it ensures that the plugin is added to the list of plugins in the context and that any hooks or configuration options provided by the plugin are properly integrated into the context's state. It should not be called directly by external code, as it is intended for internal use only and may be subject to change without warning.\n *\n * @param execution - The execution context for the build process, which provides access to the project configuration, environment, and utility functions for performing the build. The context is used to manage the state and behavior of the build process, allowing for hooks to be called at different stages of the build and for environment-specific configurations to be applied.\n * @param options - The configuration options for the plugin, which may include properties such as the plugin name, hooks, and any other relevant metadata or settings that should be associated with the plugin when it is added to the context.\n * @param config - The resolved configuration for the environment, which may include properties such as the environment name, SSR settings, and other relevant configuration options that may affect how the plugin is applied to the environment.\n * @param overriddenConfig - The configuration options that should override all other configuration sources, such as CLI flags or environment variables. This is used to ensure that certain configuration values take precedence over any other settings defined in the user configuration or environment configuration, allowing for dynamic overrides based on the execution context.\n * @returns A promise that resolves when the plugin has been added to the context and the configuration has been updated accordingly.\n */\n protected constructor(\n execution: ExecutionContext<TResolvedConfig, TSystemContext>,\n options: ExecutionOptions,\n config: TResolvedConfig,\n overriddenConfig: InferOverridableConfig<\n EnvironmentResolvedConfig<TResolvedConfig>\n >\n ) {\n super(options);\n\n this.#execution = execution;\n this.userConfig =\n config.userConfig ?? ({} as TResolvedConfig[\"userConfig\"]);\n this.inlineConfig =\n config.inlineConfig ?? ({} as TResolvedConfig[\"inlineConfig\"]);\n this.pluginConfig = config.pluginConfig ?? {};\n this.overriddenConfig = overriddenConfig;\n }\n\n /**\n * A function to merge the various configuration objects (initial, user, inline, and plugin) into a single resolved configuration object that can be used throughout the Powerlines process. This function takes into account the different sources of configuration and their respective priorities, ensuring that the final configuration reflects the intended settings for the project. The merged configuration is then returned as a new object that can be accessed through the `config` property of the context.\n *\n * @returns The merged configuration object that combines the initial, user, inline, and plugin configurations.\n */\n protected override mergeConfig(): EnvironmentResolvedConfig<TResolvedConfig> {\n return mergeConfig(\n {\n ...omit(this.environmentConfig ?? {}, [\n \"name\",\n \"ssr\",\n \"preview\",\n \"consumer\",\n \"runtime\"\n ]),\n environment: {\n name: this.environmentConfig?.name || DEFAULT_ENVIRONMENT\n },\n environmentConfig: this.environmentConfig ?? {}\n },\n super.mergeConfig()\n ) as EnvironmentResolvedConfig<TResolvedConfig>;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAuDA,IAAa,+BAAb,MAAa,qCAIH,kBAKV;;;;CAIE,SAGI,CAAC;;;;CAKL;;;;;;;;;;CAWA,aAAoB,KAIlB,WACA,SACA,QACA,kBAGwE;EACxE,MAAM,UAAU,IAAI,6BAGlB,WAAW,SAAS,QAAQ,gBAAgB;EAC9C,MAAM,QAAQ,KAAK;EAEnB,OAAO;CACT;;;;CAKA,AAAmB,oBACjB,CAAC;;;;CAKH,AAAO,UAAgE,CAAC;;;;CAKxE,IAAW,KAAa;EACtB,OAAO,KAAK,OAAO,YAAY;CACjC;;;;CAKA,IAAW,QAGT;EACA,OAAO,KAAKA;CACd;;;;;;;;;CAUA,IAAW,qBAGT;EACA,OAAO,KAAKC;CACd;;;;;;;CAQA,MAAa,qBACX,QACe;EACf,KAAK,OAAO,MAAM;GAChB,MAAM,EAAE,UAAU,SAAS;GAC3B,SAAS,gDAAgD,aAAa,MAAM;EAC9E,CAAC;EAED,KAAK,oBAAoB;EACzB,MAAM,KAAK,cAAc;CAC3B;;;;;;;CAQA,AAAgB,aAAa,SAAgC;EAC3D,OAAO,MAAM,aAAa;GACxB,GAAG;GACH,aAAa,KAAK,mBAAmB,QAAQ,KAAK,OAAO,aAAa;EACxE,CAAC;CACH;;;;;;;CAQA,AAAgB,aAAa,SAAgC;EAC3D,OAAO,MAAM,aAAa;GACxB,GAAG;GACH,aAAa,KAAK,mBAAmB,QAAQ,KAAK,OAAO,aAAa;EACxE,CAAC;CACH;;;;;;;;;CAUA,MAAa,mBACX,QACe;EACf,MAAM,UAAU,MAAM,eACpB,MACA,MACF;EACA,KAAK,MAAM,UAAU,SAAS;GAC5B,IAAI,iBAAiB;GAIrB,IAAI,WAAW,OAAO,kBAAkB,GAAG;IACzC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AO;KAC5B,OAAO,KAAK,GAAG,iBAAiB,KAAK,MAAM,KAAK,cAAc,CAAC,CAAC,CAAC;KACjE,OAAO,KAAK,GAAG,iBAAiB,KAAK,MAAM,KAAK,eAAe,CAAC,CAAC,CAAC;IACpE,OAAO,IAAI,SAAS,UAAU,QAAQ;KACpC,OAAO,KAAK,GAAG,iBAAiB,KAAK,MAAM,KAAK,eAAe,CAAC,CAAC,CAAC;KAClE,OAAO,KACL,GAAG,iBAAiB,KAAK,MAAM,KAAK,gBAAgB,CAAC,CAAC,CACxD;IACF,OACE,OAAO,KAAK,GAAG,iBAAiB,KAAK,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC;GAEjE,OAAO;IACL,OAAO,KAAK,GAAG,KAAK,YAAY,KAAK,EAAE,OAAO,MAAM,CAAC,CAAC;IACtD,OAAO,KAAK,GAAG,KAAK,YAAY,KAAK,EAAE,OAAO,SAAS,CAAC,CAAC;IACzD,OAAO,KAAK,GAAG,KAAK,YAAY,KAAK,EAAE,OAAO,OAAO,CAAC,CAAC;GACzD;EACF;EAGF,OAAO;CACT;;;;;;;;;;;;;CAcA,AAAU,YACR,WACA,SACA,QACA,kBAGA;EACA,MAAM,OAAO;EAEb,KAAKC,aAAa;EAClB,KAAK,aACH,OAAO,cAAe,CAAC;EACzB,KAAK,eACH,OAAO,gBAAiB,CAAC;EAC3B,KAAK,eAAe,OAAO,gBAAgB,CAAC;EAC5C,KAAK,mBAAmB;CAC1B;;;;;;CAOA,AAAmB,cAA0D;EAC3E,OAAO,YACL;GACE,GAAG,KAAK,KAAK,qBAAqB,CAAC,GAAG;IACpC;IACA;IACA;IACA;IACA;GACF,CAAC;GACD,aAAa,EACX,MAAM,KAAK,mBAAmB,kBAChC;GACA,mBAAmB,KAAK,qBAAqB,CAAC;EAChD,GACA,MAAM,YAAY,CACpB;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"environment-context.mjs","names":["#hooks","#execution"],"sources":["../../src/context/environment-context.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { omit } from \"@stryke/helpers/omit\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { ArrayValues } from \"@stryke/types/array\";\nimport { uuid } from \"@stryke/unique-id/uuid\";\nimport {\n DEFAULT_ENVIRONMENT,\n GLOBAL_ENVIRONMENT,\n PLUGIN_NON_HOOK_FIELDS\n} from \"../constants\";\nimport { extractHooks } from \"../lib/hooks\";\nimport { resolvePlugins } from \"../lib/plugins\";\nimport {\n dedupeHooklist,\n formatConfig,\n isPlugin,\n isPluginConfig,\n isPluginHookField,\n mergeConfig\n} from \"../plugin-utils\";\nimport type {\n EnvironmentContext,\n EnvironmentPlugin,\n EnvironmentResolvedConfig,\n ExecutionContext,\n ExecutionOptions,\n HooksList,\n HooksListItem,\n InferOverridableConfig,\n Logger,\n LoggerOptions,\n PluginConfig,\n PluginContext,\n ResolvedConfig,\n SelectHookResult,\n SelectHooksOptions\n} from \"../types\";\nimport { PowerlinesContext } from \"./context\";\nimport { createPluginContext } from \"./plugin-context\";\n\nexport class PowerlinesEnvironmentContext<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TSystemContext = unknown\n>\n extends PowerlinesContext<\n EnvironmentResolvedConfig<TResolvedConfig>,\n TSystemContext\n >\n implements EnvironmentContext<TResolvedConfig, TSystemContext>\n{\n /**\n * The hooks registered by plugins in this environment\n */\n #hooks: Record<\n string,\n HooksList<PluginContext<TResolvedConfig, TSystemContext>>\n > = {};\n\n /**\n * The execution context associated with this environment, which provides access to the project configuration, environment, and utility functions for performing the build. The execution context is used to manage the state and behavior of the build process across multiple environments, allowing for hooks to be called at different stages of the build and for environment-specific configurations to be applied.\n */\n #execution: ExecutionContext<TResolvedConfig, TSystemContext>;\n\n /**\n * Create a new context from the config.\n *\n * @param execution - The execution context for the build process, which provides access to the project configuration, environment, and utility functions for performing the build. The context is used to manage the state and behavior of the build process, allowing for hooks to be called at different stages of the build and for environment-specific configurations to be applied.\n * @param options - The resolved execution options.\n * @param config - The user configuration options.\n * @param overriddenConfig - The configuration options that should override all other configuration sources, such as CLI flags or environment variables. This is used to ensure that certain configuration values take precedence over any other settings defined in the user configuration or environment configuration, allowing for dynamic overrides based on the execution context.\n * @returns A promise that resolves to an instance of the PowerlinesEnvironmentContext class, initialized with the provided configuration and environment data.\n */\n public static async from<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TSystemContext = unknown\n >(\n execution: ExecutionContext<TResolvedConfig, TSystemContext>,\n options: ExecutionOptions,\n config: TResolvedConfig,\n overriddenConfig: InferOverridableConfig<\n EnvironmentResolvedConfig<TResolvedConfig>\n >\n ): Promise<PowerlinesEnvironmentContext<TResolvedConfig, TSystemContext>> {\n const context = new PowerlinesEnvironmentContext<\n TResolvedConfig,\n TSystemContext\n >(execution, options, config, overriddenConfig);\n await context.init();\n\n return context;\n }\n\n /**\n * The configuration options provided by plugins added by the user (and other plugins)\n */\n protected override environmentConfig: EnvironmentResolvedConfig<TResolvedConfig>[\"environment\"] =\n {} as EnvironmentResolvedConfig<TResolvedConfig>[\"environment\"];\n\n /**\n * The list of plugins applied to this environment\n */\n public plugins: EnvironmentPlugin<TResolvedConfig, TSystemContext>[] = [];\n\n /**\n * 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.\n */\n public get id(): string {\n return this.config.environment.id;\n }\n\n /**\n * The hooks registered by plugins in this environment\n */\n public get hooks(): Record<\n string,\n HooksList<PluginContext<TResolvedConfig, TSystemContext>>\n > {\n return this.#hooks;\n }\n\n /**\n * The execution context associated with this environment, which provides access to the project configuration, environment, and utility functions for performing the build. The execution context is used to manage the state and behavior of the build process across multiple environments, allowing for hooks to be called at different stages of the build and for environment-specific configurations to be applied.\n *\n * @danger\n * This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.\n *\n * @internal\n */\n public get unstable_execution(): ExecutionContext<\n TResolvedConfig,\n TSystemContext\n > {\n return this.#execution;\n }\n\n /**\n * A setter function to populate the environment config values provided during execution of the command, such as CLI flags or other parameters that may be relevant to the command being executed. This function can be used to update the context with the environment configuration values, which may be used during the configuration resolution process to ensure that the final configuration reflects both the user configuration and any environment configuration provided during execution.\n *\n * @param config - The environment configuration values to set.\n * @returns A promise that resolves when the environment configuration values have been set.\n */\n public async setEnvironmentConfig(\n config: EnvironmentResolvedConfig<TResolvedConfig>[\"environment\"]\n ): Promise<void> {\n this.logger.debug({\n meta: { category: \"config\" },\n message: `Updating environment configuration object: \\n${formatConfig(config)}`\n });\n\n this.environmentConfig = config;\n await this.resolveConfig();\n }\n\n /**\n * Create a new logger instance\n *\n * @param options - The configuration options to use for the logger instance, which can be used to customize the appearance and behavior of the log messages generated by the logger. This is typically the name of the plugin or module that is creating the logger instance.\n * @returns A logger client instance that can be used to generate log messages with consistent formatting and metadata.\n */\n public override createLogger(options: LoggerOptions): Logger {\n return super.createLogger({\n ...options,\n environment: this.environmentConfig?.name || this.config.environment?.name\n });\n }\n\n /**\n * Extend the base logger with additional configuration options\n *\n * @param options - The configuration options to extend the base logger with, which can be used to add additional metadata or customize the appearance of log messages generated by the logger. This is typically the name of the plugin or module that is creating the logger instance, as well as any additional metadata such as the plugin category or environment.\n * @returns A new logger client instance that extends the base logger with the provided configuration options.\n */\n public override extendLogger(options: LoggerOptions): Logger {\n return super.extendLogger({\n ...options,\n environment: this.environmentConfig?.name || this.config.environment?.name\n });\n }\n\n /**\n * A function used internally to add a plugin to the context and update the configuration options\n *\n * @danger\n * This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.\n *\n * @internal\n */\n public async unstable_addPlugin(\n plugin: PluginConfig<PluginContext<TResolvedConfig, TSystemContext>>\n ): Promise<void> {\n const plugins = await resolvePlugins<TResolvedConfig, TSystemContext>(\n this,\n plugin,\n {\n skipLogging: !!(\n this.environmentConfig?.name &&\n this.environmentConfig.name !== DEFAULT_ENVIRONMENT &&\n this.environmentConfig.name !== GLOBAL_ENVIRONMENT\n )\n }\n );\n for (const plugin of plugins) {\n let resolvedPlugin = plugin as EnvironmentPlugin<\n TResolvedConfig,\n TSystemContext\n >;\n if (isFunction(plugin.applyToEnvironment)) {\n const result = (await Promise.resolve(\n plugin.applyToEnvironment(this.config.environment) as Promise<any>\n )) as\n | boolean\n | PluginConfig<PluginContext<TResolvedConfig, TSystemContext>>;\n\n if (!result || (isObject(result) && Object.keys(result).length === 0)) {\n return;\n }\n\n if (\n isPluginConfig<PluginContext<TResolvedConfig, TSystemContext>>(result)\n ) {\n return this.unstable_addPlugin(result);\n }\n\n resolvedPlugin = (\n isPlugin<PluginContext<TResolvedConfig, TSystemContext>>(result)\n ? result\n : plugin\n ) as EnvironmentPlugin<TResolvedConfig, TSystemContext>;\n }\n\n const id = uuid();\n const context = createPluginContext<TResolvedConfig, TSystemContext>(\n id,\n resolvedPlugin,\n this\n );\n\n resolvedPlugin[\"~internal\"] = {\n id,\n context\n };\n\n this.plugins.push(resolvedPlugin);\n\n this.#hooks = Object.entries(\n Object.keys(resolvedPlugin)\n .filter(\n key =>\n key !== \"~internal\" &&\n !PLUGIN_NON_HOOK_FIELDS.includes(\n key as ArrayValues<typeof PLUGIN_NON_HOOK_FIELDS>\n )\n )\n .reduce(\n (ret, key) =>\n extractHooks<TResolvedConfig, TSystemContext>(\n context,\n ret,\n resolvedPlugin,\n key\n ),\n this.hooks\n )\n ).reduce(\n (ret, [key, value]) => {\n if (isSetObject(value)) {\n Object.entries(value).forEach(([type, list]) => {\n ret[key] ??= {};\n ret[key][type as keyof (typeof ret)[typeof key]] =\n dedupeHooklist<PluginContext<TResolvedConfig, TSystemContext>>(\n list\n );\n });\n }\n\n return ret;\n },\n {} as Record<\n string,\n HooksList<PluginContext<TResolvedConfig, TSystemContext>>\n >\n );\n }\n }\n\n /**\n * Retrieves the hook handlers for a specific hook name\n */\n public selectHooks<TKey extends string>(\n key: TKey,\n options?: SelectHooksOptions\n ): SelectHookResult<PluginContext<TResolvedConfig, TSystemContext>, TKey> {\n const result = [] as SelectHookResult<\n PluginContext<TResolvedConfig, TSystemContext>,\n TKey\n >;\n\n if (\n isPluginHookField<PluginContext<TResolvedConfig, TSystemContext>>(key) &&\n this.hooks[key]\n ) {\n if (this.hooks[key]) {\n if (options?.order) {\n const mapHooksToResult = (\n hooksList: HooksListItem<\n PluginContext<TResolvedConfig, TSystemContext>,\n TKey\n >[]\n ): SelectHookResult<\n PluginContext<TResolvedConfig, TSystemContext>,\n TKey\n > =>\n hooksList.map(hook => {\n const plugin = this.plugins.find(\n p => p.name === hook.plugin.name\n );\n if (!plugin) {\n throw new Error(\n `Could not find plugin context for plugin \"${\n hook.plugin.name\n }\".`\n );\n }\n\n return {\n handler: hook.handler,\n plugin: hook.plugin,\n context: plugin[\"~internal\"].context\n };\n });\n\n if (options?.order === \"pre\") {\n result.push(...mapHooksToResult(this.hooks[key].preOrdered ?? []));\n result.push(...mapHooksToResult(this.hooks[key].preEnforced ?? []));\n } else if (options?.order === \"post\") {\n result.push(...mapHooksToResult(this.hooks[key].postOrdered ?? []));\n result.push(\n ...mapHooksToResult(this.hooks[key].postEnforced ?? [])\n );\n } else {\n result.push(...mapHooksToResult(this.hooks[key].normal ?? []));\n }\n } else {\n result.push(...this.selectHooks(key, { order: \"pre\" }));\n result.push(...this.selectHooks(key, { order: \"normal\" }));\n result.push(...this.selectHooks(key, { order: \"post\" }));\n }\n }\n }\n\n return result;\n }\n\n /**\n * A function to add a plugin to the context and update the configuration options. This function is used internally when applying plugins to the environment, and it ensures that the plugin is added to the list of plugins in the context and that any hooks or configuration options provided by the plugin are properly integrated into the context's state.\n *\n * @remarks\n * This function is used internally when applying plugins to the environment, and it ensures that the plugin is added to the list of plugins in the context and that any hooks or configuration options provided by the plugin are properly integrated into the context's state. It should not be called directly by external code, as it is intended for internal use only and may be subject to change without warning.\n *\n * @param execution - The execution context for the build process, which provides access to the project configuration, environment, and utility functions for performing the build. The context is used to manage the state and behavior of the build process, allowing for hooks to be called at different stages of the build and for environment-specific configurations to be applied.\n * @param options - The configuration options for the plugin, which may include properties such as the plugin name, hooks, and any other relevant metadata or settings that should be associated with the plugin when it is added to the context.\n * @param config - The resolved configuration for the environment, which may include properties such as the environment name, SSR settings, and other relevant configuration options that may affect how the plugin is applied to the environment.\n * @param overriddenConfig - The configuration options that should override all other configuration sources, such as CLI flags or environment variables. This is used to ensure that certain configuration values take precedence over any other settings defined in the user configuration or environment configuration, allowing for dynamic overrides based on the execution context.\n * @returns A promise that resolves when the plugin has been added to the context and the configuration has been updated accordingly.\n */\n protected constructor(\n execution: ExecutionContext<TResolvedConfig, TSystemContext>,\n options: ExecutionOptions,\n config: TResolvedConfig,\n overriddenConfig: InferOverridableConfig<\n EnvironmentResolvedConfig<TResolvedConfig>\n >\n ) {\n super(options);\n\n this.#execution = execution;\n this.userConfig =\n config.userConfig ?? ({} as TResolvedConfig[\"userConfig\"]);\n this.inlineConfig =\n config.inlineConfig ?? ({} as TResolvedConfig[\"inlineConfig\"]);\n this.pluginConfig = config.pluginConfig ?? {};\n this.overriddenConfig = overriddenConfig;\n }\n\n /**\n * A function to merge the various configuration objects (initial, user, inline, and plugin) into a single resolved configuration object that can be used throughout the Powerlines process. This function takes into account the different sources of configuration and their respective priorities, ensuring that the final configuration reflects the intended settings for the project. The merged configuration is then returned as a new object that can be accessed through the `config` property of the context.\n *\n * @returns The merged configuration object that combines the initial, user, inline, and plugin configurations.\n */\n protected override mergeConfig(): EnvironmentResolvedConfig<TResolvedConfig> {\n return mergeConfig(\n {\n ...omit(this.environmentConfig ?? {}, [\n \"name\",\n \"ssr\",\n \"preview\",\n \"consumer\",\n \"runtime\"\n ]),\n environment: {\n name: this.environmentConfig?.name || DEFAULT_ENVIRONMENT\n },\n environmentConfig: this.environmentConfig ?? {}\n },\n super.mergeConfig()\n ) as EnvironmentResolvedConfig<TResolvedConfig>;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA2DA,IAAa,+BAAb,MAAa,qCAIH,kBAKV;;;;CAIE,SAGI,CAAC;;;;CAKL;;;;;;;;;;CAWA,aAAoB,KAIlB,WACA,SACA,QACA,kBAGwE;EACxE,MAAM,UAAU,IAAI,6BAGlB,WAAW,SAAS,QAAQ,gBAAgB;EAC9C,MAAM,QAAQ,KAAK;EAEnB,OAAO;CACT;;;;CAKA,AAAmB,oBACjB,CAAC;;;;CAKH,AAAO,UAAgE,CAAC;;;;CAKxE,IAAW,KAAa;EACtB,OAAO,KAAK,OAAO,YAAY;CACjC;;;;CAKA,IAAW,QAGT;EACA,OAAO,KAAKA;CACd;;;;;;;;;CAUA,IAAW,qBAGT;EACA,OAAO,KAAKC;CACd;;;;;;;CAQA,MAAa,qBACX,QACe;EACf,KAAK,OAAO,MAAM;GAChB,MAAM,EAAE,UAAU,SAAS;GAC3B,SAAS,gDAAgD,aAAa,MAAM;EAC9E,CAAC;EAED,KAAK,oBAAoB;EACzB,MAAM,KAAK,cAAc;CAC3B;;;;;;;CAQA,AAAgB,aAAa,SAAgC;EAC3D,OAAO,MAAM,aAAa;GACxB,GAAG;GACH,aAAa,KAAK,mBAAmB,QAAQ,KAAK,OAAO,aAAa;EACxE,CAAC;CACH;;;;;;;CAQA,AAAgB,aAAa,SAAgC;EAC3D,OAAO,MAAM,aAAa;GACxB,GAAG;GACH,aAAa,KAAK,mBAAmB,QAAQ,KAAK,OAAO,aAAa;EACxE,CAAC;CACH;;;;;;;;;CAUA,MAAa,mBACX,QACe;EACf,MAAM,UAAU,MA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AAC;GACD,aAAa,EACX,MAAM,KAAK,mBAAmB,kBAChC;GACA,mBAAmB,KAAK,qBAAqB,CAAC;EAChD,GACA,MAAM,YAAY,CACpB;CACF;AACF"}
|
|
@@ -219,7 +219,7 @@ var PowerlinesExecutionContext = class PowerlinesExecutionContext extends requir
|
|
|
219
219
|
* @internal
|
|
220
220
|
*/
|
|
221
221
|
async unstable_addPlugin(plugin) {
|
|
222
|
-
this.plugins.push(...await require_lib_plugins.resolvePlugins(this, plugin, { skipLogging: Object.keys(this.environments).filter((key) => key !== "default" && key !== "__global__").length > 0 }));
|
|
222
|
+
this.plugins.push(...await require_lib_plugins.resolvePlugins(this, plugin, { skipLogging: Object.keys(this.environments).filter((key) => key && key !== "default" && key !== "__global__").length > 0 }));
|
|
223
223
|
await Promise.all(Object.keys(this.environments).map(async (name) => {
|
|
224
224
|
await this.environments[name].unstable_addPlugin(plugin);
|
|
225
225
|
}));
|
|
@@ -216,7 +216,7 @@ var PowerlinesExecutionContext = class PowerlinesExecutionContext extends Powerl
|
|
|
216
216
|
* @internal
|
|
217
217
|
*/
|
|
218
218
|
async unstable_addPlugin(plugin) {
|
|
219
|
-
this.plugins.push(...await resolvePlugins(this, plugin, { skipLogging: Object.keys(this.environments).filter((key) => key !== "default" && key !== "__global__").length > 0 }));
|
|
219
|
+
this.plugins.push(...await resolvePlugins(this, plugin, { skipLogging: Object.keys(this.environments).filter((key) => key && key !== "default" && key !== "__global__").length > 0 }));
|
|
220
220
|
await Promise.all(Object.keys(this.environments).map(async (name) => {
|
|
221
221
|
await this.environments[name].unstable_addPlugin(plugin);
|
|
222
222
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution-context.mjs","names":["#environments","#plugins"],"sources":["../../src/context/execution-context.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { readJsonFile } from \"@stryke/fs/json\";\nimport { deepClone } from \"@stryke/helpers/deep-clone\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { PackageJson } from \"@stryke/types/package-json\";\nimport chalk from \"chalk\";\nimport {\n DEFAULT_ENVIRONMENT,\n GLOBAL_ENVIRONMENT\n} from \"../constants/environments\";\nimport {\n createDefaultEnvironment,\n createEnvironment\n} from \"../lib/environment\";\nimport { resolvePlugins } from \"../lib/plugins\";\nimport type {\n EnvironmentResolvedConfig,\n ExecutionContext,\n ExecutionOptions,\n InferOverridableConfig,\n Logger,\n LoggerOptions,\n Plugin,\n PluginConfig,\n PluginContext,\n ResolvedConfig\n} from \"../types\";\nimport { PowerlinesContext } from \"./context\";\nimport { PowerlinesEnvironmentContext } from \"./environment-context\";\n\nexport class PowerlinesExecutionContext<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TSystemContext = unknown\n>\n extends PowerlinesContext<TResolvedConfig, TSystemContext>\n implements ExecutionContext<TResolvedConfig, TSystemContext>\n{\n /**\n * A record of all environments by name\n */\n #environments: Record<\n string,\n PowerlinesEnvironmentContext<TResolvedConfig, TSystemContext>\n > = {};\n\n /**\n * The plugins added to this execution context, which may be used to track the plugins that have been added to the context and ensure that they are properly registered and executed during the build process. This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.\n */\n #plugins: Plugin<PluginContext<TResolvedConfig, TSystemContext>>[] = [];\n\n /**\n * Create a new Storm context from the workspace root and user config.\n *\n * @param options - The execution options to create the context with.\n * @param inlineConfig - The inline configuration for the context.\n * @returns A promise that resolves to the new context.\n */\n public static async from<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TSystemContext = unknown\n >(\n options: ExecutionOptions,\n inlineConfig?: TResolvedConfig[\"inlineConfig\"],\n system?: TSystemContext\n ): Promise<ExecutionContext<TResolvedConfig, TSystemContext>> {\n const context = new PowerlinesExecutionContext<\n TResolvedConfig,\n TSystemContext\n >(options);\n if (system) {\n context.system = system;\n }\n\n await context.init();\n\n if (inlineConfig) {\n await context.setInlineConfig(inlineConfig);\n }\n\n return context;\n }\n\n /**\n * 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.\n */\n public get id(): string {\n return this.options.executionId;\n }\n\n /**\n * A record of all environments by name\n */\n public get environments(): Record<\n string,\n PowerlinesEnvironmentContext<TResolvedConfig, TSystemContext>\n > {\n return this.#environments;\n }\n\n public get plugins(): Array<\n Plugin<PluginContext<TResolvedConfig, TSystemContext>>\n > {\n return this.#plugins;\n }\n\n /**\n * Creates a new instance.\n *\n * @param options - The options to use for creating the context, including the resolved configuration and workspace settings.\n */\n protected constructor(options: ExecutionOptions) {\n super(options);\n }\n\n /**\n * A setter function to populate the inline config values provided during execution of the command, such as CLI flags or other parameters that may be relevant to the command being executed. This function can be used to update the context with the inline configuration values, which may be used during the configuration resolution process to ensure that the final configuration reflects both the user configuration and any inline configuration provided during execution.\n *\n * @param config - The inline configuration values to set.\n * @returns A promise that resolves when the inline configuration values have been set.\n */\n public override async setInlineConfig(\n config: TResolvedConfig[\"inlineConfig\"]\n ): Promise<void> {\n await super.setInlineConfig(config);\n if (this.inlineConfig.command === \"new\") {\n const workspacePackageJsonPath = joinPaths(this.cwd, \"package.json\");\n if (!existsSync(workspacePackageJsonPath)) {\n throw new Error(\n `The workspace package.json file could not be found at ${workspacePackageJsonPath}`\n );\n }\n\n this.packageJson = await readJsonFile<PackageJson>(\n workspacePackageJsonPath\n );\n }\n }\n\n /**\n * Create a new logger instance\n *\n * @param options - The configuration options to use for the logger instance, which can be used to customize the appearance and behavior of the log messages generated by the logger. This is typically the name of the plugin or module that is creating the logger instance.\n * @returns A logger client instance that can be used to generate log messages with consistent formatting and metadata.\n */\n public override createLogger(options: LoggerOptions): Logger {\n return super.createLogger({\n ...options,\n executionId: this.id,\n configIndex: this.options.configIndex\n });\n }\n\n /**\n * Extend the base logger with additional configuration options\n *\n * @param options - The configuration options to extend the base logger with, which can be used to add additional metadata or customize the appearance of log messages generated by the logger. This is typically the name of the plugin or module that is creating the logger instance, as well as any additional metadata such as the plugin category or environment.\n * @returns A new logger client instance that extends the base logger with the provided configuration options.\n */\n public override extendLogger(options: LoggerOptions): Logger {\n return super.extendLogger({\n ...options,\n executionId: this.id,\n configIndex: this.options.configIndex\n });\n }\n\n /**\n * A function to copy the context and update the fields for a specific environment\n *\n * @param environment - The environment configuration to use.\n * @returns A new context instance with the updated environment.\n */\n public async createEnvironment(\n environment: EnvironmentResolvedConfig<TResolvedConfig>[\"environment\"]\n ): Promise<PowerlinesEnvironmentContext<TResolvedConfig, TSystemContext>> {\n const context = await PowerlinesEnvironmentContext.from<\n TResolvedConfig,\n TSystemContext\n >(\n this,\n deepClone(this.options),\n deepClone(this.config) as TResolvedConfig,\n deepClone(this.overriddenConfig) as InferOverridableConfig<\n EnvironmentResolvedConfig<TResolvedConfig>\n >\n );\n\n context.tsconfig = this.tsconfig;\n context.system = this.system;\n\n context.dependencies = deepClone<typeof this.dependencies>(\n this.dependencies\n );\n context.devDependencies = deepClone<typeof this.devDependencies>(\n this.devDependencies\n );\n context.persistedMeta = deepClone<typeof this.persistedMeta>(\n this.persistedMeta\n );\n context.resolvePatterns = deepClone<typeof this.resolvePatterns>(\n this.resolvePatterns\n );\n\n context.powerlinesPath ??= this.powerlinesPath;\n context.resolver ??= this.resolver;\n\n await context.setEnvironmentConfig(\n deepClone(\n environment\n ) as EnvironmentResolvedConfig<TResolvedConfig>[\"environment\"]\n );\n\n context.plugins = [];\n for (const plugin of this.plugins) {\n await context.unstable_addPlugin(plugin);\n }\n\n for (const [key, value] of Object.entries(this)) {\n if (\n ![\n \"fs\",\n \"system\",\n \"options\",\n \"config\",\n \"inlineConfig\",\n \"userConfig\",\n \"pluginConfig\",\n \"overriddenConfig\",\n \"environmentConfig\",\n \"dependencies\",\n \"devDependencies\",\n \"persistedMeta\",\n \"packageJson\",\n \"projectJson\",\n \"tsconfig\",\n \"resolver\",\n \"plugins\",\n \"environments\"\n ].includes(key)\n ) {\n if (isObject(value) || Array.isArray(value)) {\n (context as any)[key] = deepClone(value);\n } else {\n (context as any)[key] = value;\n }\n }\n }\n\n return context;\n }\n\n /**\n * Update the context using a new inline configuration options\n */\n public override async resolveConfig() {\n await super.resolveConfig();\n\n await Promise.all(\n toArray(\n this.config.environments &&\n Object.keys(this.config.environments).length > 0\n ? Object.keys(this.config.environments).map(name =>\n createEnvironment(name, this.config)\n )\n : createDefaultEnvironment(this.config)\n ).map(async env => {\n this.#environments[env.name] = await this.createEnvironment(env);\n })\n );\n }\n\n /**\n * Get an environment by name, or the default environment if no name is provided\n *\n * @param name - The name of the environment to retrieve.\n * @returns The requested environment context.\n */\n public async getEnvironment(name?: string) {\n let environment:\n | PowerlinesEnvironmentContext<TResolvedConfig, TSystemContext>\n | undefined;\n if (name) {\n environment = this.environments[name];\n }\n\n if (Object.keys(this.environments).length === 1) {\n environment = this.environments[Object.keys(this.environments)[0]!];\n\n this.trace({\n meta: { category: \"plugins\" },\n message: `Applying the only configured environment: ${chalk.bold.cyanBright(\n environment?.config.environment?.name\n )}`\n });\n }\n\n if (!environment) {\n if (name) {\n throw new Error(`Environment \"${name}\" not found.`);\n }\n\n environment = await this.createEnvironment(\n createDefaultEnvironment(this.config)\n );\n\n this.warn({\n meta: { category: \"plugins\" },\n message: `No environment specified, and no default environment found. Using a temporary default environment: ${chalk.bold.cyanBright(\n environment.config.environment?.name\n )}`\n });\n }\n\n return environment;\n }\n\n /**\n * A safe version of `getEnvironment` that returns `undefined` if the environment is not found\n *\n * @param name - The name of the environment to retrieve.\n * @returns The requested environment context or `undefined` if not found.\n */\n public async getEnvironmentSafe(\n name?: string\n ): Promise<\n PowerlinesEnvironmentContext<TResolvedConfig, TSystemContext> | undefined\n > {\n try {\n return await this.getEnvironment(name);\n } catch {\n return undefined;\n }\n }\n\n /**\n * A function to merge all configured environments into a single context.\n *\n * @remarks\n * If only one environment is configured, that environment will be returned directly.\n *\n * @returns A promise that resolves to a merged/global environment context.\n */\n public async toEnvironment(): Promise<\n PowerlinesEnvironmentContext<TResolvedConfig, TSystemContext>\n > {\n let environment: PowerlinesEnvironmentContext<\n TResolvedConfig,\n TSystemContext\n >;\n if (Object.keys(this.environments).length > 1) {\n environment = await this.createEnvironment(\n createEnvironment<TResolvedConfig>(GLOBAL_ENVIRONMENT, this.config)\n );\n\n this.debug({\n meta: { category: \"plugins\" },\n message: `Combined all ${Object.keys(this.environments).length} environments into a single global context.`\n });\n } else {\n environment = await this.getEnvironment();\n }\n\n return environment;\n }\n\n /**\n * A function used internally to add a plugin to the context and update the configuration options\n *\n * @danger\n * This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.\n *\n * @internal\n */\n public async unstable_addPlugin(\n plugin: PluginConfig<PluginContext<TResolvedConfig, TSystemContext>>\n ) {\n this.plugins.push(\n ...(await resolvePlugins<TResolvedConfig, TSystemContext>(this, plugin, {\n skipLogging:\n Object.keys(this.environments).filter(\n key => key !== DEFAULT_ENVIRONMENT && key !== GLOBAL_ENVIRONMENT\n ).length > 0\n }))\n );\n\n await Promise.all(\n Object.keys(this.environments).map(async name => {\n await this.environments[name]!.unstable_addPlugin(plugin);\n })\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAkDA,IAAa,6BAAb,MAAa,mCAIH,kBAEV;;;;CAIE,gBAGI,CAAC;;;;CAKL,WAAqE,CAAC;;;;;;;;CAStE,aAAoB,KAIlB,SACA,cACA,QAC4D;EAC5D,MAAM,UAAU,IAAI,2BAGlB,OAAO;EACT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M,KAAK,kBACvB,yBAAyB,KAAK,MAAM,CACtC;GAEA,KAAK,KAAK;IACR,MAAM,EAAE,UAAU,UAAU;IAC5B,SAAS,sGAAsG,MAAM,KAAK,WACxH,YAAY,OAAO,aAAa,IAClC;GACF,CAAC;EACH;EAEA,OAAO;CACT;;;;;;;CAQA,MAAa,mBACX,MAGA;EACA,IAAI;GACF,OAAO,MAAM,KAAK,eAAe,IAAI;EACvC,QAAQ;GACN;EACF;CACF;;;;;;;;;CAUA,MAAa,gBAEX;EACA,IAAI;EAIJ,IAAI,OAAO,KAAK,KAAK,YAAY,EAAE,SAAS,GAAG;GAC7C,cAAc,MAAM,KAAK,kBACvB,kBAAmC,oBAAoB,KAAK,MAAM,CACpE;GAEA,KAAK,MAAM;IACT,MAAM,EAAE,UAAU,UAAU;IAC5B,SAAS,gBAAgB,OAAO,KAAK,KAAK,YAAY,EAAE,OAAO;GACjE,CAAC;EACH,OACE,cAAc,MAAM,KAAK,eAAe;EAG1C,OAAO;CACT;;;;;;;;;CAUA,MAAa,mBACX,QACA;EACA,KAAK,QAAQ,KACX,GAAI,MAAM,eAAgD,MAAM,QAAQ,EACtE,aACE,OAAO,KAAK,KAAK,YAAY,EAAE,QAC7B,QAAO,qBAA+B,oBACxC,EAAE,SAAS,EACf,CAAC,CACH;EAEA,MAAM,QAAQ,IACZ,OAAO,KAAK,KAAK,YAAY,EAAE,IAAI,OAAM,SAAQ;GAC/C,MAAM,KAAK,aAAa,MAAO,mBAAmB,MAAM;EAC1D,CAAC,CACH;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"execution-context.mjs","names":["#environments","#plugins"],"sources":["../../src/context/execution-context.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { readJsonFile } from \"@stryke/fs/json\";\nimport { deepClone } from \"@stryke/helpers/deep-clone\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { PackageJson } from \"@stryke/types/package-json\";\nimport chalk from \"chalk\";\nimport {\n DEFAULT_ENVIRONMENT,\n GLOBAL_ENVIRONMENT\n} from \"../constants/environments\";\nimport {\n createDefaultEnvironment,\n createEnvironment\n} from \"../lib/environment\";\nimport { resolvePlugins } from \"../lib/plugins\";\nimport type {\n EnvironmentResolvedConfig,\n ExecutionContext,\n ExecutionOptions,\n InferOverridableConfig,\n Logger,\n LoggerOptions,\n Plugin,\n PluginConfig,\n PluginContext,\n ResolvedConfig\n} from \"../types\";\nimport { PowerlinesContext } from \"./context\";\nimport { PowerlinesEnvironmentContext } from \"./environment-context\";\n\nexport class PowerlinesExecutionContext<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TSystemContext = unknown\n>\n extends PowerlinesContext<TResolvedConfig, TSystemContext>\n implements ExecutionContext<TResolvedConfig, TSystemContext>\n{\n /**\n * A record of all environments by name\n */\n #environments: Record<\n string,\n PowerlinesEnvironmentContext<TResolvedConfig, TSystemContext>\n > = {};\n\n /**\n * The plugins added to this execution context, which may be used to track the plugins that have been added to the context and ensure that they are properly registered and executed during the build process. This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.\n */\n #plugins: Plugin<PluginContext<TResolvedConfig, TSystemContext>>[] = [];\n\n /**\n * Create a new Storm context from the workspace root and user config.\n *\n * @param options - The execution options to create the context with.\n * @param inlineConfig - The inline configuration for the context.\n * @returns A promise that resolves to the new context.\n */\n public static async from<\n TResolvedConfig extends ResolvedConfig = ResolvedConfig,\n TSystemContext = unknown\n >(\n options: ExecutionOptions,\n inlineConfig?: TResolvedConfig[\"inlineConfig\"],\n system?: TSystemContext\n ): Promise<ExecutionContext<TResolvedConfig, TSystemContext>> {\n const context = new PowerlinesExecutionContext<\n TResolvedConfig,\n TSystemContext\n >(options);\n if (system) {\n context.system = system;\n }\n\n await context.init();\n\n if (inlineConfig) {\n await context.setInlineConfig(inlineConfig);\n }\n\n return context;\n }\n\n /**\n * 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.\n */\n public get id(): string {\n return this.options.executionId;\n }\n\n /**\n * A record of all environments by name\n */\n public get environments(): Record<\n string,\n PowerlinesEnvironmentContext<TResolvedConfig, TSystemContext>\n > {\n return this.#environments;\n }\n\n public get plugins(): Array<\n Plugin<PluginContext<TResolvedConfig, TSystemContext>>\n > {\n return this.#plugins;\n }\n\n /**\n * Creates a new instance.\n *\n * @param options - The options to use for creating the context, including the resolved configuration and workspace settings.\n */\n protected constructor(options: ExecutionOptions) {\n super(options);\n }\n\n /**\n * A setter function to populate the inline config values provided during execution of the command, such as CLI flags or other parameters that may be relevant to the command being executed. This function can be used to update the context with the inline configuration values, which may be used during the configuration resolution process to ensure that the final configuration reflects both the user configuration and any inline configuration provided during execution.\n *\n * @param config - The inline configuration values to set.\n * @returns A promise that resolves when the inline configuration values have been set.\n */\n public override async setInlineConfig(\n config: TResolvedConfig[\"inlineConfig\"]\n ): Promise<void> {\n await super.setInlineConfig(config);\n if (this.inlineConfig.command === \"new\") {\n const workspacePackageJsonPath = joinPaths(this.cwd, \"package.json\");\n if (!existsSync(workspacePackageJsonPath)) {\n throw new Error(\n `The workspace package.json file could not be found at ${workspacePackageJsonPath}`\n );\n }\n\n this.packageJson = await readJsonFile<PackageJson>(\n workspacePackageJsonPath\n );\n }\n }\n\n /**\n * Create a new logger instance\n *\n * @param options - The configuration options to use for the logger instance, which can be used to customize the appearance and behavior of the log messages generated by the logger. This is typically the name of the plugin or module that is creating the logger instance.\n * @returns A logger client instance that can be used to generate log messages with consistent formatting and metadata.\n */\n public override createLogger(options: LoggerOptions): Logger {\n return super.createLogger({\n ...options,\n executionId: this.id,\n configIndex: this.options.configIndex\n });\n }\n\n /**\n * Extend the base logger with additional configuration options\n *\n * @param options - The configuration options to extend the base logger with, which can be used to add additional metadata or customize the appearance of log messages generated by the logger. This is typically the name of the plugin or module that is creating the logger instance, as well as any additional metadata such as the plugin category or environment.\n * @returns A new logger client instance that extends the base logger with the provided configuration options.\n */\n public override extendLogger(options: LoggerOptions): Logger {\n return super.extendLogger({\n ...options,\n executionId: this.id,\n configIndex: this.options.configIndex\n });\n }\n\n /**\n * A function to copy the context and update the fields for a specific environment\n *\n * @param environment - The environment configuration to use.\n * @returns A new context instance with the updated environment.\n */\n public async createEnvironment(\n environment: EnvironmentResolvedConfig<TResolvedConfig>[\"environment\"]\n ): Promise<PowerlinesEnvironmentContext<TResolvedConfig, TSystemContext>> {\n const context = await PowerlinesEnvironmentContext.from<\n TResolvedConfig,\n TSystemContext\n >(\n this,\n deepClone(this.options),\n deepClone(this.config) as TResolvedConfig,\n deepClone(this.overriddenConfig) as InferOverridableConfig<\n EnvironmentResolvedConfig<TResolvedConfig>\n >\n );\n\n context.tsconfig = this.tsconfig;\n context.system = this.system;\n\n context.dependencies = deepClone<typeof this.dependencies>(\n this.dependencies\n );\n context.devDependencies = deepClone<typeof this.devDependencies>(\n this.devDependencies\n );\n context.persistedMeta = deepClone<typeof this.persistedMeta>(\n this.persistedMeta\n );\n context.resolvePatterns = deepClone<typeof this.resolvePatterns>(\n this.resolvePatterns\n );\n\n context.powerlinesPath ??= this.powerlinesPath;\n context.resolver ??= this.resolver;\n\n await context.setEnvironmentConfig(\n deepClone(\n environment\n ) as EnvironmentResolvedConfig<TResolvedConfig>[\"environment\"]\n );\n\n context.plugins = [];\n for (const plugin of this.plugins) {\n await context.unstable_addPlugin(plugin);\n }\n\n for (const [key, value] of Object.entries(this)) {\n if (\n ![\n \"fs\",\n \"system\",\n \"options\",\n \"config\",\n \"inlineConfig\",\n \"userConfig\",\n \"pluginConfig\",\n \"overriddenConfig\",\n \"environmentConfig\",\n \"dependencies\",\n \"devDependencies\",\n \"persistedMeta\",\n \"packageJson\",\n \"projectJson\",\n \"tsconfig\",\n \"resolver\",\n \"plugins\",\n \"environments\"\n ].includes(key)\n ) {\n if (isObject(value) || Array.isArray(value)) {\n (context as any)[key] = deepClone(value);\n } else {\n (context as any)[key] = value;\n }\n }\n }\n\n return context;\n }\n\n /**\n * Update the context using a new inline configuration options\n */\n public override async resolveConfig() {\n await super.resolveConfig();\n\n await Promise.all(\n toArray(\n this.config.environments &&\n Object.keys(this.config.environments).length > 0\n ? Object.keys(this.config.environments).map(name =>\n createEnvironment(name, this.config)\n )\n : createDefaultEnvironment(this.config)\n ).map(async env => {\n this.#environments[env.name] = await this.createEnvironment(env);\n })\n );\n }\n\n /**\n * Get an environment by name, or the default environment if no name is provided\n *\n * @param name - The name of the environment to retrieve.\n * @returns The requested environment context.\n */\n public async getEnvironment(name?: string) {\n let environment:\n | PowerlinesEnvironmentContext<TResolvedConfig, TSystemContext>\n | undefined;\n if (name) {\n environment = this.environments[name];\n }\n\n if (Object.keys(this.environments).length === 1) {\n environment = this.environments[Object.keys(this.environments)[0]!];\n\n this.trace({\n meta: { category: \"plugins\" },\n message: `Applying the only configured environment: ${chalk.bold.cyanBright(\n environment?.config.environment?.name\n )}`\n });\n }\n\n if (!environment) {\n if (name) {\n throw new Error(`Environment \"${name}\" not found.`);\n }\n\n environment = await this.createEnvironment(\n createDefaultEnvironment(this.config)\n );\n\n this.warn({\n meta: { category: \"plugins\" },\n message: `No environment specified, and no default environment found. Using a temporary default environment: ${chalk.bold.cyanBright(\n environment.config.environment?.name\n )}`\n });\n }\n\n return environment;\n }\n\n /**\n * A safe version of `getEnvironment` that returns `undefined` if the environment is not found\n *\n * @param name - The name of the environment to retrieve.\n * @returns The requested environment context or `undefined` if not found.\n */\n public async getEnvironmentSafe(\n name?: string\n ): Promise<\n PowerlinesEnvironmentContext<TResolvedConfig, TSystemContext> | undefined\n > {\n try {\n return await this.getEnvironment(name);\n } catch {\n return undefined;\n }\n }\n\n /**\n * A function to merge all configured environments into a single context.\n *\n * @remarks\n * If only one environment is configured, that environment will be returned directly.\n *\n * @returns A promise that resolves to a merged/global environment context.\n */\n public async toEnvironment(): Promise<\n PowerlinesEnvironmentContext<TResolvedConfig, TSystemContext>\n > {\n let environment: PowerlinesEnvironmentContext<\n TResolvedConfig,\n TSystemContext\n >;\n if (Object.keys(this.environments).length > 1) {\n environment = await this.createEnvironment(\n createEnvironment<TResolvedConfig>(GLOBAL_ENVIRONMENT, this.config)\n );\n\n this.debug({\n meta: { category: \"plugins\" },\n message: `Combined all ${Object.keys(this.environments).length} environments into a single global context.`\n });\n } else {\n environment = await this.getEnvironment();\n }\n\n return environment;\n }\n\n /**\n * A function used internally to add a plugin to the context and update the configuration options\n *\n * @danger\n * This field is for internal use only and should not be accessed or modified directly. It is unstable and can be changed at anytime.\n *\n * @internal\n */\n public async unstable_addPlugin(\n plugin: PluginConfig<PluginContext<TResolvedConfig, TSystemContext>>\n ) {\n this.plugins.push(\n ...(await resolvePlugins<TResolvedConfig, TSystemContext>(this, plugin, {\n skipLogging:\n Object.keys(this.environments).filter(\n key =>\n key && key !== DEFAULT_ENVIRONMENT && key !== GLOBAL_ENVIRONMENT\n ).length > 0\n }))\n );\n\n await Promise.all(\n Object.keys(this.environments).map(async name => {\n await this.environments[name]!.unstable_addPlugin(plugin);\n })\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAkDA,IAAa,6BAAb,MAAa,mCAIH,kBAEV;;;;CAIE,gBAGI,CAAC;;;;CAKL,WAAqE,CAAC;;;;;;;;CAStE,aAAoB,KAIlB,SACA,cACA,QAC4D;EAC5D,MAAM,UAAU,IAAI,2BAGlB,OAAO;EACT,IAAI,QACF,QAAQ,SAAS;EAGnB,MAAM,QAAQ,KAAK;EAEnB,IAA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R,MAAM,EAAE,UAAU,UAAU;IAC5B,SAAS,sGAAsG,MAAM,KAAK,WACxH,YAAY,OAAO,aAAa,IAClC;GACF,CAAC;EACH;EAEA,OAAO;CACT;;;;;;;CAQA,MAAa,mBACX,MAGA;EACA,IAAI;GACF,OAAO,MAAM,KAAK,eAAe,IAAI;EACvC,QAAQ;GACN;EACF;CACF;;;;;;;;;CAUA,MAAa,gBAEX;EACA,IAAI;EAIJ,IAAI,OAAO,KAAK,KAAK,YAAY,EAAE,SAAS,GAAG;GAC7C,cAAc,MAAM,KAAK,kBACvB,kBAAmC,oBAAoB,KAAK,MAAM,CACpE;GAEA,KAAK,MAAM;IACT,MAAM,EAAE,UAAU,UAAU;IAC5B,SAAS,gBAAgB,OAAO,KAAK,KAAK,YAAY,EAAE,OAAO;GACjE,CAAC;EACH,OACE,cAAc,MAAM,KAAK,eAAe;EAG1C,OAAO;CACT;;;;;;;;;CAUA,MAAa,mBACX,QACA;EACA,KAAK,QAAQ,KACX,GAAI,MAAM,eAAgD,MAAM,QAAQ,EACtE,aACE,OAAO,KAAK,KAAK,YAAY,EAAE,QAC7B,QACE,OAAO,qBAA+B,oBAC1C,EAAE,SAAS,EACf,CAAC,CACH;EAEA,MAAM,QAAQ,IACZ,OAAO,KAAK,KAAK,YAAY,EAAE,IAAI,OAAM,SAAQ;GAC/C,MAAM,KAAK,aAAa,MAAO,mBAAmB,MAAM;EAC1D,CAAC,CACH;CACF;AACF"}
|
package/dist/index.d.cts
CHANGED
|
@@ -6,7 +6,7 @@ import { CallHookOptions, HookListOrders, HooksList, HooksListItem, InferHookFun
|
|
|
6
6
|
import { CustomLogger, CustomLoggerMessage, LogCategory, LogFn, LogFnMeta, LogFnOptions, LogLevel, LogLevelResolvedConfig, LogLevelUserConfig, LogMessage, LogMeta, Logger, LoggerMessage, LoggerMeta, LoggerOptions, PowerlinesMessage } from "./types/logging.cjs";
|
|
7
7
|
import { DeepkitOptions, Level, ParsedTypeScriptConfig, RawReflectionMode, ReflectionMode, TSCompilerOptions, TSConfig } from "./types/tsconfig.cjs";
|
|
8
8
|
import { BaseContext, BuildPluginContext, Context, EmitEntryOptions, EmitOptions, EnvironmentContext, EnvironmentPlugin, ExecutionContext, FetchOptions, InitContextOptions, MetaInfo, ParseOptions, PluginContext, ResolveResult, Resolver, SelectHookResult, SelectHookResultItem, SelectHooksOptions, SourceFile, TransformResult, UnimportContext, UnresolvedContext, WithUnpluginBuildContext } from "./types/context.cjs";
|
|
9
|
-
import {
|
|
9
|
+
import { BaseExecutionOptions, BuildInlineConfig, CleanInlineConfig, Config, ConfigParams, CopyConfig, CreateInlineConfig, DeployInlineConfig, DocsInlineConfig, EnvironmentConfig, EnvironmentResolvedConfig, ExecutionOptions, FrameworkOptions, InferOverridableConfig, InlineConfig, InlineConfigPaths, LintInlineConfig, Mode, Options, OutputConfig, ParsedUserConfig, PartialPlugin, PartialPluginFactory, PluginConfig, PluginConfigObject, PluginConfigTuple, PluginFactory, PrepareInlineConfig, ProjectType, ResolveConfig, ResolvedAssetGlob, ResolvedConfig, ResolvedCopyConfig, ResolvedEntryTypeDefinition, ResolvedEnvironmentConfig, ResolvedOutputConfig, ResolvedResolveConfig, TestInlineConfig, TypesInlineConfig, UserConfig, UserConfigExport, UserConfigFn, UserConfigFnObject, UserConfigFnPromise, UserInputConfig, WorkspaceConfig } from "./types/config.cjs";
|
|
10
10
|
import { PartiallyResolvedContext, ResolvePackageConfigsResult, defineConfig, getDefaultLogLevel, getDefaultMode, loadParsedConfig, loadUserConfigFile, loadWorkspaceConfig, normalizeBasePath, resolvePackageConfigs, resolveRoot, tryResolveWorkspaceConfig } from "./lib/config.cjs";
|
|
11
11
|
import { getConfigProps, resolvePluginConfig } from "./lib/context-helpers.cjs";
|
|
12
12
|
import { getUniqueInputs, isResolvedEntryTypeDefinition, isTypeDefinition, resolveEntryOutput, resolveInput, resolveInputs, resolveInputsSync } from "./lib/entry.cjs";
|
|
@@ -30,4 +30,4 @@ import { getMagicString, getSourceFile, getString } from "./lib/utilities/source
|
|
|
30
30
|
import { generateSourceMap } from "./lib/utilities/source-map.cjs";
|
|
31
31
|
import { writeFile } from "./lib/utilities/write-file.cjs";
|
|
32
32
|
import { VirtualFileSystem } from "./lib/vfs.cjs";
|
|
33
|
-
export {
|
|
33
|
+
export { BaseCommandType, BaseContext, BaseExecutionAPIMethods, BaseExecutionOptions, BasePlugin, BufferedChunk, BuildInlineConfig, BuildPluginContext, BuilderVariant, CallHookOptions, CleanInlineConfig, CommandType, Commands, Config, ConfigParams, Context, CopyConfig, CreateContextOptions, CreateInlineConfig, CreateResolverOptions, CreateStreamReaderOptions, CreateStreamSinkOptions, CreateUnpluginModuleResolutionFunctionsOptions, CreateUnpluginOptions, CreateUnpluginResolverOptions, CustomLogger, CustomLoggerMessage, DeepkitOptions, DeployInlineConfig, DocsInlineConfig, EmitEntryOptions, EmitOptions, EnvironmentConfig, EnvironmentContext, EnvironmentPlugin, EnvironmentResolvedConfig, ExecutionContext, ExecutionOptions, FetchOptions, FileHeaderOptions, FileId, FileMetadata, FileMetadata_KeyValuePair, FileStorage, FileSystem, FrameworkOptions, HookFunctions, HookListOrders, Hooks, HooksList, HooksListItem, InferHookFunction, InferHookParameters, InferHookReturnType, InferHookThisType, InferOverridableConfig, InitContextOptions, InlineConfig, InlineConfigPaths, Level, LintInlineConfig, LogCategory, LogFn, LogFnMeta, LogFnOptions, LogLevel, LogLevelResolvedConfig, LogLevelUserConfig, LogMessage, LogMeta, Logger, LoggerMessage, LoggerMeta, LoggerOptions, MetaInfo, Mode, NormalizedStringFilter, Options, OutputConfig, ParseOptions, ParsedTypeScriptConfig, ParsedUserConfig, PartialPlugin, PartialPluginFactory, PartiallyResolvedContext, Plugin, PluginConfig, PluginConfigObject, PluginConfigTuple, PluginContext, PluginFactory, PluginFilter, PluginHook, PluginHookFields, PluginHookObject, PluginHooks, PluginNonHookFields, PowerlinesExecutionAPIMethods, PowerlinesMessage, PrepareInlineConfig, ProjectType, RawReflectionMode, ReflectionMode, ResolveConfig, ResolveOptions, ResolvePackageConfigsResult, ResolvePluginsOptions, ResolveResult, ResolvedAssetGlob, ResolvedConfig, ResolvedCopyConfig, ResolvedEntryTypeDefinition, ResolvedEnvironmentConfig, ResolvedOutputConfig, ResolvedResolveConfig, Resolver, SelectHookResult, SelectHookResultItem, SelectHooksOptions, SourceFile, StorageAdapter, StoragePort, StoragePreset, StreamErrorPayload, StreamReader, StreamSink, StreamSinkEvents, SupportedCommands, TSCompilerOptions, TSConfig, TestInlineConfig, TransformHookFilter, TransformResult, TypegenContext, TypesInlineConfig, TypesResult, UnimportContext, UnpluginBuilderVariant, UnpluginHookFunctions, UnpluginOptions, UnresolvedContext, UserConfig, UserConfigExport, UserConfigFn, UserConfigFnObject, UserConfigFnPromise, UserInputConfig, VirtualFile, VirtualFileData, VirtualFileExtension, VirtualFileMetadata, VirtualFileSystem, VirtualFileSystemHost, VirtualFileSystemInterface, WithUnpluginBuildContext, WorkspaceConfig, WriteData, WriteOptions, _capnpFileId, callHook, combineContexts, createEventEmitter, createProgram, createResolver, createStreamReader, createStreamSink, createUnplugin, createUnpluginModuleResolutionFunctions, createUnpluginResolver, defineConfig, emitBuiltinTypes, extractHooks, findIncludeMatch, findMatch, format, formatFolder, formatTypes, generateSourceMap, getConfigProps, getDefaultLogLevel, getDefaultMode, getFileHeader, getFileHeaderWarning, getFileHeaderWarningText, getMagicString, getParsedTypeScriptConfig, getPersistedMeta, getPrefixedRootHash, getSourceFile, getString, getTsconfigDtsPath, getTsconfigFilePath, getTypescriptFileHeader, getUniqueInputs, handleTypes, initPlugin, initializeTsconfig, installDependencies, isIncludeMatchFound, isMatchFound, isResolvedEntryTypeDefinition, isTypeDefinition, isUnpluginBuilderVariant, loadParsedConfig, loadUserConfigFile, loadWorkspaceConfig, mergeConfigs, mergeResults, normalizeBasePath, resolveEntryOutput, resolveInput, resolveInputs, resolveInputsSync, resolvePackageConfigs, resolvePlugin, resolvePluginConfig, resolvePlugins, resolveRoot, resolveTsconfig, tryResolveWorkspaceConfig, tryTsconfigFilePath, writeFile, writeMetaFile };
|
package/dist/index.d.mts
CHANGED
|
@@ -6,7 +6,7 @@ import { CallHookOptions, HookListOrders, HooksList, HooksListItem, InferHookFun
|
|
|
6
6
|
import { CustomLogger, CustomLoggerMessage, LogCategory, LogFn, LogFnMeta, LogFnOptions, LogLevel, LogLevelResolvedConfig, LogLevelUserConfig, LogMessage, LogMeta, Logger, LoggerMessage, LoggerMeta, LoggerOptions, PowerlinesMessage } from "./types/logging.mjs";
|
|
7
7
|
import { DeepkitOptions, Level, ParsedTypeScriptConfig, RawReflectionMode, ReflectionMode, TSCompilerOptions, TSConfig } from "./types/tsconfig.mjs";
|
|
8
8
|
import { BaseContext, BuildPluginContext, Context, EmitEntryOptions, EmitOptions, EnvironmentContext, EnvironmentPlugin, ExecutionContext, FetchOptions, InitContextOptions, MetaInfo, ParseOptions, PluginContext, ResolveResult, Resolver, SelectHookResult, SelectHookResultItem, SelectHooksOptions, SourceFile, TransformResult, UnimportContext, UnresolvedContext, WithUnpluginBuildContext } from "./types/context.mjs";
|
|
9
|
-
import {
|
|
9
|
+
import { BaseExecutionOptions, BuildInlineConfig, CleanInlineConfig, Config, ConfigParams, CopyConfig, CreateInlineConfig, DeployInlineConfig, DocsInlineConfig, EnvironmentConfig, EnvironmentResolvedConfig, ExecutionOptions, FrameworkOptions, InferOverridableConfig, InlineConfig, InlineConfigPaths, LintInlineConfig, Mode, Options, OutputConfig, ParsedUserConfig, PartialPlugin, PartialPluginFactory, PluginConfig, PluginConfigObject, PluginConfigTuple, PluginFactory, PrepareInlineConfig, ProjectType, ResolveConfig, ResolvedAssetGlob, ResolvedConfig, ResolvedCopyConfig, ResolvedEntryTypeDefinition, ResolvedEnvironmentConfig, ResolvedOutputConfig, ResolvedResolveConfig, TestInlineConfig, TypesInlineConfig, UserConfig, UserConfigExport, UserConfigFn, UserConfigFnObject, UserConfigFnPromise, UserInputConfig, WorkspaceConfig } from "./types/config.mjs";
|
|
10
10
|
import { PartiallyResolvedContext, ResolvePackageConfigsResult, defineConfig, getDefaultLogLevel, getDefaultMode, loadParsedConfig, loadUserConfigFile, loadWorkspaceConfig, normalizeBasePath, resolvePackageConfigs, resolveRoot, tryResolveWorkspaceConfig } from "./lib/config.mjs";
|
|
11
11
|
import { getConfigProps, resolvePluginConfig } from "./lib/context-helpers.mjs";
|
|
12
12
|
import { getUniqueInputs, isResolvedEntryTypeDefinition, isTypeDefinition, resolveEntryOutput, resolveInput, resolveInputs, resolveInputsSync } from "./lib/entry.mjs";
|
|
@@ -30,4 +30,4 @@ import { getMagicString, getSourceFile, getString } from "./lib/utilities/source
|
|
|
30
30
|
import { generateSourceMap } from "./lib/utilities/source-map.mjs";
|
|
31
31
|
import { writeFile } from "./lib/utilities/write-file.mjs";
|
|
32
32
|
import { VirtualFileSystem } from "./lib/vfs.mjs";
|
|
33
|
-
export {
|
|
33
|
+
export { BaseCommandType, BaseContext, BaseExecutionAPIMethods, BaseExecutionOptions, BasePlugin, BufferedChunk, BuildInlineConfig, BuildPluginContext, BuilderVariant, CallHookOptions, CleanInlineConfig, CommandType, Commands, Config, ConfigParams, Context, CopyConfig, CreateContextOptions, CreateInlineConfig, CreateResolverOptions, CreateStreamReaderOptions, CreateStreamSinkOptions, CreateUnpluginModuleResolutionFunctionsOptions, CreateUnpluginOptions, CreateUnpluginResolverOptions, CustomLogger, CustomLoggerMessage, DeepkitOptions, DeployInlineConfig, DocsInlineConfig, EmitEntryOptions, EmitOptions, EnvironmentConfig, EnvironmentContext, EnvironmentPlugin, EnvironmentResolvedConfig, ExecutionContext, ExecutionOptions, FetchOptions, FileHeaderOptions, FileId, FileMetadata, FileMetadata_KeyValuePair, FileStorage, FileSystem, FrameworkOptions, HookFunctions, HookListOrders, Hooks, HooksList, HooksListItem, InferHookFunction, InferHookParameters, InferHookReturnType, InferHookThisType, InferOverridableConfig, InitContextOptions, InlineConfig, InlineConfigPaths, Level, LintInlineConfig, LogCategory, LogFn, LogFnMeta, LogFnOptions, LogLevel, LogLevelResolvedConfig, LogLevelUserConfig, LogMessage, LogMeta, Logger, LoggerMessage, LoggerMeta, LoggerOptions, MetaInfo, Mode, NormalizedStringFilter, Options, OutputConfig, ParseOptions, ParsedTypeScriptConfig, ParsedUserConfig, PartialPlugin, PartialPluginFactory, PartiallyResolvedContext, Plugin, PluginConfig, PluginConfigObject, PluginConfigTuple, PluginContext, PluginFactory, PluginFilter, PluginHook, PluginHookFields, PluginHookObject, PluginHooks, PluginNonHookFields, PowerlinesExecutionAPIMethods, PowerlinesMessage, PrepareInlineConfig, ProjectType, RawReflectionMode, ReflectionMode, ResolveConfig, ResolveOptions, ResolvePackageConfigsResult, ResolvePluginsOptions, ResolveResult, ResolvedAssetGlob, ResolvedConfig, ResolvedCopyConfig, ResolvedEntryTypeDefinition, ResolvedEnvironmentConfig, ResolvedOutputConfig, ResolvedResolveConfig, Resolver, SelectHookResult, SelectHookResultItem, SelectHooksOptions, SourceFile, StorageAdapter, StoragePort, StoragePreset, StreamErrorPayload, StreamReader, StreamSink, StreamSinkEvents, SupportedCommands, TSCompilerOptions, TSConfig, TestInlineConfig, TransformHookFilter, TransformResult, TypegenContext, TypesInlineConfig, TypesResult, UnimportContext, UnpluginBuilderVariant, UnpluginHookFunctions, UnpluginOptions, UnresolvedContext, UserConfig, UserConfigExport, UserConfigFn, UserConfigFnObject, UserConfigFnPromise, UserInputConfig, VirtualFile, VirtualFileData, VirtualFileExtension, VirtualFileMetadata, VirtualFileSystem, VirtualFileSystemHost, VirtualFileSystemInterface, WithUnpluginBuildContext, WorkspaceConfig, WriteData, WriteOptions, _capnpFileId, callHook, combineContexts, createEventEmitter, createProgram, createResolver, createStreamReader, createStreamSink, createUnplugin, createUnpluginModuleResolutionFunctions, createUnpluginResolver, defineConfig, emitBuiltinTypes, extractHooks, findIncludeMatch, findMatch, format, formatFolder, formatTypes, generateSourceMap, getConfigProps, getDefaultLogLevel, getDefaultMode, getFileHeader, getFileHeaderWarning, getFileHeaderWarningText, getMagicString, getParsedTypeScriptConfig, getPersistedMeta, getPrefixedRootHash, getSourceFile, getString, getTsconfigDtsPath, getTsconfigFilePath, getTypescriptFileHeader, getUniqueInputs, handleTypes, initPlugin, initializeTsconfig, installDependencies, isIncludeMatchFound, isMatchFound, isResolvedEntryTypeDefinition, isTypeDefinition, isUnpluginBuilderVariant, loadParsedConfig, loadUserConfigFile, loadWorkspaceConfig, mergeConfigs, mergeResults, normalizeBasePath, resolveEntryOutput, resolveInput, resolveInputs, resolveInputsSync, resolvePackageConfigs, resolvePlugin, resolvePluginConfig, resolvePlugins, resolveRoot, resolveTsconfig, tryResolveWorkspaceConfig, tryTsconfigFilePath, writeFile, writeMetaFile };
|
package/dist/lib/config.cjs
CHANGED
|
@@ -209,12 +209,6 @@ async function loadUserConfigFile(cwd, root, mode, command, framework, configFil
|
|
|
209
209
|
...result
|
|
210
210
|
} : {});
|
|
211
211
|
}
|
|
212
|
-
/**
|
|
213
|
-
* A type helper to make it easier to use `powerlines.config.ts` files.
|
|
214
|
-
*
|
|
215
|
-
* @remarks
|
|
216
|
-
* The function accepts a direct {@link AnyUserConfig} object/function and returns it typed as a {@link UserConfig} object.
|
|
217
|
-
*/
|
|
218
212
|
function defineConfig(config) {
|
|
219
213
|
return config;
|
|
220
214
|
}
|
package/dist/lib/config.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LogLevelResolvedConfig } from "../types/logging.cjs";
|
|
2
2
|
import { Context } from "../types/context.cjs";
|
|
3
|
-
import {
|
|
3
|
+
import { FrameworkOptions, InlineConfig, Mode, ParsedUserConfig, UserConfigExport, UserConfigFn, UserConfigFnObject, UserConfigFnPromise, UserInputConfig, WorkspaceConfig } from "../types/config.cjs";
|
|
4
4
|
import { PartialKeys } from "@stryke/types/base";
|
|
5
5
|
import { PackageJson } from "@stryke/types/package-json";
|
|
6
6
|
|
|
@@ -108,12 +108,33 @@ declare function loadWorkspaceConfig(cwd: string, root: string): Promise<Workspa
|
|
|
108
108
|
*/
|
|
109
109
|
declare function loadUserConfigFile(cwd: string, root: string, mode: Mode, command: string, framework?: PartialKeys<FrameworkOptions, "orgId">, configFile?: string): Promise<ParsedUserConfig>;
|
|
110
110
|
/**
|
|
111
|
-
*
|
|
111
|
+
* Type helper to make it easier to use `powerlines.config.ts` files. Accepts a direct {@link UserConfig} object, or a function that returns it. The function receives a {@link ConfigParams} object.
|
|
112
112
|
*
|
|
113
|
-
* @
|
|
114
|
-
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```ts
|
|
115
|
+
* import { defineConfig } from 'powerlines';
|
|
116
|
+
*
|
|
117
|
+
* export default defineConfig({
|
|
118
|
+
* // Your configuration here
|
|
119
|
+
* });
|
|
120
|
+
*
|
|
121
|
+
* // Or with a function
|
|
122
|
+
* export default defineConfig((env) => {
|
|
123
|
+
* console.log(`Running command: ${env.command} in mode: ${env.mode}`);
|
|
124
|
+
* return {
|
|
125
|
+
* // Your configuration here
|
|
126
|
+
* };
|
|
127
|
+
* });
|
|
128
|
+
* ```
|
|
115
129
|
*/
|
|
116
|
-
declare function defineConfig(config:
|
|
130
|
+
declare function defineConfig(config: UserInputConfig): UserInputConfig;
|
|
131
|
+
declare function defineConfig(config: UserInputConfig[]): UserInputConfig[];
|
|
132
|
+
declare function defineConfig(config: Promise<UserInputConfig>): Promise<UserInputConfig>;
|
|
133
|
+
declare function defineConfig(config: Promise<UserInputConfig[]>): Promise<UserInputConfig[]>;
|
|
134
|
+
declare function defineConfig(config: UserConfigFnObject): UserConfigFnObject;
|
|
135
|
+
declare function defineConfig(config: UserConfigFnPromise): UserConfigFnPromise;
|
|
136
|
+
declare function defineConfig(config: UserConfigFn): UserConfigFn;
|
|
137
|
+
declare function defineConfig(config: UserConfigExport): UserConfigExport;
|
|
117
138
|
//#endregion
|
|
118
139
|
export { PartiallyResolvedContext, ResolvePackageConfigsResult, defineConfig, getDefaultLogLevel, getDefaultMode, loadParsedConfig, loadUserConfigFile, loadWorkspaceConfig, normalizeBasePath, resolvePackageConfigs, resolveRoot, tryResolveWorkspaceConfig };
|
|
119
140
|
//# sourceMappingURL=config.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.cts","names":[],"sources":["../../src/lib/config.ts"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"config.d.cts","names":[],"sources":["../../src/lib/config.ts"],"mappings":";;;;;;;iBA4DgB,iBAAA,CAAkB,IAAkB;AAAA,UAMnC,2BAAA;EAND;;;EAUd,WAAA,GAAc,WAAA;EAVoC;AAMpD;;EASE,WAAA,GAAc,MAAM;AAAA;;;;;;AAAA;AAatB;;;;iBAAsB,qBAAA,CACpB,GAAA,UACA,IAAA,WACC,OAAO,CAAC,2BAAA;;;;;AAA2B;AA+BtC;;;iBAAgB,WAAA,CACd,GAAA,UACA,IAAA,WACA,UAAA;;;;;AAAmB;AAmCrB;;iBAAsB,yBAAA,CACpB,GAAA,UACA,IAAA,YACC,OAAO,CAAC,eAAA;;;;;;;AAAe;AAiB1B;;;iBAAsB,cAAA,CACpB,GAAA,UACA,IAAA,YACC,OAAO,CAAC,IAAA;;;;;;AAAI;AAsBf;;;;iBAAsB,kBAAA,CACpB,GAAA,UACA,IAAA,YACC,OAAO,CAAC,sBAAA;;;;;AAAsB;AAgCjC;;;;;;;;;iBAAsB,gBAAA,CACpB,GAAA,UACA,IAAA,UACA,SAAA,UACA,KAAA,UACA,YAAA,EAAc,YAAA,GAAY,OAAA,CAAA,gBAAA;AAAA,KAwBhB,wBAAA,kBAA0C,OAAA,GAAU,OAAA,IAAW,IAAA,CACzE,QAAA,sEAGA,OAAA,CAAQ,QAAA;EACN,MAAA,EAAQ,QAAA;AAAA;;;;;AA7BgB;AAwB5B;;iBAesB,mBAAA,CACpB,GAAA,UACA,IAAA,WACC,OAAO,CAAC,eAAA;;;;;;;;;;;;;;;iBA2BW,kBAAA,CACpB,GAAA,UACA,IAAA,UACA,IAAA,EAAM,IAAA,EACN,OAAA,UACA,SAAA,GAAY,WAAA,CAAY,gBAAA,YACxB,UAAA,YACC,OAAA,CAAQ,gBAAA;;;;;AA/CS;AAUpB;;;;;;;;;AAG0B;AA2B1B;;;;;iBA+KgB,YAAA,CAAa,MAAA,EAAQ,eAAA,GAAkB,eAAe;AAAA,iBACtD,YAAA,CAAa,MAAA,EAAQ,eAAA,KAAoB,eAAe;AAAA,iBACxD,YAAA,CACd,MAAA,EAAQ,OAAA,CAAQ,eAAA,IACf,OAAA,CAAQ,eAAA;AAAA,iBACK,YAAA,CACd,MAAA,EAAQ,OAAA,CAAQ,eAAA,MACf,OAAA,CAAQ,eAAA;AAAA,iBACK,YAAA,CAAa,MAAA,EAAQ,kBAAA,GAAqB,kBAAkB;AAAA,iBAC5D,YAAA,CAAa,MAAA,EAAQ,mBAAA,GAAsB,mBAAmB;AAAA,iBAC9D,YAAA,CAAa,MAAA,EAAQ,YAAA,GAAe,YAAY;AAAA,iBAChD,YAAA,CAAa,MAAA,EAAQ,gBAAA,GAAmB,gBAAgB"}
|
package/dist/lib/config.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LogLevelResolvedConfig } from "../types/logging.mjs";
|
|
2
2
|
import { Context } from "../types/context.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { FrameworkOptions, InlineConfig, Mode, ParsedUserConfig, UserConfigExport, UserConfigFn, UserConfigFnObject, UserConfigFnPromise, UserInputConfig, WorkspaceConfig } from "../types/config.mjs";
|
|
4
4
|
import { PartialKeys } from "@stryke/types/base";
|
|
5
5
|
import { PackageJson } from "@stryke/types/package-json";
|
|
6
6
|
|
|
@@ -108,12 +108,33 @@ declare function loadWorkspaceConfig(cwd: string, root: string): Promise<Workspa
|
|
|
108
108
|
*/
|
|
109
109
|
declare function loadUserConfigFile(cwd: string, root: string, mode: Mode, command: string, framework?: PartialKeys<FrameworkOptions, "orgId">, configFile?: string): Promise<ParsedUserConfig>;
|
|
110
110
|
/**
|
|
111
|
-
*
|
|
111
|
+
* Type helper to make it easier to use `powerlines.config.ts` files. Accepts a direct {@link UserConfig} object, or a function that returns it. The function receives a {@link ConfigParams} object.
|
|
112
112
|
*
|
|
113
|
-
* @
|
|
114
|
-
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```ts
|
|
115
|
+
* import { defineConfig } from 'powerlines';
|
|
116
|
+
*
|
|
117
|
+
* export default defineConfig({
|
|
118
|
+
* // Your configuration here
|
|
119
|
+
* });
|
|
120
|
+
*
|
|
121
|
+
* // Or with a function
|
|
122
|
+
* export default defineConfig((env) => {
|
|
123
|
+
* console.log(`Running command: ${env.command} in mode: ${env.mode}`);
|
|
124
|
+
* return {
|
|
125
|
+
* // Your configuration here
|
|
126
|
+
* };
|
|
127
|
+
* });
|
|
128
|
+
* ```
|
|
115
129
|
*/
|
|
116
|
-
declare function defineConfig(config:
|
|
130
|
+
declare function defineConfig(config: UserInputConfig): UserInputConfig;
|
|
131
|
+
declare function defineConfig(config: UserInputConfig[]): UserInputConfig[];
|
|
132
|
+
declare function defineConfig(config: Promise<UserInputConfig>): Promise<UserInputConfig>;
|
|
133
|
+
declare function defineConfig(config: Promise<UserInputConfig[]>): Promise<UserInputConfig[]>;
|
|
134
|
+
declare function defineConfig(config: UserConfigFnObject): UserConfigFnObject;
|
|
135
|
+
declare function defineConfig(config: UserConfigFnPromise): UserConfigFnPromise;
|
|
136
|
+
declare function defineConfig(config: UserConfigFn): UserConfigFn;
|
|
137
|
+
declare function defineConfig(config: UserConfigExport): UserConfigExport;
|
|
117
138
|
//#endregion
|
|
118
139
|
export { PartiallyResolvedContext, ResolvePackageConfigsResult, defineConfig, getDefaultLogLevel, getDefaultMode, loadParsedConfig, loadUserConfigFile, loadWorkspaceConfig, normalizeBasePath, resolvePackageConfigs, resolveRoot, tryResolveWorkspaceConfig };
|
|
119
140
|
//# sourceMappingURL=config.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.mts","names":[],"sources":["../../src/lib/config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GAAkB,eAAe;AAAA,iBACtD,YAAA,CAAa,MAAA,EAAQ,eAAA,KAAoB,eAAe;AAAA,iBACxD,YAAA,CACd,MAAA,EAAQ,OAAA,CAAQ,eAAA,IACf,OAAA,CAAQ,eAAA;AAAA,iBACK,YAAA,CACd,MAAA,EAAQ,OAAA,CAAQ,eAAA,MACf,OAAA,CAAQ,eAAA;AAAA,iBACK,YAAA,CAAa,MAAA,EAAQ,kBAAA,GAAqB,kBAAkB;AAAA,iBAC5D,YAAA,CAAa,MAAA,EAAQ,mBAAA,GAAsB,mBAAmB;AAAA,iBAC9D,YAAA,CAAa,MAAA,EAAQ,YAAA,GAAe,YAAY;AAAA,iBAChD,YAAA,CAAa,MAAA,EAAQ,gBAAA,GAAmB,gBAAgB"}
|
package/dist/lib/config.mjs
CHANGED
|
@@ -206,12 +206,6 @@ async function loadUserConfigFile(cwd, root, mode, command, framework, configFil
|
|
|
206
206
|
...result
|
|
207
207
|
} : {});
|
|
208
208
|
}
|
|
209
|
-
/**
|
|
210
|
-
* A type helper to make it easier to use `powerlines.config.ts` files.
|
|
211
|
-
*
|
|
212
|
-
* @remarks
|
|
213
|
-
* The function accepts a direct {@link AnyUserConfig} object/function and returns it typed as a {@link UserConfig} object.
|
|
214
|
-
*/
|
|
215
209
|
function defineConfig(config) {
|
|
216
210
|
return config;
|
|
217
211
|
}
|
package/dist/lib/config.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.mjs","names":["loadConfigC12"],"sources":["../../src/lib/config.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n getWorkspaceConfig,\n tryGetWorkspaceConfig\n} from \"@storm-software/config-tools/get-config\";\nimport {\n isDevelopment,\n isProduction,\n isTest\n} from \"@stryke/env/environment-checks\";\nimport { getEnvPaths } from \"@stryke/env/get-env-paths\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { isFile } from \"@stryke/fs/is-file\";\nimport { readJsonFile } from \"@stryke/fs/json\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { findFilePath, relativePath } from \"@stryke/path/file-path-fns\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { PartialKeys } from \"@stryke/types/base\";\nimport { PackageJson } from \"@stryke/types/package-json\";\nimport { loadConfig as loadConfigC12 } from \"c12\";\nimport defu from \"defu\";\nimport { resolveLogLevel } from \"../plugin-utils/logging\";\nimport type {\n FrameworkOptions,\n InlineConfig,\n Mode,\n ParsedUserConfig,\n UserConfig,\n WorkspaceConfig\n} from \"../types/config\";\nimport { AnyUserConfig } from \"../types/config\";\nimport { Context } from \"../types/context\";\nimport { LogLevelResolvedConfig } from \"../types/logging\";\nimport { createResolver } from \"./resolver\";\n\nexport function normalizeBasePath(base: string = \"/\"): string {\n let out = base.startsWith(\"/\") ? base : `/${base}`;\n if (!out.endsWith(\"/\")) out = `${out}/`;\n return out.replace(/\\/+/g, \"/\");\n}\n\nexport interface ResolvePackageConfigsResult {\n /**\n * The parsed `package.json` file for the project, if it exists. This file typically contains metadata about the project, such as its name, version, dependencies, and other information relevant to the build process.\n */\n packageJson?: PackageJson;\n\n /**\n * The parsed `project.json` file for the project, if it exists. This file is an optional configuration file that can be used to store additional configuration or metadata specific to the project, and is not required for all projects.\n */\n projectJson?: Record<string, unknown>;\n}\n\n/**\n * Resolve the package configurations for the project by loading the `package.json` and `project.json` files, if they exist. This function will look for these files in the project root and parse their contents as JavaScript objects. The parsed contents will be stored in the context for later use by plugins and other parts of the build process.\n *\n * @remarks\n * The `package.json` file is typically used to store metadata about the project, such as its name, version, dependencies, and other information. The `project.json` file is an optional file that can be used to store additional configuration or metadata specific to the project, and is not required for all projects.\n *\n * @param cwd - The current working directory to look for the package configurations. Defaults to the `cwd` specified in the context configuration.\n * @param root - The root directory of the project to look for the package configurations. Defaults to the `root` specified in the context configuration.\n * @returns A promise that resolves when the package configurations have been loaded and stored in the context.\n */\nexport async function resolvePackageConfigs(\n cwd: string,\n root: string\n): Promise<ResolvePackageConfigsResult> {\n const result: ResolvePackageConfigsResult = {};\n if (cwd || root) {\n const projectJsonPath = joinPaths(\n appendPath(root || \".\", cwd || \".\"),\n \"project.json\"\n );\n if (existsSync(projectJsonPath)) {\n result.projectJson = await readJsonFile(projectJsonPath);\n }\n\n const packageJsonPath = joinPaths(\n appendPath(root || \".\", cwd || \".\"),\n \"package.json\"\n );\n if (existsSync(packageJsonPath)) {\n result.packageJson = await readJsonFile<PackageJson>(packageJsonPath);\n }\n }\n\n return result;\n}\n\n/**\n * Resolve the root directory for the project based on the provided options. This function will determine the root directory by checking the provided `root` option, and if it is not provided, it will look for a configuration file (such as `powerlines.config.ts`) in the current working directory. If a configuration file is found, the root directory will be set to the directory containing that file. If no configuration file is found, the root directory will default to the current working directory.\n *\n * @param cwd - The current working directory to use as the base for resolving the root directory. This is typically the directory from which the Powerlines process was executed.\n * @param root - An optional root directory to use for the project. If provided, this will be used as the root directory instead of looking for a configuration file. This can be an absolute or relative path, and if it is relative, it will be resolved based on the current working directory.\n * @param configFile - An optional path to a configuration file to look for when resolving the root directory. If provided, this file will be used to determine the root directory if the `root` option is not provided. This can be an absolute or relative path, and if it is relative, it will be resolved based on the current working directory.\n * @returns The resolved root directory for the project, which will be used as the base for resolving other paths and configurations throughout the Powerlines process. This will typically be an absolute path to the root directory of the project.\n */\nexport function resolveRoot(\n cwd: string,\n root?: string,\n configFile?: string\n): string {\n let result = root || \".\";\n if (!root) {\n if (configFile) {\n const configFilePath = appendPath(configFile, cwd);\n if (!existsSync(configFilePath)) {\n throw new Error(\n `The user-provided configuration file at \"${configFile}\" does not exist. Please ensure this path is correct and try again.`\n );\n }\n if (!isFile(configFile)) {\n throw new Error(\n `The user-provided configuration file at \"${\n configFile\n }\" is not a file. Please ensure this path is correct and try again.`\n );\n }\n\n result = relativePath(cwd, findFilePath(configFile));\n }\n } else {\n result = replacePath(root, cwd);\n }\n\n return result;\n}\n\n/**\n * Retrieve the workspace configuration for the current project, if it exists. This function will look for a configuration file in the project root and return its contents as a JavaScript object. If no configuration file is found, it will return undefined.\n *\n * @param cwd - The current working directory to start searching from. This is typically the directory from which the Powerlines process was executed.\n * @param root - An optional root directory to use as the base for searching for the configuration file. If provided, this will be used as the starting point for searching for the configuration file instead of the current working directory. This can be an absolute or relative path, and if it is relative, it will be resolved based on the current working directory.\n * @returns A promise that resolves to the workspace configuration object, or undefined if no configuration file is found.\n */\nexport async function tryResolveWorkspaceConfig(\n cwd: string,\n root?: string\n): Promise<WorkspaceConfig | undefined> {\n return tryGetWorkspaceConfig(false, {\n cwd: root ? appendPath(root, cwd) : undefined,\n workspaceRoot: cwd\n });\n}\n\n/**\n * Determine the default mode for the current execution based on the environment and workspace configuration. This function will check the `NODE_ENV` environment variable to determine if the current environment is development, production, or test. If `NODE_ENV` is not set, it will look for a `mode` property in the workspace configuration file. If no mode is specified in the workspace configuration, it will default to \"production\".\n *\n * @remarks\n * The mode is used to determine which configuration file to load (e.g., `powerlines.development.config.js` for development mode, `powerlines.production.config.js` for production mode, etc.) and can also be used by plugins and other parts of the build process to conditionally apply certain behaviors based on the current mode.\n *\n * @param cwd - The current working directory to start searching from. This is typically the directory from which the Powerlines process was executed.\n * @param root - An optional root directory to use as the base for searching for the workspace configuration. If provided, this will be used as the starting point for searching for the workspace configuration instead of the current working directory. This can be an absolute or relative path, and if it is relative, it will be resolved based on the current working directory.\n * @returns A promise that resolves to the default mode for the current execution, which can be \"development\", \"production\", or \"test\".\n */\nexport async function getDefaultMode(\n cwd: string,\n root?: string\n): Promise<Mode> {\n const workspaceConfig = await tryResolveWorkspaceConfig(cwd, root);\n\n return isProduction\n ? \"production\"\n : isDevelopment\n ? \"development\"\n : isTest\n ? \"test\"\n : workspaceConfig?.mode || \"production\";\n}\n\n/**\n * Determine the default log level for the current execution based on the environment and workspace configuration. This function will check the `logLevel` property in the workspace configuration file and resolve it to a `LogLevelResolvedConfig` value. If no log level is specified in the workspace configuration, it will default to \"info\" for development mode and \"warn\" for production mode.\n *\n * @remarks\n * The log level is used to determine which log messages should be output during the execution of the Powerlines process. For example, if the log level is set to \"warn\", only messages with a level of \"warn\", \"error\", or \"fatal\" will be output, while messages with a level of \"info\", \"debug\", or \"trace\" will be suppressed. This allows users to control the verbosity of the logs and focus on the most relevant information based on their current needs.\n *\n * @param cwd - The current working directory to start searching from. This is typically the directory from which the Powerlines process was executed.\n * @param root - An optional root directory to use as the base for searching for the workspace configuration. If provided, this will be used as the starting point for searching for the workspace configuration instead of the current working directory. This can be an absolute or relative path, and if it is relative, it will be resolved based on the current working directory.\n * @returns A promise that resolves to the default log level for the current execution, which can be \"fatal\", \"error\", \"warn\", \"info\", \"debug\", or \"trace\".\n */\nexport async function getDefaultLogLevel(\n cwd: string,\n root?: string\n): Promise<LogLevelResolvedConfig> {\n const workspaceConfig = await tryResolveWorkspaceConfig(cwd, root);\n\n return resolveLogLevel(\n workspaceConfig?.logLevel\n ? workspaceConfig.logLevel === \"success\" ||\n workspaceConfig.logLevel === \"performance\"\n ? \"info\"\n : workspaceConfig.logLevel === \"all\"\n ? \"debug\"\n : workspaceConfig.logLevel === \"fatal\"\n ? \"error\"\n : workspaceConfig.logLevel\n : undefined,\n workspaceConfig?.mode || (await getDefaultMode(cwd, root))\n );\n}\n\n/**\n * Load the user configuration file for the project and set up the context with the loaded configuration. This function will be called during the initialization of the context to load the user configuration file based on the provided options and set up the context accordingly. It will also set up the resolver for loading modules from the user configuration file and ensure that the context is properly initialized with the loaded configuration.\n *\n * @remarks\n * 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.\n *\n * @param cwd - The current working directory to start searching from. This is typically the directory from which the Powerlines process was executed.\n * @param root - The root directory of the project to look for the configuration file. This is typically the root directory of the project, which may be different from the current working directory if the process was executed from a subdirectory.\n * @param framework - The name of the framework to use when looking for configuration files (default is \"powerlines\"). This is used to determine the naming convention for the configuration files to look for (e.g., `powerlines.development.config.js` for the \"powerlines\" framework in development mode).\n * @param orgId - The name of the organization to use when looking for configuration files (optional). This can be used to further customize the naming convention for the configuration files to look for (e.g., `powerlines.myorg.development.config.js` for the \"powerlines\" framework in development mode with an organization of \"myorg\").\n * @param inlineConfig - The inline configuration options provided during the execution of a Powerlines command, which can include properties such as the project root, mode, and an explicit path to a configuration file. This is used to determine how the context should be initialized and which configuration file should be loaded for the execution.\n * @returns A promise that resolves when the context has been successfully initialized with the loaded configuration and resolver setup.\n * @throws Will throw an error if no configuration file is found in the project root or current working directory. This ensures that the context cannot be initialized without a valid configuration, which is essential for the proper functioning of the Powerlines process.\n */\nexport async function loadParsedConfig(\n cwd: string,\n root: string,\n framework: string,\n orgId: string,\n inlineConfig: InlineConfig\n) {\n const mode = inlineConfig.mode || (await getDefaultMode(cwd, root));\n\n const configFile = await loadUserConfigFile(\n cwd,\n root,\n mode,\n inlineConfig.command,\n { name: framework, orgId },\n inlineConfig.configFile\n );\n if (!configFile) {\n throw new Error(\n `No configuration file found in ${appendPath(\n root,\n cwd\n )}. Please ensure you have a valid configuration file in your project.`\n );\n }\n\n return configFile;\n}\n\nexport type PartiallyResolvedContext<TContext extends Context = Context> = Omit<\n TContext,\n \"config\" | \"tsconfig\" | \"entry\" | \"fs\" | \"compiler\" | \"unimport\"\n> &\n Partial<TContext> & {\n config: TContext[\"config\"];\n };\n\n/**\n * Loads the workspace configuration.\n *\n * @param cwd - The root directory of the workspace.\n * @param root - The current working directory to start searching from.\n * @returns A promise that resolves to the loaded workspace configuration.\n */\nexport async function loadWorkspaceConfig(\n cwd: string,\n root: string\n): Promise<WorkspaceConfig> {\n return defu(\n {\n workspaceRoot: cwd\n },\n await getWorkspaceConfig(true, {\n cwd: root,\n workspaceRoot: cwd,\n useDefault: true\n })\n );\n}\n\n/**\n * Loads the user configuration file for the project.\n *\n * @remarks\n * This function will attempt to locate and load the user configuration file for the project based on the provided parameters. It will look for configuration files in various formats (e.g., `.ts`, `.js`, `.mts`, `.mjs`) and with different naming conventions (e.g., `powerlines.config.ts`, `powerlines.development.config.js`, etc.) in the project root and current working directory. If a configuration file is found, it will be loaded using a Jiti resolver, and the resulting configuration object will be returned. If no configuration file is found, an empty configuration object will be returned.\n *\n * @param cwd - The current working directory to start searching from.\n * @param root - The root directory of the project.\n * @param mode - The mode to determine which configuration file to load (e.g., \"development\", \"test\", \"production\").\n * @param command - The command being executed (e.g., \"build\", \"dev\", \"test\"), which can be used to further customize the configuration loading logic if needed.\n * @param framework - The name of the framework to use when looking for configuration files (default is \"powerlines\").\n * @param configFile - An explicit path to a configuration file to load (optional). If provided, this file will be loaded instead of searching for configuration files based on the mode and framework.\n * @returns A promise that resolves to the resolved user configuration.\n */\nexport async function loadUserConfigFile(\n cwd: string,\n root: string,\n mode: Mode,\n command: string,\n framework?: PartialKeys<FrameworkOptions, \"orgId\">,\n configFile?: string\n): Promise<ParsedUserConfig> {\n const frameworkName = kebabCase(framework?.name || \"powerlines\");\n const frameworkOrgId = kebabCase(framework?.orgId || \"storm-software\");\n\n let resolvedUserConfig: Partial<ParsedUserConfig> = {};\n\n let resolvedUserConfigFile: string | undefined;\n if (configFile) {\n resolvedUserConfigFile = existsSync(replacePath(configFile, root))\n ? replacePath(configFile, root)\n : existsSync(\n joinPaths(appendPath(root, cwd), replacePath(configFile, root))\n )\n ? joinPaths(appendPath(root, cwd), replacePath(configFile, root))\n : existsSync(joinPaths(appendPath(root, cwd), configFile))\n ? joinPaths(appendPath(root, cwd), configFile)\n : undefined;\n }\n\n if (!resolvedUserConfigFile) {\n resolvedUserConfigFile = existsSync(\n joinPaths(appendPath(root, cwd), `${frameworkName}.${mode}.config.ts`)\n )\n ? joinPaths(appendPath(root, cwd), `${frameworkName}.${mode}.config.ts`)\n : existsSync(\n joinPaths(\n appendPath(root, cwd),\n `${frameworkName}.${mode}.config.js`\n )\n )\n ? joinPaths(appendPath(root, cwd), `${frameworkName}.${mode}.config.js`)\n : existsSync(\n joinPaths(\n appendPath(root, cwd),\n `${frameworkName}.${mode}.config.mts`\n )\n )\n ? joinPaths(\n appendPath(root, cwd),\n `${frameworkName}.${mode}.config.mts`\n )\n : existsSync(\n joinPaths(\n appendPath(root, cwd),\n `${frameworkName}.${mode}.config.mjs`\n )\n )\n ? joinPaths(\n appendPath(root, cwd),\n `${frameworkName}.${mode}.config.mjs`\n )\n : existsSync(\n joinPaths(appendPath(root, cwd), `${frameworkName}.config.ts`)\n )\n ? joinPaths(appendPath(root, cwd), `${frameworkName}.config.ts`)\n : existsSync(\n joinPaths(\n appendPath(root, cwd),\n `${frameworkName}.config.js`\n )\n )\n ? joinPaths(appendPath(root, cwd), `${frameworkName}.config.js`)\n : existsSync(\n joinPaths(\n appendPath(root, cwd),\n `${frameworkName}.config.mts`\n )\n )\n ? joinPaths(\n appendPath(root, cwd),\n `${frameworkName}.config.mts`\n )\n : existsSync(\n joinPaths(\n appendPath(root, cwd),\n `${frameworkName}.config.mjs`\n )\n )\n ? joinPaths(\n appendPath(root, cwd),\n `${frameworkName}.config.mjs`\n )\n : undefined;\n }\n\n const envPaths = getEnvPaths({\n orgId: frameworkOrgId,\n appId: frameworkName,\n workspaceRoot: cwd\n });\n\n const jiti = createResolver({\n cwd,\n root,\n cacheDir: envPaths.cache,\n mode\n });\n\n if (resolvedUserConfigFile) {\n const resolved = await jiti.import<{ default: AnyUserConfig }>(\n jiti.esmResolve(resolvedUserConfigFile)\n );\n if (resolved?.default) {\n let config = {};\n if (isFunction(resolved.default)) {\n config = await Promise.resolve(\n resolved.default({ root, cwd, mode, command })\n );\n } else if (\n isSetObject(resolved.default) ||\n Array.isArray(resolved.default)\n ) {\n config = resolved.default;\n }\n\n if (isSetObject(config) || Array.isArray(config)) {\n resolvedUserConfig = {\n ...config,\n config,\n configFile: resolvedUserConfigFile\n };\n }\n }\n }\n\n const result = await loadConfigC12({\n cwd: root,\n name: frameworkName,\n envName: mode,\n globalRc: true,\n packageJson: camelCase(frameworkName),\n dotenv: true,\n jiti\n });\n\n return defu(\n {\n config: {\n root,\n cwd,\n framework\n }\n },\n resolvedUserConfig,\n isSetObject(result?.config) ? { ...result.config, ...result } : {}\n );\n}\n\n/**\n * A type helper to make it easier to use `powerlines.config.ts` files.\n *\n * @remarks\n * The function accepts a direct {@link AnyUserConfig} object/function and returns it typed as a {@link UserConfig} object.\n */\nexport function defineConfig(config: AnyUserConfig): UserConfig {\n return config as any;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAyDA,SAAgB,kBAAkB,OAAe,KAAa;CAC5D,IAAI,MAAM,KAAK,WAAW,GAAG,IAAI,OAAO,IAAI;CAC5C,IAAI,CAAC,IAAI,SAAS,GAAG,GAAG,MAAM,GAAG,IAAI;CACrC,OAAO,IAAI,QAAQ,QAAQ,GAAG;AAChC;;;;;;;;;;;AAwBA,eAAsB,sBACpB,KACA,MACsC;CACtC,MAAM,SAAsC,CAAC;CAC7C,IAAI,OAAO,MAAM;EACf,MAAM,kBAAkB,UACtB,WAAW,QAAQ,KAAK,OAAO,GAAG,GAClC,cACF;EACA,IAAI,WAAW,eAAe,GAC5B,OAAO,cAAc,MAAM,aAAa,eAAe;EAGzD,MAAM,kBAAkB,UACtB,WAAW,QAAQ,KAAK,OAAO,GAAG,GAClC,cACF;EACA,IAAI,WAAW,eAAe,GAC5B,OAAO,cAAc,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;CACF,CAAC;CAED,OAAO,KACL,EACE,QAAQ;EACN;EACA;EACA;CACF,EACF,GACA,oBACA,YAAY,QAAQ,MAAM,IAAI;EAAE,GAAG,OAAO;EAAQ,GAAG;CAAO,IAAI,CAAC,CACnE;AACF;;;;;;;AAQA,SAAgB,aAAa,QAAmC;CAC9D,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"config.mjs","names":["loadConfigC12"],"sources":["../../src/lib/config.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n getWorkspaceConfig,\n tryGetWorkspaceConfig\n} from \"@storm-software/config-tools/get-config\";\nimport {\n isDevelopment,\n isProduction,\n isTest\n} from \"@stryke/env/environment-checks\";\nimport { getEnvPaths } from \"@stryke/env/get-env-paths\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { isFile } from \"@stryke/fs/is-file\";\nimport { readJsonFile } from \"@stryke/fs/json\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { findFilePath, relativePath } from \"@stryke/path/file-path-fns\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { PartialKeys } from \"@stryke/types/base\";\nimport { PackageJson } from \"@stryke/types/package-json\";\nimport { loadConfig as loadConfigC12 } from \"c12\";\nimport defu from \"defu\";\nimport { resolveLogLevel } from \"../plugin-utils/logging\";\nimport type {\n FrameworkOptions,\n InlineConfig,\n Mode,\n ParsedUserConfig,\n UserConfigExport,\n UserConfigFn,\n UserConfigFnObject,\n UserConfigFnPromise,\n UserInputConfig,\n WorkspaceConfig\n} from \"../types/config\";\nimport { Context } from \"../types/context\";\nimport { LogLevelResolvedConfig } from \"../types/logging\";\nimport { createResolver } from \"./resolver\";\n\nexport function normalizeBasePath(base: string = \"/\"): string {\n let out = base.startsWith(\"/\") ? base : `/${base}`;\n if (!out.endsWith(\"/\")) out = `${out}/`;\n return out.replace(/\\/+/g, \"/\");\n}\n\nexport interface ResolvePackageConfigsResult {\n /**\n * The parsed `package.json` file for the project, if it exists. This file typically contains metadata about the project, such as its name, version, dependencies, and other information relevant to the build process.\n */\n packageJson?: PackageJson;\n\n /**\n * The parsed `project.json` file for the project, if it exists. This file is an optional configuration file that can be used to store additional configuration or metadata specific to the project, and is not required for all projects.\n */\n projectJson?: Record<string, unknown>;\n}\n\n/**\n * Resolve the package configurations for the project by loading the `package.json` and `project.json` files, if they exist. This function will look for these files in the project root and parse their contents as JavaScript objects. The parsed contents will be stored in the context for later use by plugins and other parts of the build process.\n *\n * @remarks\n * The `package.json` file is typically used to store metadata about the project, such as its name, version, dependencies, and other information. The `project.json` file is an optional file that can be used to store additional configuration or metadata specific to the project, and is not required for all projects.\n *\n * @param cwd - The current working directory to look for the package configurations. Defaults to the `cwd` specified in the context configuration.\n * @param root - The root directory of the project to look for the package configurations. Defaults to the `root` specified in the context configuration.\n * @returns A promise that resolves when the package configurations have been loaded and stored in the context.\n */\nexport async function resolvePackageConfigs(\n cwd: string,\n root: string\n): Promise<ResolvePackageConfigsResult> {\n const result: ResolvePackageConfigsResult = {};\n if (cwd || root) {\n const projectJsonPath = joinPaths(\n appendPath(root || \".\", cwd || \".\"),\n \"project.json\"\n );\n if (existsSync(projectJsonPath)) {\n result.projectJson = await readJsonFile(projectJsonPath);\n }\n\n const packageJsonPath = joinPaths(\n appendPath(root || \".\", cwd || \".\"),\n \"package.json\"\n );\n if (existsSync(packageJsonPath)) {\n result.packageJson = await readJsonFile<PackageJson>(packageJsonPath);\n }\n }\n\n return result;\n}\n\n/**\n * Resolve the root directory for the project based on the provided options. This function will determine the root directory by checking the provided `root` option, and if it is not provided, it will look for a configuration file (such as `powerlines.config.ts`) in the current working directory. If a configuration file is found, the root directory will be set to the directory containing that file. If no configuration file is found, the root directory will default to the current working directory.\n *\n * @param cwd - The current working directory to use as the base for resolving the root directory. This is typically the directory from which the Powerlines process was executed.\n * @param root - An optional root directory to use for the project. If provided, this will be used as the root directory instead of looking for a configuration file. This can be an absolute or relative path, and if it is relative, it will be resolved based on the current working directory.\n * @param configFile - An optional path to a configuration file to look for when resolving the root directory. If provided, this file will be used to determine the root directory if the `root` option is not provided. This can be an absolute or relative path, and if it is relative, it will be resolved based on the current working directory.\n * @returns The resolved root directory for the project, which will be used as the base for resolving other paths and configurations throughout the Powerlines process. This will typically be an absolute path to the root directory of the project.\n */\nexport function resolveRoot(\n cwd: string,\n root?: string,\n configFile?: string\n): string {\n let result = root || \".\";\n if (!root) {\n if (configFile) {\n const configFilePath = appendPath(configFile, cwd);\n if (!existsSync(configFilePath)) {\n throw new Error(\n `The user-provided configuration file at \"${configFile}\" does not exist. Please ensure this path is correct and try again.`\n );\n }\n if (!isFile(configFile)) {\n throw new Error(\n `The user-provided configuration file at \"${\n configFile\n }\" is not a file. Please ensure this path is correct and try again.`\n );\n }\n\n result = relativePath(cwd, findFilePath(configFile));\n }\n } else {\n result = replacePath(root, cwd);\n }\n\n return result;\n}\n\n/**\n * Retrieve the workspace configuration for the current project, if it exists. This function will look for a configuration file in the project root and return its contents as a JavaScript object. If no configuration file is found, it will return undefined.\n *\n * @param cwd - The current working directory to start searching from. This is typically the directory from which the Powerlines process was executed.\n * @param root - An optional root directory to use as the base for searching for the configuration file. If provided, this will be used as the starting point for searching for the configuration file instead of the current working directory. This can be an absolute or relative path, and if it is relative, it will be resolved based on the current working directory.\n * @returns A promise that resolves to the workspace configuration object, or undefined if no configuration file is found.\n */\nexport async function tryResolveWorkspaceConfig(\n cwd: string,\n root?: string\n): Promise<WorkspaceConfig | undefined> {\n return tryGetWorkspaceConfig(false, {\n cwd: root ? appendPath(root, cwd) : undefined,\n workspaceRoot: cwd\n });\n}\n\n/**\n * Determine the default mode for the current execution based on the environment and workspace configuration. This function will check the `NODE_ENV` environment variable to determine if the current environment is development, production, or test. If `NODE_ENV` is not set, it will look for a `mode` property in the workspace configuration file. If no mode is specified in the workspace configuration, it will default to \"production\".\n *\n * @remarks\n * The mode is used to determine which configuration file to load (e.g., `powerlines.development.config.js` for development mode, `powerlines.production.config.js` for production mode, etc.) and can also be used by plugins and other parts of the build process to conditionally apply certain behaviors based on the current mode.\n *\n * @param cwd - The current working directory to start searching from. This is typically the directory from which the Powerlines process was executed.\n * @param root - An optional root directory to use as the base for searching for the workspace configuration. If provided, this will be used as the starting point for searching for the workspace configuration instead of the current working directory. This can be an absolute or relative path, and if it is relative, it will be resolved based on the current working directory.\n * @returns A promise that resolves to the default mode for the current execution, which can be \"development\", \"production\", or \"test\".\n */\nexport async function getDefaultMode(\n cwd: string,\n root?: string\n): Promise<Mode> {\n const workspaceConfig = await tryResolveWorkspaceConfig(cwd, root);\n\n return isProduction\n ? \"production\"\n : isDevelopment\n ? \"development\"\n : isTest\n ? \"test\"\n : workspaceConfig?.mode || \"production\";\n}\n\n/**\n * Determine the default log level for the current execution based on the environment and workspace configuration. This function will check the `logLevel` property in the workspace configuration file and resolve it to a `LogLevelResolvedConfig` value. If no log level is specified in the workspace configuration, it will default to \"info\" for development mode and \"warn\" for production mode.\n *\n * @remarks\n * The log level is used to determine which log messages should be output during the execution of the Powerlines process. For example, if the log level is set to \"warn\", only messages with a level of \"warn\", \"error\", or \"fatal\" will be output, while messages with a level of \"info\", \"debug\", or \"trace\" will be suppressed. This allows users to control the verbosity of the logs and focus on the most relevant information based on their current needs.\n *\n * @param cwd - The current working directory to start searching from. This is typically the directory from which the Powerlines process was executed.\n * @param root - An optional root directory to use as the base for searching for the workspace configuration. If provided, this will be used as the starting point for searching for the workspace configuration instead of the current working directory. This can be an absolute or relative path, and if it is relative, it will be resolved based on the current working directory.\n * @returns A promise that resolves to the default log level for the current execution, which can be \"fatal\", \"error\", \"warn\", \"info\", \"debug\", or \"trace\".\n */\nexport async function getDefaultLogLevel(\n cwd: string,\n root?: string\n): Promise<LogLevelResolvedConfig> {\n const workspaceConfig = await tryResolveWorkspaceConfig(cwd, root);\n\n return resolveLogLevel(\n workspaceConfig?.logLevel\n ? workspaceConfig.logLevel === \"success\" ||\n workspaceConfig.logLevel === \"performance\"\n ? \"info\"\n : workspaceConfig.logLevel === \"all\"\n ? \"debug\"\n : workspaceConfig.logLevel === \"fatal\"\n ? \"error\"\n : workspaceConfig.logLevel\n : undefined,\n workspaceConfig?.mode || (await getDefaultMode(cwd, root))\n );\n}\n\n/**\n * Load the user configuration file for the project and set up the context with the loaded configuration. This function will be called during the initialization of the context to load the user configuration file based on the provided options and set up the context accordingly. It will also set up the resolver for loading modules from the user configuration file and ensure that the context is properly initialized with the loaded configuration.\n *\n * @remarks\n * 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.\n *\n * @param cwd - The current working directory to start searching from. This is typically the directory from which the Powerlines process was executed.\n * @param root - The root directory of the project to look for the configuration file. This is typically the root directory of the project, which may be different from the current working directory if the process was executed from a subdirectory.\n * @param framework - The name of the framework to use when looking for configuration files (default is \"powerlines\"). This is used to determine the naming convention for the configuration files to look for (e.g., `powerlines.development.config.js` for the \"powerlines\" framework in development mode).\n * @param orgId - The name of the organization to use when looking for configuration files (optional). This can be used to further customize the naming convention for the configuration files to look for (e.g., `powerlines.myorg.development.config.js` for the \"powerlines\" framework in development mode with an organization of \"myorg\").\n * @param inlineConfig - The inline configuration options provided during the execution of a Powerlines command, which can include properties such as the project root, mode, and an explicit path to a configuration file. This is used to determine how the context should be initialized and which configuration file should be loaded for the execution.\n * @returns A promise that resolves when the context has been successfully initialized with the loaded configuration and resolver setup.\n * @throws Will throw an error if no configuration file is found in the project root or current working directory. This ensures that the context cannot be initialized without a valid configuration, which is essential for the proper functioning of the Powerlines process.\n */\nexport async function loadParsedConfig(\n cwd: string,\n root: string,\n framework: string,\n orgId: string,\n inlineConfig: InlineConfig\n) {\n const mode = inlineConfig.mode || (await getDefaultMode(cwd, root));\n\n const configFile = await loadUserConfigFile(\n cwd,\n root,\n mode,\n inlineConfig.command,\n { name: framework, orgId },\n inlineConfig.configFile\n );\n if (!configFile) {\n throw new Error(\n `No configuration file found in ${appendPath(\n root,\n cwd\n )}. Please ensure you have a valid configuration file in your project.`\n );\n }\n\n return configFile;\n}\n\nexport type PartiallyResolvedContext<TContext extends Context = Context> = Omit<\n TContext,\n \"config\" | \"tsconfig\" | \"entry\" | \"fs\" | \"compiler\" | \"unimport\"\n> &\n Partial<TContext> & {\n config: TContext[\"config\"];\n };\n\n/**\n * Loads the workspace configuration.\n *\n * @param cwd - The root directory of the workspace.\n * @param root - The current working directory to start searching from.\n * @returns A promise that resolves to the loaded workspace configuration.\n */\nexport async function loadWorkspaceConfig(\n cwd: string,\n root: string\n): Promise<WorkspaceConfig> {\n return defu(\n {\n workspaceRoot: cwd\n },\n await getWorkspaceConfig(true, {\n cwd: root,\n workspaceRoot: cwd,\n useDefault: true\n })\n );\n}\n\n/**\n * Loads the user configuration file for the project.\n *\n * @remarks\n * This function will attempt to locate and load the user configuration file for the project based on the provided parameters. It will look for configuration files in various formats (e.g., `.ts`, `.js`, `.mts`, `.mjs`) and with different naming conventions (e.g., `powerlines.config.ts`, `powerlines.development.config.js`, etc.) in the project root and current working directory. If a configuration file is found, it will be loaded using a Jiti resolver, and the resulting configuration object will be returned. If no configuration file is found, an empty configuration object will be returned.\n *\n * @param cwd - The current working directory to start searching from.\n * @param root - The root directory of the project.\n * @param mode - The mode to determine which configuration file to load (e.g., \"development\", \"test\", \"production\").\n * @param command - The command being executed (e.g., \"build\", \"dev\", \"test\"), which can be used to further customize the configuration loading logic if needed.\n * @param framework - The name of the framework to use when looking for configuration files (default is \"powerlines\").\n * @param configFile - An explicit path to a configuration file to load (optional). If provided, this file will be loaded instead of searching for configuration files based on the mode and framework.\n * @returns A promise that resolves to the resolved user configuration.\n */\nexport async function loadUserConfigFile(\n cwd: string,\n root: string,\n mode: Mode,\n command: string,\n framework?: PartialKeys<FrameworkOptions, \"orgId\">,\n configFile?: string\n): Promise<ParsedUserConfig> {\n const frameworkName = kebabCase(framework?.name || \"powerlines\");\n const frameworkOrgId = kebabCase(framework?.orgId || \"storm-software\");\n\n let resolvedUserConfig: Partial<ParsedUserConfig> = {};\n\n let resolvedUserConfigFile: string | undefined;\n if (configFile) {\n resolvedUserConfigFile = existsSync(replacePath(configFile, root))\n ? replacePath(configFile, root)\n : existsSync(\n joinPaths(appendPath(root, cwd), replacePath(configFile, root))\n )\n ? joinPaths(appendPath(root, cwd), replacePath(configFile, root))\n : existsSync(joinPaths(appendPath(root, cwd), configFile))\n ? joinPaths(appendPath(root, cwd), configFile)\n : undefined;\n }\n\n if (!resolvedUserConfigFile) {\n resolvedUserConfigFile = existsSync(\n joinPaths(appendPath(root, cwd), `${frameworkName}.${mode}.config.ts`)\n )\n ? joinPaths(appendPath(root, cwd), `${frameworkName}.${mode}.config.ts`)\n : existsSync(\n joinPaths(\n appendPath(root, cwd),\n `${frameworkName}.${mode}.config.js`\n )\n )\n ? joinPaths(appendPath(root, cwd), `${frameworkName}.${mode}.config.js`)\n : existsSync(\n joinPaths(\n appendPath(root, cwd),\n `${frameworkName}.${mode}.config.mts`\n )\n )\n ? joinPaths(\n appendPath(root, cwd),\n `${frameworkName}.${mode}.config.mts`\n )\n : existsSync(\n joinPaths(\n appendPath(root, cwd),\n `${frameworkName}.${mode}.config.mjs`\n )\n )\n ? joinPaths(\n appendPath(root, cwd),\n `${frameworkName}.${mode}.config.mjs`\n )\n : existsSync(\n joinPaths(appendPath(root, cwd), `${frameworkName}.config.ts`)\n )\n ? joinPaths(appendPath(root, cwd), `${frameworkName}.config.ts`)\n : existsSync(\n joinPaths(\n appendPath(root, cwd),\n `${frameworkName}.config.js`\n )\n )\n ? joinPaths(appendPath(root, cwd), `${frameworkName}.config.js`)\n : existsSync(\n joinPaths(\n appendPath(root, cwd),\n `${frameworkName}.config.mts`\n )\n )\n ? joinPaths(\n appendPath(root, cwd),\n `${frameworkName}.config.mts`\n )\n : existsSync(\n joinPaths(\n appendPath(root, cwd),\n `${frameworkName}.config.mjs`\n )\n )\n ? joinPaths(\n appendPath(root, cwd),\n `${frameworkName}.config.mjs`\n )\n : undefined;\n }\n\n const envPaths = getEnvPaths({\n orgId: frameworkOrgId,\n appId: frameworkName,\n workspaceRoot: cwd\n });\n\n const jiti = createResolver({\n cwd,\n root,\n cacheDir: envPaths.cache,\n mode\n });\n\n if (resolvedUserConfigFile) {\n const resolved = await jiti.import<{ default: UserConfigExport }>(\n jiti.esmResolve(resolvedUserConfigFile)\n );\n if (resolved?.default) {\n let config = {};\n if (isFunction(resolved.default)) {\n config = await Promise.resolve(\n resolved.default({ root, cwd, mode, command })\n );\n } else if (\n isSetObject(resolved.default) ||\n Array.isArray(resolved.default)\n ) {\n config = resolved.default;\n }\n\n if (isSetObject(config) || Array.isArray(config)) {\n resolvedUserConfig = {\n ...config,\n config,\n configFile: resolvedUserConfigFile\n };\n }\n }\n }\n\n const result = await loadConfigC12({\n cwd: root,\n name: frameworkName,\n envName: mode,\n globalRc: true,\n packageJson: camelCase(frameworkName),\n dotenv: true,\n jiti\n });\n\n return defu(\n {\n config: {\n root,\n cwd,\n framework\n }\n },\n resolvedUserConfig,\n isSetObject(result?.config) ? { ...result.config, ...result } : {}\n ) as ParsedUserConfig;\n}\n\n/**\n * Type helper to make it easier to use `powerlines.config.ts` files. Accepts a direct {@link UserConfig} object, or a function that returns it. The function receives a {@link ConfigParams} object.\n *\n * @example\n * ```ts\n * import { defineConfig } from 'powerlines';\n *\n * export default defineConfig({\n * // Your configuration here\n * });\n *\n * // Or with a function\n * export default defineConfig((env) => {\n * console.log(`Running command: ${env.command} in mode: ${env.mode}`);\n * return {\n * // Your configuration here\n * };\n * });\n * ```\n */\nexport function defineConfig(config: UserInputConfig): UserInputConfig;\nexport function defineConfig(config: UserInputConfig[]): UserInputConfig[];\nexport function defineConfig(\n config: Promise<UserInputConfig>\n): Promise<UserInputConfig>;\nexport function defineConfig(\n config: Promise<UserInputConfig[]>\n): Promise<UserInputConfig[]>;\nexport function defineConfig(config: UserConfigFnObject): UserConfigFnObject;\nexport function defineConfig(config: UserConfigFnPromise): UserConfigFnPromise;\nexport function defineConfig(config: UserConfigFn): UserConfigFn;\nexport function defineConfig(config: UserConfigExport): UserConfigExport;\nexport function defineConfig(config: UserConfigExport): UserConfigExport {\n return config;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA4DA,SAAgB,kBAAkB,OAAe,KAAa;CAC5D,IAAI,MAAM,KAAK,WAAW,GAAG,IAAI,OAAO,IAAI;CAC5C,IAAI,CAAC,IAAI,SAAS,GAAG,GAAG,MAAM,GAAG,IAAI;CACrC,OAAO,IAAI,QAAQ,QAAQ,GAAG;AAChC;;;;;;;;;;;AAwBA,eAAsB,sBACpB,KACA,MACsC;CACtC,MAAM,SAAsC,CAAC;CAC7C,IAAI,OAAO,MAAM;EACf,MAAM,kBAAkB,UACtB,WAAW,QAAQ,KAAK,OAAO,GAAG,GAClC,cACF;EACA,IAAI,WAAW,eAAe,GAC5B,OAAO,cAAc,MAAM,aAAa,eAAe;EAGzD,MAAM,kBAAkB,UACtB,WAAW,QAAQ,KAAK,OAAO,GAAG,GAClC,cACF;EACA,IAAI,WAAW,eAAe,GAC5B,OAAO,cAAc,MAAM,aAA0B,eAAe;CAExE;CAEA,OAAO;AACT;;;;;;;;;AAUA,SAAgB,YACd,KACA,MACA,YACQ;CACR,IAAI,SAAS,QAAQ;CACrB,IAAI,CAAC,MACH;MAA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,IAAI,CAAC,CACnE;AACF;AAkCA,SAAgB,aAAa,QAA4C;CACvE,OAAO;AACT"}
|
|
@@ -2,13 +2,13 @@ import { ExecutionContext } from "../types/context.cjs";
|
|
|
2
2
|
import { InferOverridableConfig, ResolvedConfig } from "../types/config.cjs";
|
|
3
3
|
//#region src/lib/context-helpers.d.ts
|
|
4
4
|
declare function getConfigProps<TResolvedConfig extends ResolvedConfig>(config?: TResolvedConfig["userConfig"] | TResolvedConfig["inlineConfig"] | TResolvedConfig["pluginConfig"] | InferOverridableConfig<TResolvedConfig>): ({
|
|
5
|
-
input: import("@stryke/types/configuration").TypeDefinition | import("@stryke/types/configuration").TypeDefinitionParameter[] | Record<string, import("@stryke/types/configuration").TypeDefinitionParameter | import("@stryke/types/configuration").TypeDefinitionParameter[]> | TResolvedConfig["input"] | (Omit<TResolvedConfig, "
|
|
5
|
+
input: import("@stryke/types/configuration").TypeDefinition | import("@stryke/types/configuration").TypeDefinitionParameter[] | Record<string, import("@stryke/types/configuration").TypeDefinitionParameter | import("@stryke/types/configuration").TypeDefinitionParameter[]> | TResolvedConfig["input"] | (Omit<TResolvedConfig, "command" | "cwd" | "configFile" | "userConfig" | "inlineConfig" | "pluginConfig">["input"] extends object ? Omit<TResolvedConfig, "command" | "cwd" | "configFile" | "userConfig" | "inlineConfig" | "pluginConfig">["input"] extends infer T ? T extends Omit<TResolvedConfig, "command" | "cwd" | "configFile" | "userConfig" | "inlineConfig" | "pluginConfig">["input"] ? T extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T : { [K in keyof T]?: (T[K] extends object ? T[K] extends infer T_1 ? T_1 extends T[K] ? T_1 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_1 : { [K_2 in keyof T_1]?: (T_1[K_2] extends object ? T_1[K_2] extends infer T_2 ? T_2 extends T_1[K_2] ? T_2 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_2 : { [K_3 in keyof T_2]?: (T_2[K_3] extends object ? T_2[K_3] extends infer T_3 ? T_3 extends T_2[K_3] ? T_3 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_3 : { [K_4 in keyof T_3]?: (T_3[K_4] extends object ? T_3[K_4] extends infer T_4 ? T_4 extends T_3[K_4] ? T_4 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_4 : { [K_5 in keyof T_4]?: (T_4[K_5] extends object ? T_4[K_5] extends infer T_5 ? T_5 extends T_4[K_5] ? T_5 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_5 : { [K_6 in keyof T_5]?: (T_5[K_6] extends object ? T_5[K_6] extends infer T_6 ? T_6 extends T_5[K_6] ? T_6 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_6 : { [K_7 in keyof T_6]?: (T_6[K_7] extends object ? T_6[K_7] extends infer T_7 ? T_7 extends T_6[K_7] ? T_7 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_7 : { [K_8 in keyof T_7]?: (T_7[K_8] extends object ? T_7[K_8] extends infer T_8 ? T_8 extends T_7[K_8] ? T_8 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_8 : { [K_9 in keyof T_8]?: (T_8[K_9] extends object ? T_8[K_9] : T_8[K_9]) | undefined } : never : never : T_7[K_8]) | undefined } : never : never : T_6[K_7]) | undefined } : never : never : T_5[K_6]) | undefined } : never : never : T_4[K_5]) | undefined } : never : never : T_3[K_4]) | undefined } : never : never : T_2[K_3]) | undefined } : never : never : T_1[K_2]) | undefined } : never : never : T[K]) | undefined } : never : never : Omit<TResolvedConfig, "command" | "cwd" | "configFile" | "userConfig" | "inlineConfig" | "pluginConfig">["input"]) | undefined;
|
|
6
6
|
} & TResolvedConfig["userConfig"]) | ({
|
|
7
|
-
input: import("@stryke/types/configuration").TypeDefinition | import("@stryke/types/configuration").TypeDefinitionParameter[] | Record<string, import("@stryke/types/configuration").TypeDefinitionParameter | import("@stryke/types/configuration").TypeDefinitionParameter[]> | TResolvedConfig["input"] | (Omit<TResolvedConfig, "
|
|
7
|
+
input: import("@stryke/types/configuration").TypeDefinition | import("@stryke/types/configuration").TypeDefinitionParameter[] | Record<string, import("@stryke/types/configuration").TypeDefinitionParameter | import("@stryke/types/configuration").TypeDefinitionParameter[]> | TResolvedConfig["input"] | (Omit<TResolvedConfig, "command" | "cwd" | "configFile" | "userConfig" | "inlineConfig" | "pluginConfig">["input"] extends object ? Omit<TResolvedConfig, "command" | "cwd" | "configFile" | "userConfig" | "inlineConfig" | "pluginConfig">["input"] extends infer T_1 ? T_1 extends Omit<TResolvedConfig, "command" | "cwd" | "configFile" | "userConfig" | "inlineConfig" | "pluginConfig">["input"] ? T_1 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_1 : { [K_1 in keyof T_1]?: (T_1[K_1] extends object ? T_1[K_1] extends infer T_2 ? T_2 extends T_1[K_1] ? T_2 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_2 : { [K_3 in keyof T_2]?: (T_2[K_3] extends object ? T_2[K_3] extends infer T_3 ? T_3 extends T_2[K_3] ? T_3 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_3 : { [K_4 in keyof T_3]?: (T_3[K_4] extends object ? T_3[K_4] extends infer T_4 ? T_4 extends T_3[K_4] ? T_4 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_4 : { [K_5 in keyof T_4]?: (T_4[K_5] extends object ? T_4[K_5] extends infer T_5 ? T_5 extends T_4[K_5] ? T_5 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_5 : { [K_6 in keyof T_5]?: (T_5[K_6] extends object ? T_5[K_6] extends infer T_6 ? T_6 extends T_5[K_6] ? T_6 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_6 : { [K_7 in keyof T_6]?: (T_6[K_7] extends object ? T_6[K_7] extends infer T_7 ? T_7 extends T_6[K_7] ? T_7 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_7 : { [K_8 in keyof T_7]?: (T_7[K_8] extends object ? T_7[K_8] extends infer T_8 ? T_8 extends T_7[K_8] ? T_8 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_8 : { [K_9 in keyof T_8]?: (T_8[K_9] extends object ? T_8[K_9] extends infer T_9 ? T_9 extends T_8[K_9] ? T_9 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_9 : { [K_10 in keyof T_9]?: (T_9[K_10] extends object ? T_9[K_10] : T_9[K_10]) | undefined } : never : never : T_8[K_9]) | undefined } : never : never : T_7[K_8]) | undefined } : never : never : T_6[K_7]) | undefined } : never : never : T_5[K_6]) | undefined } : never : never : T_4[K_5]) | undefined } : never : never : T_3[K_4]) | undefined } : never : never : T_2[K_3]) | undefined } : never : never : T_1[K_1]) | undefined } : never : never : Omit<TResolvedConfig, "command" | "cwd" | "configFile" | "userConfig" | "inlineConfig" | "pluginConfig">["input"]) | undefined;
|
|
8
8
|
} & TResolvedConfig["inlineConfig"]) | ({
|
|
9
|
-
input: import("@stryke/types/configuration").TypeDefinition | import("@stryke/types/configuration").TypeDefinitionParameter[] | Record<string, import("@stryke/types/configuration").TypeDefinitionParameter | import("@stryke/types/configuration").TypeDefinitionParameter[]> | TResolvedConfig["input"] | (Omit<TResolvedConfig, "
|
|
9
|
+
input: import("@stryke/types/configuration").TypeDefinition | import("@stryke/types/configuration").TypeDefinitionParameter[] | Record<string, import("@stryke/types/configuration").TypeDefinitionParameter | import("@stryke/types/configuration").TypeDefinitionParameter[]> | TResolvedConfig["input"] | (Omit<TResolvedConfig, "command" | "cwd" | "configFile" | "userConfig" | "inlineConfig" | "pluginConfig">["input"] extends object ? Omit<TResolvedConfig, "command" | "cwd" | "configFile" | "userConfig" | "inlineConfig" | "pluginConfig">["input"] extends infer T_2 ? T_2 extends Omit<TResolvedConfig, "command" | "cwd" | "configFile" | "userConfig" | "inlineConfig" | "pluginConfig">["input"] ? T_2 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_2 : { [K_2 in keyof T_2]?: (T_2[K_2] extends object ? T_2[K_2] extends infer T_3 ? T_3 extends T_2[K_2] ? T_3 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_3 : { [K_4 in keyof T_3]?: (T_3[K_4] extends object ? T_3[K_4] extends infer T_4 ? T_4 extends T_3[K_4] ? T_4 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_4 : { [K_5 in keyof T_4]?: (T_4[K_5] extends object ? T_4[K_5] extends infer T_5 ? T_5 extends T_4[K_5] ? T_5 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_5 : { [K_6 in keyof T_5]?: (T_5[K_6] extends object ? T_5[K_6] extends infer T_6 ? T_6 extends T_5[K_6] ? T_6 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_6 : { [K_7 in keyof T_6]?: (T_6[K_7] extends object ? T_6[K_7] extends infer T_7 ? T_7 extends T_6[K_7] ? T_7 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_7 : { [K_8 in keyof T_7]?: (T_7[K_8] extends object ? T_7[K_8] extends infer T_8 ? T_8 extends T_7[K_8] ? T_8 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_8 : { [K_9 in keyof T_8]?: (T_8[K_9] extends object ? T_8[K_9] extends infer T_9 ? T_9 extends T_8[K_9] ? T_9 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_9 : { [K_10 in keyof T_9]?: (T_9[K_10] extends object ? T_9[K_10] extends infer T_10 ? T_10 extends T_9[K_10] ? T_10 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_10 : { [K_11 in keyof T_10]?: (T_10[K_11] extends object ? T_10[K_11] : T_10[K_11]) | undefined } : never : never : T_9[K_10]) | undefined } : never : never : T_8[K_9]) | undefined } : never : never : T_7[K_8]) | undefined } : never : never : T_6[K_7]) | undefined } : never : never : T_5[K_6]) | undefined } : never : never : T_4[K_5]) | undefined } : never : never : T_3[K_4]) | undefined } : never : never : T_2[K_2]) | undefined } : never : never : Omit<TResolvedConfig, "command" | "cwd" | "configFile" | "userConfig" | "inlineConfig" | "pluginConfig">["input"]) | undefined;
|
|
10
10
|
} & TResolvedConfig["pluginConfig"]) | ({
|
|
11
|
-
input: import("@stryke/types/configuration").TypeDefinition | import("@stryke/types/configuration").TypeDefinitionParameter[] | Record<string, import("@stryke/types/configuration").TypeDefinitionParameter | import("@stryke/types/configuration").TypeDefinitionParameter[]> | TResolvedConfig["input"] | (Omit<TResolvedConfig, "
|
|
11
|
+
input: import("@stryke/types/configuration").TypeDefinition | import("@stryke/types/configuration").TypeDefinitionParameter[] | Record<string, import("@stryke/types/configuration").TypeDefinitionParameter | import("@stryke/types/configuration").TypeDefinitionParameter[]> | TResolvedConfig["input"] | (Omit<TResolvedConfig, "command" | "cwd" | "configFile" | "userConfig" | "inlineConfig" | "pluginConfig">["input"] extends object ? Omit<TResolvedConfig, "command" | "cwd" | "configFile" | "userConfig" | "inlineConfig" | "pluginConfig">["input"] extends infer T_3 ? T_3 extends Omit<TResolvedConfig, "command" | "cwd" | "configFile" | "userConfig" | "inlineConfig" | "pluginConfig">["input"] ? T_3 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_3 : { [K_3 in keyof T_3]?: (T_3[K_3] extends object ? T_3[K_3] extends infer T_4 ? T_4 extends T_3[K_3] ? T_4 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_4 : { [K_5 in keyof T_4]?: (T_4[K_5] extends object ? T_4[K_5] extends infer T_5 ? T_5 extends T_4[K_5] ? T_5 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_5 : { [K_6 in keyof T_5]?: (T_5[K_6] extends object ? T_5[K_6] extends infer T_6 ? T_6 extends T_5[K_6] ? T_6 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_6 : { [K_7 in keyof T_6]?: (T_6[K_7] extends object ? T_6[K_7] extends infer T_7 ? T_7 extends T_6[K_7] ? T_7 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_7 : { [K_8 in keyof T_7]?: (T_7[K_8] extends object ? T_7[K_8] extends infer T_8 ? T_8 extends T_7[K_8] ? T_8 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_8 : { [K_9 in keyof T_8]?: (T_8[K_9] extends object ? T_8[K_9] extends infer T_9 ? T_9 extends T_8[K_9] ? T_9 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_9 : { [K_10 in keyof T_9]?: (T_9[K_10] extends object ? T_9[K_10] extends infer T_10 ? T_10 extends T_9[K_10] ? T_10 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_10 : { [K_11 in keyof T_10]?: (T_10[K_11] extends object ? T_10[K_11] extends infer T_11 ? T_11 extends T_10[K_11] ? T_11 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_11 : { [K_12 in keyof T_11]?: (T_11[K_12] extends object ? T_11[K_12] : T_11[K_12]) | undefined } : never : never : T_10[K_11]) | undefined } : never : never : T_9[K_10]) | undefined } : never : never : T_8[K_9]) | undefined } : never : never : T_7[K_8]) | undefined } : never : never : T_6[K_7]) | undefined } : never : never : T_5[K_6]) | undefined } : never : never : T_4[K_5]) | undefined } : never : never : T_3[K_3]) | undefined } : never : never : Omit<TResolvedConfig, "command" | "cwd" | "configFile" | "userConfig" | "inlineConfig" | "pluginConfig">["input"]) | undefined;
|
|
12
12
|
} & InferOverridableConfig<TResolvedConfig>);
|
|
13
13
|
declare function resolvePluginConfig<TResolvedConfig extends ResolvedConfig = ResolvedConfig, TSystemContext = unknown, TContext extends ExecutionContext<TResolvedConfig, TSystemContext> = ExecutionContext<TResolvedConfig, TSystemContext>>(context: TContext): Promise<void>;
|
|
14
14
|
//#endregion
|
|
@@ -2,13 +2,13 @@ import { ExecutionContext } from "../types/context.mjs";
|
|
|
2
2
|
import { InferOverridableConfig, ResolvedConfig } from "../types/config.mjs";
|
|
3
3
|
//#region src/lib/context-helpers.d.ts
|
|
4
4
|
declare function getConfigProps<TResolvedConfig extends ResolvedConfig>(config?: TResolvedConfig["userConfig"] | TResolvedConfig["inlineConfig"] | TResolvedConfig["pluginConfig"] | InferOverridableConfig<TResolvedConfig>): ({
|
|
5
|
-
input: import("@stryke/types/configuration").TypeDefinition | import("@stryke/types/configuration").TypeDefinitionParameter[] | Record<string, import("@stryke/types/configuration").TypeDefinitionParameter | import("@stryke/types/configuration").TypeDefinitionParameter[]> | TResolvedConfig["input"] | (Omit<TResolvedConfig, "
|
|
5
|
+
input: import("@stryke/types/configuration").TypeDefinition | import("@stryke/types/configuration").TypeDefinitionParameter[] | Record<string, import("@stryke/types/configuration").TypeDefinitionParameter | import("@stryke/types/configuration").TypeDefinitionParameter[]> | TResolvedConfig["input"] | (Omit<TResolvedConfig, "command" | "cwd" | "configFile" | "userConfig" | "inlineConfig" | "pluginConfig">["input"] extends object ? Omit<TResolvedConfig, "command" | "cwd" | "configFile" | "userConfig" | "inlineConfig" | "pluginConfig">["input"] extends infer T ? T extends Omit<TResolvedConfig, "command" | "cwd" | "configFile" | "userConfig" | "inlineConfig" | "pluginConfig">["input"] ? T extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T : { [K in keyof T]?: (T[K] extends object ? T[K] extends infer T_1 ? T_1 extends T[K] ? T_1 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_1 : { [K_2 in keyof T_1]?: (T_1[K_2] extends object ? T_1[K_2] extends infer T_2 ? T_2 extends T_1[K_2] ? T_2 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_2 : { [K_3 in keyof T_2]?: (T_2[K_3] extends object ? T_2[K_3] extends infer T_3 ? T_3 extends T_2[K_3] ? T_3 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_3 : { [K_4 in keyof T_3]?: (T_3[K_4] extends object ? T_3[K_4] extends infer T_4 ? T_4 extends T_3[K_4] ? T_4 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_4 : { [K_5 in keyof T_4]?: (T_4[K_5] extends object ? T_4[K_5] extends infer T_5 ? T_5 extends T_4[K_5] ? T_5 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_5 : { [K_6 in keyof T_5]?: (T_5[K_6] extends object ? T_5[K_6] extends infer T_6 ? T_6 extends T_5[K_6] ? T_6 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_6 : { [K_7 in keyof T_6]?: (T_6[K_7] extends object ? T_6[K_7] extends infer T_7 ? T_7 extends T_6[K_7] ? T_7 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_7 : { [K_8 in keyof T_7]?: (T_7[K_8] extends object ? T_7[K_8] extends infer T_8 ? T_8 extends T_7[K_8] ? T_8 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_8 : { [K_9 in keyof T_8]?: (T_8[K_9] extends object ? T_8[K_9] : T_8[K_9]) | undefined } : never : never : T_7[K_8]) | undefined } : never : never : T_6[K_7]) | undefined } : never : never : T_5[K_6]) | undefined } : never : never : T_4[K_5]) | undefined } : never : never : T_3[K_4]) | undefined } : never : never : T_2[K_3]) | undefined } : never : never : T_1[K_2]) | undefined } : never : never : T[K]) | undefined } : never : never : Omit<TResolvedConfig, "command" | "cwd" | "configFile" | "userConfig" | "inlineConfig" | "pluginConfig">["input"]) | undefined;
|
|
6
6
|
} & TResolvedConfig["userConfig"]) | ({
|
|
7
|
-
input: import("@stryke/types/configuration").TypeDefinition | import("@stryke/types/configuration").TypeDefinitionParameter[] | Record<string, import("@stryke/types/configuration").TypeDefinitionParameter | import("@stryke/types/configuration").TypeDefinitionParameter[]> | TResolvedConfig["input"] | (Omit<TResolvedConfig, "
|
|
7
|
+
input: import("@stryke/types/configuration").TypeDefinition | import("@stryke/types/configuration").TypeDefinitionParameter[] | Record<string, import("@stryke/types/configuration").TypeDefinitionParameter | import("@stryke/types/configuration").TypeDefinitionParameter[]> | TResolvedConfig["input"] | (Omit<TResolvedConfig, "command" | "cwd" | "configFile" | "userConfig" | "inlineConfig" | "pluginConfig">["input"] extends object ? Omit<TResolvedConfig, "command" | "cwd" | "configFile" | "userConfig" | "inlineConfig" | "pluginConfig">["input"] extends infer T_1 ? T_1 extends Omit<TResolvedConfig, "command" | "cwd" | "configFile" | "userConfig" | "inlineConfig" | "pluginConfig">["input"] ? T_1 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_1 : { [K_1 in keyof T_1]?: (T_1[K_1] extends object ? T_1[K_1] extends infer T_2 ? T_2 extends T_1[K_1] ? T_2 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_2 : { [K_3 in keyof T_2]?: (T_2[K_3] extends object ? T_2[K_3] extends infer T_3 ? T_3 extends T_2[K_3] ? T_3 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_3 : { [K_4 in keyof T_3]?: (T_3[K_4] extends object ? T_3[K_4] extends infer T_4 ? T_4 extends T_3[K_4] ? T_4 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_4 : { [K_5 in keyof T_4]?: (T_4[K_5] extends object ? T_4[K_5] extends infer T_5 ? T_5 extends T_4[K_5] ? T_5 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_5 : { [K_6 in keyof T_5]?: (T_5[K_6] extends object ? T_5[K_6] extends infer T_6 ? T_6 extends T_5[K_6] ? T_6 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_6 : { [K_7 in keyof T_6]?: (T_6[K_7] extends object ? T_6[K_7] extends infer T_7 ? T_7 extends T_6[K_7] ? T_7 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_7 : { [K_8 in keyof T_7]?: (T_7[K_8] extends object ? T_7[K_8] extends infer T_8 ? T_8 extends T_7[K_8] ? T_8 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_8 : { [K_9 in keyof T_8]?: (T_8[K_9] extends object ? T_8[K_9] extends infer T_9 ? T_9 extends T_8[K_9] ? T_9 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_9 : { [K_10 in keyof T_9]?: (T_9[K_10] extends object ? T_9[K_10] : T_9[K_10]) | undefined } : never : never : T_8[K_9]) | undefined } : never : never : T_7[K_8]) | undefined } : never : never : T_6[K_7]) | undefined } : never : never : T_5[K_6]) | undefined } : never : never : T_4[K_5]) | undefined } : never : never : T_3[K_4]) | undefined } : never : never : T_2[K_3]) | undefined } : never : never : T_1[K_1]) | undefined } : never : never : Omit<TResolvedConfig, "command" | "cwd" | "configFile" | "userConfig" | "inlineConfig" | "pluginConfig">["input"]) | undefined;
|
|
8
8
|
} & TResolvedConfig["inlineConfig"]) | ({
|
|
9
|
-
input: import("@stryke/types/configuration").TypeDefinition | import("@stryke/types/configuration").TypeDefinitionParameter[] | Record<string, import("@stryke/types/configuration").TypeDefinitionParameter | import("@stryke/types/configuration").TypeDefinitionParameter[]> | TResolvedConfig["input"] | (Omit<TResolvedConfig, "
|
|
9
|
+
input: import("@stryke/types/configuration").TypeDefinition | import("@stryke/types/configuration").TypeDefinitionParameter[] | Record<string, import("@stryke/types/configuration").TypeDefinitionParameter | import("@stryke/types/configuration").TypeDefinitionParameter[]> | TResolvedConfig["input"] | (Omit<TResolvedConfig, "command" | "cwd" | "configFile" | "userConfig" | "inlineConfig" | "pluginConfig">["input"] extends object ? Omit<TResolvedConfig, "command" | "cwd" | "configFile" | "userConfig" | "inlineConfig" | "pluginConfig">["input"] extends infer T_2 ? T_2 extends Omit<TResolvedConfig, "command" | "cwd" | "configFile" | "userConfig" | "inlineConfig" | "pluginConfig">["input"] ? T_2 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_2 : { [K_2 in keyof T_2]?: (T_2[K_2] extends object ? T_2[K_2] extends infer T_3 ? T_3 extends T_2[K_2] ? T_3 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_3 : { [K_4 in keyof T_3]?: (T_3[K_4] extends object ? T_3[K_4] extends infer T_4 ? T_4 extends T_3[K_4] ? T_4 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_4 : { [K_5 in keyof T_4]?: (T_4[K_5] extends object ? T_4[K_5] extends infer T_5 ? T_5 extends T_4[K_5] ? T_5 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_5 : { [K_6 in keyof T_5]?: (T_5[K_6] extends object ? T_5[K_6] extends infer T_6 ? T_6 extends T_5[K_6] ? T_6 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_6 : { [K_7 in keyof T_6]?: (T_6[K_7] extends object ? T_6[K_7] extends infer T_7 ? T_7 extends T_6[K_7] ? T_7 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_7 : { [K_8 in keyof T_7]?: (T_7[K_8] extends object ? T_7[K_8] extends infer T_8 ? T_8 extends T_7[K_8] ? T_8 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_8 : { [K_9 in keyof T_8]?: (T_8[K_9] extends object ? T_8[K_9] extends infer T_9 ? T_9 extends T_8[K_9] ? T_9 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_9 : { [K_10 in keyof T_9]?: (T_9[K_10] extends object ? T_9[K_10] extends infer T_10 ? T_10 extends T_9[K_10] ? T_10 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_10 : { [K_11 in keyof T_10]?: (T_10[K_11] extends object ? T_10[K_11] : T_10[K_11]) | undefined } : never : never : T_9[K_10]) | undefined } : never : never : T_8[K_9]) | undefined } : never : never : T_7[K_8]) | undefined } : never : never : T_6[K_7]) | undefined } : never : never : T_5[K_6]) | undefined } : never : never : T_4[K_5]) | undefined } : never : never : T_3[K_4]) | undefined } : never : never : T_2[K_2]) | undefined } : never : never : Omit<TResolvedConfig, "command" | "cwd" | "configFile" | "userConfig" | "inlineConfig" | "pluginConfig">["input"]) | undefined;
|
|
10
10
|
} & TResolvedConfig["pluginConfig"]) | ({
|
|
11
|
-
input: import("@stryke/types/configuration").TypeDefinition | import("@stryke/types/configuration").TypeDefinitionParameter[] | Record<string, import("@stryke/types/configuration").TypeDefinitionParameter | import("@stryke/types/configuration").TypeDefinitionParameter[]> | TResolvedConfig["input"] | (Omit<TResolvedConfig, "
|
|
11
|
+
input: import("@stryke/types/configuration").TypeDefinition | import("@stryke/types/configuration").TypeDefinitionParameter[] | Record<string, import("@stryke/types/configuration").TypeDefinitionParameter | import("@stryke/types/configuration").TypeDefinitionParameter[]> | TResolvedConfig["input"] | (Omit<TResolvedConfig, "command" | "cwd" | "configFile" | "userConfig" | "inlineConfig" | "pluginConfig">["input"] extends object ? Omit<TResolvedConfig, "command" | "cwd" | "configFile" | "userConfig" | "inlineConfig" | "pluginConfig">["input"] extends infer T_3 ? T_3 extends Omit<TResolvedConfig, "command" | "cwd" | "configFile" | "userConfig" | "inlineConfig" | "pluginConfig">["input"] ? T_3 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_3 : { [K_3 in keyof T_3]?: (T_3[K_3] extends object ? T_3[K_3] extends infer T_4 ? T_4 extends T_3[K_3] ? T_4 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_4 : { [K_5 in keyof T_4]?: (T_4[K_5] extends object ? T_4[K_5] extends infer T_5 ? T_5 extends T_4[K_5] ? T_5 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_5 : { [K_6 in keyof T_5]?: (T_5[K_6] extends object ? T_5[K_6] extends infer T_6 ? T_6 extends T_5[K_6] ? T_6 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_6 : { [K_7 in keyof T_6]?: (T_6[K_7] extends object ? T_6[K_7] extends infer T_7 ? T_7 extends T_6[K_7] ? T_7 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_7 : { [K_8 in keyof T_7]?: (T_7[K_8] extends object ? T_7[K_8] extends infer T_8 ? T_8 extends T_7[K_8] ? T_8 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_8 : { [K_9 in keyof T_8]?: (T_8[K_9] extends object ? T_8[K_9] extends infer T_9 ? T_9 extends T_8[K_9] ? T_9 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_9 : { [K_10 in keyof T_9]?: (T_9[K_10] extends object ? T_9[K_10] extends infer T_10 ? T_10 extends T_9[K_10] ? T_10 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_10 : { [K_11 in keyof T_10]?: (T_10[K_11] extends object ? T_10[K_11] extends infer T_11 ? T_11 extends T_10[K_11] ? T_11 extends import("@stryke/types/base").BrowserNativeObject | import("@stryke/types/base").NestedValue<object> ? T_11 : { [K_12 in keyof T_11]?: (T_11[K_12] extends object ? T_11[K_12] : T_11[K_12]) | undefined } : never : never : T_10[K_11]) | undefined } : never : never : T_9[K_10]) | undefined } : never : never : T_8[K_9]) | undefined } : never : never : T_7[K_8]) | undefined } : never : never : T_6[K_7]) | undefined } : never : never : T_5[K_6]) | undefined } : never : never : T_4[K_5]) | undefined } : never : never : T_3[K_3]) | undefined } : never : never : Omit<TResolvedConfig, "command" | "cwd" | "configFile" | "userConfig" | "inlineConfig" | "pluginConfig">["input"]) | undefined;
|
|
12
12
|
} & InferOverridableConfig<TResolvedConfig>);
|
|
13
13
|
declare function resolvePluginConfig<TResolvedConfig extends ResolvedConfig = ResolvedConfig, TSystemContext = unknown, TContext extends ExecutionContext<TResolvedConfig, TSystemContext> = ExecutionContext<TResolvedConfig, TSystemContext>>(context: TContext): Promise<void>;
|
|
14
14
|
//#endregion
|
package/dist/types/config.d.cts
CHANGED
|
@@ -521,7 +521,26 @@ interface UserConfig extends Config {
|
|
|
521
521
|
*/
|
|
522
522
|
singleBuild?: boolean;
|
|
523
523
|
}
|
|
524
|
-
type
|
|
524
|
+
type ConfigParams = BaseExecutionOptions & Pick<Required<UserConfig>, "mode"> & {
|
|
525
|
+
/**
|
|
526
|
+
* A string identifier for the Powerlines command being executed
|
|
527
|
+
*/
|
|
528
|
+
command: string;
|
|
529
|
+
};
|
|
530
|
+
type UserInputConfig<TUserConfig extends UserConfig = UserConfig> = DeepPartial<TUserConfig>;
|
|
531
|
+
type UserConfigFnObject<TUserConfig extends UserConfig = UserConfig> = (env: ConfigParams) => UserInputConfig<TUserConfig> | UserInputConfig<TUserConfig>[];
|
|
532
|
+
type UserConfigFnPromise<TUserConfig extends UserConfig = UserConfig> = (env: ConfigParams) => Promise<UserInputConfig<TUserConfig> | UserInputConfig<TUserConfig>[]>;
|
|
533
|
+
type UserConfigFn<TUserConfig extends UserConfig = UserConfig> = (env: ConfigParams) => UserInputConfig<TUserConfig> | UserInputConfig<TUserConfig>[] | Promise<UserInputConfig<TUserConfig> | UserInputConfig<TUserConfig>[]>;
|
|
534
|
+
type UserConfigExport<TUserConfig extends UserConfig = UserConfig> = UserInputConfig<TUserConfig> | UserInputConfig<TUserConfig>[] | Promise<UserInputConfig<TUserConfig> | UserInputConfig<TUserConfig>[]> | UserConfigFnObject<TUserConfig> | UserConfigFnPromise<TUserConfig> | UserConfigFn<TUserConfig>;
|
|
535
|
+
type ParsedUserConfig<TUserConfig extends UserConfig = UserConfig> = ResolvedConfig<UserInputConfig<TUserConfig>> & {
|
|
536
|
+
/**
|
|
537
|
+
* The path to the user configuration file, if it exists.
|
|
538
|
+
*
|
|
539
|
+
* @remarks
|
|
540
|
+
* This is typically the `powerlines.json`, `powerlines.config.js`, or `powerlines.config.ts` file in the project root.
|
|
541
|
+
*/
|
|
542
|
+
configFile?: ConfigLayer<UserInputConfig<TUserConfig>>["configFile"];
|
|
543
|
+
};
|
|
525
544
|
type InlineConfigPaths = {
|
|
526
545
|
/**
|
|
527
546
|
* The root directory of the project
|
|
@@ -594,44 +613,6 @@ type LintInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfi
|
|
|
594
613
|
type TestInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfig<TUserConfig>;
|
|
595
614
|
type DocsInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfig<TUserConfig>;
|
|
596
615
|
type DeployInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfig<TUserConfig>;
|
|
597
|
-
type ConfigParams = BaseExecutionOptions & Pick<Required<UserConfig>, "mode"> & {
|
|
598
|
-
/**
|
|
599
|
-
* A string identifier for the Powerlines command being executed
|
|
600
|
-
*/
|
|
601
|
-
command: string;
|
|
602
|
-
};
|
|
603
|
-
type UserConfigFn<TUserConfig extends UserConfig = UserConfig> = (params: ConfigParams) => MaybePromise<TUserConfig>;
|
|
604
|
-
type AnyOutputUserConfig = Partial<Omit<OutputConfig, "copy">> & {
|
|
605
|
-
/**
|
|
606
|
-
* The output configuration options to use for the build process
|
|
607
|
-
*/
|
|
608
|
-
copy?: Partial<OutputConfig>;
|
|
609
|
-
};
|
|
610
|
-
/**
|
|
611
|
-
* The configuration options for a Powerlines project, after being resolved and normalized by the configuration loading process.
|
|
612
|
-
*
|
|
613
|
-
* @remarks
|
|
614
|
-
* This type represents the final shape of the configuration object that will be used throughout the Powerlines processes. It includes all default values, resolved paths, and normalized options. It is expected to be used in `powerlines.config.ts` files and by plugins and build processes to access the configuration options in a consistent format.
|
|
615
|
-
*/
|
|
616
|
-
type AnyUserConfig<TUserConfig extends UserConfig = UserConfig> = (Partial<Omit<TUserConfig, "output" | "resolve">> & {
|
|
617
|
-
/**
|
|
618
|
-
* The output configuration options to use for the build process
|
|
619
|
-
*/
|
|
620
|
-
output?: Partial<AnyOutputUserConfig>;
|
|
621
|
-
/**
|
|
622
|
-
* Configuration for module resolution during processing of the source code
|
|
623
|
-
*/
|
|
624
|
-
resolve?: Partial<ResolveConfig>;
|
|
625
|
-
} & Record<string, any>) | UserConfigFn<TUserConfig> | AnyUserConfig<TUserConfig>[];
|
|
626
|
-
type ParsedUserConfig<TUserConfig extends UserConfig = UserConfig> = ResolvedConfig<AnyUserConfig<TUserConfig>> & {
|
|
627
|
-
/**
|
|
628
|
-
* The path to the user configuration file, if it exists.
|
|
629
|
-
*
|
|
630
|
-
* @remarks
|
|
631
|
-
* This is typically the `powerlines.json`, `powerlines.config.js`, or `powerlines.config.ts` file in the project root.
|
|
632
|
-
*/
|
|
633
|
-
configFile?: ConfigLayer<AnyUserConfig<TUserConfig>>["configFile"];
|
|
634
|
-
};
|
|
635
616
|
interface ResolvedEntryTypeDefinition extends TypeDefinition {
|
|
636
617
|
/**
|
|
637
618
|
* The user provided entry point in the source code
|
|
@@ -751,5 +732,5 @@ type EnvironmentResolvedConfig<TResolvedConfig extends ResolvedConfig$1 = Resolv
|
|
|
751
732
|
environment: ResolvedEnvironmentConfig;
|
|
752
733
|
};
|
|
753
734
|
//#endregion
|
|
754
|
-
export {
|
|
735
|
+
export { BaseExecutionOptions, BuildInlineConfig, CleanInlineConfig, Config, ConfigParams, CopyConfig, CreateInlineConfig, DeployInlineConfig, DocsInlineConfig, EnvironmentConfig, EnvironmentResolvedConfig, ExecutionOptions, FrameworkOptions, InferOverridableConfig, InlineConfig, InlineConfigPaths, LintInlineConfig, Mode, Options, OutputConfig, ParsedUserConfig, PartialPlugin, PartialPluginFactory, PluginConfig, PluginConfigObject, PluginConfigTuple, PluginFactory, PrepareInlineConfig, ProjectType, ResolveConfig, ResolvedAssetGlob, ResolvedConfig$1 as ResolvedConfig, ResolvedCopyConfig, ResolvedEntryTypeDefinition, ResolvedEnvironmentConfig, ResolvedOutputConfig, ResolvedResolveConfig, TestInlineConfig, TypesInlineConfig, UserConfig, UserConfigExport, UserConfigFn, UserConfigFnObject, UserConfigFnPromise, UserInputConfig, WorkspaceConfig };
|
|
755
736
|
//# sourceMappingURL=config.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.cts","names":[],"sources":["../../src/types/config.ts"],"mappings":";;;;;;;;;;;;;;;;;AA4CA;KAAY,eAAA,GAAkB,OAAA,CAAQ,oBAAA,IACpC,QAAA,CAAS,IAAA,CAAK,oBAAA;AAAA,KAEJ,aAAA,yBACc,aAAA,GAAgB,aAAA,qBAErC,OAAA,EAAS,QAAA,KAAa,YAAA,CAAa,MAAA,CAAO,QAAA,IAAY,MAAA,CAAO,QAAA;;;;KAKtD,iBAAA,kBACO,aAAA,GAAgB,aAAA,8BAErB,aAAA,CAAc,QAAA,EAAU,QAAA,GAAW,QAAA,KAAa,MAAA,CAAO,QAAA;;;;KAKzD,kBAAA,kBACO,aAAA,GAAgB,aAAA;EAI7B,MAAA,WAAiB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AA,GAAuB,QAAA,CACjC,IAAA,CAAK,YAAA,yBAEL,IAAA,CAAK,YAAA;EACH,IAAA,EAAM,kBAAA;AAAA;AAhFV;;;AAAA,KAsFY,gBAAA,qBACU,UAAA,GAAa,UAAA,4BACP,gBAAA,GAAmB,gBAAA,IAC3C,IAAA,CAAK,iBAAA,gBACP,IAAA,CACE,YAAA,CACE,WAAA;EA5FyD;;;EAAA,SA4GlD,UAAA,EAAY,YAAA,CAAa,WAAA;EA3GxB;;;EAAA,SAgHD,YAAA,EAAc,YAAA,CAAa,YAAA,CAAa,WAAA;EAhHnD;;;EAAA,SAqHW,YAAA,EAAc,YAAA,CAAa,WAAA,CAAY,WAAA;EAnHxC;;;EAAA,SAwHC,OAAA,EAAS,YAAA,CAAa,YAAA,CAAa,WAAA;EAxHe;;;;;;EAAA,SAgIlD,UAAA;EAhIkD;;;EAqI3D,MAAA,EAAQ,oBAAA;EApIc;AAE1B;;EAuII,OAAA,EAAS,qBAAA;EAvIoC;;;;;;;;;;EAmJ7C,iBAAA,EAAmB,kBAAA;EAlJG;AAAA;AAE1B;;;;EAwJI,QAAA,EAAU,sBAAA;AAAA;AAAA,KAGF,sBAAA,yBACc,gBAAA,GAAiB,gBAAA,IACvC,WAAA,CACF,IAAA,CACE,eAAA;;;;KAaQ,yBAAA,yBACc,gBAAA,GAAiB,gBAAA,IACvC,eAAA;EA9K0D;;;;AACpC;AAE1B;EAH8D,SAqLnD,iBAAA,EAAmB,YAAA,CAAa,iBAAA;EAlLf;;;EAuL1B,WAAA,EAAa,yBAAA;AAAA"}
|
package/dist/types/config.d.mts
CHANGED
|
@@ -521,7 +521,26 @@ interface UserConfig extends Config {
|
|
|
521
521
|
*/
|
|
522
522
|
singleBuild?: boolean;
|
|
523
523
|
}
|
|
524
|
-
type
|
|
524
|
+
type ConfigParams = BaseExecutionOptions & Pick<Required<UserConfig>, "mode"> & {
|
|
525
|
+
/**
|
|
526
|
+
* A string identifier for the Powerlines command being executed
|
|
527
|
+
*/
|
|
528
|
+
command: string;
|
|
529
|
+
};
|
|
530
|
+
type UserInputConfig<TUserConfig extends UserConfig = UserConfig> = DeepPartial<TUserConfig>;
|
|
531
|
+
type UserConfigFnObject<TUserConfig extends UserConfig = UserConfig> = (env: ConfigParams) => UserInputConfig<TUserConfig> | UserInputConfig<TUserConfig>[];
|
|
532
|
+
type UserConfigFnPromise<TUserConfig extends UserConfig = UserConfig> = (env: ConfigParams) => Promise<UserInputConfig<TUserConfig> | UserInputConfig<TUserConfig>[]>;
|
|
533
|
+
type UserConfigFn<TUserConfig extends UserConfig = UserConfig> = (env: ConfigParams) => UserInputConfig<TUserConfig> | UserInputConfig<TUserConfig>[] | Promise<UserInputConfig<TUserConfig> | UserInputConfig<TUserConfig>[]>;
|
|
534
|
+
type UserConfigExport<TUserConfig extends UserConfig = UserConfig> = UserInputConfig<TUserConfig> | UserInputConfig<TUserConfig>[] | Promise<UserInputConfig<TUserConfig> | UserInputConfig<TUserConfig>[]> | UserConfigFnObject<TUserConfig> | UserConfigFnPromise<TUserConfig> | UserConfigFn<TUserConfig>;
|
|
535
|
+
type ParsedUserConfig<TUserConfig extends UserConfig = UserConfig> = ResolvedConfig<UserInputConfig<TUserConfig>> & {
|
|
536
|
+
/**
|
|
537
|
+
* The path to the user configuration file, if it exists.
|
|
538
|
+
*
|
|
539
|
+
* @remarks
|
|
540
|
+
* This is typically the `powerlines.json`, `powerlines.config.js`, or `powerlines.config.ts` file in the project root.
|
|
541
|
+
*/
|
|
542
|
+
configFile?: ConfigLayer<UserInputConfig<TUserConfig>>["configFile"];
|
|
543
|
+
};
|
|
525
544
|
type InlineConfigPaths = {
|
|
526
545
|
/**
|
|
527
546
|
* The root directory of the project
|
|
@@ -594,44 +613,6 @@ type LintInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfi
|
|
|
594
613
|
type TestInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfig<TUserConfig>;
|
|
595
614
|
type DocsInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfig<TUserConfig>;
|
|
596
615
|
type DeployInlineConfig<TUserConfig extends UserConfig = UserConfig> = InlineConfig<TUserConfig>;
|
|
597
|
-
type ConfigParams = BaseExecutionOptions & Pick<Required<UserConfig>, "mode"> & {
|
|
598
|
-
/**
|
|
599
|
-
* A string identifier for the Powerlines command being executed
|
|
600
|
-
*/
|
|
601
|
-
command: string;
|
|
602
|
-
};
|
|
603
|
-
type UserConfigFn<TUserConfig extends UserConfig = UserConfig> = (params: ConfigParams) => MaybePromise<TUserConfig>;
|
|
604
|
-
type AnyOutputUserConfig = Partial<Omit<OutputConfig, "copy">> & {
|
|
605
|
-
/**
|
|
606
|
-
* The output configuration options to use for the build process
|
|
607
|
-
*/
|
|
608
|
-
copy?: Partial<OutputConfig>;
|
|
609
|
-
};
|
|
610
|
-
/**
|
|
611
|
-
* The configuration options for a Powerlines project, after being resolved and normalized by the configuration loading process.
|
|
612
|
-
*
|
|
613
|
-
* @remarks
|
|
614
|
-
* This type represents the final shape of the configuration object that will be used throughout the Powerlines processes. It includes all default values, resolved paths, and normalized options. It is expected to be used in `powerlines.config.ts` files and by plugins and build processes to access the configuration options in a consistent format.
|
|
615
|
-
*/
|
|
616
|
-
type AnyUserConfig<TUserConfig extends UserConfig = UserConfig> = (Partial<Omit<TUserConfig, "output" | "resolve">> & {
|
|
617
|
-
/**
|
|
618
|
-
* The output configuration options to use for the build process
|
|
619
|
-
*/
|
|
620
|
-
output?: Partial<AnyOutputUserConfig>;
|
|
621
|
-
/**
|
|
622
|
-
* Configuration for module resolution during processing of the source code
|
|
623
|
-
*/
|
|
624
|
-
resolve?: Partial<ResolveConfig>;
|
|
625
|
-
} & Record<string, any>) | UserConfigFn<TUserConfig> | AnyUserConfig<TUserConfig>[];
|
|
626
|
-
type ParsedUserConfig<TUserConfig extends UserConfig = UserConfig> = ResolvedConfig<AnyUserConfig<TUserConfig>> & {
|
|
627
|
-
/**
|
|
628
|
-
* The path to the user configuration file, if it exists.
|
|
629
|
-
*
|
|
630
|
-
* @remarks
|
|
631
|
-
* This is typically the `powerlines.json`, `powerlines.config.js`, or `powerlines.config.ts` file in the project root.
|
|
632
|
-
*/
|
|
633
|
-
configFile?: ConfigLayer<AnyUserConfig<TUserConfig>>["configFile"];
|
|
634
|
-
};
|
|
635
616
|
interface ResolvedEntryTypeDefinition extends TypeDefinition {
|
|
636
617
|
/**
|
|
637
618
|
* The user provided entry point in the source code
|
|
@@ -751,5 +732,5 @@ type EnvironmentResolvedConfig<TResolvedConfig extends ResolvedConfig$1 = Resolv
|
|
|
751
732
|
environment: ResolvedEnvironmentConfig;
|
|
752
733
|
};
|
|
753
734
|
//#endregion
|
|
754
|
-
export {
|
|
735
|
+
export { BaseExecutionOptions, BuildInlineConfig, CleanInlineConfig, Config, ConfigParams, CopyConfig, CreateInlineConfig, DeployInlineConfig, DocsInlineConfig, EnvironmentConfig, EnvironmentResolvedConfig, ExecutionOptions, FrameworkOptions, InferOverridableConfig, InlineConfig, InlineConfigPaths, LintInlineConfig, Mode, Options, OutputConfig, ParsedUserConfig, PartialPlugin, PartialPluginFactory, PluginConfig, PluginConfigObject, PluginConfigTuple, PluginFactory, PrepareInlineConfig, ProjectType, ResolveConfig, ResolvedAssetGlob, ResolvedConfig$1 as ResolvedConfig, ResolvedCopyConfig, ResolvedEntryTypeDefinition, ResolvedEnvironmentConfig, ResolvedOutputConfig, ResolvedResolveConfig, TestInlineConfig, TypesInlineConfig, UserConfig, UserConfigExport, UserConfigFn, UserConfigFnObject, UserConfigFnPromise, UserInputConfig, WorkspaceConfig };
|
|
755
736
|
//# sourceMappingURL=config.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.mts","names":[],"sources":["../../src/types/config.ts"],"mappings":";;;;;;;;;;;;;;;;;AA4CA;KAAY,eAAA,GAAkB,OAAA,CAAQ,oBAAA,IACpC,QAAA,CAAS,IAAA,CAAK,oBAAA;AAAA,KAEJ,aAAA,yBACc,aAAA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a,yBAAA;AAAA"}
|
package/dist/types/index.d.cts
CHANGED
|
@@ -6,4 +6,4 @@ import { CallHookOptions, HookListOrders, HooksList, HooksListItem, InferHookFun
|
|
|
6
6
|
import { CustomLogger, CustomLoggerMessage, LogCategory, LogFn, LogFnMeta, LogFnOptions, LogLevel, LogLevelResolvedConfig, LogLevelUserConfig, LogMessage, LogMeta, Logger, LoggerMessage, LoggerMeta, LoggerOptions, PowerlinesMessage } from "./logging.cjs";
|
|
7
7
|
import { DeepkitOptions, Level, ParsedTypeScriptConfig, RawReflectionMode, ReflectionMode, TSCompilerOptions, TSConfig } from "./tsconfig.cjs";
|
|
8
8
|
import { BaseContext, BuildPluginContext, Context, EmitEntryOptions, EmitOptions, EnvironmentContext, EnvironmentPlugin, ExecutionContext, FetchOptions, InitContextOptions, MetaInfo, ParseOptions, PluginContext, ResolveResult, Resolver, SelectHookResult, SelectHookResultItem, SelectHooksOptions, SourceFile, TransformResult, UnimportContext, UnresolvedContext, WithUnpluginBuildContext } from "./context.cjs";
|
|
9
|
-
import {
|
|
9
|
+
import { BaseExecutionOptions, BuildInlineConfig, CleanInlineConfig, Config, ConfigParams, CopyConfig, CreateInlineConfig, DeployInlineConfig, DocsInlineConfig, EnvironmentConfig, EnvironmentResolvedConfig, ExecutionOptions, FrameworkOptions, InferOverridableConfig, InlineConfig, InlineConfigPaths, LintInlineConfig, Mode, Options, OutputConfig, ParsedUserConfig, PartialPlugin, PartialPluginFactory, PluginConfig, PluginConfigObject, PluginConfigTuple, PluginFactory, PrepareInlineConfig, ProjectType, ResolveConfig, ResolvedAssetGlob, ResolvedConfig, ResolvedCopyConfig, ResolvedEntryTypeDefinition, ResolvedEnvironmentConfig, ResolvedOutputConfig, ResolvedResolveConfig, TestInlineConfig, TypesInlineConfig, UserConfig, UserConfigExport, UserConfigFn, UserConfigFnObject, UserConfigFnPromise, UserInputConfig, WorkspaceConfig } from "./config.cjs";
|
package/dist/types/index.d.mts
CHANGED
|
@@ -6,4 +6,4 @@ import { CallHookOptions, HookListOrders, HooksList, HooksListItem, InferHookFun
|
|
|
6
6
|
import { CustomLogger, CustomLoggerMessage, LogCategory, LogFn, LogFnMeta, LogFnOptions, LogLevel, LogLevelResolvedConfig, LogLevelUserConfig, LogMessage, LogMeta, Logger, LoggerMessage, LoggerMeta, LoggerOptions, PowerlinesMessage } from "./logging.mjs";
|
|
7
7
|
import { DeepkitOptions, Level, ParsedTypeScriptConfig, RawReflectionMode, ReflectionMode, TSCompilerOptions, TSConfig } from "./tsconfig.mjs";
|
|
8
8
|
import { BaseContext, BuildPluginContext, Context, EmitEntryOptions, EmitOptions, EnvironmentContext, EnvironmentPlugin, ExecutionContext, FetchOptions, InitContextOptions, MetaInfo, ParseOptions, PluginContext, ResolveResult, Resolver, SelectHookResult, SelectHookResultItem, SelectHooksOptions, SourceFile, TransformResult, UnimportContext, UnresolvedContext, WithUnpluginBuildContext } from "./context.mjs";
|
|
9
|
-
import {
|
|
9
|
+
import { BaseExecutionOptions, BuildInlineConfig, CleanInlineConfig, Config, ConfigParams, CopyConfig, CreateInlineConfig, DeployInlineConfig, DocsInlineConfig, EnvironmentConfig, EnvironmentResolvedConfig, ExecutionOptions, FrameworkOptions, InferOverridableConfig, InlineConfig, InlineConfigPaths, LintInlineConfig, Mode, Options, OutputConfig, ParsedUserConfig, PartialPlugin, PartialPluginFactory, PluginConfig, PluginConfigObject, PluginConfigTuple, PluginFactory, PrepareInlineConfig, ProjectType, ResolveConfig, ResolvedAssetGlob, ResolvedConfig, ResolvedCopyConfig, ResolvedEntryTypeDefinition, ResolvedEnvironmentConfig, ResolvedOutputConfig, ResolvedResolveConfig, TestInlineConfig, TypesInlineConfig, UserConfig, UserConfigExport, UserConfigFn, UserConfigFnObject, UserConfigFnPromise, UserInputConfig, WorkspaceConfig } from "./config.mjs";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/core",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.26",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "An internal core package for Powerlines - please use the `powerlines` package for public usage.",
|
|
6
6
|
"homepage": "https://stormsoftware.com",
|
|
@@ -327,8 +327,8 @@
|
|
|
327
327
|
"@donedeal0/superdiff": "^3.2.0",
|
|
328
328
|
"@jridgewell/sourcemap-codec": "^1.5.5",
|
|
329
329
|
"@rolldown/pluginutils": "1.0.0-rc.18",
|
|
330
|
-
"@storm-software/config": "^1.137.
|
|
331
|
-
"@storm-software/config-tools": "^1.190.
|
|
330
|
+
"@storm-software/config": "^1.137.53",
|
|
331
|
+
"@storm-software/config-tools": "^1.190.21",
|
|
332
332
|
"@stryke/capnp": "^0.12.102",
|
|
333
333
|
"@stryke/convert": "^0.7.7",
|
|
334
334
|
"@stryke/env": "^0.20.93",
|
|
@@ -362,11 +362,11 @@
|
|
|
362
362
|
"unplugin-combine": "^2.4.0"
|
|
363
363
|
},
|
|
364
364
|
"devDependencies": {
|
|
365
|
-
"@storm-software/testing-tools": "^1.119.
|
|
365
|
+
"@storm-software/testing-tools": "^1.119.174",
|
|
366
366
|
"@stryke/types": "^0.12.4",
|
|
367
367
|
"@types/bun": "^1.3.14",
|
|
368
368
|
"@types/diff-match-patch": "^1.0.36",
|
|
369
|
-
"@types/node": "^25.9.
|
|
369
|
+
"@types/node": "^25.9.1",
|
|
370
370
|
"@types/semver": "^7.7.1",
|
|
371
371
|
"bun-types-no-globals": "^1.3.11",
|
|
372
372
|
"prettier-plugin-organize-imports": "^4.3.0",
|
|
@@ -375,5 +375,5 @@
|
|
|
375
375
|
"undici-types": "^7.25.0"
|
|
376
376
|
},
|
|
377
377
|
"publishConfig": { "access": "public" },
|
|
378
|
-
"gitHead": "
|
|
378
|
+
"gitHead": "830de55572504e17339908e5379e3725c56e42e9"
|
|
379
379
|
}
|