@powerlines/plugin-env 0.15.9 → 0.15.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/dist/babel/index.cjs +3 -1
  2. package/dist/babel/index.d.cts +2 -1
  3. package/dist/babel/index.d.mts +2 -1
  4. package/dist/babel/index.mjs +1 -1
  5. package/dist/babel/plugin.cjs +7 -7
  6. package/dist/babel/plugin.mjs +6 -6
  7. package/dist/components/docs.cjs +4 -4
  8. package/dist/components/docs.mjs +3 -3
  9. package/dist/components/env.cjs +8 -8
  10. package/dist/components/env.mjs +6 -6
  11. package/dist/components/index.cjs +1 -1
  12. package/dist/components/index.mjs +1 -1
  13. package/dist/deepkit/src/utilities.cjs +2 -2
  14. package/dist/deepkit/src/utilities.mjs +2 -2
  15. package/dist/helpers/automd-generator.d.cts +14 -0
  16. package/dist/helpers/automd-generator.d.mts +14 -0
  17. package/dist/helpers/create-reflection-resource.cjs +5 -5
  18. package/dist/helpers/create-reflection-resource.d.cts +2 -2
  19. package/dist/helpers/create-reflection-resource.d.mts +2 -2
  20. package/dist/helpers/create-reflection-resource.mjs +1 -1
  21. package/dist/helpers/index.cjs +33 -6
  22. package/dist/helpers/index.d.cts +2 -1
  23. package/dist/helpers/index.d.mts +2 -1
  24. package/dist/helpers/index.mjs +2 -2
  25. package/dist/helpers/load.cjs +5 -5
  26. package/dist/helpers/load.mjs +7 -7
  27. package/dist/helpers/persistence.cjs +7 -7
  28. package/dist/helpers/persistence.mjs +3 -3
  29. package/dist/helpers/reflect.cjs +6 -6
  30. package/dist/helpers/reflect.mjs +1 -1
  31. package/dist/helpers/source-file-env.cjs +1 -1
  32. package/dist/helpers/source-file-env.mjs +1 -1
  33. package/dist/helpers/template-helpers.cjs +2 -2
  34. package/dist/index.cjs +68 -68
  35. package/dist/index.d.cts +5 -5
  36. package/dist/index.d.mts +5 -5
  37. package/dist/index.mjs +14 -14
  38. package/dist/plugin-alloy/src/core/components/output.cjs +2 -2
  39. package/dist/plugin-alloy/src/core/components/output.mjs +2 -2
  40. package/dist/plugin-alloy/src/core/components/single-line-comment.cjs +1 -1
  41. package/dist/plugin-alloy/src/core/components/single-line-comment.mjs +1 -1
  42. package/dist/plugin-alloy/src/core/components/source-file.cjs +3 -3
  43. package/dist/plugin-alloy/src/core/components/source-file.mjs +3 -3
  44. package/dist/plugin-alloy/src/index.cjs +14 -7
  45. package/dist/plugin-alloy/src/index.mjs +14 -7
  46. package/dist/plugin-alloy/src/markdown/components/markdown-file.cjs +2 -2
  47. package/dist/plugin-alloy/src/markdown/components/markdown-file.mjs +2 -2
  48. package/dist/plugin-alloy/src/markdown/components/markdown-table.cjs +2 -2
  49. package/dist/plugin-alloy/src/markdown/components/markdown-table.mjs +2 -2
  50. package/dist/plugin-alloy/src/types/components.d.cts +1 -3
  51. package/dist/plugin-alloy/src/types/components.d.mts +2 -3
  52. package/dist/plugin-alloy/src/types/plugin.cjs +1 -1
  53. package/dist/plugin-alloy/src/types/plugin.d.cts +2 -2
  54. package/dist/plugin-alloy/src/types/plugin.d.mts +2 -2
  55. package/dist/plugin-alloy/src/types/plugin.mjs +1 -1
  56. package/dist/plugin-alloy/src/typescript/components/builtin-file.cjs +2 -2
  57. package/dist/plugin-alloy/src/typescript/components/builtin-file.mjs +2 -2
  58. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.cjs +5 -5
  59. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.mjs +5 -5
  60. package/dist/plugin-alloy/src/typescript/components/tsdoc.cjs +2 -2
  61. package/dist/plugin-alloy/src/typescript/components/tsdoc.mjs +2 -2
  62. package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +20 -14
  63. package/dist/plugin-alloy/src/typescript/components/typescript-file.d.cts +1 -0
  64. package/dist/plugin-alloy/src/typescript/components/typescript-file.d.mts +1 -0
  65. package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +20 -14
  66. package/dist/plugin-alloy/src/typescript/components/typescript-interface.cjs +2 -2
  67. package/dist/plugin-alloy/src/typescript/components/typescript-interface.d.cts +1 -1
  68. package/dist/plugin-alloy/src/typescript/components/typescript-interface.mjs +2 -2
  69. package/dist/plugin-alloy/src/typescript/components/typescript-object.cjs +4 -4
  70. package/dist/plugin-alloy/src/typescript/components/typescript-object.mjs +4 -4
  71. package/dist/plugin-automd/src/index.cjs +5 -5
  72. package/dist/plugin-automd/src/index.mjs +6 -6
  73. package/dist/plugin-automd/src/types/plugin.d.mts +2 -2
  74. package/dist/plugin-babel/src/helpers/create-plugin.cjs +1 -1
  75. package/dist/plugin-babel/src/helpers/create-plugin.mjs +1 -1
  76. package/dist/plugin-babel/src/helpers/filters.cjs +1 -1
  77. package/dist/plugin-babel/src/helpers/filters.mjs +1 -1
  78. package/dist/plugin-babel/src/helpers/index.cjs +3 -3
  79. package/dist/plugin-babel/src/helpers/index.mjs +3 -3
  80. package/dist/plugin-babel/src/helpers/module-helpers.cjs +1 -1
  81. package/dist/plugin-babel/src/helpers/module-helpers.mjs +1 -1
  82. package/dist/plugin-babel/src/helpers/options.cjs +1 -1
  83. package/dist/plugin-babel/src/helpers/options.mjs +1 -1
  84. package/dist/plugin-babel/src/index.cjs +8 -11
  85. package/dist/plugin-babel/src/index.mjs +6 -9
  86. package/dist/plugin-babel/src/types/plugin.cjs +1 -1
  87. package/dist/plugin-babel/src/types/plugin.d.cts +2 -2
  88. package/dist/plugin-babel/src/types/plugin.d.mts +2 -2
  89. package/dist/plugin-babel/src/types/plugin.mjs +1 -1
  90. package/dist/powerlines/src/api.d.mts +2 -2
  91. package/dist/powerlines/src/index.d.mts +9 -6
  92. package/dist/powerlines/src/internal/helpers/hooks.cjs +39 -21
  93. package/dist/powerlines/src/internal/helpers/hooks.d.cts +47 -0
  94. package/dist/powerlines/src/internal/helpers/hooks.d.mts +47 -3
  95. package/dist/powerlines/src/internal/helpers/hooks.mjs +39 -22
  96. package/dist/powerlines/src/lib/build/esbuild.cjs +2 -2
  97. package/dist/powerlines/src/lib/build/esbuild.mjs +2 -2
  98. package/dist/powerlines/src/lib/entry.cjs +6 -6
  99. package/dist/powerlines/src/lib/entry.mjs +6 -6
  100. package/dist/powerlines/src/lib/logger.cjs +2 -2
  101. package/dist/powerlines/src/lib/logger.mjs +2 -2
  102. package/dist/powerlines/src/lib/utilities/resolve.cjs +1 -1
  103. package/dist/powerlines/src/lib/utilities/resolve.mjs +1 -1
  104. package/dist/powerlines/src/types/api.cjs +62 -1
  105. package/dist/powerlines/src/types/api.d.cts +104 -0
  106. package/dist/powerlines/src/types/api.d.mts +104 -5
  107. package/dist/powerlines/src/types/api.mjs +61 -2
  108. package/dist/powerlines/src/types/babel.d.cts +1 -1
  109. package/dist/powerlines/src/types/babel.d.mts +1 -1
  110. package/dist/powerlines/src/types/build.cjs +26 -4
  111. package/dist/powerlines/src/types/build.d.cts +43 -3
  112. package/dist/powerlines/src/types/build.d.mts +42 -4
  113. package/dist/powerlines/src/types/build.mjs +23 -3
  114. package/dist/powerlines/src/types/config.cjs +107 -0
  115. package/dist/powerlines/src/types/config.d.cts +64 -8
  116. package/dist/powerlines/src/types/config.d.mts +65 -9
  117. package/dist/powerlines/src/types/config.mjs +99 -1
  118. package/dist/powerlines/src/types/context.cjs +57 -0
  119. package/dist/powerlines/src/types/context.d.cts +114 -2
  120. package/dist/powerlines/src/types/context.d.mts +114 -4
  121. package/dist/powerlines/src/types/context.mjs +54 -1
  122. package/dist/powerlines/src/types/fs.d.cts +1 -1
  123. package/dist/powerlines/src/types/fs.d.mts +1 -1
  124. package/dist/powerlines/src/types/hooks.cjs +33 -14
  125. package/dist/powerlines/src/types/hooks.d.cts +32 -0
  126. package/dist/powerlines/src/types/hooks.d.mts +32 -2
  127. package/dist/powerlines/src/types/hooks.mjs +32 -12
  128. package/dist/powerlines/src/types/index.cjs +5 -5
  129. package/dist/powerlines/src/types/index.d.mts +9 -9
  130. package/dist/powerlines/src/types/index.mjs +8 -8
  131. package/dist/powerlines/src/types/plugin.cjs +40 -105
  132. package/dist/powerlines/src/types/plugin.d.cts +37 -63
  133. package/dist/powerlines/src/types/plugin.d.mts +37 -63
  134. package/dist/powerlines/src/types/plugin.mjs +40 -102
  135. package/dist/powerlines/src/types/resolved.d.cts +17 -5
  136. package/dist/powerlines/src/types/resolved.d.mts +17 -6
  137. package/dist/powerlines/src/types/unplugin.cjs +47 -1
  138. package/dist/powerlines/src/types/unplugin.d.cts +22 -0
  139. package/dist/powerlines/src/types/unplugin.d.mts +22 -6
  140. package/dist/powerlines/src/types/unplugin.mjs +45 -2
  141. package/dist/types/plugin.cjs +8 -8
  142. package/dist/types/plugin.d.mts +1 -1
  143. package/dist/types/plugin.mjs +2 -2
  144. package/package.json +9 -9
