@powerlines/engine 0.44.11 → 0.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/_internal/worker.cjs +141 -106
  2. package/dist/_internal/worker.d.cts +16 -8
  3. package/dist/_internal/worker.d.cts.map +1 -1
  4. package/dist/_internal/worker.d.mts +16 -8
  5. package/dist/_internal/worker.d.mts.map +1 -1
  6. package/dist/_internal/worker.mjs +142 -107
  7. package/dist/_internal/worker.mjs.map +1 -1
  8. package/dist/api.cjs +60 -46
  9. package/dist/api.d.cts +18 -13
  10. package/dist/api.d.cts.map +1 -1
  11. package/dist/api.d.mts +18 -13
  12. package/dist/api.d.mts.map +1 -1
  13. package/dist/api.mjs +60 -46
  14. package/dist/api.mjs.map +1 -1
  15. package/dist/{base-context-C6yzgs6K.mjs → base-context-BSAC5sO9.mjs} +21 -15
  16. package/dist/base-context-BSAC5sO9.mjs.map +1 -0
  17. package/dist/{base-context-trNQZNsX.cjs → base-context-Byizvf4F.cjs} +20 -14
  18. package/dist/context/index.cjs +3 -3
  19. package/dist/context/index.d.cts +13 -8
  20. package/dist/context/index.d.cts.map +1 -1
  21. package/dist/context/index.d.mts +13 -8
  22. package/dist/context/index.d.mts.map +1 -1
  23. package/dist/context/index.mjs +3 -3
  24. package/dist/{engine-context-D1_U6xVC.cjs → engine-context-CI_0NWIk.cjs} +5 -3
  25. package/dist/{engine-context-C-11i43N.mjs → engine-context-_RMFwG4J.mjs} +6 -4
  26. package/dist/engine-context-_RMFwG4J.mjs.map +1 -0
  27. package/dist/{execution-context-C-M-Mxse.cjs → execution-context-BFCOc0mH.cjs} +61 -48
  28. package/dist/{execution-context-D9Enw3J5.mjs → execution-context-Cr_VUBrP.mjs} +63 -50
  29. package/dist/execution-context-Cr_VUBrP.mjs.map +1 -0
  30. package/dist/index.cjs +30 -20
  31. package/dist/index.d.cts +9 -8
  32. package/dist/index.d.cts.map +1 -1
  33. package/dist/index.d.mts +9 -8
  34. package/dist/index.d.mts.map +1 -1
  35. package/dist/index.mjs +30 -20
  36. package/dist/index.mjs.map +1 -1
  37. package/package.json +3 -3
  38. package/dist/base-context-C6yzgs6K.mjs.map +0 -1
  39. package/dist/engine-context-C-11i43N.mjs.map +0 -1
  40. package/dist/execution-context-D9Enw3J5.mjs.map +0 -1
package/dist/api.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_chunk = require('./chunk-C0xms8kb.cjs');
3
- const require_execution_context = require('./execution-context-C-M-Mxse.cjs');
3
+ const require_execution_context = require('./execution-context-BFCOc0mH.cjs');
4
4
  const require_tsconfig = require('./tsconfig-QMSxSwBD.cjs');
5
5
  const require_ts_morph = require('./ts-morph-BaLPVAdB.cjs');
6
6
  let _stryke_convert_to_array = require("@stryke/convert/to-array");
