@powerlines/engine 0.46.4 → 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.
package/dist/api.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_chunk = require('./chunk-C0xms8kb.cjs');
3
- const require_execution_context = require('./execution-context-Dxa103Qg.cjs');
3
+ const require_execution_context = require('./execution-context-Lj_23Ps4.cjs');
4
4
  const require_tsconfig = require('./tsconfig-BUDqmOaT.cjs');
5
5
  const require_ts_morph = require('./ts-morph-BaLPVAdB.cjs');
6
6
  let _stryke_convert_to_array = require("@stryke/convert/to-array");
package/dist/api.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as mergeConfigs, i as callHook, s as writeMetaFile, t as PowerlinesExecutionContext } from "./execution-context-Bb5pfsyN.mjs";
1
+ import { a as mergeConfigs, i as callHook, s as writeMetaFile, t as PowerlinesExecutionContext } from "./execution-context-D-djno_x.mjs";
2
2
  import { a as isIncludeMatchFound, i as getTsconfigFilePath, r as getParsedTypeScriptConfig } from "./tsconfig-MeFEs21S.mjs";
3
3
  import { n as createProgram } from "./ts-morph-D0CaA37w.mjs";
4
4
  import { toArray } from "@stryke/convert/to-array";
@@ -283,12 +283,14 @@ var PowerlinesBaseContext = class {
283
283
  * @returns A promise that resolves when the package configurations have been loaded and stored in the context.
284
284
  */
285
285
  async resolvePackageConfigs(cwd = this.options.cwd, root = this.options.root) {
286
- const projectJsonPath = (0, _stryke_path.joinPaths)((0, _stryke_path_append.appendPath)(root, cwd), "project.json");
287
- if ((0, node_fs.existsSync)(projectJsonPath)) this.projectJson = await (0, _stryke_fs.readJsonFile)(projectJsonPath);
288
- const packageJsonPath = (0, _stryke_path.joinPaths)((0, _stryke_path_append.appendPath)(root, cwd), "package.json");
289
- if ((0, node_fs.existsSync)(packageJsonPath)) {
290
- this.packageJson = await (0, _stryke_fs.readJsonFile)(packageJsonPath);
291
- 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);
286
+ if (cwd || root) {
287
+ const projectJsonPath = (0, _stryke_path.joinPaths)((0, _stryke_path_append.appendPath)(root || ".", cwd || "."), "project.json");
288
+ if ((0, node_fs.existsSync)(projectJsonPath)) this.projectJson = await (0, _stryke_fs.readJsonFile)(projectJsonPath);
289
+ const packageJsonPath = (0, _stryke_path.joinPaths)((0, _stryke_path_append.appendPath)(root || ".", cwd || "."), "package.json");
290
+ if ((0, node_fs.existsSync)(packageJsonPath)) {
291
+ this.packageJson = await (0, _stryke_fs.readJsonFile)(packageJsonPath);
292
+ 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);
293
+ }
292
294
  }
293
295
  }
294
296
  /**
@@ -280,12 +280,14 @@ var PowerlinesBaseContext = class {
280
280
  * @returns A promise that resolves when the package configurations have been loaded and stored in the context.
281
281
  */
