@powerlines/engine 0.43.31 → 0.44.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.
@@ -1,12 +1,12 @@
1
1
  const require_chunk = require('./chunk-C0xms8kb.cjs');
2
- const require_base_context = require('./base-context-CPoqO4io.cjs');
2
+ const require_base_context = require('./base-context-5_AZZYFu.cjs');
3
3
  const require_fs = require('./fs-XogSgMqT.cjs');
4
4
  const require_virtual = require('./virtual-1hYa9zCy.cjs');
5
5
  const require_tsconfig = require('./tsconfig-DeyWQC2N.cjs');
6
6
  let _powerlines_core_constants = require("@powerlines/core/constants");
7
7
  let _stryke_fs_resolve = require("@stryke/fs/resolve");
8
8
  let _stryke_path_join = require("@stryke/path/join");
9
- let _storm_software_config_tools_types = require("@storm-software/config-tools/types");
9
+ let _powerlines_core = require("@powerlines/core");
10
10
  let _stryke_type_checks_is_set = require("@stryke/type-checks/is-set");
11
11
  let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
12
12
  let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
@@ -14,9 +14,9 @@ let _stryke_convert_to_array = require("@stryke/convert/to-array");
14
14
  let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
15
15
  let _stryke_unique_id_uuid = require("@stryke/unique-id/uuid");
16
16
  let _powerlines_core_lib_logger = require("@powerlines/core/lib/logger");
17
+ let _powerlines_core_plugin_utils = require("@powerlines/core/plugin-utils");
17
18
  let _stryke_path_is_equal = require("@stryke/path/is-equal");
18
19
  let _stryke_path_replace = require("@stryke/path/replace");
19
- let _stryke_type_checks_is_null = require("@stryke/type-checks/is-null");
20
20
  let chalk = require("chalk");
21
21
  chalk = require_chunk.__toESM(chalk, 1);
22
22
  let defu = require("defu");
@@ -24,7 +24,6 @@ defu = require_chunk.__toESM(defu, 1);
24
24
  let _stryke_path_join_paths = require("@stryke/path/join-paths");
25
25
  let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
26
26
  let _powerlines_core_lib_utilities_format = require("@powerlines/core/lib/utilities/format");
27
- let _powerlines_core_plugin_utils = require("@powerlines/core/plugin-utils");
28
27
  let _stryke_fs_exists = require("@stryke/fs/exists");
29
28
  let _stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
30
29
  let _stryke_helpers_omit = require("@stryke/helpers/omit");
@@ -33,7 +32,6 @@ let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
33
32
  let _stryke_path_is_parent_path = require("@stryke/path/is-parent-path");
34
33
  let _stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
35
34
  let _stryke_type_checks_is_object = require("@stryke/type-checks/is-object");
36
- let _powerlines_core = require("@powerlines/core");
37
35
  let _stryke_fs_json = require("@stryke/fs/json");
38
36
  let _stryke_helpers_deep_clone = require("@stryke/helpers/deep-clone");
39
37
  let _powerlines_core_lib_entry = require("@powerlines/core/lib/entry");
@@ -476,7 +474,7 @@ var VirtualFileSystem = class VirtualFileSystem {
476
474
  }
477
475
  }));
478
476
  } else result = new VirtualFileSystem(context, new _stryke_capnp.Message().initRoot(require_fs.FileSystem));
479
- result.#log(_storm_software_config_tools_types.LogLevelLabel.DEBUG, "Successfully completed virtual file system (VFS) initialization.");
477
+ result.#log("debug", "Successfully completed virtual file system (VFS) initialization.");
480
478
  return result;
481
479
  }
