@powerlines/core 0.44.1 → 0.44.2

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.
@@ -3,12 +3,12 @@
3
3
  const DEFAULT_DEVELOPMENT_LOG_LEVEL = {
4
4
  general: "debug",
5
5
  fs: "info",
6
- config: "debug",
6
+ config: "info",
7
7
  plugins: "debug",
8
8
  hooks: "debug",
9
9
  performance: "debug",
10
10
  env: "debug",
11
- ipc: "info",
11
+ ipc: "debug",
12
12
  network: "debug",
13
13
  babel: "debug"
14
14
  };
@@ -2,12 +2,12 @@
2
2
  declare const DEFAULT_DEVELOPMENT_LOG_LEVEL: {
3
3
  readonly general: "debug";
4
4
  readonly fs: "info";
5
- readonly config: "debug";
5
+ readonly config: "info";
6
6
  readonly plugins: "debug";
7
7
  readonly hooks: "debug";
8
8
  readonly performance: "debug";
9
9
  readonly env: "debug";
10
- readonly ipc: "info";
10
+ readonly ipc: "debug";
11
11
  readonly network: "debug";
12
12
  readonly babel: "debug";
13
13
  };
@@ -2,12 +2,12 @@
2
2
  declare const DEFAULT_DEVELOPMENT_LOG_LEVEL: {
3
3
  readonly general: "debug";
4
4
  readonly fs: "info";
5
- readonly config: "debug";
5
+ readonly config: "info";
6
6
  readonly plugins: "debug";
7
7
  readonly hooks: "debug";
8
8
  readonly performance: "debug";
9
9
  readonly env: "debug";
10
- readonly ipc: "info";
10
+ readonly ipc: "debug";
11
11
  readonly network: "debug";
12
12
  readonly babel: "debug";
13
13
  };
@@ -2,12 +2,12 @@
2
2
  const DEFAULT_DEVELOPMENT_LOG_LEVEL = {
3
3
  general: "debug",
4
4
  fs: "info",
5
- config: "debug",
5
+ config: "info",
6
6
  plugins: "debug",
7
7
  hooks: "debug",
8
8
  performance: "debug",
9
9
  env: "debug",
10
- ipc: "info",
10
+ ipc: "debug",
11
11
  network: "debug",
12
12
  babel: "debug"
13
13
  };
