@powerlines/engine 0.46.3 → 0.46.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/_internal/worker.cjs +71 -44
  2. package/dist/_internal/worker.mjs +73 -46
  3. package/dist/_internal/worker.mjs.map +1 -1
  4. package/dist/api.cjs +5 -1
  5. package/dist/api.d.cts +1 -1
  6. package/dist/api.d.cts.map +1 -1
  7. package/dist/api.d.mts +1 -1
  8. package/dist/api.d.mts.map +1 -1
  9. package/dist/api.mjs +5 -1
  10. package/dist/api.mjs.map +1 -1
  11. package/dist/{base-context-D7G_24-i.cjs → base-context-CbFlRUd-.cjs} +8 -6
  12. package/dist/{base-context-DU0NRHDt.mjs → base-context-Ce9PuQ9z.mjs} +9 -7
  13. package/dist/{base-context-DU0NRHDt.mjs.map → base-context-Ce9PuQ9z.mjs.map} +1 -1
  14. package/dist/context/index.cjs +3 -3
  15. package/dist/context/index.d.cts +3 -3
  16. package/dist/context/index.d.cts.map +1 -1
  17. package/dist/context/index.d.mts +3 -3
  18. package/dist/context/index.d.mts.map +1 -1
  19. package/dist/context/index.mjs +3 -3
  20. package/dist/{engine-context-BvDfqfY7.mjs → engine-context-CEbC9dHR.mjs} +2 -2
  21. package/dist/{engine-context-BvDfqfY7.mjs.map → engine-context-CEbC9dHR.mjs.map} +1 -1
  22. package/dist/{engine-context-BuJQY312.cjs → engine-context-D-rpz-J2.cjs} +1 -1
  23. package/dist/{execution-context-BpRfsnkE.d.mts → execution-context-CghMd-eP.d.cts} +9 -5
  24. package/dist/execution-context-CghMd-eP.d.cts.map +1 -0
  25. package/dist/{execution-context-Cu_xPYxI.mjs → execution-context-D-djno_x.mjs} +66 -46
  26. package/dist/execution-context-D-djno_x.mjs.map +1 -0
  27. package/dist/{execution-context-xj0KA802.cjs → execution-context-Lj_23Ps4.cjs} +60 -40
  28. package/dist/{execution-context-CodQucFX.d.cts → execution-context-rKd-zSZy.d.mts} +9 -5
  29. package/dist/execution-context-rKd-zSZy.d.mts.map +1 -0
  30. package/dist/index.cjs +1 -1
  31. package/dist/index.mjs +1 -1
  32. package/dist/storage/index.d.mts +1 -1
  33. package/dist/typescript/index.d.mts +1 -1
  34. package/package.json +3 -3
  35. package/dist/execution-context-BpRfsnkE.d.mts.map +0 -1
  36. package/dist/execution-context-CodQucFX.d.cts.map +0 -1
  37. package/dist/execution-context-Cu_xPYxI.mjs.map +0 -1
@@ -75,14 +75,16 @@ 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
+ let _stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
78
80
  let bundle_require = require("bundle-require");
79
81
  let compatx = require("compatx");
80
82
  let flat_cache = require("flat-cache");
83
+ let node_fs = require("node:fs");
81
84
  let oxc_parser = require("oxc-parser");
82
85
  let undici = require("undici");
83
86
  require("@stryke/fs/remove-file");
84
87
  let _stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
85
- let _powerlines_core = require("@powerlines/core");
86
88
  let jest_worker = require("jest-worker");
87
89
  let _stryke_capnp = require("@stryke/capnp");
88
90
  _stryke_capnp = __toESM(_stryke_capnp, 1);
@@ -92,13 +94,11 @@ let _stryke_path_glob_to_regex = require("@stryke/path/glob-to-regex");
92
94
  let _stryke_path_is_type = require("@stryke/path/is-type");
93
95
  let _stryke_path_slash = require("@stryke/path/slash");
94
96
  let _stryke_string_format_pretty_bytes = require("@stryke/string-format/pretty-bytes");
95
- let _stryke_type_checks_is_regexp = require("@stryke/type-checks/is-regexp");
96
97
  let node_buffer = require("node:buffer");
97
98
  let node_url = require("node:url");
98
99
  let _stryke_fs_is_file = require("@stryke/fs/is-file");
99
100
  let _stryke_fs_read_file = require("@stryke/fs/read-file");
100
101
  let _stryke_fs_write_file = require("@stryke/fs/write-file");
101
- let node_fs = require("node:fs");
102
102
  let node_fs_promises = require("node:fs/promises");
103
103
  let node_path = require("node:path");
104
104
  let typescript = require("typescript");