482
480
  /**
@@ -510,7 +508,7 @@ var VirtualFileSystem = class VirtualFileSystem {
510
508
  }
511
509
  });
512
510
  } else result = new VirtualFileSystem(context, new _stryke_capnp.Message().initRoot(require_fs.FileSystem));
513
- result.#log(_storm_software_config_tools_types.LogLevelLabel.DEBUG, "Successfully completed virtual file system (VFS) initialization.");
511
+ result.#log("debug", "Successfully completed virtual file system (VFS) initialization.");
514
512
  return result;
515
513
  }
516
514
  /**
@@ -644,7 +642,10 @@ var VirtualFileSystem = class VirtualFileSystem {
644
642
  return ret;
645
643
  }, {});
646
644
  }
647
- this.#log = context.extendLog("VFS");
645
+ this.#log = context.extendLog({
646
+ source: "VFS",
647
+ category: "fs"
648
+ });
648
649
  }
649
650
  /**
650
651
  * Asynchronously checks if a file exists in the virtual file system (VFS).
@@ -771,7 +772,7 @@ var VirtualFileSystem = class VirtualFileSystem {
771
772
  listSync(path) {
772
773
  let resolvedPath = path;
773
774
  if (resolvedPath.includes("*")) {
774
- this.#log(_storm_software_config_tools_types.LogLevelLabel.WARN, `Invoking "listSync" with a glob pattern is not supported. It is likely you meant to use "globSync". Path: ${path}`);
775
+ this.#log("warn", `Invoking "listSync" with a glob pattern is not supported. It is likely you meant to use "globSync". Path: ${path}`);
775
776
  resolvedPath = (0, _stryke_path_correct_path.stripStars)(resolvedPath);
776
777
  }
777
778
  return (0, _stryke_helpers_get_unique.getUnique)(this.#getStorages(resolvedPath, true).map((storage) => storage.adapter.listSync(storage.relativeBase ? storage.base ? (0, _stryke_path_append.appendPath)(storage.relativeBase, storage.base) : storage.relativeBase : storage.base)).flat().filter(Boolean));
@@ -785,7 +786,7 @@ var VirtualFileSystem = class VirtualFileSystem {
785
786
  async list(path) {
786
787
  let resolvedPath = path;
787
788
  if (resolvedPath.includes("*")) {
788
- this.#log(_storm_software_config_tools_types.LogLevelLabel.WARN, `Invoking "list" with a glob pattern is not supported. It is likely you meant to use "glob". Path: ${path}`);
789
+ this.#log("warn", `Invoking "list" with a glob pattern is not supported. It is likely you meant to use "glob". Path: ${path}`);
789
790
  resolvedPath = (0, _stryke_path_correct_path.stripStars)(resolvedPath);
790
791
  }
791
792
  return (0, _stryke_helpers_get_unique.getUnique)((await Promise.all(this.#getStorages(resolvedPath, true).map(async (storage) => storage.adapter.list(storage.relativeBase ? storage.base ? (0, _stryke_path_append.appendPath)(storage.relativeBase, storage.base) : storage.relativeBase : storage.base)))).flat().filter(Boolean));
@@ -797,7 +798,7 @@ var VirtualFileSystem = class VirtualFileSystem {
797
798
  */
