@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/index.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_engine_context = require('./engine-context-D1_U6xVC.cjs');
3
+ const require_engine_context = require('./engine-context-CI_0NWIk.cjs');
4
4
  let _powerlines_core_constants = require("@powerlines/core/constants");
5
5
  let _stryke_convert_to_array = require("@stryke/convert/to-array");
6
6
  let _stryke_fs_resolve = require("@stryke/fs/resolve");
@@ -410,10 +410,11 @@ var PowerlinesEngine = class PowerlinesEngine {
410
410
  * Create a new Powerlines Engine instance
411
411
  *
412
412
  * @param options - The options to initialize the context with
413
+ * @param initialConfig - The initial configuration for the context, which can be used to provide additional context or override certain configuration values during initialization. This is particularly useful when initializing the context 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.
413
414
  * @returns A new instance of the Powerlines Engine
414
415
  */
415
- static async fromOptions(options) {
416
- const api = new PowerlinesEngine(await require_engine_context.PowerlinesEngineContext.fromOptions(options));
416
+ static async init(options, initialConfig = {}) {
417
+ const api = new PowerlinesEngine(await require_engine_context.PowerlinesEngineContext.init(options, initialConfig));
417
418
  const packagePath = await (0, _stryke_fs_resolve.resolvePackage)("@powerlines/engine");
418
419
  if (!packagePath) throw new Error("Could not resolve `@powerlines/engine` package location.");
419
420
  api.#worker = new Worker((0, _stryke_path_join.joinPaths)(packagePath, "./_internal/worker.mjs"), {
@@ -431,14 +432,6 @@ var PowerlinesEngine = class PowerlinesEngine {
431
432
  return this.#context;
432
433
  }
433
434
  /**
434
- * Create a new Powerlines Engine instance
435
- *
436
- * @param context - The Powerlines context
437
- */
438
- constructor(context) {
439
- this.#context = context;
440
- }
441
- /**
442
435
  * Generate the Powerlines typescript declaration file
443
436
  *
444
437
  * @remarks
@@ -453,7 +446,8 @@ var PowerlinesEngine = class PowerlinesEngine {
453
446
  inlineConfig.command ??= "types";
454
447
  await Promise.all(this.#context.executions.map(async (execution) => this.#worker.types({
455
448
  options: execution.options,
456
- config: inlineConfig
449
+ initialConfig: this.#context.initialConfig,
450
+ inlineConfig
457
451
  })));
458
452
  this.context.debug("✔ Powerlines types generation has completed successfully");
459
453
  timer();
@@ -473,7 +467,8 @@ var PowerlinesEngine = class PowerlinesEngine {
473
467
  inlineConfig.command ??= "prepare";
474
468
  await Promise.all(this.#context.executions.map(async (execution) => this.#worker.prepare({
475
469
  options: execution.options,
476
- config: inlineConfig
470
+ initialConfig: this.#context.initialConfig,
471
+ inlineConfig
477
472
  })));
478
473
  this.context.debug("✔ Powerlines preparation has completed successfully");
479
474
  timer();
@@ -493,7 +488,8 @@ var PowerlinesEngine = class PowerlinesEngine {
493
488
  inlineConfig.command ??= "new";
494
489
  await Promise.all(this.#context.executions.map(async (execution) => this.#worker.new({
495
490
  options: execution.options,
496
- config: inlineConfig
491
+ initialConfig: this.#context.initialConfig,
492
+ inlineConfig
497
493
  })));
498
494
  this.context.debug("✔ Powerlines new command completed successfully");
499
495
  timer();
@@ -513,7 +509,8 @@ var PowerlinesEngine = class PowerlinesEngine {
513
509
  inlineConfig.command ??= "clean";
514
510
  await Promise.all(this.#context.executions.map(async (execution) => this.#worker.clean({
515
511
  options: execution.options,
516
- config: inlineConfig
512
+ initialConfig: this.#context.initialConfig,
513
+ inlineConfig
517
514
  })));
518
515
  this.context.debug("✔ Powerlines cleaning completed successfully");
519
516
  timer();
@@ -530,7 +527,8 @@ var PowerlinesEngine = class PowerlinesEngine {
530
527
  inlineConfig.command ??= "lint";
531
528
  await Promise.all(this.#context.executions.map(async (execution) => this.#worker.lint({
532
529
  options: execution.options,
533
- config: inlineConfig
530
+ initialConfig: this.#context.initialConfig,
531
+ inlineConfig
534
532
  })));
535
533
  this.context.debug("✔ Powerlines linting completed successfully");
536
534
  timer();
@@ -550,7 +548,8 @@ var PowerlinesEngine = class PowerlinesEngine {
550
548
  inlineConfig.command ??= "test";
551
549
  await Promise.all(this.#context.executions.map(async (execution) => this.#worker.test({
552
550
  options: execution.options,
553
- config: inlineConfig
551
+ initialConfig: this.#context.initialConfig,
552
+ inlineConfig
554
553
  })));
555
554
  this.context.debug("✔ Powerlines testing completed successfully");
556
555
  timer();
@@ -569,7 +568,8 @@ var PowerlinesEngine = class PowerlinesEngine {
569
568
  this.context.info("📦 Building the Powerlines project");
570
569
  await Promise.all(this.#context.executions.map(async (execution) => this.#worker.build({
571
570
  options: execution.options,
572
- config: inlineConfig
571
+ initialConfig: this.#context.initialConfig,
572
+ inlineConfig
573
573
  })));
574
574
  this.context.debug("✔ Powerlines build completed successfully");
575
575
  timer();
@@ -586,7 +586,8 @@ var PowerlinesEngine = class PowerlinesEngine {
586
586
  inlineConfig.command ??= "docs";
587
587
  await Promise.all(this.#context.executions.map(async (execution) => this.#worker.docs({
588
588
  options: execution.options,
589
- config: inlineConfig
589
+ initialConfig: this.#context.initialConfig,
590
+ inlineConfig
590
591
  })));
591
592
  this.context.debug("✔ Powerlines documentation generation completed successfully");
592
593
  timer();
@@ -605,7 +606,8 @@ var PowerlinesEngine = class PowerlinesEngine {
605
606
  inlineConfig.command ??= "deploy";
606
607
  await Promise.all(this.#context.executions.map(async (execution) => this.#worker.deploy({
607
608
  options: execution.options,
608
- config: inlineConfig
609
+ initialConfig: this.#context.initialConfig,
610
+ inlineConfig
609
611
  })));
610
612
  this.context.debug("✔ Powerlines deploy completed successfully");
611
613
  timer();
@@ -632,6 +634,14 @@ var PowerlinesEngine = class PowerlinesEngine {
632
634
  return this.finalize();
633
635
  }
634
636
  /**
637
+ * Create a new Powerlines Engine instance
638
+ *
639
+ * @param context - The Powerlines context
640
+ */
641
+ constructor(context) {
642
+ this.#context = context;
643
+ }
644
+ /**
635
645
  * Handle incoming IPC messages from the worker processes, routing them to the appropriate handlers based on the message type.
636
646
  *
637
647
  * @param message - The IPC message received from a worker process
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { BuildInlineConfig, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, Engine, EngineContext, EngineOptions, LintInlineConfig, NewInlineConfig, PrepareInlineConfig, TestInlineConfig, TypesInlineConfig } from "@powerlines/core";
1
+ import { BuildInlineConfig, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, Engine, EngineContext, EngineOptions, InitialConfig, LintInlineConfig, NewInlineConfig, PrepareInlineConfig, TestInlineConfig, TypesInlineConfig } from "@powerlines/core";
2
2
  import { PartialKeys } from "@stryke/types/base";
3
3
 
4
4
  //#region src/index.d.ts
@@ -16,19 +16,14 @@ declare class PowerlinesEngine implements Engine, AsyncDisposable {
16
16
  * Create a new Powerlines Engine instance
17
17
  *
18
18
  * @param options - The options to initialize the context with
19
+ * @param initialConfig - The initial configuration for the context, which can be used to provide additional context or override certain configuration values during initialization. This is particularly useful when initializing the context 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.
19
20
  * @returns A new instance of the Powerlines Engine
20
21
  */
21
- static fromOptions(options: EngineOptions): Promise<PowerlinesEngine>;
22
+ static init(options: EngineOptions, initialConfig?: InitialConfig<any>): Promise<PowerlinesEngine>;
22
23
  /**
23
24
  * The Powerlines context
24
25
  */
25
26
  get context(): EngineContext;
26
- /**
27
- * Create a new Powerlines Engine instance
28
- *
29
- * @param context - The Powerlines context
30
- */
31
- protected constructor(context: EngineContext);
32
27
  /**
33
28
  * Generate the Powerlines typescript declaration file
34
29
  *
@@ -123,6 +118,12 @@ declare class PowerlinesEngine implements Engine, AsyncDisposable {
123
118
  * Asynchronous disposal method for the Powerlines Engine, which will call the finalize method to perform any necessary cleanup when the engine is disposed of.
124
119
  */
125
120
  [Symbol.asyncDispose](): Promise<void>;
121
+ /**
122
+ * Create a new Powerlines Engine instance
123
+ *
124
+ * @param context - The Powerlines context
125
+ */
126
+ protected constructor(context: EngineContext);
126
127
  /**
127
128
  * Handle incoming IPC messages from the worker processes, routing them to the appropriate handlers based on the message type.
128
129
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;AA+DA;;;;;;cAAa,gBAAA,YAA4B,MAAA,EAAQ,eAAA;EAAA;EAmEtC;;;;;;EAAA,OAlDW,WAAA,CAClB,OAAA,EAAS,aAAA,GACR,OAAA,CAAQ,gBAAA;EA0FY;;;EAAA,IAjEZ,OAAA,CAAA,GAAW,aAAA;EAkEJ;;;;;EAAA,UAzDT,WAAA,CAAa,OAAA,EAAS,aAAA;EA2Db;;;;;;;;EA/CL,KAAA,CACX,YAAA,GAAc,WAAA,CACZ,IAAA,CAAK,iBAAA,8BAIN,OAAA;EA4Ce;;;;;;;;EATL,OAAA,CACX,YAAA,GACI,WAAA,CAAY,IAAA,CAAK,mBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,iBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,eAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,iBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,iBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,gBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,gBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,kBAAA,8BAEpB,OAAA;EA8DoB;;;;;;;;;EA9BV,GAAA,CAAI,YAAA,EAAc,WAAA,CAAY,eAAA,eAA2B,OAAA;EA8DnE;;;;;;;;;EAnCU,KAAA,CACX,YAAA,GACI,WAAA,CAAY,IAAA,CAAK,iBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,mBAAA,8BAEpB,OAAA;EA4Fa;;;;;;EAnEH,IAAA,CACX,YAAA,G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@@ -1,4 +1,4 @@
1
- import { BuildInlineConfig, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, Engine, EngineContext, EngineOptions, LintInlineConfig, NewInlineConfig, PrepareInlineConfig, TestInlineConfig, TypesInlineConfig } from "@powerlines/core";
1
+ import { BuildInlineConfig, CleanInlineConfig, DeployInlineConfig, DocsInlineConfig, Engine, EngineContext, EngineOptions, InitialConfig, LintInlineConfig, NewInlineConfig, PrepareInlineConfig, TestInlineConfig, TypesInlineConfig } from "@powerlines/core";
2
2
  import { PartialKeys } from "@stryke/types/base";
3
3
 
4
4
  //#region src/index.d.ts
@@ -16,19 +16,14 @@ declare class PowerlinesEngine implements Engine, AsyncDisposable {
16
16
  * Create a new Powerlines Engine instance
17
17
  *
18
18
  * @param options - The options to initialize the context with
19
+ * @param initialConfig - The initial configuration for the context, which can be used to provide additional context or override certain configuration values during initialization. This is particularly useful when initializing the context 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.
19
20
  * @returns A new instance of the Powerlines Engine
20
21
  */
21
- static fromOptions(options: EngineOptions): Promise<PowerlinesEngine>;
22
+ static init(options: EngineOptions, initialConfig?: InitialConfig<any>): Promise<PowerlinesEngine>;
22
23
  /**
23
24
  * The Powerlines context
24
25
  */
25
26
  get context(): EngineContext;
26
- /**
27
- * Create a new Powerlines Engine instance
28
- *
29
- * @param context - The Powerlines context
30
- */
31
- protected constructor(context: EngineContext);
32
27
  /**
33
28
  * Generate the Powerlines typescript declaration file
34
29
  *
@@ -123,6 +118,12 @@ declare class PowerlinesEngine implements Engine, AsyncDisposable {
123
118
  * Asynchronous disposal method for the Powerlines Engine, which will call the finalize method to perform any necessary cleanup when the engine is disposed of.
124
119
  */
125
120
  [Symbol.asyncDispose](): Promise<void>;
121
+ /**
122
+ * Create a new Powerlines Engine instance
123
+ *
124
+ * @param context - The Powerlines context
125
+ */
126
+ protected constructor(context: EngineContext);
126
127
  /**
127
128
  * Handle incoming IPC messages from the worker processes, routing them to the appropriate handlers based on the message type.
128
129
  *
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;AA+DA;;;;;;cAAa,gBAAA,YAA4B,MAAA,EAAQ,eAAA;EAAA;EAmEtC;;;;;;EAAA,OAlDW,WAAA,CAClB,OAAA,EAAS,aAAA,GACR,OAAA,CAAQ,gBAAA;EA0FY;;;EAAA,IAjEZ,OAAA,CAAA,GAAW,aAAA;EAkEJ;;;;;EAAA,UAzDT,WAAA,CAAa,OAAA,EAAS,aAAA;EA2Db;;;;;;;;EA/CL,KAAA,CACX,YAAA,GAAc,WAAA,CACZ,IAAA,CAAK,iBAAA,8BAIN,OAAA;EA4Ce;;;;;;;;EATL,OAAA,CACX,YAAA,GACI,WAAA,CAAY,IAAA,CAAK,mBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,iBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,eAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,iBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,iBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,gBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,gBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,kBAAA,8BAEpB,OAAA;EA8DoB;;;;;;;;;EA9BV,GAAA,CAAI,YAAA,EAAc,WAAA,CAAY,eAAA,eAA2B,OAAA;EA8DnE;;;;;;;;;EAnCU,KAAA,CACX,YAAA,GACI,WAAA,CAAY,IAAA,CAAK,iBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,mBAAA,8BAEpB,OAAA;EA4Fa;;;;;;EAnEH,IAAA,CACX,YAAA,GACI,WAAA,CAAY,IAAA,CAAK,gBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,iBAAA,8BAEpB,OAAA;EAiIC;;;;;;;;;EArGS,IAAA,CACX,YAAA,GACI,WAAA,CAAY,IAAA,CAAK,gBAAA,8BACjB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AA,CAAK,kBAAA,8BAEpB,OAAA;EAiC4B;;;;;;;;;EAAlB,GAAA,CAAI,YAAA,EAAc,WAAA,CAAY,eAAA,eAA2B,OAAA;EA6DpD;;;;;;;;;EAjCL,KAAA,CACX,YAAA,GACI,WAAA,CAAY,IAAA,CAAK,iBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,mBAAA,8BAEpB,OAAA;EA+De;;;;;;EArCL,IAAA,CACX,YAAA,GACI,WAAA,CAAY,IAAA,CAAK,gBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,iBAAA,8BAEpB,OAAA;EAgGM;;;;;;;;;EAnEI,IAAA,CACX,YAAA,GACI,WAAA,CAAY,IAAA,CAAK,gBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,iBAAA,8BAEpB,OAAA;EAiJW;;;;;;;;;EApHD,KAAA,CACX,YAAA,GAAc,WAAA,CACZ,IAAA,CAAK,iBAAA,8BAIN,OAAA;EAlQQ;;;;;;EA2RE,IAAA,CACX,YAAA,GAAc,WAAA,CACZ,IAAA,CAAK,gBAAA,8BAIN,OAAA;EAtQmB;;;;;;;;EAqST,MAAA,CACX,YAAA,GAAc,WAAA,CACZ,IAAA,CAAK,kBAAA,8BAIN,OAAA;EAnPe;;;;;;;;EAgRL,QAAA,CAAA,GAAQ,OAAA;EA7QH;;;EAAA,CA0RJ,MAAA,CAAO,YAAA,KAAa,OAAA;EAzRX;;;;;EAAA,UAkSd,WAAA,CAAa,OAAA,EAAS,aAAA;EAhSR;;;;;EAAA,QAyST,gBAAA;EAAA,QAuGA,cAAA;EAAA,QAsBA,kBAAA;EAAA,QAEA,gBAAA;EAAA,QAEA,mBAAA;AAAA"}
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as PowerlinesEngineContext } from "./engine-context-C-11i43N.mjs";
1
+ import { t as PowerlinesEngineContext } from "./engine-context-_RMFwG4J.mjs";
2
2
  import { POWERLINES_API_FUNCTIONS } from "@powerlines/core/constants";
3
3
  import { toArray } from "@stryke/convert/to-array";
4
4
  import { resolvePackage } from "@stryke/fs/resolve";
@@ -408,10 +408,11 @@ var PowerlinesEngine = class PowerlinesEngine {
408
408
  * Create a new Powerlines Engine instance
409
409
  *
410
410
  * @param options - The options to initialize the context with
411
+ * @param initialConfig - The initial configuration for the context, which can be used to provide additional context or override certain configuration values during initialization. This is particularly useful when initializing the context 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.
411
412
  * @returns A new instance of the Powerlines Engine
412
413
  */
413
- static async fromOptions(options) {
414
- const api = new PowerlinesEngine(await PowerlinesEngineContext.fromOptions(options));
414
+ static async init(options, initialConfig = {}) {
415
+ const api = new PowerlinesEngine(await PowerlinesEngineContext.init(options, initialConfig));
415
416
  const packagePath = await resolvePackage("@powerlines/engine");
416
417
  if (!packagePath) throw new Error("Could not resolve `@powerlines/engine` package location.");
417
418
  api.#worker = new Worker$1(joinPaths(packagePath, "./_internal/worker.mjs"), {
@@ -429,14 +430,6 @@ var PowerlinesEngine = class PowerlinesEngine {
429
430
  return this.#context;
430
431
  }
431
432
  /**
432
- * Create a new Powerlines Engine instance
433
- *
434
- * @param context - The Powerlines context
435
- */
436
- constructor(context) {
437
- this.#context = context;
438
- }
439
- /**
440
433
  * Generate the Powerlines typescript declaration file
441
434
  *
442
435
  * @remarks
@@ -451,7 +444,8 @@ var PowerlinesEngine = class PowerlinesEngine {
451
444
  inlineConfig.command ??= "types";
452
445
  await Promise.all(this.#context.executions.map(async (execution) => this.#worker.types({
453
446
  options: execution.options,
454
- config: inlineConfig
447
+ initialConfig: this.#context.initialConfig,
448
+ inlineConfig
455
449
  })));
456
450
  this.context.debug("✔ Powerlines types generation has completed successfully");
457
451
  timer();
@@ -471,7 +465,8 @@ var PowerlinesEngine = class PowerlinesEngine {
471
465
  inlineConfig.command ??= "prepare";
472
466
  await Promise.all(this.#context.executions.map(async (execution) => this.#worker.prepare({
473
467
  options: execution.options,
474
- config: inlineConfig
468
+ initialConfig: this.#context.initialConfig,
469
+ inlineConfig
475
470
  })));
476
471
  this.context.debug("✔ Powerlines preparation has completed successfully");
477
472
  timer();
@@ -491,7 +486,8 @@ var PowerlinesEngine = class PowerlinesEngine {
491
486
  inlineConfig.command ??= "new";
492
487
  await Promise.all(this.#context.executions.map(async (execution) => this.#worker.new({
493
488
  options: execution.options,
494
- config: inlineConfig
489
+ initialConfig: this.#context.initialConfig,
490
+ inlineConfig
495
491
  })));
496
492
  this.context.debug("✔ Powerlines new command completed successfully");
497
493
  timer();
@@ -511,7 +507,8 @@ var PowerlinesEngine = class PowerlinesEngine {
511
507
  inlineConfig.command ??= "clean";
512
508
  await Promise.all(this.#context.executions.map(async (execution) => this.#worker.clean({
513
509
  options: execution.options,
514
- config: inlineConfig
510
+ initialConfig: this.#context.initialConfig,
511
+ inlineConfig
515
512
  })));
516
513
  this.context.debug("✔ Powerlines cleaning completed successfully");
517
514
  timer();
@@ -528,7 +525,8 @@ var PowerlinesEngine = class PowerlinesEngine {
528
525
  inlineConfig.command ??= "lint";
529
526
  await Promise.all(this.#context.executions.map(async (execution) => this.#worker.lint({
530
527
  options: execution.options,
531
- config: inlineConfig
528
+ initialConfig: this.#context.initialConfig,
529
+ inlineConfig
532
530
  })));
533
531
  this.context.debug("✔ Powerlines linting completed successfully");
534
532
  timer();
@@ -548,7 +546,8 @@ var PowerlinesEngine = class PowerlinesEngine {
548
546
  inlineConfig.command ??= "test";
549
547
  await Promise.all(this.#context.executions.map(async (execution) => this.#worker.test({
550
548
  options: execution.options,
551
- config: inlineConfig
549
+ initialConfig: this.#context.initialConfig,
550
+ inlineConfig
552
551
  })));
553
552
  this.context.debug("✔ Powerlines testing completed successfully");
554
553
  timer();
@@ -567,7 +566,8 @@ var PowerlinesEngine = class PowerlinesEngine {
567
566
  this.context.info("📦 Building the Powerlines project");
568
567
  await Promise.all(this.#context.executions.map(async (execution) => this.#worker.build({
569
568
  options: execution.options,
570
- config: inlineConfig
569
+ initialConfig: this.#context.initialConfig,
570
+ inlineConfig
571
571
  })));
572
572
  this.context.debug("✔ Powerlines build completed successfully");
573
573
  timer();
@@ -584,7 +584,8 @@ var PowerlinesEngine = class PowerlinesEngine {
584
584
  inlineConfig.command ??= "docs";
585
585
  await Promise.all(this.#context.executions.map(async (execution) => this.#worker.docs({
586
586
  options: execution.options,
587
- config: inlineConfig
587
+ initialConfig: this.#context.initialConfig,
588
+ inlineConfig
588
589
  })));
589
590
  this.context.debug("✔ Powerlines documentation generation completed successfully");
590
591
  timer();
@@ -603,7 +604,8 @@ var PowerlinesEngine = class PowerlinesEngine {
603
604
  inlineConfig.command ??= "deploy";
604
605
  await Promise.all(this.#context.executions.map(async (execution) => this.#worker.deploy({
605
606
  options: execution.options,
606
- config: inlineConfig
607
+ initialConfig: this.#context.initialConfig,
608
+ inlineConfig
607
609
  })));
608
610
  this.context.debug("✔ Powerlines deploy completed successfully");
609
611
  timer();
@@ -630,6 +632,14 @@ var PowerlinesEngine = class PowerlinesEngine {
630
632
  return this.finalize();
631
633
  }
632
634
  /**
635
+ * Create a new Powerlines Engine instance
636
+ *
637
+ * @param context - The Powerlines context
638
+ */
639
+ constructor(context) {
640
+ this.#context = context;
641
+ }
642
+ /**
633
643
  * Handle incoming IPC messages from the worker processes, routing them to the appropriate handlers based on the message type.
634
644
  *
635
645
  * @param message - The IPC message received from a worker process