282
282
  async resolvePackageConfigs(cwd = this.options.cwd, root = this.options.root) {
283
- const projectJsonPath = joinPaths(appendPath(root, cwd), "project.json");
284
- if (existsSync(projectJsonPath)) this.projectJson = await readJsonFile(projectJsonPath);
285
- const packageJsonPath = joinPaths(appendPath(root, cwd), "package.json");
286
- if (existsSync(packageJsonPath)) {
287
- this.packageJson = await readJsonFile(packageJsonPath);
288
- this.options.organization ??= isSetObject(this.packageJson?.author) ? kebabCase(this.packageJson?.author?.name) : kebabCase(this.packageJson?.author);
283
+ if (cwd || root) {
284
+ const projectJsonPath = joinPaths(appendPath(root || ".", cwd || "."), "project.json");
285
+ if (existsSync(projectJsonPath)) this.projectJson = await readJsonFile(projectJsonPath);
286
+ const packageJsonPath = joinPaths(appendPath(root || ".", cwd || "."), "package.json");
287
+ if (existsSync(packageJsonPath)) {
288
+ this.packageJson = await readJsonFile(packageJsonPath);
289
+ this.options.organization ??= isSetObject(this.packageJson?.author) ? kebabCase(this.packageJson?.author?.name) : kebabCase(this.packageJson?.author);
290
+ }
289
291
  }
290
292
  }
291
293
  /**
@@ -310,4 +312,4 @@ var PowerlinesBaseContext = class {
310
312
 
311
313
  //#endregion
312
314
  export { PowerlinesBaseContext as t };
313
- //# sourceMappingURL=base-context-DU0NRHDt.mjs.map
315
+ //# sourceMappingURL=base-context-Ce9PuQ9z.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"base-context-DU0NRHDt.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 * 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 await this.resolvePackageConfigs();\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 * Resolve the package configurations for the project by loading the `package.json` and `project.json` files, if they exist. This function will look for these files in the project root and parse their contents as JavaScript objects. The parsed contents will be stored in the context for later use by plugins and other parts of the build process.\n *\n * @remarks\n * The `package.json` file is typically used to store metadata about the project, such as its name, version, dependencies, and other information. The `project.json` file is an optional file that can be used to store additional configuration or metadata specific to the project, and is not required for all projects.\n *\n * @param cwd - The current working directory to look for the package configurations. Defaults to the `cwd` specified in the context configuration.\n * @param root - The root directory of the project to look for the package configurations. Defaults to the `root` specified in the context configuration.\n * @returns A promise that resolves when the package configurations have been loaded and stored in the context.\n */\n protected async resolvePackageConfigs(\n cwd: string = this.options.cwd,\n root: string = this.options.root\n ) {\n const projectJsonPath = joinPaths(appendPath(root, cwd), \"project.json\");\n if (existsSync(projectJsonPath)) {\n this.projectJson = await readJsonFile(projectJsonPath);\n }\n\n const packageJsonPath = joinPaths(appendPath(root, cwd), \"package.json\");\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\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 ? \"error\"\n : workspaceConfig.logLevel\n : undefined,\n this.options?.mode ||\n this.initialOptions?.mode ||\n workspaceConfig?.mode ||\n (await this.getDefaultMode())\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,SAAS,eAAe,SAA6C;AACnE,QAAO,KAAK,SAAS;EACnB,gBAAgB;EAChB,SACE,QAAQ,SAAS,gBACbA,YAAU,QAAQ,UAAU,OAAO,GACnC;EACN,aAAa,QAAQ,SAAS;EAC/B,CAAC;;;;;;;;AASJ,SAAgB,eAAe,SAA0C;CACvE,MAAM,eAAe,WACnBA,YAAU,QAAQ,eAAe,QAAQ,KAAK,EAC9C,eAAe,QAAQ,CACxB;AACD,cAAa,SAAS,WACpBA,YAAU,QAAQ,eAAe,QAAQ,KAAK,EAC9C,eAAe,QAAQ,CACxB;AAED,QAAO;;;;;ACLT,IAAa,wBAAb,MAA0D;CACxD,aAAqB,KAAK,KAAK;;;;CAK/B,AAAO;;;;CAKP,AAAO;;;;CAKP,AAAO;;;;CAQP,AAAO;;;;CAKP,AAAO,cAA+C;;;;CAKtD,AAAO;;;;CAKP,IAAW,SAAiB;AAC1B,SAAO,KAAK,aAAa,EAAE,C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AQ,KAAK,GACzC,UAAU,KAAK,aAAa,OAAO;;;;;;;;CAS3C,MAAgB,iBAAgC;EAC9C,MAAM,kBAAkB,MAAM,KAAK,oBAAoB;AAEvD,SAAO,eACH,eACA,gBACE,gBACA,SACE,SACA,iBAAiB,QAAQ;;;;;;;CAQnC,MAAgB,qBAAsD;EACpE,MAAM,kBAAkB,MAAM,KAAK,oBAAoB;AAEvD,SAAO,gBACL,iBAAiB,WACb,gBAAgB,aAAa,aAC7B,gBAAgB,aAAa,gBAC3B,SACA,gBAAgB,aAAa,QAC3B,UACA,gBAAgB,aAAa,UAC3B,UACA,gBAAgB,WACtB,QACJ,KAAK,SAAS,QACZ,KAAK,gBAAgB,QACrB,iBAAiB,QAChB,MAAM,KAAK,gBAAgB,CAC/B"}
1
+ {"version":3,"file":"base-context-Ce9PuQ9z.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 * 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 await this.resolvePackageConfigs();\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 * Resolve the package configurations for the project by loading the `package.json` and `project.json` files, if they exist. This function will look for these files in the project root and parse their contents as JavaScript objects. The parsed contents will be stored in the context for later use by plugins and other parts of the build process.\n *\n * @remarks\n * The `package.json` file is typically used to store metadata about the project, such as its name, version, dependencies, and other information. The `project.json` file is an optional file that can be used to store additional configuration or metadata specific to the project, and is not required for all projects.\n *\n * @param cwd - The current working directory to look for the package configurations. Defaults to the `cwd` specified in the context configuration.\n * @param root - The root directory of the project to look for the package configurations. Defaults to the `root` specified in the context configuration.\n * @returns A promise that resolves when the package configurations have been loaded and stored in the context.\n */\n protected async resolvePackageConfigs(\n cwd: string = this.options.cwd,\n root: string = this.options.root\n ) {\n if (cwd || root) {\n const projectJsonPath = joinPaths(\n appendPath(root || \".\", cwd || \".\"),\n \"project.json\"\n );\n if (existsSync(projectJsonPath)) {\n this.projectJson = await readJsonFile(projectJsonPath);\n }\n\n const packageJsonPath = joinPaths(\n appendPath(root || \".\", 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 }\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 ? \"error\"\n : workspaceConfig.logLevel\n : undefined,\n this.options?.mode ||\n this.initialOptions?.mode ||\n workspaceConfig?.mode ||\n (await this.getDefaultMode())\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,SAAS,eAAe,SAA6C;AACnE,QAAO,KAAK,SAAS;EACnB,gBAAgB;EAChB,SACE,QAAQ,SAAS,gBACbA,YAAU,QAAQ,UAAU,OAAO,GACnC;EACN,aAAa,QAAQ,SAAS;EAC/B,CAAC;;;;;;;;AASJ,SAAgB,eAAe,SAA0C;CACvE,MAAM,eAAe,WACnBA,YAAU,QAAQ,eAAe,QAAQ,KAAK,EAC9C,eAAe,QAAQ,CACxB;AACD,cAAa,SAAS,WACpBA,YAAU,QAAQ,eAAe,QAAQ,KAAK,EAC9C,eAAe,QAAQ,CACxB;AAED,QAAO;;;;;ACLT,IAAa,wBAAb,MAA0D;CACxD,aAAqB,KAAK,KAAK;;;;CA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tB,WAAW,QAAQ,KAAK,OAAO,IAAI,EACnC,eACD;AACD,OAAI,WAAW,gBAAgB,EAAE;AAC/B,SAAK,cAAc,MAAM,aAA0B,gBAAgB;AACnE,SAAK,QAAQ,iBAAiB,YAAY,KAAK,aAAa,OAAO,GAC/D,UAAU,KAAK,aAAa,QAAQ,KAAK,GACzC,UAAU,KAAK,aAAa,OAAO;;;;;;;;;CAU7C,MAAgB,iBAAgC;EAC9C,MAAM,kBAAkB,MAAM,KAAK,oBAAoB;AAEvD,SAAO,eACH,eACA,gBACE,gBACA,SACE,SACA,iBAAiB,QAAQ;;;;;;;CAQnC,MAAgB,qBAAsD;EACpE,MAAM,kBAAkB,MAAM,KAAK,oBAAoB;AAEvD,SAAO,gBACL,iBAAiB,WACb,gBAAgB,aAAa,aAC7B,gBAAgB,aAAa,gBAC3B,SACA,gBAAgB,aAAa,QAC3B,UACA,gBAAgB,aAAa,UAC3B,UACA,gBAAgB,WACtB,QACJ,KAAK,SAAS,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-D7G_24-i.cjs');
3
- const require_engine_context = require('../engine-context-BuJQY312.cjs');
4
- const require_execution_context = require('../execution-context-Dxa103Qg.cjs');
2
+ const require_base_context = require('../base-context-CbFlRUd-.cjs');
3
+ const require_engine_context = require('../engine-context-D-rpz-J2.cjs');
4
+ const require_execution_context = require('../execution-context-Lj_23Ps4.cjs');
5
5
 
6
6
  exports.PowerlinesBaseContext = require_base_context.PowerlinesBaseContext;
7
7
  exports.PowerlinesContext = require_execution_context.PowerlinesContext;
@@ -1,5 +1,5 @@
1
- import { t as PowerlinesBaseContext } from "../base-context-DU0NRHDt.mjs";
2
- import { t as PowerlinesEngineContext } from "../engine-context-BvDfqfY7.mjs";
3
- import { n as PowerlinesEnvironmentContext, o as PowerlinesContext, r as createPluginContext, t as PowerlinesExecutionContext } from "../execution-context-Bb5pfsyN.mjs";
1
+ import { t as PowerlinesBaseContext } from "../base-context-Ce9PuQ9z.mjs";
2
+ import { t as PowerlinesEngineContext } from "../engine-context-CEbC9dHR.mjs";
3
+ import { n as PowerlinesEnvironmentContext, o as PowerlinesContext, r as createPluginContext, t as PowerlinesExecutionContext } from "../execution-context-D-djno_x.mjs";
4
4
 
5
5
  export { PowerlinesBaseContext, PowerlinesContext, PowerlinesEngineContext, PowerlinesEnvironmentContext, PowerlinesExecutionContext, createPluginContext };
@@ -1,4 +1,4 @@
1
- import { t as PowerlinesBaseContext } from "./base-context-DU0NRHDt.mjs";
1
+ import { t as PowerlinesBaseContext } from "./base-context-Ce9PuQ9z.mjs";
2
2
  import { toArray } from "@stryke/convert/to-array";
3
3
  import { uuid } from "@stryke/unique-id/uuid";
4
4
 
@@ -83,4 +83,4 @@ var PowerlinesEngineContext = class PowerlinesEngineContext extends PowerlinesBa
83
83
 
84
84
  //#endregion
85
85
  export { PowerlinesEngineContext as t };
86
- //# sourceMappingURL=engine-context-BvDfqfY7.mjs.map
86
+ //# sourceMappingURL=engine-context-CEbC9dHR.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"engine-context-BvDfqfY7.mjs","names":["#executions"],"sources":["../src/context/engine-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 {\n EngineContext,\n EngineOptions,\n ExecutionState,\n LogLevelResolvedConfig,\n UserConfig\n} from \"@powerlines/core\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { DeepPartial, RequiredKeys } from \"@stryke/types/base\";\nimport { uuid } from \"@stryke/unique-id/uuid\";\nimport { PowerlinesBaseContext } from \"./base-context\";\n\nexport class PowerlinesEngineContext\n extends PowerlinesBaseContext\n implements EngineContext\n{\n #executions: ExecutionState[] = [];\n\n /**\n * Creates a new instance of the PowerlinesEngineContext class.\n *\n * @param options - The options to initialize the context with.\n * @returns A promise that resolves to an instance of the PowerlinesEngineContext class.\n */\n public static async fromInitialConfig(\n options: EngineOptions,\n initialConfig: DeepPartial<UserConfig> = {}\n ): Promise<PowerlinesEngineContext> {\n const context = new PowerlinesEngineContext(options, initialConfig);\n await context.init();\n\n return context;\n }\n\n /**\n * The initial options provided to the Powerlines process before any resolution or merging. 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 public override readonly initialOptions: EngineOptions;\n\n /**\n * The initial user configuration provided to the Powerlines process before any resolution or merging. 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 public override readonly initialConfig: DeepPartial<UserConfig>;\n\n /**\n * The options provided to the Powerlines process\n */\n public override options: RequiredKeys<\n Omit<EngineOptions, \"logLevel\">,\n \"name\" | \"root\" | \"cwd\" | \"mode\" | \"framework\"\n > & {\n /**\n * The log level to use for logging messages during the build process. This can be a string indicating the log level or a more detailed configuration object that allows for specifying different log levels for different categories of logs.\n */\n logLevel: LogLevelResolvedConfig;\n } = {} as RequiredKeys<\n Omit<EngineOptions, \"logLevel\">,\n \"name\" | \"root\" | \"cwd\" | \"mode\" | \"framework\"\n > & {\n /**\n * The log level to use for logging messages during the build process. This can be a string indicating the log level or a more detailed configuration object that allows for specifying different log levels for different categories of logs.\n */\n logLevel: LogLevelResolvedConfig;\n };\n\n /**\n * Creates a new Context instance.\n *\n * @param options - The options to use for creating the context, including the resolved configuration and workspace settings.\n * @param initialConfig - The initial configuration provided by the user, which can be used to resolve the final configuration for the context. This typically includes the user configuration options defined in the `powerlines.config.ts` file, as well as any inline configuration options provided during execution.\n */\n protected constructor(\n options: EngineOptions,\n initialConfig: DeepPartial<UserConfig> = {}\n ) {\n super(options, initialConfig);\n this.initialOptions = options;\n this.initialConfig = initialConfig;\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 override async init() {\n await super.init();\n\n if (!this.configFile?.config) {\n this.fatal(\n \"No configuration file found. Please ensure you have a valid configuration file in your project.\"\n );\n throw new Error(\"No configuration file found\");\n }\n\n this.#executions = await Promise.all(\n toArray(this.configFile.config).map(async (_, executionIndex) => {\n const executionId = uuid();\n\n return {\n executionId,\n options: {\n cwd: this.options.cwd,\n root: this.options.root,\n configFile: this.options.configFile,\n ...this.initialOptions,\n executionId,\n executionIndex\n },\n active: {\n command: null,\n hook: null,\n plugin: null\n }\n };\n })\n );\n }\n\n /**\n * A list of all command executions that will be run during the lifecycle of the engine\n *\n * @returns An array of {@link ExecutionState} representing each execution context for the engine.\n */\n public get executions(): ExecutionState[] {\n return this.#executions;\n }\n}\n"],"mappings":";;;;;AA8BA,IAAa,0BAAb,MAAa,gCACH,sBAEV;CACE,cAAgC,EAAE;;;;;;;CAQlC,aAAoB,kBAClB,SACA,gBAAyC,EAAE,EACT;EAClC,MAAM,UAAU,IAAI,wBAAwB,SAAS,cAAc;AACnE,QAAM,QAAQ,MAAM;AAEpB,SAAO;;;;;CAMT,AAAyB;;;;CAKzB,AAAyB;;;;CAKzB,AAAgB,UAQZ,EAAE;;;;;;;CAgBN,AAAU,YACR,SACA,gBAAyC,EAAE,EAC3C;AACA,QAAM,SAAS,cAAc;AAC7B,OAAK,iBAAiB;AACtB,OAAK,gBAAgB;;;;;;;;CASvB,MAAyB,OAAO;AAC9B,QAAM,MAAM,MAAM;AAElB,MAAI,CAAC,KAAK,YAAY,QAAQ;AAC5B,QAAK,MACH,kGACD;AACD,SAAM,IAAI,MAAM,8BAA8B;;AAGhD,QAAKA,aAAc,MAAM,QAAQ,IAC/B,QAAQ,KAAK,WAAW,OAAO,CAAC,IAAI,OAAO,GAAG,mBAAmB;GAC/D,MAAM,cAAc,MAAM;AAE1B,UAAO;IACL;IACA,SAAS;KACP,KAAK,KAAK,QAAQ;KAClB,MAAM,KAAK,QAAQ;KACnB,YAAY,KAAK,QAAQ;KACzB,GAAG,KAAK;KACR;KACA;KACD;IACD,QAAQ;KACN,SAAS;KACT,MAAM;KACN,QAAQ;KACT;IACF;IACD,CACH;;;;;;;CAQH,IAAW,aAA+B;AACxC,SAAO,MAAKA"}
1
+ {"version":3,"file":"engine-context-CEbC9dHR.mjs","names":["#executions"],"sources":["../src/context/engine-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 {\n EngineContext,\n EngineOptions,\n ExecutionState,\n LogLevelResolvedConfig,\n UserConfig\n} from \"@powerlines/core\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { DeepPartial, RequiredKeys } from \"@stryke/types/base\";\nimport { uuid } from \"@stryke/unique-id/uuid\";\nimport { PowerlinesBaseContext } from \"./base-context\";\n\nexport class PowerlinesEngineContext\n extends PowerlinesBaseContext\n implements EngineContext\n{\n #executions: ExecutionState[] = [];\n\n /**\n * Creates a new instance of the PowerlinesEngineContext class.\n *\n * @param options - The options to initialize the context with.\n * @returns A promise that resolves to an instance of the PowerlinesEngineContext class.\n */\n public static async fromInitialConfig(\n options: EngineOptions,\n initialConfig: DeepPartial<UserConfig> = {}\n ): Promise<PowerlinesEngineContext> {\n const context = new PowerlinesEngineContext(options, initialConfig);\n await context.init();\n\n return context;\n }\n\n /**\n * The initial options provided to the Powerlines process before any resolution or merging. 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 public override readonly initialOptions: EngineOptions;\n\n /**\n * The initial user configuration provided to the Powerlines process before any resolution or merging. 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 public override readonly initialConfig: DeepPartial<UserConfig>;\n\n /**\n * The options provided to the Powerlines process\n */\n public override options: RequiredKeys<\n Omit<EngineOptions, \"logLevel\">,\n \"name\" | \"root\" | \"cwd\" | \"mode\" | \"framework\"\n > & {\n /**\n * The log level to use for logging messages during the build process. This can be a string indicating the log level or a more detailed configuration object that allows for specifying different log levels for different categories of logs.\n */\n logLevel: LogLevelResolvedConfig;\n } = {} as RequiredKeys<\n Omit<EngineOptions, \"logLevel\">,\n \"name\" | \"root\" | \"cwd\" | \"mode\" | \"framework\"\n > & {\n /**\n * The log level to use for logging messages during the build process. This can be a string indicating the log level or a more detailed configuration object that allows for specifying different log levels for different categories of logs.\n */\n logLevel: LogLevelResolvedConfig;\n };\n\n /**\n * Creates a new Context instance.\n *\n * @param options - The options to use for creating the context, including the resolved configuration and workspace settings.\n * @param initialConfig - The initial configuration provided by the user, which can be used to resolve the final configuration for the context. This typically includes the user configuration options defined in the `powerlines.config.ts` file, as well as any inline configuration options provided during execution.\n */\n protected constructor(\n options: EngineOptions,\n initialConfig: DeepPartial<UserConfig> = {}\n ) {\n super(options, initialConfig);\n this.initialOptions = options;\n this.initialConfig = initialConfig;\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 override async init() {\n await super.init();\n\n if (!this.configFile?.config) {\n this.fatal(\n \"No configuration file found. Please ensure you have a valid configuration file in your project.\"\n );\n throw new Error(\"No configuration file found\");\n }\n\n this.#executions = await Promise.all(\n toArray(this.configFile.config).map(async (_, executionIndex) => {\n const executionId = uuid();\n\n return {\n executionId,\n options: {\n cwd: this.options.cwd,\n root: this.options.root,\n configFile: this.options.configFile,\n ...this.initialOptions,\n executionId,\n executionIndex\n },\n active: {\n command: null,\n hook: null,\n plugin: null\n }\n };\n })\n );\n }\n\n /**\n * A list of all command executions that will be run during the lifecycle of the engine\n *\n * @returns An array of {@link ExecutionState} representing each execution context for the engine.\n */\n public get executions(): ExecutionState[] {\n return this.#executions;\n }\n}\n"],"mappings":";;;;;AA8BA,IAAa,0BAAb,MAAa,gCACH,sBAEV;CACE,cAAgC,EAAE;;;;;;;CAQlC,aAAoB,kBAClB,SACA,gBAAyC,EAAE,EACT;EAClC,MAAM,UAAU,IAAI,wBAAwB,SAAS,cAAc;AACnE,QAAM,QAAQ,MAAM;AAEpB,SAAO;;;;;CAMT,AAAyB;;;;CAKzB,AAAyB;;;;CAKzB,AAAgB,UAQZ,EAAE;;;;;;;CAgBN,AAAU,YACR,SACA,gBAAyC,EAAE,EAC3C;AACA,QAAM,SAAS,cAAc;AAC7B,OAAK,iBAAiB;AACtB,OAAK,gBAAgB;;;;;;;;CASvB,MAAyB,OAAO;AAC9B,QAAM,MAAM,MAAM;AAElB,MAAI,CAAC,KAAK,YAAY,QAAQ;AAC5B,QAAK,MACH,kGACD;AACD,SAAM,IAAI,MAAM,8BAA8B;;AAGhD,QAAKA,aAAc,MAAM,QAAQ,IAC/B,QAAQ,KAAK,WAAW,OAAO,CAAC,IAAI,OAAO,GAAG,mBAAmB;GAC/D,MAAM,cAAc,MAAM;AAE1B,UAAO;IACL;IACA,SAAS;KACP,KAAK,KAAK,QAAQ;KAClB,MAAM,KAAK,QAAQ;KACnB,YAAY,KAAK,QAAQ;KACzB,GAAG,KAAK;KACR;KACA;KACD;IACD,QAAQ;KACN,SAAS;KACT,MAAM;KACN,QAAQ;KACT;IACF;IACD,CACH;;;;;;;CAQH,IAAW,aAA+B;AACxC,SAAO,MAAKA"}
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require('./chunk-C0xms8kb.cjs');
2
- const require_base_context = require('./base-context-D7G_24-i.cjs');
2
+ const require_base_context = require('./base-context-CbFlRUd-.cjs');
3
3
  let _stryke_convert_to_array = require("@stryke/convert/to-array");
4
4
  let _stryke_unique_id_uuid = require("@stryke/unique-id/uuid");
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"execution-context-CghMd-eP.d.cts","names":[],"sources":["../src/context/base-context.ts","../src/context/context.ts","../src/context/execution-context.ts"],"mappings":";;;;;;;;;;;cA6Da,qBAAA,YAAiC,WAAA;EAAA;;;;EAMrC,cAAA;;AANT;;EAWS,QAAA,EAAW,QAAA;EAAA;;;EAKX,OAAA,EAAU,YAAA,CACf,aAAA;EAYkB;;;EALb,WAAA,EAAc,WAAA;EAiCE;;;EA5BhB,WAAA,EAAa,MAAA;EAoEU;;;EA/DvB,UAAA,EAAa,gBAAA;EA4HgC;;;EAAA,IAvHzC,MAAA,CAAA,GAAU,MAAA;EA4IK;;;EAAA,IArIf,SAAA,CAAA;EAAA,IAIA,QAAA,CAAA,GAAY,sBAAA;EAgJN;;;EAAA,IAzIN,QAAA,CAAA,GAAY,QAAA;EAmRW;;;;;EAtQ3B,KAAA,CAAM,OAAA,WAAkB,UAAA;EAtEwB;;;;;EA+EhD,KAAA,CAAM,OAAA,WAAkB,UAAA;EApEb;;;;;EA6EX,IAAA,CAAK,OAAA,WAAkB,UAAA;EA3DvB;;;;;EAoEA,IAAA,CAAK,OAAA,WAAkB,UAAA;EAnDnB;;;;;EA4DJ,KAAA,CAAM,OAAA,WAAkB,UAAA;EApCA;;;;;EA6CxB,KAAA,CAAM,OAAA,WAAkB,UAAA;EA3BD;;;;;;;;;;;;;EA4CvB,KAAA,CAAM,IAAA;EA0BgB;;;;;;;EAAtB,YAAA,CAAa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B,eAAA;EAAA,IAKnB,OAAA,CAAA,GAAW,KAAA,CAAM,MAAA,CAAO,aAAA,CAAc,eAAA;EFwQX;;;;;;EAAA,UE9P7B,WAAA,CACP,OAAA,EAAS,gBAAA,EACT,aAAA,GAAe,eAAA;EF3GV;;;;;;EEwHe,eAAA,CACpB,MAAA,EAAQ,eAAA,mBACP,OAAA;EFxGI;;;;;;;EEkIS,YAAA,CAAa,OAAA,EAAS,aAAA,EAAe,KAAA,GAAQ,KAAA,GAAQ,MAAA;EF7G9C;;;;;;EE8HP,YAAA,CAAa,OAAA,EAAS,aAAA,GAAgB,MAAA;EFjGvB;;;;;;EE+GlB,iBAAA,CACX,WAAA,EAAa,yBAAA,CAA0B,eAAA,mBACtC,OAAA,CAAQ,2BAAA,CAA4B,eAAA;EF/F3B;;;EE0KU,aAAA,CAAA,GAAa,OAAA;EFxJ5B;;;;;EE8KM,SAAA,CAAU,MAAA,EAAQ,MAAA,CAAO,aAAA,CAAc,eAAA,KAAiB,OAAA;EFnIxC;;;;;;EEmJhB,cAAA,CAAe,IAAA,YAAa,OAAA,CAAA,kBAAA,CAAA,eAAA;EFrIrB;;;;;;EE6LP,kBAAA,CACX,IAAA,YACC,OAAA,CAAQ,kBAAA,CAAmB,eAAA;EF3KrB;;;;;;;;EE2LI,aAAA,CAAA,GAAiB,OAAA,CAAQ,kBAAA,CAAmB,eAAA;AAAA"}
1
+ {"version":3,"file":"execution-context-CghMd-eP.d.cts","names":[],"sources":["../src/context/base-context.ts","../src/context/context.ts","../src/context/execution-context.ts"],"mappings":";;;;;;;;;;;cA6Da,qBAAA,YAAiC,WAAA;EAAA;;;;EAMrC,cAAA;;AANT;;EAWS,QAAA,EAAW,QAAA;EAAA;;;EAKX,OAAA,EAAU,YAAA,CACf,aAAA;EAYkB;;;EALb,WAAA,EAAc,WAAA;EAiCE;;;EA5BhB,WAAA,EAAa,MAAA;EAoEU;;;EA/DvB,UAAA,EAAa,gBAAA;EA4HgC;;;EAAA,IAvHzC,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A,eAAA;EFrIrB;;;;;;EE6LP,kBAAA,CACX,IAAA,YACC,OAAA,CAAQ,kBAAA,CAAmB,eAAA;EF3KrB;;;;;;;;EE2LI,aAAA,CAAA,GAAiB,OAAA,CAAQ,kBAAA,CAAmB,eAAA;AAAA"}
@@ -1,4 +1,4 @@
1
- import { t as PowerlinesBaseContext } from "./base-context-DU0NRHDt.mjs";
1
+ import { t as PowerlinesBaseContext } from "./base-context-Ce9PuQ9z.mjs";
2
2
  import { a as FileSystem } from "./fs-D1nIP45P.mjs";
3
3
  import { n as FileSystemStorageAdapter, t as VirtualStorageAdapter } from "./virtual-CYGZHTDd.mjs";
4
4
  import { i as getTsconfigFilePath } from "./tsconfig-MeFEs21S.mjs";
@@ -12,7 +12,7 @@ import { isString } from "@stryke/type-checks/is-string";
12
12
  import { messageParent } from "jest-worker";
13
13
  import { isSetString } from "@stryke/type-checks/is-set-string";
14
14
  import { uuid } from "@stryke/unique-id/uuid";
15
- import { addPluginHook, createLogger, dedupeHooklist, isDuplicate, isPlugin, isPluginConfig, isPluginHook, isPluginHookField, mergeConfig, replacePathTokens, resolveLogLevel, withCustomLogger, withLogFn } from "@powerlines/core/plugin-utils";
15
+ import { addPluginHook, createLogger, dedupeHooklist, getPackageJsonOrganization, isDuplicate, isPlugin, isPluginConfig, isPluginHook, isPluginHookField, mergeConfig, replacePathTokens, resolveLogLevel, withCustomLogger, withLogFn } from "@powerlines/core/plugin-utils";
16
16
  import { colorText } from "@powerlines/core/plugin-utils/logging";
17
17
  import { getEnvPaths } from "@stryke/env/get-env-paths";
18
18
  import { appendPath } from "@stryke/path/append";
@@ -20,9 +20,10 @@ import { replaceExtension, replacePath } from "@stryke/path/replace";
20
20
  import { kebabCase } from "@stryke/string-format/kebab-case";
21
21
  import chalk from "chalk";
22
22
  import defu, { defu as defu$1 } from "defu";
23
+ import { existsSync } from "node:fs";
23
24
  import { joinPaths as joinPaths$1 } from "@stryke/path/join-paths";
24
25
  import { format } from "@powerlines/core/lib/utilities/format";
25
- import { existsSync } from "@stryke/fs/exists";
26
+ import { existsSync as existsSync$1 } from "@stryke/fs/exists";
26
27
  import { getUnique, getUniqueBy } from "@stryke/helpers/get-unique";
27
28
  import { omit } from "@stryke/helpers/omit";
28
29
  import { findFileDotExtensionSafe, findFileExtensionSafe, findFileName, findFilePath, hasFileExtension } from "@stryke/path/file-path-fns";
@@ -38,6 +39,8 @@ import { murmurhash } from "@stryke/hash";
38
39
  import { hashDirectory } from "@stryke/hash/node";
39
40
  import { fetchRequest } from "@stryke/http/fetch";
40
41
  import { isEqual } from "@stryke/path/is-equal";
42
+ import { isRegExp } from "@stryke/type-checks/is-regexp";
43
+ import { isUndefined } from "@stryke/type-checks/is-undefined";
41
44
  import { match, tsconfigPathsToRegExp } from "bundle-require";
42
45
  import { resolveCompatibilityDates } from "compatx";
43
46
  import { create } from "flat-cache";
@@ -51,7 +54,6 @@ import { globToRegex } from "@stryke/path/glob-to-regex";
51
54
  import { isAbsolutePath } from "@stryke/path/is-type";
52
55
  import { slash } from "@stryke/path/slash";
53
56
  import { prettyBytes } from "@stryke/string-format/pretty-bytes";
54
- import { isRegExp } from "@stryke/type-checks/is-regexp";
55
57
  import { Blob } from "node:buffer";
56
58
  import { fileURLToPath } from "node:url";
57
59
  import { getField } from "@stryke/helpers/get-field";
@@ -493,7 +495,7 @@ var VirtualFileSystem = class VirtualFileSystem {
493
495
  static async create(context) {
494
496
  context.debug("Starting virtual file system (VFS) initialization processes...");
495
497
  let result;
496
- if (!context.config.skipCache && existsSync(joinPaths(context.dataPath, "fs.bin"))) {
498
+ if (!context.config.skipCache && existsSync$1(joinPaths(context.dataPath, "fs.bin"))) {
497
499
  const buffer = await readFileBuffer(joinPaths(context.dataPath, "fs.bin"));
498
500
  const fs = new capnp.Message(buffer, false).getRoot(FileSystem);
499
501
  result = new VirtualFileSystem(context, fs);
@@ -527,7 +529,7 @@ var VirtualFileSystem = class VirtualFileSystem {
527
529
  static createSync(context) {
528
530
  context.debug("Starting virtual file system (VFS) initialization processes...");
529
531
  let result;
530
- if (!context.config.skipCache && existsSync(joinPaths(context.dataPath, "fs.bin"))) {
532
+ if (!context.config.skipCache && existsSync$1(joinPaths(context.dataPath, "fs.bin"))) {
531
533
  const buffer = readFileBufferSync(joinPaths(context.dataPath, "fs.bin"));
532
534
  const fs = new capnp.Message(buffer, false).getRoot(FileSystem);
533
535
  result = new VirtualFileSystem(context, fs);
@@ -2033,7 +2035,7 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
2033
2035
  const mergedConfig = this.mergeConfig();
2034
2036
  this.logger.trace({
2035
2037
  meta: { category: "config" },
2036
- message: `Pre-setup Powerlines configuration object: \n --- Merged Config --- \n\n${this.logConfig(mergedConfig)} \n\n --- Initial Options --- \n\n${this.logConfig(this.initialOptions)} \n\n --- Initial Config --- \n\n${this.logConfig(this.initialConfig)} \n\n --- User Config --- \n\n${this.logConfig(this.userConfig)} \n\n --- Inline Config --- \n\n${this.logConfig(this.inlineConfig)} \n\n --- Plugin Config --- \n\n${this.logConfig(this.pluginConfig)} \n\n --- Environment Config --- \n\n${this.logConfig(this.environmentConfig)} \n\n --- Overridden Config --- \n\n${this.logConfig(this.overriddenConfig)}`
2038
+ 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)}`
2037
2039
  });
2038
2040
  mergedConfig.output = defu(mergedConfig.output ?? {}, {
2039
2041
  copy: { assets: [
@@ -2049,14 +2051,17 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
2049
2051
  ] },
2050
2052
  dts: true
2051
2053
  });
2052
- if (!mergedConfig.mode) mergedConfig.mode = "production";
2053
- if (!mergedConfig.framework) mergedConfig.framework = "powerlines";
2054
- if (!mergedConfig.projectType) mergedConfig.projectType = "application";
2055
- if (!mergedConfig.platform) mergedConfig.platform = "neutral";
2054
+ if (isUndefined(mergedConfig.mode)) mergedConfig.mode = await this.getDefaultMode();
2055
+ if (isUndefined(mergedConfig.framework)) mergedConfig.framework = "powerlines";
2056
+ if (isUndefined(mergedConfig.platform)) mergedConfig.platform = "neutral";
2056
2057
  mergedConfig.compatibilityDate = resolveCompatibilityDates(mergedConfig.compatibilityDate, "latest");
2058
+ if (!this.packageJson && existsSync(joinPaths(appendPath(mergedConfig.root, mergedConfig.cwd), "package.json")) || !this.projectJson && existsSync(joinPaths(appendPath(mergedConfig.root, mergedConfig.cwd), "project.json"))) {
2059
+ await this.resolvePackageConfigs(mergedConfig.cwd, mergedConfig.root);
2060
+ if (this.packageJson) mergedConfig.organization ??= getPackageJsonOrganization(this.packageJson) || "powerlines";
2061
+ }
2062
+ if (isUndefined(mergedConfig.projectType)) mergedConfig.projectType = this.projectJson?.projectType || "application";
2057
2063
  this.resolvedConfig = mergedConfig;
2058
2064
  this.#configProxy = this.createConfigProxy();
2059
- if (!this.packageJson) await this.resolvePackageConfigs();
2060
2065
  mergedConfig.input = getUniqueInputs(mergedConfig.input);
2061
2066
  if (mergedConfig.name?.startsWith("@") && mergedConfig.name.split("/").filter(Boolean).length > 1) mergedConfig.name = mergedConfig.name.split("/").filter(Boolean)[1];
2062
2067
  mergedConfig.title ??= titleCase(mergedConfig.name);
@@ -2067,18 +2072,18 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
2067
2072
  ret.push(plugin);
2068
2073
  return ret;
2069
2074
  }, []);
2070
- if (!mergedConfig.logLevel) if (mergedConfig.mode === "development") mergedConfig.logLevel = DEFAULT_DEVELOPMENT_LOG_LEVEL;
2075
+ if (isUndefined(mergedConfig.logLevel)) if (mergedConfig.mode === "development") mergedConfig.logLevel = DEFAULT_DEVELOPMENT_LOG_LEVEL;
2071
2076
  else if (mergedConfig.mode === "test") mergedConfig.logLevel = DEFAULT_TEST_LOG_LEVEL;
2072
2077
  else mergedConfig.logLevel = DEFAULT_PRODUCTION_LOG_LEVEL;
2073
2078
  mergedConfig.logLevel = resolveLogLevel(mergedConfig.logLevel);
2074
- if (mergedConfig.tsconfig) mergedConfig.tsconfig = replacePath(replacePathTokens(this, mergedConfig.tsconfig), mergedConfig.cwd);
2079
+ if (isSetString(mergedConfig.tsconfig)) mergedConfig.tsconfig = replacePath(replacePathTokens(this, mergedConfig.tsconfig), mergedConfig.cwd);
2075
2080
  else mergedConfig.tsconfig = getTsconfigFilePath(mergedConfig.cwd, mergedConfig.root);
2076
2081
  mergedConfig.output.format = getUnique(toArray(mergedConfig.output?.format ?? (mergedConfig.projectType === "library" ? ["cjs", "esm"] : ["esm"])));
2077
- if (mergedConfig.output.path) mergedConfig.output.path = appendPath(replacePathTokens(this, mergedConfig.output.path), mergedConfig.cwd);
2082
+ if (isSetString(mergedConfig.output.path)) mergedConfig.output.path = appendPath(replacePathTokens(this, mergedConfig.output.path), mergedConfig.cwd);
2078
2083
  else mergedConfig.output.path = appendPath(joinPaths(mergedConfig.root, "dist"), mergedConfig.cwd);
2079
2084
  mergedConfig.output.copy ??= {};
2080
- 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;
2081
- else mergedConfig.output.copy.path = appendPath(replacePathTokens(this, mergedConfig.output.copy.path || joinPaths("dist", mergedConfig.root)), mergedConfig.cwd);
2085
+ 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;
2086
+ else mergedConfig.output.copy.path = appendPath(replacePathTokens(this, isSetString(mergedConfig.output.copy.path) ? mergedConfig.output.copy.path : joinPaths("dist", mergedConfig.root)), mergedConfig.cwd);
2082
2087
  if (mergedConfig.output.types !== false) mergedConfig.output.types = appendPath(replacePathTokens(this, mergedConfig.output.types || joinPaths(mergedConfig.root, `${mergedConfig.framework ?? "powerlines"}.d.ts`)), mergedConfig.cwd);
2083
2088
  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) => {
2084
2089
  return {
@@ -2088,11 +2093,11 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
2088
2093
  ignore: isSetObject(asset) && asset.ignore ? toArray(asset.ignore) : void 0
2089
2094
  };
2090
2095
  }), (a) => `${a.input}-${a.glob}-${a.output}`);
2091
- if (!mergedConfig.output?.sourceMap) if (mergedConfig.mode === "development") mergedConfig.output.sourceMap = true;
2096
+ if (isUndefined(mergedConfig.output?.sourceMap)) if (mergedConfig.mode === "development") mergedConfig.output.sourceMap = true;
2092
2097
  else mergedConfig.output.sourceMap = false;
2093
- if (!mergedConfig.output.minify) if (mergedConfig.mode === "production") mergedConfig.output.minify = true;
2098
+ if (isUndefined(mergedConfig.output?.minify)) if (mergedConfig.mode === "production") mergedConfig.output.minify = true;
2094
2099
  else mergedConfig.output.minify = false;
2095
- if (!mergedConfig.output.artifactsPath) mergedConfig.output.artifactsPath = `.${mergedConfig.framework || "powerlines"}`;
2100
+ if (isUndefined(mergedConfig.output?.artifactsPath)) mergedConfig.output.artifactsPath = `.${mergedConfig.framework || "powerlines"}`;
2096
2101
  if (mergedConfig.output.copy && mergedConfig.output.copy.assets) mergedConfig.output.copy.assets = mergedConfig.output.copy.assets.map((asset) => ({
2097
2102
  ...asset,
2098
2103
  glob: replacePathTokens(this, asset.glob),
@@ -2103,14 +2108,14 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
2103
2108
  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;
2104
2109
  this.resolvedConfig = mergedConfig;
2105
2110
  this.#configProxy = this.createConfigProxy();
2106
- this.logger.debug({
2111
+ this.logger.info({
2107
2112
  meta: { category: "config" },
2108
2113
  message: `Resolved Powerlines configuration object: \n${this.logConfig(this.resolvedConfig)}`
2109
2114
  });
2110
2115
  this.#fs ??= await VirtualFileSystem.create(this);
2111
2116
  }
2112
2117
  logConfig(config) {
2113
- return JSON.stringify({
2118
+ return JSON.stringify(Object.fromEntries(Object.entries({
2114
2119
  ...omit(config, [
2115
2120
  "plugins",
2116
2121
  "initialConfig",
@@ -2119,8 +2124,13 @@ var PowerlinesContext = class PowerlinesContext extends PowerlinesBaseContext {
2119
2124
  "pluginConfig",
2120
2125
  "environmentConfig"
2121
2126
  ]),
2127
+ resolve: {
2128
+ ...config.resolve,
2129
+ external: (config.resolve?.external ?? []).filter(Boolean).map((external) => isSetString(external) ? external : isRegExp(external) ? external.source : "<unknown-external>"),
2130
+ noExternal: (config.resolve?.noExternal ?? []).filter(Boolean).map((noExternal) => isSetString(noExternal) ? noExternal : isRegExp(noExternal) ? noExternal.source : "<unknown-no-external>")
2131
+ },
2122
2132
  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>")) : []
2123
- }, null, 2).replace(/"([^"]+)":/g, "$1:").replace(/: "([^"]+)"/g, ": $1");
2133
+ }).sort(([key1], [key2]) => key1.localeCompare(key2))), null, 4).replace(/"([^"]+)":/g, "$1:").replace(/,$/g, "");
2124
2134
  }
2125
2135
  createConfigProxy() {
2126
2136
  return new Proxy(this.resolvedConfig, {
@@ -2692,7 +2702,7 @@ var PowerlinesExecutionContext = class PowerlinesExecutionContext extends Powerl
2692
2702
  await super.setInlineConfig(config);
2693
2703
  if (this.inlineConfig.command === "new") {
2694
2704
  const workspacePackageJsonPath = joinPaths(this.config.cwd, "package.json");
2695
- if (!existsSync(workspacePackageJsonPath)) throw new Error(`The workspace package.json file could not be found at ${workspacePackageJsonPath}`);
2705
+ if (!existsSync$1(workspacePackageJsonPath)) throw new Error(`The workspace package.json file could not be found at ${workspacePackageJsonPath}`);
2696
2706
  this.packageJson = await readJsonFile(workspacePackageJsonPath);
2697
2707
  }
2698
2708
  }
@@ -2849,4 +2859,4 @@ var PowerlinesExecutionContext = class PowerlinesExecutionContext extends Powerl
2849
2859
 
2850
2860
  //#endregion
2851
2861
  export { mergeConfigs as a, callHook as i, PowerlinesEnvironmentContext as n, PowerlinesContext as o, createPluginContext as r, writeMetaFile as s, PowerlinesExecutionContext as t };
2852
- //# sourceMappingURL=execution-context-Bb5pfsyN.mjs.map
2862
+ //# sourceMappingURL=execution-context-D-djno_x.mjs.map