@powerlines/engine 0.45.3 → 0.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/_internal/worker.cjs +844 -789
  2. package/dist/_internal/worker.mjs +847 -792
  3. package/dist/_internal/worker.mjs.map +1 -1
  4. package/dist/api.cjs +292 -323
  5. package/dist/api.d.cts +44 -11
  6. package/dist/api.d.cts.map +1 -1
  7. package/dist/api.d.mts +44 -11
  8. package/dist/api.d.mts.map +1 -1
  9. package/dist/api.mjs +292 -323
  10. package/dist/api.mjs.map +1 -1
  11. package/dist/{base-context-Byizvf4F.cjs → base-context-BCG0xN2e.cjs} +70 -64
  12. package/dist/{base-context-BSAC5sO9.mjs → base-context-Cmo6TTh7.mjs} +73 -67
  13. package/dist/base-context-Cmo6TTh7.mjs.map +1 -0
  14. package/dist/context/index.cjs +3 -3
  15. package/dist/context/index.d.cts +44 -617
  16. package/dist/context/index.d.cts.map +1 -1
  17. package/dist/context/index.d.mts +44 -617
  18. package/dist/context/index.d.mts.map +1 -1
  19. package/dist/context/index.mjs +3 -3
  20. package/dist/engine-context-BjFMVQEE.mjs +86 -0
  21. package/dist/engine-context-BjFMVQEE.mjs.map +1 -0
  22. package/dist/engine-context-DOsGtgD9.cjs +91 -0
  23. package/dist/execution-context-BdZt7wWa.d.mts +631 -0
  24. package/dist/execution-context-BdZt7wWa.d.mts.map +1 -0
  25. package/dist/execution-context-CU6iNchD.d.cts +631 -0
  26. package/dist/execution-context-CU6iNchD.d.cts.map +1 -0
  27. package/dist/{execution-context-Bkxp1fML.mjs → execution-context-Cp32TarF.mjs} +421 -364
  28. package/dist/execution-context-Cp32TarF.mjs.map +1 -0
  29. package/dist/{execution-context-BYGFYty0.cjs → execution-context-DgqxcDDx.cjs} +419 -362
  30. package/dist/index.cjs +15 -16
  31. package/dist/index.d.cts +3 -3
  32. package/dist/index.d.cts.map +1 -1
  33. package/dist/index.d.mts +3 -3
  34. package/dist/index.d.mts.map +1 -1
  35. package/dist/index.mjs +15 -16
  36. package/dist/index.mjs.map +1 -1
  37. package/dist/{tsconfig-QMSxSwBD.cjs → tsconfig-BUDqmOaT.cjs} +13 -13
  38. package/dist/{tsconfig-CI6bla4E.mjs → tsconfig-MeFEs21S.mjs} +14 -14
  39. package/dist/tsconfig-MeFEs21S.mjs.map +1 -0
  40. package/dist/typescript/index.cjs +1 -1
  41. package/dist/typescript/index.d.cts +6 -6
  42. package/dist/typescript/index.d.cts.map +1 -1
  43. package/dist/typescript/index.d.mts +6 -6
  44. package/dist/typescript/index.d.mts.map +1 -1
  45. package/dist/typescript/index.mjs +1 -1
  46. package/package.json +17 -17
  47. package/dist/base-context-BSAC5sO9.mjs.map +0 -1
  48. package/dist/engine-context-CI_0NWIk.cjs +0 -73
  49. package/dist/engine-context-_RMFwG4J.mjs +0 -68
  50. package/dist/engine-context-_RMFwG4J.mjs.map +0 -1
  51. package/dist/execution-context-Bkxp1fML.mjs.map +0 -1
  52. package/dist/tsconfig-CI6bla4E.mjs.map +0 -1
@@ -11,8 +11,8 @@ let _stryke_env_get_env_paths = require("@stryke/env/get-env-paths");
11
11
  let _stryke_fs = require("@stryke/fs");
12
12
  let _stryke_path = require("@stryke/path");
13
13
  let _stryke_path_append = require("@stryke/path/append");
14
- let _stryke_path_is_equal = require("@stryke/path/is-equal");
15
14
  let _stryke_path_replace = require("@stryke/path/replace");
15
+ let _stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
16
16
  let chalk = require("chalk");
17
17
  chalk = require_chunk.__toESM(chalk, 1);
18
18
  let date_fns_formatDistanceToNowStrict = require("date-fns/formatDistanceToNowStrict");
@@ -61,17 +61,17 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
61
61
  */
62
62
  resolver;
63
63
  /**
64
- * The options provided to the Powerlines process
64
+ * The options provided to the Powerlines process, resolved with default values and merged with any configuration provided by plugins or other sources. This is typically the final configuration used during the build process, but may also include additional options that are relevant to the context and its interactions with the Powerlines engine.
65
65
  */
66
66
  options;
67
67
  /**
68
- * The input options used to initialize the context, which may be used when cloning the context to ensure the same configuration is applied to the new context
68
+ * The parsed `package.json` file for the project
69
69
  */
70
- initialOptions = {};
70
+ packageJson;
71
71
  /**
72
- * The initial configuration provided when initializing the context, which may be used during the setup process to ensure that the configuration is properly merged and applied to the context. This is typically the user configuration provided in the Powerlines configuration file, but may also include additional configuration options provided by plugins or other sources.
72
+ * The parsed `project.json` file for the project
73
73
  */
74
- initialConfig = {};
74
+ projectJson = void 0;
75
75
  /**
76
76
  * The parsed configuration file for the project
77
77
  */
@@ -110,8 +110,8 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
110
110
  * @returns A promise that resolves to the cloned context.
111
111
  */
112
112
  async clone() {
113
- const clone = new PowerlinesBaseContext();
114
- await clone.init(this.options, this.initialConfig);
113
+ const clone = new PowerlinesBaseContext(this.options, this.initialConfig);
114
+ await clone.init();
115
115
  return clone;
116
116
  }
117
117
  /**
@@ -194,7 +194,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
194
194
  * @returns A logger client instance that can be used to generate log messages with consistent formatting and metadata.
195
195
  */