798
799
  async remove(path) {
799
800
  const normalizedPath = this.#normalizePath(path);
800
- this.#log(_storm_software_config_tools_types.LogLevelLabel.TRACE, `Removing file: ${normalizedPath}`);
801
+ this.#log("trace", `Removing file: ${normalizedPath}`);
801
802
  const { relativeKey, adapter } = this.#getStorage(normalizedPath);
802
803
  if ((0, _stryke_path_file_path_fns.hasFileExtension)(normalizedPath)) await adapter.remove(relativeKey);
803
804
  else await adapter.clear(relativeKey);
@@ -815,7 +816,7 @@ var VirtualFileSystem = class VirtualFileSystem {
815
816
  */
816
817
  removeSync(path) {
817
818
  const normalizedPath = this.#normalizePath(path);
818
- this.#log(_storm_software_config_tools_types.LogLevelLabel.TRACE, `Removing file: ${normalizedPath}`);
819
+ this.#log("trace", `Removing file: ${normalizedPath}`);
819
820
  const { relativeKey, adapter } = this.#getStorage(normalizedPath);
820
821
  if ((0, _stryke_path_file_path_fns.hasFileExtension)(normalizedPath)) adapter.removeSync(relativeKey);
821
822
  else adapter.clearSync(relativeKey);
@@ -961,7 +962,7 @@ var VirtualFileSystem = class VirtualFileSystem {
961
962
  const filePath = await this.resolve(path, void 0, { isFile: true });
962
963
  if (!filePath || !this.existsSync(filePath)) return;
963
964
  const { adapter } = this.#getStorage(filePath);
964
- this.#log(_storm_software_config_tools_types.LogLevelLabel.TRACE, `Reading ${adapter.name} file: ${filePath}`);
965
+ this.#log("trace", `Reading ${adapter.name} file: ${filePath}`);
965
966
  return await adapter.get(filePath) ?? void 0;
966
967
  }
967
968
  /**
@@ -974,7 +975,7 @@ var VirtualFileSystem = class VirtualFileSystem {
974
975
  const filePath = this.resolveSync(path, void 0, { isFile: true });
975
976
  if (!filePath || !this.existsSync(filePath)) return;
976
977
  const { adapter } = this.#getStorage(filePath);
977
- this.#log(_storm_software_config_tools_types.LogLevelLabel.TRACE, `Reading ${adapter.name} file: ${filePath}`);
978
+ this.#log("trace", `Reading ${adapter.name} file: ${filePath}`);
978
979
  return adapter.getSync(filePath) ?? void 0;
979
980
  }
980
981
  /**
@@ -989,15 +990,15 @@ var VirtualFileSystem = class VirtualFileSystem {
989
990
  const meta = options.meta ?? {};
990
991
  const resolvedPath = await this.resolve(this.#normalizePath(path)) || path;
991
992
  const { relativeKey, adapter } = this.#getStorage(resolvedPath, options.storage);
992
- this.#log(_storm_software_config_tools_types.LogLevelLabel.TRACE, `Writing ${resolvedPath} to ${adapter.name === "virtual" ? "the virtual file system" : adapter.name === "file-system" ? "the local file system" : adapter.name} (size: ${(0, _stryke_string_format_pretty_bytes.prettyBytes)(new node_buffer.Blob((0, _stryke_convert_to_array.toArray)(data)).size)})`);
993
+ this.#log("trace", `Writing ${resolvedPath} to ${adapter.name === "virtual" ? "the virtual file system" : adapter.name === "file-system" ? "the local file system" : adapter.name} (size: ${(0, _stryke_string_format_pretty_bytes.prettyBytes)(new node_buffer.Blob((0, _stryke_convert_to_array.toArray)(data)).size)})`);
993
994
  let code = data;
994
995
  try {
995
996
  if (!options.skipFormat) code = await (0, _powerlines_core_lib_utilities_format.format)(this.#context, resolvedPath, data);
996
997
  } catch (err) {
997
- if (DEFAULT_EXTENSIONS.includes((0, _stryke_path_file_path_fns.findFileExtensionSafe)(resolvedPath, { fullExtension: true }))) this.#log(_storm_software_config_tools_types.LogLevelLabel.WARN, `Failed to format file ${resolvedPath} before writing: ${err.message}`);
998
+ if (DEFAULT_EXTENSIONS.includes((0, _stryke_path_file_path_fns.findFileExtensionSafe)(resolvedPath, { fullExtension: true }))) this.#log("warn", `Failed to format file ${resolvedPath} before writing: ${err.message}`);
998
999
  code = data;
999
1000
  }
1000
- this.#log(_storm_software_config_tools_types.LogLevelLabel.TRACE, `Writing ${resolvedPath} to ${adapter.name === "virtual" ? "the virtual file system" : adapter.name === "file-system" ? "the local file system" : adapter.name} (size: ${(0, _stryke_string_format_pretty_bytes.prettyBytes)(new node_buffer.Blob((0, _stryke_convert_to_array.toArray)(code)).size)})`);
1001
+ this.#log("trace", `Writing ${resolvedPath} to ${adapter.name === "virtual" ? "the virtual file system" : adapter.name === "file-system" ? "the local file system" : adapter.name} (size: ${(0, _stryke_string_format_pretty_bytes.prettyBytes)(new node_buffer.Blob((0, _stryke_convert_to_array.toArray)(code)).size)})`);
1001
1002
  const id = this.#normalizeId(meta.id || resolvedPath);
1002
1003
  this.metadata[id] = {
1003
1004
  type: "normal",
@@ -1020,7 +1021,7 @@ var VirtualFileSystem = class VirtualFileSystem {
1020
1021
  const meta = options.meta ?? {};
1021
1022
  const resolvedPath = this.resolveSync(this.#normalizePath(path)) || path;
1022
1023
  const { relativeKey, adapter } = this.#getStorage(resolvedPath, options.storage);
1023
- this.#log(_storm_software_config_tools_types.LogLevelLabel.TRACE, `Writing ${resolvedPath} file to ${adapter.name === "virtual" ? "the virtual file system" : adapter.name === "file-system" ? "the local file system" : adapter.name} (size: ${(0, _stryke_string_format_pretty_bytes.prettyBytes)(new node_buffer.Blob((0, _stryke_convert_to_array.toArray)(data)).size)})`);
1024
+ this.#log("trace", `Writing ${resolvedPath} file to ${adapter.name === "virtual" ? "the virtual file system" : adapter.name === "file-system" ? "the local file system" : adapter.name} (size: ${(0, _stryke_string_format_pretty_bytes.prettyBytes)(new node_buffer.Blob((0, _stryke_convert_to_array.toArray)(data)).size)})`);
1024
1025
  const id = this.#normalizeId(meta.id || resolvedPath);
1025
1026
  this.metadata[id] = {
1026
1027
  type: "normal",
@@ -1184,7 +1185,7 @@ var VirtualFileSystem = class VirtualFileSystem {
1184
1185
  async dispose() {
1185
1186
  if (!this.#isDisposed) {
1186
1187
  this.#isDisposed = true;
1187
- this.#log(_storm_software_config_tools_types.LogLevelLabel.DEBUG, "Disposing virtual file system...");
1188
+ this.#log("debug", "Disposing virtual file system...");
1188
1189
  await this.remove((0, _stryke_path_join.joinPaths)(this.#context.dataPath, "fs.bin"));
1189
1190
  const message = new _stryke_capnp.Message();
1190
1191
  const fs = message.initRoot(require_fs.FileSystem);
@@ -1219,9 +1220,15 @@ var VirtualFileSystem = class VirtualFileSystem {
1219
1220
  await (0, _stryke_fs_buffer.writeFileBuffer)((0, _stryke_path_join.joinPaths)(this.#context.dataPath, "fs.bin"), message.toArrayBuffer());
1220
1221
  if (!this.#context.config.skipCache) this.resolverCache.save(true);
1221
1222
  await Promise.all(this.#getStorages().map(async (storage) => storage.adapter.dispose()));
1222
- this.#log(_storm_software_config_tools_types.LogLevelLabel.TRACE, "Virtual file system has been disposed.");
1223
+ this.#log("trace", "Virtual file system has been disposed.");
1223
1224
  }
1224
1225
  }
1226
+ /**
1227
+ * Asynchronously disposes of the virtual file system (VFS) by saving its state to disk.
1228
+ *
1229
+ * @remarks
1230
+ * This method is automatically called when the VFS instance is used within a `using` block, or can be manually invoked to ensure that the VFS state is saved and resources are cleaned up properly.
1231
+ */
1225
1232
  async [Symbol.asyncDispose]() {
1226
1233
  return this.dispose();
1227
1234
  }
@@ -1370,7 +1377,7 @@ var PowerlinesContext = class PowerlinesContext extends require_base_context.Pow
1370
1377
  buildId: this.#buildId,
1371
1378
  releaseId: this.#releaseId,
1372
1379
  checksum: this.#checksum,
1373
- timestamp: this.timestamp.getTime(),
1380
+ timestamp: this.timestamp,
1374
1381
  rootHash: (0, _stryke_hash.murmurhash)({
1375
1382
  workspaceRoot: this.options?.cwd,
1376
1383
  root: this.config?.root
@@ -1528,6 +1535,60 @@ var PowerlinesContext = class PowerlinesContext extends require_base_context.Pow
1528
1535
  this.options = options;
1529
1536
  }
1530
1537
  /**
1538
+ * Create a new log function with the specified configuration, which can include properties such as log level, colors, and other metadata to be included with each log message. This allows you to customize the behavior and appearance of the logger instance according to your needs.
1539
+ *
1540
+ * @param config - Optional configuration for the log function instance, which can include properties such as log level, colors, and other metadata to be included with each log message. This allows you to customize the behavior and appearance of the logger instance according to your needs.
1541
+ * @returns A log function that can be used to log messages with the specified configuration.
1542
+ */
1543
+ createLog(config) {
1544
+ const log = (0, _powerlines_core.createLogFn)({
1545
+ ...config,
1546
+ logLevel: this.logLevel
1547
+ });
1548
+ return (meta, ...args) => {
1549
+ log(meta, ...args);
1550
+ process.send?.({
1551
+ id: (0, _stryke_unique_id_uuid.uuid)(),
1552
+ type: "write-log",
1553
+ executionId: config?.executionId ?? this.options.executionId,
1554
+ executionIndex: config?.executionIndex ?? this.options.executionIndex,
1555
+ timestamp: Date.now(),
1556
+ payload: {
1557
+ level: meta && (0, _stryke_type_checks_is_set_object.isSetObject)(meta) && (0, _stryke_type_checks_is_set_string.isSetString)(meta.level) ? meta.level : (0, _stryke_type_checks_is_set_string.isSetString)(meta) ? meta : "info",
1558
+ ...config,
1559
+ args
1560
+ }
1561
+ });
1562
+ };
1563
+ }
1564
+ /**
1565
+ * Extend the current log function instance with a new name
1566
+ *
1567
+ * @param config - The configuration for the extended log function instance, which can include properties such as log level, colors, and other metadata to be included with each log message. This allows you to customize the behavior and appearance of the log function instance according to your needs.
1568
+ * @returns A log function
1569
+ */
1570
+ extendLog(config) {
1571
+ const log = (0, _powerlines_core.extendLogFn)(this.log, {
1572
+ ...config,
1573
+ logLevel: this.logLevel
1574
+ });
1575
+ return (meta, ...args) => {
1576
+ log(meta, ...args);
1577
+ process.send?.({
1578
+ id: (0, _stryke_unique_id_uuid.uuid)(),
1579
+ type: "write-log",
1580
+ executionId: config.executionId ?? this.options.executionId,
1581
+ executionIndex: config.executionIndex ?? this.options.executionIndex,
1582
+ timestamp: Date.now(),
1583
+ payload: {
1584
+ level: meta && (0, _stryke_type_checks_is_set_object.isSetObject)(meta) && (0, _stryke_type_checks_is_set_string.isSetString)(meta.level) ? meta.level : (0, _stryke_type_checks_is_set_string.isSetString)(meta) ? meta : "info",
1585
+ ...config,
1586
+ args
1587
+ }
1588
+ });
1589
+ };
1590
+ }
1591
+ /**
1531
1592
  * 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.
1532
1593
  *
1533
1594
  * @remarks
@@ -1937,6 +1998,7 @@ var PowerlinesContext = class PowerlinesContext extends require_base_context.Pow
1937
1998
  */
1938
1999
  async init(options = {}) {
1939
2000
  await super.init(options);
2001
+ this.options.executionId = options.executionId ?? this.options.executionId;
1940
2002
  this.options.executionIndex = options.executionIndex ?? this.options.executionIndex ?? 0;
1941
2003
  const projectJsonPath = (0, _stryke_path_join.joinPaths)(this.options.cwd, this.options.root, "project.json");
1942
2004
  if ((0, _stryke_fs_exists.existsSync)(projectJsonPath)) this.projectJson = await (0, _stryke_fs_json.readJsonFile)(projectJsonPath);
@@ -1966,10 +2028,6 @@ var PowerlinesContext = class PowerlinesContext extends require_base_context.Pow
1966
2028
  this.config.framework = "powerlines";
1967
2029
  }
1968
2030
  this.resolvedConfig.compatibilityDate = (0, compatx.resolveCompatibilityDates)(this.config.inlineConfig.compatibilityDate ?? this.config.userConfig.compatibilityDate ?? this.config.pluginConfig.compatibilityDate, "latest");
1969
- this.logger = {
1970
- log: this.createLog(this.config.name),
1971
- level: (0, _stryke_type_checks_is_null.isNull)(this.logLevel) ? "silent" : this.logLevel
1972
- };
1973
2031
  this.config.input = (0, _powerlines_core_lib_entry.getUniqueInputs)(this.config.input);
1974
2032
  if (this.config.name?.startsWith("@") && this.config.name.split("/").filter(Boolean).length > 1) this.config.name = this.config.name.split("/").filter(Boolean)[1];
1975
2033
  this.config.title ??= (0, _stryke_string_format_title_case.titleCase)(this.config.name);
@@ -1982,11 +2040,12 @@ var PowerlinesContext = class PowerlinesContext extends require_base_context.Pow
1982
2040
  ret.push(plugin);
1983
2041
  return ret;
1984
2042
  }, []);
1985
- if (!this.config.userConfig?.logLevel && !this.config.inlineConfig?.logLevel) if (this.config.mode === "development") this.config.logLevel = "debug";
1986
- else this.config.logLevel = "info";
1987
- if (!this.config.userConfig?.tsconfig && !this.config.inlineConfig?.tsconfig) this.config.tsconfig = require_tsconfig.getTsconfigFilePath(this.options.cwd, this.options.root);
2043
+ if (!this.config.userConfig?.logLevel && !this.config.inlineConfig?.logLevel) if (this.config.mode === "development") this.config.logLevel = _powerlines_core_constants.DEFAULT_DEVELOPMENT_LOG_LEVEL;
2044
+ else if (this.config.mode === "test") this.config.logLevel = _powerlines_core_constants.DEFAULT_TEST_LOG_LEVEL;
2045
+ else this.config.logLevel = _powerlines_core_constants.DEFAULT_PRODUCTION_LOG_LEVEL;
2046
+ if (!this.config.userConfig?.tsconfig && !this.config.inlineConfig?.tsconfig) this.config.tsconfig = require_tsconfig.getTsconfigFilePath(this.config.cwd, this.config.root);
1988
2047
  else if (this.config.tsconfig) this.config.tsconfig = (0, _stryke_path_replace.replacePath)((0, _powerlines_core_plugin_utils.replacePathTokens)(this, this.config.tsconfig), this.config.cwd);
1989
- this.resolvedConfig.output = (0, defu.default)(this.resolvedConfig.output ?? {}, {
2048
+ this.resolvedConfig.output = (0, defu.default)(this.config.output ?? {}, {
1990
2049
  path: (0, _stryke_path_join.joinPaths)(this.config.root, "dist"),
1991
2050
  copy: { assets: [
1992
2051
  { glob: "LICENSE" },
@@ -2031,6 +2090,7 @@ var PowerlinesContext = class PowerlinesContext extends require_base_context.Pow
2031
2090
  }));
2032
2091
  if ((0, _stryke_type_checks_is_set_string.isSetString)(this.config.output?.storage) && this.config.output.storage === "virtual" || (0, _stryke_type_checks_is_set_object.isSetObject)(this.config.output?.storage) && Object.values(this.config.output.storage).every((adapter) => adapter.preset === "virtual")) this.config.output.overwrite = true;
2033
2092
  this.#fs ??= await VirtualFileSystem.create(this);
2093
+ this.extendLog({ category: "config" })("debug", `Resolved Powerlines configuration object: \n${JSON.stringify(this.resolvedConfig, null, 2)}`);
2034
2094
  }
2035
2095
  };
2036
2096
 
@@ -2180,7 +2240,7 @@ function createPluginContext(pluginId, plugin, environment) {
2180
2240
  const normalizeMessage = (message) => {
2181
2241
  return (0, _stryke_type_checks_is_string.isString)(message) ? message : message.message;
2182
2242
  };
2183
- const log = environment.extendLog(pluginId, plugin.name.replaceAll(":", " - "));
2243
+ const log = environment.extendLog({ plugin: plugin.name.replaceAll(":", " - ") });
2184
2244
  const callHookFn = async (hook, options, ...args) => {
2185
2245
  return environment.$$internal.api.callHook(hook, {
2186
2246
  sequential: true,
@@ -2201,22 +2261,22 @@ function createPluginContext(pluginId, plugin, environment) {
2201
2261
  if (prop === "id") return pluginId;
2202
2262
  if (prop === "log" || prop === "logger") return log;
2203
2263
  if (prop === "fatal") return (message) => {
2204
- log(_storm_software_config_tools_types.LogLevelLabel.FATAL, normalizeMessage(message));
2264
+ log("error", normalizeMessage(message));
2205
2265
  };
2206
2266
  if (prop === "error") return (message) => {
2207
- log(_storm_software_config_tools_types.LogLevelLabel.ERROR, normalizeMessage(message));
2267
+ log("error", normalizeMessage(message));
2208
2268
  };
2209
2269
  if (prop === "warn") return (message) => {
2210
- log(_storm_software_config_tools_types.LogLevelLabel.WARN, normalizeMessage(message));
2270
+ log("warn", normalizeMessage(message));
2211
2271
  };
2212
2272
  if (prop === "info") return (message) => {
2213
- log(_storm_software_config_tools_types.LogLevelLabel.INFO, normalizeMessage(message));
2273
+ log("info", normalizeMessage(message));
2214
2274
  };
2215
2275
  if (prop === "debug") return (message) => {
2216
- log(_storm_software_config_tools_types.LogLevelLabel.DEBUG, normalizeMessage(message));
2276
+ log("debug", normalizeMessage(message));
2217
2277
  };
2218
2278
  if (prop === "trace") return (message) => {
2219
- log(_storm_software_config_tools_types.LogLevelLabel.TRACE, normalizeMessage(message));
2279
+ log("trace", normalizeMessage(message));
2220
2280
  };
2221
2281
  return environment[prop];
2222
2282
  },
@@ -2235,7 +2295,7 @@ function createPluginContext(pluginId, plugin, environment) {
2235
2295
  "addPlugin",
2236
2296
  "selectHooks"
2237
2297
  ].includes(prop)) {
2238
- log(_storm_software_config_tools_types.LogLevelLabel.WARN, `Cannot set read-only property "${String(prop)}"`);
2298
+ log("warn", `Cannot set read-only property "${String(prop)}"`);
2239
2299
  return false;
2240
2300
  }
2241
2301
  environment[prop] = value;
@@ -2287,52 +2347,28 @@ var PowerlinesEnvironmentContext = class PowerlinesEnvironmentContext extends Po
2287
2347
  return this.#hooks;
2288
2348
  }
2289
2349
  /**
2290
- * Create a new logger instance
2350
+ * Create a new log function with the specified configuration, which can include properties such as log level, colors, and other metadata to be included with each log message. This allows you to customize the behavior and appearance of the logger instance according to your needs.
2291
2351
  *
2292
- * @param source - The source name to use for the logger instance, which can be used to identify the origin of log messages in the logs for better traceability. This is typically the name of the plugin or module that is creating the logger instance.
2293
- * @returns A logger function
2352
+ * @param config - Optional configuration for the log function instance, which can include properties such as log level, colors, and other metadata to be included with each log message. This allows you to customize the behavior and appearance of the logger instance according to your needs.
2353
+ * @returns A log function that can be used to log messages with the specified configuration.
2294
2354
  */
2295
- createLog(source = null) {
2296
- return (level, ...args) => {
2297
- process.send?.({
2298
- id: (0, _stryke_unique_id_uuid.uuid)(),
2299
- type: "write-log",
2300
- executionId: this.options.executionId,
2301
- executionIndex: this.options.executionIndex,
2302
- timestamp: Date.now(),
2303
- payload: {
2304
- level,
2305
- source,
2306
- environment: this.environment?.name,
2307
- args
2308
- }
2309
- });
2310
- };
2355
+ createLog(config) {
2356
+ return super.createLog({
2357
+ ...config,
2358
+ environment: this.environment?.name
2359
+ });
2311
2360
  }
2312
2361
  /**
2313
- * Extend the current logger instance with a new name
2362
+ * Extend the current log function instance with a new name
2314
2363
  *
2315
- * @param source - The name of the source to use for the extended logger instance
2316
- * @param plugin - An optional plugin name to use for the extended logger instance, which can be used to identify the origin of log messages in the logs for better traceability. This is typically the name of the plugin or module that is creating the logger instance.
2317
- * @returns A logger function
2364
+ * @param config - The configuration for the extended log function instance, which can include properties such as log level, colors, and other metadata to be included with each log message. This allows you to customize the behavior and appearance of the log function instance according to your needs.
2365
+ * @returns A log function
2318
2366
  */
2319
- extendLog(source, plugin) {
2320
- return (level, ...args) => {
2321
- process.send?.({
2322
- id: (0, _stryke_unique_id_uuid.uuid)(),
2323
- type: "write-log",
2324
- executionId: this.options.executionId,
2325
- executionIndex: this.options.executionIndex,
2326
- timestamp: Date.now(),
2327
- payload: {
2328
- level,
2329
- source,
2330
- plugin,
2331
- environment: this.environment?.name,
2332
- args
2333
- }
2334
- });
2335
- };
2367
+ extendLog(config) {
2368
+ return super.extendLog({
2369
+ ...config,
2370
+ environment: this.environment?.name
2371
+ });
2336
2372
  }
2337
2373
  /**
2338
2374
  * 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.
@@ -2516,31 +2552,30 @@ var PowerlinesExecutionContext = class PowerlinesExecutionContext extends Powerl
2516
2552
  super(options);
2517
2553
  }
2518
2554
  /**
2519
- * Create a new logger instance
2555
+ * Create a new log function with the specified configuration, which can include properties such as log level, colors, and other metadata to be included with each log message. This allows you to customize the behavior and appearance of the logger instance according to your needs.
2520
2556
  *
2521
- * @param source - The source name to use for the logger instance, which can be used to identify the origin of log messages in the logs for better traceability. This is typically the name of the plugin or module that is creating the logger instance.
2522
- * @returns A logger function
2557
+ * @param config - Optional configuration for the log function instance, which can include properties such as log level, colors, and other metadata to be included with each log message. This allows you to customize the behavior and appearance of the logger instance according to your needs.
2558
+ * @returns A log function that can be used to log messages with the specified configuration.
2523
2559
  */
2524
- createLog(source = null) {
2525
- const logger = (0, _powerlines_core.createLog)(source, {
2526
- ...this.config,
2527
- logLevel: (0, _stryke_type_checks_is_null.isNull)(this.config.logLevel) ? "silent" : this.config.logLevel
2560
+ createLog(config) {
2561
+ return super.createLog({
2562
+ ...config,
2563
+ executionId: this.id,
2564
+ executionIndex: this.options.executionIndex
2565
+ });
2566
+ }
2567
+ /**
2568
+ * Extend the current log function instance with a new name
2569
+ *
2570
+ * @param config - The configuration for the extended log function instance, which can include properties such as log level, colors, and other metadata to be included with each log message. This allows you to customize the behavior and appearance of the log function instance according to your needs.
2571
+ * @returns A log function
2572
+ */
2573
+ extendLog(config) {
2574
+ return super.extendLog({
2575
+ ...config,
2576
+ executionId: this.id,
2577
+ executionIndex: this.options.executionIndex
2528
2578
  });
2529
- return (level, ...args) => {
2530
- logger(level, ...args);
2531
- process.send?.({
2532
- id: (0, _stryke_unique_id_uuid.uuid)(),
2533
- type: "write-log",
2534
- executionId: this.id,
2535
- executionIndex: this.options.executionIndex,
2536
- timestamp: Date.now(),
2537
- payload: {
2538
- source,
2539
- level,
2540
- args
2541
- }
2542
- });
2543
- };
2544
2579
  }
2545
2580
  /**
2546
2581
  * 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.