@powerlines/core 0.44.0 → 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.
- package/dist/constants/index.cjs +2 -2
- package/dist/constants/index.mjs +2 -2
- package/dist/constants/log-level.cjs +2 -2
- package/dist/constants/log-level.d.cts +2 -2
- package/dist/constants/log-level.d.mts +2 -2
- package/dist/constants/log-level.mjs +2 -2
- package/dist/constants/log-level.mjs.map +1 -1
- package/dist/index.cjs +7 -10
- package/dist/index.d.cts +3 -4
- package/dist/index.d.mts +3 -4
- package/dist/index.mjs +4 -4
- package/dist/lib/index.cjs +1 -7
- package/dist/lib/index.d.cts +1 -2
- package/dist/lib/index.d.mts +1 -2
- package/dist/lib/index.mjs +2 -3
- package/dist/lib/unplugin/plugin.cjs +9 -11
- package/dist/lib/unplugin/plugin.d.cts.map +1 -1
- package/dist/lib/unplugin/plugin.d.mts.map +1 -1
- package/dist/lib/unplugin/plugin.mjs +9 -11
- package/dist/lib/unplugin/plugin.mjs.map +1 -1
- package/dist/lib/utilities/index.cjs +1 -1
- package/dist/lib/utilities/index.mjs +1 -1
- package/dist/lib/utilities/write-file.d.cts +1 -1
- package/dist/lib/utilities/write-file.d.mts +1 -1
- package/dist/lib/utilities/write-file.mjs.map +1 -1
- package/dist/plugin-utils/index.cjs +15 -2
- package/dist/plugin-utils/index.d.cts +2 -2
- package/dist/plugin-utils/index.d.mts +2 -2
- package/dist/plugin-utils/index.mjs +3 -3
- package/dist/plugin-utils/logging.cjs +421 -4
- package/dist/plugin-utils/logging.d.cts +77 -3
- package/dist/plugin-utils/logging.d.cts.map +1 -1
- package/dist/plugin-utils/logging.d.mts +77 -3
- package/dist/plugin-utils/logging.d.mts.map +1 -1
- package/dist/plugin-utils/logging.mjs +407 -4
- package/dist/plugin-utils/logging.mjs.map +1 -1
- package/dist/plugin-utils/paths.cjs +1 -1
- package/dist/plugin-utils/paths.mjs +1 -1
- package/dist/plugin-utils/paths.mjs.map +1 -1
- package/dist/types/config.d.cts +11 -4
- package/dist/types/config.d.cts.map +1 -1
- package/dist/types/config.d.mts +11 -4
- package/dist/types/config.d.mts.map +1 -1
- package/dist/types/context.d.cts +17 -28
- package/dist/types/context.d.cts.map +1 -1
- package/dist/types/context.d.mts +17 -28
- package/dist/types/context.d.mts.map +1 -1
- package/dist/types/index.cjs +1 -0
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.mts +2 -2
- package/dist/types/index.mjs +3 -0
- package/dist/types/logging.cjs +48 -0
- package/dist/types/logging.d.cts +175 -0
- package/dist/types/logging.d.cts.map +1 -0
- package/dist/types/logging.d.mts +175 -0
- package/dist/types/logging.d.mts.map +1 -0
- package/dist/types/logging.mjs +45 -0
- package/dist/types/logging.mjs.map +1 -0
- package/package.json +74 -442
- package/dist/lib/logger.cjs +0 -106
- package/dist/lib/logger.d.cts +0 -42
- package/dist/lib/logger.d.cts.map +0 -1
- package/dist/lib/logger.d.mts +0 -42
- package/dist/lib/logger.d.mts.map +0 -1
- package/dist/lib/logger.mjs +0 -100
- package/dist/lib/logger.mjs.map +0 -1
- package/dist/types/log.cjs +0 -26
- package/dist/types/log.d.cts +0 -90
- package/dist/types/log.d.cts.map +0 -1
- package/dist/types/log.d.mts +0 -90
- package/dist/types/log.d.mts.map +0 -1
- package/dist/types/log.mjs +0 -25
- package/dist/types/log.mjs.map +0 -1
|
@@ -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 { 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 { defu } from \"defu\";\nimport {\n DEFAULT_DEVELOPMENT_LOG_LEVEL,\n DEFAULT_PRODUCTION_LOG_LEVEL,\n DEFAULT_TEST_LOG_LEVEL\n} from \"../constants/log-level\";\nimport { Mode, UnresolvedContext } from \"../types\";\nimport { LogLevelResolvedConfig, LogLevelUserConfig } from \"../types/log\";\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 };\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 };\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 };\n } else if (isSetObject(logLevel)) {\n return defu(logLevel, defaultLogLevel) as LogLevelResolvedConfig;\n }\n\n return defaultLogLevel;\n}\n"],"mappings":";;;;;;;;;;;;;AAoDA,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;EACT;UACQ,aAAa,SACtB,QAAO;EACL,SAAS;EACT,IAAI;EACJ,aAAa;EACb,SAAS;EACT,SAAS;EACT,OAAO;EACP,KAAK;EACL,KAAK;EACL,QAAQ;EACT;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,aAAa;EACb,SAAS,gBAAgB;EACzB,SAAS;EACT,OAAO;EACP,KAAK,gBAAgB;EACrB,KAAK,gBAAgB;EACrB,QAAQ,gBAAgB;EACzB;UACQ,YAAY,SAAS,CAC9B,QAAOA,OAAK,UAAU,gBAAgB;AAGxC,QAAO"}
|
|
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,aAAa;EAC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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()
|
|
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()
|
|
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()
|
|
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":";;;;;;;;;;;;;;;;;;;;;;;;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
|
3
|
+
import { CustomLogger, LogLevelResolvedConfig, LogLevelUserConfig } from "./logging.cjs";
|
|
4
4
|
import { TSConfig } from "./tsconfig.cjs";
|
|
5
5
|
import { PluginContext } from "./context.cjs";
|
|
6
6
|
import { Format } from "@storm-software/build-tools/types";
|
|
@@ -234,6 +234,10 @@ interface OutputConfig {
|
|
|
234
234
|
storage?: StoragePort | StoragePreset;
|
|
235
235
|
}
|
|
236
236
|
interface EngineOptions {
|
|
237
|
+
/**
|
|
238
|
+
* The name of the project
|
|
239
|
+
*/
|
|
240
|
+
name?: string;
|
|
237
241
|
/**
|
|
238
242
|
* The root directory of the project
|
|
239
243
|
*/
|
|
@@ -276,7 +280,7 @@ interface EngineOptions {
|
|
|
276
280
|
*/
|
|
277
281
|
configFile?: string;
|
|
278
282
|
}
|
|
279
|
-
type ResolvedEngineOptions = PartialKeys<Required<EngineOptions>, "organization" | "configFile">;
|
|
283
|
+
type ResolvedEngineOptions = PartialKeys<Required<EngineOptions>, "organization" | "configFile" | "name">;
|
|
280
284
|
interface ExecutionOptions extends EngineOptions {
|
|
281
285
|
/**
|
|
282
286
|
* 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.
|
|
@@ -429,9 +433,12 @@ interface UserConfig extends Config, ExecutionOptions {
|
|
|
429
433
|
*/
|
|
430
434
|
logLevel?: LogLevelUserConfig;
|
|
431
435
|
/**
|
|
432
|
-
* A custom logger
|
|
436
|
+
* A custom logger instance that implements the {@link CustomLogger} interface, which can be used for logging messages during the build process instead of the default Powerlines logger.
|
|
437
|
+
*
|
|
438
|
+
* @remarks
|
|
439
|
+
* Providing a custom logger allows you to integrate Powerlines logging with your own logging system or to customize the logging behavior, such as formatting log messages differently or sending logs to an external service. If a custom logger is not provided, Powerlines will use its default logger implementation.
|
|
433
440
|
*/
|
|
434
|
-
customLogger?:
|
|
441
|
+
customLogger?: CustomLogger;
|
|
435
442
|
/**
|
|
436
443
|
* The type of project being built
|
|
437
444
|
*
|
|
@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AAS,IAAA,CAAK,iBAAA;EA3D6B;;;EA+DzC,aAAA;EA7DC;;;EAkED,IAAA;EApEyC;;;EAyEzC,OAAA,GAAU,sBAAA;AAAA;;;;KAMF,qBAAA,GAAwB,QAAA,CAClC,IAAA,CAAK,aAAA;EA5EwB;;;;;;EAoF7B,QAAA;EAhFc;;;EAqFd,UAAA;AAAA;AAAA,KAGU,iBAAA,GAAoB,SAAA,GAAY,QAAA,CAAS,IAAA,CAAK,SAAA;AAAA,KAE9C,kBAAA,GAAqB,QAAA,CAAS,IAAA,CAAK,UAAA;EAC7C,MAAA,EAAQ,iBAAA;AAAA;AAAA,KAGE,oBAAA,GAAuB,QAAA,CACjC,IAAA,CAAK,YAAA,yBAEL,IAAA,CAAK,YAAA;EACH,IAAA,EAAM,kBAAA;AAAA;;;;KAME,gBAAA,qBAAmC,UAAA,GAAa,UAAA,IAAc,IAAA,CACxE,WAAA,0NAmBA,QAAA,CACE,IAAA,CACE,WAAA;EApHO;;;EAwIT,MAAA,EAAQ,oBAAA;EA/HY;;;EAoIpB,OAAA,EAAS,qBAAA;EAlIT;;;;;;;;;;EA8IA,iBAAA,EAAmB,kBAAA;EArJjB;;;EA0JF,YAAA,EAAc,YAAA,CAAa,WAAA;EArJf;;;EA0JZ,UAAA,EAAY,WAAA;EAxJC;;;EA6Jb,YAAA,EAAc,OAAA,CAAQ,WAAA;EA5JG;AAE7B;;EA+JI,OAAA,EAAS,YAAA,CAAa,YAAA,CAAa,WAAA;EA/JU;;;;;;EAuK7C,QAAA,EAAU,sBAAA;AAAA;AAAA"}
|
package/dist/types/config.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StoragePort, StoragePreset } from "./fs.mjs";
|
|
2
2
|
import { Plugin } from "./plugin.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { CustomLogger, LogLevelResolvedConfig, LogLevelUserConfig } from "./logging.mjs";
|
|
4
4
|
import { TSConfig } from "./tsconfig.mjs";
|
|
5
5
|
import { PluginContext } from "./context.mjs";
|
|
6
6
|
import { ConfigLayer, ResolvedConfig } from "c12";
|
|
@@ -234,6 +234,10 @@ interface OutputConfig {
|
|
|
234
234
|
storage?: StoragePort | StoragePreset;
|
|
235
235
|
}
|
|
236
236
|
interface EngineOptions {
|
|
237
|
+
/**
|
|
238
|
+
* The name of the project
|
|
239
|
+
*/
|
|
240
|
+
name?: string;
|
|
237
241
|
/**
|
|
238
242
|
* The root directory of the project
|
|
239
243
|
*/
|
|
@@ -276,7 +280,7 @@ interface EngineOptions {
|
|
|
276
280
|
*/
|
|
277
281
|
configFile?: string;
|
|
278
282
|
}
|
|
279
|
-
type ResolvedEngineOptions = PartialKeys<Required<EngineOptions>, "organization" | "configFile">;
|
|
283
|
+
type ResolvedEngineOptions = PartialKeys<Required<EngineOptions>, "organization" | "configFile" | "name">;
|
|
280
284
|
interface ExecutionOptions extends EngineOptions {
|
|
281
285
|
/**
|
|
282
286
|
* 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.
|
|
@@ -429,9 +433,12 @@ interface UserConfig extends Config, ExecutionOptions {
|
|
|
429
433
|
*/
|
|
430
434
|
logLevel?: LogLevelUserConfig;
|
|
431
435
|
/**
|
|
432
|
-
* A custom logger
|
|
436
|
+
* A custom logger instance that implements the {@link CustomLogger} interface, which can be used for logging messages during the build process instead of the default Powerlines logger.
|
|
437
|
+
*
|
|
438
|
+
* @remarks
|
|
439
|
+
* Providing a custom logger allows you to integrate Powerlines logging with your own logging system or to customize the logging behavior, such as formatting log messages differently or sending logs to an external service. If a custom logger is not provided, Powerlines will use its default logger implementation.
|
|
433
440
|
*/
|
|
434
|
-
customLogger?:
|
|
441
|
+
customLogger?: CustomLogger;
|
|
435
442
|
/**
|
|
436
443
|
* The type of project being built
|
|
437
444
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.mts","names":[],"sources":["../../src/types/config.ts"],"mappings":";;;;;;;;;;;;;;;;;AA+CA;KA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AAA;;;;KAMF,qBAAA,GAAwB,QAAA,CAClC,IAAA,CAAK,aAAA;EA5EwB;;;;;;EAoF7B,QAAA;EAhFc;;;EAqFd,UAAA;AAAA;AAAA,KAGU,iBAAA,GAAoB,SAAA,GAAY,QAAA,CAAS,IAAA,CAAK,SAAA;AAAA,KAE9C,kBAAA,GAAqB,QAAA,CAAS,IAAA,CAAK,UAAA;EAC7C,MAAA,EAAQ,iBAAA;AAAA;AAAA,KAGE,oBAAA,GAAuB,QAAA,CACjC,IAAA,CAAK,YAAA,yBAEL,IAAA,CAAK,YAAA;EACH,IAAA,EAAM,kBAAA;AAAA;;;;KAME,gBAAA,qBAAmC,UAAA,GAAa,UAAA,IAAc,IAAA,CACxE,WAAA,0NAmBA,QAAA,CACE,IAAA,CACE,WAAA;EApHO;;;EAwIT,MAAA,EAAQ,oBAAA;EA/HY;;;EAoIpB,OAAA,EAAS,qBAAA;EAlIT;;;;;;;;;;EA8IA,iBAAA,EAAmB,kBAAA;EArJjB;;;EA0JF,YAAA,EAAc,YAAA,CAAa,WAAA;EArJf;;;EA0JZ,UAAA,EAAY,WAAA;EAxJC;;;EA6Jb,YAAA,EAAc,OAAA,CAAQ,WAAA;EA5JG;AAE7B;;EA+JI,OAAA,EAAS,YAAA,CAAa,YAAA,CAAa,WAAA;EA/JU;;;;;;EAuK7C,QAAA,EAAU,sBAAA;AAAA;AAAA"}
|
package/dist/types/context.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ResolveOptions, VirtualFile, VirtualFileSystemInterface, WriteOptions } from "./fs.cjs";
|
|
2
2
|
import { Plugin } from "./plugin.cjs";
|
|
3
3
|
import { HooksList, HooksListItem } from "./hooks.cjs";
|
|
4
|
-
import {
|
|
4
|
+
import { LogLevelResolvedConfig, LogMessage, Logger, LoggerOptions } from "./logging.cjs";
|
|
5
5
|
import { ParsedTypeScriptConfig } from "./tsconfig.cjs";
|
|
6
6
|
import { EngineOptions, EnvironmentResolvedConfig, ParsedUserConfig, ResolvedConfig, ResolvedEngineOptions, ResolvedEntryTypeDefinition, ResolvedExecutionOptions } from "./config.cjs";
|
|
7
7
|
import { Jiti } from "jiti";
|
|
@@ -13,7 +13,7 @@ import { ParseResult, ParserOptions } from "oxc-parser";
|
|
|
13
13
|
import { Range } from "semver";
|
|
14
14
|
import { RequestInfo, Response } from "undici";
|
|
15
15
|
import { Unimport } from "unimport";
|
|
16
|
-
import { ExternalIdResult, UnpluginBuildContext
|
|
16
|
+
import { ExternalIdResult, UnpluginBuildContext } from "unplugin";
|
|
17
17
|
|
|
18
18
|
//#region src/types/context.d.ts
|
|
19
19
|
interface MetaInfo {
|
|
@@ -129,9 +129,6 @@ interface ResolveResult extends ExternalIdResult {
|
|
|
129
129
|
*/
|
|
130
130
|
virtual?: boolean;
|
|
131
131
|
}
|
|
132
|
-
interface PowerlinesMessage extends UnpluginMessage {
|
|
133
|
-
meta: Partial<LogMeta>;
|
|
134
|
-
}
|
|
135
132
|
/**
|
|
136
133
|
* The base Powerlines context.
|
|
137
134
|
*
|
|
@@ -164,33 +161,33 @@ interface BaseContext {
|
|
|
164
161
|
*/
|
|
165
162
|
logLevel: LogLevelResolvedConfig;
|
|
166
163
|
/**
|
|
167
|
-
*
|
|
164
|
+
* An instance of the Powerlines logger client that can be used to generate log messages with consistent formatting and metadata.
|
|
168
165
|
*/
|
|
169
|
-
|
|
166
|
+
logger: Logger;
|
|
170
167
|
/**
|
|
171
168
|
* A logging function for fatal messages
|
|
172
169
|
*/
|
|
173
|
-
fatal: (message: string |
|
|
170
|
+
fatal: (message: string | LogMessage) => void;
|
|
174
171
|
/**
|
|
175
172
|
* A logging function for error messages
|
|
176
173
|
*/
|
|
177
|
-
error: (message: string |
|
|
174
|
+
error: (message: string | LogMessage) => void;
|
|
178
175
|
/**
|
|
179
176
|
* A logging function for warning messages
|
|
180
177
|
*/
|
|
181
|
-
warn: (message: string |
|
|
178
|
+
warn: (message: string | LogMessage) => void;
|
|
182
179
|
/**
|
|
183
180
|
* A logging function for informational messages
|
|
184
181
|
*/
|
|
185
|
-
info: (message: string |
|
|
182
|
+
info: (message: string | LogMessage) => void;
|
|
186
183
|
/**
|
|
187
184
|
* A logging function for debug messages
|
|
188
185
|
*/
|
|
189
|
-
debug: (message: string |
|
|
186
|
+
debug: (message: string | LogMessage) => void;
|
|
190
187
|
/**
|
|
191
188
|
* A logging function for trace messages
|
|
192
189
|
*/
|
|
193
|
-
trace: (message: string |
|
|
190
|
+
trace: (message: string | LogMessage) => void;
|
|
194
191
|
/**
|
|
195
192
|
* A function to create a timer for measuring the duration of asynchronous operations
|
|
196
193
|
*
|
|
@@ -208,17 +205,17 @@ interface BaseContext {
|
|
|
208
205
|
/**
|
|
209
206
|
* Create a new logger instance
|
|
210
207
|
*
|
|
211
|
-
* @param
|
|
212
|
-
* @returns A logger
|
|
208
|
+
* @param options - The configuration options to use for the logger instance, which can be used to customize the appearance and behavior of the log messages generated by the logger. This is typically the name of the plugin or module that is creating the logger instance.
|
|
209
|
+
* @returns A logger client instance that can be used to generate log messages with consistent formatting and metadata.
|
|
213
210
|
*/
|
|
214
|
-
|
|
211
|
+
createLogger: (options: LoggerOptions) => Logger;
|
|
215
212
|
/**
|
|
216
213
|
* Extend the current logger instance with a new source
|
|
217
214
|
*
|
|
218
|
-
* @param
|
|
219
|
-
* @returns A logger
|
|
215
|
+
* @param options - The overlay metadata to use for the badge in the log output.
|
|
216
|
+
* @returns A logger client instance that extends the current logger with the provided configuration options.
|
|
220
217
|
*/
|
|
221
|
-
|
|
218
|
+
extendLogger: (options: LoggerOptions) => Logger;
|
|
222
219
|
/**
|
|
223
220
|
* A function to create a deep clone of the context
|
|
224
221
|
*
|
|
@@ -708,13 +705,6 @@ interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedCon
|
|
|
708
705
|
* The environment specific resolved configuration
|
|
709
706
|
*/
|
|
710
707
|
environment: EnvironmentResolvedConfig;
|
|
711
|
-
/**
|
|
712
|
-
* An alternative property name for the {@link log} property
|
|
713
|
-
*
|
|
714
|
-
* @remarks
|
|
715
|
-
* This is provided for compatibility with other logging libraries that expect a `logger` property.
|
|
716
|
-
*/
|
|
717
|
-
logger: LogFn;
|
|
718
708
|
/**
|
|
719
709
|
* A function to create a deep clone of the context
|
|
720
710
|
*
|
|
@@ -737,7 +727,6 @@ declare type __ΩParseOptions = any[];
|
|
|
737
727
|
declare type __ΩEmitOptions = any[];
|
|
738
728
|
declare type __ΩEmitEntryOptions = any[];
|
|
739
729
|
declare type __ΩResolveResult = any[];
|
|
740
|
-
declare type __ΩPowerlinesMessage = any[];
|
|
741
730
|
declare type __ΩBaseContext = any[];
|
|
742
731
|
declare type __ΩExecutionStateItem = any[];
|
|
743
732
|
declare type __ΩHookExecutionStateItem = any[];
|
|
@@ -754,5 +743,5 @@ declare type __ΩPluginContext = any[];
|
|
|
754
743
|
declare type __ΩBuildPluginContext = any[];
|
|
755
744
|
declare type __ΩWithUnpluginBuildContext = any[];
|
|
756
745
|
//#endregion
|
|
757
|
-
export { BaseContext, BuildPluginContext, Context, EmitEntryOptions, EmitOptions, EngineContext, EnvironmentContext, EnvironmentContextPlugin, ExecutionContext, ExecutionState, ExecutionStateItem, FetchOptions, HookExecutionStateItem, InitContextOptions, MetaInfo, ParseOptions, PluginContext,
|
|
746
|
+
export { BaseContext, BuildPluginContext, Context, EmitEntryOptions, EmitOptions, EngineContext, EnvironmentContext, EnvironmentContextPlugin, ExecutionContext, ExecutionState, ExecutionStateItem, FetchOptions, HookExecutionStateItem, InitContextOptions, MetaInfo, ParseOptions, PluginContext, ResolveResult, Resolver, SelectHookResult, SelectHookResultItem, SelectHooksOptions, SourceFile, TransformResult$1 as TransformResult, UnimportContext, UnresolvedContext, WithUnpluginBuildContext, __ΩBaseContext, __ΩBuildPluginContext, __ΩContext, __ΩEmitEntryOptions, __ΩEmitOptions, __ΩEngineContext, __ΩEnvironmentContext, __ΩEnvironmentContextPlugin, __ΩExecutionContext, __ΩExecutionState, __ΩExecutionStateItem, __ΩFetchOptions, __ΩHookExecutionStateItem, __ΩInitContextOptions, __ΩMetaInfo, __ΩParseOptions, __ΩPluginContext, __ΩResolveResult, __ΩResolver, __ΩSelectHookResult, __ΩSelectHookResultItem, __ΩSelectHooksOptions, __ΩSourceFile, __ΩTransformResult, __ΩUnimportContext, __ΩUnresolvedContext, __ΩWithUnpluginBuildContext };
|
|
758
747
|
//# sourceMappingURL=context.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.cts","names":[],"sources":["../../src/types/context.ts"],"mappings":";;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"context.d.cts","names":[],"sources":["../../src/types/context.ts"],"mappings":";;;;;;;;;;;;;;;;;;UAsDiB,QAAA;EAAA;;;EAIf,QAAA;EAAA;;;EAKA,OAAA;EAeA;;;EAVA,SAAA;EAkBe;;;EAbf,SAAA;EAagC;;;EARhC,QAAA;EASY;AAGd;;EAPE,UAAA;AAAA;AAAA,UAGe,QAAA,SAAiB,IAAA;EAChC,MAAA,EAAQ,IAAA;AAAA;AAAA,UAGO,iBAAA;EACf,IAAA;EACA,GAAA,EAAK,SAAA;AAAA;;;;UAMU,UAAA;EAST;;;EALN,EAAA;EAewB;;AAG1B;EAbE,IAAA,EAAM,WAAA;;;;EAKN,GAAA;EAUwB;;;EALxB,MAAA,GAAS,iBAAA;AAAA;AAAA,KAGC,eAAA,GAAkB,IAAA,CAAK,QAAA;EACjC,WAAA,QAAmB,OAAA;EACnB,aAAA,GAAgB,MAAA,EAAQ,UAAA,KAAe,OAAA,CAAQ,UAAA;EAC/C,qBAAA,QAA6B,OAAA;AAAA;AAAA,UAGd,kBAAA;EACf,KAAA;AAAA;;;;UAMe,kBAAA;EAVqB;;AAGtC;;;EAaE,cAAA;AAAA;AANF;;;AAAA,UAYiB,YAAA,SAAqB,mBAAA;EANtB;AAMhB;;EAIE,SAAA;AAAA;;AAMF;;UAAiB,YAAA,SAAqB,aAAA;EAAA;;A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,KAGC,gBAAA,kBACO,aAAA,yBAEf,oBAAA,CAAqB,QAAA,EAAU,IAAA;AAAA,UAElB,kBAAA,yBACS,cAAA,GAAiB,cAAA,UACjC,OAAA,CAAQ,eAAA;EA2Be;;;EAvB/B,EAAA;EA6BE;;;;;;EArBF,OAAA,EAAS,wBAAA,CAAyB,eAAA;EA+BlC;;;EA1BA,SAAA,GAAY,MAAA,EAAQ,MAAA,CAAO,aAAA,CAAc,eAAA,OAAsB,OAAA;EA0BR;;AAGzD;EAxBE,WAAA,EAAa,yBAAA;EAwBe;;;EAnB5B,KAAA,EAAO,SAAA,CAAU,aAAA,CAAc,eAAA;EA8BlB;;;EAzBb,WAAA,wBACE,GAAA,EAAK,IAAA,EACL,OAAA,GAAU,kBAAA,KACP,gBAAA,CAAiB,aAAA,CAAc,eAAA,GAAkB,IAAA;EAa9C;;;;;;EALR,KAAA,QAAa,OAAA,CAAQ,kBAAA,CAAmB,eAAA;AAAA;AAAA,UAGzB,aAAA,6BACa,cAAA,GAAiB,cAAA,UACrC,OAAA,CAAQ,eAAA;EAShB;;;EALA,EAAA;EAaqB;;;EARrB,WAAA,EAAa,yBAAA;EAWH;;;;;;EAHV,KAAA,QAAa,OAAA,CAAQ,aAAA,CAAc,eAAA;AAAA;AAAA,KAGzB,kBAAA,yBACc,cAAA,GAAiB,cAAA,IACvC,oBAAA,GAAuB,aAAA,CAAc,eAAA;AAAA,KAE7B,wBAAA,kBAA0C,aAAA,IACpD,oBAAA,GAAuB,QAAA;AAAA"}
|
package/dist/types/context.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ResolveOptions, VirtualFile, VirtualFileSystemInterface, WriteOptions } from "./fs.mjs";
|
|
2
2
|
import { Plugin } from "./plugin.mjs";
|
|
3
3
|
import { HooksList, HooksListItem } from "./hooks.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { LogLevelResolvedConfig, LogMessage, Logger, LoggerOptions } from "./logging.mjs";
|
|
5
5
|
import { ParsedTypeScriptConfig } from "./tsconfig.mjs";
|
|
6
6
|
import { EngineOptions, EnvironmentResolvedConfig, ParsedUserConfig, ResolvedConfig, ResolvedEngineOptions, ResolvedEntryTypeDefinition, ResolvedExecutionOptions } from "./config.mjs";
|
|
7
|
-
import { ExternalIdResult, UnpluginBuildContext
|
|
7
|
+
import { ExternalIdResult, UnpluginBuildContext } from "unplugin";
|
|
8
8
|
import MagicString, { SourceMap } from "magic-string";
|
|
9
9
|
import { Jiti } from "jiti";
|
|
10
10
|
import { EnvPaths } from "@stryke/env/get-env-paths";
|
|
@@ -129,9 +129,6 @@ interface ResolveResult extends ExternalIdResult {
|
|
|
129
129
|
*/
|
|
130
130
|
virtual?: boolean;
|
|
131
131
|
}
|
|
132
|
-
interface PowerlinesMessage extends UnpluginMessage {
|
|
133
|
-
meta: Partial<LogMeta>;
|
|
134
|
-
}
|
|
135
132
|
/**
|
|
136
133
|
* The base Powerlines context.
|
|
137
134
|
*
|
|
@@ -164,33 +161,33 @@ interface BaseContext {
|
|
|
164
161
|
*/
|
|
165
162
|
logLevel: LogLevelResolvedConfig;
|
|
166
163
|
/**
|
|
167
|
-
*
|
|
164
|
+
* An instance of the Powerlines logger client that can be used to generate log messages with consistent formatting and metadata.
|
|
168
165
|
*/
|
|
169
|
-
|
|
166
|
+
logger: Logger;
|
|
170
167
|
/**
|
|
171
168
|
* A logging function for fatal messages
|
|
172
169
|
*/
|
|
173
|
-
fatal: (message: string |
|
|
170
|
+
fatal: (message: string | LogMessage) => void;
|
|
174
171
|
/**
|
|
175
172
|
* A logging function for error messages
|
|
176
173
|
*/
|
|
177
|
-
error: (message: string |
|
|
174
|
+
error: (message: string | LogMessage) => void;
|
|
178
175
|
/**
|
|
179
176
|
* A logging function for warning messages
|
|
180
177
|
*/
|
|
181
|
-
warn: (message: string |
|
|
178
|
+
warn: (message: string | LogMessage) => void;
|
|
182
179
|
/**
|
|
183
180
|
* A logging function for informational messages
|
|
184
181
|
*/
|
|
185
|
-
info: (message: string |
|
|
182
|
+
info: (message: string | LogMessage) => void;
|
|
186
183
|
/**
|
|
187
184
|
* A logging function for debug messages
|
|
188
185
|
*/
|
|
189
|
-
debug: (message: string |
|
|
186
|
+
debug: (message: string | LogMessage) => void;
|
|
190
187
|
/**
|
|
191
188
|
* A logging function for trace messages
|
|
192
189
|
*/
|
|
193
|
-
trace: (message: string |
|
|
190
|
+
trace: (message: string | LogMessage) => void;
|
|
194
191
|
/**
|
|
195
192
|
* A function to create a timer for measuring the duration of asynchronous operations
|
|
196
193
|
*
|
|
@@ -208,17 +205,17 @@ interface BaseContext {
|
|
|
208
205
|
/**
|
|
209
206
|
* Create a new logger instance
|
|
210
207
|
*
|
|
211
|
-
* @param
|
|
212
|
-
* @returns A logger
|
|
208
|
+
* @param options - The configuration options to use for the logger instance, which can be used to customize the appearance and behavior of the log messages generated by the logger. This is typically the name of the plugin or module that is creating the logger instance.
|
|
209
|
+
* @returns A logger client instance that can be used to generate log messages with consistent formatting and metadata.
|
|
213
210
|
*/
|
|
214
|
-
|
|
211
|
+
createLogger: (options: LoggerOptions) => Logger;
|
|
215
212
|
/**
|
|
216
213
|
* Extend the current logger instance with a new source
|
|
217
214
|
*
|
|
218
|
-
* @param
|
|
219
|
-
* @returns A logger
|
|
215
|
+
* @param options - The overlay metadata to use for the badge in the log output.
|
|
216
|
+
* @returns A logger client instance that extends the current logger with the provided configuration options.
|
|
220
217
|
*/
|
|
221
|
-
|
|
218
|
+
extendLogger: (options: LoggerOptions) => Logger;
|
|
222
219
|
/**
|
|
223
220
|
* A function to create a deep clone of the context
|
|
224
221
|
*
|
|
@@ -708,13 +705,6 @@ interface PluginContext<out TResolvedConfig extends ResolvedConfig = ResolvedCon
|
|
|
708
705
|
* The environment specific resolved configuration
|
|
709
706
|
*/
|
|
710
707
|
environment: EnvironmentResolvedConfig;
|
|
711
|
-
/**
|
|
712
|
-
* An alternative property name for the {@link log} property
|
|
713
|
-
*
|
|
714
|
-
* @remarks
|
|
715
|
-
* This is provided for compatibility with other logging libraries that expect a `logger` property.
|
|
716
|
-
*/
|
|
717
|
-
logger: LogFn;
|
|
718
708
|
/**
|
|
719
709
|
* A function to create a deep clone of the context
|
|
720
710
|
*
|
|
@@ -737,7 +727,6 @@ declare type __ΩParseOptions = any[];
|
|
|
737
727
|
declare type __ΩEmitOptions = any[];
|
|
738
728
|
declare type __ΩEmitEntryOptions = any[];
|
|
739
729
|
declare type __ΩResolveResult = any[];
|
|
740
|
-
declare type __ΩPowerlinesMessage = any[];
|
|
741
730
|
declare type __ΩBaseContext = any[];
|
|
742
731
|
declare type __ΩExecutionStateItem = any[];
|
|
743
732
|
declare type __ΩHookExecutionStateItem = any[];
|
|
@@ -754,5 +743,5 @@ declare type __ΩPluginContext = any[];
|
|
|
754
743
|
declare type __ΩBuildPluginContext = any[];
|
|
755
744
|
declare type __ΩWithUnpluginBuildContext = any[];
|
|
756
745
|
//#endregion
|
|
757
|
-
export { BaseContext, BuildPluginContext, Context, EmitEntryOptions, EmitOptions, EngineContext, EnvironmentContext, EnvironmentContextPlugin, ExecutionContext, ExecutionState, ExecutionStateItem, FetchOptions, HookExecutionStateItem, InitContextOptions, MetaInfo, ParseOptions, PluginContext,
|
|
746
|
+
export { BaseContext, BuildPluginContext, Context, EmitEntryOptions, EmitOptions, EngineContext, EnvironmentContext, EnvironmentContextPlugin, ExecutionContext, ExecutionState, ExecutionStateItem, FetchOptions, HookExecutionStateItem, InitContextOptions, MetaInfo, ParseOptions, PluginContext, ResolveResult, Resolver, SelectHookResult, SelectHookResultItem, SelectHooksOptions, SourceFile, TransformResult$1 as TransformResult, UnimportContext, UnresolvedContext, WithUnpluginBuildContext, __ΩBaseContext, __ΩBuildPluginContext, __ΩContext, __ΩEmitEntryOptions, __ΩEmitOptions, __ΩEngineContext, __ΩEnvironmentContext, __ΩEnvironmentContextPlugin, __ΩExecutionContext, __ΩExecutionState, __ΩExecutionStateItem, __ΩFetchOptions, __ΩHookExecutionStateItem, __ΩInitContextOptions, __ΩMetaInfo, __ΩParseOptions, __ΩPluginContext, __ΩResolveResult, __ΩResolver, __ΩSelectHookResult, __ΩSelectHookResultItem, __ΩSelectHooksOptions, __ΩSourceFile, __ΩTransformResult, __ΩUnimportContext, __ΩUnresolvedContext, __ΩWithUnpluginBuildContext };
|
|
758
747
|
//# sourceMappingURL=context.d.mts.map
|