@@ -1 +1 @@
1
- {"version":3,"file":"log-level.mjs","names":[],"sources":["../../src/constants/log-level.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\nexport const DEFAULT_DEVELOPMENT_LOG_LEVEL = {\n general: \"debug\",\n fs: \"info\",\n config: \"debug\",\n plugins: \"debug\",\n hooks: \"debug\",\n performance: \"debug\",\n env: \"debug\",\n ipc: \"info\",\n network: \"debug\",\n babel: \"debug\"\n} as const;\n\nexport const DEFAULT_TEST_LOG_LEVEL = {\n general: \"info\",\n fs: \"warn\",\n config: \"warn\",\n plugins: \"warn\",\n hooks: \"warn\",\n performance: \"info\",\n env: \"warn\",\n ipc: \"warn\",\n network: \"warn\",\n babel: \"warn\"\n} as const;\n\nexport const DEFAULT_PRODUCTION_LOG_LEVEL = {\n general: \"info\",\n fs: \"error\",\n config: \"warn\",\n plugins: \"warn\",\n hooks: \"warn\",\n performance: \"info\",\n env: \"error\",\n ipc: \"error\",\n network: \"error\",\n babel: \"warn\"\n} as const;\n"],"mappings":";AAkBA,MAAa,gCAAgC;CAC3C,SAAS;CACT,IAAI;CACJ,QAAQ;CACR,SAAS;CACT,OAAO;CACP,aAAa;CACb,KAAK;CACL,KAAK;CACL,SAAS;CACT,OAAO;CACR;AAED,MAAa,yBAAyB;CACpC,SAAS;CACT,IAAI;CACJ,QAAQ;CACR,SAAS;CACT,OAAO;CACP,aAAa;CACb,KAAK;CACL,KAAK;CACL,SAAS;CACT,OAAO;CACR;AAED,MAAa,+BAA+B;CAC1C,SAAS;CACT,IAAI;CACJ,QAAQ;CACR,SAAS;CACT,OAAO;CACP,aAAa;CACb,KAAK;CACL,KAAK;CACL,SAAS;CACT,OAAO;CACR"}
1
+ {"version":3,"file":"log-level.mjs","names":[],"sources":["../../src/constants/log-level.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\nexport const DEFAULT_DEVELOPMENT_LOG_LEVEL = {\n general: \"debug\",\n fs: \"info\",\n config: \"info\",\n plugins: \"debug\",\n hooks: \"debug\",\n performance: \"debug\",\n env: \"debug\",\n ipc: \"debug\",\n network: \"debug\",\n babel: \"debug\"\n} as const;\n\nexport const DEFAULT_TEST_LOG_LEVEL = {\n general: \"info\",\n fs: \"warn\",\n config: \"warn\",\n plugins: \"warn\",\n hooks: \"warn\",\n performance: \"info\",\n env: \"warn\",\n ipc: \"warn\",\n network: \"warn\",\n babel: \"warn\"\n} as const;\n\nexport const DEFAULT_PRODUCTION_LOG_LEVEL = {\n general: \"info\",\n fs: \"error\",\n config: \"warn\",\n plugins: \"warn\",\n hooks: \"warn\",\n performance: \"info\",\n env: \"error\",\n ipc: \"error\",\n network: \"error\",\n babel: \"warn\"\n} as const;\n"],"mappings":";AAkBA,MAAa,gCAAgC;CAC3C,SAAS;CACT,IAAI;CACJ,QAAQ;CACR,SAAS;CACT,OAAO;CACP,aAAa;CACb,KAAK;CACL,KAAK;CACL,SAAS;CACT,OAAO;CACR;AAED,MAAa,yBAAyB;CACpC,SAAS;CACT,IAAI;CACJ,QAAQ;CACR,SAAS;CACT,OAAO;CACP,aAAa;CACb,KAAK;CACL,KAAK;CACL,SAAS;CACT,OAAO;CACR;AAED,MAAa,+BAA+B;CAC1C,SAAS;CACT,IAAI;CACJ,QAAQ;CACR,SAAS;CACT,OAAO;CACP,aAAa;CACb,KAAK;CACL,KAAK;CACL,SAAS;CACT,OAAO;CACR"}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.mjs","names":[],"sources":["../../../src/lib/unplugin/plugin.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 { Unstable_PluginContext } from \"@powerlines/core/types/_internal\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport type {\n TransformResult,\n UnpluginBuildContext,\n UnpluginContext\n} from \"unplugin\";\nimport { setParseImpl } from \"unplugin\";\nimport { VIRTUAL_MODULE_PREFIX_REGEX } from \"../../constants/virtual-modules\";\nimport { PluginContext } from \"../../types/context\";\nimport { UnpluginFactory } from \"../../types/unplugin\";\nimport { getString } from \"../utilities/source-file\";\nimport { combineContexts } from \"./helpers\";\nimport {\n createUnpluginModuleResolutionFunctions,\n CreateUnpluginModuleResolutionFunctionsOptions\n} from \"./module-resolution\";\n\nexport interface CreateUnpluginResolverOptions extends CreateUnpluginModuleResolutionFunctionsOptions {\n /**\n * A name to use for the unplugin instance. This is used for logging and to generate the plugin name. It does not affect the functionality of the plugin.\n *\n * @remarks\n * If not provided, the plugin will be named \"powerlines\". If provided, the plugin will be named `${name} - Powerlines` (e.g., \"MyPlugin - Powerlines\").\n *\n * @defaultValue \"powerlines\"\n */\n name?: string;\n}\n\n/**\n * Creates a Powerlines unplugin instance.\n *\n * @param context - The plugin context.\n * @returns The unplugin instance.\n */\nexport function createUnpluginResolver<\n TContext extends PluginContext = PluginContext\n>(\n context: TContext,\n options: CreateUnpluginResolverOptions = {}\n): UnpluginFactory<TContext> {\n const ctx = context as unknown as Unstable_PluginContext;\n setParseImpl(ctx.parse);\n\n const name = options.name || \"powerlines\";\n\n return () => {\n const logger = ctx.extendLogger({ source: name });\n logger.debug(`Initializing ${titleCase(name)} plugin`);\n\n try {\n const { resolveId, load } =\n createUnpluginModuleResolutionFunctions<TContext>(context, options);\n\n return {\n name:\n name.toLowerCase() === \"powerlines\"\n ? \"powerlines\"\n : `powerlines:${kebabCase(name)}`,\n api: ctx.$$internal.api,\n resolveId,\n load\n };\n } catch (error) {\n logger.error(error instanceof Error ? error.message : String(error));\n\n throw error;\n }\n };\n}\n\nexport interface CreateUnpluginOptions extends CreateUnpluginResolverOptions {\n /**\n * Whether to silence logging for the plugin hooks. This can be useful for plugins that run frequently or have hooks that are called often, to reduce noise in the logs. When set to `true`, the plugin will not log any messages for its hooks. When set to `false` (the default), the plugin will log messages for its hooks as normal.\n *\n * @defaultValue false\n */\n silenceHookLogging?: boolean;\n}\n\n/**\n * Creates a Powerlines unplugin instance.\n *\n * @param context - The plugin context.\n * @returns The unplugin instance.\n */\nexport function createUnplugin<TContext extends PluginContext = PluginContext>(\n context: TContext,\n options: CreateUnpluginOptions = {}\n): UnpluginFactory<TContext> {\n const ctx = context as unknown as Unstable_PluginContext;\n setParseImpl(ctx.parse);\n\n const name = options.name || \"powerlines\";\n\n return () => {\n const logger = ctx.extendLogger({ source: name });\n logger.debug(`Initializing ${titleCase(name)} plugin`);\n\n try {\n const { resolveId, load } =\n createUnpluginModuleResolutionFunctions<TContext>(context, options);\n\n async function buildStart(this: UnpluginBuildContext) {\n if (!options.silenceHookLogging) {\n logger.debug(\"Powerlines build plugin starting...\");\n }\n\n await ctx.$$internal.callHook(\"buildStart\", {\n sequential: true\n });\n }\n\n async function transform(\n this: UnpluginBuildContext & UnpluginContext,\n code: string,\n id: string\n ): Promise<TransformResult | null | undefined> {\n let transformed: TransformResult | string = code;\n\n for (const hook of ctx.$$internal.environment.selectHooks(\n \"transform\"\n )) {\n const result: TransformResult | string | undefined =\n await hook.handler.apply(combineContexts(ctx, this), [\n getString(transformed),\n id.replace(VIRTUAL_MODULE_PREFIX_REGEX, \"\")\n ]);\n if (result) {\n transformed = result;\n }\n }\n\n return transformed;\n }\n\n async function buildEnd(this: UnpluginBuildContext): Promise<void> {\n if (!options.silenceHookLogging) {\n logger.debug(\"Powerlines build plugin finishing...\");\n }\n\n return ctx.$$internal.callHook(\"buildEnd\", {\n sequential: true\n });\n }\n\n async function writeBundle(): Promise<void> {\n if (!options.silenceHookLogging) {\n logger.debug(\"Finalizing Powerlines project output...\");\n }\n\n return ctx.$$internal.callHook(\"writeBundle\", {\n sequential: true\n });\n }\n\n return {\n name:\n name.toLowerCase() === \"powerlines\"\n ? \"powerlines\"\n : `powerlines:${kebabCase(name)}`,\n api: ctx.$$internal.api,\n resolveId,\n load,\n transform,\n buildStart,\n buildEnd,\n writeBundle,\n vite: {\n sharedDuringBuild: true\n }\n };\n } catch (error) {\n logger.error(error instanceof Error ? error.message : String(error));\n\n throw error;\n }\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;AAuDA,SAAgB,uBAGd,SACA,UAAyC,EAAE,EAChB;CAC3B,MAAM,MAAM;AACZ,cAAa,IAAI,MAAM;CAEvB,MAAM,OAAO,QAAQ,QAAQ;AAE7B,cAAa;EACX,MAAM,SAAS,IAAI,aAAa,EAAE,QAAQ,MAAM,CAAC;AACjD,SAAO,MAAM,gBAAgB,UAAU,KAAK,CAAC,SAAS;AAEtD,MAAI;GACF,MAAM,EAAE,WAAW,SACjB,wCAAkD,SAAS,QAAQ;AAErE,UAAO;IACL,MACE,KAAK,aAAa,KAAK,eACnB,eACA,cAAc,UAAU,KAAK;IACnC,KAAK,IAAI,WAAW;IACpB;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EACJ,mBAAmB,MACpB;IACF;WACM,OAAO;AACd,UAAO,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC;AAEpE,SAAM"}
1
+ {"version":3,"file":"plugin.mjs","names":[],"sources":["../../../src/lib/unplugin/plugin.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 { Unstable_PluginContext } from \"@powerlines/core/types/_internal\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport type {\n TransformResult,\n UnpluginBuildContext,\n UnpluginContext\n} from \"unplugin\";\nimport { setParseImpl } from \"unplugin\";\nimport { VIRTUAL_MODULE_PREFIX_REGEX } from \"../../constants/virtual-modules\";\nimport { PluginContext } from \"../../types/context\";\nimport { UnpluginFactory } from \"../../types/unplugin\";\nimport { getString } from \"../utilities/source-file\";\nimport { combineContexts } from \"./helpers\";\nimport {\n createUnpluginModuleResolutionFunctions,\n CreateUnpluginModuleResolutionFunctionsOptions\n} from \"./module-resolution\";\n\nexport interface CreateUnpluginResolverOptions extends CreateUnpluginModuleResolutionFunctionsOptions {\n /**\n * A name to use for the unplugin instance. This is used for logging and to generate the plugin name. It does not affect the functionality of the plugin.\n *\n * @remarks\n * If not provided, the plugin will be named \"powerlines\". If provided, the plugin will be named `${name} - Powerlines` (e.g., \"MyPlugin - Powerlines\").\n *\n * @defaultValue \"powerlines\"\n */\n name?: string;\n}\n\n/**\n * Creates a Powerlines unplugin instance.\n *\n * @param context - The plugin context.\n * @returns The unplugin instance.\n */\nexport function createUnpluginResolver<\n TContext extends PluginContext = PluginContext\n>(\n context: TContext,\n options: CreateUnpluginResolverOptions = {}\n): UnpluginFactory<TContext> {\n const ctx = context as unknown as Unstable_PluginContext;\n setParseImpl(ctx.parse);\n\n const name = options.name || \"powerlines\";\n\n return () => {\n const logger = ctx.extendLogger({ source: name });\n logger.debug(`Initializing ${titleCase(name)} plugin`);\n\n try {\n const { resolveId, load } =\n createUnpluginModuleResolutionFunctions<TContext>(context, options);\n\n return {\n name:\n name.toLowerCase() === \"powerlines\"\n ? \"powerlines\"\n : `powerlines:${kebabCase(name)}`,\n api: ctx.$$internal.api,\n resolveId,\n load\n };\n } catch (error) {\n logger.error(error instanceof Error ? error.message : String(error));\n\n throw error;\n }\n };\n}\n\nexport interface CreateUnpluginOptions extends CreateUnpluginResolverOptions {\n /**\n * Whether to silence logging for the plugin hooks. This can be useful for plugins that run frequently or have hooks that are called often, to reduce noise in the logs. When set to `true`, the plugin will not log any messages for its hooks. When set to `false` (the default), the plugin will log messages for its hooks as normal.\n *\n * @defaultValue false\n */\n silenceHookLogging?: boolean;\n}\n\n/**\n * Creates a Powerlines unplugin instance.\n *\n * @param context - The plugin context.\n * @returns The unplugin instance.\n */\nexport function createUnplugin<TContext extends PluginContext = PluginContext>(\n context: TContext,\n options: CreateUnpluginOptions = {}\n): UnpluginFactory<TContext> {\n const ctx = context as unknown as Unstable_PluginContext;\n setParseImpl(ctx.parse);\n\n const name = options.name || \"powerlines\";\n\n return () => {\n const logger = ctx.extendLogger({ source: name });\n logger.debug(`Initializing ${titleCase(name)} plugin`);\n\n try {\n const { resolveId, load } =\n createUnpluginModuleResolutionFunctions<TContext>(context, options);\n\n async function buildStart(this: UnpluginBuildContext) {\n if (!options.silenceHookLogging) {\n logger.debug(\"Powerlines build plugin starting...\");\n }\n\n await ctx.$$internal.callHook(\"buildStart\", {\n sequential: true\n });\n }\n\n async function transform(\n this: UnpluginBuildContext & UnpluginContext,\n code: string,\n id: string\n ): Promise<TransformResult | null | undefined> {\n let transformed: TransformResult | string = code;\n\n for (const hook of ctx.$$internal.environment.selectHooks(\n \"transform\"\n )) {\n const result: TransformResult | string | undefined =\n await hook.handler.apply(combineContexts(ctx, this), [\n getString(transformed),\n id.replace(VIRTUAL_MODULE_PREFIX_REGEX, \"\")\n ] as [code: string, id: string]);\n if (result) {\n transformed = result;\n }\n }\n\n return transformed;\n }\n\n async function buildEnd(this: UnpluginBuildContext): Promise<void> {\n if (!options.silenceHookLogging) {\n logger.debug(\"Powerlines build plugin finishing...\");\n }\n\n return ctx.$$internal.callHook(\"buildEnd\", {\n sequential: true\n });\n }\n\n async function writeBundle(): Promise<void> {\n if (!options.silenceHookLogging) {\n logger.debug(\"Finalizing Powerlines project output...\");\n }\n\n return ctx.$$internal.callHook(\"writeBundle\", {\n sequential: true\n });\n }\n\n return {\n name:\n name.toLowerCase() === \"powerlines\"\n ? \"powerlines\"\n : `powerlines:${kebabCase(name)}`,\n api: ctx.$$internal.api,\n resolveId,\n load,\n transform,\n buildStart,\n buildEnd,\n writeBundle,\n vite: {\n sharedDuringBuild: true\n }\n };\n } catch (error) {\n logger.error(error instanceof Error ? error.message : String(error));\n\n throw error;\n }\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;AAuDA,SAAgB,uBAGd,SACA,UAAyC,EAAE,EAChB;CAC3B,MAAM,MAAM;AACZ,cAAa,IAAI,MAAM;CAEvB,MAAM,OAAO,QAAQ,QAAQ;AAE7B,cAAa;EACX,MAAM,SAAS,IAAI,aAAa,EAAE,QAAQ,MAAM,CAAC;AACjD,SAAO,MAAM,gBAAgB,UAAU,KAAK,CAAC,SAAS;AAEtD,MAAI;GACF,MAAM,EAAE,WAAW,SACjB,wCAAkD,SAAS,QAAQ;AAErE,UAAO;IACL,MACE,KAAK,aAAa,KAAK,eACnB,eACA,cAAc,UAAU,KAAK;IACnC,KAAK,IAAI,WAAW;IACpB;IACA;IACD;WACM,OAAO;AACd,UAAO,MAAM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;AACd,UAAO,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC;AAEpE,SAAM"}
@@ -131,7 +131,7 @@ const colorBackground = (text) => {
131
131
  const title = (0, _stryke_string_format_title_case.titleCase)(text);
132
132
  return chalk.default.inverse.hex(getTextColor(title))(` ${title} `);
133
133
  };
134
- const consoleLog = (meta, ...args) => (0, _storm_software_config_tools_logger.getLogFn)((0, _storm_software_config_tools_logger.getLogLevel)(meta.type), { logLevel: "trace" })(`${meta.name ? chalk.default.bold.hex(BRAND_COLOR)((0, _stryke_string_format_kebab_case.kebabCase)(meta.name)) : ""}${meta.command ? chalk.default.hex(BRAND_COLOR)(` (${meta.command})`) : ""}${meta.name ? chalk.default.grey(" > ") : ""}${(meta.source || meta.plugin) && (!meta.name || (0, _stryke_string_format_kebab_case.kebabCase)(meta.source || meta.plugin) !== (0, _stryke_string_format_kebab_case.kebabCase)(meta.name)) ? `${chalk.default.bold.hex(BRAND_COLOR)((0, _stryke_string_format_kebab_case.kebabCase)(meta.source || meta.plugin))}${chalk.default.grey(" > ")}` : ""}${meta.environment && (0, _stryke_string_format_kebab_case.kebabCase)(meta.environment) !== "default" ? `${chalk.default.bold.hex(BRAND_COLOR)((0, _stryke_string_format_kebab_case.kebabCase)(meta.environment))}${chalk.default.grey(" > ")}` : ""}${meta.category && meta.category !== require_logging.LogCategories.GENERAL ? ` ${colorBackground((0, _stryke_string_format_kebab_case.kebabCase)(meta.category))} ` : ""}${args.join(" ")} `.trim());
134
+ const consoleLog = (meta, ...args) => (0, _storm_software_config_tools_logger.getLogFn)((0, _storm_software_config_tools_logger.getLogLevel)(meta.type), { logLevel: "trace" })(`${meta.name ? chalk.default.bold.hex(BRAND_COLOR)((0, _stryke_string_format_kebab_case.kebabCase)(meta.name)) : ""}${meta.command ? chalk.default.hex(BRAND_COLOR)(` (${meta.command})`) : ""}${meta.name ? chalk.default.grey(" > ") : ""}${(meta.source || meta.plugin) && (!meta.name || (0, _stryke_string_format_kebab_case.kebabCase)(meta.source || meta.plugin) !== (0, _stryke_string_format_kebab_case.kebabCase)(meta.name)) ? `${chalk.default.bold.hex(BRAND_COLOR)((0, _stryke_string_format_kebab_case.kebabCase)(meta.source || meta.plugin))}${chalk.default.grey(" > ")}` : ""}${meta.environment && (0, _stryke_string_format_kebab_case.kebabCase)(meta.environment) !== "default" ? `${chalk.default.bold.hex(BRAND_COLOR)((0, _stryke_string_format_kebab_case.kebabCase)(meta.environment))}${chalk.default.grey(" > ")}` : ""}${meta.category && meta.category !== require_logging.LogCategories.GENERAL ? `${colorBackground((0, _stryke_string_format_kebab_case.kebabCase)(meta.category))} ` : ""}${args.join(" ")} `.trim());
135
135
  function isValidLogLevel(logLevel, type) {
136
136
  if (logLevel === require_logging.LogLevels.SILENT) return false;
137
137
  return require_logging.LOG_LEVELS.indexOf(logLevel) >= require_logging.LOG_LEVELS.indexOf(type);
@@ -248,7 +248,7 @@ const withLogger = (logger, secondaryLogger) => {
248
248
  ...secondaryLogger.options,
249
249
  ...logger.options
250
250
  };
251
- return {
251
+ const result = {
252
252
  options,
253
253
  error: validateLogger("error", options.name, options, (message) => {
254
254
  logger.error?.(message);
@@ -271,6 +271,30 @@ const withLogger = (logger, secondaryLogger) => {
271
271
  secondaryLogger.trace?.(message);
272
272
  })
273
273
  };
274
+ result.log = (type, message) => {
275
+ switch (type) {
276
+ case "error":
277
+ result.error(message);
278
+ break;
279
+ case "warn":
280
+ result.warn(message);
281
+ break;
282
+ case "info":
283
+ result.info(message);
284
+ break;
285
+ case "debug":
286
+ result.debug(message);
287
+ break;
288
+ case "trace":
289
+ result.trace(message);
290
+ break;
291
+ case "silent": break;
292
+ default:
293
+ result.info(message);
294
+ break;
295
+ }
296
+ };
297
+ return result;
274
298
  };
275
299
  /**
276
300
  * Create a logging function with a specific name and options.
@@ -280,7 +304,7 @@ const withLogger = (logger, secondaryLogger) => {
280
304
  * @returns A new logger that combines the original logger's options with the custom logger's methods, allowing for customized logging behavior while still maintaining the original logger's configuration.
281
305
  */
282
306
  const withCustomLogger = (logger, customLogger) => {
283
- return {
307
+ const result = {
284
308
  options: logger.options,
285
309
  error: validateCustomLogger("error", logger.options.name, logger.options, logger.error.bind(logger), customLogger.error?.bind(customLogger)),
286
310
  warn: validateCustomLogger("warn", logger.options.name, logger.options, logger.warn.bind(logger), customLogger.warn?.bind(customLogger)),
@@ -288,6 +312,30 @@ const withCustomLogger = (logger, customLogger) => {
288
312
  debug: validateCustomLogger("debug", logger.options.name, logger.options, logger.debug.bind(logger), customLogger.debug?.bind(customLogger)),
289
313
  trace: validateCustomLogger("trace", logger.options.name, logger.options, logger.trace.bind(logger), customLogger.trace?.bind(customLogger))
290
314
  };
315
+ result.log = (type, message) => {
316
+ switch (type) {
317
+ case "error":
318
+ result.error(message);
319
+ break;
320
+ case "warn":
321
+ result.warn(message);
322
+ break;
323
+ case "info":
324
+ result.info(message);
325
+ break;
326
+ case "debug":
327
+ result.debug(message);
328
+ break;
329
+ case "trace":
330
+ result.trace(message);
331
+ break;
332
+ case "silent": break;
333
+ default:
334
+ result.info(message);
335
+ break;
336
+ }
337
+ };
338
+ return result;
291
339
  };
292
340
  const consoleLogger = (type, message) => consoleLog((0, _stryke_type_checks_is_set_string.isSetString)(message) ? {
293
341
  type,
@@ -299,7 +347,7 @@ const consoleLogger = (type, message) => consoleLog((0, _stryke_type_checks_is_s
299
347
  category: require_logging.LogCategories.GENERAL,
300
348
  logId: (0, _stryke_unique_id_uuid.uuid)(),
301
349
  timestamp: Date.now(),
302
- ...message
350
+ ...message.meta
303
351
  }, (0, _stryke_type_checks_is_set_string.isSetString)(message) ? message : message.message);
304
352
  /**
305
353
  * Create a logging function with a specific name and options.
@@ -309,7 +357,7 @@ const consoleLogger = (type, message) => consoleLog((0, _stryke_type_checks_is_s
309
357
  * @returns A logging function.
310
358
  */
311
359
  const createLogger = (name, options, callback = consoleLogger) => {
312
- return {
360
+ const result = {
313
361
  options: {
314
362
  ...options,
315
363
  name
@@ -335,6 +383,30 @@ const createLogger = (name, options, callback = consoleLogger) => {
335
383
  name
336
384
  }, (message) => callback("trace", message))
337
385
  };
386
+ result.log = (type, message) => {
387
+ switch (type) {
388
+ case "error":
389
+ result.error(message);
390
+ break;
391
+ case "warn":
392
+ result.warn(message);
393
+ break;
394
+ case "info":
395
+ result.info(message);
396
+ break;
397
+ case "debug":
398
+ result.debug(message);
399
+ break;
400
+ case "trace":
401
+ result.trace(message);
402
+ break;
403
+ case "silent": break;
404
+ default:
405
+ result.info(message);
406
+ break;
407
+ }
408
+ };
409
+ return result;
338
410
  };
339
411
  /**
340
412
  * Extend a logging function with a specific name, adding a colored badge to the log output.
@@ -364,7 +436,7 @@ const extendLogger = (logger, options) => {
364
436
  ...logger.options,
365
437
  ...options
366
438
  };
367
- return {
439
+ const result = {
368
440
  options: opts,
369
441
  error: validateLogger("error", opts.name, opts, logger.error.bind(logger)),
370
442
  warn: validateLogger("warn", opts.name, opts, logger.warn.bind(logger)),
@@ -372,6 +444,30 @@ const extendLogger = (logger, options) => {
372
444
  debug: validateLogger("debug", opts.name, opts, logger.debug.bind(logger)),
373
445
  trace: validateLogger("trace", opts.name, opts, logger.trace.bind(logger))
374
446
  };
447
+ result.log = (type, message) => {
448
+ switch (type) {
449
+ case "error":
450
+ result.error(message);
451
+ break;
452
+ case "warn":
453
+ result.warn(message);
454
+ break;
455
+ case "info":
456
+ result.info(message);
457
+ break;
458
+ case "debug":
459
+ result.debug(message);
460
+ break;
461
+ case "trace":
462
+ result.trace(message);
463
+ break;
464
+ case "silent": break;
465
+ default:
466
+ result.info(message);
467
+ break;
468
+ }
469
+ };
470
+ return result;
375
471
  };
376
472
 
377
473
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"logging.d.cts","names":[],"sources":["../../src/plugin-utils/logging.ts"],"mappings":";;;;;;AA2DA;;;;;iBAAgB,SAAA,CAAU,QAAA;;;;;AAiC1B;;iBAzBgB,SAAA,CAAU,OAAA,EAAS,iBAAA;;;;;;;;iBAyBn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A;;;;;AA2FH;;cAAa,YAAA,GAAgB,IAAA;;;AAiB7B;;;;cAAa,SAAA,GAAa,IAAA;AAY1B;;;;;AAMA;AANA,cAAa,eAAA,GAAmB,IAAA;AAAA,cAMnB,UAAA,GAAc,IAAA,EAAM,OAAA,KAAY,IAAA;AAAA,iBA2B7B,eAAA,CAAgB,QAAA,EAAU,QAAA,EAAU,IAAA,EAAM,QAAA;AAAA,iBAQ1C,qBAAA,CACd,IAAA,EAAM,QAAA,EACN,QAAA,EAAU,sBAAA,EACV,QAAA,GAAU,WAAA;;;;;AAXZ;;;cAuBa,WAAA,GAAe,IAAA,UAAc,OAAA,EAAS,YAAA,KAAe,KAAA;;;;;;;AAflE;cAoJa,UAAA,GAAc,MAAA,EAAQ,MAAA,EAAQ,eAAA,EAAiB,MAAA,KAAS,MAAA;;;;;;;;cAuFxD,gBAAA,GACX,MAAA,EAAQ,MAAA,EACR,YAAA,EAAc,YAAA,KACb,MAAA;AAAA,cAoEU,aAAA,GACX,IAAA,EAAM,QAAA,EACN,OAAA,WAAkB,aAAA;;;;;;AArSpB;;cAgUa,YAAA,GACX,IAAA,UACA,OAAA,EAAS,aAAA,EACT,QAAA,IACE,IAAA,EAAM,QAAA,EACN,OAAA,WAAkB,aAAA,cAEnB,MAAA;;;;;;;;cAuDU,WAAA,GAAe,KAAA,EAAO,KAAA,EAAO,OAAA,EAAS,YAAA,KAAe,KAAA;;;;;;;;cAsBrD,YAAA,GACX,MAAA,EAAQ,MAAA,EACR,OAAA,EAAS,aAAA,KACR,MAAA"}
@@ -128,7 +128,7 @@ const colorBackground = (text) => {
128
128
  const title = titleCase(text);
129
129
  return chalk.inverse.hex(getTextColor(title))(` ${title} `);
130
130
  };
131
- const consoleLog = (meta, ...args) => getLogFn(getLogLevel(meta.type), { logLevel: "trace" })(`${meta.name ? chalk.bold.hex(BRAND_COLOR)(kebabCase(meta.name)) : ""}${meta.command ? chalk.hex(BRAND_COLOR)(` (${meta.command})`) : ""}${meta.name ? chalk.grey(" > ") : ""}${(meta.source || meta.plugin) && (!meta.name || kebabCase(meta.source || meta.plugin) !== kebabCase(meta.name)) ? `${chalk.bold.hex(BRAND_COLOR)(kebabCase(meta.source || meta.plugin))}${chalk.grey(" > ")}` : ""}${meta.environment && kebabCase(meta.environment) !== "default" ? `${chalk.bold.hex(BRAND_COLOR)(kebabCase(meta.environment))}${chalk.grey(" > ")}` : ""}${meta.category && meta.category !== LogCategories.GENERAL ? ` ${colorBackground(kebabCase(meta.category))} ` : ""}${args.join(" ")} `.trim());
131
+ const consoleLog = (meta, ...args) => getLogFn(getLogLevel(meta.type), { logLevel: "trace" })(`${meta.name ? chalk.bold.hex(BRAND_COLOR)(kebabCase(meta.name)) : ""}${meta.command ? chalk.hex(BRAND_COLOR)(` (${meta.command})`) : ""}${meta.name ? chalk.grey(" > ") : ""}${(meta.source || meta.plugin) && (!meta.name || kebabCase(meta.source || meta.plugin) !== kebabCase(meta.name)) ? `${chalk.bold.hex(BRAND_COLOR)(kebabCase(meta.source || meta.plugin))}${chalk.grey(" > ")}` : ""}${meta.environment && kebabCase(meta.environment) !== "default" ? `${chalk.bold.hex(BRAND_COLOR)(kebabCase(meta.environment))}${chalk.grey(" > ")}` : ""}${meta.category && meta.category !== LogCategories.GENERAL ? `${colorBackground(kebabCase(meta.category))} ` : ""}${args.join(" ")} `.trim());
132
132
  function isValidLogLevel(logLevel, type) {
133
133
  if (logLevel === LogLevels.SILENT) return false;
134
134
  return LOG_LEVELS.indexOf(logLevel) >= LOG_LEVELS.indexOf(type);
@@ -245,7 +245,7 @@ const withLogger = (logger, secondaryLogger) => {
245
245
  ...secondaryLogger.options,
246
246
  ...logger.options
247
247
  };
248
- return {
248
+ const result = {
249
249
  options,
250
250
  error: validateLogger("error", options.name, options, (message) => {
251
251
  logger.error?.(message);
@@ -268,6 +268,30 @@ const withLogger = (logger, secondaryLogger) => {
268
268
  secondaryLogger.trace?.(message);
269
269
  })
270
270
  };
271
+ result.log = (type, message) => {
272
+ switch (type) {
273
+ case "error":
274
+ result.error(message);
275
+ break;
276
+ case "warn":
277
+ result.warn(message);
278
+ break;
279
+ case "info":
280
+ result.info(message);
281
+ break;
282
+ case "debug":
283
+ result.debug(message);
284
+ break;
285
+ case "trace":
286
+ result.trace(message);
287
+ break;
288
+ case "silent": break;
289
+ default:
290
+ result.info(message);
291
+ break;
292
+ }
293
+ };
294
+ return result;
271
295
  };
272
296
  /**
273
297
  * Create a logging function with a specific name and options.
@@ -277,7 +301,7 @@ const withLogger = (logger, secondaryLogger) => {
277
301
  * @returns A new logger that combines the original logger's options with the custom logger's methods, allowing for customized logging behavior while still maintaining the original logger's configuration.
278
302
  */
279
303
  const withCustomLogger = (logger, customLogger) => {
280
- return {
304
+ const result = {
281
305
  options: logger.options,
282
306
  error: validateCustomLogger("error", logger.options.name, logger.options, logger.error.bind(logger), customLogger.error?.bind(customLogger)),
283
307
  warn: validateCustomLogger("warn", logger.options.name, logger.options, logger.warn.bind(logger), customLogger.warn?.bind(customLogger)),
@@ -285,6 +309,30 @@ const withCustomLogger = (logger, customLogger) => {
285
309
  debug: validateCustomLogger("debug", logger.options.name, logger.options, logger.debug.bind(logger), customLogger.debug?.bind(customLogger)),
286
310
  trace: validateCustomLogger("trace", logger.options.name, logger.options, logger.trace.bind(logger), customLogger.trace?.bind(customLogger))
287
311
  };
312
+ result.log = (type, message) => {
313
+ switch (type) {
314
+ case "error":
315
+ result.error(message);
316
+ break;
317
+ case "warn":
318
+ result.warn(message);
319
+ break;
320
+ case "info":
321
+ result.info(message);
322
+ break;
323
+ case "debug":
324
+ result.debug(message);
325
+ break;
326
+ case "trace":
327
+ result.trace(message);
328
+ break;
329
+ case "silent": break;
330
+ default:
331
+ result.info(message);
332
+ break;
333
+ }
334
+ };
335
+ return result;
288
336
  };
289
337
  const consoleLogger = (type, message) => consoleLog(isSetString(message) ? {
290
338
  type,
@@ -296,7 +344,7 @@ const consoleLogger = (type, message) => consoleLog(isSetString(message) ? {
296
344
  category: LogCategories.GENERAL,
297
345
  logId: uuid(),
298
346
  timestamp: Date.now(),
299
- ...message
347
+ ...message.meta
300
348
  }, isSetString(message) ? message : message.message);
301
349
  /**
302
350
  * Create a logging function with a specific name and options.
@@ -306,7 +354,7 @@ const consoleLogger = (type, message) => consoleLog(isSetString(message) ? {
306
354
  * @returns A logging function.
307
355
  */
308
356
  const createLogger = (name, options, callback = consoleLogger) => {
309
- return {
357
+ const result = {
310
358
  options: {
311
359
  ...options,
312
360
  name
@@ -332,6 +380,30 @@ const createLogger = (name, options, callback = consoleLogger) => {
332
380
  name
333
381
  }, (message) => callback("trace", message))
334
382
  };
383
+ result.log = (type, message) => {
384
+ switch (type) {
385
+ case "error":
386
+ result.error(message);
387
+ break;
388
+ case "warn":
389
+ result.warn(message);
390
+ break;
391
+ case "info":
392
+ result.info(message);
393
+ break;
394
+ case "debug":
395
+ result.debug(message);
396
+ break;
397
+ case "trace":
398
+ result.trace(message);
399
+ break;
400
+ case "silent": break;
401
+ default:
402
+ result.info(message);
403
+ break;
404
+ }
405
+ };
406
+ return result;
335
407
  };
336
408
  /**
337
409
  * Extend a logging function with a specific name, adding a colored badge to the log output.
@@ -361,7 +433,7 @@ const extendLogger = (logger, options) => {
361
433
  ...logger.options,
362
434
  ...options
363
435
  };
364
- return {
436
+ const result = {
365
437
  options: opts,
366
438
  error: validateLogger("error", opts.name, opts, logger.error.bind(logger)),
367
439
  warn: validateLogger("warn", opts.name, opts, logger.warn.bind(logger)),
@@ -369,6 +441,30 @@ const extendLogger = (logger, options) => {
369
441
  debug: validateLogger("debug", opts.name, opts, logger.debug.bind(logger)),
370
442
  trace: validateLogger("trace", opts.name, opts, logger.trace.bind(logger))
371
443
  };
444
+ result.log = (type, message) => {
445
+ switch (type) {
446
+ case "error":
447
+ result.error(message);
448
+ break;
449
+ case "warn":
450
+ result.warn(message);
451
+ break;
452
+ case "info":
453
+ result.info(message);
454
+ break;
455
+ case "debug":
456
+ result.debug(message);
457
+ break;
458
+ case "trace":
459
+ result.trace(message);
460
+ break;
461
+ case "silent": break;
462
+ default:
463
+ result.info(message);
464
+ break;
465
+ }
466
+ };
467
+ return result;
372
468
  };
373
469
 
374
470
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"logging.mjs","names":["defu"],"sources":["../../src/plugin-utils/logging.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 { getLogFn, getLogLevel } from \"@storm-software/config-tools/logger\";\nimport { getColor } from \"@storm-software/config-tools/utilities/colors\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { RequiredKeys } from \"@stryke/types/base\";\nimport { uuid } from \"@stryke/unique-id/uuid\";\nimport chalk from \"chalk\";\nimport { defu } from \"defu\";\nimport { DEFAULT_ENVIRONMENT } from \"../constants/environments\";\nimport {\n DEFAULT_DEVELOPMENT_LOG_LEVEL,\n DEFAULT_PRODUCTION_LOG_LEVEL,\n DEFAULT_TEST_LOG_LEVEL\n} from \"../constants/log-level\";\nimport { Mode } from \"../types/config\";\nimport { UnresolvedContext } from \"../types/context\";\nimport type {\n CustomLogger,\n CustomLoggerMessage,\n LogCategory,\n LogFn,\n LogFnMeta,\n LogFnOptions,\n LoggerMessage,\n LoggerOptions,\n LogLevel,\n LogLevelResolvedConfig,\n LogLevelUserConfig,\n LogMeta\n} from \"../types/logging\";\nimport { LOG_LEVELS, LogCategories, Logger, LogLevels } from \"../types/logging\";\n\n/**\n * Determines if the provided log level is considered verbose (debug or trace).\n *\n * @param logLevel - The log level to check, which can be a string or an UnresolvedContext containing the log level in its config.\n * @returns True if the log level is \"debug\" or \"trace\", false otherwise.\n */\nexport function isVerbose(logLevel: string): boolean;\n\n/**\n * Determines if the provided context is considered verbose (debug or trace).\n *\n * @param context - The context to check, which contains the log level in its config.\n * @returns True if the log level is \"debug\" or \"trace\", false otherwise.\n */\nexport function isVerbose(context: UnresolvedContext): boolean;\n\n/**\n * Determines if the provided log level is considered verbose (debug or trace).\n *\n * @param logLevelOrContext - The log level to check, which can be a string or an UnresolvedContext containing the log level in its config.\n * @returns True if the log level is \"debug\" or \"trace\", false otherwise.\n */\nexport function isVerbose(\n logLevelOrContext: string | UnresolvedContext\n): boolean {\n const level = isString(logLevelOrContext)\n ? logLevelOrContext\n : logLevelOrContext.config.logLevel;\n\n return level === \"debug\" || level === \"trace\";\n}\n\n/**\n * Resolves the log level configuration based on the provided log level and mode, returning a complete LogLevelResolvedConfig object that specifies the log level for each log category.\n *\n * @param logLevel - The user-provided log level configuration, which can be a string or an object specifying log levels for each category.\n * @param mode - The current mode of the application (e.g., \"development\", \"test\", \"production\"), which determines the default log levels.\n * @returns A LogLevelResolvedConfig object specifying the log level for each log category.\n */\nexport function resolveLogLevel(\n logLevel?: LogLevelUserConfig,\n mode?: Mode\n): LogLevelResolvedConfig {\n if (logLevel === \"trace\") {\n return {\n general: \"trace\",\n fs: \"trace\",\n performance: \"trace\",\n network: \"trace\",\n plugins: \"trace\",\n hooks: \"trace\",\n env: \"trace\",\n ipc: \"trace\",\n config: \"trace\",\n babel: \"trace\"\n };\n } else if (logLevel === \"silent\") {\n return {\n general: \"silent\",\n fs: \"silent\",\n performance: \"silent\",\n network: \"silent\",\n plugins: \"silent\",\n hooks: \"silent\",\n env: \"silent\",\n ipc: \"silent\",\n config: \"silent\",\n babel: \"silent\"\n };\n }\n\n let defaultLogLevel: LogLevelResolvedConfig;\n if (mode === \"development\") {\n defaultLogLevel = DEFAULT_DEVELOPMENT_LOG_LEVEL;\n } else if (mode === \"test\") {\n defaultLogLevel = DEFAULT_TEST_LOG_LEVEL;\n } else {\n defaultLogLevel = DEFAULT_PRODUCTION_LOG_LEVEL;\n }\n\n if (isSetString(logLevel)) {\n return {\n general: logLevel,\n fs: defaultLogLevel.fs,\n performance: logLevel,\n network: defaultLogLevel.network,\n plugins: logLevel,\n hooks: logLevel,\n env: defaultLogLevel.env,\n ipc: defaultLogLevel.ipc,\n config: defaultLogLevel.config,\n babel: logLevel\n };\n } else if (isSetObject(logLevel)) {\n return defu(logLevel, defaultLogLevel) as LogLevelResolvedConfig;\n }\n\n return defaultLogLevel;\n}\n\nconst BADGE_COLORS = [\n \"#00A0DD\",\n \"#6FCE4E\",\n \"#FBBF24\",\n \"#F43F5E\",\n \"#3B82F6\",\n \"#A855F7\",\n \"#469592\",\n \"#288EDF\",\n \"#D8B4FE\",\n \"#10B981\",\n \"#EF4444\",\n \"#F0EC56\",\n \"#F472B6\",\n \"#22D3EE\",\n \"#EAB308\",\n \"#84CC16\",\n \"#F87171\",\n \"#0EA5E9\",\n \"#D946EF\",\n \"#FACC15\",\n \"#34D399\",\n \"#8B5CF6\"\n] as const;\n\nconst BRAND_COLOR = getColor(\"brand\");\n\n/**\n * Generate a consistent color based on the input text.\n *\n * @param text - The input text to generate the color from.\n * @return A hexadecimal color string.\n */\nexport const getTextColor = (text: string): string => {\n return (\n BADGE_COLORS[\n text\n .split(\"\")\n .map(char => char.charCodeAt(0))\n .reduce((ret, charCode) => ret + charCode, 0) % BADGE_COLORS.length\n ] || BADGE_COLORS[0]\n );\n};\n\n/**\n * Generate a consistent color based on the input text.\n *\n * @param text - The input text to generate the color from.\n * @return A hexadecimal color string.\n */\nexport const colorText = (text: string): string => {\n const title = titleCase(text);\n\n return chalk.hex(getTextColor(title))(title);\n};\n\n/**\n * Generate a consistent color based on the input text.\n *\n * @param text - The input text to generate the color from.\n * @return A hexadecimal color string.\n */\nexport const colorBackground = (text: string): string => {\n const title = titleCase(text);\n\n return chalk.inverse.hex(getTextColor(title))(` ${title} `);\n};\n\nexport const consoleLog = (meta: LogMeta, ...args: string[]) =>\n getLogFn(getLogLevel(meta.type), {\n logLevel: \"trace\"\n })(\n `${meta.name ? chalk.bold.hex(BRAND_COLOR)(kebabCase(meta.name)) : \"\"}${\n meta.command ? chalk.hex(BRAND_COLOR)(` (${meta.command})`) : \"\"\n }${meta.name ? chalk.grey(\" > \") : \"\"}${\n (meta.source || meta.plugin) &&\n (!meta.name ||\n kebabCase(meta.source || meta.plugin) !== kebabCase(meta.name))\n ? `${chalk.bold.hex(BRAND_COLOR)(\n kebabCase(meta.source || meta.plugin)\n )}${chalk.grey(\" > \")}`\n : \"\"\n }${\n meta.environment && kebabCase(meta.environment) !== DEFAULT_ENVIRONMENT\n ? `${chalk.bold.hex(BRAND_COLOR)(\n kebabCase(meta.environment)\n )}${chalk.grey(\" > \")}`\n : \"\"\n }${\n meta.category && meta.category !== LogCategories.GENERAL\n ? ` ${colorBackground(kebabCase(meta.category))} `\n : \"\"\n }${args.join(\" \")} `.trim()\n );\n\nexport function isValidLogLevel(logLevel: LogLevel, type: LogLevel): boolean {\n if (logLevel === LogLevels.SILENT) {\n return false;\n }\n\n return LOG_LEVELS.indexOf(logLevel) >= LOG_LEVELS.indexOf(type);\n}\n\nexport function isValidLogLevelConfig(\n type: LogLevel,\n logLevel: LogLevelResolvedConfig,\n category: LogCategory = LogCategories.GENERAL\n): boolean {\n return isValidLogLevel(logLevel[category], type);\n}\n\n/**\n * Create a logging function with a specific name and options.\n *\n * @param name - The name of the logging function.\n * @param options - The options to configure the logging function, including the source, command, environment, plugin, log level, custom logger, and colors. These options can be used to customize the appearance and behavior of the log messages generated by the logging function.\n * @returns A logging function.\n */\nexport const createLogFn = (name: string, options: LogFnOptions): LogFn => {\n const logLevel = resolveLogLevel(options.logLevel, options.mode);\n\n return (meta: LogFnMeta | LogLevel, ...args: string[]) => {\n const logMeta = isSetObject(meta)\n ? {\n logId: uuid(),\n timestamp: Date.now(),\n category: LogCategories.GENERAL,\n ...options,\n ...meta,\n name\n }\n : {\n logId: uuid(),\n timestamp: Date.now(),\n category: LogCategories.GENERAL,\n ...options,\n type: meta,\n name\n };\n\n if (\n isValidLogLevelConfig(\n logMeta.type,\n logLevel,\n logMeta.category ? logMeta.category : LogCategories.GENERAL\n )\n ) {\n consoleLog(logMeta, ...args);\n }\n };\n};\n\nconst validateLogger = (\n type: LogLevel,\n name: string,\n options: LoggerOptions,\n callback: (message: string | LoggerMessage) => void\n) => {\n const logLevel = resolveLogLevel(options.logLevel, options.mode);\n\n return (message: string | LoggerMessage) => {\n const params = isSetString(message)\n ? {\n name,\n plugin: options.plugin,\n meta: {\n type,\n name,\n category: LogCategories.GENERAL,\n logId: uuid(),\n timestamp: Date.now(),\n ...options\n },\n message\n }\n : {\n name,\n plugin: options.plugin,\n ...message,\n meta: {\n type,\n name,\n category: LogCategories.GENERAL,\n logId: uuid(),\n timestamp: Date.now(),\n plugin: message.plugin,\n ...options,\n ...message.meta\n }\n };\n\n if (isValidLogLevelConfig(type, logLevel, params.meta.category)) {\n callback(params);\n }\n };\n};\n\nconst validateCustomLogger = (\n type: LogLevel,\n name: string,\n options: LoggerOptions,\n callback?: (message: string | LoggerMessage) => void,\n customCallback?: (message: CustomLoggerMessage) => void\n) => {\n const logLevel = resolveLogLevel(options.logLevel, options.mode);\n\n return (message: string | LoggerMessage) => {\n const params = isSetString(message)\n ? {\n name,\n plugin: options.plugin,\n meta: {\n type,\n name,\n category: LogCategories.GENERAL,\n logId: uuid(),\n timestamp: Date.now(),\n ...options\n },\n message\n }\n : {\n name,\n plugin: options.plugin,\n ...message,\n meta: {\n type,\n name,\n category: LogCategories.GENERAL,\n logId: uuid(),\n timestamp: Date.now(),\n plugin: message.plugin,\n ...options,\n ...message.meta\n }\n };\n\n if (isValidLogLevelConfig(type, logLevel, params.meta.category)) {\n callback?.(params);\n customCallback?.(params);\n }\n };\n};\n\n/**\n * Create a logging function with a specific name and options.\n *\n * @param logger - The original logger to wrap with the custom logger.\n * @param secondaryLogger - The custom logger to use for logging messages, which can be used to override the default logging behavior of the original logger.\n * @returns A new logger that combines the original logger's options with the custom logger's methods, allowing for customized logging behavior while still maintaining the original logger's configuration.\n */\nexport const withLogger = (logger: Logger, secondaryLogger: Logger): Logger => {\n const options = { ...secondaryLogger.options, ...logger.options };\n\n return {\n options,\n error: validateLogger(\n \"error\",\n options.name!,\n options,\n (message: string | LoggerMessage) => {\n logger.error?.(message);\n secondaryLogger.error?.(message);\n }\n ),\n warn: validateLogger(\n \"warn\",\n options.name!,\n options,\n (message: string | LoggerMessage) => {\n logger.warn?.(message);\n secondaryLogger.warn?.(message);\n }\n ),\n info: validateLogger(\n \"info\",\n options.name!,\n options,\n (message: string | LoggerMessage) => {\n logger.info?.(message);\n secondaryLogger.info?.(message);\n }\n ),\n debug: validateLogger(\n \"debug\",\n options.name!,\n options,\n (message: string | LoggerMessage) => {\n logger.debug?.(message);\n secondaryLogger.debug?.(message);\n }\n ),\n trace: validateLogger(\n \"trace\",\n options.name!,\n options,\n (message: string | LoggerMessage) => {\n logger.trace?.(message);\n secondaryLogger.trace?.(message);\n }\n )\n };\n};\n\n/**\n * Create a logging function with a specific name and options.\n *\n * @param logger - The original logger to wrap with the custom logger.\n * @param customLogger - The custom logger to use for logging messages, which can be used to override the default logging behavior of the original logger.\n * @returns A new logger that combines the original logger's options with the custom logger's methods, allowing for customized logging behavior while still maintaining the original logger's configuration.\n */\nexport const withCustomLogger = (\n logger: Logger,\n customLogger: CustomLogger\n): Logger => {\n return {\n options: logger.options,\n error: validateCustomLogger(\n \"error\",\n logger.options.name!,\n logger.options,\n logger.error.bind(logger),\n customLogger.error?.bind(customLogger)\n ),\n warn: validateCustomLogger(\n \"warn\",\n logger.options.name!,\n logger.options,\n logger.warn.bind(logger),\n customLogger.warn?.bind(customLogger)\n ),\n info: validateCustomLogger(\n \"info\",\n logger.options.name!,\n logger.options,\n logger.info.bind(logger),\n customLogger.info?.bind(customLogger)\n ),\n debug: validateCustomLogger(\n \"debug\",\n logger.options.name!,\n logger.options,\n logger.debug.bind(logger),\n customLogger.debug?.bind(customLogger)\n ),\n trace: validateCustomLogger(\n \"trace\",\n logger.options.name!,\n logger.options,\n logger.trace.bind(logger),\n customLogger.trace?.bind(customLogger)\n )\n };\n};\n\nexport const consoleLogger = (\n type: LogLevel,\n message: string | LoggerMessage\n) =>\n consoleLog(\n isSetString(message)\n ? {\n type,\n category: LogCategories.GENERAL,\n logId: uuid(),\n timestamp: Date.now()\n }\n : {\n type,\n category: LogCategories.GENERAL,\n logId: uuid(),\n timestamp: Date.now(),\n ...message\n },\n isSetString(message) ? message : message.message\n );\n\n/**\n * Create a logging function with a specific name and options.\n *\n * @param name - The name of the logging function.\n * @param options - The options to configure the logging function, including the source, command, environment, plugin, log level, custom logger, and colors. These options can be used to customize the appearance and behavior of the log messages generated by the logging function.\n * @returns A logging function.\n */\nexport const createLogger = (\n name: string,\n options: LoggerOptions,\n callback: (\n type: LogLevel,\n message: string | LoggerMessage\n ) => void = consoleLogger\n): Logger => {\n return {\n options: { ...options, name },\n error: validateLogger(\"error\", name, { ...options, name }, message =>\n callback(\"error\", message)\n ),\n warn: validateLogger(\"warn\", name, { ...options, name }, message =>\n callback(\"warn\", message)\n ),\n info: validateLogger(\"info\", name, { ...options, name }, message =>\n callback(\"info\", message)\n ),\n debug: validateLogger(\"debug\", name, { ...options, name }, message =>\n callback(\"debug\", message)\n ),\n trace: validateLogger(\"trace\", name, { ...options, name }, message =>\n callback(\"trace\", message)\n )\n };\n};\n\n/**\n * Extend a logging function with a specific name, adding a colored badge to the log output.\n *\n * @param logFn - The original logging function to extend.\n * @param options - The overlay metadata to use for the badge in the log output.\n * @returns A new logging function that includes the badge in its output.\n */\nexport const extendLogFn = (logFn: LogFn, options: LogFnOptions): LogFn => {\n return (meta, ...args) =>\n options.source || options.category\n ? logFn(\n isSetObject(meta)\n ? { ...options, ...meta }\n : { ...options, type: meta },\n `${colorBackground(String(options.source || options.category))} ${args\n .filter(Boolean)\n .map(arg => String(arg).trim())\n .join(\" \")} `\n )\n : logFn(meta, ...args);\n};\n\n/**\n * Extend a logger with a specific name and options, adding a colored badge to the log output for each log message generated by the logger.\n *\n * @param logger - The original logger to extend.\n * @param options - The options to configure the logging function, including the source, command, environment, plugin, log level, custom logger, and colors. These options can be used to customize the appearance and behavior of the log messages generated by the extended logger.\n * @returns A new logger that includes the badge in its output for each log message.\n */\nexport const extendLogger = (\n logger: Logger,\n options: LoggerOptions\n): Logger => {\n const opts = { ...logger.options, ...options } as RequiredKeys<\n LoggerOptions,\n \"name\"\n >;\n\n return {\n options: opts,\n error: validateLogger(\"error\", opts.name, opts, logger.error.bind(logger)),\n warn: validateLogger(\"warn\", opts.name, opts, logger.warn.bind(logger)),\n info: validateLogger(\"info\", opts.name, opts, logger.info.bind(logger)),\n debug: validateLogger(\"debug\", opts.name, opts, logger.debug.bind(logger)),\n trace: validateLogger(\"trace\", opts.name, opts, logger.trace.bind(logger))\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA2EA,SAAgB,UACd,mBACS;CACT,MAAM,QAAQ,SAAS,kBAAkB,GACrC,oBACA,kBAAkB,OAAO;AAE7B,QAAO,UAAU,WAAW,UAAU;;;;;;;;;AAUxC,SAAgB,gBACd,UACA,MACwB;AACxB,KAAI,aAAa,QACf,QAAO;EACL,SAAS;EACT,IAAI;EACJ,aAAa;EACb,SAAS;EACT,SAAS;EACT,OAAO;EACP,KAAK;EACL,KAAK;EACL,QAAQ;EACR,OAAO;EACR;UACQ,aAAa,SACtB,QAAO;EACL,SAAS;EACT,IAAI;EACJ,aAAa;EACb,SAAS;EACT,SAAS;EACT,OAAO;EACP,KAAK;EACL,KAAK;EACL,QAAQ;EACR,OAAO;EACR;CAGH,IAAI;AACJ,KAAI,SAAS,cACX,mBA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AAC;EAC1E,MAAM,eAAe,QAAQ,KAAK,MAAM,MAAM,OAAO,KAAK,KAAK,OAAO,CAAC;EACvE,MAAM,eAAe,QAAQ,KAAK,MAAM,MAAM,OAAO,KAAK,KAAK,OAAO,CAAC;EACvE,OAAO,eAAe,SAAS,KAAK,MAAM,MAAM,OAAO,MAAM,KAAK,OAAO,CAAC;EAC1E,OAAO,eAAe,SAAS,KAAK,MAAM,MAAM,OAAO,MAAM,KAAK,OAAO,CAAC;EAC3E"}
1
+ {"version":3,"file":"logging.mjs","names":["defu"],"sources":["../../src/plugin-utils/logging.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 { getLogFn, getLogLevel } from \"@storm-software/config-tools/logger\";\nimport { getColor } from \"@storm-software/config-tools/utilities/colors\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { RequiredKeys } from \"@stryke/types/base\";\nimport { uuid } from \"@stryke/unique-id/uuid\";\nimport chalk from \"chalk\";\nimport { defu } from \"defu\";\nimport { DEFAULT_ENVIRONMENT } from \"../constants/environments\";\nimport {\n DEFAULT_DEVELOPMENT_LOG_LEVEL,\n DEFAULT_PRODUCTION_LOG_LEVEL,\n DEFAULT_TEST_LOG_LEVEL\n} from \"../constants/log-level\";\nimport { Mode } from \"../types/config\";\nimport { UnresolvedContext } from \"../types/context\";\nimport type {\n CustomLogger,\n CustomLoggerMessage,\n LogCategory,\n LogFn,\n LogFnMeta,\n LogFnOptions,\n LoggerMessage,\n LoggerOptions,\n LogLevel,\n LogLevelResolvedConfig,\n LogLevelUserConfig,\n LogMeta\n} from \"../types/logging\";\nimport { LOG_LEVELS, LogCategories, Logger, LogLevels } from \"../types/logging\";\n\n/**\n * Determines if the provided log level is considered verbose (debug or trace).\n *\n * @param logLevel - The log level to check, which can be a string or an UnresolvedContext containing the log level in its config.\n * @returns True if the log level is \"debug\" or \"trace\", false otherwise.\n */\nexport function isVerbose(logLevel: string): boolean;\n\n/**\n * Determines if the provided context is considered verbose (debug or trace).\n *\n * @param context - The context to check, which contains the log level in its config.\n * @returns True if the log level is \"debug\" or \"trace\", false otherwise.\n */\nexport function isVerbose(context: UnresolvedContext): boolean;\n\n/**\n * Determines if the provided log level is considered verbose (debug or trace).\n *\n * @param logLevelOrContext - The log level to check, which can be a string or an UnresolvedContext containing the log level in its config.\n * @returns True if the log level is \"debug\" or \"trace\", false otherwise.\n */\nexport function isVerbose(\n logLevelOrContext: string | UnresolvedContext\n): boolean {\n const level = isString(logLevelOrContext)\n ? logLevelOrContext\n : logLevelOrContext.config.logLevel;\n\n return level === \"debug\" || level === \"trace\";\n}\n\n/**\n * Resolves the log level configuration based on the provided log level and mode, returning a complete LogLevelResolvedConfig object that specifies the log level for each log category.\n *\n * @param logLevel - The user-provided log level configuration, which can be a string or an object specifying log levels for each category.\n * @param mode - The current mode of the application (e.g., \"development\", \"test\", \"production\"), which determines the default log levels.\n * @returns A LogLevelResolvedConfig object specifying the log level for each log category.\n */\nexport function resolveLogLevel(\n logLevel?: LogLevelUserConfig,\n mode?: Mode\n): LogLevelResolvedConfig {\n if (logLevel === \"trace\") {\n return {\n general: \"trace\",\n fs: \"trace\",\n performance: \"trace\",\n network: \"trace\",\n plugins: \"trace\",\n hooks: \"trace\",\n env: \"trace\",\n ipc: \"trace\",\n config: \"trace\",\n babel: \"trace\"\n };\n } else if (logLevel === \"silent\") {\n return {\n general: \"silent\",\n fs: \"silent\",\n performance: \"silent\",\n network: \"silent\",\n plugins: \"silent\",\n hooks: \"silent\",\n env: \"silent\",\n ipc: \"silent\",\n config: \"silent\",\n babel: \"silent\"\n };\n }\n\n let defaultLogLevel: LogLevelResolvedConfig;\n if (mode === \"development\") {\n defaultLogLevel = DEFAULT_DEVELOPMENT_LOG_LEVEL;\n } else if (mode === \"test\") {\n defaultLogLevel = DEFAULT_TEST_LOG_LEVEL;\n } else {\n defaultLogLevel = DEFAULT_PRODUCTION_LOG_LEVEL;\n }\n\n if (isSetString(logLevel)) {\n return {\n general: logLevel,\n fs: defaultLogLevel.fs,\n performance: logLevel,\n network: defaultLogLevel.network,\n plugins: logLevel,\n hooks: logLevel,\n env: defaultLogLevel.env,\n ipc: defaultLogLevel.ipc,\n config: defaultLogLevel.config,\n babel: logLevel\n };\n } else if (isSetObject(logLevel)) {\n return defu(logLevel, defaultLogLevel) as LogLevelResolvedConfig;\n }\n\n return defaultLogLevel;\n}\n\nconst BADGE_COLORS = [\n \"#00A0DD\",\n \"#6FCE4E\",\n \"#FBBF24\",\n \"#F43F5E\",\n \"#3B82F6\",\n \"#A855F7\",\n \"#469592\",\n \"#288EDF\",\n \"#D8B4FE\",\n \"#10B981\",\n \"#EF4444\",\n \"#F0EC56\",\n \"#F472B6\",\n \"#22D3EE\",\n \"#EAB308\",\n \"#84CC16\",\n \"#F87171\",\n \"#0EA5E9\",\n \"#D946EF\",\n \"#FACC15\",\n \"#34D399\",\n \"#8B5CF6\"\n] as const;\n\nconst BRAND_COLOR = getColor(\"brand\");\n\n/**\n * Generate a consistent color based on the input text.\n *\n * @param text - The input text to generate the color from.\n * @return A hexadecimal color string.\n */\nexport const getTextColor = (text: string): string => {\n return (\n BADGE_COLORS[\n text\n .split(\"\")\n .map(char => char.charCodeAt(0))\n .reduce((ret, charCode) => ret + charCode, 0) % BADGE_COLORS.length\n ] || BADGE_COLORS[0]\n );\n};\n\n/**\n * Generate a consistent color based on the input text.\n *\n * @param text - The input text to generate the color from.\n * @return A hexadecimal color string.\n */\nexport const colorText = (text: string): string => {\n const title = titleCase(text);\n\n return chalk.hex(getTextColor(title))(title);\n};\n\n/**\n * Generate a consistent color based on the input text.\n *\n * @param text - The input text to generate the color from.\n * @return A hexadecimal color string.\n */\nexport const colorBackground = (text: string): string => {\n const title = titleCase(text);\n\n return chalk.inverse.hex(getTextColor(title))(` ${title} `);\n};\n\nexport const consoleLog = (meta: LogMeta, ...args: string[]) =>\n getLogFn(getLogLevel(meta.type), {\n logLevel: \"trace\"\n })(\n `${meta.name ? chalk.bold.hex(BRAND_COLOR)(kebabCase(meta.name)) : \"\"}${\n meta.command ? chalk.hex(BRAND_COLOR)(` (${meta.command})`) : \"\"\n }${meta.name ? chalk.grey(\" > \") : \"\"}${\n (meta.source || meta.plugin) &&\n (!meta.name ||\n kebabCase(meta.source || meta.plugin) !== kebabCase(meta.name))\n ? `${chalk.bold.hex(BRAND_COLOR)(\n kebabCase(meta.source || meta.plugin)\n )}${chalk.grey(\" > \")}`\n : \"\"\n }${\n meta.environment && kebabCase(meta.environment) !== DEFAULT_ENVIRONMENT\n ? `${chalk.bold.hex(BRAND_COLOR)(\n kebabCase(meta.environment)\n )}${chalk.grey(\" > \")}`\n : \"\"\n }${\n meta.category && meta.category !== LogCategories.GENERAL\n ? `${colorBackground(kebabCase(meta.category))} `\n : \"\"\n }${args.join(\" \")} `.trim()\n );\n\nexport function isValidLogLevel(logLevel: LogLevel, type: LogLevel): boolean {\n if (logLevel === LogLevels.SILENT) {\n return false;\n }\n\n return LOG_LEVELS.indexOf(logLevel) >= LOG_LEVELS.indexOf(type);\n}\n\nexport function isValidLogLevelConfig(\n type: LogLevel,\n logLevel: LogLevelResolvedConfig,\n category: LogCategory = LogCategories.GENERAL\n): boolean {\n return isValidLogLevel(logLevel[category], type);\n}\n\n/**\n * Create a logging function with a specific name and options.\n *\n * @param name - The name of the logging function.\n * @param options - The options to configure the logging function, including the source, command, environment, plugin, log level, custom logger, and colors. These options can be used to customize the appearance and behavior of the log messages generated by the logging function.\n * @returns A logging function.\n */\nexport const createLogFn = (name: string, options: LogFnOptions): LogFn => {\n const logLevel = resolveLogLevel(options.logLevel, options.mode);\n\n return (meta: LogFnMeta | LogLevel, ...args: string[]) => {\n const logMeta = isSetObject(meta)\n ? {\n logId: uuid(),\n timestamp: Date.now(),\n category: LogCategories.GENERAL,\n ...options,\n ...meta,\n name\n }\n : {\n logId: uuid(),\n timestamp: Date.now(),\n category: LogCategories.GENERAL,\n ...options,\n type: meta,\n name\n };\n\n if (\n isValidLogLevelConfig(\n logMeta.type,\n logLevel,\n logMeta.category ? logMeta.category : LogCategories.GENERAL\n )\n ) {\n consoleLog(logMeta, ...args);\n }\n };\n};\n\nconst validateLogger = (\n type: LogLevel,\n name: string,\n options: LoggerOptions,\n callback: (message: string | LoggerMessage) => void\n) => {\n const logLevel = resolveLogLevel(options.logLevel, options.mode);\n\n return (message: string | LoggerMessage) => {\n const params = isSetString(message)\n ? {\n name,\n plugin: options.plugin,\n meta: {\n type,\n name,\n category: LogCategories.GENERAL,\n logId: uuid(),\n timestamp: Date.now(),\n ...options\n },\n message\n }\n : {\n name,\n plugin: options.plugin,\n ...message,\n meta: {\n type,\n name,\n category: LogCategories.GENERAL,\n logId: uuid(),\n timestamp: Date.now(),\n plugin: message.plugin,\n ...options,\n ...message.meta\n }\n };\n\n if (isValidLogLevelConfig(type, logLevel, params.meta.category)) {\n callback(params);\n }\n };\n};\n\nconst validateCustomLogger = (\n type: LogLevel,\n name: string,\n options: LoggerOptions,\n callback?: (message: string | LoggerMessage) => void,\n customCallback?: (message: CustomLoggerMessage) => void\n) => {\n const logLevel = resolveLogLevel(options.logLevel, options.mode);\n\n return (message: string | LoggerMessage) => {\n const params = isSetString(message)\n ? {\n name,\n plugin: options.plugin,\n meta: {\n type,\n name,\n category: LogCategories.GENERAL,\n logId: uuid(),\n timestamp: Date.now(),\n ...options\n },\n message\n }\n : {\n name,\n plugin: options.plugin,\n ...message,\n meta: {\n type,\n name,\n category: LogCategories.GENERAL,\n logId: uuid(),\n timestamp: Date.now(),\n plugin: message.plugin,\n ...options,\n ...message.meta\n }\n };\n\n if (isValidLogLevelConfig(type, logLevel, params.meta.category)) {\n callback?.(params);\n customCallback?.(params);\n }\n };\n};\n\n/**\n * Create a logging function with a specific name and options.\n *\n * @param logger - The original logger to wrap with the custom logger.\n * @param secondaryLogger - The custom logger to use for logging messages, which can be used to override the default logging behavior of the original logger.\n * @returns A new logger that combines the original logger's options with the custom logger's methods, allowing for customized logging behavior while still maintaining the original logger's configuration.\n */\nexport const withLogger = (logger: Logger, secondaryLogger: Logger): Logger => {\n const options = { ...secondaryLogger.options, ...logger.options };\n\n const result = {\n options,\n error: validateLogger(\n \"error\",\n options.name!,\n options,\n (message: string | LoggerMessage) => {\n logger.error?.(message);\n secondaryLogger.error?.(message);\n }\n ),\n warn: validateLogger(\n \"warn\",\n options.name!,\n options,\n (message: string | LoggerMessage) => {\n logger.warn?.(message);\n secondaryLogger.warn?.(message);\n }\n ),\n info: validateLogger(\n \"info\",\n options.name!,\n options,\n (message: string | LoggerMessage) => {\n logger.info?.(message);\n secondaryLogger.info?.(message);\n }\n ),\n debug: validateLogger(\n \"debug\",\n options.name!,\n options,\n (message: string | LoggerMessage) => {\n logger.debug?.(message);\n secondaryLogger.debug?.(message);\n }\n ),\n trace: validateLogger(\n \"trace\",\n options.name!,\n options,\n (message: string | LoggerMessage) => {\n logger.trace?.(message);\n secondaryLogger.trace?.(message);\n }\n )\n } as Logger;\n\n result.log = (type: LogLevel, message: string | LoggerMessage) => {\n switch (type) {\n case \"error\":\n result.error(message);\n break;\n case \"warn\":\n result.warn(message);\n break;\n case \"info\":\n result.info(message);\n break;\n case \"debug\":\n result.debug(message);\n break;\n case \"trace\":\n result.trace(message);\n break;\n case \"silent\":\n break;\n default:\n result.info(message);\n break;\n }\n };\n\n return result;\n};\n\n/**\n * Create a logging function with a specific name and options.\n *\n * @param logger - The original logger to wrap with the custom logger.\n * @param customLogger - The custom logger to use for logging messages, which can be used to override the default logging behavior of the original logger.\n * @returns A new logger that combines the original logger's options with the custom logger's methods, allowing for customized logging behavior while still maintaining the original logger's configuration.\n */\nexport const withCustomLogger = (\n logger: Logger,\n customLogger: CustomLogger\n): Logger => {\n const result = {\n options: logger.options,\n error: validateCustomLogger(\n \"error\",\n logger.options.name!,\n logger.options,\n logger.error.bind(logger),\n customLogger.error?.bind(customLogger)\n ),\n warn: validateCustomLogger(\n \"warn\",\n logger.options.name!,\n logger.options,\n logger.warn.bind(logger),\n customLogger.warn?.bind(customLogger)\n ),\n info: validateCustomLogger(\n \"info\",\n logger.options.name!,\n logger.options,\n logger.info.bind(logger),\n customLogger.info?.bind(customLogger)\n ),\n debug: validateCustomLogger(\n \"debug\",\n logger.options.name!,\n logger.options,\n logger.debug.bind(logger),\n customLogger.debug?.bind(customLogger)\n ),\n trace: validateCustomLogger(\n \"trace\",\n logger.options.name!,\n logger.options,\n logger.trace.bind(logger),\n customLogger.trace?.bind(customLogger)\n )\n } as Logger;\n\n result.log = (type: LogLevel, message: string | LoggerMessage) => {\n switch (type) {\n case \"error\":\n result.error(message);\n break;\n case \"warn\":\n result.warn(message);\n break;\n case \"info\":\n result.info(message);\n break;\n case \"debug\":\n result.debug(message);\n break;\n case \"trace\":\n result.trace(message);\n break;\n case \"silent\":\n break;\n default:\n result.info(message);\n break;\n }\n };\n\n return result;\n};\n\nexport const consoleLogger = (\n type: LogLevel,\n message: string | LoggerMessage\n) =>\n consoleLog(\n isSetString(message)\n ? {\n type,\n category: LogCategories.GENERAL,\n logId: uuid(),\n timestamp: Date.now()\n }\n : {\n type,\n category: LogCategories.GENERAL,\n logId: uuid(),\n timestamp: Date.now(),\n ...message.meta\n },\n isSetString(message) ? message : message.message\n );\n\n/**\n * Create a logging function with a specific name and options.\n *\n * @param name - The name of the logging function.\n * @param options - The options to configure the logging function, including the source, command, environment, plugin, log level, custom logger, and colors. These options can be used to customize the appearance and behavior of the log messages generated by the logging function.\n * @returns A logging function.\n */\nexport const createLogger = (\n name: string,\n options: LoggerOptions,\n callback: (\n type: LogLevel,\n message: string | LoggerMessage\n ) => void = consoleLogger\n): Logger => {\n const result = {\n options: { ...options, name },\n error: validateLogger(\"error\", name, { ...options, name }, message =>\n callback(\"error\", message)\n ),\n warn: validateLogger(\"warn\", name, { ...options, name }, message =>\n callback(\"warn\", message)\n ),\n info: validateLogger(\"info\", name, { ...options, name }, message =>\n callback(\"info\", message)\n ),\n debug: validateLogger(\"debug\", name, { ...options, name }, message =>\n callback(\"debug\", message)\n ),\n trace: validateLogger(\"trace\", name, { ...options, name }, message =>\n callback(\"trace\", message)\n )\n } as Logger;\n\n result.log = (type: LogLevel, message: string | LoggerMessage) => {\n switch (type) {\n case \"error\":\n result.error(message);\n break;\n case \"warn\":\n result.warn(message);\n break;\n case \"info\":\n result.info(message);\n break;\n case \"debug\":\n result.debug(message);\n break;\n case \"trace\":\n result.trace(message);\n break;\n case \"silent\":\n break;\n default:\n result.info(message);\n break;\n }\n };\n\n return result;\n};\n\n/**\n * Extend a logging function with a specific name, adding a colored badge to the log output.\n *\n * @param logFn - The original logging function to extend.\n * @param options - The overlay metadata to use for the badge in the log output.\n * @returns A new logging function that includes the badge in its output.\n */\nexport const extendLogFn = (logFn: LogFn, options: LogFnOptions): LogFn => {\n return (meta, ...args) =>\n options.source || options.category\n ? logFn(\n isSetObject(meta)\n ? { ...options, ...meta }\n : { ...options, type: meta },\n `${colorBackground(String(options.source || options.category))} ${args\n .filter(Boolean)\n .map(arg => String(arg).trim())\n .join(\" \")} `\n )\n : logFn(meta, ...args);\n};\n\n/**\n * Extend a logger with a specific name and options, adding a colored badge to the log output for each log message generated by the logger.\n *\n * @param logger - The original logger to extend.\n * @param options - The options to configure the logging function, including the source, command, environment, plugin, log level, custom logger, and colors. These options can be used to customize the appearance and behavior of the log messages generated by the extended logger.\n * @returns A new logger that includes the badge in its output for each log message.\n */\nexport const extendLogger = (\n logger: Logger,\n options: LoggerOptions\n): Logger => {\n const opts = { ...logger.options, ...options } as RequiredKeys<\n LoggerOptions,\n \"name\"\n >;\n\n const result = {\n options: opts,\n error: validateLogger(\"error\", opts.name, opts, logger.error.bind(logger)),\n warn: validateLogger(\"warn\", opts.name, opts, logger.warn.bind(logger)),\n info: validateLogger(\"info\", opts.name, opts, logger.info.bind(logger)),\n debug: validateLogger(\"debug\", opts.name, opts, logger.debug.bind(logger)),\n trace: validateLogger(\"trace\", opts.name, opts, logger.trace.bind(logger))\n } as Logger;\n\n result.log = (type: LogLevel, message: string | LoggerMessage) => {\n switch (type) {\n case \"error\":\n result.error(message);\n break;\n case \"warn\":\n result.warn(message);\n break;\n case \"info\":\n result.info(message);\n break;\n case \"debug\":\n result.debug(message);\n break;\n case \"trace\":\n result.trace(message);\n break;\n case \"silent\":\n break;\n default:\n result.info(message);\n break;\n }\n };\n\n return result;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA2EA,SAAgB,UACd,mBACS;CACT,MAAM,QAAQ,SAAS,kBAAkB,GACrC,oBACA,kBAAkB,OAAO;AAE7B,QAAO,UAAU,WAAW,UAAU;;;;;;;;;AAUxC,SAAgB,gBACd,UACA,MACwB;AACxB,KAAI,aAAa,QACf,QAAO;EACL,SAAS;EACT,IAAI;EACJ,aAAa;EACb,SAAS;EACT,SAAS;EACT,OAAO;EACP,KAAK;EACL,KAAK;EACL,QAAQ;EACR,OAAO;EACR;UACQ,aAAa,SACtB,QAAO;EACL,SAAS;EACT,IAAI;EACJ,aAAa;EACb,SAAS;EACT,SAAS;EACT,OAAO;EACP,KAAK;EACL,KAAK;EACL,QAAQ;EACR,OAAO;EACR;CAGH,IAAI;AACJ,KAAI,SAAS,cACX,mBAAkB;UACT,SAAS,OAClB,mBAAkB;KAElB,mBAAkB;AAGpB,KAAI,YAAY,SAAS,CACvB,QAAO;EACL,SAAS;EACT,IAAI,gBAAgB;EACpB,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E,KAAK;AACH,WAAO,MAAM,QAAQ;AACrB;GACF,KAAK;AACH,WAAO,KAAK,QAAQ;AACpB;GACF,KAAK;AACH,WAAO,KAAK,QAAQ;AACpB;GACF,KAAK;AACH,WAAO,MAAM,QAAQ;AACrB;GACF,KAAK;AACH,WAAO,MAAM,QAAQ;AACrB;GACF,KAAK,SACH;GACF;AACE,WAAO,KAAK,QAAQ;AACpB;;;AAIN,QAAO"}
@@ -44,7 +44,7 @@ let _stryke_path_join = require("@stryke/path/join");
44
44
  */
45
45
  function replacePathTokens(context, path) {
46
46
  if (!path) return path;
47
- const result = path.replaceAll("{cwd}", context.config.cwd || process.cwd() || "./").replaceAll("{workspaceRoot}", context.config.cwd || process.cwd() || "./").replaceAll("{root}", context.config.root).replaceAll("{projectRoot}", context.config.root).replaceAll("{sourceRoot}", (0, _stryke_path_join.joinPaths)(context.config.root, "src")).replaceAll("{powerlinesPath}", context.powerlinesPath).replaceAll("{cachePath}", context.cachePath).replaceAll("{dataPath}", context.dataPath).replaceAll("{logPath}", context.envPaths.log).replaceAll("{tempPath}", context.envPaths.temp).replaceAll("{configPath}", context.envPaths.config).replaceAll("{outputPath}", context.config.output.path).replaceAll("{output}", context.config.output.path).replaceAll("{artifactsPath}", (0, _stryke_path_replace.replacePath)(context.artifactsPath, context.config.cwd)).replaceAll("{builtinPath}", (0, _stryke_path_replace.replacePath)(context.builtinsPath, context.config.cwd)).replaceAll("{builtinsPath}", (0, _stryke_path_replace.replacePath)(context.builtinsPath, context.config.cwd)).replaceAll("{entryPath}", (0, _stryke_path_replace.replacePath)(context.entryPath, context.config.cwd));
47
+ const result = path.replaceAll("{cwd}", context.config.cwd || process.cwd()).replaceAll("{workspaceRoot}", context.config.cwd || process.cwd()).replaceAll("{root}", context.config.root).replaceAll("{projectRoot}", context.config.root).replaceAll("{sourceRoot}", (0, _stryke_path_join.joinPaths)(context.config.root, "src")).replaceAll("{powerlinesPath}", context.powerlinesPath).replaceAll("{cachePath}", context.cachePath).replaceAll("{dataPath}", context.dataPath).replaceAll("{logPath}", context.envPaths.log).replaceAll("{tempPath}", context.envPaths.temp).replaceAll("{configPath}", context.envPaths.config).replaceAll("{outputPath}", context.config.output.path).replaceAll("{output}", context.config.output.path).replaceAll("{artifactsPath}", (0, _stryke_path_replace.replacePath)(context.artifactsPath, context.config.cwd)).replaceAll("{builtinPath}", (0, _stryke_path_replace.replacePath)(context.builtinsPath, context.config.cwd)).replaceAll("{builtinsPath}", (0, _stryke_path_replace.replacePath)(context.builtinsPath, context.config.cwd)).replaceAll("{entryPath}", (0, _stryke_path_replace.replacePath)(context.entryPath, context.config.cwd));
48
48
  return context.config.output.copy && (0, _stryke_type_checks_is_set_string.isSetString)(context.config.output.copy.path) ? result.replaceAll("{copyPath}", context.config.output.copy.path).replaceAll("{copy}", context.config.output.copy.path) : result;
49
49
  }
50
50
 
@@ -42,7 +42,7 @@ import { joinPaths } from "@stryke/path/join";
42
42
  */
43
43
  function replacePathTokens(context, path) {
44
44
  if (!path) return path;
45
- const result = path.replaceAll("{cwd}", context.config.cwd || process.cwd() || "./").replaceAll("{workspaceRoot}", context.config.cwd || process.cwd() || "./").replaceAll("{root}", context.config.root).replaceAll("{projectRoot}", context.config.root).replaceAll("{sourceRoot}", joinPaths(context.config.root, "src")).replaceAll("{powerlinesPath}", context.powerlinesPath).replaceAll("{cachePath}", context.cachePath).replaceAll("{dataPath}", context.dataPath).replaceAll("{logPath}", context.envPaths.log).replaceAll("{tempPath}", context.envPaths.temp).replaceAll("{configPath}", context.envPaths.config).replaceAll("{outputPath}", context.config.output.path).replaceAll("{output}", context.config.output.path).replaceAll("{artifactsPath}", replacePath(context.artifactsPath, context.config.cwd)).replaceAll("{builtinPath}", replacePath(context.builtinsPath, context.config.cwd)).replaceAll("{builtinsPath}", replacePath(context.builtinsPath, context.config.cwd)).replaceAll("{entryPath}", replacePath(context.entryPath, context.config.cwd));
45
+ const result = path.replaceAll("{cwd}", context.config.cwd || process.cwd()).replaceAll("{workspaceRoot}", context.config.cwd || process.cwd()).replaceAll("{root}", context.config.root).replaceAll("{projectRoot}", context.config.root).replaceAll("{sourceRoot}", joinPaths(context.config.root, "src")).replaceAll("{powerlinesPath}", context.powerlinesPath).replaceAll("{cachePath}", context.cachePath).replaceAll("{dataPath}", context.dataPath).replaceAll("{logPath}", context.envPaths.log).replaceAll("{tempPath}", context.envPaths.temp).replaceAll("{configPath}", context.envPaths.config).replaceAll("{outputPath}", context.config.output.path).replaceAll("{output}", context.config.output.path).replaceAll("{artifactsPath}", replacePath(context.artifactsPath, context.config.cwd)).replaceAll("{builtinPath}", replacePath(context.builtinsPath, context.config.cwd)).replaceAll("{builtinsPath}", replacePath(context.builtinsPath, context.config.cwd)).replaceAll("{entryPath}", replacePath(context.entryPath, context.config.cwd));
46
46
  return context.config.output.copy && isSetString(context.config.output.copy.path) ? result.replaceAll("{copyPath}", context.config.output.copy.path).replaceAll("{copy}", context.config.output.copy.path) : result;
47
47
  }
48
48
 
@@ -1 +1 @@
1
- {"version":3,"file":"paths.mjs","names":[],"sources":["../../src/plugin-utils/paths.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 { joinPaths } from \"@stryke/path/join\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { IsUndefined } from \"@stryke/types/base\";\nimport { UnresolvedContext } from \"../types/context\";\n\n/**\n * Replaces tokens in the given path string with their corresponding values from the context.\n *\n * @remarks\n * The following tokens are supported:\n * - `{cwd}` - The current working directory.\n * - `{workspaceRoot}` - The current working directory (same as `{cwd}`).\n * - `{root}` - The root directory of the project (same as `{projectRoot}`).\n * - `{projectRoot}` - The root directory of the project (same as `{root}`).\n * - `{sourceRoot}` - The source root directory of the project (usually `{root}/src`).\n * - `{powerlinesPath}` - The directory where Powerlines is installed.\n * - `{cachePath}` - The environment's directory for cached files.\n * - `{dataPath}` - The environment's directory for data files.\n * - `{logPath}` - The environment's directory for log files.\n * - `{tempPath}` - The environment's directory for temporary files.\n * - `{configPath}` - The environment's directory for configuration files.\n * - `{output}` - The configured output directory for the project.\n * - `{outputPath}` - The configured output directory for the project.\n * - `{copy}` - The configured final/copied distribution directory for the project.\n * - `{copyPath}` - The configured final/copied distribution directory for the project.\n * - `{artifactsPath}` - The configured directory for build artifacts.\n * - `{builtinPath}` - The configured directory for generated built-in plugins.\n * - `{entryPath}` - The configured directory for generated entry files.\n *\n * @example\n * ```ts\n * const path = replacePathTokens(context, \"{root}/dist\");\n * // If context.config.root is \"/home/user/project\", this will return \"/home/user/project/dist\"\n *\n * const pathWithCopy = replacePathTokens(context, \"{copy}\");\n * // If context.config.output.copy.path is \"/home/user/project/dist-copy\", this will return \"/home/user/project/dist-copy\"\n * ```\n *\n * @param context - The context containing the values for the path tokens.\n * @param path - The path string with tokens to replace.\n * @returns The path string with tokens replaced by their corresponding values from the context.\n */\nexport function replacePathTokens(\n context: UnresolvedContext,\n path?: string\n): IsUndefined<typeof path> extends true ? undefined : string {\n if (!path) {\n return path as IsUndefined<typeof path> extends true ? undefined : string;\n }\n\n const result = path\n .replaceAll(\"{cwd}\", context.config.cwd || process.cwd() || \"./\")\n .replaceAll(\"{workspaceRoot}\", context.config.cwd || process.cwd() || \"./\")\n .replaceAll(\"{root}\", context.config.root)\n .replaceAll(\"{projectRoot}\", context.config.root)\n .replaceAll(\"{sourceRoot}\", joinPaths(context.config.root, \"src\"))\n .replaceAll(\"{powerlinesPath}\", context.powerlinesPath)\n .replaceAll(\"{cachePath}\", context.cachePath)\n .replaceAll(\"{dataPath}\", context.dataPath)\n .replaceAll(\"{logPath}\", context.envPaths.log)\n .replaceAll(\"{tempPath}\", context.envPaths.temp)\n .replaceAll(\"{configPath}\", context.envPaths.config)\n .replaceAll(\"{outputPath}\", context.config.output.path)\n .replaceAll(\"{output}\", context.config.output.path)\n\n .replaceAll(\n \"{artifactsPath}\",\n replacePath(context.artifactsPath, context.config.cwd)\n )\n .replaceAll(\n \"{builtinPath}\",\n replacePath(context.builtinsPath, context.config.cwd)\n )\n .replaceAll(\n \"{builtinsPath}\",\n replacePath(context.builtinsPath, context.config.cwd)\n )\n .replaceAll(\n \"{entryPath}\",\n replacePath(context.entryPath, context.config.cwd)\n );\n\n return context.config.output.copy &&\n isSetString(context.config.output.copy.path)\n ? result\n .replaceAll(\"{copyPath}\", context.config.output.copy.path)\n .replaceAll(\"{copy}\", context.config.output.copy.path)\n : result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DA,SAAgB,kBACd,SACA,MAC4D;AAC5D,KAAI,CAAC,KACH,QAAO;CAGT,MAAM,SAAS,KACZ,WAAW,SAAS,QAAQ,OAAO,OAAO,QAAQ,KAAK,IAAI,KAAK,CAChE,WAAW,mBAAmB,QAAQ,OAAO,OAAO,QAAQ,KAAK,IAAI,KAAK,CAC1E,WAAW,UAAU,QAAQ,OAAO,KAAK,CACzC,WAAW,iBAAiB,QAAQ,OAAO,KAAK,CAChD,WAAW,gBAAgB,UAAU,QAAQ,OAAO,MAAM,MAAM,CAAC,CACjE,WAAW,oBAAoB,QAAQ,eAAe,CACtD,WAAW,eAAe,QAAQ,UAAU,CAC5C,WAAW,cAAc,QAAQ,SAAS,CAC1C,WAAW,aAAa,QAAQ,SAAS,IAAI,CAC7C,WAAW,cAAc,QAAQ,SAAS,KAAK,CAC/C,WAAW,gBAAgB,QAAQ,SAAS,OAAO,CACnD,WAAW,gBAAgB,QAAQ,OAAO,OAAO,KAAK,CACtD,WAAW,YAAY,QAAQ,OAAO,OAAO,KAAK,CAElD,WACC,mBACA,YAAY,QAAQ,eAAe,QAAQ,OAAO,IAAI,CACvD,CACA,WACC,iBACA,YAAY,QAAQ,cAAc,QAAQ,OAAO,IAAI,CACtD,CACA,WACC,kBACA,YAAY,QAAQ,cAAc,QAAQ,OAAO,IAAI,CACtD,CACA,WACC,eACA,YAAY,QAAQ,WAAW,QAAQ,OAAO,IAAI,CACnD;AAEH,QAAO,QAAQ,OAAO,OAAO,QAC3B,YAAY,QAAQ,OAAO,OAAO,KAAK,KAAK,GAC1C,OACG,WAAW,cAAc,QAAQ,OAAO,OAAO,KAAK,KAAK,CACzD,WAAW,UAAU,QAAQ,OAAO,OAAO,KAAK,KAAK,GACxD"}
1
+ {"version":3,"file":"paths.mjs","names":[],"sources":["../../src/plugin-utils/paths.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 { joinPaths } from \"@stryke/path/join\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { IsUndefined } from \"@stryke/types/base\";\nimport { UnresolvedContext } from \"../types/context\";\n\n/**\n * Replaces tokens in the given path string with their corresponding values from the context.\n *\n * @remarks\n * The following tokens are supported:\n * - `{cwd}` - The current working directory.\n * - `{workspaceRoot}` - The current working directory (same as `{cwd}`).\n * - `{root}` - The root directory of the project (same as `{projectRoot}`).\n * - `{projectRoot}` - The root directory of the project (same as `{root}`).\n * - `{sourceRoot}` - The source root directory of the project (usually `{root}/src`).\n * - `{powerlinesPath}` - The directory where Powerlines is installed.\n * - `{cachePath}` - The environment's directory for cached files.\n * - `{dataPath}` - The environment's directory for data files.\n * - `{logPath}` - The environment's directory for log files.\n * - `{tempPath}` - The environment's directory for temporary files.\n * - `{configPath}` - The environment's directory for configuration files.\n * - `{output}` - The configured output directory for the project.\n * - `{outputPath}` - The configured output directory for the project.\n * - `{copy}` - The configured final/copied distribution directory for the project.\n * - `{copyPath}` - The configured final/copied distribution directory for the project.\n * - `{artifactsPath}` - The configured directory for build artifacts.\n * - `{builtinPath}` - The configured directory for generated built-in plugins.\n * - `{entryPath}` - The configured directory for generated entry files.\n *\n * @example\n * ```ts\n * const path = replacePathTokens(context, \"{root}/dist\");\n * // If context.config.root is \"/home/user/project\", this will return \"/home/user/project/dist\"\n *\n * const pathWithCopy = replacePathTokens(context, \"{copy}\");\n * // If context.config.output.copy.path is \"/home/user/project/dist-copy\", this will return \"/home/user/project/dist-copy\"\n * ```\n *\n * @param context - The context containing the values for the path tokens.\n * @param path - The path string with tokens to replace.\n * @returns The path string with tokens replaced by their corresponding values from the context.\n */\nexport function replacePathTokens(\n context: UnresolvedContext,\n path?: string\n): IsUndefined<typeof path> extends true ? undefined : string {\n if (!path) {\n return path as IsUndefined<typeof path> extends true ? undefined : string;\n }\n\n const result = path\n .replaceAll(\"{cwd}\", context.config.cwd || process.cwd())\n .replaceAll(\"{workspaceRoot}\", context.config.cwd || process.cwd())\n .replaceAll(\"{root}\", context.config.root)\n .replaceAll(\"{projectRoot}\", context.config.root)\n .replaceAll(\"{sourceRoot}\", joinPaths(context.config.root, \"src\"))\n .replaceAll(\"{powerlinesPath}\", context.powerlinesPath)\n .replaceAll(\"{cachePath}\", context.cachePath)\n .replaceAll(\"{dataPath}\", context.dataPath)\n .replaceAll(\"{logPath}\", context.envPaths.log)\n .replaceAll(\"{tempPath}\", context.envPaths.temp)\n .replaceAll(\"{configPath}\", context.envPaths.config)\n .replaceAll(\"{outputPath}\", context.config.output.path)\n .replaceAll(\"{output}\", context.config.output.path)\n .replaceAll(\n \"{artifactsPath}\",\n replacePath(context.artifactsPath, context.config.cwd)\n )\n .replaceAll(\n \"{builtinPath}\",\n replacePath(context.builtinsPath, context.config.cwd)\n )\n .replaceAll(\n \"{builtinsPath}\",\n replacePath(context.builtinsPath, context.config.cwd)\n )\n .replaceAll(\n \"{entryPath}\",\n replacePath(context.entryPath, context.config.cwd)\n );\n\n return context.config.output.copy &&\n isSetString(context.config.output.copy.path)\n ? result\n .replaceAll(\"{copyPath}\", context.config.output.copy.path)\n .replaceAll(\"{copy}\", context.config.output.copy.path)\n : result;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DA,SAAgB,kBACd,SACA,MAC4D;AAC5D,KAAI,CAAC,KACH,QAAO;CAGT,MAAM,SAAS,KACZ,WAAW,SAAS,QAAQ,OAAO,OAAO,QAAQ,KAAK,CAAC,CACxD,WAAW,mBAAmB,QAAQ,OAAO,OAAO,QAAQ,KAAK,CAAC,CAClE,WAAW,UAAU,QAAQ,OAAO,KAAK,CACzC,WAAW,iBAAiB,QAAQ,OAAO,KAAK,CAChD,WAAW,gBAAgB,UAAU,QAAQ,OAAO,MAAM,MAAM,CAAC,CACjE,WAAW,oBAAoB,QAAQ,eAAe,CACtD,WAAW,eAAe,QAAQ,UAAU,CAC5C,WAAW,cAAc,QAAQ,SAAS,CAC1C,WAAW,aAAa,QAAQ,SAAS,IAAI,CAC7C,WAAW,cAAc,QAAQ,SAAS,KAAK,CAC/C,WAAW,gBAAgB,QAAQ,SAAS,OAAO,CACnD,WAAW,gBAAgB,QAAQ,OAAO,OAAO,KAAK,CACtD,WAAW,YAAY,QAAQ,OAAO,OAAO,KAAK,CAClD,WACC,mBACA,YAAY,QAAQ,eAAe,QAAQ,OAAO,IAAI,CACvD,CACA,WACC,iBACA,YAAY,QAAQ,cAAc,QAAQ,OAAO,IAAI,CACtD,CACA,WACC,kBACA,YAAY,QAAQ,cAAc,QAAQ,OAAO,IAAI,CACtD,CACA,WACC,eACA,YAAY,QAAQ,WAAW,QAAQ,OAAO,IAAI,CACnD;AAEH,QAAO,QAAQ,OAAO,OAAO,QAC3B,YAAY,QAAQ,OAAO,OAAO,KAAK,KAAK,GAC1C,OACG,WAAW,cAAc,QAAQ,OAAO,OAAO,KAAK,KAAK,CACzD,WAAW,UAAU,QAAQ,OAAO,OAAO,KAAK,KAAK,GACxD"}
@@ -106,6 +106,7 @@ interface Logger {
106
106
  info: (message: string | LoggerMessage) => void;
107
107
  debug: (message: string | LoggerMessage) => void;
108
108
  trace: (message: string | LoggerMessage) => void;
109
+ log: (type: LogLevel, message: string | LoggerMessage) => void;
109
110
  }
110
111
  /**
111
112
  * A type representing a log message that can be passed to a custom logger, which includes the log metadata and message content. This type is used as the parameter for the logging methods defined in the {@link CustomLogger} interface, allowing users to log messages with rich metadata that can be used for filtering, formatting, or other purposes in their custom logging implementation.
@@ -1 +1 @@
1
- {"version":3,"file":"logging.d.cts","names":[],"sources":["../../src/types/logging.ts"],"mappings":";;;;;cAsBa,SAAA;EAAA;;;;;;;cASA,UAAA;AAAA,KASD,QAAA,WAAmB,UAAA;AAAA,cAElB,aAAA;EAAA;;;;;;;;;;;cAaA,cAAA;AAAA,KAaD,WAAA,WAAsB,cAAA;AAAA,UAEjB,OAAA;EAjBP;;;EAqBR,KAAA;;;;EAIA,IAAA,EAAM,QAAA;;;;EAIN,QAAA,EAAU,WAAA;;;;EAIV,SAAA;EApBQ;;;EAwBR,IAAA;EAtBU;;;EA0BV,WAAA;EA1B8C;AAEhD;;EA4BE,cAAA;EAhBqB;;;EAoBrB,OAAA;EApBA;;;EAwBA,IAAA;EAZA;;;EAgBA,WAAA;EAAA;;;EAIA,MAAA;EAIM;AAGR;;EAHE,MAAA;AAAA;AAAA,KAGU,YAAA,GAAe,IAAA,CACzB,OAAA,CAAQ,OAAA;EAGR,IAAA,GAAO,IAAA;EACP,QAAA,GAAW,kBAAA;AAAA;AA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EAC1B,GAAA,GAAM,IAAA,EAAM,QAAA,EAAU,OAAA,WAAkB,aAAA;AAAA;;;;KAM9B,mBAAA,GAAsB,iBAAA,CAAkB,IAAA,CAAK,OAAA;;;AArCzD;UA0CiB,YAAA;;;;;;;EAOf,KAAA,IAAS,OAAA,EAAS,mBAAA;EAhDlB;;;;AAIF;;EAmDE,IAAA,IAAQ,OAAA,EAAS,mBAAA;EAnDc;;;;;;EA0D/B,IAAA,IAAQ,OAAA,EAAS,mBAAA;EA1Dc;;;;;;EAiE/B,KAAA,IAAS,OAAA,EAAS,mBAAA;EA5DH;;;;;;EAmEf,KAAA,IAAS,OAAA,EAAS,mBAAA;AAAA;AAAA,KAGR,kBAAA,GACR,QAAA,GACA,YAAA,CACE,MAAA,CAAO,WAAA,EAAa,QAAA;AAAA,KAId,sBAAA,GAAyB,MAAA,CAAO,WAAA,EAAa,QAAA;AAAA"}
@@ -106,6 +106,7 @@ interface Logger {
106
106
  info: (message: string | LoggerMessage) => void;
107
107
  debug: (message: string | LoggerMessage) => void;
108
108
  trace: (message: string | LoggerMessage) => void;
109
+ log: (type: LogLevel, message: string | LoggerMessage) => void;
109
110
  }
110
111
  /**
111
112
  * A type representing a log message that can be passed to a custom logger, which includes the log metadata and message content. This type is used as the parameter for the logging methods defined in the {@link CustomLogger} interface, allowing users to log messages with rich metadata that can be used for filtering, formatting, or other purposes in their custom logging implementation.
@@ -1 +1 @@
1
- {"version":3,"file":"logging.d.mts","names":[],"sources":["../../src/types/logging.ts"],"mappings":";;;;;cAsBa,SAAA;EAAA;;;;;;;cASA,UAAA;AAAA,KASD,QAAA,WAAmB,UAAA;AAAA,cAElB,aAAA;EAAA;;;;;;;;;;;cAaA,cAAA;AAAA,KAaD,WAAA,WAAsB,cAAA;AAAA,UAEjB,OAAA;EAjBP;;;EAqBR,KAAA;;;;EAIA,IAAA,EAAM,QAAA;;;;EAIN,QAAA,EAAU,WAAA;;;;EAIV,SAAA;EApBQ;;;EAwBR,IAAA;EAtB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;;AAAA,KAyBY,aAAA,GAAgB,iBAAA,CAAkB,UAAA;;;;UAK7B,MAAA;EACf,OAAA,EAAS,aAAA;EACT,KAAA,GAAQ,OAAA,WAAkB,aAAA;EAC1B,IAAA,GAAO,OAAA,WAAkB,aAAA;EACzB,IAAA,GAAO,OAAA,WAAkB,aAAA;EACzB,KAAA,GAAQ,OAAA,WAAkB,aAAA;EAC1B,KAAA,GAAQ,OAAA,WAAkB,aAAA;EAC1B,GAAA,GAAM,IAAA,EAAM,QAAA,EAAU,OAAA,WAAkB,aAAA;AAAA;;;;KAM9B,mBAAA,GAAsB,iBAAA,CAAkB,IAAA,CAAK,OAAA;;;AArCzD;UA0CiB,YAAA;;;;;;;EAOf,KAAA,IAAS,OAAA,EAAS,mBAAA;EAhDlB;;;;AAIF;;EAmDE,IAAA,IAAQ,OAAA,EAAS,mBAAA;EAnDc;;;;;;EA0D/B,IAAA,IAAQ,OAAA,EAAS,mBAAA;EA1Dc;;;;;;EAiE/B,KAAA,IAAS,OAAA,EAAS,mBAAA;EA5DH;;;;;;EAmEf,KAAA,IAAS,OAAA,EAAS,mBAAA;AAAA;AAAA,KAGR,kBAAA,GACR,QAAA,GACA,YAAA,CACE,MAAA,CAAO,WAAA,EAAa,QAAA;AAAA,KAId,sBAAA,GAAyB,MAAA,CAAO,WAAA,EAAa,QAAA;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"logging.mjs","names":[],"sources":["../../src/types/logging.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 { PartialKeys, RequiredKeys } from \"@stryke/types/base\";\nimport { UnpluginMessage } from \"unplugin\";\nimport { Mode } from \"./config\";\n\nexport const LogLevels = {\n SILENT: \"silent\",\n ERROR: \"error\",\n WARN: \"warn\",\n INFO: \"info\",\n DEBUG: \"debug\",\n TRACE: \"trace\"\n} as const;\n\nexport const LOG_LEVELS = [\n LogLevels.SILENT,\n LogLevels.ERROR,\n LogLevels.WARN,\n LogLevels.INFO,\n LogLevels.DEBUG,\n LogLevels.TRACE\n] as const;\n\nexport type LogLevel = (typeof LOG_LEVELS)[number];\n\nexport const LogCategories = {\n GENERAL: \"general\",\n FS: \"fs\",\n PERFORMANCE: \"performance\",\n CONFIG: \"config\",\n PLUGINS: \"plugins\",\n HOOKS: \"hooks\",\n ENV: \"env\",\n IPC: \"ipc\",\n BABEL: \"babel\",\n NETWORK: \"network\"\n} as const;\n\nexport const LOG_CATEGORIES = [\n LogCategories.GENERAL,\n LogCategories.FS,\n LogCategories.PERFORMANCE,\n LogCategories.CONFIG,\n LogCategories.PLUGINS,\n LogCategories.HOOKS,\n LogCategories.ENV,\n LogCategories.IPC,\n LogCategories.NETWORK,\n LogCategories.BABEL\n] as const;\n\nexport type LogCategory = (typeof LOG_CATEGORIES)[number];\n\nexport interface LogMeta {\n /**\n * A unique identifier for the log message, which can be used to correlate related log entries across different parts of the system or different executions.\n */\n logId: string;\n /**\n * The log level of the message, which indicates the severity or importance of the log entry. The log level can be used to filter log messages based on their importance, allowing users to focus on critical issues or relevant information while ignoring less important messages.\n */\n type: LogLevel;\n /**\n * The category of the log message, which can be used to classify and filter log entries based on their purpose or origin.\n */\n category: LogCategory;\n /**\n * The timestamp when the IPC message was created, represented as the number of milliseconds since the Unix epoch.\n */\n timestamp: number;\n /**\n * The name of the project or package associated with the log message, which can be used to identify the source of the log entry and provide context for the message.\n */\n name?: string;\n /**\n * A unique identifier for the current execution instance, which can be used for logging and other purposes to distinguish between different executions in the same process.\n */\n executionId?: string;\n /**\n * The zero-based index of the current execution within the sequence of executions in the same process.\n */\n executionIndex?: number;\n /**\n * Optional command identifier to specify the command or task associated with the log message, which can be used to provide additional context about the operation being performed when the log entry was generated.\n */\n command?: string;\n /**\n * Optional hook name to specify the plugin hook associated with the log message, which can be used to provide additional context about the specific plugin hook being executed when the log entry was generated.\n */\n hook?: string;\n /**\n * Optional environment identifier to specify the context or environment in which the message is being processed.\n */\n environment?: string;\n /**\n * Optional plugin name to specify the source plugin of the log message.\n */\n plugin?: string;\n /**\n * The name of the logger or source of the log message, which can be used to identify the origin of the log entry.\n */\n source?: string;\n}\n\nexport type LogFnOptions = Omit<\n Partial<LogMeta>,\n \"logId\" | \"timestamp\" | \"name\" | \"type\"\n> & {\n mode?: Mode;\n logLevel?: LogLevelUserConfig;\n};\n\nexport type LogFnMeta =\n | LogLevel\n | PartialKeys<LogMeta, \"logId\" | \"timestamp\" | \"name\" | \"category\">;\n\nexport type LogFn = (meta: LogFnMeta, ...args: string[]) => void;\n\nexport type LoggerMeta = PartialKeys<\n Omit<LogMeta, \"type\">,\n \"logId\" | \"timestamp\" | \"name\" | \"category\"\n>;\n\nexport type LoggerOptions = Omit<LoggerMeta, \"logId\" | \"timestamp\" | \"type\"> & {\n mode?: Mode;\n logLevel?: LogLevelUserConfig;\n};\n\nexport interface PowerlinesMessage<TMeta> extends UnpluginMessage {\n meta: TMeta;\n}\n\nexport type LogMessage = PowerlinesMessage<Partial<LogMeta>>;\n\n/**\n * A type representing a log message that can be passed to the logging methods defined in the {@link Logger} interface, which includes the log metadata and message content. This type is used as the parameter for the logging methods defined in the {@link Logger} interface, allowing users to log messages with rich metadata that can be used for filtering, formatting, or other purposes in the logging implementation.\n */\nexport type LoggerMessage = PowerlinesMessage<LoggerMeta>;\n\n/**\n * An internal interface representing a logger instance used within Powerlines for logging messages at various log levels, including \"error\", \"warn\", \"info\", \"debug\", and \"trace\". This interface defines methods for logging messages at each log level, which accept a message parameter that can be either a string or an object containing the log metadata and message content. The logger instance also includes an options property that contains the configuration options used for the logger, such as the source, command, environment, plugin, log level, and other relevant metadata. This interface is intended for internal use within Powerlines and is not meant to be implemented by users directly; instead, users can provide a custom logger that implements the {@link CustomLogger} interface to integrate with Powerlines' logging system.\n */\nexport interface Logger {\n options: LoggerOptions;\n error: (message: string | LoggerMessage) => void;\n warn: (message: string | LoggerMessage) => void;\n info: (message: string | LoggerMessage) => void;\n debug: (message: string | LoggerMessage) => void;\n trace: (message: string | LoggerMessage) => void;\n}\n\n/**\n * A type representing a log message that can be passed to a custom logger, which includes the log metadata and message content. This type is used as the parameter for the logging methods defined in the {@link CustomLogger} interface, allowing users to log messages with rich metadata that can be used for filtering, formatting, or other purposes in their custom logging implementation.\n */\nexport type CustomLoggerMessage = PowerlinesMessage<Omit<LogMeta, \"type\">>;\n\n/**\n * An interface representing a custom logger that can be provided by the user to override the default logging behavior of Powerlines. This interface defines methods for logging messages at different log levels, including \"error\", \"warn\", \"info\", \"debug\", and \"trace\". Each method accepts a message parameter, which can be either a string or an object containing the log metadata and message content. By implementing this interface, users can integrate their own logging system with Powerlines or customize the logging behavior to suit their specific needs.\n */\nexport interface CustomLogger {\n /**\n * A function to log messages at the \"error\" level, which indicates a serious issue that has caused a failure in the build process or a critical problem that needs immediate attention.\n *\n * @param message - The log message to be recorded, which can be a string or an object containing the log metadata and message content. The log message should provide sufficient information to understand the context and nature of the error being reported.\n * @returns void\n */\n error?: (message: CustomLoggerMessage) => void;\n /**\n * A function to log messages at the \"warn\" level, which indicates a potential issue or a situation that may require attention but does not necessarily cause a failure in the build process.\n *\n * @param message - The log message to be recorded, which can be a string or an object containing the log metadata and message content. The log message should provide sufficient information to understand the context and nature of the warning being reported.\n * @returns void\n */\n warn?: (message: CustomLoggerMessage) => void;\n /**\n * A function to log messages at the \"info\" level, which indicates general informational messages about the build process, such as the start and completion of tasks, configuration details, or other relevant information that may be useful for monitoring the build process.\n *\n * @param message - The log message to be recorded, which can be a string or an object containing the log metadata and message content. The log message should provide sufficient information to understand the context and nature of the informational message being reported.\n * @returns void\n */\n info?: (message: CustomLoggerMessage) => void;\n /**\n * A function to log messages at the \"debug\" level, which indicates detailed debugging information that may be useful for diagnosing issues during development or troubleshooting problems in the build process.\n *\n * @param message - The log message to be recorded, which can be a string or an object containing the log metadata and message content. The log message should provide sufficient information to understand the context and nature of the debug information being reported.\n * @returns void\n */\n debug?: (message: CustomLoggerMessage) => void;\n /**\n * A function to log messages at the \"trace\" level, which indicates very detailed tracing information that may be useful for in-depth analysis of the build process or for tracking the flow of execution through various stages of the build.\n *\n * @param message - The log message to be recorded, which can be a string or an object containing the log metadata and message content. The log message should provide sufficient information to understand the context and nature of the trace information being reported.\n * @returns void\n */\n trace?: (message: CustomLoggerMessage) => void;\n}\n\nexport type LogLevelUserConfig =\n | LogLevel\n | RequiredKeys<\n Record<LogCategory, LogLevel | boolean | undefined>,\n \"general\"\n >;\n\nexport type LogLevelResolvedConfig = Record<LogCategory, LogLevel>;\n"],"mappings":";AAsBA,MAAa,YAAY;CACvB,QAAQ;CACR,OAAO;CACP,MAAM;CACN,MAAM;CACN,OAAO;CACP,OAAO;CACR;AAED,MAAa,aAAa;CACxB,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACX;AAID,MAAa,gBAAgB;CAC3B,SAAS;CACT,IAAI;CACJ,aAAa;CACb,QAAQ;CACR,SAAS;CACT,OAAO;CACP,KAAK;CACL,KAAK;CACL,OAAO;CACP,SAAS;CACV;AAED,MAAa,iBAAiB;CAC5B,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACf"}
1
+ {"version":3,"file":"logging.mjs","names":[],"sources":["../../src/types/logging.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 { PartialKeys, RequiredKeys } from \"@stryke/types/base\";\nimport { UnpluginMessage } from \"unplugin\";\nimport { Mode } from \"./config\";\n\nexport const LogLevels = {\n SILENT: \"silent\",\n ERROR: \"error\",\n WARN: \"warn\",\n INFO: \"info\",\n DEBUG: \"debug\",\n TRACE: \"trace\"\n} as const;\n\nexport const LOG_LEVELS = [\n LogLevels.SILENT,\n LogLevels.ERROR,\n LogLevels.WARN,\n LogLevels.INFO,\n LogLevels.DEBUG,\n LogLevels.TRACE\n] as const;\n\nexport type LogLevel = (typeof LOG_LEVELS)[number];\n\nexport const LogCategories = {\n GENERAL: \"general\",\n FS: \"fs\",\n PERFORMANCE: \"performance\",\n CONFIG: \"config\",\n PLUGINS: \"plugins\",\n HOOKS: \"hooks\",\n ENV: \"env\",\n IPC: \"ipc\",\n BABEL: \"babel\",\n NETWORK: \"network\"\n} as const;\n\nexport const LOG_CATEGORIES = [\n LogCategories.GENERAL,\n LogCategories.FS,\n LogCategories.PERFORMANCE,\n LogCategories.CONFIG,\n LogCategories.PLUGINS,\n LogCategories.HOOKS,\n LogCategories.ENV,\n LogCategories.IPC,\n LogCategories.NETWORK,\n LogCategories.BABEL\n] as const;\n\nexport type LogCategory = (typeof LOG_CATEGORIES)[number];\n\nexport interface LogMeta {\n /**\n * A unique identifier for the log message, which can be used to correlate related log entries across different parts of the system or different executions.\n */\n logId: string;\n /**\n * The log level of the message, which indicates the severity or importance of the log entry. The log level can be used to filter log messages based on their importance, allowing users to focus on critical issues or relevant information while ignoring less important messages.\n */\n type: LogLevel;\n /**\n * The category of the log message, which can be used to classify and filter log entries based on their purpose or origin.\n */\n category: LogCategory;\n /**\n * The timestamp when the IPC message was created, represented as the number of milliseconds since the Unix epoch.\n */\n timestamp: number;\n /**\n * The name of the project or package associated with the log message, which can be used to identify the source of the log entry and provide context for the message.\n */\n name?: string;\n /**\n * A unique identifier for the current execution instance, which can be used for logging and other purposes to distinguish between different executions in the same process.\n */\n executionId?: string;\n /**\n * The zero-based index of the current execution within the sequence of executions in the same process.\n */\n executionIndex?: number;\n /**\n * Optional command identifier to specify the command or task associated with the log message, which can be used to provide additional context about the operation being performed when the log entry was generated.\n */\n command?: string;\n /**\n * Optional hook name to specify the plugin hook associated with the log message, which can be used to provide additional context about the specific plugin hook being executed when the log entry was generated.\n */\n hook?: string;\n /**\n * Optional environment identifier to specify the context or environment in which the message is being processed.\n */\n environment?: string;\n /**\n * Optional plugin name to specify the source plugin of the log message.\n */\n plugin?: string;\n /**\n * The name of the logger or source of the log message, which can be used to identify the origin of the log entry.\n */\n source?: string;\n}\n\nexport type LogFnOptions = Omit<\n Partial<LogMeta>,\n \"logId\" | \"timestamp\" | \"name\" | \"type\"\n> & {\n mode?: Mode;\n logLevel?: LogLevelUserConfig;\n};\n\nexport type LogFnMeta =\n | LogLevel\n | PartialKeys<LogMeta, \"logId\" | \"timestamp\" | \"name\" | \"category\">;\n\nexport type LogFn = (meta: LogFnMeta, ...args: string[]) => void;\n\nexport type LoggerMeta = PartialKeys<\n Omit<LogMeta, \"type\">,\n \"logId\" | \"timestamp\" | \"name\" | \"category\"\n>;\n\nexport type LoggerOptions = Omit<LoggerMeta, \"logId\" | \"timestamp\" | \"type\"> & {\n mode?: Mode;\n logLevel?: LogLevelUserConfig;\n};\n\nexport interface PowerlinesMessage<TMeta> extends UnpluginMessage {\n meta: TMeta;\n}\n\nexport type LogMessage = PowerlinesMessage<Partial<LogMeta>>;\n\n/**\n * A type representing a log message that can be passed to the logging methods defined in the {@link Logger} interface, which includes the log metadata and message content. This type is used as the parameter for the logging methods defined in the {@link Logger} interface, allowing users to log messages with rich metadata that can be used for filtering, formatting, or other purposes in the logging implementation.\n */\nexport type LoggerMessage = PowerlinesMessage<LoggerMeta>;\n\n/**\n * An internal interface representing a logger instance used within Powerlines for logging messages at various log levels, including \"error\", \"warn\", \"info\", \"debug\", and \"trace\". This interface defines methods for logging messages at each log level, which accept a message parameter that can be either a string or an object containing the log metadata and message content. The logger instance also includes an options property that contains the configuration options used for the logger, such as the source, command, environment, plugin, log level, and other relevant metadata. This interface is intended for internal use within Powerlines and is not meant to be implemented by users directly; instead, users can provide a custom logger that implements the {@link CustomLogger} interface to integrate with Powerlines' logging system.\n */\nexport interface Logger {\n options: LoggerOptions;\n error: (message: string | LoggerMessage) => void;\n warn: (message: string | LoggerMessage) => void;\n info: (message: string | LoggerMessage) => void;\n debug: (message: string | LoggerMessage) => void;\n trace: (message: string | LoggerMessage) => void;\n log: (type: LogLevel, message: string | LoggerMessage) => void;\n}\n\n/**\n * A type representing a log message that can be passed to a custom logger, which includes the log metadata and message content. This type is used as the parameter for the logging methods defined in the {@link CustomLogger} interface, allowing users to log messages with rich metadata that can be used for filtering, formatting, or other purposes in their custom logging implementation.\n */\nexport type CustomLoggerMessage = PowerlinesMessage<Omit<LogMeta, \"type\">>;\n\n/**\n * An interface representing a custom logger that can be provided by the user to override the default logging behavior of Powerlines. This interface defines methods for logging messages at different log levels, including \"error\", \"warn\", \"info\", \"debug\", and \"trace\". Each method accepts a message parameter, which can be either a string or an object containing the log metadata and message content. By implementing this interface, users can integrate their own logging system with Powerlines or customize the logging behavior to suit their specific needs.\n */\nexport interface CustomLogger {\n /**\n * A function to log messages at the \"error\" level, which indicates a serious issue that has caused a failure in the build process or a critical problem that needs immediate attention.\n *\n * @param message - The log message to be recorded, which can be a string or an object containing the log metadata and message content. The log message should provide sufficient information to understand the context and nature of the error being reported.\n * @returns void\n */\n error?: (message: CustomLoggerMessage) => void;\n /**\n * A function to log messages at the \"warn\" level, which indicates a potential issue or a situation that may require attention but does not necessarily cause a failure in the build process.\n *\n * @param message - The log message to be recorded, which can be a string or an object containing the log metadata and message content. The log message should provide sufficient information to understand the context and nature of the warning being reported.\n * @returns void\n */\n warn?: (message: CustomLoggerMessage) => void;\n /**\n * A function to log messages at the \"info\" level, which indicates general informational messages about the build process, such as the start and completion of tasks, configuration details, or other relevant information that may be useful for monitoring the build process.\n *\n * @param message - The log message to be recorded, which can be a string or an object containing the log metadata and message content. The log message should provide sufficient information to understand the context and nature of the informational message being reported.\n * @returns void\n */\n info?: (message: CustomLoggerMessage) => void;\n /**\n * A function to log messages at the \"debug\" level, which indicates detailed debugging information that may be useful for diagnosing issues during development or troubleshooting problems in the build process.\n *\n * @param message - The log message to be recorded, which can be a string or an object containing the log metadata and message content. The log message should provide sufficient information to understand the context and nature of the debug information being reported.\n * @returns void\n */\n debug?: (message: CustomLoggerMessage) => void;\n /**\n * A function to log messages at the \"trace\" level, which indicates very detailed tracing information that may be useful for in-depth analysis of the build process or for tracking the flow of execution through various stages of the build.\n *\n * @param message - The log message to be recorded, which can be a string or an object containing the log metadata and message content. The log message should provide sufficient information to understand the context and nature of the trace information being reported.\n * @returns void\n */\n trace?: (message: CustomLoggerMessage) => void;\n}\n\nexport type LogLevelUserConfig =\n | LogLevel\n | RequiredKeys<\n Record<LogCategory, LogLevel | boolean | undefined>,\n \"general\"\n >;\n\nexport type LogLevelResolvedConfig = Record<LogCategory, LogLevel>;\n"],"mappings":";AAsBA,MAAa,YAAY;CACvB,QAAQ;CACR,OAAO;CACP,MAAM;CACN,MAAM;CACN,OAAO;CACP,OAAO;CACR;AAED,MAAa,aAAa;CACxB,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACV,UAAU;CACX;AAID,MAAa,gBAAgB;CAC3B,SAAS;CACT,IAAI;CACJ,aAAa;CACb,QAAQ;CACR,SAAS;CACT,OAAO;CACP,KAAK;CACL,KAAK;CACL,OAAO;CACP,SAAS;CACV;AAED,MAAa,iBAAiB;CAC5B,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACd,cAAc;CACf"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/core",
3
- "version": "0.44.1",
3
+ "version": "0.44.2",
4
4
  "private": false,
5
5
  "description": "An internal core package for Powerlines - please use the `powerlines` package for public usage.",
6
6
  "homepage": "https://stormsoftware.com",
@@ -201,5 +201,5 @@
201
201
  "typescript": "^6.0.3"
202
202
  },
203
203
  "publishConfig": { "access": "public" },
204
- "gitHead": "e246dfd00453dc44868dac37f1b6cefb369c6e48"
204
+ "gitHead": "e334be23d413125e5ac9d015ba2d26b434129a7c"
205
205
  }