@powerlines/core 0.44.9 → 0.44.11
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/index.d.cts +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/lib/config.d.cts +2 -2
- package/dist/lib/config.d.cts.map +1 -1
- package/dist/lib/config.d.mts +2 -2
- package/dist/lib/config.d.mts.map +1 -1
- package/dist/lib/config.mjs.map +1 -1
- package/dist/lib/unplugin/plugin.cjs +1 -1
- package/dist/lib/unplugin/plugin.mjs +1 -1
- package/dist/lib/unplugin/plugin.mjs.map +1 -1
- package/dist/plugin-utils/index.cjs +1 -0
- package/dist/plugin-utils/index.d.cts +2 -2
- package/dist/plugin-utils/index.d.mts +2 -2
- package/dist/plugin-utils/index.mjs +2 -2
- package/dist/plugin-utils/logging.cjs +122 -20
- package/dist/plugin-utils/logging.d.cts +12 -4
- package/dist/plugin-utils/logging.d.cts.map +1 -1
- package/dist/plugin-utils/logging.d.mts +12 -4
- package/dist/plugin-utils/logging.d.mts.map +1 -1
- package/dist/plugin-utils/logging.mjs +122 -21
- package/dist/plugin-utils/logging.mjs.map +1 -1
- package/dist/types/api.d.cts +11 -4
- package/dist/types/api.d.cts.map +1 -1
- package/dist/types/api.d.mts +11 -4
- package/dist/types/api.d.mts.map +1 -1
- package/dist/types/config.d.cts +8 -10
- package/dist/types/config.d.cts.map +1 -1
- package/dist/types/config.d.mts +8 -10
- package/dist/types/config.d.mts.map +1 -1
- package/dist/types/context.d.cts +7 -7
- package/dist/types/context.d.cts.map +1 -1
- package/dist/types/context.d.mts +7 -7
- package/dist/types/context.d.mts.map +1 -1
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.mts +2 -2
- package/dist/types/logging.d.cts +1 -1
- package/dist/types/logging.d.cts.map +1 -1
- package/dist/types/logging.d.mts +1 -1
- package/dist/types/logging.d.mts.map +1 -1
- package/dist/types/logging.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { ResolveOptions, StorageAdapter, StoragePort, StoragePreset, VirtualFile, VirtualFileData, VirtualFileExtension, VirtualFileMetadata, VirtualFileSystemInterface, WriteData, WriteOptions, __ΩResolveOptions, __ΩStorageAdapter, __ΩStoragePort, __ΩStoragePreset, __ΩVirtualFile, __ΩVirtualFileData, __ΩVirtualFileExtension, __ΩVirtualFileMetadata, __ΩVirtualFileSystemInterface, __ΩWriteData, __ΩWriteOptions } from "./types/fs.cjs";
|
|
2
2
|
import { BaseCommandType, CommandType, Commands, __ΩBaseCommandType, __ΩCommandType, __ΩCommands } from "./types/commands.cjs";
|
|
3
3
|
import { WorkerProcess, __ΩWorkerProcess } from "./types/utils.cjs";
|
|
4
|
-
import { API, Engine, Execution, ExecutionWorkerParams, ExecutionWorkerProcess, __ΩAPI, __ΩEngine, __ΩExecution, __ΩExecutionWorkerParams, __ΩExecutionWorkerProcess } from "./types/api.cjs";
|
|
4
|
+
import { API, APIFunctions, BaseAPIFunctions, Engine, Execution, ExecutionWorkerParams, ExecutionWorkerProcess, SupportedCommands, __ΩAPI, __ΩAPIFunctions, __ΩBaseAPIFunctions, __ΩEngine, __ΩExecution, __ΩExecutionWorkerParams, __ΩExecutionWorkerProcess, __ΩSupportedCommands } from "./types/api.cjs";
|
|
5
5
|
import { BuilderVariant, InferUnpluginOptions, InferUnpluginVariant, UnpluginAsyncFactory, UnpluginBuilderVariant, UnpluginFactory, UnpluginHookFunctions, UnpluginOptions, UnpluginUserConfig, __ΩBuilderVariant, __ΩInferUnpluginOptions, __ΩInferUnpluginVariant, __ΩUnpluginAsyncFactory, __ΩUnpluginBuilderVariant, __ΩUnpluginFactory, __ΩUnpluginHookFunctions, __ΩUnpluginOptions, __ΩUnpluginUserConfig } from "./types/unplugin.cjs";
|
|
6
6
|
import { BasePlugin, HookFunctions, Hooks, Plugin, PluginHook, PluginHookFields, PluginHookObject, PluginHooks, PluginNonHookFields, TypesResult, __ΩBasePlugin, __ΩHookFunctions, __ΩHooks, __ΩPlugin, __ΩPluginHook, __ΩPluginHookFields, __ΩPluginHookObject, __ΩPluginHooks, __ΩPluginNonHookFields, __ΩTypesResult } from "./types/plugin.cjs";
|
|
7
7
|
import { CallHookOptions, HookListOrders, HooksList, HooksListItem, InferHookFunction, InferHookParameters, InferHookReturnType, InferHookThisType, NormalizedStringFilter, PluginFilter, TransformHookFilter, __ΩCallHookOptions, __ΩHookListOrders, __ΩHooksList, __ΩHooksListItem, __ΩInferHookFunction, __ΩInferHookParameters, __ΩInferHookReturnType, __ΩInferHookThisType, __ΩNormalizedStringFilter, __ΩPluginFilter, __ΩTransformHookFilter } from "./types/hooks.cjs";
|
|
8
8
|
import { CustomLogger, CustomLoggerMessage, LOG_CATEGORIES, LOG_LEVELS, LogCategories, LogCategory, LogFn, LogFnMeta, LogFnOptions, LogLevel, LogLevelResolvedConfig, LogLevelUserConfig, LogLevels, LogMessage, LogMeta, Logger, LoggerMessage, LoggerMeta, LoggerOptions, PowerlinesMessage, __ΩCustomLogger, __ΩCustomLoggerMessage, __ΩLogCategory, __ΩLogFn, __ΩLogFnMeta, __ΩLogFnOptions, __ΩLogLevel, __ΩLogLevelResolvedConfig, __ΩLogLevelUserConfig, __ΩLogMessage, __ΩLogMeta, __ΩLogger, __ΩLoggerMessage, __ΩLoggerMeta, __ΩLoggerOptions, __ΩPowerlinesMessage } from "./types/logging.cjs";
|
|
9
9
|
import { DeepkitOptions, Level, ParsedTypeScriptConfig, RawReflectionMode, ReflectionMode, TSCompilerOptions, TSConfig, __ΩDeepkitOptions, __ΩLevel, __ΩParsedTypeScriptConfig, __ΩRawReflectionMode, __ΩReflectionMode, __ΩTSCompilerOptions, __ΩTSConfig } from "./types/tsconfig.cjs";
|
|
10
10
|
import { 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, __Ω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 } from "./types/context.cjs";
|
|
11
|
-
import { AnyOutputUserConfig, AnyUserConfig, BuildInlineConfig, CleanInlineConfig, Config, CopyConfig, CopyResolvedConfig, DeployInlineConfig, DocsInlineConfig, EngineOptions, EnvironmentConfig, EnvironmentResolvedConfig, ExecutionOptions, InlineConfig, LintInlineConfig, Mode, NewInlineConfig, OutputConfig, OutputResolvedConfig, ParsedUserConfig, PartialPlugin, PartialPluginFactory, PluginConfig, PluginConfigObject, PluginConfigTuple, PluginFactory, PowerlinesCommand, PrepareInlineConfig, ProjectType, ResolveConfig, ResolveResolvedConfig, ResolvedAssetGlob, ResolvedConfig,
|
|
11
|
+
import { AnyOutputUserConfig, AnyUserConfig, BuildInlineConfig, CleanInlineConfig, Config, CopyConfig, CopyResolvedConfig, DeployInlineConfig, DocsInlineConfig, EngineInputOptions, EngineOptions, EnvironmentConfig, EnvironmentResolvedConfig, ExecutionOptions, InlineConfig, LintInlineConfig, Mode, NewInlineConfig, OutputConfig, OutputResolvedConfig, ParsedUserConfig, PartialPlugin, PartialPluginFactory, PluginConfig, PluginConfigObject, PluginConfigTuple, PluginFactory, PowerlinesCommand, PrepareInlineConfig, ProjectType, ResolveConfig, ResolveResolvedConfig, ResolvedAssetGlob, ResolvedConfig, ResolvedEntryTypeDefinition, TestInlineConfig, TypesInlineConfig, UserConfig, UserConfigFn, WorkspaceConfig, __ΩAnyOutputUserConfig, __ΩAnyUserConfig, __ΩBuildInlineConfig, __ΩCleanInlineConfig, __ΩConfig, __ΩCopyConfig, __ΩCopyResolvedConfig, __ΩDeployInlineConfig, __ΩDocsInlineConfig, __ΩEngineInputOptions, __ΩEngineOptions, __ΩEnvironmentConfig, __ΩEnvironmentResolvedConfig, __ΩExecutionOptions, __ΩInlineConfig, __ΩLintInlineConfig, __ΩMode, __ΩNewInlineConfig, __ΩOutputConfig, __ΩOutputResolvedConfig, __ΩParsedUserConfig, __ΩPartialPlugin, __ΩPartialPluginFactory, __ΩPluginConfig, __ΩPluginConfigObject, __ΩPluginConfigTuple, __ΩPluginFactory, __ΩPowerlinesCommand, __ΩPrepareInlineConfig, __ΩProjectType, __ΩResolveConfig, __ΩResolveResolvedConfig, __ΩResolvedAssetGlob, __ΩResolvedConfig, __ΩResolvedEntryTypeDefinition, __ΩTestInlineConfig, __ΩTypesInlineConfig, __ΩUserConfig, __ΩUserConfigFn, __ΩWorkspaceConfig } from "./types/config.cjs";
|
|
12
12
|
import { PartiallyResolvedContext, __ΩPartiallyResolvedContext, defineConfig, loadUserConfigFile, loadWorkspaceConfig } from "./lib/config.cjs";
|
|
13
13
|
import { getUniqueInputs, isResolvedEntryTypeDefinition, isTypeDefinition, resolveEntryOutput, resolveInput, resolveInputs, resolveInputsSync } from "./lib/entry.cjs";
|
|
14
14
|
import { combineContexts, isUnpluginBuilderVariant } from "./lib/unplugin/helpers.cjs";
|
|
@@ -19,4 +19,4 @@ import { format, formatFolder } from "./lib/utilities/format.cjs";
|
|
|
19
19
|
import { getMagicString, getSourceFile, getString } from "./lib/utilities/source-file.cjs";
|
|
20
20
|
import { generateSourceMap } from "./lib/utilities/source-map.cjs";
|
|
21
21
|
import { writeFile } from "./lib/utilities/write-file.cjs";
|
|
22
|
-
export { API, AnyOutputUserConfig, AnyUserConfig, BaseCommandType, BaseContext, BasePlugin, BuildInlineConfig, BuildPluginContext, BuilderVariant, CallHookOptions, CleanInlineConfig, CommandType, Commands, Config, Context, CopyConfig, CopyResolvedConfig, CreateUnpluginModuleResolutionFunctionsOptions, CreateUnpluginOptions, CreateUnpluginResolverOptions, CustomLogger, CustomLoggerMessage, DeepkitOptions, DeployInlineConfig, DocsInlineConfig, EmitEntryOptions, EmitOptions, Engine, EngineContext, EngineOptions, EnvironmentConfig, EnvironmentContext, EnvironmentContextPlugin, EnvironmentResolvedConfig, Execution, ExecutionContext, ExecutionOptions, ExecutionState, ExecutionStateItem, ExecutionWorkerParams, ExecutionWorkerProcess, FetchOptions, FileHeaderOptions, HookExecutionStateItem, HookFunctions, HookListOrders, Hooks, HooksList, HooksListItem, InferHookFunction, InferHookParameters, InferHookReturnType, InferHookThisType, InferUnpluginOptions, InferUnpluginVariant, InitContextOptions, InlineConfig, LOG_CATEGORIES, LOG_LEVELS, Level, LintInlineConfig, LogCategories, LogCategory, LogFn, LogFnMeta, LogFnOptions, LogLevel, LogLevelResolvedConfig, LogLevelUserConfig, LogLevels, LogMessage, LogMeta, Logger, LoggerMessage, LoggerMeta, LoggerOptions, MetaInfo, Mode, NewInlineConfig, NormalizedStringFilter, OutputConfig, OutputResolvedConfig, ParseOptions, ParsedTypeScriptConfig, ParsedUserConfig, PartialPlugin, PartialPluginFactory, PartiallyResolvedContext, Plugin, PluginConfig, PluginConfigObject, PluginConfigTuple, PluginContext, PluginFactory, PluginFilter, PluginHook, PluginHookFields, PluginHookObject, PluginHooks, PluginNonHookFields, PowerlinesCommand, PowerlinesMessage, PrepareInlineConfig, ProjectType, RawReflectionMode, ReflectionMode, ResolveConfig, ResolveOptions, ResolveResolvedConfig, ResolveResult, ResolvedAssetGlob, ResolvedConfig,
|
|
22
|
+
export { API, APIFunctions, AnyOutputUserConfig, AnyUserConfig, BaseAPIFunctions, BaseCommandType, BaseContext, BasePlugin, BuildInlineConfig, BuildPluginContext, BuilderVariant, CallHookOptions, CleanInlineConfig, CommandType, Commands, Config, Context, CopyConfig, CopyResolvedConfig, CreateUnpluginModuleResolutionFunctionsOptions, CreateUnpluginOptions, CreateUnpluginResolverOptions, CustomLogger, CustomLoggerMessage, DeepkitOptions, DeployInlineConfig, DocsInlineConfig, EmitEntryOptions, EmitOptions, Engine, EngineContext, EngineInputOptions, EngineOptions, EnvironmentConfig, EnvironmentContext, EnvironmentContextPlugin, EnvironmentResolvedConfig, Execution, ExecutionContext, ExecutionOptions, ExecutionState, ExecutionStateItem, ExecutionWorkerParams, ExecutionWorkerProcess, FetchOptions, FileHeaderOptions, HookExecutionStateItem, HookFunctions, HookListOrders, Hooks, HooksList, HooksListItem, InferHookFunction, InferHookParameters, InferHookReturnType, InferHookThisType, InferUnpluginOptions, InferUnpluginVariant, InitContextOptions, InlineConfig, LOG_CATEGORIES, LOG_LEVELS, Level, LintInlineConfig, LogCategories, LogCategory, LogFn, LogFnMeta, LogFnOptions, LogLevel, LogLevelResolvedConfig, LogLevelUserConfig, LogLevels, LogMessage, LogMeta, Logger, LoggerMessage, LoggerMeta, LoggerOptions, MetaInfo, Mode, NewInlineConfig, NormalizedStringFilter, OutputConfig, OutputResolvedConfig, ParseOptions, ParsedTypeScriptConfig, ParsedUserConfig, PartialPlugin, PartialPluginFactory, PartiallyResolvedContext, Plugin, PluginConfig, PluginConfigObject, PluginConfigTuple, PluginContext, PluginFactory, PluginFilter, PluginHook, PluginHookFields, PluginHookObject, PluginHooks, PluginNonHookFields, PowerlinesCommand, PowerlinesMessage, PrepareInlineConfig, ProjectType, RawReflectionMode, ReflectionMode, ResolveConfig, ResolveOptions, ResolveResolvedConfig, ResolveResult, ResolvedAssetGlob, ResolvedConfig, ResolvedEntryTypeDefinition, Resolver, SelectHookResult, SelectHookResultItem, SelectHooksOptions, SourceFile, StorageAdapter, StoragePort, StoragePreset, SupportedCommands, TSCompilerOptions, TSConfig, TestInlineConfig, TransformHookFilter, TransformResult, TypesInlineConfig, TypesResult, UnimportContext, UnpluginAsyncFactory, UnpluginBuilderVariant, UnpluginFactory, UnpluginHookFunctions, UnpluginOptions, UnpluginUserConfig, UnresolvedContext, UserConfig, UserConfigFn, VirtualFile, VirtualFileData, VirtualFileExtension, VirtualFileMetadata, VirtualFileSystemInterface, WithUnpluginBuildContext, WorkerProcess, WorkspaceConfig, WriteData, WriteOptions, __ΩAPI, __ΩAPIFunctions, __ΩAnyOutputUserConfig, __ΩAnyUserConfig, __ΩBaseAPIFunctions, __ΩBaseCommandType, __ΩBaseContext, __ΩBasePlugin, __ΩBuildInlineConfig, __ΩBuildPluginContext, __ΩBuilderVariant, __ΩCallHookOptions, __ΩCleanInlineConfig, __ΩCommandType, __ΩCommands, __ΩConfig, __ΩContext, __ΩCopyConfig, __ΩCopyResolvedConfig, __ΩCreateUnpluginModuleResolutionFunctionsOptions, __ΩCreateUnpluginOptions, __ΩCreateUnpluginResolverOptions, __ΩCustomLogger, __ΩCustomLoggerMessage, __ΩDeepkitOptions, __ΩDeployInlineConfig, __ΩDocsInlineConfig, __ΩEmitEntryOptions, __ΩEmitOptions, __ΩEngine, __ΩEngineContext, __ΩEngineInputOptions, __ΩEngineOptions, __ΩEnvironmentConfig, __ΩEnvironmentContext, __ΩEnvironmentContextPlugin, __ΩEnvironmentResolvedConfig, __ΩExecution, __ΩExecutionContext, __ΩExecutionOptions, __ΩExecutionState, __ΩExecutionStateItem, __ΩExecutionWorkerParams, __ΩExecutionWorkerProcess, __ΩFetchOptions, __ΩFileHeaderOptions, __ΩHookExecutionStateItem, __ΩHookFunctions, __ΩHookListOrders, __ΩHooks, __ΩHooksList, __ΩHooksListItem, __ΩInferHookFunction, __ΩInferHookParameters, __ΩInferHookReturnType, __ΩInferHookThisType, __ΩInferUnpluginOptions, __ΩInferUnpluginVariant, __ΩInitContextOptions, __ΩInlineConfig, __ΩLevel, __ΩLintInlineConfig, __ΩLogCategory, __ΩLogFn, __ΩLogFnMeta, __ΩLogFnOptions, __ΩLogLevel, __ΩLogLevelResolvedConfig, __ΩLogLevelUserConfig, __ΩLogMessage, __ΩLogMeta, __ΩLogger, __ΩLoggerMessage, __ΩLoggerMeta, __ΩLoggerOptions, __ΩMetaInfo, __ΩMode, __ΩNewInlineConfig, __ΩNormalizedStringFilter, __ΩOutputConfig, __ΩOutputResolvedConfig, __ΩParseOptions, __ΩParsedTypeScriptConfig, __ΩParsedUserConfig, __ΩPartialPlugin, __ΩPartialPluginFactory, __ΩPartiallyResolvedContext, __ΩPlugin, __ΩPluginConfig, __ΩPluginConfigObject, __ΩPluginConfigTuple, __ΩPluginContext, __ΩPluginFactory, __ΩPluginFilter, __ΩPluginHook, __ΩPluginHookFields, __ΩPluginHookObject, __ΩPluginHooks, __ΩPluginNonHookFields, __ΩPowerlinesCommand, __ΩPowerlinesMessage, __ΩPrepareInlineConfig, __ΩProjectType, __ΩRawReflectionMode, __ΩReflectionMode, __ΩResolveConfig, __ΩResolveOptions, __ΩResolveResolvedConfig, __ΩResolveResult, __ΩResolvedAssetGlob, __ΩResolvedConfig, __ΩResolvedEntryTypeDefinition, __ΩResolver, __ΩSelectHookResult, __ΩSelectHookResultItem, __ΩSelectHooksOptions, __ΩSourceFile, __ΩStorageAdapter, __ΩStoragePort, __ΩStoragePreset, __ΩSupportedCommands, __ΩTSCompilerOptions, __ΩTSConfig, __ΩTestInlineConfig, __ΩTransformHookFilter, __ΩTransformResult, __ΩTypesInlineConfig, __ΩTypesResult, __ΩUnimportContext, __ΩUnpluginAsyncFactory, __ΩUnpluginBuilderVariant, __ΩUnpluginFactory, __ΩUnpluginHookFunctions, __ΩUnpluginOptions, __ΩUnpluginUserConfig, __ΩUnresolvedContext, __ΩUserConfig, __ΩUserConfigFn, __ΩVirtualFile, __ΩVirtualFileData, __ΩVirtualFileExtension, __ΩVirtualFileMetadata, __ΩVirtualFileSystemInterface, __ΩWithUnpluginBuildContext, __ΩWorkerProcess, __ΩWorkspaceConfig, __ΩWriteData, __ΩWriteOptions, combineContexts, createUnplugin, createUnpluginModuleResolutionFunctions, createUnpluginResolver, defineConfig, format, formatFolder, generateSourceMap, getFileHeader, getFileHeaderWarning, getFileHeaderWarningText, getMagicString, getSourceFile, getString, getTypescriptFileHeader, getUniqueInputs, isResolvedEntryTypeDefinition, isTypeDefinition, isUnpluginBuilderVariant, loadUserConfigFile, loadWorkspaceConfig, resolveEntryOutput, resolveInput, resolveInputs, resolveInputsSync, writeFile };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { ResolveOptions, StorageAdapter, StoragePort, StoragePreset, VirtualFile, VirtualFileData, VirtualFileExtension, VirtualFileMetadata, VirtualFileSystemInterface, WriteData, WriteOptions, __ΩResolveOptions, __ΩStorageAdapter, __ΩStoragePort, __ΩStoragePreset, __ΩVirtualFile, __ΩVirtualFileData, __ΩVirtualFileExtension, __ΩVirtualFileMetadata, __ΩVirtualFileSystemInterface, __ΩWriteData, __ΩWriteOptions } from "./types/fs.mjs";
|
|
2
2
|
import { BaseCommandType, CommandType, Commands, __ΩBaseCommandType, __ΩCommandType, __ΩCommands } from "./types/commands.mjs";
|
|
3
3
|
import { WorkerProcess, __ΩWorkerProcess } from "./types/utils.mjs";
|
|
4
|
-
import { API, Engine, Execution, ExecutionWorkerParams, ExecutionWorkerProcess, __ΩAPI, __ΩEngine, __ΩExecution, __ΩExecutionWorkerParams, __ΩExecutionWorkerProcess } from "./types/api.mjs";
|
|
4
|
+
import { API, APIFunctions, BaseAPIFunctions, Engine, Execution, ExecutionWorkerParams, ExecutionWorkerProcess, SupportedCommands, __ΩAPI, __ΩAPIFunctions, __ΩBaseAPIFunctions, __ΩEngine, __ΩExecution, __ΩExecutionWorkerParams, __ΩExecutionWorkerProcess, __ΩSupportedCommands } from "./types/api.mjs";
|
|
5
5
|
import { BuilderVariant, InferUnpluginOptions, InferUnpluginVariant, UnpluginAsyncFactory, UnpluginBuilderVariant, UnpluginFactory, UnpluginHookFunctions, UnpluginOptions, UnpluginUserConfig, __ΩBuilderVariant, __ΩInferUnpluginOptions, __ΩInferUnpluginVariant, __ΩUnpluginAsyncFactory, __ΩUnpluginBuilderVariant, __ΩUnpluginFactory, __ΩUnpluginHookFunctions, __ΩUnpluginOptions, __ΩUnpluginUserConfig } from "./types/unplugin.mjs";
|
|
6
6
|
import { BasePlugin, HookFunctions, Hooks, Plugin, PluginHook, PluginHookFields, PluginHookObject, PluginHooks, PluginNonHookFields, TypesResult, __ΩBasePlugin, __ΩHookFunctions, __ΩHooks, __ΩPlugin, __ΩPluginHook, __ΩPluginHookFields, __ΩPluginHookObject, __ΩPluginHooks, __ΩPluginNonHookFields, __ΩTypesResult } from "./types/plugin.mjs";
|
|
7
7
|
import { CallHookOptions, HookListOrders, HooksList, HooksListItem, InferHookFunction, InferHookParameters, InferHookReturnType, InferHookThisType, NormalizedStringFilter, PluginFilter, TransformHookFilter, __ΩCallHookOptions, __ΩHookListOrders, __ΩHooksList, __ΩHooksListItem, __ΩInferHookFunction, __ΩInferHookParameters, __ΩInferHookReturnType, __ΩInferHookThisType, __ΩNormalizedStringFilter, __ΩPluginFilter, __ΩTransformHookFilter } from "./types/hooks.mjs";
|
|
8
8
|
import { CustomLogger, CustomLoggerMessage, LOG_CATEGORIES, LOG_LEVELS, LogCategories, LogCategory, LogFn, LogFnMeta, LogFnOptions, LogLevel, LogLevelResolvedConfig, LogLevelUserConfig, LogLevels, LogMessage, LogMeta, Logger, LoggerMessage, LoggerMeta, LoggerOptions, PowerlinesMessage, __ΩCustomLogger, __ΩCustomLoggerMessage, __ΩLogCategory, __ΩLogFn, __ΩLogFnMeta, __ΩLogFnOptions, __ΩLogLevel, __ΩLogLevelResolvedConfig, __ΩLogLevelUserConfig, __ΩLogMessage, __ΩLogMeta, __ΩLogger, __ΩLoggerMessage, __ΩLoggerMeta, __ΩLoggerOptions, __ΩPowerlinesMessage } from "./types/logging.mjs";
|
|
9
9
|
import { DeepkitOptions, Level, ParsedTypeScriptConfig, RawReflectionMode, ReflectionMode, TSCompilerOptions, TSConfig, __ΩDeepkitOptions, __ΩLevel, __ΩParsedTypeScriptConfig, __ΩRawReflectionMode, __ΩReflectionMode, __ΩTSCompilerOptions, __ΩTSConfig } from "./types/tsconfig.mjs";
|
|
10
10
|
import { 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, __Ω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 } from "./types/context.mjs";
|
|
11
|
-
import { AnyOutputUserConfig, AnyUserConfig, BuildInlineConfig, CleanInlineConfig, Config, CopyConfig, CopyResolvedConfig, DeployInlineConfig, DocsInlineConfig, EngineOptions, EnvironmentConfig, EnvironmentResolvedConfig, ExecutionOptions, InlineConfig, LintInlineConfig, Mode, NewInlineConfig, OutputConfig, OutputResolvedConfig, ParsedUserConfig, PartialPlugin, PartialPluginFactory, PluginConfig, PluginConfigObject, PluginConfigTuple, PluginFactory, PowerlinesCommand, PrepareInlineConfig, ProjectType, ResolveConfig, ResolveResolvedConfig, ResolvedAssetGlob, ResolvedConfig,
|
|
11
|
+
import { AnyOutputUserConfig, AnyUserConfig, BuildInlineConfig, CleanInlineConfig, Config, CopyConfig, CopyResolvedConfig, DeployInlineConfig, DocsInlineConfig, EngineInputOptions, EngineOptions, EnvironmentConfig, EnvironmentResolvedConfig, ExecutionOptions, InlineConfig, LintInlineConfig, Mode, NewInlineConfig, OutputConfig, OutputResolvedConfig, ParsedUserConfig, PartialPlugin, PartialPluginFactory, PluginConfig, PluginConfigObject, PluginConfigTuple, PluginFactory, PowerlinesCommand, PrepareInlineConfig, ProjectType, ResolveConfig, ResolveResolvedConfig, ResolvedAssetGlob, ResolvedConfig, ResolvedEntryTypeDefinition, TestInlineConfig, TypesInlineConfig, UserConfig, UserConfigFn, WorkspaceConfig, __ΩAnyOutputUserConfig, __ΩAnyUserConfig, __ΩBuildInlineConfig, __ΩCleanInlineConfig, __ΩConfig, __ΩCopyConfig, __ΩCopyResolvedConfig, __ΩDeployInlineConfig, __ΩDocsInlineConfig, __ΩEngineInputOptions, __ΩEngineOptions, __ΩEnvironmentConfig, __ΩEnvironmentResolvedConfig, __ΩExecutionOptions, __ΩInlineConfig, __ΩLintInlineConfig, __ΩMode, __ΩNewInlineConfig, __ΩOutputConfig, __ΩOutputResolvedConfig, __ΩParsedUserConfig, __ΩPartialPlugin, __ΩPartialPluginFactory, __ΩPluginConfig, __ΩPluginConfigObject, __ΩPluginConfigTuple, __ΩPluginFactory, __ΩPowerlinesCommand, __ΩPrepareInlineConfig, __ΩProjectType, __ΩResolveConfig, __ΩResolveResolvedConfig, __ΩResolvedAssetGlob, __ΩResolvedConfig, __ΩResolvedEntryTypeDefinition, __ΩTestInlineConfig, __ΩTypesInlineConfig, __ΩUserConfig, __ΩUserConfigFn, __ΩWorkspaceConfig } from "./types/config.mjs";
|
|
12
12
|
import { PartiallyResolvedContext, __ΩPartiallyResolvedContext, defineConfig, loadUserConfigFile, loadWorkspaceConfig } from "./lib/config.mjs";
|
|
13
13
|
import { getUniqueInputs, isResolvedEntryTypeDefinition, isTypeDefinition, resolveEntryOutput, resolveInput, resolveInputs, resolveInputsSync } from "./lib/entry.mjs";
|
|
14
14
|
import { combineContexts, isUnpluginBuilderVariant } from "./lib/unplugin/helpers.mjs";
|
|
@@ -19,4 +19,4 @@ import { format, formatFolder } from "./lib/utilities/format.mjs";
|
|
|
19
19
|
import { getMagicString, getSourceFile, getString } from "./lib/utilities/source-file.mjs";
|
|
20
20
|
import { generateSourceMap } from "./lib/utilities/source-map.mjs";
|
|
21
21
|
import { writeFile } from "./lib/utilities/write-file.mjs";
|
|
22
|
-
export { API, AnyOutputUserConfig, AnyUserConfig, BaseCommandType, BaseContext, BasePlugin, BuildInlineConfig, BuildPluginContext, BuilderVariant, CallHookOptions, CleanInlineConfig, CommandType, Commands, Config, Context, CopyConfig, CopyResolvedConfig, CreateUnpluginModuleResolutionFunctionsOptions, CreateUnpluginOptions, CreateUnpluginResolverOptions, CustomLogger, CustomLoggerMessage, DeepkitOptions, DeployInlineConfig, DocsInlineConfig, EmitEntryOptions, EmitOptions, Engine, EngineContext, EngineOptions, EnvironmentConfig, EnvironmentContext, EnvironmentContextPlugin, EnvironmentResolvedConfig, Execution, ExecutionContext, ExecutionOptions, ExecutionState, ExecutionStateItem, ExecutionWorkerParams, ExecutionWorkerProcess, FetchOptions, FileHeaderOptions, HookExecutionStateItem, HookFunctions, HookListOrders, Hooks, HooksList, HooksListItem, InferHookFunction, InferHookParameters, InferHookReturnType, InferHookThisType, InferUnpluginOptions, InferUnpluginVariant, InitContextOptions, InlineConfig, LOG_CATEGORIES, LOG_LEVELS, Level, LintInlineConfig, LogCategories, LogCategory, LogFn, LogFnMeta, LogFnOptions, LogLevel, LogLevelResolvedConfig, LogLevelUserConfig, LogLevels, LogMessage, LogMeta, Logger, LoggerMessage, LoggerMeta, LoggerOptions, MetaInfo, Mode, NewInlineConfig, NormalizedStringFilter, OutputConfig, OutputResolvedConfig, ParseOptions, ParsedTypeScriptConfig, ParsedUserConfig, PartialPlugin, PartialPluginFactory, PartiallyResolvedContext, Plugin, PluginConfig, PluginConfigObject, PluginConfigTuple, PluginContext, PluginFactory, PluginFilter, PluginHook, PluginHookFields, PluginHookObject, PluginHooks, PluginNonHookFields, PowerlinesCommand, PowerlinesMessage, PrepareInlineConfig, ProjectType, RawReflectionMode, ReflectionMode, ResolveConfig, ResolveOptions, ResolveResolvedConfig, ResolveResult, ResolvedAssetGlob, ResolvedConfig,
|
|
22
|
+
export { API, APIFunctions, AnyOutputUserConfig, AnyUserConfig, BaseAPIFunctions, BaseCommandType, BaseContext, BasePlugin, BuildInlineConfig, BuildPluginContext, BuilderVariant, CallHookOptions, CleanInlineConfig, CommandType, Commands, Config, Context, CopyConfig, CopyResolvedConfig, CreateUnpluginModuleResolutionFunctionsOptions, CreateUnpluginOptions, CreateUnpluginResolverOptions, CustomLogger, CustomLoggerMessage, DeepkitOptions, DeployInlineConfig, DocsInlineConfig, EmitEntryOptions, EmitOptions, Engine, EngineContext, EngineInputOptions, EngineOptions, EnvironmentConfig, EnvironmentContext, EnvironmentContextPlugin, EnvironmentResolvedConfig, Execution, ExecutionContext, ExecutionOptions, ExecutionState, ExecutionStateItem, ExecutionWorkerParams, ExecutionWorkerProcess, FetchOptions, FileHeaderOptions, HookExecutionStateItem, HookFunctions, HookListOrders, Hooks, HooksList, HooksListItem, InferHookFunction, InferHookParameters, InferHookReturnType, InferHookThisType, InferUnpluginOptions, InferUnpluginVariant, InitContextOptions, InlineConfig, LOG_CATEGORIES, LOG_LEVELS, Level, LintInlineConfig, LogCategories, LogCategory, LogFn, LogFnMeta, LogFnOptions, LogLevel, LogLevelResolvedConfig, LogLevelUserConfig, LogLevels, LogMessage, LogMeta, Logger, LoggerMessage, LoggerMeta, LoggerOptions, MetaInfo, Mode, NewInlineConfig, NormalizedStringFilter, OutputConfig, OutputResolvedConfig, ParseOptions, ParsedTypeScriptConfig, ParsedUserConfig, PartialPlugin, PartialPluginFactory, PartiallyResolvedContext, Plugin, PluginConfig, PluginConfigObject, PluginConfigTuple, PluginContext, PluginFactory, PluginFilter, PluginHook, PluginHookFields, PluginHookObject, PluginHooks, PluginNonHookFields, PowerlinesCommand, PowerlinesMessage, PrepareInlineConfig, ProjectType, RawReflectionMode, ReflectionMode, ResolveConfig, ResolveOptions, ResolveResolvedConfig, ResolveResult, ResolvedAssetGlob, ResolvedConfig, ResolvedEntryTypeDefinition, Resolver, SelectHookResult, SelectHookResultItem, SelectHooksOptions, SourceFile, StorageAdapter, StoragePort, StoragePreset, SupportedCommands, TSCompilerOptions, TSConfig, TestInlineConfig, TransformHookFilter, TransformResult, TypesInlineConfig, TypesResult, UnimportContext, UnpluginAsyncFactory, UnpluginBuilderVariant, UnpluginFactory, UnpluginHookFunctions, UnpluginOptions, UnpluginUserConfig, UnresolvedContext, UserConfig, UserConfigFn, VirtualFile, VirtualFileData, VirtualFileExtension, VirtualFileMetadata, VirtualFileSystemInterface, WithUnpluginBuildContext, WorkerProcess, WorkspaceConfig, WriteData, WriteOptions, __ΩAPI, __ΩAPIFunctions, __ΩAnyOutputUserConfig, __ΩAnyUserConfig, __ΩBaseAPIFunctions, __ΩBaseCommandType, __ΩBaseContext, __ΩBasePlugin, __ΩBuildInlineConfig, __ΩBuildPluginContext, __ΩBuilderVariant, __ΩCallHookOptions, __ΩCleanInlineConfig, __ΩCommandType, __ΩCommands, __ΩConfig, __ΩContext, __ΩCopyConfig, __ΩCopyResolvedConfig, __ΩCreateUnpluginModuleResolutionFunctionsOptions, __ΩCreateUnpluginOptions, __ΩCreateUnpluginResolverOptions, __ΩCustomLogger, __ΩCustomLoggerMessage, __ΩDeepkitOptions, __ΩDeployInlineConfig, __ΩDocsInlineConfig, __ΩEmitEntryOptions, __ΩEmitOptions, __ΩEngine, __ΩEngineContext, __ΩEngineInputOptions, __ΩEngineOptions, __ΩEnvironmentConfig, __ΩEnvironmentContext, __ΩEnvironmentContextPlugin, __ΩEnvironmentResolvedConfig, __ΩExecution, __ΩExecutionContext, __ΩExecutionOptions, __ΩExecutionState, __ΩExecutionStateItem, __ΩExecutionWorkerParams, __ΩExecutionWorkerProcess, __ΩFetchOptions, __ΩFileHeaderOptions, __ΩHookExecutionStateItem, __ΩHookFunctions, __ΩHookListOrders, __ΩHooks, __ΩHooksList, __ΩHooksListItem, __ΩInferHookFunction, __ΩInferHookParameters, __ΩInferHookReturnType, __ΩInferHookThisType, __ΩInferUnpluginOptions, __ΩInferUnpluginVariant, __ΩInitContextOptions, __ΩInlineConfig, __ΩLevel, __ΩLintInlineConfig, __ΩLogCategory, __ΩLogFn, __ΩLogFnMeta, __ΩLogFnOptions, __ΩLogLevel, __ΩLogLevelResolvedConfig, __ΩLogLevelUserConfig, __ΩLogMessage, __ΩLogMeta, __ΩLogger, __ΩLoggerMessage, __ΩLoggerMeta, __ΩLoggerOptions, __ΩMetaInfo, __ΩMode, __ΩNewInlineConfig, __ΩNormalizedStringFilter, __ΩOutputConfig, __ΩOutputResolvedConfig, __ΩParseOptions, __ΩParsedTypeScriptConfig, __ΩParsedUserConfig, __ΩPartialPlugin, __ΩPartialPluginFactory, __ΩPartiallyResolvedContext, __ΩPlugin, __ΩPluginConfig, __ΩPluginConfigObject, __ΩPluginConfigTuple, __ΩPluginContext, __ΩPluginFactory, __ΩPluginFilter, __ΩPluginHook, __ΩPluginHookFields, __ΩPluginHookObject, __ΩPluginHooks, __ΩPluginNonHookFields, __ΩPowerlinesCommand, __ΩPowerlinesMessage, __ΩPrepareInlineConfig, __ΩProjectType, __ΩRawReflectionMode, __ΩReflectionMode, __ΩResolveConfig, __ΩResolveOptions, __ΩResolveResolvedConfig, __ΩResolveResult, __ΩResolvedAssetGlob, __ΩResolvedConfig, __ΩResolvedEntryTypeDefinition, __ΩResolver, __ΩSelectHookResult, __ΩSelectHookResultItem, __ΩSelectHooksOptions, __ΩSourceFile, __ΩStorageAdapter, __ΩStoragePort, __ΩStoragePreset, __ΩSupportedCommands, __ΩTSCompilerOptions, __ΩTSConfig, __ΩTestInlineConfig, __ΩTransformHookFilter, __ΩTransformResult, __ΩTypesInlineConfig, __ΩTypesResult, __ΩUnimportContext, __ΩUnpluginAsyncFactory, __ΩUnpluginBuilderVariant, __ΩUnpluginFactory, __ΩUnpluginHookFunctions, __ΩUnpluginOptions, __ΩUnpluginUserConfig, __ΩUnresolvedContext, __ΩUserConfig, __ΩUserConfigFn, __ΩVirtualFile, __ΩVirtualFileData, __ΩVirtualFileExtension, __ΩVirtualFileMetadata, __ΩVirtualFileSystemInterface, __ΩWithUnpluginBuildContext, __ΩWorkerProcess, __ΩWorkspaceConfig, __ΩWriteData, __ΩWriteOptions, combineContexts, createUnplugin, createUnpluginModuleResolutionFunctions, createUnpluginResolver, defineConfig, format, formatFolder, generateSourceMap, getFileHeader, getFileHeaderWarning, getFileHeaderWarningText, getMagicString, getSourceFile, getString, getTypescriptFileHeader, getUniqueInputs, isResolvedEntryTypeDefinition, isTypeDefinition, isUnpluginBuilderVariant, loadUserConfigFile, loadWorkspaceConfig, resolveEntryOutput, resolveInput, resolveInputs, resolveInputsSync, writeFile };
|
package/dist/lib/config.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Context } from "../types/context.cjs";
|
|
2
|
-
import { AnyUserConfig,
|
|
2
|
+
import { AnyUserConfig, EngineOptions, ParsedUserConfig, UserConfig, WorkspaceConfig } from "../types/config.cjs";
|
|
3
3
|
import { Jiti } from "jiti";
|
|
4
4
|
|
|
5
5
|
//#region src/lib/config.d.ts
|
|
@@ -21,7 +21,7 @@ declare function loadWorkspaceConfig(cwd: string, root: string): Promise<Workspa
|
|
|
21
21
|
* @param jiti - An instance of Jiti to resolve modules from
|
|
22
22
|
* @returns A promise that resolves to the resolved user configuration.
|
|
23
23
|
*/
|
|
24
|
-
declare function loadUserConfigFile(options:
|
|
24
|
+
declare function loadUserConfigFile(options: EngineOptions, jiti: Jiti): Promise<ParsedUserConfig>;
|
|
25
25
|
/**
|
|
26
26
|
* A type helper to make it easier to use `powerlines.config.ts` files.
|
|
27
27
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.cts","names":[],"sources":["../../src/lib/config.ts"],"mappings":";;;;;KAsCY,wBAAA,kBAA0C,OAAA,GAAU,OAAA,IAAW,IAAA,CACzE,QAAA,sEAGA,OAAA,CAAQ,QAAA;EACN,MAAA,EAAQ,QAAA;AAAA;;;;;;;;iBAUU,mBAAA,CACpB,GAAA,UACA,IAAA,WACC,OAAA,CAAQ,eAAA;;;;;;;;iBAoBW,kBAAA,CACpB,OAAA,EAAS,
|
|
1
|
+
{"version":3,"file":"config.d.cts","names":[],"sources":["../../src/lib/config.ts"],"mappings":";;;;;KAsCY,wBAAA,kBAA0C,OAAA,GAAU,OAAA,IAAW,IAAA,CACzE,QAAA,sEAGA,OAAA,CAAQ,QAAA;EACN,MAAA,EAAQ,QAAA;AAAA;;;;;;;;iBAUU,mBAAA,CACpB,GAAA,UACA,IAAA,WACC,OAAA,CAAQ,eAAA;;;;;;;;iBAoBW,kBAAA,CACpB,OAAA,EAAS,aAAA,EACT,IAAA,EAAM,IAAA,GACL,OAAA,CAAQ,gBAAA;;;;;;AA1BX;iBAkMgB,YAAA,CAAa,MAAA,EAAQ,aAAA,GAAgB,UAAA;AAAA"}
|
package/dist/lib/config.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Context } from "../types/context.mjs";
|
|
2
|
-
import { AnyUserConfig,
|
|
2
|
+
import { AnyUserConfig, EngineOptions, ParsedUserConfig, UserConfig, WorkspaceConfig } from "../types/config.mjs";
|
|
3
3
|
import { Jiti } from "jiti";
|
|
4
4
|
|
|
5
5
|
//#region src/lib/config.d.ts
|
|
@@ -21,7 +21,7 @@ declare function loadWorkspaceConfig(cwd: string, root: string): Promise<Workspa
|
|
|
21
21
|
* @param jiti - An instance of Jiti to resolve modules from
|
|
22
22
|
* @returns A promise that resolves to the resolved user configuration.
|
|
23
23
|
*/
|
|
24
|
-
declare function loadUserConfigFile(options:
|
|
24
|
+
declare function loadUserConfigFile(options: EngineOptions, jiti: Jiti): Promise<ParsedUserConfig>;
|
|
25
25
|
/**
|
|
26
26
|
* A type helper to make it easier to use `powerlines.config.ts` files.
|
|
27
27
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.mts","names":[],"sources":["../../src/lib/config.ts"],"mappings":";;;;;KAsCY,wBAAA,kBAA0C,OAAA,GAAU,OAAA,IAAW,IAAA,CACzE,QAAA,sEAGA,OAAA,CAAQ,QAAA;EACN,MAAA,EAAQ,QAAA;AAAA;;;;;;;;iBAUU,mBAAA,CACpB,GAAA,UACA,IAAA,WACC,OAAA,CAAQ,eAAA;;;;;;;;iBAoBW,kBAAA,CACpB,OAAA,EAAS,
|
|
1
|
+
{"version":3,"file":"config.d.mts","names":[],"sources":["../../src/lib/config.ts"],"mappings":";;;;;KAsCY,wBAAA,kBAA0C,OAAA,GAAU,OAAA,IAAW,IAAA,CACzE,QAAA,sEAGA,OAAA,CAAQ,QAAA;EACN,MAAA,EAAQ,QAAA;AAAA;;;;;;;;iBAUU,mBAAA,CACpB,GAAA,UACA,IAAA,WACC,OAAA,CAAQ,eAAA;;;;;;;;iBAoBW,kBAAA,CACpB,OAAA,EAAS,aAAA,EACT,IAAA,EAAM,IAAA,GACL,OAAA,CAAQ,gBAAA;;;;;;AA1BX;iBAkMgB,YAAA,CAAa,MAAA,EAAQ,aAAA,GAAgB,UAAA;AAAA"}
|
package/dist/lib/config.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.mjs","names":["loadConfigC12"],"sources":["../../src/lib/config.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 { getWorkspaceConfig } from \"@storm-software/config-tools/get-config\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { loadConfig as loadConfigC12 } from \"c12\";\nimport defu from \"defu\";\nimport type { Jiti } from \"jiti\";\nimport type {\n ParsedUserConfig,\n ResolvedEngineOptions,\n UserConfig,\n WorkspaceConfig\n} from \"../types/config\";\nimport { AnyUserConfig } from \"../types/config\";\nimport { Context } from \"../types/context\";\n\nexport type PartiallyResolvedContext<TContext extends Context = Context> = Omit<\n TContext,\n \"config\" | \"tsconfig\" | \"entry\" | \"fs\" | \"compiler\" | \"unimport\"\n> &\n Partial<TContext> & {\n config: TContext[\"config\"];\n };\n\n/**\n * Loads the workspace configuration.\n *\n * @param cwd - The root directory of the workspace.\n * @param root - The current working directory to start searching from.\n * @returns A promise that resolves to the loaded workspace configuration.\n */\nexport async function loadWorkspaceConfig(\n cwd: string,\n root: string\n): Promise<WorkspaceConfig> {\n return defu(\n {\n workspaceRoot: cwd\n },\n await getWorkspaceConfig(true, {\n cwd: root,\n workspaceRoot: cwd,\n useDefault: true\n })\n );\n}\n\n/**\n * Loads the user configuration file for the project.\n *\n * @param options - The engine options containing the root, cwd, mode, framework, and organization.\n * @param jiti - An instance of Jiti to resolve modules from\n * @returns A promise that resolves to the resolved user configuration.\n */\nexport async function loadUserConfigFile(\n options: ResolvedEngineOptions,\n jiti: Jiti\n): Promise<ParsedUserConfig> {\n let resolvedUserConfig: Partial<ParsedUserConfig> = {};\n\n let resolvedUserConfigFile: string | undefined;\n if (options.configFile) {\n resolvedUserConfigFile = existsSync(\n replacePath(options.configFile, options.root)\n )\n ? replacePath(options.configFile, options.root)\n : existsSync(\n joinPaths(\n appendPath(options.root, options.cwd),\n replacePath(options.configFile, options.root)\n )\n )\n ? joinPaths(\n appendPath(options.root, options.cwd),\n replacePath(options.configFile, options.root)\n )\n : existsSync(\n joinPaths(\n appendPath(options.root, options.cwd),\n options.configFile\n )\n )\n ? joinPaths(appendPath(options.root, options.cwd), options.configFile)\n : undefined;\n }\n\n if (!resolvedUserConfigFile) {\n resolvedUserConfigFile = existsSync(\n joinPaths(\n appendPath(options.root, options.cwd),\n `${options.framework}.${options.mode}.config.ts`\n )\n )\n ? joinPaths(\n appendPath(options.root, options.cwd),\n `${options.framework}.${options.mode}.config.ts`\n )\n : existsSync(\n joinPaths(\n appendPath(options.root, options.cwd),\n `${options.framework}.${options.mode}.config.js`\n )\n )\n ? joinPaths(\n appendPath(options.root, options.cwd),\n `${options.framework}.${options.mode}.config.js`\n )\n : existsSync(\n joinPaths(\n appendPath(options.root, options.cwd),\n `${options.framework}.${options.mode}.config.mts`\n )\n )\n ? joinPaths(\n appendPath(options.root, options.cwd),\n `${options.framework}.${options.mode}.config.mts`\n )\n : existsSync(\n joinPaths(\n appendPath(options.root, options.cwd),\n `${options.framework}.${options.mode}.config.mjs`\n )\n )\n ? joinPaths(\n appendPath(options.root, options.cwd),\n `${options.framework}.${options.mode}.config.mjs`\n )\n : existsSync(\n joinPaths(\n appendPath(options.root, options.cwd),\n `${options.framework}.config.ts`\n )\n )\n ? joinPaths(\n appendPath(options.root, options.cwd),\n `${options.framework}.config.ts`\n )\n : existsSync(\n joinPaths(\n appendPath(options.root, options.cwd),\n `${options.framework}.config.js`\n )\n )\n ? joinPaths(\n appendPath(options.root, options.cwd),\n `${options.framework}.config.js`\n )\n : existsSync(\n joinPaths(\n appendPath(options.root, options.cwd),\n `${options.framework}.config.mts`\n )\n )\n ? joinPaths(\n appendPath(options.root, options.cwd),\n `${options.framework}.config.mts`\n )\n : existsSync(\n joinPaths(\n appendPath(options.root, options.cwd),\n `${options.framework}.config.mjs`\n )\n )\n ? joinPaths(\n appendPath(options.root, options.cwd),\n `${options.framework}.config.mjs`\n )\n : undefined;\n }\n\n if (resolvedUserConfigFile) {\n const resolved = await jiti.import<{ default: AnyUserConfig }>(\n jiti.esmResolve(resolvedUserConfigFile)\n );\n if (resolved?.default) {\n let config = {};\n if (isFunction(resolved.default)) {\n config = await Promise.resolve(resolved.default(options));\n } else if (\n isSetObject(resolved.default) ||\n Array.isArray(resolved.default)\n ) {\n config = resolved.default;\n }\n\n if (isSetObject(config) || Array.isArray(config)) {\n resolvedUserConfig = {\n ...config,\n config,\n configFile: resolvedUserConfigFile\n };\n }\n }\n }\n\n const result = await loadConfigC12({\n cwd: options.root,\n name: options.framework,\n envName: options.mode,\n globalRc: true,\n packageJson: camelCase(options.framework),\n dotenv: true,\n jiti\n });\n\n return defu(\n {\n config: {\n root: options.root,\n cwd: options.cwd,\n framework: options.framework,\n organization: options.organization\n }\n },\n resolvedUserConfig,\n isSetObject(result?.config) ? { ...result.config, ...result } : {}\n );\n}\n\n/**\n * A type helper to make it easier to use `powerlines.config.ts` files.\n *\n * @remarks\n * The function accepts a direct {@link AnyUserConfig} object/function and returns it typed as a {@link UserConfig} object.\n */\nexport function defineConfig(config: AnyUserConfig): UserConfig {\n return config as any;\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"config.mjs","names":["loadConfigC12"],"sources":["../../src/lib/config.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 { getWorkspaceConfig } from \"@storm-software/config-tools/get-config\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { isFunction } from \"@stryke/type-checks/is-function\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { loadConfig as loadConfigC12 } from \"c12\";\nimport defu from \"defu\";\nimport type { Jiti } from \"jiti\";\nimport type {\n EngineOptions,\n ParsedUserConfig,\n UserConfig,\n WorkspaceConfig\n} from \"../types/config\";\nimport { AnyUserConfig } from \"../types/config\";\nimport { Context } from \"../types/context\";\n\nexport type PartiallyResolvedContext<TContext extends Context = Context> = Omit<\n TContext,\n \"config\" | \"tsconfig\" | \"entry\" | \"fs\" | \"compiler\" | \"unimport\"\n> &\n Partial<TContext> & {\n config: TContext[\"config\"];\n };\n\n/**\n * Loads the workspace configuration.\n *\n * @param cwd - The root directory of the workspace.\n * @param root - The current working directory to start searching from.\n * @returns A promise that resolves to the loaded workspace configuration.\n */\nexport async function loadWorkspaceConfig(\n cwd: string,\n root: string\n): Promise<WorkspaceConfig> {\n return defu(\n {\n workspaceRoot: cwd\n },\n await getWorkspaceConfig(true, {\n cwd: root,\n workspaceRoot: cwd,\n useDefault: true\n })\n );\n}\n\n/**\n * Loads the user configuration file for the project.\n *\n * @param options - The engine options containing the root, cwd, mode, framework, and organization.\n * @param jiti - An instance of Jiti to resolve modules from\n * @returns A promise that resolves to the resolved user configuration.\n */\nexport async function loadUserConfigFile(\n options: EngineOptions,\n jiti: Jiti\n): Promise<ParsedUserConfig> {\n let resolvedUserConfig: Partial<ParsedUserConfig> = {};\n\n let resolvedUserConfigFile: string | undefined;\n if (options.configFile) {\n resolvedUserConfigFile = existsSync(\n replacePath(options.configFile, options.root)\n )\n ? replacePath(options.configFile, options.root)\n : existsSync(\n joinPaths(\n appendPath(options.root, options.cwd),\n replacePath(options.configFile, options.root)\n )\n )\n ? joinPaths(\n appendPath(options.root, options.cwd),\n replacePath(options.configFile, options.root)\n )\n : existsSync(\n joinPaths(\n appendPath(options.root, options.cwd),\n options.configFile\n )\n )\n ? joinPaths(appendPath(options.root, options.cwd), options.configFile)\n : undefined;\n }\n\n if (!resolvedUserConfigFile) {\n resolvedUserConfigFile = existsSync(\n joinPaths(\n appendPath(options.root, options.cwd),\n `${options.framework}.${options.mode}.config.ts`\n )\n )\n ? joinPaths(\n appendPath(options.root, options.cwd),\n `${options.framework}.${options.mode}.config.ts`\n )\n : existsSync(\n joinPaths(\n appendPath(options.root, options.cwd),\n `${options.framework}.${options.mode}.config.js`\n )\n )\n ? joinPaths(\n appendPath(options.root, options.cwd),\n `${options.framework}.${options.mode}.config.js`\n )\n : existsSync(\n joinPaths(\n appendPath(options.root, options.cwd),\n `${options.framework}.${options.mode}.config.mts`\n )\n )\n ? joinPaths(\n appendPath(options.root, options.cwd),\n `${options.framework}.${options.mode}.config.mts`\n )\n : existsSync(\n joinPaths(\n appendPath(options.root, options.cwd),\n `${options.framework}.${options.mode}.config.mjs`\n )\n )\n ? joinPaths(\n appendPath(options.root, options.cwd),\n `${options.framework}.${options.mode}.config.mjs`\n )\n : existsSync(\n joinPaths(\n appendPath(options.root, options.cwd),\n `${options.framework}.config.ts`\n )\n )\n ? joinPaths(\n appendPath(options.root, options.cwd),\n `${options.framework}.config.ts`\n )\n : existsSync(\n joinPaths(\n appendPath(options.root, options.cwd),\n `${options.framework}.config.js`\n )\n )\n ? joinPaths(\n appendPath(options.root, options.cwd),\n `${options.framework}.config.js`\n )\n : existsSync(\n joinPaths(\n appendPath(options.root, options.cwd),\n `${options.framework}.config.mts`\n )\n )\n ? joinPaths(\n appendPath(options.root, options.cwd),\n `${options.framework}.config.mts`\n )\n : existsSync(\n joinPaths(\n appendPath(options.root, options.cwd),\n `${options.framework}.config.mjs`\n )\n )\n ? joinPaths(\n appendPath(options.root, options.cwd),\n `${options.framework}.config.mjs`\n )\n : undefined;\n }\n\n if (resolvedUserConfigFile) {\n const resolved = await jiti.import<{ default: AnyUserConfig }>(\n jiti.esmResolve(resolvedUserConfigFile)\n );\n if (resolved?.default) {\n let config = {};\n if (isFunction(resolved.default)) {\n config = await Promise.resolve(resolved.default(options));\n } else if (\n isSetObject(resolved.default) ||\n Array.isArray(resolved.default)\n ) {\n config = resolved.default;\n }\n\n if (isSetObject(config) || Array.isArray(config)) {\n resolvedUserConfig = {\n ...config,\n config,\n configFile: resolvedUserConfigFile\n };\n }\n }\n }\n\n const result = await loadConfigC12({\n cwd: options.root,\n name: options.framework,\n envName: options.mode,\n globalRc: true,\n packageJson: camelCase(options.framework),\n dotenv: true,\n jiti\n });\n\n return defu(\n {\n config: {\n root: options.root,\n cwd: options.cwd,\n framework: options.framework,\n organization: options.organization\n }\n },\n resolvedUserConfig,\n isSetObject(result?.config) ? { ...result.config, ...result } : {}\n );\n}\n\n/**\n * A type helper to make it easier to use `powerlines.config.ts` files.\n *\n * @remarks\n * The function accepts a direct {@link AnyUserConfig} object/function and returns it typed as a {@link UserConfig} object.\n */\nexport function defineConfig(config: AnyUserConfig): UserConfig {\n return config as any;\n}\n"],"mappings":"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"}
|
|
@@ -48,7 +48,7 @@ function createUnplugin(context, options = {}) {
|
|
|
48
48
|
(0, unplugin.setParseImpl)(ctx.parse);
|
|
49
49
|
const name = options.name || "powerlines";
|
|
50
50
|
return () => {
|
|
51
|
-
const logger = ctx.extendLogger(name !== "powerlines" ? { source: name } : {});
|
|
51
|
+
const logger = ctx.extendLogger(!options.silenceHookLogging && name !== "powerlines" ? { source: name } : {});
|
|
52
52
|
logger.debug(`Initializing ${(0, _stryke_string_format_title_case.titleCase)(name)} plugin`);
|
|
53
53
|
try {
|
|
54
54
|
const { resolveId, load } = require_lib_unplugin_module_resolution.createUnpluginModuleResolutionFunctions(context, options);
|
|
@@ -46,7 +46,7 @@ function createUnplugin(context, options = {}) {
|
|
|
46
46
|
setParseImpl(ctx.parse);
|
|
47
47
|
const name = options.name || "powerlines";
|
|
48
48
|
return () => {
|
|
49
|
-
const logger = ctx.extendLogger(name !== "powerlines" ? { source: name } : {});
|
|
49
|
+
const logger = ctx.extendLogger(!options.silenceHookLogging && name !== "powerlines" ? { source: name } : {});
|
|
50
50
|
logger.debug(`Initializing ${titleCase(name)} plugin`);
|
|
51
51
|
try {
|
|
52
52
|
const { resolveId, load } = createUnpluginModuleResolutionFunctions(context, options);
|
|
@@ -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 { 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\";\nimport { Unstable_PluginContext } from \"../../types/_internal\";\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(\n name !== \"powerlines\" ? { source: name } : {}\n );\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(\n name !== \"powerlines\"
|
|
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 { 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\";\nimport { Unstable_PluginContext } from \"../../types/_internal\";\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(\n name !== \"powerlines\" ? { source: name } : {}\n );\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(\n !options.silenceHookLogging && name !== \"powerlines\"\n ? { source: name }\n : {}\n );\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,aACjB,SAAS,eAAe,EAAE,QAAQ,MAAM,GAAG,EAAE,CAC9C;AACD,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,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC;AAEpE,SAAM;;;;;;;;;;AAoBZ,SAAgB,eACd,SACA,UAAiC,EAAE,EACR;CAC3B,MAAM,MAAM;AACZ,cAAa,IAAI,MAAM;CAEvB,MAAM,OAAO,QAAQ,QAAQ;AAE7B,cAAa;EACX,MAAM,SAAS,IAAI,aACjB,CAAC,QAAQ,sBAAsB,SAAS,eACpC,EAAE,QAAQ,MAAM,GAChB,EAAE,CACP;AACD,SAAO,MAAM,gBAAgB,UAAU,KAAK,CAAC,SAAS;AAEtD,MAAI;GACF,MAAM,EAAE,WAAW,SACjB,wCAAkD,SAAS,QAAQ;GAErE,eAAe,aAAuC;AACpD,QAAI,CAAC,QAAQ,mBACX,QAAO,MAAM,sCAAsC;AAGrD,UAAM,IAAI,WAAW,SAAS,cAAc,EAC1C,YAAY,MACb,CAAC;;GAGJ,eAAe,UAEb,MACA,IAC6C;IAC7C,IAAI,cAAwC;AAE5C,SAAK,MAAM,QAAQ,IAAI,WAAW,YAAY,YAC5C,YACD,EAAE;KACD,MAAM,SACJ,MAAM,KAAK,QAAQ,MAAM,gBAAgB,KAAK,KAAK,EAAE,CACnD,UAAU,YAAY,EACtB,GAAG,QAAQ,6BAA6B,GAAG,CAC5C,CAA+B;AAClC,SAAI,OACF,eAAc;;AAIlB,WAAO;;GAGT,eAAe,WAAoD;AACjE,QAAI,CAAC,QAAQ,mBACX,QAAO,MAAM,uCAAuC;AAGtD,WAAO,IAAI,WAAW,SAAS,YAAY,EACzC,YAAY,MACb,CAAC;;GAGJ,eAAe,cAA6B;AAC1C,QAAI,CAAC,QAAQ,mBACX,QAAO,MAAM,0CAA0C;AAGzD,WAAO,IAAI,WAAW,SAAS,eAAe,EAC5C,YAAY,MACb,CAAC;;AAGJ,UAAO;IACL,MACE,KAAK,aAAa,KAAK,eACnB,eACA,cAAc,UAAU,KAAK;IACnC,KAAK,IAAI,WAAW;IACpB;IACA;IACA;IACA;IACA;IACA;IACA,MAAM,EACJ,mBAAmB,MACpB;IACF;WACM,OAAO;AACd,UAAO,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC;AAEpE,SAAM"}
|
|
@@ -64,4 +64,5 @@ exports.patternToIdFilter = require_plugin_utils_filter.patternToIdFilter;
|
|
|
64
64
|
exports.replacePathTokens = require_plugin_utils_paths.replacePathTokens;
|
|
65
65
|
exports.resolveLogLevel = require_plugin_utils_logging.resolveLogLevel;
|
|
66
66
|
exports.withCustomLogger = require_plugin_utils_logging.withCustomLogger;
|
|
67
|
+
exports.withLogFn = require_plugin_utils_logging.withLogFn;
|
|
67
68
|
exports.withLogger = require_plugin_utils_logging.withLogger;
|
|
@@ -7,8 +7,8 @@ import { createCodeFilter, createFilter, createFilterForId, createFilterForTrans
|
|
|
7
7
|
import { formatPackageJson } from "./format-package-json.cjs";
|
|
8
8
|
import { getConfigPath } from "./get-config-path.cjs";
|
|
9
9
|
import { GetHookHandlerReturnType, __ΩGetHookHandlerReturnType, addPluginHook, dedupeHooklist, extractPluginHook, findInvalidPluginConfig, getHookHandler, isDuplicate, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookField, isPluginHookFunction, isPluginHookObject, isUnpluginHookField, isUnpluginHookKey } from "./helpers.cjs";
|
|
10
|
-
import { colorBackground, colorText, consoleLog, consoleLogger, createLogFn, createLogger, extendLogFn, extendLogger, getTextColor, isValidLogLevel, isValidLogLevelConfig, isVerbose, resolveLogLevel, withCustomLogger, withLogger } from "./logging.cjs";
|
|
10
|
+
import { colorBackground, colorText, consoleLog, consoleLogger, createLogFn, createLogger, extendLogFn, extendLogger, getTextColor, isValidLogLevel, isValidLogLevelConfig, isVerbose, resolveLogLevel, withCustomLogger, withLogFn, withLogger } from "./logging.cjs";
|
|
11
11
|
import { MergeResult, __ΩMergeResult, merge, mergeConfig } from "./merge.cjs";
|
|
12
12
|
import { isBuiltinModule } from "./modules.cjs";
|
|
13
13
|
import { replacePathTokens } from "./paths.cjs";
|
|
14
|
-
export { CombinePluginsOptions, GetDependencyConfigResult, GetHookHandlerReturnType, MergeResult, __ΩCombinePluginsOptions, __ΩGetDependencyConfigResult, __ΩGetHookHandlerReturnType, __ΩMergeResult, addPluginHook, colorBackground, colorText, combinePluginOptions, combinePlugins, consoleLog, consoleLogger, createCodeFilter, createFilter, createFilterForId, createFilterForTransform, createIdFilter, createLogFn, createLogger, dedupeHooklist, extend, extendLogFn, extendLogger, extractPluginHook, findInvalidPluginConfig, formatPackageJson, getConfigPath, getDependencyConfig, getDocsOutputPath, getHookHandler, getOrganizationName, getTextColor, getWorkspaceName, isBuiltinModule, isDuplicate, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookField, isPluginHookFunction, isPluginHookObject, isUnpluginHookField, isUnpluginHookKey, isValidLogLevel, isValidLogLevelConfig, isVerbose, merge, mergeConfig, normalizeFilter, patternToCodeFilter, patternToIdFilter, replacePathTokens, resolveLogLevel, withCustomLogger, withLogger };
|
|
14
|
+
export { CombinePluginsOptions, GetDependencyConfigResult, GetHookHandlerReturnType, MergeResult, __ΩCombinePluginsOptions, __ΩGetDependencyConfigResult, __ΩGetHookHandlerReturnType, __ΩMergeResult, addPluginHook, colorBackground, colorText, combinePluginOptions, combinePlugins, consoleLog, consoleLogger, createCodeFilter, createFilter, createFilterForId, createFilterForTransform, createIdFilter, createLogFn, createLogger, dedupeHooklist, extend, extendLogFn, extendLogger, extractPluginHook, findInvalidPluginConfig, formatPackageJson, getConfigPath, getDependencyConfig, getDocsOutputPath, getHookHandler, getOrganizationName, getTextColor, getWorkspaceName, isBuiltinModule, isDuplicate, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookField, isPluginHookFunction, isPluginHookObject, isUnpluginHookField, isUnpluginHookKey, isValidLogLevel, isValidLogLevelConfig, isVerbose, merge, mergeConfig, normalizeFilter, patternToCodeFilter, patternToIdFilter, replacePathTokens, resolveLogLevel, withCustomLogger, withLogFn, withLogger };
|
|
@@ -7,8 +7,8 @@ import { createCodeFilter, createFilter, createFilterForId, createFilterForTrans
|
|
|
7
7
|
import { formatPackageJson } from "./format-package-json.mjs";
|
|
8
8
|
import { getConfigPath } from "./get-config-path.mjs";
|
|
9
9
|
import { GetHookHandlerReturnType, __ΩGetHookHandlerReturnType, addPluginHook, dedupeHooklist, extractPluginHook, findInvalidPluginConfig, getHookHandler, isDuplicate, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookField, isPluginHookFunction, isPluginHookObject, isUnpluginHookField, isUnpluginHookKey } from "./helpers.mjs";
|
|
10
|
-
import { colorBackground, colorText, consoleLog, consoleLogger, createLogFn, createLogger, extendLogFn, extendLogger, getTextColor, isValidLogLevel, isValidLogLevelConfig, isVerbose, resolveLogLevel, withCustomLogger, withLogger } from "./logging.mjs";
|
|
10
|
+
import { colorBackground, colorText, consoleLog, consoleLogger, createLogFn, createLogger, extendLogFn, extendLogger, getTextColor, isValidLogLevel, isValidLogLevelConfig, isVerbose, resolveLogLevel, withCustomLogger, withLogFn, withLogger } from "./logging.mjs";
|
|
11
11
|
import { MergeResult, __ΩMergeResult, merge, mergeConfig } from "./merge.mjs";
|
|
12
12
|
import { isBuiltinModule } from "./modules.mjs";
|
|
13
13
|
import { replacePathTokens } from "./paths.mjs";
|
|
14
|
-
export { CombinePluginsOptions, GetDependencyConfigResult, GetHookHandlerReturnType, MergeResult, __ΩCombinePluginsOptions, __ΩGetDependencyConfigResult, __ΩGetHookHandlerReturnType, __ΩMergeResult, addPluginHook, colorBackground, colorText, combinePluginOptions, combinePlugins, consoleLog, consoleLogger, createCodeFilter, createFilter, createFilterForId, createFilterForTransform, createIdFilter, createLogFn, createLogger, dedupeHooklist, extend, extendLogFn, extendLogger, extractPluginHook, findInvalidPluginConfig, formatPackageJson, getConfigPath, getDependencyConfig, getDocsOutputPath, getHookHandler, getOrganizationName, getTextColor, getWorkspaceName, isBuiltinModule, isDuplicate, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookField, isPluginHookFunction, isPluginHookObject, isUnpluginHookField, isUnpluginHookKey, isValidLogLevel, isValidLogLevelConfig, isVerbose, merge, mergeConfig, normalizeFilter, patternToCodeFilter, patternToIdFilter, replacePathTokens, resolveLogLevel, withCustomLogger, withLogger };
|
|
14
|
+
export { CombinePluginsOptions, GetDependencyConfigResult, GetHookHandlerReturnType, MergeResult, __ΩCombinePluginsOptions, __ΩGetDependencyConfigResult, __ΩGetHookHandlerReturnType, __ΩMergeResult, addPluginHook, colorBackground, colorText, combinePluginOptions, combinePlugins, consoleLog, consoleLogger, createCodeFilter, createFilter, createFilterForId, createFilterForTransform, createIdFilter, createLogFn, createLogger, dedupeHooklist, extend, extendLogFn, extendLogger, extractPluginHook, findInvalidPluginConfig, formatPackageJson, getConfigPath, getDependencyConfig, getDocsOutputPath, getHookHandler, getOrganizationName, getTextColor, getWorkspaceName, isBuiltinModule, isDuplicate, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookField, isPluginHookFunction, isPluginHookObject, isUnpluginHookField, isUnpluginHookKey, isValidLogLevel, isValidLogLevelConfig, isVerbose, merge, mergeConfig, normalizeFilter, patternToCodeFilter, patternToIdFilter, replacePathTokens, resolveLogLevel, withCustomLogger, withLogFn, withLogger };
|
|
@@ -9,7 +9,7 @@ import { getDocsOutputPath } from "./docs-helper.mjs";
|
|
|
9
9
|
import { extend } from "./extend.mjs";
|
|
10
10
|
import { createCodeFilter, createFilter, createFilterForId, createFilterForTransform, createIdFilter, normalizeFilter, patternToCodeFilter, patternToIdFilter } from "./filter.mjs";
|
|
11
11
|
import { getConfigPath } from "./get-config-path.mjs";
|
|
12
|
-
import { colorBackground, colorText, consoleLog, consoleLogger, createLogFn, createLogger, extendLogFn, extendLogger, getTextColor, isValidLogLevel, isValidLogLevelConfig, isVerbose, resolveLogLevel, withCustomLogger, withLogger } from "./logging.mjs";
|
|
12
|
+
import { colorBackground, colorText, consoleLog, consoleLogger, createLogFn, createLogger, extendLogFn, extendLogger, getTextColor, isValidLogLevel, isValidLogLevelConfig, isVerbose, resolveLogLevel, withCustomLogger, withLogFn, withLogger } from "./logging.mjs";
|
|
13
13
|
import { isBuiltinModule } from "./modules.mjs";
|
|
14
14
|
|
|
15
|
-
export { addPluginHook, colorBackground, colorText, combinePluginOptions, combinePlugins, consoleLog, consoleLogger, createCodeFilter, createFilter, createFilterForId, createFilterForTransform, createIdFilter, createLogFn, createLogger, dedupeHooklist, extend, extendLogFn, extendLogger, extractPluginHook, findInvalidPluginConfig, formatPackageJson, getConfigPath, getDependencyConfig, getDocsOutputPath, getHookHandler, getOrganizationName, getTextColor, getWorkspaceName, isBuiltinModule, isDuplicate, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookField, isPluginHookFunction, isPluginHookObject, isUnpluginHookField, isUnpluginHookKey, isValidLogLevel, isValidLogLevelConfig, isVerbose, merge, mergeConfig, normalizeFilter, patternToCodeFilter, patternToIdFilter, replacePathTokens, resolveLogLevel, withCustomLogger, withLogger };
|
|
15
|
+
export { addPluginHook, colorBackground, colorText, combinePluginOptions, combinePlugins, consoleLog, consoleLogger, createCodeFilter, createFilter, createFilterForId, createFilterForTransform, createIdFilter, createLogFn, createLogger, dedupeHooklist, extend, extendLogFn, extendLogger, extractPluginHook, findInvalidPluginConfig, formatPackageJson, getConfigPath, getDependencyConfig, getDocsOutputPath, getHookHandler, getOrganizationName, getTextColor, getWorkspaceName, isBuiltinModule, isDuplicate, isPlugin, isPluginConfig, isPluginConfigObject, isPluginConfigTuple, isPluginHook, isPluginHookField, isPluginHookFunction, isPluginHookObject, isUnpluginHookField, isUnpluginHookKey, isValidLogLevel, isValidLogLevelConfig, isVerbose, merge, mergeConfig, normalizeFilter, patternToCodeFilter, patternToIdFilter, replacePathTokens, resolveLogLevel, withCustomLogger, withLogFn, withLogger };
|
|
@@ -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.category === require_logging.LogCategories.PERFORMANCE ? "performance" : meta.type), { logLevel: "all" })(`${meta.name ? chalk.default.bold.hex(BRAND_COLOR)((0, _stryke_string_format_kebab_case.kebabCase)(meta.name)) : ""}${meta.name ? chalk.default.grey(" > ") : ""}${meta.command
|
|
134
|
+
const consoleLog = (meta, ...args) => (0, _storm_software_config_tools_logger.getLogFn)((0, _storm_software_config_tools_logger.getLogLevel)(meta.category === require_logging.LogCategories.PERFORMANCE ? "performance" : meta.type), { logLevel: "all" })(`${meta.name ? chalk.default.bold.hex(BRAND_COLOR)((0, _stryke_string_format_kebab_case.kebabCase)(meta.name)) : ""}${meta.name ? chalk.default.grey(" > ") : ""}${meta.command ? `${chalk.default.bold.hex(BRAND_COLOR)((0, _stryke_string_format_kebab_case.kebabCase)(meta.command))}${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.plugin ? `${chalk.default.bold.hex(BRAND_COLOR)((0, _stryke_string_format_kebab_case.kebabCase)(meta.plugin))}${chalk.default.grey(" > ")}` : ""}${meta.source ? `${chalk.default.bold.hex(BRAND_COLOR)((0, _stryke_string_format_kebab_case.kebabCase)(meta.source))}${chalk.default.grey(" > ")}` : ""}${meta.category && meta.category !== require_logging.LogCategories.GENERAL && meta.category !== require_logging.LogCategories.PERFORMANCE ? `${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);
|
|
@@ -207,12 +207,12 @@ const validateCustomLogger = (type, name, options, callback, customCallback) =>
|
|
|
207
207
|
name,
|
|
208
208
|
plugin: options.plugin,
|
|
209
209
|
meta: {
|
|
210
|
+
category: require_logging.LogCategories.GENERAL,
|
|
211
|
+
...options,
|
|
210
212
|
type,
|
|
211
213
|
name,
|
|
212
|
-
category: require_logging.LogCategories.GENERAL,
|
|
213
214
|
logId: (0, _stryke_unique_id_uuid.uuid)(),
|
|
214
|
-
timestamp: Date.now()
|
|
215
|
-
...options
|
|
215
|
+
timestamp: Date.now()
|
|
216
216
|
},
|
|
217
217
|
message
|
|
218
218
|
} : {
|
|
@@ -220,13 +220,13 @@ const validateCustomLogger = (type, name, options, callback, customCallback) =>
|
|
|
220
220
|
plugin: options.plugin,
|
|
221
221
|
...message,
|
|
222
222
|
meta: {
|
|
223
|
+
category: require_logging.LogCategories.GENERAL,
|
|
224
|
+
...options,
|
|
223
225
|
type,
|
|
224
226
|
name,
|
|
225
|
-
category: require_logging.LogCategories.GENERAL,
|
|
226
227
|
logId: (0, _stryke_unique_id_uuid.uuid)(),
|
|
227
228
|
timestamp: Date.now(),
|
|
228
229
|
plugin: message.plugin,
|
|
229
|
-
...options,
|
|
230
230
|
...message.meta
|
|
231
231
|
}
|
|
232
232
|
};
|
|
@@ -300,6 +300,97 @@ const withLogger = (logger, secondaryLogger) => {
|
|
|
300
300
|
* Create a logging function with a specific name and options.
|
|
301
301
|
*
|
|
302
302
|
* @param logger - The original logger to wrap with the custom logger.
|
|
303
|
+
* @param logFn - The custom logging function to use for logging messages, which can be used to override the default logging behavior of the original logger.
|
|
304
|
+
* @returns A new logger that combines the original logger's options with the custom logging function, allowing for customized logging behavior while still maintaining the original logger's configuration.
|
|
305
|
+
*/
|
|
306
|
+
const withLogFn = (logger, logFn) => {
|
|
307
|
+
const result = {
|
|
308
|
+
options: logger.options,
|
|
309
|
+
error: validateLogger("error", logger.options.name, logger.options, (msg) => {
|
|
310
|
+
logger.error?.(msg);
|
|
311
|
+
logFn({
|
|
312
|
+
category: require_logging.LogCategories.GENERAL,
|
|
313
|
+
...logger.options,
|
|
314
|
+
type: "error",
|
|
315
|
+
logId: (0, _stryke_unique_id_uuid.uuid)(),
|
|
316
|
+
timestamp: Date.now(),
|
|
317
|
+
...msg.meta
|
|
318
|
+
}, msg.message);
|
|
319
|
+
}),
|
|
320
|
+
warn: validateLogger("warn", logger.options.name, logger.options, (msg) => {
|
|
321
|
+
logger.warn?.(msg);
|
|
322
|
+
logFn({
|
|
323
|
+
category: require_logging.LogCategories.GENERAL,
|
|
324
|
+
...logger.options,
|
|
325
|
+
type: "warn",
|
|
326
|
+
logId: (0, _stryke_unique_id_uuid.uuid)(),
|
|
327
|
+
timestamp: Date.now(),
|
|
328
|
+
...msg.meta
|
|
329
|
+
}, msg.message);
|
|
330
|
+
}),
|
|
331
|
+
info: validateLogger("info", logger.options.name, logger.options, (msg) => {
|
|
332
|
+
logger.info?.(msg);
|
|
333
|
+
logFn({
|
|
334
|
+
category: require_logging.LogCategories.GENERAL,
|
|
335
|
+
...logger.options,
|
|
336
|
+
type: "info",
|
|
337
|
+
logId: (0, _stryke_unique_id_uuid.uuid)(),
|
|
338
|
+
timestamp: Date.now(),
|
|
339
|
+
...msg.meta
|
|
340
|
+
}, msg.message);
|
|
341
|
+
}),
|
|
342
|
+
debug: validateLogger("debug", logger.options.name, logger.options, (msg) => {
|
|
343
|
+
logger.debug?.(msg);
|
|
344
|
+
logFn({
|
|
345
|
+
category: require_logging.LogCategories.GENERAL,
|
|
346
|
+
...logger.options,
|
|
347
|
+
type: "debug",
|
|
348
|
+
logId: (0, _stryke_unique_id_uuid.uuid)(),
|
|
349
|
+
timestamp: Date.now(),
|
|
350
|
+
...msg.meta
|
|
351
|
+
}, msg.message);
|
|
352
|
+
}),
|
|
353
|
+
trace: validateLogger("trace", logger.options.name, logger.options, (msg) => {
|
|
354
|
+
logger.trace?.(msg);
|
|
355
|
+
logFn({
|
|
356
|
+
category: require_logging.LogCategories.GENERAL,
|
|
357
|
+
...logger.options,
|
|
358
|
+
type: "trace",
|
|
359
|
+
logId: (0, _stryke_unique_id_uuid.uuid)(),
|
|
360
|
+
timestamp: Date.now(),
|
|
361
|
+
...msg.meta
|
|
362
|
+
}, msg.message);
|
|
363
|
+
})
|
|
364
|
+
};
|
|
365
|
+
result.log = (type, message) => {
|
|
366
|
+
switch (type) {
|
|
367
|
+
case "error":
|
|
368
|
+
result.error(message);
|
|
369
|
+
break;
|
|
370
|
+
case "warn":
|
|
371
|
+
result.warn(message);
|
|
372
|
+
break;
|
|
373
|
+
case "info":
|
|
374
|
+
result.info(message);
|
|
375
|
+
break;
|
|
376
|
+
case "debug":
|
|
377
|
+
result.debug(message);
|
|
378
|
+
break;
|
|
379
|
+
case "trace":
|
|
380
|
+
result.trace(message);
|
|
381
|
+
break;
|
|
382
|
+
case "silent": break;
|
|
383
|
+
default:
|
|
384
|
+
result.info(message);
|
|
385
|
+
break;
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
return result;
|
|
389
|
+
};
|
|
390
|
+
/**
|
|
391
|
+
* Create a logging function with a specific name and options.
|
|
392
|
+
*
|
|
393
|
+
* @param logger - The original logger to wrap with the custom logger.
|
|
303
394
|
* @param customLogger - The custom logger to use for logging messages, which can be used to override the default logging behavior of the original logger.
|
|
304
395
|
* @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.
|
|
305
396
|
*/
|
|
@@ -337,18 +428,13 @@ const withCustomLogger = (logger, customLogger) => {
|
|
|
337
428
|
};
|
|
338
429
|
return result;
|
|
339
430
|
};
|
|
340
|
-
const consoleLogger = (
|
|
341
|
-
type,
|
|
342
|
-
category: require_logging.LogCategories.GENERAL,
|
|
343
|
-
logId: (0, _stryke_unique_id_uuid.uuid)(),
|
|
344
|
-
timestamp: Date.now()
|
|
345
|
-
} : {
|
|
346
|
-
type,
|
|
431
|
+
const consoleLogger = (meta, message) => consoleLog({
|
|
432
|
+
type: (0, _stryke_type_checks_is_set_string.isSetString)(meta) ? meta : meta.type,
|
|
347
433
|
category: require_logging.LogCategories.GENERAL,
|
|
348
434
|
logId: (0, _stryke_unique_id_uuid.uuid)(),
|
|
349
435
|
timestamp: Date.now(),
|
|
350
|
-
...
|
|
351
|
-
},
|
|
436
|
+
...(0, _stryke_type_checks_is_set_object.isSetObject)(meta) ? meta : {}
|
|
437
|
+
}, message);
|
|
352
438
|
/**
|
|
353
439
|
* Create a logging function with a specific name and options.
|
|
354
440
|
*
|
|
@@ -365,23 +451,38 @@ const createLogger = (name, options, callback = consoleLogger) => {
|
|
|
365
451
|
error: validateLogger("error", name, {
|
|
366
452
|
...options,
|
|
367
453
|
name
|
|
368
|
-
}, (
|
|
454
|
+
}, (data) => callback({
|
|
455
|
+
...data.meta,
|
|
456
|
+
type: "error"
|
|
457
|
+
}, data.message)),
|
|
369
458
|
warn: validateLogger("warn", name, {
|
|
370
459
|
...options,
|
|
371
460
|
name
|
|
372
|
-
}, (
|
|
461
|
+
}, (data) => callback({
|
|
462
|
+
...data.meta,
|
|
463
|
+
type: "warn"
|
|
464
|
+
}, data.message)),
|
|
373
465
|
info: validateLogger("info", name, {
|
|
374
466
|
...options,
|
|
375
467
|
name
|
|
376
|
-
}, (
|
|
468
|
+
}, (data) => callback({
|
|
469
|
+
...data.meta,
|
|
470
|
+
type: "info"
|
|
471
|
+
}, data.message)),
|
|
377
472
|
debug: validateLogger("debug", name, {
|
|
378
473
|
...options,
|
|
379
474
|
name
|
|
380
|
-
}, (
|
|
475
|
+
}, (data) => callback({
|
|
476
|
+
...data.meta,
|
|
477
|
+
type: "debug"
|
|
478
|
+
}, data.message)),
|
|
381
479
|
trace: validateLogger("trace", name, {
|
|
382
480
|
...options,
|
|
383
481
|
name
|
|
384
|
-
}, (
|
|
482
|
+
}, (data) => callback({
|
|
483
|
+
...data.meta,
|
|
484
|
+
type: "trace"
|
|
485
|
+
}, data.message))
|
|
385
486
|
};
|
|
386
487
|
result.log = (type, message) => {
|
|
387
488
|
switch (type) {
|
|
@@ -485,4 +586,5 @@ exports.isValidLogLevelConfig = isValidLogLevelConfig;
|
|
|
485
586
|
exports.isVerbose = isVerbose;
|
|
486
587
|
exports.resolveLogLevel = resolveLogLevel;
|
|
487
588
|
exports.withCustomLogger = withCustomLogger;
|
|
589
|
+
exports.withLogFn = withLogFn;
|
|
488
590
|
exports.withLogger = withLogger;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CustomLogger, LogCategory, LogFn, LogFnOptions, LogLevel, LogLevelResolvedConfig, LogLevelUserConfig, LogMeta, Logger,
|
|
1
|
+
import { CustomLogger, LogCategory, LogFn, LogFnOptions, LogLevel, LogLevelResolvedConfig, LogLevelUserConfig, LogMeta, Logger, LoggerOptions } from "../types/logging.cjs";
|
|
2
2
|
import { UnresolvedContext } from "../types/context.cjs";
|
|
3
3
|
import { Mode } from "../types/config.cjs";
|
|
4
4
|
|
|
@@ -65,6 +65,14 @@ declare const createLogFn: (name: string, options: LogFnOptions) => LogFn;
|
|
|
65
65
|
* @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.
|
|
66
66
|
*/
|
|
67
67
|
declare const withLogger: (logger: Logger, secondaryLogger: Logger) => Logger;
|
|
68
|
+
/**
|
|
69
|
+
* Create a logging function with a specific name and options.
|
|
70
|
+
*
|
|
71
|
+
* @param logger - The original logger to wrap with the custom logger.
|
|
72
|
+
* @param logFn - The custom logging function to use for logging messages, which can be used to override the default logging behavior of the original logger.
|
|
73
|
+
* @returns A new logger that combines the original logger's options with the custom logging function, allowing for customized logging behavior while still maintaining the original logger's configuration.
|
|
74
|
+
*/
|
|
75
|
+
declare const withLogFn: (logger: Logger, logFn: LogFn) => Logger;
|
|
68
76
|
/**
|
|
69
77
|
* Create a logging function with a specific name and options.
|
|
70
78
|
*
|
|
@@ -73,7 +81,7 @@ declare const withLogger: (logger: Logger, secondaryLogger: Logger) => Logger;
|
|
|
73
81
|
* @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.
|
|
74
82
|
*/
|
|
75
83
|
declare const withCustomLogger: (logger: Logger, customLogger: CustomLogger) => Logger;
|
|
76
|
-
declare const consoleLogger:
|
|
84
|
+
declare const consoleLogger: LogFn;
|
|
77
85
|
/**
|
|
78
86
|
* Create a logging function with a specific name and options.
|
|
79
87
|
*
|
|
@@ -81,7 +89,7 @@ declare const consoleLogger: (type: LogLevel, message: string | LoggerMessage) =
|
|
|
81
89
|
* @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.
|
|
82
90
|
* @returns A logging function.
|
|
83
91
|
*/
|
|
84
|
-
declare const createLogger: (name: string, options: LoggerOptions, callback?:
|
|
92
|
+
declare const createLogger: (name: string, options: LoggerOptions, callback?: LogFn) => Logger;
|
|
85
93
|
/**
|
|
86
94
|
* Extend a logging function with a specific name, adding a colored badge to the log output.
|
|
87
95
|
*
|
|
@@ -99,5 +107,5 @@ declare const extendLogFn: (logFn: LogFn, options: LogFnOptions) => LogFn;
|
|
|
99
107
|
*/
|
|
100
108
|
declare const extendLogger: (logger: Logger, options: LoggerOptions) => Logger;
|
|
101
109
|
//#endregion
|
|
102
|
-
export { colorBackground, colorText, consoleLog, consoleLogger, createLogFn, createLogger, extendLogFn, extendLogger, getTextColor, isValidLogLevel, isValidLogLevelConfig, isVerbose, resolveLogLevel, withCustomLogger, withLogger };
|
|
110
|
+
export { colorBackground, colorText, consoleLog, consoleLogger, createLogFn, createLogger, extendLogFn, extendLogger, getTextColor, isValidLogLevel, isValidLogLevelConfig, isVerbose, resolveLogLevel, withCustomLogger, withLogFn, withLogger };
|
|
103
111
|
//# sourceMappingURL=logging.d.cts.map
|