@@ -1,6 +1,6 @@
1
+ const require_context = require('../../../powerlines/src/types/context.cjs');
1
2
  const require_config = require('../../../powerlines/src/types/config.cjs');
2
3
  const require_resolved = require('../../../powerlines/src/types/resolved.cjs');
3
- const require_context = require('../../../powerlines/src/types/context.cjs');
4
4
 
5
5
  //#region ../plugin-babel/src/types/plugin.ts
6
6
  const __ΩPartial = [
@@ -1,6 +1,6 @@
1
- import { PluginContext } from "../../../powerlines/src/types/context.cjs";
2
- import { BabelUserConfig, UserConfig } from "../../../powerlines/src/types/config.cjs";
3
1
  import { BabelResolvedConfig, ResolvedConfig } from "../../../powerlines/src/types/resolved.cjs";
2
+ import { BabelUserConfig, UserConfig } from "../../../powerlines/src/types/config.cjs";
3
+ import { PluginContext } from "../../../powerlines/src/types/context.cjs";
4
4
 
5
5
  //#region ../plugin-babel/src/types/plugin.d.ts
6
6
  type BabelPluginOptions = Partial<BabelUserConfig>;
@@ -1,6 +1,6 @@
1
- import { PluginContext } from "../../../powerlines/src/types/context.mjs";
2
- import { BabelUserConfig, UserConfig } from "../../../powerlines/src/types/config.mjs";
3
1
  import { BabelResolvedConfig, ResolvedConfig } from "../../../powerlines/src/types/resolved.mjs";
2
+ import { BabelUserConfig, UserConfig } from "../../../powerlines/src/types/config.mjs";
3
+ import { PluginContext } from "../../../powerlines/src/types/context.mjs";
4
4
 
5
5
  //#region ../plugin-babel/src/types/plugin.d.ts
6
6
  type BabelPluginOptions = Partial<BabelUserConfig>;
@@ -1,6 +1,6 @@
1
+ import { __ΩPluginContext } from "../../../powerlines/src/types/context.mjs";
1
2
  import { __ΩBabelUserConfig, __ΩUserConfig } from "../../../powerlines/src/types/config.mjs";
2
3
  import { __ΩBabelResolvedConfig, __ΩResolvedConfig } from "../../../powerlines/src/types/resolved.mjs";
3
- import { __ΩPluginContext } from "../../../powerlines/src/types/context.mjs";
4
4
 
5
5
  //#region ../plugin-babel/src/types/plugin.ts
6
6
  const __ΩPartial = [
@@ -1,7 +1,7 @@
1
+ import "./types/resolved.mjs";
2
+ import "./types/config.mjs";
1
3
  import "./types/hooks.mjs";
2
4
  import "./types/context.mjs";
3
- import "./types/config.mjs";
4
- import "./types/resolved.mjs";
5
5
  import "./internal/helpers/hooks.mjs";
6
6
  import "./types/api.mjs";
7
7
  import "./types/index.mjs";
@@ -1,12 +1,15 @@
1
+ import { BabelPluginPass, BabelTransformPlugin, BabelTransformPluginFilter, BabelTransformPluginOptions, DeclareBabelTransformPluginReturn } from "./types/babel.mjs";
2
+ import { BuildConfig, BuildResolvedConfig, BuilderVariant, ESBuildBuildConfig, ESBuildResolvedBuildConfig, FarmBuildConfig, FarmResolvedBuildConfig, InferUnpluginVariant, RolldownBuildConfig, RolldownResolvedBuildConfig, RollupBuildConfig, RollupBuildOutputConfig, RollupResolvedBuildConfig, RspackBuildConfig, RspackResolvedBuildConfig, TsdownBuildConfig, TsdownResolvedBuildConfig, TsupBuildConfig, TsupResolvedBuildConfig, UnbuildBuildConfig, UnbuildResolvedBuildConfig, UnpluginBuilderVariant, ViteBuildConfig, ViteResolvedBuildConfig, WebpackBuildConfig, WebpackResolvedBuildConfig } from "./types/build.mjs";
1
3
  import { ResolveOptions, StorageAdapter, StoragePort, StoragePreset, VirtualFile, VirtualFileData, VirtualFileMetadata, VirtualFileSystemInterface, WriteOptions } from "./types/fs.mjs";
2
- import { BuildConfig, BuildResolvedConfig, UnpluginBuildVariant } from "./types/build.mjs";
3
4
  import { CommandType, SUPPORTED_COMMANDS } from "./types/commands.mjs";
4
- import { BasePluginHookFunctions, BuildPlugin, ConfigResult, Plugin, PluginBuildPlugins, PluginHook, PluginHookObject, PluginHooks, TypesResult } from "./types/plugin.mjs";
5
+ import { BabelResolvedConfig, ESBuildResolvedConfig, EnvironmentResolvedConfig, FarmResolvedConfig, InferResolvedConfig, OutputResolvedConfig, ResolvedAssetGlob, ResolvedConfig, ResolvedEntryTypeDefinition, RolldownResolvedConfig, RollupResolvedConfig, RspackResolvedConfig, TsdownResolvedConfig, TsupResolvedConfig, UnbuildResolvedConfig, ViteResolvedConfig, WebpackResolvedConfig } from "./types/resolved.mjs";
6
+ import { InferUnpluginOptions, UnpluginOptions } from "./types/unplugin.mjs";
7
+ import { Plugin, PluginHook, PluginHookFields, PluginHookFunctions, PluginHookObject, PluginHooks, TypesResult } from "./types/plugin.mjs";
5
8
  import { DeepkitOptions, ParsedTypeScriptConfig, RawReflectionMode, ReflectionLevel, ReflectionMode, TSCompilerOptions, TSConfig } from "./types/tsconfig.mjs";
6
- import { BuildPluginContext, Context, EmitEntryOptions, EmitOptions, FetchOptions, InitContextOptions, LogLevel, MetaInfo, ParseOptions, PluginContext, Resolver, TransformResult, UnresolvedContext } from "./types/context.mjs";
7
- import { BabelPluginPass, BabelTransformPlugin, BabelTransformPluginFilter, BabelTransformPluginOptions, DeclareBabelTransformPluginReturn } from "./types/babel.mjs";
8
- import { BabelUserConfig, BaseConfig, CommonUserConfig, DeployConfig, EnvironmentConfig, InlineConfig, LogFn, OutputConfig, PluginConfig, PluginConfigObject, PluginConfigTuple, PluginFactory, PowerlinesCommand, ProjectType, UserConfig, WorkspaceConfig } from "./types/config.mjs";
9
- import { BabelResolvedConfig, EnvironmentResolvedConfig, OutputResolvedConfig, ResolvedAssetGlob, ResolvedConfig, ResolvedEntryTypeDefinition } from "./types/resolved.mjs";
9
+ import { BabelUserConfig, BaseConfig, BuildInlineConfig, CleanInlineConfig, CommonUserConfig, DeployConfig, DeployInlineConfig, DocsInlineConfig, ESBuildUserConfig, EnvironmentConfig, FarmUserConfig, InlineConfig, LintInlineConfig, LogFn, NewInlineConfig, OutputConfig, PluginConfig, PluginConfigObject, PluginConfigTuple, PluginFactory, PowerlinesCommand, PrepareInlineConfig, ProjectType, RolldownUserConfig, RollupUserConfig, RspackUserConfig, TsdownUserConfig, TsupUserConfig, UnbuildUserConfig, UserConfig, ViteUserConfig, WebpackUserConfig, WorkspaceConfig } from "./types/config.mjs";
10
+ import { HookFields, HookListOrders, HooksList, InferHookFunction, InferHookParameters, InferHookReturnType, InferHooksListItem, PluginHooksList, PluginHooksListItem, UnpluginHookFunctions, UnpluginHookList, UnpluginHookVariant, UnpluginHookVariantField, UnpluginHooksListItem } from "./types/hooks.mjs";
11
+ import { APIContext, BuildPluginContext, Context, EmitEntryOptions, EmitOptions, EnvironmentContext, EnvironmentContextPlugin, FetchOptions, InitContextOptions, LogLevel, MetaInfo, ParseOptions, PluginContext, Resolver, SelectHookResult, SelectHookResultItem, SelectHooksOptions, TransformResult, UnresolvedContext, WithUnpluginBuildContext } from "./types/context.mjs";
12
+ import { API } from "./types/api.mjs";
10
13
  import "./types/index.mjs";
11
14
  import "./api.mjs";
12
15
  import "../schemas/fs.mjs";
@@ -3,12 +3,12 @@ const require_context = require('../../types/context.cjs');
3
3
  const require_hooks = require('../../types/hooks.cjs');
4
4
  let defu = require("defu");
5
5
  let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
6
- let __stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
7
- let __stryke_type_checks_is_object = require("@stryke/type-checks/is-object");
8
- let __stryke_type_checks_is_set = require("@stryke/type-checks/is-set");
9
6
  let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
7
+ let __stryke_type_checks_is_set = require("@stryke/type-checks/is-set");
10
8
  let chalk = require("chalk");
11
9
  chalk = require_rolldown_runtime.__toESM(chalk);
10
+ let __stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
11
+ let __stryke_type_checks_is_object = require("@stryke/type-checks/is-object");
12
12
 
13
13
  //#region ../powerlines/src/internal/helpers/hooks.ts
14
14
  function __assignType(fn, args) {
@@ -53,33 +53,51 @@ const mergeResults = (0, defu.createDefu)(__assignType((obj, key, value) => {
53
53
  * Calls a hook with the given context, options, and arguments.
54
54
  *
55
55
  * @param context - The context to use when calling the hook.
56
- * @param hook - The hook to call.
56
+ * @param key - The hook to call.
57
57
  * @param options - Options for calling the hook.
58
58
  * @param args - Arguments to pass to the hook.
59
59
  * @returns The return value of the hook.
60
60
  */
61
- async function callHook(context, hook, options, ...args) {
62
- const handlers = context.selectHooks(hook, options);
63
- if (handlers.length > 0) {
64
- context.log(__storm_software_config_tools_types.LogLevelLabel.DEBUG, ` 🧩 Calling plugin hook: ${chalk.default.bold.cyanBright(`${hook}${options?.order ? ` (${options.order})` : ""}`)}`);
61
+ async function callHook(context, key, options, ...args) {
62
+ const hooks = context.selectHooks(key, options);
63
+ if (hooks.length > 0) {
64
+ context.log(__storm_software_config_tools_types.LogLevelLabel.DEBUG, ` 🧩 Calling plugin hook: ${chalk.default.bold.cyanBright(`${key}${options?.order ? ` (${options.order})` : ""}`)}`);
65
+ const invokeHook = __assignType(async (hook, hookArgs) => {
66
+ return Reflect.apply(hook.handler, hook.context, hookArgs);
67
+ }, [
68
+ "hook",
69
+ () => require_hooks.__ΩInferHookParameters,
70
+ () => require_context.__ΩPluginContext,
71
+ () => context,
72
+ () => require_context.__ΩEnvironmentContext,
73
+ () => args,
74
+ () => require_hooks.__ΩInferHookParameters,
75
+ () => require_context.__ΩPluginContext,
76
+ () => args,
77
+ () => require_hooks.__ΩInferHookParameters,
78
+ () => require_context.__ΩPluginContext,
79
+ "hookArgs",
80
+ "",
81
+ "P!2!Pdi$h!!o%\"qe!!!jPdi&h!!o(\"\"o'#qe!!!jo#\"Pdi)\"o+\"h!!o*#qe!!!jo\"#2,\"/-"
82
+ ]);
65
83
  let results = [];
66
- if (options?.sequential === false) results = await Promise.all(handlers.map(__assignType(async (handler) => {
67
- if (!(0, __stryke_type_checks_is_function.isFunction)(handler.handle)) throw new Error(`Plugin hook handler for hook "${hook}" is not a function.`);
68
- return Promise.resolve(handler.handle.apply(handler.context, [...args]));
84
+ if (options?.sequential === false) results = await Promise.all(hooks.map(__assignType(async (hook) => {
85
+ if (!(0, __stryke_type_checks_is_function.isFunction)(hook.handler)) throw new Error(`Plugin hook handler for hook "${key}" is not a function.`);
86
+ return invokeHook(hook, [...args]);
69
87
  }, [
70
- "handler",
88
+ "hook",
71
89
  "",
72
90
  "P\"2!\"/\""
73
91
  ])));
74
- else for (const handler of handlers) {
75
- if (!(0, __stryke_type_checks_is_function.isFunction)(handler.handle)) throw new Error(`Plugin hook handler for hook "${hook}" is not a function.`);
92
+ else for (const hook of hooks) {
93
+ if (!(0, __stryke_type_checks_is_function.isFunction)(hook.handler)) throw new Error(`Plugin hook handler for hook "${key}" is not a function.`);
76
94
  if (options?.result === "first" || options?.asNextParam === false) {
77
- results.push(await Promise.resolve(handler.handle.apply(handler.context, [...args])));
95
+ results.push(await Promise.resolve(invokeHook(hook, [...args])));
78
96
  if (options?.result === "first" && (0, __stryke_type_checks_is_set.isSet)(results[results.length - 1])) break;
79
97
  } else {
80
98
  const sequenceArgs = [...args];
81
99
  if (results.length > 0 && sequenceArgs.length > 0) sequenceArgs[0] = (0, __stryke_type_checks_is_function.isFunction)(options.asNextParam) ? await Promise.resolve(options.asNextParam(results[0])) : results[0];
82
- const result = await Promise.resolve(handler.handle.apply(handler.context, [...sequenceArgs]));
100
+ const result = await Promise.resolve(invokeHook(hook, [...sequenceArgs]));
83
101
  if (result) {
84
102
  if (options?.result === "last") results = [result];
85
103
  else if ((0, __stryke_type_checks_is_string.isString)(result)) results = [`${(0, __stryke_type_checks_is_string.isString)(results[0]) ? results[0] || "" : ""}\n${result || ""}`.trim()];
@@ -100,20 +118,20 @@ async function callHook(context, hook, options, ...args) {
100
118
  }
101
119
  }
102
120
  callHook.__type = [
121
+ () => require_context.__ΩEnvironmentContext,
103
122
  "context",
104
- "hook",
123
+ "key",
105
124
  () => __ΩCallHookOptions,
106
125
  "options",
107
126
  () => require_hooks.__ΩInferHookParameters,
108
127
  () => require_context.__ΩPluginContext,
109
- "config",
110
128
  "args",
111
129
  () => require_hooks.__ΩInferHookReturnType,
112
130
  () => require_context.__ΩPluginContext,
113
- "config",
114
131
  "callHook",
115
132
  "Calls a hook with the given context, options, and arguments.",
116
- "P\"2!\"2\"n#2$\".'fo&\"\"o%#@2(P\".+fo*\"\"o)#-J`/,?-"
133
+ "P\"o!\"2\"\"2#n$2%\"o'\"\"o&#@2(P\"o*\"\"o)#-J`/+?,"
117
134
  ];
118
135
 
119
- //#endregion
136
+ //#endregion
137
+ exports.__ΩCallHookOptions = __ΩCallHookOptions;
@@ -0,0 +1,47 @@
1
+ import { SelectHooksOptions } from "../../types/context.cjs";
2
+ import { MaybePromise } from "@stryke/types/base";
3
+
4
+ //#region ../powerlines/src/internal/helpers/hooks.d.ts
5
+ type CallHookOptions = SelectHooksOptions & (({
6
+ /**
7
+ * Whether to call the hooks sequentially or in parallel.
8
+ *
9
+ * @defaultValue true
10
+ */
11
+ sequential?: true;
12
+ } & ({
13
+ /**
14
+ * How to handle multiple return values from hooks.
15
+ * - "merge": Merge all non-undefined return values (if they are objects).
16
+ * - "first": Return the first non-undefined value.
17
+ *
18
+ * @remarks
19
+ * Merging only works if the return values are objects.
20
+ *
21
+ * @defaultValue "merge"
22
+ */
23
+ result: "first";
24
+ } | {
25
+ /**
26
+ * How to handle multiple return values from hooks.
27
+ * - "merge": Merge all non-undefined return values (if they are objects).
28
+ * - "first": Return the first non-undefined value.
29
+ *
30
+ * @remarks
31
+ * Merging only works if the return values are objects.
32
+ *
33
+ * @defaultValue "merge"
34
+ */
35
+ result?: "merge" | "last";
36
+ /**
37
+ * An indicator specifying if the results of the previous hook should be provided as the **first** parameter of the next hook function, or a function to process the result of the previous hook function and pass the returned value as the next hook's **first** parameter
38
+ */
39
+ asNextParam?: false | ((previousResult: any) => MaybePromise<any>);
40
+ })) | {
41
+ /**
42
+ * Whether to call the hooks sequentially or in parallel.
43
+ */
44
+ sequential: false;
45
+ });
46
+ //#endregion
47
+ export { CallHookOptions };
@@ -1,5 +1,49 @@
1
- import "../../types/hooks.mjs";
2
- import "../../types/context.mjs";
3
1
  import "../../types/resolved.mjs";
2
+ import "../../types/hooks.mjs";
3
+ import { SelectHooksOptions } from "../../types/context.mjs";
4
4
  import { MaybePromise } from "@stryke/types/base";
5
- import { ArrayValues } from "@stryke/types/array";
5
+
6
+ //#region ../powerlines/src/internal/helpers/hooks.d.ts
7
+ type CallHookOptions = SelectHooksOptions & (({
8
+ /**
9
+ * Whether to call the hooks sequentially or in parallel.
10
+ *
11
+ * @defaultValue true
12
+ */
13
+ sequential?: true;
14
+ } & ({
15
+ /**
16
+ * How to handle multiple return values from hooks.
17
+ * - "merge": Merge all non-undefined return values (if they are objects).
18
+ * - "first": Return the first non-undefined value.
19
+ *
20
+ * @remarks
21
+ * Merging only works if the return values are objects.
22
+ *
23
+ * @defaultValue "merge"
24
+ */
25
+ result: "first";
26
+ } | {
27
+ /**
28
+ * How to handle multiple return values from hooks.
29
+ * - "merge": Merge all non-undefined return values (if they are objects).
30
+ * - "first": Return the first non-undefined value.
31
+ *
32
+ * @remarks
33
+ * Merging only works if the return values are objects.
34
+ *
35
+ * @defaultValue "merge"
36
+ */
37
+ result?: "merge" | "last";
38
+ /**
39
+ * An indicator specifying if the results of the previous hook should be provided as the **first** parameter of the next hook function, or a function to process the result of the previous hook function and pass the returned value as the next hook's **first** parameter
40
+ */
41
+ asNextParam?: false | ((previousResult: any) => MaybePromise<any>);
42
+ })) | {
43
+ /**
44
+ * Whether to call the hooks sequentially or in parallel.
45
+ */
46
+ sequential: false;
47
+ });
48
+ //#endregion
49
+ export { CallHookOptions };
@@ -1,12 +1,12 @@
1
- import { __ΩPluginContext, __ΩSelectHooksOptions } from "../../types/context.mjs";
1
+ import { __ΩEnvironmentContext, __ΩPluginContext, __ΩSelectHooksOptions } from "../../types/context.mjs";
2
2
  import { __ΩInferHookParameters, __ΩInferHookReturnType } from "../../types/hooks.mjs";
3
3
  import { createDefu, defu } from "defu";
4
4
  import { LogLevelLabel } from "@storm-software/config-tools/types";
5
- import { isFunction } from "@stryke/type-checks/is-function";
6
- import { isObject } from "@stryke/type-checks/is-object";
7
- import { isSet } from "@stryke/type-checks/is-set";
8
5
  import { isString } from "@stryke/type-checks/is-string";
6
+ import { isSet } from "@stryke/type-checks/is-set";
9
7
  import chalk from "chalk";
8
+ import { isFunction } from "@stryke/type-checks/is-function";
9
+ import { isObject } from "@stryke/type-checks/is-object";
10
10
 
11
11
  //#region ../powerlines/src/internal/helpers/hooks.ts
12
12
  function __assignType(fn, args) {
@@ -51,33 +51,51 @@ const mergeResults = createDefu(__assignType((obj, key, value) => {
51
51
  * Calls a hook with the given context, options, and arguments.
52
52
  *
53
53
  * @param context - The context to use when calling the hook.
54
- * @param hook - The hook to call.
54
+ * @param key - The hook to call.
55
55
  * @param options - Options for calling the hook.
56
56
  * @param args - Arguments to pass to the hook.
57
57
  * @returns The return value of the hook.
58
58
  */
59
- async function callHook(context, hook, options, ...args) {
60
- const handlers = context.selectHooks(hook, options);
61
- if (handlers.length > 0) {
62
- context.log(LogLevelLabel.DEBUG, ` 🧩 Calling plugin hook: ${chalk.bold.cyanBright(`${hook}${options?.order ? ` (${options.order})` : ""}`)}`);
59
+ async function callHook(context, key, options, ...args) {
60
+ const hooks = context.selectHooks(key, options);
61
+ if (hooks.length > 0) {
62
+ context.log(LogLevelLabel.DEBUG, ` 🧩 Calling plugin hook: ${chalk.bold.cyanBright(`${key}${options?.order ? ` (${options.order})` : ""}`)}`);
63
+ const invokeHook = __assignType(async (hook, hookArgs) => {
64
+ return Reflect.apply(hook.handler, hook.context, hookArgs);
65
+ }, [
66
+ "hook",
67
+ () => __ΩInferHookParameters,
68
+ () => __ΩPluginContext,
69
+ () => context,
70
+ () => __ΩEnvironmentContext,
71
+ () => args,
72
+ () => __ΩInferHookParameters,
73
+ () => __ΩPluginContext,
74
+ () => args,
75
+ () => __ΩInferHookParameters,
76
+ () => __ΩPluginContext,
77
+ "hookArgs",
78
+ "",
79
+ "P!2!Pdi$h!!o%\"qe!!!jPdi&h!!o(\"\"o'#qe!!!jo#\"Pdi)\"o+\"h!!o*#qe!!!jo\"#2,\"/-"
80
+ ]);
63
81
  let results = [];
64
- if (options?.sequential === false) results = await Promise.all(handlers.map(__assignType(async (handler) => {
65
- if (!isFunction(handler.handle)) throw new Error(`Plugin hook handler for hook "${hook}" is not a function.`);
66
- return Promise.resolve(handler.handle.apply(handler.context, [...args]));
82
+ if (options?.sequential === false) results = await Promise.all(hooks.map(__assignType(async (hook) => {
83
+ if (!isFunction(hook.handler)) throw new Error(`Plugin hook handler for hook "${key}" is not a function.`);
84
+ return invokeHook(hook, [...args]);
67
85
  }, [
68
- "handler",
86
+ "hook",
69
87
  "",
70
88
  "P\"2!\"/\""
71
89
  ])));
72
- else for (const handler of handlers) {
73
- if (!isFunction(handler.handle)) throw new Error(`Plugin hook handler for hook "${hook}" is not a function.`);
90
+ else for (const hook of hooks) {
91
+ if (!isFunction(hook.handler)) throw new Error(`Plugin hook handler for hook "${key}" is not a function.`);
74
92
  if (options?.result === "first" || options?.asNextParam === false) {
75
- results.push(await Promise.resolve(handler.handle.apply(handler.context, [...args])));
93
+ results.push(await Promise.resolve(invokeHook(hook, [...args])));
76
94
  if (options?.result === "first" && isSet(results[results.length - 1])) break;
77
95
  } else {
78
96
  const sequenceArgs = [...args];
79
97
  if (results.length > 0 && sequenceArgs.length > 0) sequenceArgs[0] = isFunction(options.asNextParam) ? await Promise.resolve(options.asNextParam(results[0])) : results[0];
80
- const result = await Promise.resolve(handler.handle.apply(handler.context, [...sequenceArgs]));
98
+ const result = await Promise.resolve(invokeHook(hook, [...sequenceArgs]));
81
99
  if (result) {
82
100
  if (options?.result === "last") results = [result];
83
101
  else if (isString(result)) results = [`${isString(results[0]) ? results[0] || "" : ""}\n${result || ""}`.trim()];
@@ -98,21 +116,20 @@ async function callHook(context, hook, options, ...args) {
98
116
  }
99
117
  }
100
118
  callHook.__type = [
119
+ () => __ΩEnvironmentContext,
101
120
  "context",
102
- "hook",
121
+ "key",
103
122
  () => __ΩCallHookOptions,
104
123
  "options",
105
124
  () => __ΩInferHookParameters,
106
125
  () => __ΩPluginContext,
107
- "config",
108
126
  "args",
109
127
  () => __ΩInferHookReturnType,
110
128
  () => __ΩPluginContext,
111
- "config",
112
129
  "callHook",
113
130
  "Calls a hook with the given context, options, and arguments.",
114
- "P\"2!\"2\"n#2$\".'fo&\"\"o%#@2(P\".+fo*\"\"o)#-J`/,?-"
131
+ "P\"o!\"2\"\"2#n$2%\"o'\"\"o&#@2(P\"o*\"\"o)#-J`/+?,"
115
132
  ];
116
133
 
117
134
  //#endregion
118
- export { };
135
+ export { __ΩCallHookOptions };
@@ -2,13 +2,13 @@ const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.
2
2
  const require_context = require('../../types/context.cjs');
3
3
  const require_build = require('../../types/build.cjs');
4
4
  const require_entry = require('../entry.cjs');
5
- let __stryke_path_replace = require("@stryke/path/replace");
6
5
  let __stryke_path_join_paths = require("@stryke/path/join-paths");
7
6
  let defu = require("defu");
8
7
  defu = require_rolldown_runtime.__toESM(defu);
9
- let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
10
8
  let __stryke_helpers_omit = require("@stryke/helpers/omit");
9
+ let __stryke_path_replace = require("@stryke/path/replace");
11
10
  let __stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
11
+ let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
12
12
 
13
13
  //#region ../powerlines/src/lib/build/esbuild.ts
14
14
  function __assignType(fn, args) {
@@ -1,12 +1,12 @@
1
1
  import { __ΩContext } from "../../types/context.mjs";
2
2
  import { __ΩESBuildResolvedBuildConfig } from "../../types/build.mjs";
3
3
  import { resolveEntryInputFile, resolveEntryOutput } from "../entry.mjs";
4
- import { replaceExtension, replacePath } from "@stryke/path/replace";
5
4
  import { joinPaths } from "@stryke/path/join-paths";
6
5
  import defu$1 from "defu";
7
- import { isString } from "@stryke/type-checks/is-string";
8
6
  import { omit } from "@stryke/helpers/omit";
7
+ import { replaceExtension, replacePath } from "@stryke/path/replace";
9
8
  import { camelCase } from "@stryke/string-format/camel-case";
9
+ import { isString } from "@stryke/type-checks/is-string";
10
10
 
11
11
  //#region ../powerlines/src/lib/build/esbuild.ts
12
12
  function __assignType(fn, args) {
@@ -1,17 +1,17 @@
1
1
  const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
2
  const require_resolved = require('../types/resolved.cjs');
3
3
  const require_paths = require('../plugin-utils/paths.cjs');
4
+ let __stryke_path_join_paths = require("@stryke/path/join-paths");
5
+ let __stryke_convert_parse_type_definition = require("@stryke/convert/parse-type-definition");
6
+ let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
4
7
  let __stryke_path_replace = require("@stryke/path/replace");
8
+ let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
5
9
  let __stryke_convert_to_array = require("@stryke/convert/to-array");
6
10
  let __stryke_fs_is_file = require("@stryke/fs/is-file");
7
11
  let __stryke_fs_list_files = require("@stryke/fs/list-files");
8
- let __stryke_path_append = require("@stryke/path/append");
9
- let __stryke_path_join_paths = require("@stryke/path/join-paths");
10
- let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
11
- let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
12
- let __stryke_convert_parse_type_definition = require("@stryke/convert/parse-type-definition");
13
- let __stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
14
12
  let __stryke_hash_murmurhash = require("@stryke/hash/murmurhash");
13
+ let __stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
14
+ let __stryke_path_append = require("@stryke/path/append");
15
15
 
16
16
  //#region ../powerlines/src/lib/entry.ts
17
17
  function __assignType(fn, args) {
@@ -1,16 +1,16 @@
1
1
  import { __ΩResolvedEntryTypeDefinition } from "../types/resolved.mjs";
2
2
  import { replacePathTokens } from "../plugin-utils/paths.mjs";
3
+ import { joinPaths } from "@stryke/path/join-paths";
4
+ import { parseTypeDefinition } from "@stryke/convert/parse-type-definition";
5
+ import { isSetString } from "@stryke/type-checks/is-set-string";
3
6
  import { replaceExtension, replacePath } from "@stryke/path/replace";
7
+ import { isString } from "@stryke/type-checks/is-string";
4
8
  import { toArray } from "@stryke/convert/to-array";
5
9
  import { isFile } from "@stryke/fs/is-file";
6
10
  import { listFiles, listFilesSync } from "@stryke/fs/list-files";
7
- import { appendPath } from "@stryke/path/append";
8
- import { joinPaths } from "@stryke/path/join-paths";
9
- import { isString } from "@stryke/type-checks/is-string";
10
- import { isSetString } from "@stryke/type-checks/is-set-string";
11
- import { parseTypeDefinition } from "@stryke/convert/parse-type-definition";
12
- import { getUniqueBy } from "@stryke/helpers/get-unique";
13
11
  import { murmurhash } from "@stryke/hash/murmurhash";
12
+ import { getUniqueBy } from "@stryke/helpers/get-unique";
13
+ import { appendPath } from "@stryke/path/append";
14
14
 
15
15
  //#region ../powerlines/src/lib/entry.ts
16
16
  function __assignType(fn, args) {
@@ -1,12 +1,12 @@
1
1
  const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
2
+ let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
2
3
  let __storm_software_config_tools_types = require("@storm-software/config-tools/types");
4
+ let __stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
3
5
  let chalk = require("chalk");
4
6
  chalk = require_rolldown_runtime.__toESM(chalk);
5
7
  let __storm_software_config_tools_logger = require("@storm-software/config-tools/logger");
6
8
  let __storm_software_config_tools_utilities_colors = require("@storm-software/config-tools/utilities/colors");
7
9
  let __stryke_helpers_noop = require("@stryke/helpers/noop");
8
- let __stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
9
- let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
10
10
 
11
11
  //#region ../powerlines/src/lib/logger.ts
12
12
  function __assignType(fn, args) {
@@ -1,10 +1,10 @@
1
+ import { titleCase } from "@stryke/string-format/title-case";
1
2
  import { LogLevelLabel } from "@storm-software/config-tools/types";
3
+ import { kebabCase } from "@stryke/string-format/kebab-case";
2
4
  import chalk from "chalk";
3
5
  import { getLogFn, getLogLevel } from "@storm-software/config-tools/logger";
4
6
  import { getColor } from "@storm-software/config-tools/utilities/colors";
5
7
  import { noop } from "@stryke/helpers/noop";
6
- import { kebabCase } from "@stryke/string-format/kebab-case";
7
- import { titleCase } from "@stryke/string-format/title-case";
8
8
 
9
9
  //#region ../powerlines/src/lib/logger.ts
10
10
  function __assignType(fn, args) {
@@ -2,8 +2,8 @@ const require_rolldown_runtime = require('../../../../_virtual/rolldown_runtime.
2
2
  const require_context = require('../../types/context.cjs');
3
3
  const require_build = require('../../types/build.cjs');
4
4
  const require_bundle = require('./bundle.cjs');
5
- let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
6
5
  let __stryke_convert_parse_type_definition = require("@stryke/convert/parse-type-definition");
6
+ let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
7
7
 
8
8
  //#region ../powerlines/src/lib/utilities/resolve.ts
9
9
  const __ΩPartial = [
@@ -1,8 +1,8 @@
1
1
  import { __ΩContext } from "../../types/context.mjs";
2
2
  import { __ΩESBuildResolvedBuildConfig } from "../../types/build.mjs";
3
3
  import { bundle } from "./bundle.mjs";
4
- import { isSetString } from "@stryke/type-checks/is-set-string";
5
4
  import { parseTypeDefinition } from "@stryke/convert/parse-type-definition";
5
+ import { isSetString } from "@stryke/type-checks/is-set-string";
6
6
 
7
7
  //#region ../powerlines/src/lib/utilities/resolve.ts
8
8
  const __ΩPartial = [
@@ -1 +1,62 @@
1
- require('../internal/helpers/hooks.cjs');
1
+ const require_config = require('./config.cjs');
2
+ const require_resolved = require('./resolved.cjs');
3
+ const require_hooks = require('./hooks.cjs');
4
+ const require_hooks$1 = require('../internal/helpers/hooks.cjs');
5
+
6
+ //#region ../powerlines/src/types/api.ts
7
+ const __ΩAPI = [
8
+ () => require_resolved.__ΩResolvedConfig,
9
+ "TResolvedConfig",
10
+ "APIContext",
11
+ "context",
12
+ "The Powerlines shared API context",
13
+ () => require_config.__ΩPrepareInlineConfig,
14
+ () => require_config.__ΩNewInlineConfig,
15
+ () => require_config.__ΩCleanInlineConfig,
16
+ () => require_config.__ΩBuildInlineConfig,
17
+ () => require_config.__ΩLintInlineConfig,
18
+ () => require_config.__ΩDocsInlineConfig,
19
+ () => require_config.__ΩDeployInlineConfig,
20
+ "inlineConfig",
21
+ "",
22
+ "prepare",
23
+ "Prepare the Powerlines API",
24
+ () => require_config.__ΩNewInlineConfig,
25
+ "new",
26
+ "Create a new Powerlines project",
27
+ () => require_config.__ΩCleanInlineConfig,
28
+ () => require_config.__ΩPrepareInlineConfig,
29
+ "clean",
30
+ "Clean any previously prepared artifacts",
31
+ () => require_config.__ΩLintInlineConfig,
32
+ "lint",
33
+ "Lint the project source code",
34
+ () => require_config.__ΩBuildInlineConfig,
35
+ "build",
36
+ "Build the project",
37
+ () => require_config.__ΩDocsInlineConfig,
38
+ "docs",
39
+ "Prepare the documentation for the project",
40
+ () => require_config.__ΩDeployInlineConfig,
41
+ "deploy",
42
+ "Deploy the project source code",
43
+ "finalize",
44
+ "Finalization process",
45
+ "hook",
46
+ () => require_hooks$1.__ΩCallHookOptions,
47
+ "EnvironmentContext",
48
+ "environment",
49
+ "options",
50
+ () => require_hooks.__ΩInferHookParameters,
51
+ "PluginContext",
52
+ "args",
53
+ () => require_hooks.__ΩInferHookReturnType,
54
+ "callHook",
55
+ "Invokes the configured plugin hooks",
56
+ "Powerlines API Interface",
57
+ "API",
58
+ "n!c\"P\"w#4$?%PPn&n'n(n)n*n+n,J2-$`/.4/?0Pn12-$`/.42?3PPn4n5J2-$`/.46?7Pn82-$`/.49?:Pn;2-$`/.4<?=Pn>2-$`/.4??@PnA2-$`/.4B?CP$`/.4D?EP\"2FPnGPP&\"wHJ4I8MK2J\"wL\"oK#@2MP\"wL\"oN#-J`/.4O?PM?QwRy"
59
+ ];
60
+
61
+ //#endregion
62
+ exports.__ΩAPI = __ΩAPI;