@@ -691,47 +691,53 @@ ${formatTypes(code)}
691
691
  `);
692
692
  }
693
693
  /**
694
+ * Initialize a Powerlines API instance
695
+ *
696
+ * @param options - The options to initialize the API with
697
+ * @returns A new instance of the Powerlines API
698
+ */
699
+ static async init(options, initialConfig) {
700
+ const api = new PowerlinesExecution(await require_execution_context.PowerlinesExecutionContext.init(options, initialConfig ?? {}));
701
+ api.#context.config.initialConfig = initialConfig ?? {};
702
+ await api.setup();
703
+ return api;
704
+ }
705
+ /**
694
706
  * The Powerlines context
695
707
  */
696
708
  get context() {
697
709
  return this.#context;
698
710
  }
699
711
  /**
700
- * Initialize a Powerlines API instance
701
- *
702
- * @param options - The options to initialize the API with
703
- * @returns A new instance of the Powerlines API
712
+ * Initialize the execution API with the provided configuration options
704
713
  */
705
- static async fromConfig(options, config) {
706
- const api = new PowerlinesExecution(await require_execution_context.PowerlinesExecutionContext.fromOptions(options));
707
- api.#context.config.inlineConfig = config;
708
- await api.#context.setup();
709
- api.#context.$$internal = {
710
- api,
711
- addPlugin: api.addPlugin.bind(api)
714
+ async setup() {
715
+ await this.#context.setup();
716
+ this.#context.$$internal = {
717
+ api: this,
718
+ addPlugin: this.addPlugin.bind(this)
712
719
  };
713
- const timer = api.context.timer("Initialization");
714
- for (const plugin of api.context.config.plugins.flatMap((p) => (0, _stryke_convert_to_array.toArray)(p)) ?? []) await api.addPlugin(plugin);
715
- if (api.context.plugins.length === 0) api.context.warn({
720
+ const timer = this.#context.timer("Initialization");
721
+ for (const plugin of this.#context.config.plugins.flatMap((p) => (0, _stryke_convert_to_array.toArray)(p)) ?? []) await this.addPlugin(plugin);
722
+ if (this.#context.plugins.length === 0) this.#context.warn({
716
723
  meta: { category: "plugins" },
717
724
  message: "No Powerlines plugins were specified in the options. Please ensure this is correct, as it is generally not recommended."
718
725
  });
719
- else api.context.info({
726
+ else this.#context.info({
720
727
  meta: { category: "plugins" },
721
- message: `Loaded ${api.context.plugins.length} ${(0, _stryke_string_format_title_case.titleCase)(api.context.config.framework)} plugin${api.context.plugins.length > 1 ? "s" : ""}: \n${api.context.plugins.map((plugin, index) => ` ${index + 1}. ${(0, _powerlines_core_plugin_utils_logging.colorText)(plugin.name)}`).join("\n")}`
728
+ message: `Loaded ${this.#context.plugins.length} ${(0, _stryke_string_format_title_case.titleCase)(this.#context.config.framework)} plugin${this.#context.plugins.length > 1 ? "s" : ""}: \n${this.#context.plugins.map((plugin, index) => ` ${index + 1}. ${(0, _powerlines_core_plugin_utils_logging.colorText)(plugin.name)}`).join("\n")}`
722
729
  });