@@ -217,7 +217,7 @@ function formatWriteLogMessage(context, meta, message) {
217
217
  payload: {
218
218
  meta: {
219
219
  type: combinedMeta.type,
220
- category: combinedMeta.category || _powerlines_core.LogCategories.GENERAL,
220
+ category: combinedMeta.category || _powerlines_core_constants.LogCategories.GENERAL,
221
221
  logId: combinedMeta.logId || (0, _stryke_unique_id_uuid.uuid)(),
222
222
  timestamp: combinedMeta.timestamp ?? Date.now(),
223
223
  name: combinedMeta.name || context.config.name,
@@ -2436,12 +2436,14 @@ var PowerlinesBaseContext = class {
2436
2436
  * @returns A promise that resolves when the package configurations have been loaded and stored in the context.
2437
2437
  */
2438
2438
  async resolvePackageConfigs(cwd = this.options.cwd, root = this.options.root) {
2439
- const projectJsonPath = (0, _stryke_path.joinPaths)((0, _stryke_path_append.appendPath)(root, cwd), "project.json");
2440
- if ((0, node_fs.existsSync)(projectJsonPath)) this.projectJson = await (0, _stryke_fs.readJsonFile)(projectJsonPath);
2441
- const packageJsonPath = (0, _stryke_path.joinPaths)((0, _stryke_path_append.appendPath)(root, cwd), "package.json");
2442
- if ((0, node_fs.existsSync)(packageJsonPath)) {
2443
- this.packageJson = await (0, _stryke_fs.readJsonFile)(packageJsonPath);
2444
- this.options.organization ??= (0, _stryke_type_checks_is_set_object.isSetObject)(this.packageJson?.author) ? (0, _stryke_string_format_kebab_case.kebabCase)(this.packageJson?.author?.name) : (0, _stryke_string_format_kebab_case.kebabCase)(this.packageJson?.author);
2439
+ if (cwd || root) {
2440
+ const projectJsonPath = (0, _stryke_path.joinPaths)((0, _stryke_path_append.appendPath)(root || ".", cwd || "."), "project.json");
2441
+ if ((0, node_fs.existsSync)(projectJsonPath)) this.projectJson = await (0, _stryke_fs.readJsonFile)(projectJsonPath);
2442
+ const packageJsonPath = (0, _stryke_path.joinPaths)((0, _stryke_path_append.appendPath)(root || ".", cwd || "."), "package.json");
2443
+ if ((0, node_fs.existsSync)(packageJsonPath)) {
2444
+ this.packageJson = await (0, _stryke_fs.readJsonFile)(packageJsonPath);
2445
+ this.options.organization ??= (0, _stryke_type_checks_is_set_object.isSetObject)(this.packageJson?.author) ? (0, _stryke_string_format_kebab_case.kebabCase)(this.packageJson?.author?.name) : (0, _stryke_string_format_kebab_case.kebabCase)(this.packageJson?.author);
2446
+ }
2445
2447
  }
2446
2448
  }
2447
2449
  /**
@@ -2477,7 +2479,8 @@ const UNRESOLVED_CONFIG_NAMES = [
2477
2479
  "initialConfig",
2478
2480
  "userConfig",
2479
2481
  "inlineConfig",
2480
- "pluginConfig"
2482
+ "pluginConfig",
2483
+ "environmentConfig"
2481
2484
  ];
2482
2485
  var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
2483
2486
  #checksum = null;
@@ -2544,6 +2547,10 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
2544
2547
  */
2545
2548
  pluginConfig = {};
2546
2549
  /**
2550
+ * The configuration options provided by the environment
2551
+ */
2552
+ environmentConfig = {};
2553
+ /**
2547
2554
  * The resolved entry type definitions for the project
2548
2555
  */
2549
2556
  get entry() {
@@ -3125,7 +3132,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
3125
3132
  * @returns A promise that resolves when the inline configuration values have been set.
3126
3133
  */
3127
3134
  async setInlineConfig(config) {
3128
- this.logger.trace({
3135
+ this.logger.debug({
3129
3136
  meta: { category: "config" },
3130
3137
  message: `Updating inline configuration object: \n${this.logConfig(config)}`
3131
3138
  });
@@ -3139,7 +3146,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
3139
3146
  * @returns A promise that resolves when the plugin configuration values have been set.
3140
3147
  */
3141
3148
  async setPluginConfig(config) {
3142
- this.logger.trace({
3149
+ this.logger.debug({
3143
3150
  meta: { category: "config" },
3144
3151
  message: `Updating plugin configuration object: \n${this.logConfig(config)}`
3145
3152
  });
@@ -3155,21 +3162,21 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
3155
3162
  return (0, _powerlines_core_plugin_utils.mergeConfig)({
3156
3163
  mode: this.initialOptions.mode,
3157
3164
  framework: this.initialOptions.framework,
3158
- initialOptions: this.initialOptions,
3159
3165
  logLevel: this.initialOptions.logLevel,
3160
- options: this.options,
3161
3166
  inlineConfig: this.inlineConfig,
3162
3167
  userConfig: this.userConfig,
3163
3168
  initialConfig: this.initialConfig,
3164
- pluginConfig: this.pluginConfig
3169
+ pluginConfig: this.pluginConfig,
3170
+ environmentConfig: this.environmentConfig
3165
3171
  }, getConfigProps(this.overriddenConfig), (0, _stryke_helpers_omit.omit)(this.options, [
3172
+ "name",
3166
3173
  "mode",
3167
3174
  "framework",
3168
3175
  "logLevel"
3169
3176
  ]), getConfigProps(this.inlineConfig), getConfigProps(this.userConfig), getConfigProps(this.initialConfig), getConfigProps(this.pluginConfig), {
3177
+ name: this.initialOptions.name,
3170
3178
  version: this.packageJson?.version,
3171
- description: this.packageJson?.description
3172
- }, {
3179
+ description: this.packageJson?.description,
3173
3180
  environments: {},
3174
3181
  resolve: {}
3175
3182
  });
@@ -3181,7 +3188,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
3181
3188
  * @returns A promise that resolves when the user configuration values have been set.
3182
3189
  */
3183
3190
  async setUserConfig(config) {
3184
- this.logger.trace({
3191
+ this.logger.debug({
3185
3192
  meta: { category: "config" },
3186
3193
  message: `Updating user configuration object: \n${this.logConfig(config)}`
3187
3194
  });
@@ -3220,7 +3227,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
3220
3227
  const mergedConfig = this.mergeConfig();
3221
3228
  this.logger.trace({
3222
3229
  meta: { category: "config" },
3223
- message: `Pre-setup Powerlines configuration object: \n --- Pre-Resolved Config --- \n${this.logConfig(mergedConfig)} \n --- Initial Config --- \n${this.logConfig(this.initialConfig)} \n --- User Config --- \n${this.logConfig(this.userConfig)} \n --- Inline Config --- \n${this.logConfig(this.inlineConfig)} \n --- Plugin Config --- \n${this.logConfig(this.pluginConfig)}`
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)}`
3224
3231
  });
3225
3232
  mergedConfig.output = (0, defu.default)(mergedConfig.output ?? {}, {
3226
3233
  copy: { assets: [
@@ -3236,14 +3243,17 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
3236
3243
  ] },
3237
3244
  dts: true
3238
3245
  });
3239
- if (!mergedConfig.mode) mergedConfig.mode = "production";
3240
- if (!mergedConfig.framework) mergedConfig.framework = "powerlines";
3241
- if (!mergedConfig.projectType) mergedConfig.projectType = "application";
3242
- if (!mergedConfig.platform) mergedConfig.platform = "neutral";
3246
+ if ((0, _stryke_type_checks_is_undefined.isUndefined)(mergedConfig.mode)) mergedConfig.mode = await this.getDefaultMode();
3247
+ if ((0, _stryke_type_checks_is_undefined.isUndefined)(mergedConfig.framework)) mergedConfig.framework = "powerlines";
3248
+ if ((0, _stryke_type_checks_is_undefined.isUndefined)(mergedConfig.platform)) mergedConfig.platform = "neutral";
3243
3249
  mergedConfig.compatibilityDate = (0, compatx.resolveCompatibilityDates)(mergedConfig.compatibilityDate, "latest");
3250
+ if (!this.packageJson && (0, node_fs.existsSync)((0, _stryke_path_join.joinPaths)((0, _stryke_path_append.appendPath)(mergedConfig.root, mergedConfig.cwd), "package.json")) || !this.projectJson && (0, node_fs.existsSync)((0, _stryke_path_join.joinPaths)((0, _stryke_path_append.appendPath)(mergedConfig.root, mergedConfig.cwd), "project.json"))) {
3251
+ await this.resolvePackageConfigs(mergedConfig.cwd, mergedConfig.root);
3252
+ if (this.packageJson) mergedConfig.organization ??= (0, _powerlines_core_plugin_utils.getPackageJsonOrganization)(this.packageJson) || "powerlines";
3253
+ }
3254
+ if ((0, _stryke_type_checks_is_undefined.isUndefined)(mergedConfig.projectType)) mergedConfig.projectType = this.projectJson?.projectType || "application";
3244
3255
  this.resolvedConfig = mergedConfig;
3245
3256
  this.#configProxy = this.createConfigProxy();
3246
- if (!this.packageJson) await this.resolvePackageConfigs();
3247
3257
  mergedConfig.input = (0, _powerlines_core_lib_entry.getUniqueInputs)(mergedConfig.input);
3248
3258
  if (mergedConfig.name?.startsWith("@") && mergedConfig.name.split("/").filter(Boolean).length > 1) mergedConfig.name = mergedConfig.name.split("/").filter(Boolean)[1];
3249
3259
  mergedConfig.title ??= (0, _stryke_string_format_title_case.titleCase)(mergedConfig.name);
@@ -3254,18 +3264,18 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
3254
3264
  ret.push(plugin);
3255
3265
  return ret;
3256
3266
  }, []);
3257
- if (!mergedConfig.logLevel) if (mergedConfig.mode === "development") mergedConfig.logLevel = _powerlines_core_constants.DEFAULT_DEVELOPMENT_LOG_LEVEL;
3267
+ if ((0, _stryke_type_checks_is_undefined.isUndefined)(mergedConfig.logLevel)) if (mergedConfig.mode === "development") mergedConfig.logLevel = _powerlines_core_constants.DEFAULT_DEVELOPMENT_LOG_LEVEL;
3258
3268
  else if (mergedConfig.mode === "test") mergedConfig.logLevel = _powerlines_core_constants.DEFAULT_TEST_LOG_LEVEL;
3259
3269
  else mergedConfig.logLevel = _powerlines_core_constants.DEFAULT_PRODUCTION_LOG_LEVEL;
3260
3270
  mergedConfig.logLevel = (0, _powerlines_core_plugin_utils.resolveLogLevel)(mergedConfig.logLevel);
3261
- if (mergedConfig.tsconfig) mergedConfig.tsconfig = (0, _stryke_path_replace.replacePath)((0, _powerlines_core_plugin_utils.replacePathTokens)(this, mergedConfig.tsconfig), mergedConfig.cwd);
3271
+ if ((0, _stryke_type_checks_is_set_string.isSetString)(mergedConfig.tsconfig)) mergedConfig.tsconfig = (0, _stryke_path_replace.replacePath)((0, _powerlines_core_plugin_utils.replacePathTokens)(this, mergedConfig.tsconfig), mergedConfig.cwd);
3262
3272
  else mergedConfig.tsconfig = getTsconfigFilePath(mergedConfig.cwd, mergedConfig.root);
3263
3273
  mergedConfig.output.format = (0, _stryke_helpers_get_unique.getUnique)((0, _stryke_convert_to_array.toArray)(mergedConfig.output?.format ?? (mergedConfig.projectType === "library" ? ["cjs", "esm"] : ["esm"])));
3264
- if (mergedConfig.output.path) mergedConfig.output.path = (0, _stryke_path_append.appendPath)((0, _powerlines_core_plugin_utils.replacePathTokens)(this, mergedConfig.output.path), mergedConfig.cwd);
3274
+ if ((0, _stryke_type_checks_is_set_string.isSetString)(mergedConfig.output.path)) mergedConfig.output.path = (0, _stryke_path_append.appendPath)((0, _powerlines_core_plugin_utils.replacePathTokens)(this, mergedConfig.output.path), mergedConfig.cwd);
3265
3275
  else mergedConfig.output.path = (0, _stryke_path_append.appendPath)((0, _stryke_path_join.joinPaths)(mergedConfig.root, "dist"), mergedConfig.cwd);
3266
3276
  mergedConfig.output.copy ??= {};
3267
- if (mergedConfig.output.copy !== false) if (!mergedConfig.root.replace(/^\.\/?/, "")) mergedConfig.output.copy.path = mergedConfig.output.copy.path ? (0, _stryke_path_append.appendPath)((0, _powerlines_core_plugin_utils.replacePathTokens)(this, mergedConfig.output.copy.path), mergedConfig.cwd) : mergedConfig.output.path;
3268
- else mergedConfig.output.copy.path = (0, _stryke_path_append.appendPath)((0, _powerlines_core_plugin_utils.replacePathTokens)(this, mergedConfig.output.copy.path || (0, _stryke_path_join.joinPaths)("dist", mergedConfig.root)), mergedConfig.cwd);
3277
+ if (mergedConfig.output.copy !== false) if (!mergedConfig.root.replace(/^\.\/?/, "")) mergedConfig.output.copy.path = (0, _stryke_type_checks_is_set_string.isSetString)(mergedConfig.output.copy.path) ? (0, _stryke_path_append.appendPath)((0, _powerlines_core_plugin_utils.replacePathTokens)(this, mergedConfig.output.copy.path), mergedConfig.cwd) : mergedConfig.output.path;
3278
+ else mergedConfig.output.copy.path = (0, _stryke_path_append.appendPath)((0, _powerlines_core_plugin_utils.replacePathTokens)(this, (0, _stryke_type_checks_is_set_string.isSetString)(mergedConfig.output.copy.path) ? mergedConfig.output.copy.path : (0, _stryke_path_join.joinPaths)("dist", mergedConfig.root)), mergedConfig.cwd);
3269
3279
  if (mergedConfig.output.types !== false) mergedConfig.output.types = (0, _stryke_path_append.appendPath)((0, _powerlines_core_plugin_utils.replacePathTokens)(this, mergedConfig.output.types || (0, _stryke_path_join.joinPaths)(mergedConfig.root, `${mergedConfig.framework ?? "powerlines"}.d.ts`)), mergedConfig.cwd);
3270
3280
  if (mergedConfig.output.copy && mergedConfig.output.copy.path && mergedConfig.output.copy.assets && Array.isArray(mergedConfig.output.copy.assets)) mergedConfig.output.copy.assets = (0, _stryke_helpers_get_unique.getUniqueBy)(mergedConfig.output.copy.assets.map((asset) => {
3271
3281
  return {
@@ -3275,11 +3285,11 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
3275
3285
  ignore: (0, _stryke_type_checks_is_set_object.isSetObject)(asset) && asset.ignore ? (0, _stryke_convert_to_array.toArray)(asset.ignore) : void 0
3276
3286
  };
3277
3287
  }), (a) => `${a.input}-${a.glob}-${a.output}`);
3278
- if (!mergedConfig.output?.sourceMap) if (mergedConfig.mode === "development") mergedConfig.output.sourceMap = true;
3288
+ if ((0, _stryke_type_checks_is_undefined.isUndefined)(mergedConfig.output?.sourceMap)) if (mergedConfig.mode === "development") mergedConfig.output.sourceMap = true;
3279
3289
  else mergedConfig.output.sourceMap = false;
3280
- if (!mergedConfig.output.minify) if (mergedConfig.mode === "production") mergedConfig.output.minify = true;
3290
+ if ((0, _stryke_type_checks_is_undefined.isUndefined)(mergedConfig.output?.minify)) if (mergedConfig.mode === "production") mergedConfig.output.minify = true;
3281
3291
  else mergedConfig.output.minify = false;
3282
- if (!mergedConfig.output.artifactsPath) mergedConfig.output.artifactsPath = `.${mergedConfig.framework || "powerlines"}`;
3292
+ if ((0, _stryke_type_checks_is_undefined.isUndefined)(mergedConfig.output?.artifactsPath)) mergedConfig.output.artifactsPath = `.${mergedConfig.framework || "powerlines"}`;
3283
3293
  if (mergedConfig.output.copy && mergedConfig.output.copy.assets) mergedConfig.output.copy.assets = mergedConfig.output.copy.assets.map((asset) => ({
3284
3294
  ...asset,
3285
3295
  glob: (0, _powerlines_core_plugin_utils.replacePathTokens)(this, asset.glob),
@@ -3290,17 +3300,29 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
3290
3300
  if ((0, _stryke_type_checks_is_set_string.isSetString)(mergedConfig.output?.storage) && mergedConfig.output.storage === "virtual" || (0, _stryke_type_checks_is_set_object.isSetObject)(mergedConfig.output?.storage) && Object.values(mergedConfig.output.storage).every((adapter) => adapter.preset === "virtual")) mergedConfig.output.overwrite = true;
3291
3301
  this.resolvedConfig = mergedConfig;
3292
3302
  this.#configProxy = this.createConfigProxy();
3293
- this.logger.debug({
3303
+ this.logger.info({
3294
3304
  meta: { category: "config" },
3295
- message: `Resolved Powerlines configuration object: \n --- Resolved Config --- \n${this.logConfig(this.resolvedConfig)} \n --- Initial Config --- \n${this.logConfig(this.initialConfig)} \n --- User Config --- \n${this.logConfig(this.userConfig)} \n --- Inline Config --- \n${this.logConfig(this.inlineConfig)} \n --- Plugin Config --- \n${this.logConfig(this.pluginConfig)}`
3305
+ message: `Resolved Powerlines configuration object: \n${this.logConfig(this.resolvedConfig)}`
3296
3306
  });
3297
3307
  this.#fs ??= await VirtualFileSystem.create(this);
3298
3308
  }
3299
3309
  logConfig(config) {
3300
- return (0, _storm_software_config_tools_logger_console.formatLogMessage)({
3301
- ...(0, _stryke_helpers_omit.omit)(config, ["plugins"]),
3302
- 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_promise.isPromise)(plugin) ? "<promise>" : (0, _stryke_type_checks_is_function.isFunction)(plugin) ? plugin.name || "<anonymous function>" : Array.isArray(plugin) ? plugin[0] || "<anonymous function plugin>" : "<unknown plugin>")) : void 0
3303
- });
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, "");
3304
3326
  }
3305
3327
  createConfigProxy() {
3306
3328
  return new Proxy(this.resolvedConfig, {
@@ -3327,6 +3349,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
3327
3349
  if (key === "userConfig") return this.userConfig;
3328
3350
  if (key === "inlineConfig") return this.inlineConfig;
3329
3351
  if (key === "pluginConfig") return this.pluginConfig;
3352
+ if (key === "environmentConfig") return this.environmentConfig;
3330
3353
  }
3331
3354
  return Reflect.get(target, key, receiver);
3332
3355
  },
@@ -3596,14 +3619,14 @@ var PowerlinesEnvironmentContext = class PowerlinesEnvironmentContext extends Po
3596
3619
  /**
3597
3620
  * Create a new context from the config.
3598
3621
  *
3599
- * @param options - The resolved execution options.
3622
+ * @param initialOptions - The resolved execution options.
3600
3623
  * @param config - The user configuration options.
3601
3624
  * @param overriddenConfig - The configuration options that should override all other configuration sources, such as CLI flags or environment variables. This is used to ensure that certain configuration values take precedence over any other settings defined in the user configuration or environment configuration, allowing for dynamic overrides based on the execution context.
3602
3625
  * @param environment - The resolved environment configuration, which may include additional properties or modifications made during the configuration loading process. This is used to provide context about the environment in which the command is being executed, allowing for environment-specific behavior and configuration resolution.
3603
3626
  * @returns A promise that resolves to an instance of the PowerlinesEnvironmentContext class, initialized with the provided configuration and environment data.
3604
3627
  */
3605
- static async createEnvironment(options, config, overriddenConfig, environment) {
3606
- const context = new PowerlinesEnvironmentContext(options, config, overriddenConfig);
3628
+ static async createEnvironment(initialOptions, config, overriddenConfig, environment) {
3629
+ const context = new PowerlinesEnvironmentContext(initialOptions, config, overriddenConfig);
3607
3630
  await context.setEnvironmentConfig(environment);
3608
3631
  return context;
3609
3632
  }
@@ -3656,7 +3679,7 @@ var PowerlinesEnvironmentContext = class PowerlinesEnvironmentContext extends Po
3656
3679
  * @returns A promise that resolves when the environment configuration values have been set.
3657
3680
  */
3658
3681
  async setEnvironmentConfig(config) {
3659
- this.logger.trace({
3682
+ this.logger.debug({
3660
3683
  meta: { category: "config" },
3661
3684
  message: `Updating environment configuration object: \n${this.logConfig(config)}`
3662
3685
  });
@@ -3909,7 +3932,7 @@ var PowerlinesExecutionContext = class PowerlinesExecutionContext extends Powerl
3909
3932
  * @returns A new context instance with the updated environment.
3910
3933
  */
3911
3934
  async createEnvironment(environment) {
3912
- const context = await PowerlinesEnvironmentContext.createEnvironment((0, _stryke_helpers_deep_clone.deepClone)(this.options), (0, _stryke_helpers_deep_clone.deepClone)(this.config), (0, _stryke_helpers_deep_clone.deepClone)(this.overriddenConfig), (0, _stryke_helpers_deep_clone.deepClone)(environment));
3935
+ const context = await PowerlinesEnvironmentContext.createEnvironment((0, _stryke_helpers_deep_clone.deepClone)(this.initialOptions), (0, _stryke_helpers_deep_clone.deepClone)(this.config), (0, _stryke_helpers_deep_clone.deepClone)(this.overriddenConfig), (0, _stryke_helpers_deep_clone.deepClone)(environment));
3913
3936
  context.$$internal = this.$$internal;
3914
3937
  context.dependencies = (0, _stryke_helpers_deep_clone.deepClone)(this.dependencies);
3915
3938
  context.devDependencies = (0, _stryke_helpers_deep_clone.deepClone)(this.devDependencies);
@@ -4891,6 +4914,10 @@ var PowerlinesExecution = class PowerlinesExecution {
4891
4914
  merge: mergeConfigs
4892
4915
  });
4893
4916
  if (pluginConfig) await this.context.setPluginConfig(pluginConfig);
4917
+ else this.context.debug({
4918
+ meta: { category: "config" },
4919
+ message: "No plugin configuration was returned from the config hook."
4920
+ });
4894
4921
  timer();
4895
4922
  }
4896
4923
  /**
@@ -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, isDuplicate, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookField, mergeConfig, replacePathTokens, resolveLogLevel, withCustomLogger, withLogFn } from "@powerlines/core/plugin-utils";
4
+ import { addPluginHook, createLogger, dedupeHooklist, findInvalidPluginConfig, 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";
@@ -24,7 +24,7 @@ import { isError } from "@stryke/type-checks/is-error";
24
24
  import { isFunction } from "@stryke/type-checks/is-function";
25
25
  import { isNumber } from "@stryke/type-checks/is-number";
26
26
  import { isObject } from "@stryke/type-checks/is-object";
27
- import { isPromise, isPromiseLike } from "@stryke/type-checks/is-promise";
27
+ import { isPromiseLike } from "@stryke/type-checks/is-promise";
28
28
  import { isSet } from "@stryke/type-checks/is-set";
29
29
  import { isSetObject } from "@stryke/type-checks/is-set-object";
30
30
  import { isSetString } from "@stryke/type-checks/is-set-string";
@@ -32,7 +32,7 @@ import { isString } from "@stryke/type-checks/is-string";
32
32
  import chalk from "chalk";
33
33
  import defu, { defu as defu$1 } from "defu";
34
34
  import Handlebars from "handlebars";
35
- import { CACHE_HASH_LENGTH, DEFAULT_DEVELOPMENT_LOG_LEVEL, DEFAULT_ENVIRONMENT, DEFAULT_PRODUCTION_LOG_LEVEL, DEFAULT_TEST_LOG_LEVEL, GLOBAL_ENVIRONMENT, PLUGIN_NON_HOOK_FIELDS, ROOT_HASH_LENGTH } from "@powerlines/core/constants";
35
+ import { CACHE_HASH_LENGTH, DEFAULT_DEVELOPMENT_LOG_LEVEL, DEFAULT_ENVIRONMENT, DEFAULT_PRODUCTION_LOG_LEVEL, DEFAULT_TEST_LOG_LEVEL, GLOBAL_ENVIRONMENT, LogCategories, PLUGIN_NON_HOOK_FIELDS, ROOT_HASH_LENGTH } from "@powerlines/core/constants";
36
36
  import { readJsonFile, readJsonFileSync } from "@stryke/fs/json";
37
37
  import { deepClone } from "@stryke/helpers/deep-clone";
38
38
  import { joinPaths as joinPaths$1 } from "@stryke/path/join";
@@ -44,14 +44,16 @@ 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
+ import { isUndefined } from "@stryke/type-checks/is-undefined";
47
49
  import { match, tsconfigPathsToRegExp } from "bundle-require";
48
50
  import { resolveCompatibilityDates } from "compatx";
49
51
  import { create } from "flat-cache";
52
+ import { existsSync as existsSync$1, unlinkSync } from "node:fs";
50
53
  import { parse } from "oxc-parser";
51
54
  import { Agent, Response, interceptors, setGlobalDispatcher } from "undici";
52
55
  import "@stryke/fs/remove-file";
53
56
  import { kebabCase } from "@stryke/string-format/kebab-case";
54
- import { LogCategories } from "@powerlines/core";
55
57
  import { messageParent } from "jest-worker";
56
58
  import * as $ from "@stryke/capnp";
57
59
  import { readFileBuffer, readFileBufferSync, writeFileBuffer } from "@stryke/fs/buffer";
@@ -60,13 +62,11 @@ import { globToRegex } from "@stryke/path/glob-to-regex";
60
62
  import { isAbsolutePath } from "@stryke/path/is-type";
61
63
  import { slash } from "@stryke/path/slash";
62
64
  import { prettyBytes } from "@stryke/string-format/pretty-bytes";
63
- import { isRegExp } from "@stryke/type-checks/is-regexp";
64
65
  import { Blob as Blob$1 } from "node:buffer";
65
66
  import { fileURLToPath } from "node:url";
66
67
  import { isDirectory, isFile } from "@stryke/fs/is-file";
67
68
  import { readFile, readFileSync } from "@stryke/fs/read-file";
68
69
  import { writeFile, writeFileSync } from "@stryke/fs/write-file";
69
- import { existsSync as existsSync$1, unlinkSync } from "node:fs";
70
70
  import { unlink } from "node:fs/promises";
71
71
  import { resolve as resolve$1 } from "node:path";
72
72
  import ts from "typescript";
@@ -2403,12 +2403,14 @@ var PowerlinesBaseContext = class {
2403
2403
  * @returns A promise that resolves when the package configurations have been loaded and stored in the context.
2404
2404
  */
2405
2405
  async resolvePackageConfigs(cwd = this.options.cwd, root = this.options.root) {
2406
- const projectJsonPath = joinPaths$2(appendPath(root, cwd), "project.json");
2407
- if (existsSync$1(projectJsonPath)) this.projectJson = await readJsonFile$1(projectJsonPath);
2408
- const packageJsonPath = joinPaths$2(appendPath(root, cwd), "package.json");
2409
- if (existsSync$1(packageJsonPath)) {
2410
- this.packageJson = await readJsonFile$1(packageJsonPath);
2411
- this.options.organization ??= isSetObject(this.packageJson?.author) ? kebabCase(this.packageJson?.author?.name) : kebabCase(this.packageJson?.author);
2406
+ if (cwd || root) {
2407
+ const projectJsonPath = joinPaths$2(appendPath(root || ".", cwd || "."), "project.json");
2408
+ if (existsSync$1(projectJsonPath)) this.projectJson = await readJsonFile$1(projectJsonPath);
2409
+ const packageJsonPath = joinPaths$2(appendPath(root || ".", cwd || "."), "package.json");
2410
+ if (existsSync$1(packageJsonPath)) {
2411
+ this.packageJson = await readJsonFile$1(packageJsonPath);
2412
+ this.options.organization ??= isSetObject(this.packageJson?.author) ? kebabCase(this.packageJson?.author?.name) : kebabCase(this.packageJson?.author);
2413
+ }
2412
2414
  }
2413
2415
  }
2414
2416
  /**
@@ -2444,7 +2446,8 @@ const UNRESOLVED_CONFIG_NAMES = [
2444
2446
  "initialConfig",
2445
2447
  "userConfig",
2446
2448
  "inlineConfig",
2447
- "pluginConfig"
2449
+ "pluginConfig",
2450
+ "environmentConfig"
2448
2451
  ];
2449
2452
  var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
2450
2453
  #checksum = null;
@@ -2511,6 +2514,10 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
2511
2514
  */
2512
2515
  pluginConfig = {};
2513
2516
  /**
2517
+ * The configuration options provided by the environment
2518
+ */
2519
+ environmentConfig = {};
2520
+ /**
2514
2521
  * The resolved entry type definitions for the project
2515
2522
  */
2516
2523
  get entry() {
@@ -3092,7 +3099,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
3092
3099
  * @returns A promise that resolves when the inline configuration values have been set.
3093
3100
  */
3094
3101
  async setInlineConfig(config) {
3095
- this.logger.trace({
3102
+ this.logger.debug({
3096
3103
  meta: { category: "config" },
3097
3104
  message: `Updating inline configuration object: \n${this.logConfig(config)}`
3098
3105
  });
@@ -3106,7 +3113,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
3106
3113
  * @returns A promise that resolves when the plugin configuration values have been set.
3107
3114
  */
3108
3115
  async setPluginConfig(config) {
3109
- this.logger.trace({
3116
+ this.logger.debug({
3110
3117
  meta: { category: "config" },
3111
3118
  message: `Updating plugin configuration object: \n${this.logConfig(config)}`
3112
3119
  });
@@ -3122,21 +3129,21 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
3122
3129
  return mergeConfig({
3123
3130
  mode: this.initialOptions.mode,
3124
3131
  framework: this.initialOptions.framework,
3125
- initialOptions: this.initialOptions,
3126
3132
  logLevel: this.initialOptions.logLevel,
3127
- options: this.options,
3128
3133
  inlineConfig: this.inlineConfig,
3129
3134
  userConfig: this.userConfig,
3130
3135
  initialConfig: this.initialConfig,
3131
- pluginConfig: this.pluginConfig
3136
+ pluginConfig: this.pluginConfig,
3137
+ environmentConfig: this.environmentConfig
3132
3138
  }, getConfigProps(this.overriddenConfig), omit(this.options, [
3139
+ "name",
3133
3140
  "mode",
3134
3141
  "framework",
3135
3142
  "logLevel"
3136
3143
  ]), getConfigProps(this.inlineConfig), getConfigProps(this.userConfig), getConfigProps(this.initialConfig), getConfigProps(this.pluginConfig), {
3144
+ name: this.initialOptions.name,
3137
3145
  version: this.packageJson?.version,
3138
- description: this.packageJson?.description
3139
- }, {
3146
+ description: this.packageJson?.description,
3140
3147
  environments: {},
3141
3148
  resolve: {}
3142
3149
  });
@@ -3148,7 +3155,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
3148
3155
  * @returns A promise that resolves when the user configuration values have been set.
3149
3156
  */
3150
3157
  async setUserConfig(config) {
3151
- this.logger.trace({
3158
+ this.logger.debug({
3152
3159
  meta: { category: "config" },
3153
3160
  message: `Updating user configuration object: \n${this.logConfig(config)}`
3154
3161
  });
@@ -3187,7 +3194,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
3187
3194
  const mergedConfig = this.mergeConfig();
3188
3195
  this.logger.trace({
3189
3196
  meta: { category: "config" },
3190
- message: `Pre-setup Powerlines configuration object: \n --- Pre-Resolved Config --- \n${this.logConfig(mergedConfig)} \n --- Initial Config --- \n${this.logConfig(this.initialConfig)} \n --- User Config --- \n${this.logConfig(this.userConfig)} \n --- Inline Config --- \n${this.logConfig(this.inlineConfig)} \n --- Plugin Config --- \n${this.logConfig(this.pluginConfig)}`
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)}`
3191
3198
  });
3192
3199
  mergedConfig.output = defu(mergedConfig.output ?? {}, {
3193
3200
  copy: { assets: [
@@ -3203,14 +3210,17 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
3203
3210
  ] },
3204
3211
  dts: true
3205
3212
  });
3206
- if (!mergedConfig.mode) mergedConfig.mode = "production";
3207
- if (!mergedConfig.framework) mergedConfig.framework = "powerlines";
3208
- if (!mergedConfig.projectType) mergedConfig.projectType = "application";
3209
- if (!mergedConfig.platform) mergedConfig.platform = "neutral";
3213
+ if (isUndefined(mergedConfig.mode)) mergedConfig.mode = await this.getDefaultMode();
3214
+ if (isUndefined(mergedConfig.framework)) mergedConfig.framework = "powerlines";
3215
+ if (isUndefined(mergedConfig.platform)) mergedConfig.platform = "neutral";
3210
3216
  mergedConfig.compatibilityDate = resolveCompatibilityDates(mergedConfig.compatibilityDate, "latest");
3217
+ if (!this.packageJson && existsSync$1(joinPaths$1(appendPath(mergedConfig.root, mergedConfig.cwd), "package.json")) || !this.projectJson && existsSync$1(joinPaths$1(appendPath(mergedConfig.root, mergedConfig.cwd), "project.json"))) {
3218
+ await this.resolvePackageConfigs(mergedConfig.cwd, mergedConfig.root);
3219
+ if (this.packageJson) mergedConfig.organization ??= getPackageJsonOrganization(this.packageJson) || "powerlines";
3220
+ }
3221
+ if (isUndefined(mergedConfig.projectType)) mergedConfig.projectType = this.projectJson?.projectType || "application";
3211
3222
  this.resolvedConfig = mergedConfig;
3212
3223
  this.#configProxy = this.createConfigProxy();
3213
- if (!this.packageJson) await this.resolvePackageConfigs();
3214
3224
  mergedConfig.input = getUniqueInputs(mergedConfig.input);
3215
3225
  if (mergedConfig.name?.startsWith("@") && mergedConfig.name.split("/").filter(Boolean).length > 1) mergedConfig.name = mergedConfig.name.split("/").filter(Boolean)[1];
3216
3226
  mergedConfig.title ??= titleCase(mergedConfig.name);
@@ -3221,18 +3231,18 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
3221
3231
  ret.push(plugin);
3222
3232
  return ret;
3223
3233
  }, []);
3224
- if (!mergedConfig.logLevel) if (mergedConfig.mode === "development") mergedConfig.logLevel = DEFAULT_DEVELOPMENT_LOG_LEVEL;
3234
+ if (isUndefined(mergedConfig.logLevel)) if (mergedConfig.mode === "development") mergedConfig.logLevel = DEFAULT_DEVELOPMENT_LOG_LEVEL;
3225
3235
  else if (mergedConfig.mode === "test") mergedConfig.logLevel = DEFAULT_TEST_LOG_LEVEL;
3226
3236
  else mergedConfig.logLevel = DEFAULT_PRODUCTION_LOG_LEVEL;
3227
3237
  mergedConfig.logLevel = resolveLogLevel(mergedConfig.logLevel);
3228
- if (mergedConfig.tsconfig) mergedConfig.tsconfig = replacePath(replacePathTokens(this, mergedConfig.tsconfig), mergedConfig.cwd);
3238
+ if (isSetString(mergedConfig.tsconfig)) mergedConfig.tsconfig = replacePath(replacePathTokens(this, mergedConfig.tsconfig), mergedConfig.cwd);
3229
3239
  else mergedConfig.tsconfig = getTsconfigFilePath(mergedConfig.cwd, mergedConfig.root);
3230
3240
  mergedConfig.output.format = getUnique(toArray(mergedConfig.output?.format ?? (mergedConfig.projectType === "library" ? ["cjs", "esm"] : ["esm"])));
3231
- if (mergedConfig.output.path) mergedConfig.output.path = appendPath(replacePathTokens(this, mergedConfig.output.path), mergedConfig.cwd);
3241
+ if (isSetString(mergedConfig.output.path)) mergedConfig.output.path = appendPath(replacePathTokens(this, mergedConfig.output.path), mergedConfig.cwd);
3232
3242
  else mergedConfig.output.path = appendPath(joinPaths$1(mergedConfig.root, "dist"), mergedConfig.cwd);
3233
3243
  mergedConfig.output.copy ??= {};
3234
- if (mergedConfig.output.copy !== false) if (!mergedConfig.root.replace(/^\.\/?/, "")) mergedConfig.output.copy.path = mergedConfig.output.copy.path ? appendPath(replacePathTokens(this, mergedConfig.output.copy.path), mergedConfig.cwd) : mergedConfig.output.path;
3235
- else mergedConfig.output.copy.path = appendPath(replacePathTokens(this, mergedConfig.output.copy.path || joinPaths$1("dist", mergedConfig.root)), mergedConfig.cwd);
3244
+ if (mergedConfig.output.copy !== false) if (!mergedConfig.root.replace(/^\.\/?/, "")) mergedConfig.output.copy.path = isSetString(mergedConfig.output.copy.path) ? appendPath(replacePathTokens(this, mergedConfig.output.copy.path), mergedConfig.cwd) : mergedConfig.output.path;
3245
+ else mergedConfig.output.copy.path = appendPath(replacePathTokens(this, isSetString(mergedConfig.output.copy.path) ? mergedConfig.output.copy.path : joinPaths$1("dist", mergedConfig.root)), mergedConfig.cwd);
3236
3246
  if (mergedConfig.output.types !== false) mergedConfig.output.types = appendPath(replacePathTokens(this, mergedConfig.output.types || joinPaths$1(mergedConfig.root, `${mergedConfig.framework ?? "powerlines"}.d.ts`)), mergedConfig.cwd);
3237
3247
  if (mergedConfig.output.copy && mergedConfig.output.copy.path && mergedConfig.output.copy.assets && Array.isArray(mergedConfig.output.copy.assets)) mergedConfig.output.copy.assets = getUniqueBy(mergedConfig.output.copy.assets.map((asset) => {
3238
3248
  return {
@@ -3242,11 +3252,11 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
3242
3252
  ignore: isSetObject(asset) && asset.ignore ? toArray(asset.ignore) : void 0
3243
3253
  };
3244
3254
  }), (a) => `${a.input}-${a.glob}-${a.output}`);
3245
- if (!mergedConfig.output?.sourceMap) if (mergedConfig.mode === "development") mergedConfig.output.sourceMap = true;
3255
+ if (isUndefined(mergedConfig.output?.sourceMap)) if (mergedConfig.mode === "development") mergedConfig.output.sourceMap = true;
3246
3256
  else mergedConfig.output.sourceMap = false;
3247
- if (!mergedConfig.output.minify) if (mergedConfig.mode === "production") mergedConfig.output.minify = true;
3257
+ if (isUndefined(mergedConfig.output?.minify)) if (mergedConfig.mode === "production") mergedConfig.output.minify = true;
3248
3258
  else mergedConfig.output.minify = false;
3249
- if (!mergedConfig.output.artifactsPath) mergedConfig.output.artifactsPath = `.${mergedConfig.framework || "powerlines"}`;
3259
+ if (isUndefined(mergedConfig.output?.artifactsPath)) mergedConfig.output.artifactsPath = `.${mergedConfig.framework || "powerlines"}`;
3250
3260
  if (mergedConfig.output.copy && mergedConfig.output.copy.assets) mergedConfig.output.copy.assets = mergedConfig.output.copy.assets.map((asset) => ({
3251
3261
  ...asset,
3252
3262
  glob: replacePathTokens(this, asset.glob),
@@ -3257,17 +3267,29 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
3257
3267
  if (isSetString(mergedConfig.output?.storage) && mergedConfig.output.storage === "virtual" || isSetObject(mergedConfig.output?.storage) && Object.values(mergedConfig.output.storage).every((adapter) => adapter.preset === "virtual")) mergedConfig.output.overwrite = true;
3258
3268
  this.resolvedConfig = mergedConfig;
3259
3269
  this.#configProxy = this.createConfigProxy();
3260
- this.logger.debug({
3270
+ this.logger.info({
3261
3271
  meta: { category: "config" },
3262
- message: `Resolved Powerlines configuration object: \n --- Resolved Config --- \n${this.logConfig(this.resolvedConfig)} \n --- Initial Config --- \n${this.logConfig(this.initialConfig)} \n --- User Config --- \n${this.logConfig(this.userConfig)} \n --- Inline Config --- \n${this.logConfig(this.inlineConfig)} \n --- Plugin Config --- \n${this.logConfig(this.pluginConfig)}`
3272
+ message: `Resolved Powerlines configuration object: \n${this.logConfig(this.resolvedConfig)}`
3263
3273
  });
3264
3274
  this.#fs ??= await VirtualFileSystem.create(this);
3265
3275
  }
3266
3276
  logConfig(config) {
3267
- return formatLogMessage({
3268
- ...omit(config, ["plugins"]),
3269
- plugins: config.plugins ? config.plugins.flatMap((plugin) => toArray(plugin)).map((plugin) => String(isSetString(plugin) ? plugin : isPromise(plugin) ? "<promise>" : isFunction(plugin) ? plugin.name || "<anonymous function>" : Array.isArray(plugin) ? plugin[0] || "<anonymous function plugin>" : "<unknown plugin>")) : void 0
3270
- });
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, "");
3271
3293
  }
3272
3294
  createConfigProxy() {
3273
3295
  return new Proxy(this.resolvedConfig, {
@@ -3294,6 +3316,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
3294
3316
  if (key === "userConfig") return this.userConfig;
3295
3317
  if (key === "inlineConfig") return this.inlineConfig;
3296
3318
  if (key === "pluginConfig") return this.pluginConfig;
3319
+ if (key === "environmentConfig") return this.environmentConfig;
3297
3320
  }
3298
3321
  return Reflect.get(target, key, receiver);
3299
3322
  },
@@ -3563,14 +3586,14 @@ var PowerlinesEnvironmentContext = class PowerlinesEnvironmentContext extends Po
3563
3586
  /**
3564
3587
  * Create a new context from the config.
3565
3588
  *
3566
- * @param options - The resolved execution options.
3589
+ * @param initialOptions - The resolved execution options.
3567
3590
  * @param config - The user configuration options.
3568
3591
  * @param overriddenConfig - The configuration options that should override all other configuration sources, such as CLI flags or environment variables. This is used to ensure that certain configuration values take precedence over any other settings defined in the user configuration or environment configuration, allowing for dynamic overrides based on the execution context.
3569
3592
  * @param environment - The resolved environment configuration, which may include additional properties or modifications made during the configuration loading process. This is used to provide context about the environment in which the command is being executed, allowing for environment-specific behavior and configuration resolution.
3570
3593
  * @returns A promise that resolves to an instance of the PowerlinesEnvironmentContext class, initialized with the provided configuration and environment data.
3571
3594
  */
3572
- static async createEnvironment(options, config, overriddenConfig, environment) {
3573
- const context = new PowerlinesEnvironmentContext(options, config, overriddenConfig);
3595
+ static async createEnvironment(initialOptions, config, overriddenConfig, environment) {
3596
+ const context = new PowerlinesEnvironmentContext(initialOptions, config, overriddenConfig);
3574
3597
  await context.setEnvironmentConfig(environment);
3575
3598
  return context;
3576
3599
  }
@@ -3623,7 +3646,7 @@ var PowerlinesEnvironmentContext = class PowerlinesEnvironmentContext extends Po
3623
3646
  * @returns A promise that resolves when the environment configuration values have been set.
3624
3647
  */
3625
3648
  async setEnvironmentConfig(config) {
3626
- this.logger.trace({
3649
+ this.logger.debug({
3627
3650
  meta: { category: "config" },
3628
3651
  message: `Updating environment configuration object: \n${this.logConfig(config)}`
3629
3652
  });
@@ -3876,7 +3899,7 @@ var PowerlinesExecutionContext = class PowerlinesExecutionContext extends Powerl
3876
3899
  * @returns A new context instance with the updated environment.
3877
3900
  */
3878
3901
  async createEnvironment(environment) {
3879
- const context = await PowerlinesEnvironmentContext.createEnvironment(deepClone(this.options), deepClone(this.config), deepClone(this.overriddenConfig), deepClone(environment));
3902
+ const context = await PowerlinesEnvironmentContext.createEnvironment(deepClone(this.initialOptions), deepClone(this.config), deepClone(this.overriddenConfig), deepClone(environment));
3880
3903
  context.$$internal = this.$$internal;
3881
3904
  context.dependencies = deepClone(this.dependencies);
3882
3905
  context.devDependencies = deepClone(this.devDependencies);
@@ -4858,6 +4881,10 @@ var PowerlinesExecution = class PowerlinesExecution {
4858
4881
  merge: mergeConfigs
4859
4882
  });
4860
4883
  if (pluginConfig) await this.context.setPluginConfig(pluginConfig);
4884
+ else this.context.debug({
4885
+ meta: { category: "config" },
4886
+ message: "No plugin configuration was returned from the config hook."
4887
+ });
4861
4888
  timer();
4862
4889
  }
4863
4890
  /**