196
196
  createLogger(options, logFn) {
197
- return (0, _powerlines_core_plugin_utils_logging.createLogger)(this.options.name || this.options.root, {
197
+ return (0, _powerlines_core_plugin_utils_logging.createLogger)(this.options.name || this.options.root || "powerlines", {
198
198
  ...this.configFile.config,
199
199
  ...this.options,
200
200
  ...options
@@ -210,6 +210,24 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
210
210
  return (0, _powerlines_core_plugin_utils_logging.extendLogger)(this.logger, options);
211
211
  }
212
212
  /**
213
+ * The input options used to initialize the context, which may be used when cloning the context to ensure the same configuration is applied to the new context
214
+ */
215
+ initialOptions = {};
216
+ /**
217
+ * The initial configuration provided when initializing the context, which may be used during the setup process to ensure that the configuration is properly merged and applied to the context. This is typically the user configuration provided in the Powerlines configuration file, but may also include additional configuration options provided by plugins or other sources.
218
+ */
219
+ initialConfig = {};
220
+ /**
221
+ * Initialize the context with the provided configuration options and set up the resolver and user configuration file. This method is called during the construction of the context and can also be called when cloning the context to ensure that the new context has the same configuration and resolver setup as the original context.
222
+ *
223
+ * @param options - The configuration options to initialize the context with, which can include properties such as the project root, mode, log level, and other settings that affect the behavior of the context and its plugins.
224
+ * @param initialConfig - The initial configuration to initialize the context with, which is typically the user configuration provided in the Powerlines configuration file. This can also include additional configuration options provided by plugins or other sources that should be merged with the user configuration during initialization
225
+ */
226
+ constructor(options, initialConfig = {}) {
227
+ this.initialOptions = options;
228
+ this.initialConfig = initialConfig;
229
+ }
230
+ /**
213
231
  * Retrieve the workspace configuration for the current project, if it exists. This function will look for a configuration file in the project root and return its contents as a JavaScript object. If no configuration file is found, it will return undefined.
214
232
  *
215
233
  * @returns A promise that resolves to the workspace configuration object, or undefined if no configuration file is found.
@@ -221,64 +239,47 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
221
239
  } : void 0);
222
240
  }
223
241
  /**
224
- * Determine the default mode for the current execution based on the environment and workspace configuration. This function will check the `NODE_ENV` environment variable to determine if the current environment is development, production, or test. If `NODE_ENV` is not set, it will look for a `mode` property in the workspace configuration file. If no mode is specified in the workspace configuration, it will default to "production".
225
- *
226
- * @returns A promise that resolves to the default mode for the current execution, which can be "development", "production", or "test".
227
- */
228
- async getDefaultMode() {
229
- const workspaceConfig = await this.getWorkspaceConfig();
230
- return _stryke_env_environment_checks.isProduction ? "production" : _stryke_env_environment_checks.isDevelopment ? "development" : _stryke_env_environment_checks.isTest ? "test" : workspaceConfig?.mode || "production";
231
- }
232
- /**
233
- * Determine the default log level for the current execution based on the environment and workspace configuration. This function will check the `logLevel` property in the workspace configuration file and resolve it to a `LogLevelResolvedConfig` value. If no log level is specified in the workspace configuration, it will default to "info" for development mode and "warn" for production mode.
234
- *
235
- * @returns A promise that resolves to the default log level for the current execution, which can be "fatal", "error", "warn", "info", "debug", or "trace".
236
- */
237
- async getDefaultLogLevel() {
238
- const workspaceConfig = await this.getWorkspaceConfig();
239
- return (0, _powerlines_core_plugin_utils.resolveLogLevel)(workspaceConfig?.logLevel ? workspaceConfig.logLevel === "success" || workspaceConfig.logLevel === "performance" ? "info" : workspaceConfig.logLevel === "all" ? "debug" : workspaceConfig.logLevel === "fatal" ? "error" : workspaceConfig.logLevel : void 0, this.options?.mode || this.initialOptions?.mode || workspaceConfig?.mode || await this.getDefaultMode());
240
- }
241
- /**
242
242
  * Initialize the context with the provided configuration options
243
243
  *
244
244
  * @remarks
245
245
  * This method will set up the resolver and load the user configuration file based on the provided options. It is called during the construction of the context and can also be called when cloning the context to ensure that the new context has the same configuration and resolver setup.
246
- *
247
- * @param options - The configuration options to initialize the context with
248
- * @param initialConfig - The initial configuration to initialize the context with
249
246
  */
250
- async init(options, initialConfig) {
251
- this.initialOptions = { ...options };
252
- this.initialConfig = { ...initialConfig };
247
+ async init() {
253
248
  if (!this.powerlinesPath) {
254
249
  const powerlinesPath = await (0, _stryke_fs_resolve.resolvePackage)("powerlines");
255
250
  if (!powerlinesPath) throw new Error("Could not resolve `powerlines` package location.");
256
251
  this.powerlinesPath = powerlinesPath;
257
252
  }
258
- const cwd = options.cwd || this.options?.cwd || process.cwd();
259
- const root = (0, _stryke_path_replace.replacePath)((options.root || this.options?.root) && (options.root || this.options.root).replace(/^\.\/?/, "") && !(0, _stryke_path_is_equal.isEqual)(options.root || this.options.root, cwd) ? options.root || this.options.root : ".", cwd);
260
- this.options = (0, defu.default)({
261
- name: options.name || this.initialConfig.name,
262
- root,
263
- cwd,
264
- mode: options.mode || this.initialConfig.mode,
265
- logLevel: options.logLevel || this.initialConfig.logLevel,
266
- framework: options.framework || this.initialConfig.framework,
267
- organization: options.organization || this.initialConfig.organization,
268
- configFile: options.configFile || this.initialConfig.configFile
269
- }, this.options ?? {}, {
253
+ this.options = (0, defu.default)(this.initialOptions, this.initialConfig, {
254
+ cwd: process.cwd(),
270
255
  mode: await this.getDefaultMode(),
271
- logLevel: await this.getDefaultLogLevel()
256
+ logLevel: await this.getDefaultLogLevel(),
257
+ framework: "powerlines"
272
258
  });
259
+ if (!this.options.root) if (this.options.configFile) {
260
+ const configFile = (0, _stryke_path_append.appendPath)(this.options.configFile, this.options.cwd);
261
+ if (!(0, node_fs.existsSync)(configFile)) throw new Error(`The user-provided configuration file at "${this.options.configFile}" does not exist. Please ensure this path is correct and try again.`);
262
+ if (!(0, _stryke_fs.isFile)(configFile)) throw new Error(`The user-provided configuration file at "${this.options.configFile}" is not a file. Please ensure this path is correct and try again.`);
263
+ this.options.root = (0, _stryke_path.relativePath)(this.options.cwd, (0, _stryke_path.findFilePath)(configFile));
264
+ } else this.options.root = ".";
265
+ else this.options.root = (0, _stryke_path_replace.replacePath)(this.options.root, this.options.cwd);
273
266
  this.resolver = createResolver({
274
- workspaceRoot: cwd,
275
- root,
267
+ workspaceRoot: this.options.cwd,
268
+ root: this.options.root,
276
269
  cacheDir: this.envPaths.cache,
277
270
  mode: this.options.mode
278
271
  });
272
+ const projectJsonPath = (0, _stryke_path.joinPaths)((0, _stryke_path_append.appendPath)(this.options.root, this.options.cwd), "project.json");
273
+ if ((0, node_fs.existsSync)(projectJsonPath)) this.projectJson = await (0, _stryke_fs.readJsonFile)(projectJsonPath);
274
+ const packageJsonPath = (0, _stryke_path.joinPaths)((0, _stryke_path_append.appendPath)(this.options.root, this.options.cwd), "package.json");
275
+ if ((0, node_fs.existsSync)(packageJsonPath)) {
276
+ this.packageJson = await (0, _stryke_fs.readJsonFile)(packageJsonPath);
277
+ 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);
278
+ }
279
279
  this.configFile = await (0, _powerlines_core_lib_config.loadUserConfigFile)(this.options, this.resolver);
280
- if (!this.options.name) {
281
- if (this.configFile.config) {
280
+ if (this.configFile.config) {
281
+ if ((0, _stryke_type_checks_is_set_string.isSetString)(this.configFile.configFile)) this.options.configFile ??= (0, _stryke_path_replace.replacePath)(this.configFile.configFile, this.options.cwd);
282
+ if (!this.options.name) {
282
283
  if ((0, _stryke_type_checks_is_set_object.isSetObject)(this.configFile.config) && (0, _stryke_type_checks_is_set_string.isSetString)(this.configFile.config.name)) this.options.name = this.configFile.config.name;
283
284
  else if (Array.isArray(this.configFile.config)) {
284
285
  for (const config of this.configFile.config) if ((0, _stryke_type_checks_is_set_object.isSetObject)(config) && (0, _stryke_type_checks_is_set_string.isSetString)(config.name)) {
@@ -287,22 +288,27 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
287
288
  }
288
289
  }
289
290
  }
290
- if (!this.options.name) {
291
- const packageJsonPath = (0, _stryke_path.joinPaths)((0, _stryke_path_append.appendPath)(this.options.root, this.options.cwd), "package.json");
292
- if ((0, node_fs.existsSync)(packageJsonPath)) {
293
- const packageJson = await (0, _stryke_fs.readJsonFile)(packageJsonPath);
294
- this.options.name = packageJson.name;
295
- }
296
- if (!this.options.name) {
297
- const projectJsonPath = (0, _stryke_path.joinPaths)((0, _stryke_path_append.appendPath)(this.options.root, this.options.cwd), "project.json");
298
- if ((0, node_fs.existsSync)(projectJsonPath)) {
299
- const projectJson = await (0, _stryke_fs.readJsonFile)(projectJsonPath);
300
- this.options.name = projectJson.name;
301
- }
302
- }
303
- }
291
+ if (!this.options.name) this.options.name = this.projectJson?.name || this.packageJson?.name;
304
292
  }
305
293
  }
294
+ /**
295
+ * Determine the default mode for the current execution based on the environment and workspace configuration. This function will check the `NODE_ENV` environment variable to determine if the current environment is development, production, or test. If `NODE_ENV` is not set, it will look for a `mode` property in the workspace configuration file. If no mode is specified in the workspace configuration, it will default to "production".
296
+ *
297
+ * @returns A promise that resolves to the default mode for the current execution, which can be "development", "production", or "test".
298
+ */
299
+ async getDefaultMode() {
300
+ const workspaceConfig = await this.getWorkspaceConfig();
301
+ return _stryke_env_environment_checks.isProduction ? "production" : _stryke_env_environment_checks.isDevelopment ? "development" : _stryke_env_environment_checks.isTest ? "test" : workspaceConfig?.mode || "production";
302
+ }
303
+ /**
304
+ * Determine the default log level for the current execution based on the environment and workspace configuration. This function will check the `logLevel` property in the workspace configuration file and resolve it to a `LogLevelResolvedConfig` value. If no log level is specified in the workspace configuration, it will default to "info" for development mode and "warn" for production mode.
305
+ *
306
+ * @returns A promise that resolves to the default log level for the current execution, which can be "fatal", "error", "warn", "info", "debug", or "trace".
307
+ */
308
+ async getDefaultLogLevel() {
309
+ const workspaceConfig = await this.getWorkspaceConfig();
310
+ return (0, _powerlines_core_plugin_utils.resolveLogLevel)(workspaceConfig?.logLevel ? workspaceConfig.logLevel === "success" || workspaceConfig.logLevel === "performance" ? "info" : workspaceConfig.logLevel === "all" ? "debug" : workspaceConfig.logLevel === "fatal" ? "error" : workspaceConfig.logLevel : void 0, this.options?.mode || this.initialOptions?.mode || workspaceConfig?.mode || await this.getDefaultMode());
311
+ }
306
312
  };
307
313
 
308
314
  //#endregion
@@ -7,11 +7,11 @@ import { createLogger as createLogger$1, extendLogger } from "@powerlines/core/p
7
7
  import { tryGetWorkspaceConfig } from "@storm-software/config-tools/get-config";
8
8
  import { isDevelopment, isProduction, isTest } from "@stryke/env/environment-checks";
9
9
  import { getEnvPaths } from "@stryke/env/get-env-paths";
10
- import { readJsonFile } from "@stryke/fs";
11
- import { joinPaths } from "@stryke/path";
10
+ import { isFile, readJsonFile } from "@stryke/fs";
11
+ import { findFilePath, joinPaths, relativePath } from "@stryke/path";
12
12
  import { appendPath } from "@stryke/path/append";
13
- import { isEqual } from "@stryke/path/is-equal";
14
13
  import { replacePath } from "@stryke/path/replace";
14
+ import { kebabCase } from "@stryke/string-format/kebab-case";
15
15
  import chalk from "chalk";
16
16
  import { formatDistanceToNowStrict } from "date-fns/formatDistanceToNowStrict";
17
17
  import defu from "defu";
@@ -58,17 +58,17 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
58
58
  */
59
59
  resolver;
60
60
  /**
61
- * The options provided to the Powerlines process
61
+ * The options provided to the Powerlines process, resolved with default values and merged with any configuration provided by plugins or other sources. This is typically the final configuration used during the build process, but may also include additional options that are relevant to the context and its interactions with the Powerlines engine.
62
62
  */
63
63
  options;
64
64
  /**
65
- * The input options used to initialize the context, which may be used when cloning the context to ensure the same configuration is applied to the new context
65
+ * The parsed `package.json` file for the project
66
66
  */
67
- initialOptions = {};
67
+ packageJson;
68
68
  /**
69
- * The initial configuration provided when initializing the context, which may be used during the setup process to ensure that the configuration is properly merged and applied to the context. This is typically the user configuration provided in the Powerlines configuration file, but may also include additional configuration options provided by plugins or other sources.
69
+ * The parsed `project.json` file for the project
70
70
  */
71
- initialConfig = {};
71
+ projectJson = void 0;
72
72
  /**
73
73
  * The parsed configuration file for the project
74
74
  */
@@ -107,8 +107,8 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
107
107
  * @returns A promise that resolves to the cloned context.
108
108
  */
109
109
  async clone() {
110
- const clone = new PowerlinesBaseContext();
111
- await clone.init(this.options, this.initialConfig);
110
+ const clone = new PowerlinesBaseContext(this.options, this.initialConfig);
111
+ await clone.init();
112
112
  return clone;
113
113
  }
114
114
  /**
@@ -191,7 +191,7 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
191
191
  * @returns A logger client instance that can be used to generate log messages with consistent formatting and metadata.
192
192
  */
193
193
  createLogger(options, logFn) {
194
- return createLogger$1(this.options.name || this.options.root, {
194
+ return createLogger$1(this.options.name || this.options.root || "powerlines", {
195
195
  ...this.configFile.config,
196
196
  ...this.options,
197
197
  ...options
@@ -207,6 +207,24 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
207
207
  return extendLogger(this.logger, options);
208
208
  }
209
209
  /**
210
+ * The input options used to initialize the context, which may be used when cloning the context to ensure the same configuration is applied to the new context
211
+ */
212
+ initialOptions = {};
213
+ /**
214
+ * The initial configuration provided when initializing the context, which may be used during the setup process to ensure that the configuration is properly merged and applied to the context. This is typically the user configuration provided in the Powerlines configuration file, but may also include additional configuration options provided by plugins or other sources.
215
+ */
216
+ initialConfig = {};
217
+ /**
218
+ * Initialize the context with the provided configuration options and set up the resolver and user configuration file. This method is called during the construction of the context and can also be called when cloning the context to ensure that the new context has the same configuration and resolver setup as the original context.
219
+ *
220
+ * @param options - The configuration options to initialize the context with, which can include properties such as the project root, mode, log level, and other settings that affect the behavior of the context and its plugins.
221
+ * @param initialConfig - The initial configuration to initialize the context with, which is typically the user configuration provided in the Powerlines configuration file. This can also include additional configuration options provided by plugins or other sources that should be merged with the user configuration during initialization
222
+ */
223
+ constructor(options, initialConfig = {}) {
224
+ this.initialOptions = options;
225
+ this.initialConfig = initialConfig;
226
+ }
227
+ /**
210
228
  * Retrieve the workspace configuration for the current project, if it exists. This function will look for a configuration file in the project root and return its contents as a JavaScript object. If no configuration file is found, it will return undefined.
211
229
  *
212
230
  * @returns A promise that resolves to the workspace configuration object, or undefined if no configuration file is found.
@@ -218,64 +236,47 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
218
236
  } : void 0);
219
237
  }
220
238
  /**
221
- * Determine the default mode for the current execution based on the environment and workspace configuration. This function will check the `NODE_ENV` environment variable to determine if the current environment is development, production, or test. If `NODE_ENV` is not set, it will look for a `mode` property in the workspace configuration file. If no mode is specified in the workspace configuration, it will default to "production".
222
- *
223
- * @returns A promise that resolves to the default mode for the current execution, which can be "development", "production", or "test".
224
- */
225
- async getDefaultMode() {
226
- const workspaceConfig = await this.getWorkspaceConfig();
227
- return isProduction ? "production" : isDevelopment ? "development" : isTest ? "test" : workspaceConfig?.mode || "production";
228
- }
229
- /**
230
- * Determine the default log level for the current execution based on the environment and workspace configuration. This function will check the `logLevel` property in the workspace configuration file and resolve it to a `LogLevelResolvedConfig` value. If no log level is specified in the workspace configuration, it will default to "info" for development mode and "warn" for production mode.
231
- *
232
- * @returns A promise that resolves to the default log level for the current execution, which can be "fatal", "error", "warn", "info", "debug", or "trace".
233
- */
234
- async getDefaultLogLevel() {
235
- const workspaceConfig = await this.getWorkspaceConfig();
236
- return resolveLogLevel(workspaceConfig?.logLevel ? workspaceConfig.logLevel === "success" || workspaceConfig.logLevel === "performance" ? "info" : workspaceConfig.logLevel === "all" ? "debug" : workspaceConfig.logLevel === "fatal" ? "error" : workspaceConfig.logLevel : void 0, this.options?.mode || this.initialOptions?.mode || workspaceConfig?.mode || await this.getDefaultMode());
237
- }
238
- /**
239
239
  * Initialize the context with the provided configuration options
240
240
  *
241
241
  * @remarks
242
242
  * This method will set up the resolver and load the user configuration file based on the provided options. It is called during the construction of the context and can also be called when cloning the context to ensure that the new context has the same configuration and resolver setup.
243
- *
244
- * @param options - The configuration options to initialize the context with
245
- * @param initialConfig - The initial configuration to initialize the context with
246
243
  */
247
- async init(options, initialConfig) {
248
- this.initialOptions = { ...options };
249
- this.initialConfig = { ...initialConfig };
244
+ async init() {
250
245
  if (!this.powerlinesPath) {
251
246
  const powerlinesPath = await resolvePackage("powerlines");
252
247
  if (!powerlinesPath) throw new Error("Could not resolve `powerlines` package location.");
253
248
  this.powerlinesPath = powerlinesPath;
254
249
  }
255
- const cwd = options.cwd || this.options?.cwd || process.cwd();
256
- const root = replacePath((options.root || this.options?.root) && (options.root || this.options.root).replace(/^\.\/?/, "") && !isEqual(options.root || this.options.root, cwd) ? options.root || this.options.root : ".", cwd);
257
- this.options = defu({
258
- name: options.name || this.initialConfig.name,
259
- root,
260
- cwd,
261
- mode: options.mode || this.initialConfig.mode,
262
- logLevel: options.logLevel || this.initialConfig.logLevel,
263
- framework: options.framework || this.initialConfig.framework,
264
- organization: options.organization || this.initialConfig.organization,
265
- configFile: options.configFile || this.initialConfig.configFile
266
- }, this.options ?? {}, {
250
+ this.options = defu(this.initialOptions, this.initialConfig, {
251
+ cwd: process.cwd(),
267
252
  mode: await this.getDefaultMode(),
268
- logLevel: await this.getDefaultLogLevel()
253
+ logLevel: await this.getDefaultLogLevel(),
254
+ framework: "powerlines"
269
255
  });
256
+ if (!this.options.root) if (this.options.configFile) {
257
+ const configFile = appendPath(this.options.configFile, this.options.cwd);
258
+ if (!existsSync(configFile)) throw new Error(`The user-provided configuration file at "${this.options.configFile}" does not exist. Please ensure this path is correct and try again.`);
259
+ if (!isFile(configFile)) throw new Error(`The user-provided configuration file at "${this.options.configFile}" is not a file. Please ensure this path is correct and try again.`);
260
+ this.options.root = relativePath(this.options.cwd, findFilePath(configFile));
261
+ } else this.options.root = ".";
262
+ else this.options.root = replacePath(this.options.root, this.options.cwd);
270
263
  this.resolver = createResolver({
271
- workspaceRoot: cwd,
272
- root,
264
+ workspaceRoot: this.options.cwd,
265
+ root: this.options.root,
273
266
  cacheDir: this.envPaths.cache,
274
267
  mode: this.options.mode
275
268
  });
269
+ const projectJsonPath = joinPaths(appendPath(this.options.root, this.options.cwd), "project.json");
270
+ if (existsSync(projectJsonPath)) this.projectJson = await readJsonFile(projectJsonPath);
271
+ const packageJsonPath = joinPaths(appendPath(this.options.root, this.options.cwd), "package.json");
272
+ if (existsSync(packageJsonPath)) {
273
+ this.packageJson = await readJsonFile(packageJsonPath);
274
+ this.options.organization ??= isSetObject(this.packageJson?.author) ? kebabCase(this.packageJson?.author?.name) : kebabCase(this.packageJson?.author);
275
+ }
276
276
  this.configFile = await loadUserConfigFile(this.options, this.resolver);
277
- if (!this.options.name) {
278
- if (this.configFile.config) {
277
+ if (this.configFile.config) {
278
+ if (isSetString(this.configFile.configFile)) this.options.configFile ??= replacePath(this.configFile.configFile, this.options.cwd);
279
+ if (!this.options.name) {
279
280
  if (isSetObject(this.configFile.config) && isSetString(this.configFile.config.name)) this.options.name = this.configFile.config.name;
280
281
  else if (Array.isArray(this.configFile.config)) {
281
282
  for (const config of this.configFile.config) if (isSetObject(config) && isSetString(config.name)) {
@@ -284,24 +285,29 @@ var PowerlinesBaseContext = class PowerlinesBaseContext {
284
285
  }
285
286
  }
286
287
  }
287
- if (!this.options.name) {
288
- const packageJsonPath = joinPaths(appendPath(this.options.root, this.options.cwd), "package.json");
289
- if (existsSync(packageJsonPath)) {
290
- const packageJson = await readJsonFile(packageJsonPath);
291
- this.options.name = packageJson.name;
292
- }
293
- if (!this.options.name) {
294
- const projectJsonPath = joinPaths(appendPath(this.options.root, this.options.cwd), "project.json");
295
- if (existsSync(projectJsonPath)) {
296
- const projectJson = await readJsonFile(projectJsonPath);
297
- this.options.name = projectJson.name;
298
- }
299
- }
300
- }
288
+ if (!this.options.name) this.options.name = this.projectJson?.name || this.packageJson?.name;
301
289
  }
302
290
  }
291
+ /**
292
+ * Determine the default mode for the current execution based on the environment and workspace configuration. This function will check the `NODE_ENV` environment variable to determine if the current environment is development, production, or test. If `NODE_ENV` is not set, it will look for a `mode` property in the workspace configuration file. If no mode is specified in the workspace configuration, it will default to "production".
293
+ *
294
+ * @returns A promise that resolves to the default mode for the current execution, which can be "development", "production", or "test".
295
+ */
296
+ async getDefaultMode() {
297
+ const workspaceConfig = await this.getWorkspaceConfig();
298
+ return isProduction ? "production" : isDevelopment ? "development" : isTest ? "test" : workspaceConfig?.mode || "production";
299
+ }
300
+ /**
301
+ * Determine the default log level for the current execution based on the environment and workspace configuration. This function will check the `logLevel` property in the workspace configuration file and resolve it to a `LogLevelResolvedConfig` value. If no log level is specified in the workspace configuration, it will default to "info" for development mode and "warn" for production mode.
302
+ *
303
+ * @returns A promise that resolves to the default log level for the current execution, which can be "fatal", "error", "warn", "info", "debug", or "trace".
304
+ */
305
+ async getDefaultLogLevel() {
306
+ const workspaceConfig = await this.getWorkspaceConfig();
307
+ return resolveLogLevel(workspaceConfig?.logLevel ? workspaceConfig.logLevel === "success" || workspaceConfig.logLevel === "performance" ? "info" : workspaceConfig.logLevel === "all" ? "debug" : workspaceConfig.logLevel === "fatal" ? "error" : workspaceConfig.logLevel : void 0, this.options?.mode || this.initialOptions?.mode || workspaceConfig?.mode || await this.getDefaultMode());
308
+ }
303
309
  };
304
310
 
305
311
  //#endregion
306
312
  export { PowerlinesBaseContext as t };
307
- //# sourceMappingURL=base-context-BSAC5sO9.mjs.map
313
+ //# sourceMappingURL=base-context-Cmo6TTh7.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-context-Cmo6TTh7.mjs","names":["joinPaths","#timestamp","createLogger"],"sources":["../src/_internal/helpers/resolver.ts","../src/context/base-context.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ResolvedConfig, Resolver } from \"@powerlines/core\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport defu from \"defu\";\nimport { JitiOptions, createJiti } from \"jiti\";\n\nexport type CreateResolverOptions = Omit<\n JitiOptions,\n \"fsCache\" | \"moduleCache\" | \"interopDefault\"\n> &\n Partial<Pick<ResolvedConfig, \"mode\" | \"skipCache\">> & {\n workspaceRoot: string;\n root: string;\n cacheDir: string;\n };\n\n/**\n * Create a Jiti resolver for the given workspace and project root.\n *\n * @param options - The options for creating the resolver.\n * @returns A Jiti instance configured for the specified workspace and project root.\n */\nfunction resolveOptions(options: CreateResolverOptions): JitiOptions {\n return defu(options, {\n interopDefault: true,\n fsCache:\n options.mode !== \"development\"\n ? joinPaths(options.cacheDir, \"jiti\")\n : false,\n moduleCache: options.mode !== \"development\"\n });\n}\n\n/**\n * Create a Jiti resolver for the given workspace and project root.\n *\n * @param options - The options for creating the resolver.\n * @returns A Jiti instance configured for the specified workspace and project root.\n */\nexport function createResolver(options: CreateResolverOptions): Resolver {\n const baseResolver = createJiti(\n joinPaths(options.workspaceRoot, options.root),\n resolveOptions(options)\n ) as Resolver;\n baseResolver.plugin = createJiti(\n joinPaths(options.workspaceRoot, options.root),\n resolveOptions(options)\n );\n\n return baseResolver;\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type {\n BaseContext,\n EngineOptions,\n LogFn,\n Logger,\n LoggerOptions,\n LogLevelResolvedConfig,\n LogMessage,\n Mode,\n ParsedUserConfig,\n Resolver,\n UserConfig,\n WorkspaceConfig\n} from \"@powerlines/core\";\nimport { loadUserConfigFile } from \"@powerlines/core/lib/config\";\nimport { resolveLogLevel } from \"@powerlines/core/plugin-utils\";\nimport {\n createLogger,\n extendLogger\n} from \"@powerlines/core/plugin-utils/logging\";\nimport { tryGetWorkspaceConfig } from \"@storm-software/config-tools/get-config\";\nimport {\n isDevelopment,\n isProduction,\n isTest\n} from \"@stryke/env/environment-checks\";\nimport { EnvPaths, getEnvPaths } from \"@stryke/env/get-env-paths\";\nimport { isFile, readJsonFile } from \"@stryke/fs\";\nimport { resolvePackage } from \"@stryke/fs/resolve\";\nimport { findFilePath, joinPaths, relativePath } from \"@stryke/path\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { DeepPartial, RequiredKeys } from \"@stryke/types/base\";\nimport { PackageJson } from \"@stryke/types/package-json\";\nimport chalk from \"chalk\";\nimport { formatDistanceToNowStrict } from \"date-fns/formatDistanceToNowStrict\";\nimport defu from \"defu\";\nimport { existsSync } from \"node:fs\";\nimport { createResolver } from \"../_internal/helpers/resolver\";\n\nexport class PowerlinesBaseContext implements BaseContext {\n #timestamp: number = Date.now();\n\n /**\n * The path to the Powerlines package\n */\n public powerlinesPath!: string;\n\n /**\n * The module resolver for the project\n */\n public resolver!: Resolver;\n\n /**\n * The options provided to the Powerlines process, resolved with default values and merged with any configuration provided by plugins or other sources. This is typically the final configuration used during the build process, but may also include additional options that are relevant to the context and its interactions with the Powerlines engine.\n */\n public options!: RequiredKeys<\n EngineOptions,\n \"mode\" | \"cwd\" | \"root\" | \"framework\"\n >;\n\n /**\n * The parsed `package.json` file for the project\n */\n public packageJson!: PackageJson;\n\n /**\n * The parsed `project.json` file for the project\n */\n public projectJson: Record<string, any> | undefined = undefined;\n\n /**\n * The parsed configuration file for the project\n */\n public configFile!: ParsedUserConfig;\n\n /**\n * The logger instance for the context, which can be used to create log messages with consistent formatting and metadata. This logger is extended by plugin contexts to include additional metadata such as the plugin name and category, which can be used to filter and format log messages in a more granular way.\n */\n public get logger(): Logger {\n return this.createLogger({});\n }\n\n /**\n * A timestamp representing when the context was initialized\n */\n public get timestamp(): number {\n return this.#timestamp;\n }\n\n public get logLevel(): LogLevelResolvedConfig {\n return resolveLogLevel(this.options.logLevel, this.options.mode);\n }\n\n /**\n * The environment paths for the project\n */\n public get envPaths(): EnvPaths {\n return getEnvPaths({\n orgId: this.options.organization,\n appId: this.options.framework || \"powerlines\",\n workspaceRoot: this.options.cwd\n });\n }\n\n /**\n * Creates a clone of the current context with the same configuration and workspace settings. This can be useful for running multiple builds in parallel or for creating isolated contexts for different parts of the build process.\n *\n * @remarks\n * The cloned context will have the same configuration and workspace settings as the original context, but will have a different build ID, release ID, and timestamp. The virtual file system and caches will also be separate between the original and cloned contexts.\n *\n * @returns A promise that resolves to the cloned context.\n */\n public async clone(): Promise<BaseContext> {\n const clone = new PowerlinesBaseContext(this.options, this.initialConfig);\n await clone.init();\n\n return clone;\n }\n\n /**\n * A logging function for fatal messages\n *\n * @param message - The message to log.\n */\n public fatal(message: string | LogMessage) {\n this.logger.error(message);\n }\n\n /**\n * A logging function for error messages\n *\n * @param message - The message to log.\n */\n public error(message: string | LogMessage) {\n this.logger.error(message);\n }\n\n /**\n * A logging function for warning messages\n *\n * @param message - The message to log.\n */\n public warn(message: string | LogMessage) {\n this.logger.warn(message);\n }\n\n /**\n * A logging function for informational messages\n *\n * @param message - The message to log.\n */\n public info(message: string | LogMessage) {\n this.logger.info(message);\n }\n\n /**\n * A logging function for debug messages\n *\n * @param message - The message to log.\n */\n public debug(message: string | LogMessage) {\n this.logger.debug(message);\n }\n\n /**\n * A logging function for trace messages\n *\n * @param message - The message to log.\n */\n public trace(message: string | LogMessage) {\n this.logger.trace(message);\n }\n\n /**\n * A function to create a timer for measuring the duration of asynchronous operations\n *\n * @example\n * ```ts\n * const stopTimer = context.timer(\"Your Async Operation\");\n * await performAsyncOperation();\n * stopTimer(); // \"Your Async Operation completed in 123.45 milliseconds\"\n * ```\n *\n * @param name - The name of the timer.\n * @returns A function that, when called, stops the timer and logs the duration.\n */\n public timer(name: string): () => void {\n const startDate = Date.now();\n const startDuration = performance.now();\n\n return () => {\n const duration = performance.now() - startDuration;\n this.logger.info({\n meta: {\n category: \"performance\"\n },\n message: `${chalk.bold.cyanBright(name)} completed in ${chalk.bold.cyanBright(\n duration < 1000\n ? `${duration.toFixed(2)} milliseconds`\n : formatDistanceToNowStrict(startDate)\n )}`\n });\n };\n }\n\n /**\n * Create a new logger instance\n *\n * @param options - The configuration options to use for the logger instance, which can be used to customize the appearance and behavior of the log messages generated by the logger. This is typically the name of the plugin or module that is creating the logger instance.\n * @param logFn - The custom logging function to use for logging messages, which can be used to override the default logging behavior of the original logger.\n * @returns A logger client instance that can be used to generate log messages with consistent formatting and metadata.\n */\n public createLogger(options: LoggerOptions, logFn?: LogFn): Logger {\n return createLogger(\n this.options.name || this.options.root || \"powerlines\",\n { ...this.configFile.config, ...this.options, ...options },\n logFn\n );\n }\n\n /**\n * Extend the base logger with additional configuration options\n *\n * @param options - The configuration options to extend the base logger with, which can be used to add additional metadata or customize the appearance of log messages generated by the logger. This is typically the name of the plugin or module that is creating the logger instance, as well as any additional metadata such as the plugin category or environment.\n * @returns A new logger client instance that extends the base logger with the provided configuration options.\n */\n public extendLogger(options: LoggerOptions): Logger {\n return extendLogger(this.logger, options);\n }\n\n /**\n * The input options used to initialize the context, which may be used when cloning the context to ensure the same configuration is applied to the new context\n */\n protected initialOptions: EngineOptions = {};\n\n /**\n * The initial configuration provided when initializing the context, which may be used during the setup process to ensure that the configuration is properly merged and applied to the context. This is typically the user configuration provided in the Powerlines configuration file, but may also include additional configuration options provided by plugins or other sources.\n */\n protected initialConfig: DeepPartial<UserConfig> = {};\n\n /**\n * Initialize the context with the provided configuration options and set up the resolver and user configuration file. This method is called during the construction of the context and can also be called when cloning the context to ensure that the new context has the same configuration and resolver setup as the original context.\n *\n * @param options - The configuration options to initialize the context with, which can include properties such as the project root, mode, log level, and other settings that affect the behavior of the context and its plugins.\n * @param initialConfig - The initial configuration to initialize the context with, which is typically the user configuration provided in the Powerlines configuration file. This can also include additional configuration options provided by plugins or other sources that should be merged with the user configuration during initialization\n */\n protected constructor(\n options: EngineOptions,\n initialConfig: DeepPartial<UserConfig> = {}\n ) {\n this.initialOptions = options;\n this.initialConfig = initialConfig;\n }\n\n /**\n * Retrieve the workspace configuration for the current project, if it exists. This function will look for a configuration file in the project root and return its contents as a JavaScript object. If no configuration file is found, it will return undefined.\n *\n * @returns A promise that resolves to the workspace configuration object, or undefined if no configuration file is found.\n */\n protected async getWorkspaceConfig(): Promise<WorkspaceConfig | undefined> {\n return tryGetWorkspaceConfig(\n false,\n this.options || this.initialOptions\n ? {\n cwd:\n this.options?.root || this.initialOptions?.root\n ? appendPath(\n this.options?.root || this.initialOptions?.root || \".\",\n this.options?.cwd || this.initialOptions?.cwd\n )\n : undefined,\n workspaceRoot: this.options?.cwd || this.initialOptions?.cwd\n }\n : undefined\n );\n }\n\n /**\n * Initialize the context with the provided configuration options\n *\n * @remarks\n * This method will set up the resolver and load the user configuration file based on the provided options. It is called during the construction of the context and can also be called when cloning the context to ensure that the new context has the same configuration and resolver setup.\n */\n protected async init() {\n if (!this.powerlinesPath) {\n const powerlinesPath = await resolvePackage(\"powerlines\");\n if (!powerlinesPath) {\n throw new Error(\"Could not resolve `powerlines` package location.\");\n }\n this.powerlinesPath = powerlinesPath;\n }\n\n this.options = defu(this.initialOptions, this.initialConfig, {\n cwd: process.cwd(),\n mode: await this.getDefaultMode(),\n logLevel: await this.getDefaultLogLevel(),\n framework: \"powerlines\"\n }) as RequiredKeys<EngineOptions, \"mode\" | \"cwd\" | \"root\" | \"framework\">;\n\n if (!this.options.root) {\n if (this.options.configFile) {\n const configFile = appendPath(\n this.options.configFile,\n this.options.cwd\n );\n if (!existsSync(configFile)) {\n throw new Error(\n `The user-provided configuration file at \"${\n this.options.configFile\n }\" does not exist. Please ensure this path is correct and try again.`\n );\n }\n if (!isFile(configFile)) {\n throw new Error(\n `The user-provided configuration file at \"${\n this.options.configFile\n }\" is not a file. Please ensure this path is correct and try again.`\n );\n }\n\n this.options.root = relativePath(\n this.options.cwd,\n findFilePath(configFile)\n );\n } else {\n this.options.root = \".\";\n }\n } else {\n this.options.root = replacePath(this.options.root, this.options.cwd);\n }\n\n this.resolver = createResolver({\n workspaceRoot: this.options.cwd,\n root: this.options.root,\n cacheDir: this.envPaths.cache,\n mode: this.options.mode\n });\n\n const projectJsonPath = joinPaths(\n appendPath(this.options.root, this.options.cwd),\n \"project.json\"\n );\n if (existsSync(projectJsonPath)) {\n this.projectJson = await readJsonFile(projectJsonPath);\n }\n\n const packageJsonPath = joinPaths(\n appendPath(this.options.root, this.options.cwd),\n \"package.json\"\n );\n if (existsSync(packageJsonPath)) {\n this.packageJson = await readJsonFile<PackageJson>(packageJsonPath);\n this.options.organization ??= isSetObject(this.packageJson?.author)\n ? kebabCase(this.packageJson?.author?.name)\n : kebabCase(this.packageJson?.author);\n }\n\n this.configFile = await loadUserConfigFile(this.options, this.resolver);\n if (this.configFile.config) {\n if (isSetString(this.configFile.configFile)) {\n this.options.configFile ??= replacePath(\n this.configFile.configFile,\n this.options.cwd\n );\n }\n\n if (!this.options.name) {\n if (\n isSetObject(this.configFile.config) &&\n isSetString((this.configFile.config as UserConfig).name)\n ) {\n this.options.name = (this.configFile.config as UserConfig).name;\n } else if (Array.isArray(this.configFile.config)) {\n for (const config of this.configFile.config) {\n if (\n isSetObject(config) &&\n isSetString((config as UserConfig).name)\n ) {\n this.options.name = (config as UserConfig).name;\n break;\n }\n }\n }\n }\n\n if (!this.options.name) {\n this.options.name = this.projectJson?.name || this.packageJson?.name;\n }\n }\n }\n\n /**\n * Determine the default mode for the current execution based on the environment and workspace configuration. This function will check the `NODE_ENV` environment variable to determine if the current environment is development, production, or test. If `NODE_ENV` is not set, it will look for a `mode` property in the workspace configuration file. If no mode is specified in the workspace configuration, it will default to \"production\".\n *\n * @returns A promise that resolves to the default mode for the current execution, which can be \"development\", \"production\", or \"test\".\n */\n protected async getDefaultMode(): Promise<Mode> {\n const workspaceConfig = await this.getWorkspaceConfig();\n\n return isProduction\n ? \"production\"\n : isDevelopment\n ? \"development\"\n : isTest\n ? \"test\"\n : workspaceConfig?.mode || \"production\";\n }\n\n /**\n * Determine the default log level for the current execution based on the environment and workspace configuration. This function will check the `logLevel` property in the workspace configuration file and resolve it to a `LogLevelResolvedConfig` value. If no log level is specified in the workspace configuration, it will default to \"info\" for development mode and \"warn\" for production mode.\n *\n * @returns A promise that resolves to the default log level for the current execution, which can be \"fatal\", \"error\", \"warn\", \"info\", \"debug\", or \"trace\".\n */\n protected async getDefaultLogLevel(): Promise<LogLevelResolvedConfig> {\n const workspaceConfig = await this.getWorkspaceConfig();\n\n return resolveLogLevel(\n workspaceConfig?.logLevel\n ? workspaceConfig.logLevel === \"success\" ||\n workspaceConfig.logLevel === \"performance\"\n ? \"info\"\n : workspaceConfig.logLevel === \"all\"\n ? \"debug\"\n : workspaceConfig.logLevel === \"fatal\"\n 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,QACZ,KAAK,gBAAgB,QACrB,iBAAiB,QAChB,MAAM,KAAK,gBAAgB,CAC/B"}
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_base_context = require('../base-context-Byizvf4F.cjs');
3
- const require_engine_context = require('../engine-context-CI_0NWIk.cjs');
4
- const require_execution_context = require('../execution-context-BYGFYty0.cjs');
2
+ const require_base_context = require('../base-context-BCG0xN2e.cjs');
3
+ const require_engine_context = require('../engine-context-DOsGtgD9.cjs');
4
+ const require_execution_context = require('../execution-context-DgqxcDDx.cjs');
5
5
 
6
6
  exports.PowerlinesBaseContext = require_base_context.PowerlinesBaseContext;
7
7
  exports.PowerlinesContext = require_execution_context.PowerlinesContext;