723
- const pluginConfig = await api.callHook("config", {
724
- environment: await api.context.getEnvironment(),
730
+ const pluginConfig = await this.callHook("config", {
731
+ environment: await this.#context.getEnvironment(),
725
732
  sequential: true,
726
733
  result: "merge",
727
734
  merge: require_execution_context.mergeConfigs
728
735
  });
729
736
  if (pluginConfig) {
730
- api.#context.config.pluginConfig = pluginConfig;
731
- await api.#context.setup();
737
+ this.#context.config.pluginConfig = pluginConfig;
738
+ await this.#context.setup();
732
739
  }
733
740
  timer();
734
- return api;
735
741
  }
736
742
  /**
737
743
  * Generate the Powerlines typescript declaration file
@@ -745,7 +751,7 @@ ${formatTypes(code)}
745
751
  this.context.debug(" Aggregating configuration options for the Powerlines project");
746
752
  inlineConfig.command ??= "types";
747
753
  this.context.config.inlineConfig = inlineConfig;
748
- await this.context.setup();
754
+ await this.setup();
749
755
  await this.#executeEnvironments(async (context) => {
750
756
  context.debug(`Initializing the processing options for the Powerlines project.`);
751
757
  await this.callHook("configResolved", {
@@ -796,7 +802,7 @@ ${formatTypes(code)}
796
802
  async prepare(inlineConfig = { command: "prepare" }) {
797
803
  inlineConfig.command ??= "prepare";
798
804
  this.context.config.inlineConfig = inlineConfig;
799
- await this.context.setup();
805
+ await this.setup();
800
806
  await this.#executeEnvironments(async (context) => {
801
807
  context.debug(`Initializing the processing options for the Powerlines project.`);
802
808
  await this.callHook("configResolved", {
@@ -816,12 +822,23 @@ ${formatTypes(code)}
816
822
  environment: context,
817
823
  order: "post"
818
824
  });
819
- context.trace(`Powerlines configuration has been resolved: \n\n${(0, _storm_software_config_tools_logger_console.formatLogMessage)({
820
- ...context.config,
821
- userConfig: (0, _stryke_type_checks_is_set_object.isSetObject)(context.config.userConfig) ? (0, _stryke_helpers_omit.omit)(context.config.userConfig, ["plugins"]) : void 0,
822
- inlineConfig: (0, _stryke_type_checks_is_set_object.isSetObject)(context.config.inlineConfig) ? (0, _stryke_helpers_omit.omit)(context.config.inlineConfig, ["plugins"]) : void 0,
823
- plugins: context.plugins.map((plugin) => plugin.plugin.name)
824
- })}`);
825
+ context.trace({
826
+ meta: { category: "config" },
827
+ message: `Powerlines configuration after configResolved hook: \n${(0, _storm_software_config_tools_logger_console.formatLogMessage)({
828
+ ...(0, _stryke_helpers_omit.omit)(context.config, [
829
+ "inlineConfig",
830
+ "userConfig",
831
+ "initialConfig",
832
+ "pluginConfig",
833
+ "plugins"
834
+ ]),
835
+ plugins: context.plugins.map((plugin) => plugin.plugin.name),
836
+ inlineConfig: (0, _stryke_type_checks_is_set_object.isSetObject)(context.config.inlineConfig) ? (0, _stryke_helpers_omit.omit)(context.config.inlineConfig, ["plugins"]) : void 0,
837
+ userConfig: (0, _stryke_type_checks_is_set_object.isSetObject)(context.config.userConfig) ? (0, _stryke_helpers_omit.omit)(context.config.userConfig, ["plugins"]) : void 0,
838
+ initialConfig: (0, _stryke_type_checks_is_set_object.isSetObject)(context.config.initialConfig) ? (0, _stryke_helpers_omit.omit)(context.config.initialConfig, ["plugins"]) : void 0,
839
+ pluginConfig: (0, _stryke_type_checks_is_set_object.isSetObject)(context.config.pluginConfig) ? (0, _stryke_helpers_omit.omit)(context.config.pluginConfig, ["plugins"]) : void 0
840
+ })}`
841
+ });
825
842
  if (!context.fs.existsSync(context.cachePath)) await (0, _stryke_fs_helpers.createDirectory)(context.cachePath);
826
843
  if (!context.fs.existsSync(context.dataPath)) await (0, _stryke_fs_helpers.createDirectory)(context.dataPath);
827
844
  await this.callHook("prepare", {
@@ -1070,36 +1087,25 @@ ${formatTypes(code)}
1070
1087
  * @public
1071
1088
  */
1072
1089
  var PowerlinesAPI = class PowerlinesAPI extends PowerlinesExecution {
1073
- /**
1074
- * Create a new Powerlines API instance
1075
- *
1076
- * @param context - The Powerlines context
1077
- */
1078
- constructor(context) {
1079
- super(context);
1080
- }
1081
1090
  /**
1082
1091
  * Initialize a Powerlines API instance
1083
1092
  *
1084
1093
  * @param options - The options to initialize the API with
1094
+ * @param initialConfig - The initial configuration for the API, which can be used to provide additional context or override certain configuration values during initialization. This is particularly useful when initializing the API from a CLI command, where the CLI flags can be passed as part of the initial configuration to ensure they are properly merged with the configuration file and made available to plugins during their setup and execution.
1085
1095
  * @returns A new instance of the Powerlines API
1086
1096
  */
1087
- static async fromOptions(options, override) {
1088
- const api = new PowerlinesAPI(await require_execution_context.PowerlinesExecutionContext.fromOptions({
1097
+ static async init(options, initialConfig) {
1098
+ const api = new PowerlinesAPI(await require_execution_context.PowerlinesExecutionContext.init({
1089
1099
  executionId: (0, _stryke_unique_id_uuid.uuid)(),
1090
1100
  executionIndex: 0,
1091
1101
  ...options
1092
- }));
1093
- if (override) {
1094
- api.context.config.inlineConfig = override;
1095
- await api.context.setup();
1096
- }
1102
+ }, initialConfig ?? {}));
1097
1103
  api.context.$$internal = {
1098
1104
  api,
1099
1105
  addPlugin: api.addPlugin.bind(api)
1100
1106
  };
1101
1107
  const timer = api.context.timer("Initialization");
1102
- for (const plugin of api.context.config.plugins.flat(10) ?? []) await api.addPlugin(plugin);
1108
+ for (const plugin of api.context.config.plugins.flatMap((p) => (0, _stryke_convert_to_array.toArray)(p)) ?? []) await api.addPlugin(plugin);
1103
1109
  if (api.context.plugins.length === 0) api.context.warn({
1104
1110
  meta: { category: "plugins" },
1105
1111
  message: "No Powerlines plugins were specified in the options. Please ensure this is correct, as it is generally not recommended."
@@ -1281,6 +1287,14 @@ var PowerlinesAPI = class PowerlinesAPI extends PowerlinesExecution {
1281
1287
  async [Symbol.asyncDispose]() {
1282
1288
  await this.finalize();
1283
1289
  }
1290
+ /**
1291
+ * Create a new Powerlines API instance
1292
+ *
1293
+ * @param context - The Powerlines context
1294
+ */
1295
+ constructor(context) {
1296
+ super(context);
1297
+ }
1284
1298
  };
1285
1299
 
1286
1300
  //#endregion
package/dist/api.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _$_powerlines_core0 from "@powerlines/core";
2
- import { API, BuildInlineConfig, CallHookOptions, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, EnvironmentContext, Execution, ExecutionContext, ExecutionOptions, InferHookParameters, InlineConfig, LintInlineConfig, NewInlineConfig, PluginConfig, PluginContext, PrepareInlineConfig, ResolvedConfig, TestInlineConfig, TypesInlineConfig } from "@powerlines/core";
2
+ import { API, BuildInlineConfig, CallHookOptions, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, EnvironmentContext, Execution, ExecutionContext, ExecutionOptions, InferHookParameters, InitialConfig, LintInlineConfig, NewInlineConfig, PluginConfig, PluginContext, PrepareInlineConfig, ResolvedConfig, TestInlineConfig, TypesInlineConfig } from "@powerlines/core";
3
3
  import { PartialKeys } from "@stryke/types/base";
4
4
 
5
5
  //#region src/_internal/execution.d.ts
@@ -13,17 +13,21 @@ import { PartialKeys } from "@stryke/types/base";
13
13
  */
14
14
  declare class PowerlinesExecution<TResolvedConfig extends ResolvedConfig = ResolvedConfig> implements Execution {
15
15
  #private;
16
- /**
17
- * The Powerlines context
18
- */
19
- get context(): ExecutionContext<TResolvedConfig>;
20
16
  /**
21
17
  * Initialize a Powerlines API instance
22
18
  *
23
19
  * @param options - The options to initialize the API with
24
20
  * @returns A new instance of the Powerlines API
25
21
  */
26
- static fromConfig<TResolvedConfig extends ResolvedConfig = ResolvedConfig>(options: ExecutionOptions, config: InlineConfig): Promise<PowerlinesExecution<TResolvedConfig>>;
22
+ static init<TResolvedConfig extends ResolvedConfig = ResolvedConfig>(options: ExecutionOptions, initialConfig?: InitialConfig<TResolvedConfig["userConfig"]>): Promise<PowerlinesExecution<TResolvedConfig>>;
23
+ /**
24
+ * The Powerlines context
25
+ */
26
+ get context(): ExecutionContext<TResolvedConfig>;
27
+ /**
28
+ * Initialize the execution API with the provided configuration options
29
+ */
30
+ setup(): Promise<void>;
27
31
  /**
28
32
  * Generate the Powerlines typescript declaration file
29
33
  *
@@ -149,19 +153,14 @@ declare class PowerlinesExecution<TResolvedConfig extends ResolvedConfig = Resol
149
153
  * @public
150
154
  */
151
155
  declare class PowerlinesAPI<TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends PowerlinesExecution<TResolvedConfig> implements API<TResolvedConfig>, AsyncDisposable {
152
- /**
153
- * Create a new Powerlines API instance
154
- *
155
- * @param context - The Powerlines context
156
- */
157
- protected constructor(context: ExecutionContext<TResolvedConfig>);
158
156
  /**
159
157
  * Initialize a Powerlines API instance
160
158
  *
161
159
  * @param options - The options to initialize the API with
160
+ * @param initialConfig - The initial configuration for the API, which can be used to provide additional context or override certain configuration values during initialization. This is particularly useful when initializing the API from a CLI command, where the CLI flags can be passed as part of the initial configuration to ensure they are properly merged with the configuration file and made available to plugins during their setup and execution.
162
161
  * @returns A new instance of the Powerlines API
163
162
  */
164
- static fromOptions<TResolvedConfig extends ResolvedConfig = ResolvedConfig>(options: PartialKeys<ExecutionOptions, "executionId" | "executionIndex">, override?: InlineConfig): Promise<PowerlinesAPI<TResolvedConfig>>;
163
+ static init<TResolvedConfig extends ResolvedConfig = ResolvedConfig>(options: PartialKeys<ExecutionOptions, "executionId" | "executionIndex">, initialConfig?: InitialConfig<TResolvedConfig["userConfig"]>): Promise<PowerlinesAPI<TResolvedConfig>>;
165
164
  /**
166
165
  * Generate the Powerlines typescript declaration file
167
166
  *
@@ -259,6 +258,12 @@ declare class PowerlinesAPI<TResolvedConfig extends ResolvedConfig = ResolvedCon
259
258
  * This method will finalize the Powerlines API instance, cleaning up any resources used.
260
259
  */
261
260
  [Symbol.asyncDispose](): Promise<void>;
261
+ /**
262
+ * Create a new Powerlines API instance
263
+ *
264
+ * @param context - The Powerlines context
265
+ */
266
+ protected constructor(context: ExecutionContext<TResolvedConfig>);
262
267
  }
263
268
  //#endregion
264
269
  export { PowerlinesAPI };
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.cts","names":[],"sources":["../src/_internal/execution.ts","../src/api.ts"],"mappings":";;;;;;;AAyGA;;;;;;cAAa,mBAAA,yBACa,cAAA,GAAiB,cAAA,aAC9B,SAAA;EAAA;EA0qBgC;;;EAAA,IAXhC,OAAA,CAAA,GAAW,gBAAA,CAAiB,eAAA;EAe5B;;;;;;EAAA,OALS,UAAA,yBACM,cAAA,GAAiB,cAAA,CAAA,CAEzC,OAAA,EAAS,gBAAA,EACT,MAAA,EAAQ,YAAA,GACP,OAAA,CAAQ,mBAAA,CAAoB,eAAA;EA6Mb;;;;;;;;EA3IL,KAAA,CACX,YAAA,GAAc,WAAA,CAAY,iBAAA,eAEzB,OAAA;EA4IG;;;;;;;;EAPO,OAAA,CACX,YAAA,GACI,WAAA,CAAY,mBAAA,eACZ,WAAA,CAAY,iBAAA,eACZ,WAAA,C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-1,5 +1,5 @@
1
1
  import * as _$_powerlines_core0 from "@powerlines/core";
2
- import { API, BuildInlineConfig, CallHookOptions, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, EnvironmentContext, Execution, ExecutionContext, ExecutionOptions, InferHookParameters, InlineConfig, LintInlineConfig, NewInlineConfig, PluginConfig, PluginContext, PrepareInlineConfig, ResolvedConfig, TestInlineConfig, TypesInlineConfig } from "@powerlines/core";
2
+ import { API, BuildInlineConfig, CallHookOptions, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, EnvironmentContext, Execution, ExecutionContext, ExecutionOptions, InferHookParameters, InitialConfig, LintInlineConfig, NewInlineConfig, PluginConfig, PluginContext, PrepareInlineConfig, ResolvedConfig, TestInlineConfig, TypesInlineConfig } from "@powerlines/core";
3
3
  import { PartialKeys } from "@stryke/types/base";
4
4
 
5
5
  //#region src/_internal/execution.d.ts
@@ -13,17 +13,21 @@ import { PartialKeys } from "@stryke/types/base";
13
13
  */
14
14
  declare class PowerlinesExecution<TResolvedConfig extends ResolvedConfig = ResolvedConfig> implements Execution {
15
15
  #private;
16
- /**
17
- * The Powerlines context
18
- */
19
- get context(): ExecutionContext<TResolvedConfig>;
20
16
  /**
21
17
  * Initialize a Powerlines API instance
22
18
  *
23
19
  * @param options - The options to initialize the API with
24
20
  * @returns A new instance of the Powerlines API
25
21
  */
26
- static fromConfig<TResolvedConfig extends ResolvedConfig = ResolvedConfig>(options: ExecutionOptions, config: InlineConfig): Promise<PowerlinesExecution<TResolvedConfig>>;
22
+ static init<TResolvedConfig extends ResolvedConfig = ResolvedConfig>(options: ExecutionOptions, initialConfig?: InitialConfig<TResolvedConfig["userConfig"]>): Promise<PowerlinesExecution<TResolvedConfig>>;
23
+ /**
24
+ * The Powerlines context
25
+ */
26
+ get context(): ExecutionContext<TResolvedConfig>;
27
+ /**
28
+ * Initialize the execution API with the provided configuration options
29
+ */
30
+ setup(): Promise<void>;
27
31
  /**
28
32
  * Generate the Powerlines typescript declaration file
29
33
  *
@@ -149,19 +153,14 @@ declare class PowerlinesExecution<TResolvedConfig extends ResolvedConfig = Resol
149
153
  * @public
150
154
  */
151
155
  declare class PowerlinesAPI<TResolvedConfig extends ResolvedConfig = ResolvedConfig> extends PowerlinesExecution<TResolvedConfig> implements API<TResolvedConfig>, AsyncDisposable {
152
- /**
153
- * Create a new Powerlines API instance
154
- *
155
- * @param context - The Powerlines context
156
- */
157
- protected constructor(context: ExecutionContext<TResolvedConfig>);
158
156
  /**
159
157
  * Initialize a Powerlines API instance
160
158
  *
161
159
  * @param options - The options to initialize the API with
160
+ * @param initialConfig - The initial configuration for the API, which can be used to provide additional context or override certain configuration values during initialization. This is particularly useful when initializing the API from a CLI command, where the CLI flags can be passed as part of the initial configuration to ensure they are properly merged with the configuration file and made available to plugins during their setup and execution.
162
161
  * @returns A new instance of the Powerlines API
163
162
  */
164
- static fromOptions<TResolvedConfig extends ResolvedConfig = ResolvedConfig>(options: PartialKeys<ExecutionOptions, "executionId" | "executionIndex">, override?: InlineConfig): Promise<PowerlinesAPI<TResolvedConfig>>;
163
+ static init<TResolvedConfig extends ResolvedConfig = ResolvedConfig>(options: PartialKeys<ExecutionOptions, "executionId" | "executionIndex">, initialConfig?: InitialConfig<TResolvedConfig["userConfig"]>): Promise<PowerlinesAPI<TResolvedConfig>>;
165
164
  /**
166
165
  * Generate the Powerlines typescript declaration file
167
166
  *
@@ -259,6 +258,12 @@ declare class PowerlinesAPI<TResolvedConfig extends ResolvedConfig = ResolvedCon
259
258
  * This method will finalize the Powerlines API instance, cleaning up any resources used.
260
259
  */
261
260
  [Symbol.asyncDispose](): Promise<void>;
261
+ /**
262
+ * Create a new Powerlines API instance
263
+ *
264
+ * @param context - The Powerlines context
265
+ */
266
+ protected constructor(context: ExecutionContext<TResolvedConfig>);
262
267
  }
263
268
  //#endregion
264
269
  export { PowerlinesAPI };
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.mts","names":[],"sources":["../src/_internal/execution.ts","../src/api.ts"],"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eACZ,WAAA,CAAY,iBAAA,eAAmD,OAAA;EDyoCtC;;;;;;;;;ECrnCT,KAAA,CACpB,YAAA,GAAc,WAAA,CAAY,iBAAA,eAEzB,OAAA;EDmoC4B;;;;;;EClnCT,IAAA,CACpB,YAAA,GAAc,gBAAA,GAAsC,OAAA;ED3MlC;;;;;;;;ECgOE,MAAA,CACpB,YAAA,GAAc,WAAA,CAAY,kBAAA,eAEzB,OAAA;EDgcwC;;;;;;;;EC7arB,QAAA,CAAA,GAAQ,OAAA;EDkcnB;;;;;;EAAA,CClbG,MAAA,CAAO,YAAA,KAAa,OAAA;EDsfN;;;;;EAAA,UC7enB,WAAA,CAAa,OAAA,EAAS,gBAAA,CAAiB,eAAA;AAAA"}
package/dist/api.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as mergeConfigs, i as callHook, s as writeMetaFile, t as PowerlinesExecutionContext } from "./execution-context-D9Enw3J5.mjs";
1
+ import { a as mergeConfigs, i as callHook, s as writeMetaFile, t as PowerlinesExecutionContext } from "./execution-context-Cr_VUBrP.mjs";
2
2
  import { a as isIncludeMatchFound, i as getTsconfigFilePath, r as getParsedTypeScriptConfig } from "./tsconfig-CI6bla4E.mjs";
3
3
  import { n as createProgram } from "./ts-morph-D0CaA37w.mjs";
4
4
  import { toArray } from "@stryke/convert/to-array";
@@ -686,47 +686,53 @@ ${formatTypes(code)}
686
686
  `);
687
687
  }
688
688
  /**
689
+ * Initialize a Powerlines API instance
690
+ *
691
+ * @param options - The options to initialize the API with
692
+ * @returns A new instance of the Powerlines API
693
+ */
694
+ static async init(options, initialConfig) {
695
+ const api = new PowerlinesExecution(await PowerlinesExecutionContext.init(options, initialConfig ?? {}));
696
+ api.#context.config.initialConfig = initialConfig ?? {};
697
+ await api.setup();
698
+ return api;
699
+ }
700
+ /**
689
701
  * The Powerlines context
690
702
  */
691
703
  get context() {
692
704
  return this.#context;
693
705
  }
694
706
  /**
695
- * Initialize a Powerlines API instance
696
- *
697
- * @param options - The options to initialize the API with
698
- * @returns A new instance of the Powerlines API
707
+ * Initialize the execution API with the provided configuration options
699
708
  */
700
- static async fromConfig(options, config) {
701
- const api = new PowerlinesExecution(await PowerlinesExecutionContext.fromOptions(options));
702
- api.#context.config.inlineConfig = config;
703
- await api.#context.setup();
704
- api.#context.$$internal = {
705
- api,
706
- addPlugin: api.addPlugin.bind(api)
709
+ async setup() {
710
+ await this.#context.setup();
711
+ this.#context.$$internal = {
712
+ api: this,
713
+ addPlugin: this.addPlugin.bind(this)
707
714
  };
708
- const timer = api.context.timer("Initialization");
709
- for (const plugin of api.context.config.plugins.flatMap((p) => toArray(p)) ?? []) await api.addPlugin(plugin);
710
- if (api.context.plugins.length === 0) api.context.warn({
715
+ const timer = this.#context.timer("Initialization");
716
+ for (const plugin of this.#context.config.plugins.flatMap((p) => toArray(p)) ?? []) await this.addPlugin(plugin);
717
+ if (this.#context.plugins.length === 0) this.#context.warn({
711
718
  meta: { category: "plugins" },
712
719
  message: "No Powerlines plugins were specified in the options. Please ensure this is correct, as it is generally not recommended."
713
720
  });
714
- else api.context.info({
721
+ else this.#context.info({
715
722
  meta: { category: "plugins" },
716
- message: `Loaded ${api.context.plugins.length} ${titleCase(api.context.config.framework)} plugin${api.context.plugins.length > 1 ? "s" : ""}: \n${api.context.plugins.map((plugin, index) => ` ${index + 1}. ${colorText(plugin.name)}`).join("\n")}`
723
+ message: `Loaded ${this.#context.plugins.length} ${titleCase(this.#context.config.framework)} plugin${this.#context.plugins.length > 1 ? "s" : ""}: \n${this.#context.plugins.map((plugin, index) => ` ${index + 1}. ${colorText(plugin.name)}`).join("\n")}`
717
724
  });
718
- const pluginConfig = await api.callHook("config", {
719
- environment: await api.context.getEnvironment(),
725
+ const pluginConfig = await this.callHook("config", {
726
+ environment: await this.#context.getEnvironment(),
720
727
  sequential: true,
721
728
  result: "merge",
722
729
  merge: mergeConfigs
723
730
  });
724
731
  if (pluginConfig) {
725
- api.#context.config.pluginConfig = pluginConfig;
726
- await api.#context.setup();
732
+ this.#context.config.pluginConfig = pluginConfig;
733
+ await this.#context.setup();
727
734
  }
728
735
  timer();
729
- return api;
730
736
  }
731
737
  /**
732
738
  * Generate the Powerlines typescript declaration file
@@ -740,7 +746,7 @@ ${formatTypes(code)}
740
746
  this.context.debug(" Aggregating configuration options for the Powerlines project");
741
747
  inlineConfig.command ??= "types";
742
748
  this.context.config.inlineConfig = inlineConfig;
743
- await this.context.setup();
749
+ await this.setup();
744
750
  await this.#executeEnvironments(async (context) => {
745
751
  context.debug(`Initializing the processing options for the Powerlines project.`);
746
752
  await this.callHook("configResolved", {
@@ -791,7 +797,7 @@ ${formatTypes(code)}
791
797
  async prepare(inlineConfig = { command: "prepare" }) {
792
798
  inlineConfig.command ??= "prepare";
793
799
  this.context.config.inlineConfig = inlineConfig;
794
- await this.context.setup();
800
+ await this.setup();
795
801
  await this.#executeEnvironments(async (context) => {
796
802
  context.debug(`Initializing the processing options for the Powerlines project.`);
797
803
  await this.callHook("configResolved", {
@@ -811,12 +817,23 @@ ${formatTypes(code)}
811
817
  environment: context,
812
818
  order: "post"
813
819
  });
814
- context.trace(`Powerlines configuration has been resolved: \n\n${formatLogMessage({
815
- ...context.config,
816
- userConfig: isSetObject(context.config.userConfig) ? omit(context.config.userConfig, ["plugins"]) : void 0,
817
- inlineConfig: isSetObject(context.config.inlineConfig) ? omit(context.config.inlineConfig, ["plugins"]) : void 0,
818
- plugins: context.plugins.map((plugin) => plugin.plugin.name)
819
- })}`);
820
+ context.trace({
821
+ meta: { category: "config" },
822
+ message: `Powerlines configuration after configResolved hook: \n${formatLogMessage({
823
+ ...omit(context.config, [
824
+ "inlineConfig",
825
+ "userConfig",
826
+ "initialConfig",
827
+ "pluginConfig",
828
+ "plugins"
829
+ ]),
830
+ plugins: context.plugins.map((plugin) => plugin.plugin.name),
831
+ inlineConfig: isSetObject(context.config.inlineConfig) ? omit(context.config.inlineConfig, ["plugins"]) : void 0,
832
+ userConfig: isSetObject(context.config.userConfig) ? omit(context.config.userConfig, ["plugins"]) : void 0,
833
+ initialConfig: isSetObject(context.config.initialConfig) ? omit(context.config.initialConfig, ["plugins"]) : void 0,
834
+ pluginConfig: isSetObject(context.config.pluginConfig) ? omit(context.config.pluginConfig, ["plugins"]) : void 0
835
+ })}`
836
+ });
820
837
  if (!context.fs.existsSync(context.cachePath)) await createDirectory(context.cachePath);
821
838
  if (!context.fs.existsSync(context.dataPath)) await createDirectory(context.dataPath);
822
839
  await this.callHook("prepare", {
@@ -1065,36 +1082,25 @@ ${formatTypes(code)}
1065
1082
  * @public
1066
1083
  */
1067
1084
  var PowerlinesAPI = class PowerlinesAPI extends PowerlinesExecution {
1068
- /**
1069
- * Create a new Powerlines API instance
1070
- *
1071
- * @param context - The Powerlines context
1072
- */
1073
- constructor(context) {
1074
- super(context);
1075
- }
1076
1085
  /**
1077
1086
  * Initialize a Powerlines API instance
1078
1087
  *
1079
1088
  * @param options - The options to initialize the API with
1089
+ * @param initialConfig - The initial configuration for the API, which can be used to provide additional context or override certain configuration values during initialization. This is particularly useful when initializing the API from a CLI command, where the CLI flags can be passed as part of the initial configuration to ensure they are properly merged with the configuration file and made available to plugins during their setup and execution.
1080
1090
  * @returns A new instance of the Powerlines API
1081
1091
  */
1082
- static async fromOptions(options, override) {
1083
- const api = new PowerlinesAPI(await PowerlinesExecutionContext.fromOptions({
1092
+ static async init(options, initialConfig) {
1093
+ const api = new PowerlinesAPI(await PowerlinesExecutionContext.init({
1084
1094
  executionId: uuid(),
1085
1095
  executionIndex: 0,
1086
1096
  ...options
1087
- }));
1088
- if (override) {
1089
- api.context.config.inlineConfig = override;
1090
- await api.context.setup();
1091
- }
1097
+ }, initialConfig ?? {}));
1092
1098
  api.context.$$internal = {
1093
1099
  api,
1094
1100
  addPlugin: api.addPlugin.bind(api)
1095
1101
  };
1096
1102
  const timer = api.context.timer("Initialization");
1097
- for (const plugin of api.context.config.plugins.flat(10) ?? []) await api.addPlugin(plugin);
1103
+ for (const plugin of api.context.config.plugins.flatMap((p) => toArray(p)) ?? []) await api.addPlugin(plugin);
1098
1104
  if (api.context.plugins.length === 0) api.context.warn({
1099
1105
  meta: { category: "plugins" },
1100
1106
  message: "No Powerlines plugins were specified in the options. Please ensure this is correct, as it is generally not recommended."
@@ -1276,6 +1282,14 @@ var PowerlinesAPI = class PowerlinesAPI extends PowerlinesExecution {
1276
1282
  async [Symbol.asyncDispose]() {
1277
1283
  await this.finalize();
1278
1284
  }
1285
+ /**
1286
+ * Create a new Powerlines API instance
1287
+ *
1288
+ * @param context - The Powerlines context
1289
+ */
1290
+ constructor(context) {
1291
+ super(context);
1292
+ }
1279
1293
  };
1280
1294
 
1281
1295
  //#endregion