@powerlines/engine 0.46.5 → 0.46.6

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.
@@ -75,7 +75,6 @@ let _stryke_hash = require("@stryke/hash");
75
75
  let _stryke_hash_node = require("@stryke/hash/node");
76
76
  let _stryke_http_fetch = require("@stryke/http/fetch");
77
77
  let _stryke_path_is_equal = require("@stryke/path/is-equal");
78
- let _stryke_type_checks_is_regexp = require("@stryke/type-checks/is-regexp");
79
78
  let _stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
80
79
  let bundle_require = require("bundle-require");
81
80
  let compatx = require("compatx");
@@ -94,6 +93,7 @@ let _stryke_path_glob_to_regex = require("@stryke/path/glob-to-regex");
94
93
  let _stryke_path_is_type = require("@stryke/path/is-type");
95
94
  let _stryke_path_slash = require("@stryke/path/slash");
96
95
  let _stryke_string_format_pretty_bytes = require("@stryke/string-format/pretty-bytes");
96
+ let _stryke_type_checks_is_regexp = require("@stryke/type-checks/is-regexp");
97
97
  let node_buffer = require("node:buffer");
98
98
  let node_url = require("node:url");
99
99
  let _stryke_fs_is_file = require("@stryke/fs/is-file");
@@ -3134,7 +3134,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
3134
3134
  async setInlineConfig(config) {
3135
3135
  this.logger.debug({
3136
3136
  meta: { category: "config" },
3137
- message: `Updating inline configuration object: \n${this.logConfig(config)}`
3137
+ message: `Updating inline configuration object: \n${(0, _powerlines_core_plugin_utils.formatConfig)(config)}`
3138
3138
  });
3139
3139
  this.inlineConfig = config;
3140
3140
  await this.resolveConfig();
@@ -3148,7 +3148,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
3148
3148
  async setPluginConfig(config) {
3149
3149
  this.logger.debug({
3150
3150
  meta: { category: "config" },
3151
- message: `Updating plugin configuration object: \n${this.logConfig(config)}`
3151
+ message: `Updating plugin configuration object: \n${(0, _powerlines_core_plugin_utils.formatConfig)(config)}`
3152
3152
  });
3153
3153
  this.pluginConfig = config;
3154
3154
  await this.resolveConfig();
@@ -3190,7 +3190,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
3190
3190
  async setUserConfig(config) {
3191
3191
  this.logger.debug({
3192
3192
  meta: { category: "config" },
3193
- message: `Updating user configuration object: \n${this.logConfig(config)}`
3193
+ message: `Updating user configuration object: \n${(0, _powerlines_core_plugin_utils.formatConfig)(config)}`
3194
3194
  });
3195
3195
  this.userConfig = config;
3196
3196
  await this.resolveConfig();
@@ -3227,7 +3227,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
3227
3227
  const mergedConfig = this.mergeConfig();
3228
3228
  this.logger.trace({
3229
3229
  meta: { category: "config" },
3230
- message: `Pre-setup Powerlines configuration object: \n --- Merged Config --- \n${this.logConfig(mergedConfig)} \n\n --- Initial Options --- \n${this.logConfig(this.initialOptions)} \n\n --- Initial Config --- \n${this.logConfig(this.initialConfig)} \n\n --- User Config --- \n${this.logConfig(this.userConfig)} \n\n --- Inline Config --- \n${this.logConfig(this.inlineConfig)} \n\n --- Plugin Config --- \n${this.logConfig(this.pluginConfig)} \n\n --- Environment Config --- \n${this.logConfig(this.environmentConfig)} \n\n --- Overridden Config --- \n${this.logConfig(this.overriddenConfig)}`
3230
+ message: `Pre-setup Powerlines configuration object: \n --- Merged Config --- \n${(0, _powerlines_core_plugin_utils.formatConfig)(mergedConfig)} \n\n --- Initial Options --- \n${(0, _powerlines_core_plugin_utils.formatConfig)(this.initialOptions)} \n\n --- Initial Config --- \n${(0, _powerlines_core_plugin_utils.formatConfig)(this.initialConfig)} \n\n --- User Config --- \n${(0, _powerlines_core_plugin_utils.formatConfig)(this.userConfig)} \n\n --- Inline Config --- \n${(0, _powerlines_core_plugin_utils.formatConfig)(this.inlineConfig)} \n\n --- Plugin Config --- \n${(0, _powerlines_core_plugin_utils.formatConfig)(this.pluginConfig)} \n\n --- Environment Config --- \n${(0, _powerlines_core_plugin_utils.formatConfig)(this.environmentConfig)} \n\n --- Overridden Config --- \n${(0, _powerlines_core_plugin_utils.formatConfig)(this.overriddenConfig)}`
3231
3231
  });
3232
3232
  mergedConfig.output = (0, defu.default)(mergedConfig.output ?? {}, {
3233
3233
  copy: { assets: [
@@ -3302,28 +3302,10 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
3302
3302
  this.#configProxy = this.createConfigProxy();
3303
3303
  this.logger.info({
3304
3304
  meta: { category: "config" },
3305
- message: `Resolved Powerlines configuration object: \n${this.logConfig(this.resolvedConfig)}`
3305
+ message: `Resolved Powerlines configuration object: \n${(0, _powerlines_core_plugin_utils.formatConfig)(this.resolvedConfig)}`
3306
3306
  });
3307
3307
  this.#fs ??= await VirtualFileSystem.create(this);
3308
3308
  }
3309
- logConfig(config) {
3310
- return JSON.stringify(Object.fromEntries(Object.entries({
3311
- ...(0, _stryke_helpers_omit.omit)(config, [
3312
- "plugins",
3313
- "initialConfig",
3314
- "userConfig",
3315
- "inlineConfig",
3316
- "pluginConfig",
3317
- "environmentConfig"
3318
- ]),
3319
- resolve: {
3320
- ...config.resolve,
3321
- external: (config.resolve?.external ?? []).filter(Boolean).map((external) => (0, _stryke_type_checks_is_set_string.isSetString)(external) ? external : (0, _stryke_type_checks_is_regexp.isRegExp)(external) ? external.source : "<unknown-external>"),
3322
- noExternal: (config.resolve?.noExternal ?? []).filter(Boolean).map((noExternal) => (0, _stryke_type_checks_is_set_string.isSetString)(noExternal) ? noExternal : (0, _stryke_type_checks_is_regexp.isRegExp)(noExternal) ? noExternal.source : "<unknown-no-external>")
3323
- },
3324
- plugins: config.plugins ? config.plugins.flatMap((plugin) => (0, _stryke_convert_to_array.toArray)(plugin)).map((plugin) => String((0, _stryke_type_checks_is_set_string.isSetString)(plugin) ? plugin : (0, _stryke_type_checks_is_set_object.isSetObject)(plugin) && (0, _stryke_type_checks_is_set_string.isSetString)(plugin.name) ? plugin.name : Array.isArray(plugin) && (0, _stryke_type_checks_is_set_string.isSetString)(plugin[0]) ? plugin[0] : "<function-plugin>")) : []
3325
- }).sort(([key1], [key2]) => key1.localeCompare(key2))), null, 4).replace(/"([^"]+)":/g, "$1:").replace(/,$/g, "");
3326
- }
3327
3309
  createConfigProxy() {
3328
3310
  return new Proxy(this.resolvedConfig, {
3329
3311
  /**
@@ -3681,7 +3663,7 @@ var PowerlinesEnvironmentContext = class PowerlinesEnvironmentContext extends Po
3681
3663
  async setEnvironmentConfig(config) {
3682
3664
  this.logger.debug({
3683
3665
  meta: { category: "config" },
3684
- message: `Updating environment configuration object: \n${this.logConfig(config)}`
3666
+ message: `Updating environment configuration object: \n${(0, _powerlines_core_plugin_utils.formatConfig)(config)}`
3685
3667
  });
3686
3668
  this.environmentConfig = config;
3687
3669
  await this.resolveConfig();
@@ -4657,20 +4639,7 @@ var PowerlinesExecution = class PowerlinesExecution {
4657
4639
  });
4658
4640
  context.trace({
4659
4641
  meta: { category: "config" },
4660
- message: `Powerlines configuration after configResolved hook: \n${(0, _storm_software_config_tools_logger_console.formatLogMessage)({
4661
- ...(0, _stryke_helpers_omit.omit)(context.config, [
4662
- "inlineConfig",
4663
- "userConfig",
4664
- "initialConfig",
4665
- "pluginConfig",
4666
- "plugins"
4667
- ]),
4668
- plugins: context.plugins.map((plugin) => plugin.plugin.name),
4669
- inlineConfig: (0, _stryke_type_checks_is_set_object.isSetObject)(context.config.inlineConfig) ? (0, _stryke_helpers_omit.omit)(context.config.inlineConfig, ["plugins"]) : void 0,
4670
- userConfig: (0, _stryke_type_checks_is_set_object.isSetObject)(context.config.userConfig) ? (0, _stryke_helpers_omit.omit)(context.config.userConfig, ["plugins"]) : void 0,
4671
- initialConfig: (0, _stryke_type_checks_is_set_object.isSetObject)(context.config.initialConfig) ? (0, _stryke_helpers_omit.omit)(context.config.initialConfig, ["plugins"]) : void 0,
4672
- pluginConfig: (0, _stryke_type_checks_is_set_object.isSetObject)(context.config.pluginConfig) ? (0, _stryke_helpers_omit.omit)(context.config.pluginConfig, ["plugins"]) : void 0
4673
- })}`
4642
+ message: `Powerlines configuration after configResolved hook: \n${(0, _powerlines_core_plugin_utils.formatConfig)(context.config)}`
4674
4643
  });
4675
4644
  if (!context.fs.existsSync(context.cachePath)) await (0, _stryke_fs_helpers.createDirectory)(context.cachePath);
4676
4645
  if (!context.fs.existsSync(context.dataPath)) await (0, _stryke_fs_helpers.createDirectory)(context.dataPath);
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env -S NODE_OPTIONS=--enable-source-maps node
2
2
  import { getFileHeaderWarningText, getTypescriptFileHeader } from "@powerlines/core/lib/utilities/file-header";
3
3
  import { format, formatFolder } from "@powerlines/core/lib/utilities/format";
4
- import { addPluginHook, createLogger, dedupeHooklist, findInvalidPluginConfig, getPackageJsonOrganization, isDuplicate, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookField, mergeConfig, replacePathTokens, resolveLogLevel, withCustomLogger, withLogFn } from "@powerlines/core/plugin-utils";
4
+ import { addPluginHook, createLogger, dedupeHooklist, findInvalidPluginConfig, formatConfig, getPackageJsonOrganization, isDuplicate, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookField, mergeConfig, replacePathTokens, resolveLogLevel, withCustomLogger, withLogFn } from "@powerlines/core/plugin-utils";
5
5
  import { colorText, createLogger as createLogger$1, extendLogger } from "@powerlines/core/plugin-utils/logging";
6
6
  import { formatLogMessage } from "@storm-software/config-tools/logger/console";
7
7
  import { toArray } from "@stryke/convert/to-array";
@@ -44,7 +44,6 @@ import { murmurhash } from "@stryke/hash";
44
44
  import { hashDirectory } from "@stryke/hash/node";
45
45
  import { fetchRequest } from "@stryke/http/fetch";
46
46
  import { isEqual } from "@stryke/path/is-equal";
47
- import { isRegExp } from "@stryke/type-checks/is-regexp";
48
47
  import { isUndefined } from "@stryke/type-checks/is-undefined";
49
48
  import { match, tsconfigPathsToRegExp } from "bundle-require";
50
49
  import { resolveCompatibilityDates } from "compatx";
@@ -62,6 +61,7 @@ import { globToRegex } from "@stryke/path/glob-to-regex";
62
61
  import { isAbsolutePath } from "@stryke/path/is-type";
63
62
  import { slash } from "@stryke/path/slash";
64
63
  import { prettyBytes } from "@stryke/string-format/pretty-bytes";
64
+ import { isRegExp } from "@stryke/type-checks/is-regexp";
65
65
  import { Blob as Blob$1 } from "node:buffer";
66
66
  import { fileURLToPath } from "node:url";
67
67
  import { isDirectory, isFile } from "@stryke/fs/is-file";
@@ -3101,7 +3101,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
3101
3101
  async setInlineConfig(config) {
3102
3102
  this.logger.debug({
3103
3103
  meta: { category: "config" },
3104
- message: `Updating inline configuration object: \n${this.logConfig(config)}`
3104
+ message: `Updating inline configuration object: \n${formatConfig(config)}`
3105
3105
  });
3106
3106
  this.inlineConfig = config;
3107
3107
  await this.resolveConfig();
@@ -3115,7 +3115,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
3115
3115
  async setPluginConfig(config) {
3116
3116
  this.logger.debug({
3117
3117
  meta: { category: "config" },
3118
- message: `Updating plugin configuration object: \n${this.logConfig(config)}`
3118
+ message: `Updating plugin configuration object: \n${formatConfig(config)}`
3119
3119
  });
3120
3120
  this.pluginConfig = config;
3121
3121
  await this.resolveConfig();
@@ -3157,7 +3157,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
3157
3157
  async setUserConfig(config) {
3158
3158
  this.logger.debug({
3159
3159
  meta: { category: "config" },
3160
- message: `Updating user configuration object: \n${this.logConfig(config)}`
3160
+ message: `Updating user configuration object: \n${formatConfig(config)}`
3161
3161
  });
3162
3162
  this.userConfig = config;
3163
3163
  await this.resolveConfig();
@@ -3194,7 +3194,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
3194
3194
  const mergedConfig = this.mergeConfig();
3195
3195
  this.logger.trace({
3196
3196
  meta: { category: "config" },
3197
- message: `Pre-setup Powerlines configuration object: \n --- Merged Config --- \n${this.logConfig(mergedConfig)} \n\n --- Initial Options --- \n${this.logConfig(this.initialOptions)} \n\n --- Initial Config --- \n${this.logConfig(this.initialConfig)} \n\n --- User Config --- \n${this.logConfig(this.userConfig)} \n\n --- Inline Config --- \n${this.logConfig(this.inlineConfig)} \n\n --- Plugin Config --- \n${this.logConfig(this.pluginConfig)} \n\n --- Environment Config --- \n${this.logConfig(this.environmentConfig)} \n\n --- Overridden Config --- \n${this.logConfig(this.overriddenConfig)}`
3197
+ message: `Pre-setup Powerlines configuration object: \n --- Merged Config --- \n${formatConfig(mergedConfig)} \n\n --- Initial Options --- \n${formatConfig(this.initialOptions)} \n\n --- Initial Config --- \n${formatConfig(this.initialConfig)} \n\n --- User Config --- \n${formatConfig(this.userConfig)} \n\n --- Inline Config --- \n${formatConfig(this.inlineConfig)} \n\n --- Plugin Config --- \n${formatConfig(this.pluginConfig)} \n\n --- Environment Config --- \n${formatConfig(this.environmentConfig)} \n\n --- Overridden Config --- \n${formatConfig(this.overriddenConfig)}`
3198
3198
  });
3199
3199
  mergedConfig.output = defu(mergedConfig.output ?? {}, {
3200
3200
  copy: { assets: [
@@ -3269,28 +3269,10 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
3269
3269
  this.#configProxy = this.createConfigProxy();
3270
3270
  this.logger.info({
3271
3271
  meta: { category: "config" },
3272
- message: `Resolved Powerlines configuration object: \n${this.logConfig(this.resolvedConfig)}`
3272
+ message: `Resolved Powerlines configuration object: \n${formatConfig(this.resolvedConfig)}`
3273
3273
  });
3274
3274
  this.#fs ??= await VirtualFileSystem.create(this);
3275
3275
  }
3276
- logConfig(config) {
3277
- return JSON.stringify(Object.fromEntries(Object.entries({
3278
- ...omit(config, [
3279
- "plugins",
3280
- "initialConfig",
3281
- "userConfig",
3282
- "inlineConfig",
3283
- "pluginConfig",
3284
- "environmentConfig"
3285
- ]),
3286
- resolve: {
3287
- ...config.resolve,
3288
- external: (config.resolve?.external ?? []).filter(Boolean).map((external) => isSetString(external) ? external : isRegExp(external) ? external.source : "<unknown-external>"),
3289
- noExternal: (config.resolve?.noExternal ?? []).filter(Boolean).map((noExternal) => isSetString(noExternal) ? noExternal : isRegExp(noExternal) ? noExternal.source : "<unknown-no-external>")
3290
- },
3291
- plugins: config.plugins ? config.plugins.flatMap((plugin) => toArray(plugin)).map((plugin) => String(isSetString(plugin) ? plugin : isSetObject(plugin) && isSetString(plugin.name) ? plugin.name : Array.isArray(plugin) && isSetString(plugin[0]) ? plugin[0] : "<function-plugin>")) : []
3292
- }).sort(([key1], [key2]) => key1.localeCompare(key2))), null, 4).replace(/"([^"]+)":/g, "$1:").replace(/,$/g, "");
3293
- }
3294
3276
  createConfigProxy() {
3295
3277
  return new Proxy(this.resolvedConfig, {
3296
3278
  /**
@@ -3648,7 +3630,7 @@ var PowerlinesEnvironmentContext = class PowerlinesEnvironmentContext extends Po
3648
3630
  async setEnvironmentConfig(config) {
3649
3631
  this.logger.debug({
3650
3632
  meta: { category: "config" },
3651
- message: `Updating environment configuration object: \n${this.logConfig(config)}`
3633
+ message: `Updating environment configuration object: \n${formatConfig(config)}`
3652
3634
  });
3653
3635
  this.environmentConfig = config;
3654
3636
  await this.resolveConfig();
@@ -4624,20 +4606,7 @@ var PowerlinesExecution = class PowerlinesExecution {
4624
4606
  });
4625
4607
  context.trace({
4626
4608
  meta: { category: "config" },
4627
- message: `Powerlines configuration after configResolved hook: \n${formatLogMessage({
4628
- ...omit(context.config, [
4629
- "inlineConfig",
4630
- "userConfig",
4631
- "initialConfig",
4632
- "pluginConfig",
4633
- "plugins"
4634
- ]),
4635
- plugins: context.plugins.map((plugin) => plugin.plugin.name),
4636
- inlineConfig: isSetObject(context.config.inlineConfig) ? omit(context.config.inlineConfig, ["plugins"]) : void 0,
4637
- userConfig: isSetObject(context.config.userConfig) ? omit(context.config.userConfig, ["plugins"]) : void 0,
4638
- initialConfig: isSetObject(context.config.initialConfig) ? omit(context.config.initialConfig, ["plugins"]) : void 0,
4639
- pluginConfig: isSetObject(context.config.pluginConfig) ? omit(context.config.pluginConfig, ["plugins"]) : void 0
4640
- })}`
4609
+ message: `Powerlines configuration after configResolved hook: \n${formatConfig(context.config)}`
4641
4610
  });
4642
4611
  if (!context.fs.existsSync(context.cachePath)) await createDirectory(context.cachePath);
4643
4612
  if (!context.fs.existsSync(context.dataPath)) await createDirectory(context.dataPath);