@powerlines/engine 0.43.28 → 0.43.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_internal/worker.cjs +18 -8
- package/dist/_internal/worker.mjs +18 -8
- package/dist/_internal/worker.mjs.map +1 -1
- package/dist/api.cjs +1 -1
- package/dist/api.mjs +1 -1
- package/dist/{base-context-BgAxrobW.cjs → base-context-B9AROf66.cjs} +11 -2
- package/dist/{base-context-D9PKchy4.mjs → base-context-D8a2XGIK.mjs} +12 -3
- package/dist/base-context-D8a2XGIK.mjs.map +1 -0
- package/dist/context/index.cjs +3 -3
- package/dist/context/index.d.cts +4 -0
- package/dist/context/index.d.cts.map +1 -1
- package/dist/context/index.d.mts +4 -0
- package/dist/context/index.d.mts.map +1 -1
- package/dist/context/index.mjs +3 -3
- package/dist/{engine-context-B7_Cc9N2.mjs → engine-context-DsA9XGVb.mjs} +2 -2
- package/dist/{engine-context-B7_Cc9N2.mjs.map → engine-context-DsA9XGVb.mjs.map} +1 -1
- package/dist/{engine-context-B5zOInDj.cjs → engine-context-qCVw66U_.cjs} +1 -1
- package/dist/{execution-context-BmRT3Anb.mjs → execution-context-CBJxP2B2.mjs} +10 -8
- package/dist/execution-context-CBJxP2B2.mjs.map +1 -0
- package/dist/{execution-context-R45_zd18.cjs → execution-context-CprxWvYn.cjs} +9 -7
- package/dist/index.cjs +22 -17
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +22 -17
- package/dist/index.mjs.map +1 -1
- package/package.json +17 -16
- package/dist/base-context-D9PKchy4.mjs.map +0 -1
- package/dist/execution-context-BmRT3Anb.mjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
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-
|
|
3
|
+
const require_engine_context = require('./engine-context-qCVw66U_.cjs');
|
|
4
4
|
let _powerlines_core_constants = require("@powerlines/core/constants");
|
|
5
|
+
let _stryke_async_node = require("@stryke/async/node");
|
|
5
6
|
let _stryke_fs_resolve = require("@stryke/fs/resolve");
|
|
6
7
|
let _stryke_path_join = require("@stryke/path/join");
|
|
7
8
|
let _storm_software_config_tools_types = require("@storm-software/config-tools/types");
|
|
@@ -344,6 +345,10 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
344
345
|
*/
|
|
345
346
|
#worker;
|
|
346
347
|
/**
|
|
348
|
+
* The queue for managing concurrent execution of Powerlines commands, ensuring that commands are executed in a controlled manner to prevent resource exhaustion and ensure optimal performance.
|
|
349
|
+
*/
|
|
350
|
+
#queue = new _stryke_async_node.PQueue();
|
|
351
|
+
/**
|
|
347
352
|
* Create a new Powerlines Engine instance
|
|
348
353
|
*
|
|
349
354
|
* @param options - The options to initialize the context with
|
|
@@ -406,10 +411,10 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
406
411
|
this.context.info(" 🏗️ Preparing the Powerlines project");
|
|
407
412
|
this.context.debug("Aggregating configuration options for the Powerlines project");
|
|
408
413
|
inlineConfig.command ??= "prepare";
|
|
409
|
-
await Promise.all(this.#context.executions.map(async (options) => this.#worker.prepare({
|
|
414
|
+
await Promise.all(this.#context.executions.map(async (options) => this.#queue.add(async () => this.#worker.prepare({
|
|
410
415
|
options,
|
|
411
416
|
config: inlineConfig
|
|
412
|
-
})));
|
|
417
|
+
}))));
|
|
413
418
|
this.context.debug("✔ Powerlines preparation has completed successfully");
|
|
414
419
|
timer();
|
|
415
420
|
}
|
|
@@ -426,10 +431,10 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
426
431
|
const timer = this.context.timer("New");
|
|
427
432
|
this.context.info(" 🆕 Creating a new Powerlines project");
|
|
428
433
|
inlineConfig.command ??= "new";
|
|
429
|
-
await Promise.all(this.#context.executions.map(async (options) => this.#worker.new({
|
|
434
|
+
await Promise.all(this.#context.executions.map(async (options) => this.#queue.add(async () => this.#worker.new({
|
|
430
435
|
options,
|
|
431
436
|
config: inlineConfig
|
|
432
|
-
})));
|
|
437
|
+
}))));
|
|
433
438
|
this.context.debug("✔ Powerlines new command completed successfully");
|
|
434
439
|
timer();
|
|
435
440
|
}
|
|
@@ -446,10 +451,10 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
446
451
|
const timer = this.context.timer("Clean");
|
|
447
452
|
this.context.info(" 🧹 Cleaning the previous Powerlines artifacts");
|
|
448
453
|
inlineConfig.command ??= "clean";
|
|
449
|
-
await Promise.all(this.#context.executions.map(async (options) => this.#worker.clean({
|
|
454
|
+
await Promise.all(this.#context.executions.map(async (options) => this.#queue.add(async () => this.#worker.clean({
|
|
450
455
|
options,
|
|
451
456
|
config: inlineConfig
|
|
452
|
-
})));
|
|
457
|
+
}))));
|
|
453
458
|
this.context.debug("✔ Powerlines cleaning completed successfully");
|
|
454
459
|
timer();
|
|
455
460
|
}
|
|
@@ -463,10 +468,10 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
463
468
|
const timer = this.context.timer("Lint");
|
|
464
469
|
this.context.info(" 📝 Linting the Powerlines project");
|
|
465
470
|
inlineConfig.command ??= "lint";
|
|
466
|
-
await Promise.all(this.#context.executions.map(async (options) => this.#worker.lint({
|
|
471
|
+
await Promise.all(this.#context.executions.map(async (options) => this.#queue.add(async () => this.#worker.lint({
|
|
467
472
|
options,
|
|
468
473
|
config: inlineConfig
|
|
469
|
-
})));
|
|
474
|
+
}))));
|
|
470
475
|
this.context.debug("✔ Powerlines linting completed successfully");
|
|
471
476
|
timer();
|
|
472
477
|
}
|
|
@@ -483,10 +488,10 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
483
488
|
const timer = this.context.timer("Test");
|
|
484
489
|
this.context.info(" 🧪 Running tests for the Powerlines project");
|
|
485
490
|
inlineConfig.command ??= "test";
|
|
486
|
-
await Promise.all(this.#context.executions.map(async (options) => this.#worker.test({
|
|
491
|
+
await Promise.all(this.#context.executions.map(async (options) => this.#queue.add(async () => this.#worker.test({
|
|
487
492
|
options,
|
|
488
493
|
config: inlineConfig
|
|
489
|
-
})));
|
|
494
|
+
}))));
|
|
490
495
|
this.context.debug("✔ Powerlines testing completed successfully");
|
|
491
496
|
timer();
|
|
492
497
|
}
|
|
@@ -502,10 +507,10 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
502
507
|
async build(inlineConfig = { command: "build" }) {
|
|
503
508
|
const timer = this.context.timer("Build");
|
|
504
509
|
this.context.info(" 📦 Building the Powerlines project");
|
|
505
|
-
await Promise.all(this.#context.executions.map(async (options) => this.#worker.build({
|
|
510
|
+
await Promise.all(this.#context.executions.map(async (options) => this.#queue.add(async () => this.#worker.build({
|
|
506
511
|
options,
|
|
507
512
|
config: inlineConfig
|
|
508
|
-
})));
|
|
513
|
+
}))));
|
|
509
514
|
this.context.debug("✔ Powerlines build completed successfully");
|
|
510
515
|
timer();
|
|
511
516
|
}
|
|
@@ -519,10 +524,10 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
519
524
|
const timer = this.context.timer("Docs");
|
|
520
525
|
this.context.info(" 📓 Generating documentation for the Powerlines project");
|
|
521
526
|
inlineConfig.command ??= "docs";
|
|
522
|
-
await Promise.all(this.#context.executions.map(async (options) => this.#worker.docs({
|
|
527
|
+
await Promise.all(this.#context.executions.map(async (options) => this.#queue.add(async () => this.#worker.docs({
|
|
523
528
|
options,
|
|
524
529
|
config: inlineConfig
|
|
525
|
-
})));
|
|
530
|
+
}))));
|
|
526
531
|
this.context.debug("✔ Powerlines documentation generation completed successfully");
|
|
527
532
|
timer();
|
|
528
533
|
}
|
|
@@ -538,10 +543,10 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
538
543
|
const timer = this.context.timer("Deploy");
|
|
539
544
|
this.context.info(" 🚀 Deploying the Powerlines project");
|
|
540
545
|
inlineConfig.command ??= "deploy";
|
|
541
|
-
await Promise.all(this.#context.executions.map(async (options) => this.#worker.deploy({
|
|
546
|
+
await Promise.all(this.#context.executions.map(async (options) => this.#queue.add(async () => this.#worker.deploy({
|
|
542
547
|
options,
|
|
543
548
|
config: inlineConfig
|
|
544
|
-
})));
|
|
549
|
+
}))));
|
|
545
550
|
this.context.debug("✔ Powerlines deploy completed successfully");
|
|
546
551
|
timer();
|
|
547
552
|
}
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;AAiDA;;;;;;cAAa,gBAAA,YAA4B,MAAA,EAAQ,eAAA;EAAA;EAsEtC;;;;;;EAAA,OAhDW,WAAA,CAClB,OAAA,EAAS,aAAA,GACR,OAAA,CAAQ,gBAAA;EAwFY;;;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;EAkEoB;;;;;;;;;EAhCV,GAAA,CAAI,YAAA,EAAc,WAAA,CAAY,eAAA,eAA2B,OAAA;EAkEnE;;;;;;;;;EArCU,KAAA,CACX,YAAA,GACI,WAAA,CAAY,IAAA,CAAK,iBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,mBAAA,8BAEpB,OAAA;EAkGa;;;;;;EAvEH,IAAA,CACX,YAAA,GACI,WAAA,CAAY,IAAA,CAAK,gBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,iBAAA,8BAEpB,OAAA;EA2IC;;;;;;;;;EA7GS,IAAA,CACX,YAAA,GACI,WAAA,CAAY,IAAA,CAAK,gBAAA,8BACjB,WAAA,CAAY,IAAA,CAAK,iBAAA,8BAEpB,OAAA;EA/PoC;;;;;;;;;EA6R1B,KAAA,CACX,YAAA,GAAc,WAAA,CACZ,IAAA,CAAK,iBAAA,8BAIN,OAAA;EA3OM;;;;;;EAqQI,IAAA,CACX,YAAA,GAAc,WAAA,CACZ,IAAA,CAAK,gBAAA,8BAIN,OAAA;EA9PD;;;;;;;;EAgSW,MAAA,CACX,YAAA,GAAc,WAAA,CACZ,IAAA,CAAK,kBAAA,8BAIN,OAAA;EA1PG;;;;;;;;EAwRO,QAAA,CAAA,GAAQ,OAAA;EAAA,CAUd,MAAA,CAAO,YAAA,KAAa,OAAA;AAAA"}
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;AAiDA;;;;;;cAAa,gBAAA,YAA4B,MAAA,EAAQ,eAAA;EAAA;EAsEtC;;;;;;EAAA,OAhDW,WAAA,CAClB,OAAA,EAAS,aAAA,GACR,OAAA,CAAQ,gBAAA;EAwFY;;;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,iB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GED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { t as PowerlinesEngineContext } from "./engine-context-
|
|
1
|
+
import { t as PowerlinesEngineContext } from "./engine-context-DsA9XGVb.mjs";
|
|
2
2
|
import { POWERLINES_API_FUNCTIONS } from "@powerlines/core/constants";
|
|
3
|
+
import { PQueue } from "@stryke/async/node";
|
|
3
4
|
import { resolvePackage } from "@stryke/fs/resolve";
|
|
4
5
|
import { joinPaths } from "@stryke/path/join";
|
|
5
6
|
import { LogLevelLabel } from "@storm-software/config-tools/types";
|
|
@@ -342,6 +343,10 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
342
343
|
*/
|
|
343
344
|
#worker;
|
|
344
345
|
/**
|
|
346
|
+
* The queue for managing concurrent execution of Powerlines commands, ensuring that commands are executed in a controlled manner to prevent resource exhaustion and ensure optimal performance.
|
|
347
|
+
*/
|
|
348
|
+
#queue = new PQueue();
|
|
349
|
+
/**
|
|
345
350
|
* Create a new Powerlines Engine instance
|
|
346
351
|
*
|
|
347
352
|
* @param options - The options to initialize the context with
|
|
@@ -404,10 +409,10 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
404
409
|
this.context.info(" 🏗️ Preparing the Powerlines project");
|
|
405
410
|
this.context.debug("Aggregating configuration options for the Powerlines project");
|
|
406
411
|
inlineConfig.command ??= "prepare";
|
|
407
|
-
await Promise.all(this.#context.executions.map(async (options) => this.#worker.prepare({
|
|
412
|
+
await Promise.all(this.#context.executions.map(async (options) => this.#queue.add(async () => this.#worker.prepare({
|
|
408
413
|
options,
|
|
409
414
|
config: inlineConfig
|
|
410
|
-
})));
|
|
415
|
+
}))));
|
|
411
416
|
this.context.debug("✔ Powerlines preparation has completed successfully");
|
|
412
417
|
timer();
|
|
413
418
|
}
|
|
@@ -424,10 +429,10 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
424
429
|
const timer = this.context.timer("New");
|
|
425
430
|
this.context.info(" 🆕 Creating a new Powerlines project");
|
|
426
431
|
inlineConfig.command ??= "new";
|
|
427
|
-
await Promise.all(this.#context.executions.map(async (options) => this.#worker.new({
|
|
432
|
+
await Promise.all(this.#context.executions.map(async (options) => this.#queue.add(async () => this.#worker.new({
|
|
428
433
|
options,
|
|
429
434
|
config: inlineConfig
|
|
430
|
-
})));
|
|
435
|
+
}))));
|
|
431
436
|
this.context.debug("✔ Powerlines new command completed successfully");
|
|
432
437
|
timer();
|
|
433
438
|
}
|
|
@@ -444,10 +449,10 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
444
449
|
const timer = this.context.timer("Clean");
|
|
445
450
|
this.context.info(" 🧹 Cleaning the previous Powerlines artifacts");
|
|
446
451
|
inlineConfig.command ??= "clean";
|
|
447
|
-
await Promise.all(this.#context.executions.map(async (options) => this.#worker.clean({
|
|
452
|
+
await Promise.all(this.#context.executions.map(async (options) => this.#queue.add(async () => this.#worker.clean({
|
|
448
453
|
options,
|
|
449
454
|
config: inlineConfig
|
|
450
|
-
})));
|
|
455
|
+
}))));
|
|
451
456
|
this.context.debug("✔ Powerlines cleaning completed successfully");
|
|
452
457
|
timer();
|
|
453
458
|
}
|
|
@@ -461,10 +466,10 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
461
466
|
const timer = this.context.timer("Lint");
|
|
462
467
|
this.context.info(" 📝 Linting the Powerlines project");
|
|
463
468
|
inlineConfig.command ??= "lint";
|
|
464
|
-
await Promise.all(this.#context.executions.map(async (options) => this.#worker.lint({
|
|
469
|
+
await Promise.all(this.#context.executions.map(async (options) => this.#queue.add(async () => this.#worker.lint({
|
|
465
470
|
options,
|
|
466
471
|
config: inlineConfig
|
|
467
|
-
})));
|
|
472
|
+
}))));
|
|
468
473
|
this.context.debug("✔ Powerlines linting completed successfully");
|
|
469
474
|
timer();
|
|
470
475
|
}
|
|
@@ -481,10 +486,10 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
481
486
|
const timer = this.context.timer("Test");
|
|
482
487
|
this.context.info(" 🧪 Running tests for the Powerlines project");
|
|
483
488
|
inlineConfig.command ??= "test";
|
|
484
|
-
await Promise.all(this.#context.executions.map(async (options) => this.#worker.test({
|
|
489
|
+
await Promise.all(this.#context.executions.map(async (options) => this.#queue.add(async () => this.#worker.test({
|
|
485
490
|
options,
|
|
486
491
|
config: inlineConfig
|
|
487
|
-
})));
|
|
492
|
+
}))));
|
|
488
493
|
this.context.debug("✔ Powerlines testing completed successfully");
|
|
489
494
|
timer();
|
|
490
495
|
}
|
|
@@ -500,10 +505,10 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
500
505
|
async build(inlineConfig = { command: "build" }) {
|
|
501
506
|
const timer = this.context.timer("Build");
|
|
502
507
|
this.context.info(" 📦 Building the Powerlines project");
|
|
503
|
-
await Promise.all(this.#context.executions.map(async (options) => this.#worker.build({
|
|
508
|
+
await Promise.all(this.#context.executions.map(async (options) => this.#queue.add(async () => this.#worker.build({
|
|
504
509
|
options,
|
|
505
510
|
config: inlineConfig
|
|
506
|
-
})));
|
|
511
|
+
}))));
|
|
507
512
|
this.context.debug("✔ Powerlines build completed successfully");
|
|
508
513
|
timer();
|
|
509
514
|
}
|
|
@@ -517,10 +522,10 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
517
522
|
const timer = this.context.timer("Docs");
|
|
518
523
|
this.context.info(" 📓 Generating documentation for the Powerlines project");
|
|
519
524
|
inlineConfig.command ??= "docs";
|
|
520
|
-
await Promise.all(this.#context.executions.map(async (options) => this.#worker.docs({
|
|
525
|
+
await Promise.all(this.#context.executions.map(async (options) => this.#queue.add(async () => this.#worker.docs({
|
|
521
526
|
options,
|
|
522
527
|
config: inlineConfig
|
|
523
|
-
})));
|
|
528
|
+
}))));
|
|
524
529
|
this.context.debug("✔ Powerlines documentation generation completed successfully");
|
|
525
530
|
timer();
|
|
526
531
|
}
|
|
@@ -536,10 +541,10 @@ var PowerlinesEngine = class PowerlinesEngine {
|
|
|
536
541
|
const timer = this.context.timer("Deploy");
|
|
537
542
|
this.context.info(" 🚀 Deploying the Powerlines project");
|
|
538
543
|
inlineConfig.command ??= "deploy";
|
|
539
|
-
await Promise.all(this.#context.executions.map(async (options) => this.#worker.deploy({
|
|
544
|
+
await Promise.all(this.#context.executions.map(async (options) => this.#queue.add(async () => this.#worker.deploy({
|
|
540
545
|
options,
|
|
541
546
|
config: inlineConfig
|
|
542
|
-
})));
|
|
547
|
+
}))));
|
|
543
548
|
this.context.debug("✔ Powerlines deploy completed successfully");
|
|
544
549
|
timer();
|
|
545
550
|
}
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["Worker","#worker","JestWorker","#worker","Worker","#context"],"sources":["../src/_internal/helpers/worker.ts","../src/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { LogFn } from \"@powerlines/core\";\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { isSet } from \"@stryke/type-checks/is-set\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { Worker as JestWorker } from \"jest-worker\";\nimport type { ChildProcess } from \"node:child_process\";\nimport { Transform } from \"node:stream\";\nimport { parseArgs } from \"node:util\";\n\nconst RESTARTED = Symbol(\"powerlines-worker:restarted\");\n\n/**\n * The debug address is in the form of `[host:]port`. The host is optional.\n */\ninterface DebugAddress {\n host: string | undefined;\n port: number;\n}\n\n/**\n * Formats the debug address into a string.\n */\nconst formatDebugAddress = ({ host, port }: DebugAddress): string => {\n if (host) return `${host}:${port}`;\n return `${port}`;\n};\n\n/**\n * Node.js CLI flags that are not allowed in NODE_OPTIONS and must be\n * passed as direct CLI arguments via execArgv.\n * This set is the difference between all Node.js CLI flags and the ones **not**\n * allowed in NODE_OPTIONS, as listed in the Node.js documentation:\n * https://nodejs.org/api/cli.html#node_optionsoptions\n *\n * It is not exhaustive since not all options make sense for Powerlines (e.g. --test)\n */\nconst EXEC_ARGV_ONLY_OPTIONS = new Set([\n \"experimental-network-inspection\",\n \"experimental-storage-inspection\",\n \"experimental-worker-inspection\",\n \"experimental-inspector-network-resource\"\n]);\n\nfunction formatArg(\n key: string,\n value: string | boolean | undefined\n): string | null {\n if (value === true) {\n return `--${key}`;\n }\n\n if (value) {\n return `--${key}=${\n // Values with spaces need to be quoted. We use JSON.stringify to\n // also escape any nested quotes.\n value.includes(\" \") && !value.startsWith('\"')\n ? JSON.stringify(value)\n : value\n }`;\n }\n\n return null;\n}\n\n/**\n * Tokenizes the arguments string into an array of strings, supporting quoted\n * values and escaped characters.\n * Converted from: https://github.com/nodejs/node/blob/c29d53c5cfc63c5a876084e788d70c9e87bed880/src/node_options.cc#L1401\n *\n * @param input - The arguments string to be tokenized.\n * @returns An array of strings with the tokenized arguments.\n */\nconst tokenizeArgs = (input: string): string[] => {\n const args: string[] = [];\n let isInString = false;\n let willStartNewArg = true;\n\n for (let i = 0; i < input.length; i++) {\n let char = input[i];\n if (char) {\n // Skip any escaped characters in strings.\n if (char === \"\\\\\" && isInString) {\n // Ensure we don't have an escape character at the end.\n if (input.length === i + 1) {\n throw new Error(\"Invalid escape character at the end.\");\n }\n\n // Skip the next character.\n char = input[++i];\n if (!char) {\n continue;\n }\n }\n // If we find a space outside of a string, we should start a new argument.\n else if (char === \" \" && !isInString) {\n willStartNewArg = true;\n continue;\n }\n\n // If we find a quote, we should toggle the string flag.\n else if (char === '\"') {\n isInString = !isInString;\n continue;\n }\n\n // If we're starting a new argument, we should add it to the array.\n if (willStartNewArg) {\n args.push(char);\n willStartNewArg = false;\n }\n // Otherwise, add it to the last argument.\n else {\n args[args.length - 1] += char;\n }\n }\n }\n\n if (isInString) {\n throw new Error(\"Unterminated string\");\n }\n\n return args;\n};\n\n/**\n * Get the node options from the environment variable `NODE_OPTIONS` and returns\n * them as an array of strings.\n *\n * @returns An array of strings with the node options.\n */\nconst getNodeOptionsArgs = () => {\n if (!process.env.NODE_OPTIONS) return [];\n\n return tokenizeArgs(process.env.NODE_OPTIONS);\n};\n\n/**\n * Stringify the arguments to be used in a command line. It will ignore any\n * argument that has a value of `undefined`. Options that are not allowed in\n * NODE_OPTIONS are returned separately as execArgv.\n *\n * @param args - The arguments to be stringified.\n * @returns An object with `nodeOptions` string and `execArgv` array.\n */\nfunction formatNodeOptions(\n args: Record<string, string | boolean | undefined>\n): { nodeOptions: string; execArgv: string[] } {\n const nodeOptionsParts: string[] = [];\n const execArgv: string[] = [];\n\n for (const [key, value] of Object.entries(args)) {\n const formatted = formatArg(key, value);\n if (formatted === null) continue;\n\n if (EXEC_ARGV_ONLY_OPTIONS.has(key)) {\n execArgv.push(formatted);\n } else {\n nodeOptionsParts.push(formatted);\n }\n }\n\n return { nodeOptions: nodeOptionsParts.join(\" \"), execArgv };\n}\n\nexport type NodeOptions = Record<string, string | boolean | undefined>;\n\nconst parseNodeArgs = (args: string[]): NodeOptions => {\n const { values, tokens } = parseArgs({ args, strict: false, tokens: true });\n\n // For the `NODE_OPTIONS`, we support arguments with values without the `=`\n // sign. We need to parse them manually.\n let orphan = null;\n for (let i = 0; i < tokens.length; i++) {\n const token = tokens[i];\n if (!token) continue;\n\n if (token.kind === \"option-terminator\") {\n break;\n }\n\n // When we encounter an option, if it's value is undefined, we should check\n // to see if the following tokens are positional parameters. If they are,\n // then the option is orphaned, and we can assign it.\n if (token.kind === \"option\") {\n orphan = !isSet(token.value) ? token : null;\n continue;\n }\n\n // If the token isn't a positional one, then we can't assign it to the found\n // orphaned option.\n if (token.kind !== \"positional\") {\n orphan = null;\n continue;\n }\n\n // If we don't have an orphan, then we can skip this token.\n if (!orphan) {\n continue;\n }\n\n // If the token is a positional one, and it has a value, so add it to the\n // values object. If it already exists, append it with a space.\n if (orphan.name in values && isString(values[orphan.name])) {\n values[orphan.name] += ` ${token.value}`;\n } else {\n values[orphan.name] = token.value;\n }\n }\n\n return values;\n};\n\nfunction getParsedNodeOptions(): Record<string, string | boolean | undefined> {\n const args = [...process.execArgv, ...getNodeOptionsArgs()];\n if (args.length === 0) return {};\n\n return parseNodeArgs(args);\n}\n\n/**\n * Get's the debug address from the `NODE_OPTIONS` environment variable. If the\n * address is not found, it returns the default host (`undefined`) and port\n * (`9229`).\n *\n * @returns An object with the host and port of the debug address.\n */\nconst getParsedDebugAddress = (\n address: string | boolean | undefined\n): DebugAddress => {\n if (!address || !isString(address)) {\n return { host: undefined, port: 9229 };\n }\n\n // The address is in the form of `[host:]port`. Let's parse the address.\n if (address.includes(\":\")) {\n const [host, port] = address.split(\":\");\n if (!host || !port) {\n throw new Error(`Invalid debug address: ${address}`);\n }\n\n return { host, port: Number.parseInt(port, 10) };\n }\n\n return { host: undefined, port: Number.parseInt(address, 10) };\n};\n\ntype NodeInspectType = \"inspect\" | \"inspect-brk\" | undefined;\n\n/**\n * Get the debug type from the `NODE_OPTIONS` environment variable.\n */\nfunction getNodeDebugType(nodeOptions: NodeOptions): NodeInspectType {\n if (nodeOptions.inspect) {\n return \"inspect\";\n }\n if (nodeOptions[\"inspect-brk\"] || nodeOptions.inspect_brk) {\n return \"inspect-brk\";\n }\n\n return undefined;\n}\n\nconst cleanupWorkers = (worker: JestWorker) => {\n for (const curWorker of ((worker as any)._workerPool?._workers || []) as {\n _child?: ChildProcess;\n }[]) {\n curWorker._child?.kill(\"SIGINT\");\n }\n};\n\nexport type WorkerOptions = ConstructorParameters<typeof JestWorker>[1] & {\n /**\n * `-1` if not inspectable\n */\n debuggerPortOffset?: number;\n\n /**\n * Whether to enable source maps support in the worker, which can improve the quality of stack traces at the cost of increased memory usage and slower performance. Defaults to `false`.\n */\n enableSourceMaps?: boolean;\n\n /**\n * True if `--max-old-space-size` should not be forwarded to the worker.\n */\n isolatedMemory?: boolean;\n\n /**\n * The maximum time in milliseconds a worker can run before being terminated. Defaults to `0` (no timeout).\n */\n timeout?: number;\n\n /**\n * A callback function that is called when the worker is active.\n */\n onActivity?: () => void;\n\n /**\n * A callback function that is called when the worker activity is aborted.\n */\n onActivityAbort?: () => void;\n\n /**\n * A callback function that is called when the worker is restarted.\n */\n onRestart?: (method: string, args: any[], attempts: number) => void;\n\n /**\n * An array of method names that the worker exposes. These methods will be available on the Worker instance and can be called to execute tasks in the worker process.\n */\n exposedMethods: ReadonlyArray<string>;\n\n /**\n * Whether to use worker threads instead of child processes for the worker implementation. This is an experimental feature and may not be suitable for all use cases. Defaults to `false`.\n */\n enableWorkerThreads?: boolean;\n\n /**\n * A custom logger function that can be used to log messages from the worker. This can be useful for debugging and monitoring the worker's activity. The function should accept a string message as its argument.\n */\n logger: LogFn;\n};\n\nexport class Worker {\n #worker: JestWorker | undefined;\n\n /**\n * Create a new worker instance.\n *\n * @param workerPath - The path to the worker file.\n * @param options - The options for the worker, including exposed methods, timeout, and hooks for activity and restart.\n */\n public constructor(\n protected workerPath: string,\n protected options: WorkerOptions\n ) {\n const {\n timeout,\n onRestart,\n debuggerPortOffset = -1,\n enableSourceMaps = false,\n isolatedMemory = false,\n logger,\n ...rest\n } = this.options;\n\n let restartPromise: Promise<typeof RESTARTED>;\n let resolveRestartPromise: (arg: typeof RESTARTED) => void;\n let activeTasks = 0;\n\n this.#worker = undefined;\n\n // ensure we end workers if they weren't before exit\n process.on(\"exit\", () => {\n this.close();\n });\n\n const nodeOptions = getParsedNodeOptions();\n const originalOptions = { ...nodeOptions };\n delete nodeOptions.inspect;\n delete nodeOptions[\"inspect-brk\"];\n delete nodeOptions.inspect_brk;\n if (debuggerPortOffset !== -1) {\n const nodeDebugType = getNodeDebugType(originalOptions);\n if (nodeDebugType) {\n const debuggerAddress = getParsedDebugAddress(\n originalOptions[nodeDebugType]\n );\n const address: DebugAddress = {\n host: debuggerAddress.host,\n // current process runs on `address.port`\n port:\n debuggerAddress.port === 0\n ? 0\n : debuggerAddress.port + 1 + debuggerPortOffset\n };\n nodeOptions[nodeDebugType] = formatDebugAddress(address);\n }\n }\n\n if (enableSourceMaps) {\n nodeOptions[\"enable-source-maps\"] = true;\n }\n\n if (isolatedMemory) {\n delete nodeOptions[\"max-old-space-size\"];\n delete nodeOptions.max_old_space_size;\n }\n\n const { nodeOptions: formattedNodeOptions, execArgv } =\n formatNodeOptions(nodeOptions);\n\n const createWorker = () => {\n const workerEnv: NodeJS.ProcessEnv = {\n ...process.env,\n ...((rest.forkOptions?.env ?? {}) as any),\n POWERLINES_WORKER: \"true\",\n NODE_OPTIONS: formattedNodeOptions\n };\n\n if (workerEnv.FORCE_COLOR === undefined) {\n // Mirror the enablement heuristic from picocolors (see https://github.com/vercel/next.js/blob/6a40da0345939fe4f7b1ae519b296a86dd103432/packages/next/src/lib/picocolors.ts#L21-L24).\n // Picocolors snapshots `process.env`/`stdout.isTTY` at module load time, so when the worker\n // process bootstraps with piped stdio its own check would disable colors. Re-evaluating the\n // same conditions here lets us opt the worker into color output only when the parent would\n // have seen colors, while still respecting explicit opt-outs like NO_COLOR.\n const supportsColors =\n !workerEnv.NO_COLOR &&\n !workerEnv.CI &&\n workerEnv.TERM !== \"dumb\" &&\n (process.stdout.isTTY || process.stderr?.isTTY);\n\n if (supportsColors) {\n workerEnv.FORCE_COLOR = \"1\";\n }\n }\n\n this.#worker = new JestWorker(workerPath, {\n ...rest,\n forkOptions: {\n ...rest.forkOptions,\n execArgv: [...execArgv, ...(rest.forkOptions?.execArgv ?? [])],\n env: workerEnv\n },\n maxRetries: 0\n });\n restartPromise = new Promise(resolve => {\n resolveRestartPromise = resolve;\n });\n\n /**\n * Jest Worker has two worker types, ChildProcessWorker (uses child_process) and NodeThreadWorker (uses worker_threads)\n * Powerlines uses ChildProcessWorker by default, but it can be switched to NodeThreadWorker with an experimental flag\n *\n * We only want to handle ChildProcessWorker's orphan process issue, so we access the private property \"_child\":\n * https://github.com/facebook/jest/blob/b38d7d345a81d97d1dc3b68b8458b1837fbf19be/packages/jest-worker/src/workers/ChildProcessWorker.ts\n *\n * But this property is not available in NodeThreadWorker, so we need to check if we are using ChildProcessWorker\n */\n if (!rest.enableWorkerThreads) {\n for (const worker of ((this.#worker as any)._workerPool?._workers ||\n []) as {\n _child?: ChildProcess;\n }[]) {\n worker._child?.on(\"exit\", (code, signal) => {\n if ((code || (signal && signal !== \"SIGINT\")) && this.#worker) {\n logger(\n LogLevelLabel.ERROR,\n `Worker exited with code: ${code} and signal: ${signal}`\n );\n\n // if a child process doesn't exit gracefully, we want to bubble up the exit code to the parent process\n process.exit(code ?? 1);\n }\n });\n\n // if a child process emits a particular message, we track that as activity\n // so the parent process can keep track of progress\n worker._child?.on(\"message\", ([, data]: [number, unknown]) => {\n if (\n data &&\n typeof data === \"object\" &&\n \"type\" in data &&\n data.type === \"activity\"\n ) {\n // eslint-disable-next-line ts/no-use-before-define\n onActivity();\n }\n });\n }\n }\n\n let aborted = false;\n const onActivityAbort = () => {\n if (!aborted) {\n this.options.onActivityAbort?.();\n aborted = true;\n }\n };\n\n // Listen to the worker's stdout and stderr, if there's any thing logged, abort the activity first\n const abortActivityStreamOnLog = new Transform({\n transform(_chunk, _encoding, callback) {\n onActivityAbort();\n callback();\n }\n });\n // Stop the activity if there's any output from the worker\n this.#worker.getStdout().pipe(abortActivityStreamOnLog);\n this.#worker.getStderr().pipe(abortActivityStreamOnLog);\n\n // Pipe the worker's stdout and stderr to the parent process\n this.#worker.getStdout().pipe(process.stdout);\n this.#worker.getStderr().pipe(process.stderr);\n };\n createWorker();\n\n const onHanging = () => {\n const worker = this.#worker;\n if (!worker) {\n return;\n }\n\n const resolve = resolveRestartPromise;\n createWorker();\n\n logger(\n LogLevelLabel.WARN,\n `Sending SIGTERM signal to static worker due to timeout${\n timeout ? ` of ${timeout / 1000} seconds` : \"\"\n }. Subsequent errors may be a result of the worker exiting.`\n );\n\n void worker.end().then(() => {\n resolve(RESTARTED);\n });\n };\n\n let hangingTimer: NodeJS.Timeout | false = false;\n\n const onActivity = () => {\n if (hangingTimer) {\n clearTimeout(hangingTimer);\n }\n if (this.options.onActivity) {\n this.options.onActivity();\n }\n\n hangingTimer = activeTasks > 0 && setTimeout(onHanging, timeout);\n };\n\n for (const method of rest.exposedMethods) {\n if (method.startsWith(\"_\")) {\n continue;\n }\n\n (this as any)[method] = timeout\n ? async (...args: any[]) => {\n activeTasks++;\n try {\n let attempts = 0;\n for (;;) {\n onActivity();\n\n const result = await Promise.race([\n // eslint-disable-next-line ts/no-unsafe-call\n (this.#worker as any)[method](\n args.length > 0 && args[0] ? args[0] : {}\n ),\n restartPromise\n ]);\n if (result !== RESTARTED) {\n return result;\n }\n if (onRestart) {\n onRestart(method, args, ++attempts);\n }\n }\n } finally {\n activeTasks--;\n onActivity();\n }\n }\n : // eslint-disable-next-line ts/no-unsafe-call\n (this.#worker as any)[method].bind(this.#worker);\n }\n }\n\n public async end(): ReturnType<JestWorker[\"end\"]> {\n const worker = this.#worker;\n if (!worker) {\n throw new Error(\"Farm is ended, no more calls can be done to it\");\n }\n\n cleanupWorkers(worker);\n this.#worker = undefined;\n return worker.end();\n }\n\n /**\n * Quietly end the worker if it exists\n */\n public close(): void {\n if (this.#worker) {\n cleanupWorkers(this.#worker);\n void this.#worker.end();\n }\n }\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n BuildInlineConfig,\n CleanInlineConfig,\n DeployInlineConfig,\n DocsInlineConfig,\n Engine,\n EngineContext,\n EngineOptions,\n ExecutionWorkerProcess,\n LintInlineConfig,\n NewInlineConfig,\n PrepareInlineConfig,\n TestInlineConfig,\n TypesInlineConfig\n} from \"@powerlines/core\";\nimport { POWERLINES_API_FUNCTIONS } from \"@powerlines/core/constants\";\nimport { resolvePackage } from \"@stryke/fs/resolve\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { PartialKeys } from \"@stryke/types/base\";\nimport { Worker } from \"./_internal/helpers/worker\";\nimport { PowerlinesEngineContext } from \"./context/engine-context\";\n\n/**\n * The Powerlines Engine class\n *\n * @remarks\n * This class is responsible for managing the Powerlines project lifecycle, including initialization, building, and finalization.\n *\n * @public\n */\nexport class PowerlinesEngine implements Engine, AsyncDisposable {\n /**\n * The Powerlines context\n */\n #context: EngineContext;\n\n /**\n * The worker pool for managing child threads\n */\n #worker!: ExecutionWorkerProcess;\n\n /**\n * Create a new Powerlines Engine instance\n *\n * @param options - The options to initialize the context with\n * @returns A new instance of the Powerlines Engine\n */\n public static async fromOptions(\n options: EngineOptions\n ): Promise<PowerlinesEngine> {\n const api = new PowerlinesEngine(\n await PowerlinesEngineContext.fromOptions(options)\n );\n\n const packagePath = await resolvePackage(\"@powerlines/engine\");\n if (!packagePath) {\n throw new Error(\n \"Could not resolve `@powerlines/engine` package location.\"\n );\n }\n\n api.#worker = new Worker(joinPaths(packagePath, \"./_internal/worker.mjs\"), {\n exposedMethods: POWERLINES_API_FUNCTIONS,\n logger: api.context.createLog(null)\n }) as unknown as ExecutionWorkerProcess;\n\n return api;\n }\n\n /**\n * The Powerlines context\n */\n public get context(): EngineContext {\n return this.#context;\n }\n\n /**\n * Create a new Powerlines Engine instance\n *\n * @param context - The Powerlines context\n */\n protected constructor(context: EngineContext) {\n this.#context = context;\n }\n\n /**\n * Generate the Powerlines typescript declaration file\n *\n * @remarks\n * This method will only generate the typescript declaration file for the Powerlines project. It is generally recommended to run the full `prepare` command, which will run this method as part of its process.\n *\n * @param inlineConfig - The inline configuration for the types command\n */\n public async types(\n inlineConfig: PartialKeys<\n Omit<TypesInlineConfig, \"configFile\">,\n \"command\"\n > = {\n command: \"types\"\n }\n ) {\n const timer = this.context.timer(\"Types\");\n this.context.info(\n \" 🏗️ Generating typescript declarations for the Powerlines project\"\n );\n\n this.context.debug(\n \" Aggregating configuration options for the Powerlines project\"\n );\n\n inlineConfig.command ??= \"types\";\n await Promise.all(\n this.#context.executions.map(async options =>\n this.#worker.types({\n options,\n config: inlineConfig as TypesInlineConfig\n })\n )\n );\n\n this.context.debug(\n \"✔ Powerlines types generation has completed successfully\"\n );\n timer();\n }\n\n /**\n * Prepare the Powerlines API\n *\n * @remarks\n * This method will prepare the Powerlines API for use, initializing any necessary resources.\n *\n * @param inlineConfig - The inline configuration for the prepare command\n */\n public async prepare(\n inlineConfig:\n | PartialKeys<Omit<PrepareInlineConfig, \"configFile\">, \"command\">\n | PartialKeys<Omit<TypesInlineConfig, \"configFile\">, \"command\">\n | PartialKeys<Omit<NewInlineConfig, \"configFile\">, \"command\">\n | PartialKeys<Omit<CleanInlineConfig, \"configFile\">, \"command\">\n | PartialKeys<Omit<BuildInlineConfig, \"configFile\">, \"command\">\n | PartialKeys<Omit<LintInlineConfig, \"configFile\">, \"command\">\n | PartialKeys<Omit<DocsInlineConfig, \"configFile\">, \"command\">\n | PartialKeys<Omit<DeployInlineConfig, \"configFile\">, \"command\"> = {\n command: \"prepare\"\n }\n ) {\n const timer = this.context.timer(\"Prepare\");\n this.context.info(\" 🏗️ Preparing the Powerlines project\");\n\n this.context.debug(\n \"Aggregating configuration options for the Powerlines project\"\n );\n\n inlineConfig.command ??= \"prepare\";\n await Promise.all(\n this.#context.executions.map(async options =>\n this.#worker.prepare({\n options,\n config: inlineConfig as PrepareInlineConfig\n })\n )\n );\n\n this.context.debug(\"✔ Powerlines preparation has completed successfully\");\n timer();\n }\n\n /**\n * Create a new Powerlines project\n *\n * @remarks\n * This method will create a new Powerlines project in the current directory.\n *\n * @param inlineConfig - The inline configuration for the new command\n * @returns A promise that resolves when the project has been created\n */\n public async new(inlineConfig: PartialKeys<NewInlineConfig, \"command\">) {\n const timer = this.context.timer(\"New\");\n this.context.info(\" 🆕 Creating a new Powerlines project\");\n\n inlineConfig.command ??= \"new\";\n await Promise.all(\n this.#context.executions.map(async options =>\n this.#worker.new({\n options,\n config: inlineConfig as NewInlineConfig\n })\n )\n );\n\n this.context.debug(\"✔ Powerlines new command completed successfully\");\n timer();\n }\n\n /**\n * Clean any previously prepared artifacts\n *\n * @remarks\n * This method will remove the previous Powerlines artifacts from the project.\n *\n * @param inlineConfig - The inline configuration for the clean command\n * @returns A promise that resolves when the clean command has completed\n */\n public async clean(\n inlineConfig:\n | PartialKeys<Omit<CleanInlineConfig, \"configFile\">, \"command\">\n | PartialKeys<Omit<PrepareInlineConfig, \"configFile\">, \"command\"> = {\n command: \"clean\"\n }\n ) {\n const timer = this.context.timer(\"Clean\");\n this.context.info(\" 🧹 Cleaning the previous Powerlines artifacts\");\n\n inlineConfig.command ??= \"clean\";\n await Promise.all(\n this.#context.executions.map(async options =>\n this.#worker.clean({\n options,\n config: inlineConfig as CleanInlineConfig\n })\n )\n );\n\n this.context.debug(\"✔ Powerlines cleaning completed successfully\");\n timer();\n }\n\n /**\n * Lint the project\n *\n * @param inlineConfig - The inline configuration for the lint command\n * @returns A promise that resolves when the lint command has completed\n */\n public async lint(\n inlineConfig:\n | PartialKeys<Omit<LintInlineConfig, \"configFile\">, \"command\">\n | PartialKeys<Omit<BuildInlineConfig, \"configFile\">, \"command\"> = {\n command: \"lint\"\n }\n ) {\n const timer = this.context.timer(\"Lint\");\n this.context.info(\" 📝 Linting the Powerlines project\");\n\n inlineConfig.command ??= \"lint\";\n await Promise.all(\n this.#context.executions.map(async options =>\n this.#worker.lint({\n options,\n config: inlineConfig as LintInlineConfig\n })\n )\n );\n\n this.context.debug(\"✔ Powerlines linting completed successfully\");\n timer();\n }\n\n /**\n * Test the project\n *\n * @remarks\n * This method will run the tests for the Powerlines project.\n *\n * @param inlineConfig - The inline configuration for the test command\n * @returns A promise that resolves when the test command has completed\n */\n public async test(\n inlineConfig:\n | PartialKeys<Omit<TestInlineConfig, \"configFile\">, \"command\">\n | PartialKeys<Omit<BuildInlineConfig, \"configFile\">, \"command\"> = {\n command: \"test\"\n }\n ) {\n const timer = this.context.timer(\"Test\");\n this.context.info(\" 🧪 Running tests for the Powerlines project\");\n\n inlineConfig.command ??= \"test\";\n await Promise.all(\n this.#context.executions.map(async options =>\n this.#worker.test({\n options,\n config: inlineConfig as TestInlineConfig\n })\n )\n );\n\n this.context.debug(\"✔ Powerlines testing completed successfully\");\n timer();\n }\n\n /**\n * Build the project\n *\n * @remarks\n * This method will build the Powerlines project, generating the necessary artifacts.\n *\n * @param inlineConfig - The inline configuration for the build command\n * @returns A promise that resolves when the build command has completed\n */\n public async build(\n inlineConfig: PartialKeys<\n Omit<BuildInlineConfig, \"configFile\">,\n \"command\"\n > = {\n command: \"build\"\n }\n ) {\n const timer = this.context.timer(\"Build\");\n this.context.info(\" 📦 Building the Powerlines project\");\n\n await Promise.all(\n this.#context.executions.map(async options =>\n this.#worker.build({\n options,\n config: inlineConfig as BuildInlineConfig\n })\n )\n );\n\n this.context.debug(\"✔ Powerlines build completed successfully\");\n timer();\n }\n\n /**\n * Prepare the documentation for the project\n *\n * @param inlineConfig - The inline configuration for the docs command\n * @returns A promise that resolves when the documentation generation has completed\n */\n public async docs(\n inlineConfig: PartialKeys<\n Omit<DocsInlineConfig, \"configFile\">,\n \"command\"\n > = {\n command: \"docs\"\n }\n ) {\n const timer = this.context.timer(\"Docs\");\n this.context.info(\n \" 📓 Generating documentation for the Powerlines project\"\n );\n\n inlineConfig.command ??= \"docs\";\n\n await Promise.all(\n this.#context.executions.map(async options =>\n this.#worker.docs({\n options,\n config: inlineConfig as DocsInlineConfig\n })\n )\n );\n\n this.context.debug(\n \"✔ Powerlines documentation generation completed successfully\"\n );\n timer();\n }\n\n /**\n * Deploy the project source code\n *\n * @remarks\n * This method will prepare and build the Powerlines project, generating the necessary artifacts for the deployment.\n *\n * @param inlineConfig - The inline configuration for the deploy command\n */\n public async deploy(\n inlineConfig: PartialKeys<\n Omit<DeployInlineConfig, \"configFile\">,\n \"command\"\n > = {\n command: \"deploy\"\n }\n ) {\n const timer = this.context.timer(\"Deploy\");\n this.context.info(\" 🚀 Deploying the Powerlines project\");\n\n inlineConfig.command ??= \"deploy\";\n\n await Promise.all(\n this.#context.executions.map(async options =>\n this.#worker.deploy({\n options,\n config: inlineConfig as DeployInlineConfig\n })\n )\n );\n\n this.context.debug(\"✔ Powerlines deploy completed successfully\");\n timer();\n }\n\n /**\n * Finalization/cleanup processing for the Powerlines API\n *\n * @remarks\n * This step includes any final processes or clean up required by Powerlines. It will be run after each Powerlines command.\n *\n * @returns A promise that resolves when the finalization process has completed\n */\n public async finalize() {\n const timer = this.context.timer(\"Finalization\");\n this.context.info(\" 🏁 Powerlines finalization processes started\");\n\n this.#worker.close();\n\n this.context.debug(\"✔ Powerlines finalization completed successfully\");\n timer();\n }\n\n async [Symbol.asyncDispose]() {\n return this.finalize();\n }\n}\n"],"mappings":";;;;;;;;;;;;AA2BA,MAAM,YAAY,OAAO,8BAA8B;;;;AAavD,MAAM,sBAAsB,EAAE,MAAM,WAAiC;AACnE,KAAI,KAAM,QAAO,GAAG,KAAK,GAAG;AAC5B,QAAO,GAAG;;;;;;;;;;;AAYZ,MAAM,yBAAyB,IAAI,IAAI;CACrC;CACA;CACA;CACA;CACD,CAAC;AAEF,SAAS,UACP,KACA,OACe;AACf,KAAI,UAAU,KACZ,QAAO,KAAK;AAGd,KAAI,MACF,QAAO,KAAK,IAAI,GAGd,MAAM,SAAS,IAAI,IAAI,CAAC,MAAM,WAAW,KAAI,GACzC,KAAK,UAAU,MAAM,GACrB;AAIR,QAAO;;;;;;;;;;AAWT,MAAM,gBAAgB,UAA4B;CAChD,MAAM,OAAiB,EAAE;CACzB,IAAI,aA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,MACX,+DACD;AACD,SAAO;;;;;;;;;;CAWT,MAAa,OACX,eAGI,EACF,SAAS,UACV,EACD;EACA,MAAM,QAAQ,KAAK,QAAQ,MAAM,SAAS;AAC1C,OAAK,QAAQ,KAAK,uCAAuC;AAEzD,eAAa,YAAY;AAEzB,QAAM,QAAQ,IACZ,MAAKE,QAAS,WAAW,IAAI,OAAM,YACjC,MAAKF,OAAQ,OAAO;GAClB;GACA,QAAQ;GACT,CAAC,CACH,CACF;AAED,OAAK,QAAQ,MAAM,6CAA6C;AAChE,SAAO;;;;;;;;;;CAWT,MAAa,WAAW;EACtB,MAAM,QAAQ,KAAK,QAAQ,MAAM,eAAe;AAChD,OAAK,QAAQ,KAAK,gDAAgD;AAElE,QAAKA,OAAQ,OAAO;AAEpB,OAAK,QAAQ,MAAM,mDAAmD;AACtE,SAAO;;CAGT,OAAO,OAAO,gBAAgB;AAC5B,SAAO,KAAK,UAAU"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["Worker","#worker","JestWorker","#worker","Worker","#context","#queue"],"sources":["../src/_internal/helpers/worker.ts","../src/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { LogFn } from \"@powerlines/core\";\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { isSet } from \"@stryke/type-checks/is-set\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { Worker as JestWorker } from \"jest-worker\";\nimport type { ChildProcess } from \"node:child_process\";\nimport { Transform } from \"node:stream\";\nimport { parseArgs } from \"node:util\";\n\nconst RESTARTED = Symbol(\"powerlines-worker:restarted\");\n\n/**\n * The debug address is in the form of `[host:]port`. The host is optional.\n */\ninterface DebugAddress {\n host: string | undefined;\n port: number;\n}\n\n/**\n * Formats the debug address into a string.\n */\nconst formatDebugAddress = ({ host, port }: DebugAddress): string => {\n if (host) return `${host}:${port}`;\n return `${port}`;\n};\n\n/**\n * Node.js CLI flags that are not allowed in NODE_OPTIONS and must be\n * passed as direct CLI arguments via execArgv.\n * This set is the difference between all Node.js CLI flags and the ones **not**\n * allowed in NODE_OPTIONS, as listed in the Node.js documentation:\n * https://nodejs.org/api/cli.html#node_optionsoptions\n *\n * It is not exhaustive since not all options make sense for Powerlines (e.g. --test)\n */\nconst EXEC_ARGV_ONLY_OPTIONS = new Set([\n \"experimental-network-inspection\",\n \"experimental-storage-inspection\",\n \"experimental-worker-inspection\",\n \"experimental-inspector-network-resource\"\n]);\n\nfunction formatArg(\n key: string,\n value: string | boolean | undefined\n): string | null {\n if (value === true) {\n return `--${key}`;\n }\n\n if (value) {\n return `--${key}=${\n // Values with spaces need to be quoted. We use JSON.stringify to\n // also escape any nested quotes.\n value.includes(\" \") && !value.startsWith('\"')\n ? JSON.stringify(value)\n : value\n }`;\n }\n\n return null;\n}\n\n/**\n * Tokenizes the arguments string into an array of strings, supporting quoted\n * values and escaped characters.\n * Converted from: https://github.com/nodejs/node/blob/c29d53c5cfc63c5a876084e788d70c9e87bed880/src/node_options.cc#L1401\n *\n * @param input - The arguments string to be tokenized.\n * @returns An array of strings with the tokenized arguments.\n */\nconst tokenizeArgs = (input: string): string[] => {\n const args: string[] = [];\n let isInString = false;\n let willStartNewArg = true;\n\n for (let i = 0; i < input.length; i++) {\n let char = input[i];\n if (char) {\n // Skip any escaped characters in strings.\n if (char === \"\\\\\" && isInString) {\n // Ensure we don't have an escape character at the end.\n if (input.length === i + 1) {\n throw new Error(\"Invalid escape character at the end.\");\n }\n\n // Skip the next character.\n char = input[++i];\n if (!char) {\n continue;\n }\n }\n // If we find a space outside of a string, we should start a new argument.\n else if (char === \" \" && !isInString) {\n willStartNewArg = true;\n continue;\n }\n\n // If we find a quote, we should toggle the string flag.\n else if (char === '\"') {\n isInString = !isInString;\n continue;\n }\n\n // If we're starting a new argument, we should add it to the array.\n if (willStartNewArg) {\n args.push(char);\n willStartNewArg = false;\n }\n // Otherwise, add it to the last argument.\n else {\n args[args.length - 1] += char;\n }\n }\n }\n\n if (isInString) {\n throw new Error(\"Unterminated string\");\n }\n\n return args;\n};\n\n/**\n * Get the node options from the environment variable `NODE_OPTIONS` and returns\n * them as an array of strings.\n *\n * @returns An array of strings with the node options.\n */\nconst getNodeOptionsArgs = () => {\n if (!process.env.NODE_OPTIONS) return [];\n\n return tokenizeArgs(process.env.NODE_OPTIONS);\n};\n\n/**\n * Stringify the arguments to be used in a command line. It will ignore any\n * argument that has a value of `undefined`. Options that are not allowed in\n * NODE_OPTIONS are returned separately as execArgv.\n *\n * @param args - The arguments to be stringified.\n * @returns An object with `nodeOptions` string and `execArgv` array.\n */\nfunction formatNodeOptions(\n args: Record<string, string | boolean | undefined>\n): { nodeOptions: string; execArgv: string[] } {\n const nodeOptionsParts: string[] = [];\n const execArgv: string[] = [];\n\n for (const [key, value] of Object.entries(args)) {\n const formatted = formatArg(key, value);\n if (formatted === null) continue;\n\n if (EXEC_ARGV_ONLY_OPTIONS.has(key)) {\n execArgv.push(formatted);\n } else {\n nodeOptionsParts.push(formatted);\n }\n }\n\n return { nodeOptions: nodeOptionsParts.join(\" \"), execArgv };\n}\n\nexport type NodeOptions = Record<string, string | boolean | undefined>;\n\nconst parseNodeArgs = (args: string[]): NodeOptions => {\n const { values, tokens } = parseArgs({ args, strict: false, tokens: true });\n\n // For the `NODE_OPTIONS`, we support arguments with values without the `=`\n // sign. We need to parse them manually.\n let orphan = null;\n for (let i = 0; i < tokens.length; i++) {\n const token = tokens[i];\n if (!token) continue;\n\n if (token.kind === \"option-terminator\") {\n break;\n }\n\n // When we encounter an option, if it's value is undefined, we should check\n // to see if the following tokens are positional parameters. If they are,\n // then the option is orphaned, and we can assign it.\n if (token.kind === \"option\") {\n orphan = !isSet(token.value) ? token : null;\n continue;\n }\n\n // If the token isn't a positional one, then we can't assign it to the found\n // orphaned option.\n if (token.kind !== \"positional\") {\n orphan = null;\n continue;\n }\n\n // If we don't have an orphan, then we can skip this token.\n if (!orphan) {\n continue;\n }\n\n // If the token is a positional one, and it has a value, so add it to the\n // values object. If it already exists, append it with a space.\n if (orphan.name in values && isString(values[orphan.name])) {\n values[orphan.name] += ` ${token.value}`;\n } else {\n values[orphan.name] = token.value;\n }\n }\n\n return values;\n};\n\nfunction getParsedNodeOptions(): Record<string, string | boolean | undefined> {\n const args = [...process.execArgv, ...getNodeOptionsArgs()];\n if (args.length === 0) return {};\n\n return parseNodeArgs(args);\n}\n\n/**\n * Get's the debug address from the `NODE_OPTIONS` environment variable. If the\n * address is not found, it returns the default host (`undefined`) and port\n * (`9229`).\n *\n * @returns An object with the host and port of the debug address.\n */\nconst getParsedDebugAddress = (\n address: string | boolean | undefined\n): DebugAddress => {\n if (!address || !isString(address)) {\n return { host: undefined, port: 9229 };\n }\n\n // The address is in the form of `[host:]port`. Let's parse the address.\n if (address.includes(\":\")) {\n const [host, port] = address.split(\":\");\n if (!host || !port) {\n throw new Error(`Invalid debug address: ${address}`);\n }\n\n return { host, port: Number.parseInt(port, 10) };\n }\n\n return { host: undefined, port: Number.parseInt(address, 10) };\n};\n\ntype NodeInspectType = \"inspect\" | \"inspect-brk\" | undefined;\n\n/**\n * Get the debug type from the `NODE_OPTIONS` environment variable.\n */\nfunction getNodeDebugType(nodeOptions: NodeOptions): NodeInspectType {\n if (nodeOptions.inspect) {\n return \"inspect\";\n }\n if (nodeOptions[\"inspect-brk\"] || nodeOptions.inspect_brk) {\n return \"inspect-brk\";\n }\n\n return undefined;\n}\n\nconst cleanupWorkers = (worker: JestWorker) => {\n for (const curWorker of ((worker as any)._workerPool?._workers || []) as {\n _child?: ChildProcess;\n }[]) {\n curWorker._child?.kill(\"SIGINT\");\n }\n};\n\nexport type WorkerOptions = ConstructorParameters<typeof JestWorker>[1] & {\n /**\n * `-1` if not inspectable\n */\n debuggerPortOffset?: number;\n\n /**\n * Whether to enable source maps support in the worker, which can improve the quality of stack traces at the cost of increased memory usage and slower performance. Defaults to `false`.\n */\n enableSourceMaps?: boolean;\n\n /**\n * True if `--max-old-space-size` should not be forwarded to the worker.\n */\n isolatedMemory?: boolean;\n\n /**\n * The maximum time in milliseconds a worker can run before being terminated. Defaults to `0` (no timeout).\n */\n timeout?: number;\n\n /**\n * A callback function that is called when the worker is active.\n */\n onActivity?: () => void;\n\n /**\n * A callback function that is called when the worker activity is aborted.\n */\n onActivityAbort?: () => void;\n\n /**\n * A callback function that is called when the worker is restarted.\n */\n onRestart?: (method: string, args: any[], attempts: number) => void;\n\n /**\n * An array of method names that the worker exposes. These methods will be available on the Worker instance and can be called to execute tasks in the worker process.\n */\n exposedMethods: ReadonlyArray<string>;\n\n /**\n * Whether to use worker threads instead of child processes for the worker implementation. This is an experimental feature and may not be suitable for all use cases. Defaults to `false`.\n */\n enableWorkerThreads?: boolean;\n\n /**\n * A custom logger function that can be used to log messages from the worker. This can be useful for debugging and monitoring the worker's activity. The function should accept a string message as its argument.\n */\n logger: LogFn;\n};\n\nexport class Worker {\n #worker: JestWorker | undefined;\n\n /**\n * Create a new worker instance.\n *\n * @param workerPath - The path to the worker file.\n * @param options - The options for the worker, including exposed methods, timeout, and hooks for activity and restart.\n */\n public constructor(\n protected workerPath: string,\n protected options: WorkerOptions\n ) {\n const {\n timeout,\n onRestart,\n debuggerPortOffset = -1,\n enableSourceMaps = false,\n isolatedMemory = false,\n logger,\n ...rest\n } = this.options;\n\n let restartPromise: Promise<typeof RESTARTED>;\n let resolveRestartPromise: (arg: typeof RESTARTED) => void;\n let activeTasks = 0;\n\n this.#worker = undefined;\n\n // ensure we end workers if they weren't before exit\n process.on(\"exit\", () => {\n this.close();\n });\n\n const nodeOptions = getParsedNodeOptions();\n const originalOptions = { ...nodeOptions };\n delete nodeOptions.inspect;\n delete nodeOptions[\"inspect-brk\"];\n delete nodeOptions.inspect_brk;\n if (debuggerPortOffset !== -1) {\n const nodeDebugType = getNodeDebugType(originalOptions);\n if (nodeDebugType) {\n const debuggerAddress = getParsedDebugAddress(\n originalOptions[nodeDebugType]\n );\n const address: DebugAddress = {\n host: debuggerAddress.host,\n // current process runs on `address.port`\n port:\n debuggerAddress.port === 0\n ? 0\n : debuggerAddress.port + 1 + debuggerPortOffset\n };\n nodeOptions[nodeDebugType] = formatDebugAddress(address);\n }\n }\n\n if (enableSourceMaps) {\n nodeOptions[\"enable-source-maps\"] = true;\n }\n\n if (isolatedMemory) {\n delete nodeOptions[\"max-old-space-size\"];\n delete nodeOptions.max_old_space_size;\n }\n\n const { nodeOptions: formattedNodeOptions, execArgv } =\n formatNodeOptions(nodeOptions);\n\n const createWorker = () => {\n const workerEnv: NodeJS.ProcessEnv = {\n ...process.env,\n ...((rest.forkOptions?.env ?? {}) as any),\n POWERLINES_WORKER: \"true\",\n NODE_OPTIONS: formattedNodeOptions\n };\n\n if (workerEnv.FORCE_COLOR === undefined) {\n // Mirror the enablement heuristic from picocolors (see https://github.com/vercel/next.js/blob/6a40da0345939fe4f7b1ae519b296a86dd103432/packages/next/src/lib/picocolors.ts#L21-L24).\n // Picocolors snapshots `process.env`/`stdout.isTTY` at module load time, so when the worker\n // process bootstraps with piped stdio its own check would disable colors. Re-evaluating the\n // same conditions here lets us opt the worker into color output only when the parent would\n // have seen colors, while still respecting explicit opt-outs like NO_COLOR.\n const supportsColors =\n !workerEnv.NO_COLOR &&\n !workerEnv.CI &&\n workerEnv.TERM !== \"dumb\" &&\n (process.stdout.isTTY || process.stderr?.isTTY);\n\n if (supportsColors) {\n workerEnv.FORCE_COLOR = \"1\";\n }\n }\n\n this.#worker = new JestWorker(workerPath, {\n ...rest,\n forkOptions: {\n ...rest.forkOptions,\n execArgv: [...execArgv, ...(rest.forkOptions?.execArgv ?? [])],\n env: workerEnv\n },\n maxRetries: 0\n });\n restartPromise = new Promise(resolve => {\n resolveRestartPromise = resolve;\n });\n\n /**\n * Jest Worker has two worker types, ChildProcessWorker (uses child_process) and NodeThreadWorker (uses worker_threads)\n * Powerlines uses ChildProcessWorker by default, but it can be switched to NodeThreadWorker with an experimental flag\n *\n * We only want to handle ChildProcessWorker's orphan process issue, so we access the private property \"_child\":\n * https://github.com/facebook/jest/blob/b38d7d345a81d97d1dc3b68b8458b1837fbf19be/packages/jest-worker/src/workers/ChildProcessWorker.ts\n *\n * But this property is not available in NodeThreadWorker, so we need to check if we are using ChildProcessWorker\n */\n if (!rest.enableWorkerThreads) {\n for (const worker of ((this.#worker as any)._workerPool?._workers ||\n []) as {\n _child?: ChildProcess;\n }[]) {\n worker._child?.on(\"exit\", (code, signal) => {\n if ((code || (signal && signal !== \"SIGINT\")) && this.#worker) {\n logger(\n LogLevelLabel.ERROR,\n `Worker exited with code: ${code} and signal: ${signal}`\n );\n\n // if a child process doesn't exit gracefully, we want to bubble up the exit code to the parent process\n process.exit(code ?? 1);\n }\n });\n\n // if a child process emits a particular message, we track that as activity\n // so the parent process can keep track of progress\n worker._child?.on(\"message\", ([, data]: [number, unknown]) => {\n if (\n data &&\n typeof data === \"object\" &&\n \"type\" in data &&\n data.type === \"activity\"\n ) {\n // eslint-disable-next-line ts/no-use-before-define\n onActivity();\n }\n });\n }\n }\n\n let aborted = false;\n const onActivityAbort = () => {\n if (!aborted) {\n this.options.onActivityAbort?.();\n aborted = true;\n }\n };\n\n // Listen to the worker's stdout and stderr, if there's any thing logged, abort the activity first\n const abortActivityStreamOnLog = new Transform({\n transform(_chunk, _encoding, callback) {\n onActivityAbort();\n callback();\n }\n });\n // Stop the activity if there's any output from the worker\n this.#worker.getStdout().pipe(abortActivityStreamOnLog);\n this.#worker.getStderr().pipe(abortActivityStreamOnLog);\n\n // Pipe the worker's stdout and stderr to the parent process\n this.#worker.getStdout().pipe(process.stdout);\n this.#worker.getStderr().pipe(process.stderr);\n };\n createWorker();\n\n const onHanging = () => {\n const worker = this.#worker;\n if (!worker) {\n return;\n }\n\n const resolve = resolveRestartPromise;\n createWorker();\n\n logger(\n LogLevelLabel.WARN,\n `Sending SIGTERM signal to static worker due to timeout${\n timeout ? ` of ${timeout / 1000} seconds` : \"\"\n }. Subsequent errors may be a result of the worker exiting.`\n );\n\n void worker.end().then(() => {\n resolve(RESTARTED);\n });\n };\n\n let hangingTimer: NodeJS.Timeout | false = false;\n\n const onActivity = () => {\n if (hangingTimer) {\n clearTimeout(hangingTimer);\n }\n if (this.options.onActivity) {\n this.options.onActivity();\n }\n\n hangingTimer = activeTasks > 0 && setTimeout(onHanging, timeout);\n };\n\n for (const method of rest.exposedMethods) {\n if (method.startsWith(\"_\")) {\n continue;\n }\n\n (this as any)[method] = timeout\n ? async (...args: any[]) => {\n activeTasks++;\n try {\n let attempts = 0;\n for (;;) {\n onActivity();\n\n const result = await Promise.race([\n // eslint-disable-next-line ts/no-unsafe-call\n (this.#worker as any)[method](\n args.length > 0 && args[0] ? args[0] : {}\n ),\n restartPromise\n ]);\n if (result !== RESTARTED) {\n return result;\n }\n if (onRestart) {\n onRestart(method, args, ++attempts);\n }\n }\n } finally {\n activeTasks--;\n onActivity();\n }\n }\n : // eslint-disable-next-line ts/no-unsafe-call\n (this.#worker as any)[method].bind(this.#worker);\n }\n }\n\n public async end(): ReturnType<JestWorker[\"end\"]> {\n const worker = this.#worker;\n if (!worker) {\n throw new Error(\"Farm is ended, no more calls can be done to it\");\n }\n\n cleanupWorkers(worker);\n this.#worker = undefined;\n return worker.end();\n }\n\n /**\n * Quietly end the worker if it exists\n */\n public close(): void {\n if (this.#worker) {\n cleanupWorkers(this.#worker);\n void this.#worker.end();\n }\n }\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n BuildInlineConfig,\n CleanInlineConfig,\n DeployInlineConfig,\n DocsInlineConfig,\n Engine,\n EngineContext,\n EngineOptions,\n ExecutionWorkerProcess,\n LintInlineConfig,\n NewInlineConfig,\n PrepareInlineConfig,\n TestInlineConfig,\n TypesInlineConfig\n} from \"@powerlines/core\";\nimport { POWERLINES_API_FUNCTIONS } from \"@powerlines/core/constants\";\nimport { PQueue } from \"@stryke/async/node\";\nimport { resolvePackage } from \"@stryke/fs/resolve\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { PartialKeys } from \"@stryke/types/base\";\nimport { Worker } from \"./_internal/helpers/worker\";\nimport { PowerlinesEngineContext } from \"./context/engine-context\";\n\n/**\n * The Powerlines Engine class\n *\n * @remarks\n * This class is responsible for managing the Powerlines project lifecycle, including initialization, building, and finalization.\n *\n * @public\n */\nexport class PowerlinesEngine implements Engine, AsyncDisposable {\n /**\n * The Powerlines context\n */\n #context: EngineContext;\n\n /**\n * The worker pool for managing child threads\n */\n #worker!: ExecutionWorkerProcess;\n\n /**\n * The queue for managing concurrent execution of Powerlines commands, ensuring that commands are executed in a controlled manner to prevent resource exhaustion and ensure optimal performance.\n */\n #queue = new PQueue();\n\n /**\n * Create a new Powerlines Engine instance\n *\n * @param options - The options to initialize the context with\n * @returns A new instance of the Powerlines Engine\n */\n public static async fromOptions(\n options: EngineOptions\n ): Promise<PowerlinesEngine> {\n const api = new PowerlinesEngine(\n await PowerlinesEngineContext.fromOptions(options)\n );\n\n const packagePath = await resolvePackage(\"@powerlines/engine\");\n if (!packagePath) {\n throw new Error(\n \"Could not resolve `@powerlines/engine` package location.\"\n );\n }\n\n api.#worker = new Worker(joinPaths(packagePath, \"./_internal/worker.mjs\"), {\n exposedMethods: POWERLINES_API_FUNCTIONS,\n logger: api.context.createLog(null)\n }) as unknown as ExecutionWorkerProcess;\n\n return api;\n }\n\n /**\n * The Powerlines context\n */\n public get context(): EngineContext {\n return this.#context;\n }\n\n /**\n * Create a new Powerlines Engine instance\n *\n * @param context - The Powerlines context\n */\n protected constructor(context: EngineContext) {\n this.#context = context;\n }\n\n /**\n * Generate the Powerlines typescript declaration file\n *\n * @remarks\n * This method will only generate the typescript declaration file for the Powerlines project. It is generally recommended to run the full `prepare` command, which will run this method as part of its process.\n *\n * @param inlineConfig - The inline configuration for the types command\n */\n public async types(\n inlineConfig: PartialKeys<\n Omit<TypesInlineConfig, \"configFile\">,\n \"command\"\n > = {\n command: \"types\"\n }\n ) {\n const timer = this.context.timer(\"Types\");\n this.context.info(\n \" 🏗️ Generating typescript declarations for the Powerlines project\"\n );\n\n this.context.debug(\n \" Aggregating configuration options for the Powerlines project\"\n );\n\n inlineConfig.command ??= \"types\";\n await Promise.all(\n this.#context.executions.map(async options =>\n this.#worker.types({\n options,\n config: inlineConfig as TypesInlineConfig\n })\n )\n );\n\n this.context.debug(\n \"✔ Powerlines types generation has completed successfully\"\n );\n timer();\n }\n\n /**\n * Prepare the Powerlines API\n *\n * @remarks\n * This method will prepare the Powerlines API for use, initializing any necessary resources.\n *\n * @param inlineConfig - The inline configuration for the prepare command\n */\n public async prepare(\n inlineConfig:\n | PartialKeys<Omit<PrepareInlineConfig, \"configFile\">, \"command\">\n | PartialKeys<Omit<TypesInlineConfig, \"configFile\">, \"command\">\n | PartialKeys<Omit<NewInlineConfig, \"configFile\">, \"command\">\n | PartialKeys<Omit<CleanInlineConfig, \"configFile\">, \"command\">\n | PartialKeys<Omit<BuildInlineConfig, \"configFile\">, \"command\">\n | PartialKeys<Omit<LintInlineConfig, \"configFile\">, \"command\">\n | PartialKeys<Omit<DocsInlineConfig, \"configFile\">, \"command\">\n | PartialKeys<Omit<DeployInlineConfig, \"configFile\">, \"command\"> = {\n command: \"prepare\"\n }\n ) {\n const timer = this.context.timer(\"Prepare\");\n this.context.info(\" 🏗️ Preparing the Powerlines project\");\n\n this.context.debug(\n \"Aggregating configuration options for the Powerlines project\"\n );\n\n inlineConfig.command ??= \"prepare\";\n await Promise.all(\n this.#context.executions.map(async options =>\n this.#queue.add(async () =>\n this.#worker.prepare({\n options,\n config: inlineConfig as PrepareInlineConfig\n })\n )\n )\n );\n\n this.context.debug(\"✔ Powerlines preparation has completed successfully\");\n timer();\n }\n\n /**\n * Create a new Powerlines project\n *\n * @remarks\n * This method will create a new Powerlines project in the current directory.\n *\n * @param inlineConfig - The inline configuration for the new command\n * @returns A promise that resolves when the project has been created\n */\n public async new(inlineConfig: PartialKeys<NewInlineConfig, \"command\">) {\n const timer = this.context.timer(\"New\");\n this.context.info(\" 🆕 Creating a new Powerlines project\");\n\n inlineConfig.command ??= \"new\";\n await Promise.all(\n this.#context.executions.map(async options =>\n this.#queue.add(async () =>\n this.#worker.new({\n options,\n config: inlineConfig as NewInlineConfig\n })\n )\n )\n );\n\n this.context.debug(\"✔ Powerlines new command completed successfully\");\n timer();\n }\n\n /**\n * Clean any previously prepared artifacts\n *\n * @remarks\n * This method will remove the previous Powerlines artifacts from the project.\n *\n * @param inlineConfig - The inline configuration for the clean command\n * @returns A promise that resolves when the clean command has completed\n */\n public async clean(\n inlineConfig:\n | PartialKeys<Omit<CleanInlineConfig, \"configFile\">, \"command\">\n | PartialKeys<Omit<PrepareInlineConfig, \"configFile\">, \"command\"> = {\n command: \"clean\"\n }\n ) {\n const timer = this.context.timer(\"Clean\");\n this.context.info(\" 🧹 Cleaning the previous Powerlines artifacts\");\n\n inlineConfig.command ??= \"clean\";\n await Promise.all(\n this.#context.executions.map(async options =>\n this.#queue.add(async () =>\n this.#worker.clean({\n options,\n config: inlineConfig as CleanInlineConfig\n })\n )\n )\n );\n\n this.context.debug(\"✔ Powerlines cleaning completed successfully\");\n timer();\n }\n\n /**\n * Lint the project\n *\n * @param inlineConfig - The inline configuration for the lint command\n * @returns A promise that resolves when the lint command has completed\n */\n public async lint(\n inlineConfig:\n | PartialKeys<Omit<LintInlineConfig, \"configFile\">, \"command\">\n | PartialKeys<Omit<BuildInlineConfig, \"configFile\">, \"command\"> = {\n command: \"lint\"\n }\n ) {\n const timer = this.context.timer(\"Lint\");\n this.context.info(\" 📝 Linting the Powerlines project\");\n\n inlineConfig.command ??= \"lint\";\n await Promise.all(\n this.#context.executions.map(async options =>\n this.#queue.add(async () =>\n this.#worker.lint({\n options,\n config: inlineConfig as LintInlineConfig\n })\n )\n )\n );\n\n this.context.debug(\"✔ Powerlines linting completed successfully\");\n timer();\n }\n\n /**\n * Test the project\n *\n * @remarks\n * This method will run the tests for the Powerlines project.\n *\n * @param inlineConfig - The inline configuration for the test command\n * @returns A promise that resolves when the test command has completed\n */\n public async test(\n inlineConfig:\n | PartialKeys<Omit<TestInlineConfig, \"configFile\">, \"command\">\n | PartialKeys<Omit<BuildInlineConfig, \"configFile\">, \"command\"> = {\n command: \"test\"\n }\n ) {\n const timer = this.context.timer(\"Test\");\n this.context.info(\" 🧪 Running tests for the Powerlines project\");\n\n inlineConfig.command ??= \"test\";\n await Promise.all(\n this.#context.executions.map(async options =>\n this.#queue.add(async () =>\n this.#worker.test({\n options,\n config: inlineConfig as TestInlineConfig\n })\n )\n )\n );\n\n this.context.debug(\"✔ Powerlines testing completed successfully\");\n timer();\n }\n\n /**\n * Build the project\n *\n * @remarks\n * This method will build the Powerlines project, generating the necessary artifacts.\n *\n * @param inlineConfig - The inline configuration for the build command\n * @returns A promise that resolves when the build command has completed\n */\n public async build(\n inlineConfig: PartialKeys<\n Omit<BuildInlineConfig, \"configFile\">,\n \"command\"\n > = {\n command: \"build\"\n }\n ) {\n const timer = this.context.timer(\"Build\");\n this.context.info(\" 📦 Building the Powerlines project\");\n\n await Promise.all(\n this.#context.executions.map(async options =>\n this.#queue.add(async () =>\n this.#worker.build({\n options,\n config: inlineConfig as BuildInlineConfig\n })\n )\n )\n );\n\n this.context.debug(\"✔ Powerlines build completed successfully\");\n timer();\n }\n\n /**\n * Prepare the documentation for the project\n *\n * @param inlineConfig - The inline configuration for the docs command\n * @returns A promise that resolves when the documentation generation has completed\n */\n public async docs(\n inlineConfig: PartialKeys<\n Omit<DocsInlineConfig, \"configFile\">,\n \"command\"\n > = {\n command: \"docs\"\n }\n ) {\n const timer = this.context.timer(\"Docs\");\n this.context.info(\n \" 📓 Generating documentation for the Powerlines project\"\n );\n\n inlineConfig.command ??= \"docs\";\n\n await Promise.all(\n this.#context.executions.map(async options =>\n this.#queue.add(async () =>\n this.#worker.docs({\n options,\n config: inlineConfig as DocsInlineConfig\n })\n )\n )\n );\n\n this.context.debug(\n \"✔ Powerlines documentation generation completed successfully\"\n );\n timer();\n }\n\n /**\n * Deploy the project source code\n *\n * @remarks\n * This method will prepare and build the Powerlines project, generating the necessary artifacts for the deployment.\n *\n * @param inlineConfig - The inline configuration for the deploy command\n */\n public async deploy(\n inlineConfig: PartialKeys<\n Omit<DeployInlineConfig, \"configFile\">,\n \"command\"\n > = {\n command: \"deploy\"\n }\n ) {\n const timer = this.context.timer(\"Deploy\");\n this.context.info(\" 🚀 Deploying the Powerlines project\");\n\n inlineConfig.command ??= \"deploy\";\n\n await Promise.all(\n this.#context.executions.map(async options =>\n this.#queue.add(async () =>\n this.#worker.deploy({\n options,\n config: inlineConfig as DeployInlineConfig\n })\n )\n )\n );\n\n this.context.debug(\"✔ Powerlines deploy completed successfully\");\n timer();\n }\n\n /**\n * Finalization/cleanup processing for the Powerlines API\n *\n * @remarks\n * This step includes any final processes or clean up required by Powerlines. It will be run after each Powerlines command.\n *\n * @returns A promise that resolves when the finalization process has completed\n */\n public async finalize() {\n const timer = this.context.timer(\"Finalization\");\n this.context.info(\" 🏁 Powerlines finalization processes started\");\n\n this.#worker.close();\n\n this.context.debug(\"✔ Powerlines finalization completed successfully\");\n timer();\n }\n\n async [Symbol.asyncDispose]() {\n return this.finalize();\n }\n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AKA,OAAQ,OAAO;AAEpB,OAAK,QAAQ,MAAM,mDAAmD;AACtE,SAAO;;CAGT,OAAO,OAAO,gBAAgB;AAC5B,SAAO,KAAK,UAAU"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/engine",
|
|
3
|
-
"version": "0.43.
|
|
3
|
+
"version": "0.43.29",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "An internal package containing the core engine modules for Powerlines.",
|
|
6
6
|
"homepage": "https://stormsoftware.com",
|
|
@@ -137,21 +137,22 @@
|
|
|
137
137
|
"@cacheable/memory": "^2.0.8",
|
|
138
138
|
"@donedeal0/superdiff": "^3.2.0",
|
|
139
139
|
"@jridgewell/sourcemap-codec": "^1.5.5",
|
|
140
|
-
"@powerlines/core": "^0.43.
|
|
140
|
+
"@powerlines/core": "^0.43.29",
|
|
141
141
|
"@storm-software/config": "^1.137.32",
|
|
142
142
|
"@storm-software/config-tools": "^1.189.78",
|
|
143
|
-
"@stryke/
|
|
144
|
-
"@stryke/
|
|
145
|
-
"@stryke/
|
|
146
|
-
"@stryke/
|
|
147
|
-
"@stryke/
|
|
148
|
-
"@stryke/
|
|
149
|
-
"@stryke/
|
|
150
|
-
"@stryke/
|
|
151
|
-
"@stryke/
|
|
152
|
-
"@stryke/
|
|
153
|
-
"@stryke/
|
|
154
|
-
"@stryke/
|
|
143
|
+
"@stryke/async": "^0.1.0",
|
|
144
|
+
"@stryke/capnp": "^0.12.95",
|
|
145
|
+
"@stryke/convert": "^0.7.2",
|
|
146
|
+
"@stryke/env": "^0.20.86",
|
|
147
|
+
"@stryke/fs": "^0.33.69",
|
|
148
|
+
"@stryke/hash": "^0.13.22",
|
|
149
|
+
"@stryke/helpers": "^0.10.11",
|
|
150
|
+
"@stryke/http": "^0.12.57",
|
|
151
|
+
"@stryke/json": "^0.14.15",
|
|
152
|
+
"@stryke/path": "^0.28.1",
|
|
153
|
+
"@stryke/string-format": "^0.17.12",
|
|
154
|
+
"@stryke/type-checks": "^0.6.4",
|
|
155
|
+
"@stryke/unique-id": "^0.3.80",
|
|
155
156
|
"bundle-require": "^5.1.0",
|
|
156
157
|
"chalk": "5.6.2",
|
|
157
158
|
"compatx": "^0.2.0",
|
|
@@ -171,7 +172,7 @@
|
|
|
171
172
|
},
|
|
172
173
|
"devDependencies": {
|
|
173
174
|
"@storm-software/testing-tools": "^1.119.153",
|
|
174
|
-
"@stryke/types": "^0.11.
|
|
175
|
+
"@stryke/types": "^0.11.6",
|
|
175
176
|
"@types/bun": "^1.3.13",
|
|
176
177
|
"@types/node": "^25.6.0",
|
|
177
178
|
"@types/semver": "^7.7.1",
|
|
@@ -179,5 +180,5 @@
|
|
|
179
180
|
"typescript": "^6.0.3",
|
|
180
181
|
"undici-types": "^7.25.0"
|
|
181
182
|
},
|
|
182
|
-
"gitHead": "
|
|
183
|
+
"gitHead": "4dc29b19d25392ae42c58ba47b7590884a8e28c8"
|
|
183
184
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base-context-D9PKchy4.mjs","names":["#timestamp","#logLevel"],"sources":["../src/_internal/helpers/resolver.ts","../src/context/base-context.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ResolvedConfig, Resolver } from \"@powerlines/core\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport defu from \"defu\";\nimport { JitiOptions, createJiti } from \"jiti\";\n\nexport type CreateResolverOptions = Omit<\n JitiOptions,\n \"fsCache\" | \"moduleCache\" | \"interopDefault\"\n> &\n Pick<ResolvedConfig, \"mode\" | \"logLevel\" | \"skipCache\"> & {\n workspaceRoot: string;\n root: string;\n cacheDir: string;\n };\n\n/**\n * Create a Jiti resolver for the given workspace and project root.\n *\n * @param options - The options for creating the resolver.\n * @returns A Jiti instance configured for the specified workspace and project root.\n */\nfunction resolveOptions(options: CreateResolverOptions): JitiOptions {\n return defu(options, {\n interopDefault: true,\n fsCache:\n options.mode !== \"development\"\n ? joinPaths(options.cacheDir, \"jiti\")\n : false,\n moduleCache: options.mode !== \"development\"\n });\n}\n\n/**\n * Create a Jiti resolver for the given workspace and project root.\n *\n * @param options - The options for creating the resolver.\n * @returns A Jiti instance configured for the specified workspace and project root.\n */\nexport function createResolver(options: CreateResolverOptions): Resolver {\n const baseResolver = createJiti(\n joinPaths(options.workspaceRoot, options.root),\n resolveOptions(options)\n ) as Resolver;\n baseResolver.plugin = createJiti(\n joinPaths(options.workspaceRoot, options.root),\n resolveOptions(options)\n );\n\n return baseResolver;\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n BaseContext,\n EngineOptions,\n LogFn,\n Logger,\n LogLevel,\n ParsedUserConfig,\n ResolvedEngineOptions,\n Resolver\n} from \"@powerlines/core\";\nimport { loadUserConfigFile } from \"@powerlines/core/lib/config\";\nimport { createLog, extendLog } from \"@powerlines/core/lib/logger\";\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { EnvPaths, getEnvPaths } from \"@stryke/env/get-env-paths\";\nimport { resolvePackage } from \"@stryke/fs/resolve\";\nimport { StormJSON } from \"@stryke/json/storm-json\";\nimport { isNull } from \"@stryke/type-checks/is-null\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport chalk from \"chalk\";\nimport { formatDistanceToNowStrict } from \"date-fns/formatDistanceToNowStrict\";\nimport defu from \"defu\";\nimport { UnpluginMessage } from \"unplugin\";\nimport { createResolver } from \"../_internal/helpers/resolver\";\n\nexport class PowerlinesBaseContext implements BaseContext {\n #timestamp: number = Date.now();\n\n #logLevel: LogLevel | null = \"info\";\n\n /**\n * The path to the Powerlines package\n */\n public powerlinesPath!: string;\n\n /**\n * The module resolver for the project\n */\n public resolver!: Resolver;\n\n /**\n * The options provided to the Powerlines process\n */\n public options!: ResolvedEngineOptions;\n\n /**\n * The parsed configuration file for the project\n */\n public configFile!: ParsedUserConfig;\n\n /**\n * A timestamp representing when the context was initialized\n */\n public get timestamp(): Date {\n return new Date(this.#timestamp);\n }\n\n public get logLevel(): LogLevel | null {\n return this.#logLevel || \"info\";\n }\n\n public set logLevel(level: LogLevel | null) {\n this.#logLevel = level;\n }\n\n /**\n * The logger function\n */\n public get log(): LogFn {\n const level = this.logLevel || \"info\";\n if (!this.logger || this.logger.level !== level) {\n this.logger = {\n log: this.createLog(),\n level\n };\n }\n\n return this.logger.log;\n }\n\n /**\n * The environment paths for the project\n */\n public get envPaths(): EnvPaths {\n return getEnvPaths({\n orgId: this.options.organization,\n appId: this.options.framework || \"powerlines\",\n workspaceRoot: this.options.cwd\n });\n }\n\n /**\n * Creates a clone of the current context with the same configuration and workspace settings. This can be useful for running multiple builds in parallel or for creating isolated contexts for different parts of the build process.\n *\n * @remarks\n * The cloned context will have the same configuration and workspace settings as the original context, but will have a different build ID, release ID, and timestamp. The virtual file system and caches will also be separate between the original and cloned contexts.\n *\n * @returns A promise that resolves to the cloned context.\n */\n public async clone(): Promise<BaseContext> {\n const clone = new PowerlinesBaseContext();\n await clone.init(this.options);\n\n return clone;\n }\n\n /**\n * A logging function for fatal messages\n *\n * @param message - The message to log.\n */\n public fatal(message: string | UnpluginMessage) {\n this.log(\n LogLevelLabel.FATAL,\n isString(message) ? message : StormJSON.stringify(message)\n );\n }\n\n /**\n * A logging function for error messages\n *\n * @param message - The message to log.\n */\n public error(message: string | UnpluginMessage) {\n this.log(\n LogLevelLabel.ERROR,\n isString(message) ? message : StormJSON.stringify(message)\n );\n }\n\n /**\n * A logging function for warning messages\n *\n * @param message - The message to log.\n */\n public warn(message: string | UnpluginMessage) {\n this.log(\n LogLevelLabel.WARN,\n isString(message) ? message : StormJSON.stringify(message)\n );\n }\n\n /**\n * A logging function for informational messages\n *\n * @param message - The message to log.\n */\n public info(message: string | UnpluginMessage) {\n this.log(\n LogLevelLabel.INFO,\n isString(message) ? message : StormJSON.stringify(message)\n );\n }\n\n /**\n * A logging function for debug messages\n *\n * @param message - The message to log.\n */\n public debug(message: string | UnpluginMessage) {\n this.log(\n LogLevelLabel.DEBUG,\n isString(message) ? message : StormJSON.stringify(message)\n );\n }\n\n /**\n * A logging function for trace messages\n *\n * @param message - The message to log.\n */\n public trace(message: string | UnpluginMessage) {\n this.log(\n LogLevelLabel.TRACE,\n isString(message) ? message : StormJSON.stringify(message)\n );\n }\n\n /**\n * A function to create a timer for measuring the duration of asynchronous operations\n *\n * @example\n * ```ts\n * const stopTimer = context.timer(\"Your Async Operation\");\n * await performAsyncOperation();\n * stopTimer(); // \"Your Async Operation completed in 123.45 milliseconds\"\n * ```\n *\n * @param name - The name of the timer.\n * @returns A function that, when called, stops the timer and logs the duration.\n */\n public timer(name: string): () => void {\n const startDate = Date.now();\n const startDuration = performance.now();\n\n return () => {\n const duration = performance.now() - startDuration;\n this.log(\n LogLevelLabel.PERFORMANCE,\n `${chalk.bold.cyanBright(name)} completed in ${chalk.bold.cyanBright(\n duration < 1000\n ? `${duration.toFixed(2)} milliseconds`\n : formatDistanceToNowStrict(startDate)\n )}`\n );\n };\n }\n\n /**\n * Create a new logger instance\n *\n * @param name - The name to use for the logger instance\n * @returns A logger function\n */\n public createLog(name: string | null = null): LogFn {\n return createLog(name, {\n ...this.options,\n logLevel: isNull(this.logLevel) ? \"silent\" : this.logLevel\n });\n }\n\n /**\n * Extend the current logger instance with a new name\n *\n * @param name - The name to use for the extended logger instance\n * @returns A logger function\n */\n public extendLog(name: string): LogFn {\n return extendLog(this.log, name);\n }\n\n /**\n * A logger function specific to this context\n */\n protected logger!: Logger;\n\n /**\n * Initialize the context with the provided configuration options\n *\n * @remarks\n * This method will set up the resolver and load the user configuration file based on the provided options. It is called during the construction of the context and can also be called when cloning the context to ensure that the new context has the same configuration and resolver setup.\n *\n * @param options - The configuration options to initialize the context with\n */\n protected async init(options: Partial<EngineOptions> = {}) {\n if (!this.powerlinesPath) {\n const powerlinesPath = await resolvePackage(\"powerlines\");\n if (!powerlinesPath) {\n throw new Error(\"Could not resolve `powerlines` package location.\");\n }\n this.powerlinesPath = powerlinesPath;\n }\n\n const cwd = options.cwd || this.options?.cwd || process.cwd();\n const root =\n (options.root || this.options?.root) &&\n (options.root || this.options.root).replace(/^\\.\\/?/, \"\") &&\n (options.root || this.options.root) !== cwd\n ? options.root || this.options.root\n : \"./\";\n\n this.options = defu(\n {\n root,\n cwd,\n mode: options.mode,\n framework: options.framework,\n organization: options.organization,\n configFile: options.configFile\n },\n this.options ?? {}\n ) as ResolvedEngineOptions;\n\n this.resolver = createResolver({\n workspaceRoot: cwd,\n root,\n cacheDir: this.envPaths.cache,\n mode: this.options.mode,\n logLevel: this.logLevel\n });\n\n this.configFile = await loadUserConfigFile(this.options, this.resolver);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAuCA,SAAS,eAAe,SAA6C;AACnE,QAAO,KAAK,SAAS;EACnB,gBAAgB;EAChB,SACE,QAAQ,SAAS,gBACb,UAAU,QAAQ,UAAU,OAAO,GACnC;EACN,aAAa,QAAQ,SAAS;EAC/B,CAAC;;;;;;;;AASJ,SAAgB,eAAe,SAA0C;CACvE,MAA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