@powerlines/core 0.1.2 → 0.1.4

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 CHANGED
@@ -11,11 +11,11 @@ import { PartiallyResolvedContext, __ΩPartiallyResolvedContext, defineConfig, l
11
11
  import { getUniqueInputs, isResolvedEntryTypeDefinition, isTypeDefinition, resolveEntryOutput, resolveInput, resolveInputs, resolveInputsSync } from "./lib/entry.cjs";
12
12
  import { CreateLogOptions, __ΩCreateLogOptions, createLog, extendLog } from "./lib/logger.cjs";
13
13
  import { combineContexts, isUnpluginBuilderVariant } from "./lib/unplugin/helpers.cjs";
14
- import { createUnpluginModuleResolutionFunctions } from "./lib/unplugin/module-resolution.cjs";
15
- import { createUnplugin, createUnpluginResolver } from "./lib/unplugin/plugin.cjs";
14
+ import { CreateUnpluginModuleResolutionFunctionsOptions, __ΩCreateUnpluginModuleResolutionFunctionsOptions, createUnpluginModuleResolutionFunctions } from "./lib/unplugin/module-resolution.cjs";
15
+ import { CreateUnpluginOptions, CreateUnpluginResolverOptions, __ΩCreateUnpluginOptions, __ΩCreateUnpluginResolverOptions, createUnplugin, createUnpluginResolver } from "./lib/unplugin/plugin.cjs";
16
16
  import { FileHeaderOptions, __ΩFileHeaderOptions, getBaseFileHeader, getFileHeader } from "./lib/utilities/file-header.cjs";
17
17
  import { format, formatFolder } from "./lib/utilities/format.cjs";
18
18
  import { getMagicString, getSourceFile, getString } from "./lib/utilities/source-file.cjs";
19
19
  import { generateSourceMap } from "./lib/utilities/source-map.cjs";
20
20
  import { writeFile } from "./lib/utilities/write-file.cjs";
21
- export { API, APIContext, AnyUserConfig, BaseConfig, BuildInlineConfig, BuildPluginContext, BuilderVariant, CallHookOptions, CleanInlineConfig, CommandType, Commands, ConfigEnv, Context, CreateLogOptions, DeepkitOptions, DeployInlineConfig, DocsInlineConfig, EmitEntryOptions, EmitOptions, EnvironmentConfig, EnvironmentContext, EnvironmentContextPlugin, EnvironmentResolvedConfig, FetchOptions, FileHeaderOptions, HookFields, HookListOrders, HooksList, InferHookFunction, InferHookParameters, InferHookReturnType, InferHookThisType, InferHooksListItem, InferUnpluginOptions, InferUnpluginVariant, InitContextOptions, InitialUserConfig, InlineConfig, LintInlineConfig, LogFn, LogLevel, MetaInfo, NewInlineConfig, OutputConfig, OutputResolvedConfig, ParseOptions, ParsedTypeScriptConfig, ParsedUserConfig, PartialPlugin, PartialPluginFactory, PartiallyResolvedContext, Plugin, PluginConfig, PluginConfigObject, PluginConfigTuple, PluginContext, PluginFactory, PluginFields, PluginHook, PluginHookFields, PluginHookFunctions, PluginHookObject, PluginHooks, PluginHooksList, PluginHooksListItem, PluginNonHookFields, PowerlinesCommand, PrepareInlineConfig, ProjectType, RawReflectionMode, ReflectionLevel, ReflectionMode, ResolveConfig, ResolveOptions, ResolveResolvedConfig, ResolvedAssetGlob, ResolvedConfig, ResolvedEntryTypeDefinition, Resolver, SelectHookResult, SelectHookResultItem, SelectHooksOptions, SourceFile, StorageAdapter, StoragePort, StoragePreset, TSCompilerOptions, TSConfig, TransformResult, TypesResult, UnimportContext, UnpluginBuilderVariant, UnpluginFactory, UnpluginHookFunctions, UnpluginHookList, UnpluginHookVariant, UnpluginHookVariantField, UnpluginHooksListItem, UnpluginOptions, UnpluginUserConfig, UnresolvedContext, UserConfig, VirtualFile, VirtualFileData, VirtualFileExtension, VirtualFileMetadata, VirtualFileSystemInterface, WithUnpluginBuildContext, WorkerProcess, WorkspaceConfig, WriteData, WriteOptions, __ΩAPI, __ΩAPIContext, __ΩAnyUserConfig, __ΩBaseConfig, __ΩBuildInlineConfig, __ΩBuildPluginContext, __ΩBuilderVariant, __ΩCallHookOptions, __ΩCleanInlineConfig, __ΩCommandType, __ΩCommands, __ΩConfigEnv, __ΩContext, __ΩCreateLogOptions, __ΩDeepkitOptions, __ΩDeployInlineConfig, __ΩDocsInlineConfig, __ΩEmitEntryOptions, __ΩEmitOptions, __ΩEnvironmentConfig, __ΩEnvironmentContext, __ΩEnvironmentContextPlugin, __ΩEnvironmentResolvedConfig, __ΩFetchOptions, __ΩFileHeaderOptions, __ΩHookFields, __ΩHookListOrders, __ΩHooksList, __ΩInferHookFunction, __ΩInferHookParameters, __ΩInferHookReturnType, __ΩInferHookThisType, __ΩInferHooksListItem, __ΩInferUnpluginOptions, __ΩInferUnpluginVariant, __ΩInitContextOptions, __ΩInitialUserConfig, __ΩInlineConfig, __ΩLintInlineConfig, __ΩLogFn, __ΩLogLevel, __ΩMetaInfo, __ΩNewInlineConfig, __ΩOutputConfig, __ΩOutputResolvedConfig, __ΩParseOptions, __ΩParsedTypeScriptConfig, __ΩParsedUserConfig, __ΩPartialPlugin, __ΩPartialPluginFactory, __ΩPartiallyResolvedContext, __ΩPlugin, __ΩPluginConfig, __ΩPluginConfigObject, __ΩPluginConfigTuple, __ΩPluginContext, __ΩPluginFactory, __ΩPluginFields, __ΩPluginHook, __ΩPluginHookFields, __ΩPluginHookFunctions, __ΩPluginHookObject, __ΩPluginHooks, __ΩPluginHooksList, __ΩPluginHooksListItem, __ΩPluginNonHookFields, __ΩPowerlinesCommand, __ΩPrepareInlineConfig, __ΩProjectType, __ΩRawReflectionMode, __ΩReflectionLevel, __ΩReflectionMode, __ΩResolveConfig, __ΩResolveOptions, __ΩResolveResolvedConfig, __ΩResolvedAssetGlob, __ΩResolvedConfig, __ΩResolvedEntryTypeDefinition, __ΩResolver, __ΩSelectHookResult, __ΩSelectHookResultItem, __ΩSelectHooksOptions, __ΩSourceFile, __ΩStorageAdapter, __ΩStoragePort, __ΩStoragePreset, __ΩTSCompilerOptions, __ΩTSConfig, __ΩTransformResult, __ΩTypesResult, __ΩUnimportContext, __ΩUnpluginBuilderVariant, __ΩUnpluginFactory, __ΩUnpluginHookFunctions, __ΩUnpluginHookList, __ΩUnpluginHookVariant, __ΩUnpluginHookVariantField, __ΩUnpluginHooksListItem, __ΩUnpluginOptions, __ΩUnpluginUserConfig, __ΩUnresolvedContext, __ΩUserConfig, __ΩVirtualFile, __ΩVirtualFileData, __ΩVirtualFileExtension, __ΩVirtualFileMetadata, __ΩVirtualFileSystemInterface, __ΩWithUnpluginBuildContext, __ΩWorkerProcess, __ΩWorkspaceConfig, __ΩWriteData, __ΩWriteOptions, combineContexts, createLog, createUnplugin, createUnpluginModuleResolutionFunctions, createUnpluginResolver, defineConfig, extendLog, format, formatFolder, generateSourceMap, getBaseFileHeader, getFileHeader, getMagicString, getSourceFile, getString, getUniqueInputs, isResolvedEntryTypeDefinition, isTypeDefinition, isUnpluginBuilderVariant, loadUserConfigFile, loadWorkspaceConfig, resolveEntryOutput, resolveInput, resolveInputs, resolveInputsSync, writeFile };
21
+ export { API, APIContext, AnyUserConfig, BaseConfig, BuildInlineConfig, BuildPluginContext, BuilderVariant, CallHookOptions, CleanInlineConfig, CommandType, Commands, ConfigEnv, Context, CreateLogOptions, CreateUnpluginModuleResolutionFunctionsOptions, CreateUnpluginOptions, CreateUnpluginResolverOptions, DeepkitOptions, DeployInlineConfig, DocsInlineConfig, EmitEntryOptions, EmitOptions, EnvironmentConfig, EnvironmentContext, EnvironmentContextPlugin, EnvironmentResolvedConfig, FetchOptions, FileHeaderOptions, HookFields, HookListOrders, HooksList, InferHookFunction, InferHookParameters, InferHookReturnType, InferHookThisType, InferHooksListItem, InferUnpluginOptions, InferUnpluginVariant, InitContextOptions, InitialUserConfig, InlineConfig, LintInlineConfig, LogFn, LogLevel, MetaInfo, NewInlineConfig, OutputConfig, OutputResolvedConfig, ParseOptions, ParsedTypeScriptConfig, ParsedUserConfig, PartialPlugin, PartialPluginFactory, PartiallyResolvedContext, Plugin, PluginConfig, PluginConfigObject, PluginConfigTuple, PluginContext, PluginFactory, PluginFields, PluginHook, PluginHookFields, PluginHookFunctions, PluginHookObject, PluginHooks, PluginHooksList, PluginHooksListItem, PluginNonHookFields, PowerlinesCommand, PrepareInlineConfig, ProjectType, RawReflectionMode, ReflectionLevel, ReflectionMode, ResolveConfig, ResolveOptions, ResolveResolvedConfig, ResolvedAssetGlob, ResolvedConfig, ResolvedEntryTypeDefinition, Resolver, SelectHookResult, SelectHookResultItem, SelectHooksOptions, SourceFile, StorageAdapter, StoragePort, StoragePreset, TSCompilerOptions, TSConfig, TransformResult, TypesResult, UnimportContext, UnpluginBuilderVariant, UnpluginFactory, UnpluginHookFunctions, UnpluginHookList, UnpluginHookVariant, UnpluginHookVariantField, UnpluginHooksListItem, UnpluginOptions, UnpluginUserConfig, UnresolvedContext, UserConfig, VirtualFile, VirtualFileData, VirtualFileExtension, VirtualFileMetadata, VirtualFileSystemInterface, WithUnpluginBuildContext, WorkerProcess, WorkspaceConfig, WriteData, WriteOptions, __ΩAPI, __ΩAPIContext, __ΩAnyUserConfig, __ΩBaseConfig, __ΩBuildInlineConfig, __ΩBuildPluginContext, __ΩBuilderVariant, __ΩCallHookOptions, __ΩCleanInlineConfig, __ΩCommandType, __ΩCommands, __ΩConfigEnv, __ΩContext, __ΩCreateLogOptions, __ΩCreateUnpluginModuleResolutionFunctionsOptions, __ΩCreateUnpluginOptions, __ΩCreateUnpluginResolverOptions, __ΩDeepkitOptions, __ΩDeployInlineConfig, __ΩDocsInlineConfig, __ΩEmitEntryOptions, __ΩEmitOptions, __ΩEnvironmentConfig, __ΩEnvironmentContext, __ΩEnvironmentContextPlugin, __ΩEnvironmentResolvedConfig, __ΩFetchOptions, __ΩFileHeaderOptions, __ΩHookFields, __ΩHookListOrders, __ΩHooksList, __ΩInferHookFunction, __ΩInferHookParameters, __ΩInferHookReturnType, __ΩInferHookThisType, __ΩInferHooksListItem, __ΩInferUnpluginOptions, __ΩInferUnpluginVariant, __ΩInitContextOptions, __ΩInitialUserConfig, __ΩInlineConfig, __ΩLintInlineConfig, __ΩLogFn, __ΩLogLevel, __ΩMetaInfo, __ΩNewInlineConfig, __ΩOutputConfig, __ΩOutputResolvedConfig, __ΩParseOptions, __ΩParsedTypeScriptConfig, __ΩParsedUserConfig, __ΩPartialPlugin, __ΩPartialPluginFactory, __ΩPartiallyResolvedContext, __ΩPlugin, __ΩPluginConfig, __ΩPluginConfigObject, __ΩPluginConfigTuple, __ΩPluginContext, __ΩPluginFactory, __ΩPluginFields, __ΩPluginHook, __ΩPluginHookFields, __ΩPluginHookFunctions, __ΩPluginHookObject, __ΩPluginHooks, __ΩPluginHooksList, __ΩPluginHooksListItem, __ΩPluginNonHookFields, __ΩPowerlinesCommand, __ΩPrepareInlineConfig, __ΩProjectType, __ΩRawReflectionMode, __ΩReflectionLevel, __ΩReflectionMode, __ΩResolveConfig, __ΩResolveOptions, __ΩResolveResolvedConfig, __ΩResolvedAssetGlob, __ΩResolvedConfig, __ΩResolvedEntryTypeDefinition, __ΩResolver, __ΩSelectHookResult, __ΩSelectHookResultItem, __ΩSelectHooksOptions, __ΩSourceFile, __ΩStorageAdapter, __ΩStoragePort, __ΩStoragePreset, __ΩTSCompilerOptions, __ΩTSConfig, __ΩTransformResult, __ΩTypesResult, __ΩUnimportContext, __ΩUnpluginBuilderVariant, __ΩUnpluginFactory, __ΩUnpluginHookFunctions, __ΩUnpluginHookList, __ΩUnpluginHookVariant, __ΩUnpluginHookVariantField, __ΩUnpluginHooksListItem, __ΩUnpluginOptions, __ΩUnpluginUserConfig, __ΩUnresolvedContext, __ΩUserConfig, __ΩVirtualFile, __ΩVirtualFileData, __ΩVirtualFileExtension, __ΩVirtualFileMetadata, __ΩVirtualFileSystemInterface, __ΩWithUnpluginBuildContext, __ΩWorkerProcess, __ΩWorkspaceConfig, __ΩWriteData, __ΩWriteOptions, combineContexts, createLog, createUnplugin, createUnpluginModuleResolutionFunctions, createUnpluginResolver, defineConfig, extendLog, format, formatFolder, generateSourceMap, getBaseFileHeader, getFileHeader, getMagicString, getSourceFile, getString, getUniqueInputs, isResolvedEntryTypeDefinition, isTypeDefinition, isUnpluginBuilderVariant, loadUserConfigFile, loadWorkspaceConfig, resolveEntryOutput, resolveInput, resolveInputs, resolveInputsSync, writeFile };
package/dist/index.d.mts CHANGED
@@ -12,12 +12,12 @@ import "./types/index.mjs";
12
12
  import { getUniqueInputs, isResolvedEntryTypeDefinition, isTypeDefinition, resolveEntryOutput, resolveInput, resolveInputs, resolveInputsSync } from "./lib/entry.mjs";
13
13
  import { CreateLogOptions, __ΩCreateLogOptions, createLog, extendLog } from "./lib/logger.mjs";
14
14
  import { combineContexts, isUnpluginBuilderVariant } from "./lib/unplugin/helpers.mjs";
15
- import { createUnpluginModuleResolutionFunctions } from "./lib/unplugin/module-resolution.mjs";
16
- import { createUnplugin, createUnpluginResolver } from "./lib/unplugin/plugin.mjs";
15
+ import { CreateUnpluginModuleResolutionFunctionsOptions, __ΩCreateUnpluginModuleResolutionFunctionsOptions, createUnpluginModuleResolutionFunctions } from "./lib/unplugin/module-resolution.mjs";
16
+ import { CreateUnpluginOptions, CreateUnpluginResolverOptions, __ΩCreateUnpluginOptions, __ΩCreateUnpluginResolverOptions, createUnplugin, createUnpluginResolver } from "./lib/unplugin/plugin.mjs";
17
17
  import { FileHeaderOptions, __ΩFileHeaderOptions, getBaseFileHeader, getFileHeader } from "./lib/utilities/file-header.mjs";
18
18
  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
22
  import "./lib/index.mjs";
23
- export { API, APIContext, AnyUserConfig, BaseConfig, BuildInlineConfig, BuildPluginContext, BuilderVariant, CallHookOptions, CleanInlineConfig, CommandType, Commands, ConfigEnv, Context, CreateLogOptions, DeepkitOptions, DeployInlineConfig, DocsInlineConfig, EmitEntryOptions, EmitOptions, EnvironmentConfig, EnvironmentContext, EnvironmentContextPlugin, EnvironmentResolvedConfig, FetchOptions, FileHeaderOptions, HookFields, HookListOrders, HooksList, InferHookFunction, InferHookParameters, InferHookReturnType, InferHookThisType, InferHooksListItem, InferUnpluginOptions, InferUnpluginVariant, InitContextOptions, InitialUserConfig, InlineConfig, LintInlineConfig, LogFn, LogLevel, MetaInfo, NewInlineConfig, OutputConfig, OutputResolvedConfig, ParseOptions, ParsedTypeScriptConfig, ParsedUserConfig, PartialPlugin, PartialPluginFactory, PartiallyResolvedContext, Plugin, PluginConfig, PluginConfigObject, PluginConfigTuple, PluginContext, PluginFactory, PluginFields, PluginHook, PluginHookFields, PluginHookFunctions, PluginHookObject, PluginHooks, PluginHooksList, PluginHooksListItem, PluginNonHookFields, PowerlinesCommand, PrepareInlineConfig, ProjectType, RawReflectionMode, ReflectionLevel, ReflectionMode, ResolveConfig, ResolveOptions, ResolveResolvedConfig, ResolvedAssetGlob, ResolvedConfig, ResolvedEntryTypeDefinition, Resolver, SelectHookResult, SelectHookResultItem, SelectHooksOptions, SourceFile, StorageAdapter, StoragePort, StoragePreset, TSCompilerOptions, TSConfig, TransformResult, TypesResult, UnimportContext, UnpluginBuilderVariant, UnpluginFactory, UnpluginHookFunctions, UnpluginHookList, UnpluginHookVariant, UnpluginHookVariantField, UnpluginHooksListItem, UnpluginOptions, UnpluginUserConfig, UnresolvedContext, UserConfig, VirtualFile, VirtualFileData, VirtualFileExtension, VirtualFileMetadata, VirtualFileSystemInterface, WithUnpluginBuildContext, WorkerProcess, WorkspaceConfig, WriteData, WriteOptions, __ΩAPI, __ΩAPIContext, __ΩAnyUserConfig, __ΩBaseConfig, __ΩBuildInlineConfig, __ΩBuildPluginContext, __ΩBuilderVariant, __ΩCallHookOptions, __ΩCleanInlineConfig, __ΩCommandType, __ΩCommands, __ΩConfigEnv, __ΩContext, __ΩCreateLogOptions, __ΩDeepkitOptions, __ΩDeployInlineConfig, __ΩDocsInlineConfig, __ΩEmitEntryOptions, __ΩEmitOptions, __ΩEnvironmentConfig, __ΩEnvironmentContext, __ΩEnvironmentContextPlugin, __ΩEnvironmentResolvedConfig, __ΩFetchOptions, __ΩFileHeaderOptions, __ΩHookFields, __ΩHookListOrders, __ΩHooksList, __ΩInferHookFunction, __ΩInferHookParameters, __ΩInferHookReturnType, __ΩInferHookThisType, __ΩInferHooksListItem, __ΩInferUnpluginOptions, __ΩInferUnpluginVariant, __ΩInitContextOptions, __ΩInitialUserConfig, __ΩInlineConfig, __ΩLintInlineConfig, __ΩLogFn, __ΩLogLevel, __ΩMetaInfo, __ΩNewInlineConfig, __ΩOutputConfig, __ΩOutputResolvedConfig, __ΩParseOptions, __ΩParsedTypeScriptConfig, __ΩParsedUserConfig, __ΩPartialPlugin, __ΩPartialPluginFactory, __ΩPartiallyResolvedContext, __ΩPlugin, __ΩPluginConfig, __ΩPluginConfigObject, __ΩPluginConfigTuple, __ΩPluginContext, __ΩPluginFactory, __ΩPluginFields, __ΩPluginHook, __ΩPluginHookFields, __ΩPluginHookFunctions, __ΩPluginHookObject, __ΩPluginHooks, __ΩPluginHooksList, __ΩPluginHooksListItem, __ΩPluginNonHookFields, __ΩPowerlinesCommand, __ΩPrepareInlineConfig, __ΩProjectType, __ΩRawReflectionMode, __ΩReflectionLevel, __ΩReflectionMode, __ΩResolveConfig, __ΩResolveOptions, __ΩResolveResolvedConfig, __ΩResolvedAssetGlob, __ΩResolvedConfig, __ΩResolvedEntryTypeDefinition, __ΩResolver, __ΩSelectHookResult, __ΩSelectHookResultItem, __ΩSelectHooksOptions, __ΩSourceFile, __ΩStorageAdapter, __ΩStoragePort, __ΩStoragePreset, __ΩTSCompilerOptions, __ΩTSConfig, __ΩTransformResult, __ΩTypesResult, __ΩUnimportContext, __ΩUnpluginBuilderVariant, __ΩUnpluginFactory, __ΩUnpluginHookFunctions, __ΩUnpluginHookList, __ΩUnpluginHookVariant, __ΩUnpluginHookVariantField, __ΩUnpluginHooksListItem, __ΩUnpluginOptions, __ΩUnpluginUserConfig, __ΩUnresolvedContext, __ΩUserConfig, __ΩVirtualFile, __ΩVirtualFileData, __ΩVirtualFileExtension, __ΩVirtualFileMetadata, __ΩVirtualFileSystemInterface, __ΩWithUnpluginBuildContext, __ΩWorkerProcess, __ΩWorkspaceConfig, __ΩWriteData, __ΩWriteOptions, combineContexts, createLog, createUnplugin, createUnpluginModuleResolutionFunctions, createUnpluginResolver, defineConfig, extendLog, format, formatFolder, generateSourceMap, getBaseFileHeader, getFileHeader, getMagicString, getSourceFile, getString, getUniqueInputs, isResolvedEntryTypeDefinition, isTypeDefinition, isUnpluginBuilderVariant, loadUserConfigFile, loadWorkspaceConfig, resolveEntryOutput, resolveInput, resolveInputs, resolveInputsSync, writeFile };
23
+ export { API, APIContext, AnyUserConfig, BaseConfig, BuildInlineConfig, BuildPluginContext, BuilderVariant, CallHookOptions, CleanInlineConfig, CommandType, Commands, ConfigEnv, Context, CreateLogOptions, CreateUnpluginModuleResolutionFunctionsOptions, CreateUnpluginOptions, CreateUnpluginResolverOptions, DeepkitOptions, DeployInlineConfig, DocsInlineConfig, EmitEntryOptions, EmitOptions, EnvironmentConfig, EnvironmentContext, EnvironmentContextPlugin, EnvironmentResolvedConfig, FetchOptions, FileHeaderOptions, HookFields, HookListOrders, HooksList, InferHookFunction, InferHookParameters, InferHookReturnType, InferHookThisType, InferHooksListItem, InferUnpluginOptions, InferUnpluginVariant, InitContextOptions, InitialUserConfig, InlineConfig, LintInlineConfig, LogFn, LogLevel, MetaInfo, NewInlineConfig, OutputConfig, OutputResolvedConfig, ParseOptions, ParsedTypeScriptConfig, ParsedUserConfig, PartialPlugin, PartialPluginFactory, PartiallyResolvedContext, Plugin, PluginConfig, PluginConfigObject, PluginConfigTuple, PluginContext, PluginFactory, PluginFields, PluginHook, PluginHookFields, PluginHookFunctions, PluginHookObject, PluginHooks, PluginHooksList, PluginHooksListItem, PluginNonHookFields, PowerlinesCommand, PrepareInlineConfig, ProjectType, RawReflectionMode, ReflectionLevel, ReflectionMode, ResolveConfig, ResolveOptions, ResolveResolvedConfig, ResolvedAssetGlob, ResolvedConfig, ResolvedEntryTypeDefinition, Resolver, SelectHookResult, SelectHookResultItem, SelectHooksOptions, SourceFile, StorageAdapter, StoragePort, StoragePreset, TSCompilerOptions, TSConfig, TransformResult, TypesResult, UnimportContext, UnpluginBuilderVariant, UnpluginFactory, UnpluginHookFunctions, UnpluginHookList, UnpluginHookVariant, UnpluginHookVariantField, UnpluginHooksListItem, UnpluginOptions, UnpluginUserConfig, UnresolvedContext, UserConfig, VirtualFile, VirtualFileData, VirtualFileExtension, VirtualFileMetadata, VirtualFileSystemInterface, WithUnpluginBuildContext, WorkerProcess, WorkspaceConfig, WriteData, WriteOptions, __ΩAPI, __ΩAPIContext, __ΩAnyUserConfig, __ΩBaseConfig, __ΩBuildInlineConfig, __ΩBuildPluginContext, __ΩBuilderVariant, __ΩCallHookOptions, __ΩCleanInlineConfig, __ΩCommandType, __ΩCommands, __ΩConfigEnv, __ΩContext, __ΩCreateLogOptions, __ΩCreateUnpluginModuleResolutionFunctionsOptions, __ΩCreateUnpluginOptions, __ΩCreateUnpluginResolverOptions, __ΩDeepkitOptions, __ΩDeployInlineConfig, __ΩDocsInlineConfig, __ΩEmitEntryOptions, __ΩEmitOptions, __ΩEnvironmentConfig, __ΩEnvironmentContext, __ΩEnvironmentContextPlugin, __ΩEnvironmentResolvedConfig, __ΩFetchOptions, __ΩFileHeaderOptions, __ΩHookFields, __ΩHookListOrders, __ΩHooksList, __ΩInferHookFunction, __ΩInferHookParameters, __ΩInferHookReturnType, __ΩInferHookThisType, __ΩInferHooksListItem, __ΩInferUnpluginOptions, __ΩInferUnpluginVariant, __ΩInitContextOptions, __ΩInitialUserConfig, __ΩInlineConfig, __ΩLintInlineConfig, __ΩLogFn, __ΩLogLevel, __ΩMetaInfo, __ΩNewInlineConfig, __ΩOutputConfig, __ΩOutputResolvedConfig, __ΩParseOptions, __ΩParsedTypeScriptConfig, __ΩParsedUserConfig, __ΩPartialPlugin, __ΩPartialPluginFactory, __ΩPartiallyResolvedContext, __ΩPlugin, __ΩPluginConfig, __ΩPluginConfigObject, __ΩPluginConfigTuple, __ΩPluginContext, __ΩPluginFactory, __ΩPluginFields, __ΩPluginHook, __ΩPluginHookFields, __ΩPluginHookFunctions, __ΩPluginHookObject, __ΩPluginHooks, __ΩPluginHooksList, __ΩPluginHooksListItem, __ΩPluginNonHookFields, __ΩPowerlinesCommand, __ΩPrepareInlineConfig, __ΩProjectType, __ΩRawReflectionMode, __ΩReflectionLevel, __ΩReflectionMode, __ΩResolveConfig, __ΩResolveOptions, __ΩResolveResolvedConfig, __ΩResolvedAssetGlob, __ΩResolvedConfig, __ΩResolvedEntryTypeDefinition, __ΩResolver, __ΩSelectHookResult, __ΩSelectHookResultItem, __ΩSelectHooksOptions, __ΩSourceFile, __ΩStorageAdapter, __ΩStoragePort, __ΩStoragePreset, __ΩTSCompilerOptions, __ΩTSConfig, __ΩTransformResult, __ΩTypesResult, __ΩUnimportContext, __ΩUnpluginBuilderVariant, __ΩUnpluginFactory, __ΩUnpluginHookFunctions, __ΩUnpluginHookList, __ΩUnpluginHookVariant, __ΩUnpluginHookVariantField, __ΩUnpluginHooksListItem, __ΩUnpluginOptions, __ΩUnpluginUserConfig, __ΩUnresolvedContext, __ΩUserConfig, __ΩVirtualFile, __ΩVirtualFileData, __ΩVirtualFileExtension, __ΩVirtualFileMetadata, __ΩVirtualFileSystemInterface, __ΩWithUnpluginBuildContext, __ΩWorkerProcess, __ΩWorkspaceConfig, __ΩWriteData, __ΩWriteOptions, combineContexts, createLog, createUnplugin, createUnpluginModuleResolutionFunctions, createUnpluginResolver, defineConfig, extendLog, format, formatFolder, generateSourceMap, getBaseFileHeader, getFileHeader, getMagicString, getSourceFile, getString, getUniqueInputs, isResolvedEntryTypeDefinition, isTypeDefinition, isUnpluginBuilderVariant, loadUserConfigFile, loadWorkspaceConfig, resolveEntryOutput, resolveInput, resolveInputs, resolveInputsSync, writeFile };
@@ -2,11 +2,11 @@ import { PartiallyResolvedContext, __ΩPartiallyResolvedContext, defineConfig, l
2
2
  import { getUniqueInputs, isResolvedEntryTypeDefinition, isTypeDefinition, resolveEntryOutput, resolveInput, resolveInputs, resolveInputsSync } from "./entry.cjs";
3
3
  import { CreateLogOptions, __ΩCreateLogOptions, createLog, extendLog } from "./logger.cjs";
4
4
  import { combineContexts, isUnpluginBuilderVariant } from "./unplugin/helpers.cjs";
5
- import { createUnpluginModuleResolutionFunctions } from "./unplugin/module-resolution.cjs";
6
- import { createUnplugin, createUnpluginResolver } from "./unplugin/plugin.cjs";
5
+ import { CreateUnpluginModuleResolutionFunctionsOptions, __ΩCreateUnpluginModuleResolutionFunctionsOptions, createUnpluginModuleResolutionFunctions } from "./unplugin/module-resolution.cjs";
6
+ import { CreateUnpluginOptions, CreateUnpluginResolverOptions, __ΩCreateUnpluginOptions, __ΩCreateUnpluginResolverOptions, createUnplugin, createUnpluginResolver } from "./unplugin/plugin.cjs";
7
7
  import { FileHeaderOptions, __ΩFileHeaderOptions, getBaseFileHeader, getFileHeader } from "./utilities/file-header.cjs";
8
8
  import { format, formatFolder } from "./utilities/format.cjs";
9
9
  import { getMagicString, getSourceFile, getString } from "./utilities/source-file.cjs";
10
10
  import { generateSourceMap } from "./utilities/source-map.cjs";
11
11
  import { writeFile } from "./utilities/write-file.cjs";
12
- export { CreateLogOptions, FileHeaderOptions, PartiallyResolvedContext, __ΩCreateLogOptions, __ΩFileHeaderOptions, __ΩPartiallyResolvedContext, combineContexts, createLog, createUnplugin, createUnpluginModuleResolutionFunctions, createUnpluginResolver, defineConfig, extendLog, format, formatFolder, generateSourceMap, getBaseFileHeader, getFileHeader, getMagicString, getSourceFile, getString, getUniqueInputs, isResolvedEntryTypeDefinition, isTypeDefinition, isUnpluginBuilderVariant, loadUserConfigFile, loadWorkspaceConfig, resolveEntryOutput, resolveInput, resolveInputs, resolveInputsSync, writeFile };
12
+ export { CreateLogOptions, CreateUnpluginModuleResolutionFunctionsOptions, CreateUnpluginOptions, CreateUnpluginResolverOptions, FileHeaderOptions, PartiallyResolvedContext, __ΩCreateLogOptions, __ΩCreateUnpluginModuleResolutionFunctionsOptions, __ΩCreateUnpluginOptions, __ΩCreateUnpluginResolverOptions, __ΩFileHeaderOptions, __ΩPartiallyResolvedContext, combineContexts, createLog, createUnplugin, createUnpluginModuleResolutionFunctions, createUnpluginResolver, defineConfig, extendLog, format, formatFolder, generateSourceMap, getBaseFileHeader, getFileHeader, getMagicString, getSourceFile, getString, getUniqueInputs, isResolvedEntryTypeDefinition, isTypeDefinition, isUnpluginBuilderVariant, loadUserConfigFile, loadWorkspaceConfig, resolveEntryOutput, resolveInput, resolveInputs, resolveInputsSync, writeFile };
@@ -2,8 +2,8 @@ import { PartiallyResolvedContext, __ΩPartiallyResolvedContext, defineConfig, l
2
2
  import { getUniqueInputs, isResolvedEntryTypeDefinition, isTypeDefinition, resolveEntryOutput, resolveInput, resolveInputs, resolveInputsSync } from "./entry.mjs";
3
3
  import { CreateLogOptions, __ΩCreateLogOptions, createLog, extendLog } from "./logger.mjs";
4
4
  import { combineContexts, isUnpluginBuilderVariant } from "./unplugin/helpers.mjs";
5
- import { createUnpluginModuleResolutionFunctions } from "./unplugin/module-resolution.mjs";
6
- import { createUnplugin, createUnpluginResolver } from "./unplugin/plugin.mjs";
5
+ import { CreateUnpluginModuleResolutionFunctionsOptions, __ΩCreateUnpluginModuleResolutionFunctionsOptions, createUnpluginModuleResolutionFunctions } from "./unplugin/module-resolution.mjs";
6
+ import { CreateUnpluginOptions, CreateUnpluginResolverOptions, __ΩCreateUnpluginOptions, __ΩCreateUnpluginResolverOptions, createUnplugin, createUnpluginResolver } from "./unplugin/plugin.mjs";
7
7
  import "./unplugin/index.mjs";
8
8
  import { FileHeaderOptions, __ΩFileHeaderOptions, getBaseFileHeader, getFileHeader } from "./utilities/file-header.mjs";
9
9
  import { format, formatFolder } from "./utilities/format.mjs";
@@ -11,4 +11,4 @@ import { getMagicString, getSourceFile, getString } from "./utilities/source-fil
11
11
  import { generateSourceMap } from "./utilities/source-map.mjs";
12
12
  import { writeFile } from "./utilities/write-file.mjs";
13
13
  import "./utilities/index.mjs";
14
- export { CreateLogOptions, FileHeaderOptions, PartiallyResolvedContext, __ΩCreateLogOptions, __ΩFileHeaderOptions, __ΩPartiallyResolvedContext, combineContexts, createLog, createUnplugin, createUnpluginModuleResolutionFunctions, createUnpluginResolver, defineConfig, extendLog, format, formatFolder, generateSourceMap, getBaseFileHeader, getFileHeader, getMagicString, getSourceFile, getString, getUniqueInputs, isResolvedEntryTypeDefinition, isTypeDefinition, isUnpluginBuilderVariant, loadUserConfigFile, loadWorkspaceConfig, resolveEntryOutput, resolveInput, resolveInputs, resolveInputsSync, writeFile };
14
+ export { CreateLogOptions, CreateUnpluginModuleResolutionFunctionsOptions, CreateUnpluginOptions, CreateUnpluginResolverOptions, FileHeaderOptions, PartiallyResolvedContext, __ΩCreateLogOptions, __ΩCreateUnpluginModuleResolutionFunctionsOptions, __ΩCreateUnpluginOptions, __ΩCreateUnpluginResolverOptions, __ΩFileHeaderOptions, __ΩPartiallyResolvedContext, combineContexts, createLog, createUnplugin, createUnpluginModuleResolutionFunctions, createUnpluginResolver, defineConfig, extendLog, format, formatFolder, generateSourceMap, getBaseFileHeader, getFileHeader, getMagicString, getSourceFile, getString, getUniqueInputs, isResolvedEntryTypeDefinition, isTypeDefinition, isUnpluginBuilderVariant, loadUserConfigFile, loadWorkspaceConfig, resolveEntryOutput, resolveInput, resolveInputs, resolveInputsSync, writeFile };
@@ -1,4 +1,4 @@
1
1
  import { combineContexts, isUnpluginBuilderVariant } from "./helpers.cjs";
2
- import { createUnpluginModuleResolutionFunctions } from "./module-resolution.cjs";
3
- import { createUnplugin, createUnpluginResolver } from "./plugin.cjs";
4
- export { combineContexts, createUnplugin, createUnpluginModuleResolutionFunctions, createUnpluginResolver, isUnpluginBuilderVariant };
2
+ import { CreateUnpluginModuleResolutionFunctionsOptions, __ΩCreateUnpluginModuleResolutionFunctionsOptions, createUnpluginModuleResolutionFunctions } from "./module-resolution.cjs";
3
+ import { CreateUnpluginOptions, CreateUnpluginResolverOptions, __ΩCreateUnpluginOptions, __ΩCreateUnpluginResolverOptions, createUnplugin, createUnpluginResolver } from "./plugin.cjs";
4
+ export { CreateUnpluginModuleResolutionFunctionsOptions, CreateUnpluginOptions, CreateUnpluginResolverOptions, __ΩCreateUnpluginModuleResolutionFunctionsOptions, __ΩCreateUnpluginOptions, __ΩCreateUnpluginResolverOptions, combineContexts, createUnplugin, createUnpluginModuleResolutionFunctions, createUnpluginResolver, isUnpluginBuilderVariant };
@@ -1,4 +1,4 @@
1
1
  import { combineContexts, isUnpluginBuilderVariant } from "./helpers.mjs";
2
- import { createUnpluginModuleResolutionFunctions } from "./module-resolution.mjs";
3
- import { createUnplugin, createUnpluginResolver } from "./plugin.mjs";
4
- export { combineContexts, createUnplugin, createUnpluginModuleResolutionFunctions, createUnpluginResolver, isUnpluginBuilderVariant };
2
+ import { CreateUnpluginModuleResolutionFunctionsOptions, __ΩCreateUnpluginModuleResolutionFunctionsOptions, createUnpluginModuleResolutionFunctions } from "./module-resolution.mjs";
3
+ import { CreateUnpluginOptions, CreateUnpluginResolverOptions, __ΩCreateUnpluginOptions, __ΩCreateUnpluginResolverOptions, createUnplugin, createUnpluginResolver } from "./plugin.mjs";
4
+ export { CreateUnpluginModuleResolutionFunctionsOptions, CreateUnpluginOptions, CreateUnpluginResolverOptions, __ΩCreateUnpluginModuleResolutionFunctionsOptions, __ΩCreateUnpluginOptions, __ΩCreateUnpluginResolverOptions, combineContexts, createUnplugin, createUnpluginModuleResolutionFunctions, createUnpluginResolver, isUnpluginBuilderVariant };
@@ -1,3 +1,6 @@
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ let __stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
3
+ let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
1
4
 
2
5
  //#region src/lib/unplugin/module-resolution.ts
3
6
  /**
@@ -12,8 +15,10 @@
12
15
  * @param context - The plugin context.
13
16
  * @returns The module resolution hooks (`resolveId` and `load`).
14
17
  */
15
- function createUnpluginModuleResolutionFunctions(context) {
18
+ function createUnpluginModuleResolutionFunctions(context, options = {}) {
16
19
  const ctx = context;
20
+ let prefix = "";
21
+ if (options.prefix !== false) prefix = options.prefix ?? "\0";
17
22
  async function resolveId(id, importer, opts = { isEntry: false }) {
18
23
  let result = await ctx.$$internal.callHook("resolveId", {
19
24
  sequential: true,
@@ -29,11 +34,17 @@ function createUnpluginModuleResolutionFunctions(context) {
29
34
  if (result) return result;
30
35
  result = await ctx.resolve(id, importer, opts);
31
36
  if (result) return result;
32
- return ctx.$$internal.callHook("resolveId", {
37
+ result = await ctx.$$internal.callHook("resolveId", {
33
38
  sequential: true,
34
39
  result: "first",
35
40
  order: "post"
36
41
  }, id, importer, opts);
42
+ if ((0, __stryke_type_checks_is_set_string.isSetString)(result)) return `${prefix}${result}`;
43
+ else if ((0, __stryke_type_checks_is_set_object.isSetObject)(result)) return {
44
+ ...result,
45
+ id: `${prefix}${result.id}`
46
+ };
47
+ return null;
37
48
  }
38
49
  async function load(id) {
39
50
  let result = await ctx.$$internal.callHook("load", {
@@ -2,7 +2,17 @@ import { PluginContext } from "../../types/context.cjs";
2
2
  import { HookFnMap } from "unplugin";
3
3
 
4
4
  //#region src/lib/unplugin/module-resolution.d.ts
5
-
5
+ interface CreateUnpluginModuleResolutionFunctionsOptions {
6
+ /**
7
+ * A prefix to apply to all resolved module IDs. This can be used to create virtual modules by prefixing them with a specific string (e.g., `\0`).
8
+ *
9
+ * @remarks
10
+ * If set to `false`, no prefix will be applied, and resolved module IDs will be returned as-is. By default, this is set to `\0`, which is a common convention for virtual modules in Rollup and Vite plugins.
11
+ *
12
+ * @defaultValue "\\0"
13
+ */
14
+ prefix?: string | false;
15
+ }
6
16
  /**
7
17
  * Creates the module resolution hook functions for a Powerlines unplugin plugin instance.
8
18
  *
@@ -15,7 +25,8 @@ import { HookFnMap } from "unplugin";
15
25
  * @param context - The plugin context.
16
26
  * @returns The module resolution hooks (`resolveId` and `load`).
17
27
  */
18
- declare function createUnpluginModuleResolutionFunctions<TContext extends PluginContext = PluginContext>(context: TContext): Pick<HookFnMap, "resolveId" | "load">;
28
+ declare function createUnpluginModuleResolutionFunctions<TContext extends PluginContext = PluginContext>(context: TContext, options?: CreateUnpluginModuleResolutionFunctionsOptions): Pick<HookFnMap, "resolveId" | "load">;
29
+ declare type __ΩCreateUnpluginModuleResolutionFunctionsOptions = any[];
19
30
  //#endregion
20
- export { createUnpluginModuleResolutionFunctions };
31
+ export { CreateUnpluginModuleResolutionFunctionsOptions, __ΩCreateUnpluginModuleResolutionFunctionsOptions, createUnpluginModuleResolutionFunctions };
21
32
  //# sourceMappingURL=module-resolution.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"module-resolution.d.cts","names":[],"sources":["../../../src/lib/unplugin/module-resolution.ts"],"sourcesContent":[],"mappings":";;;;;;;AAwCA;;;;;;;;;;iBAAgB,yDACG,gBAAgB,wBACxB,WAAW,KAAK"}
1
+ {"version":3,"file":"module-resolution.d.cts","names":[],"sources":["../../../src/lib/unplugin/module-resolution.ts"],"sourcesContent":[],"mappings":";;;;UA8BiB,8CAAA;;AAAjB;AAwBA;;;;;;EAKG,MAAA,CAAA,EAAA,MAAA,GAAA,KAAA;;;;;;;;;;;;;;iBALa,yDACG,gBAAgB,wBAExB,oBACA,iDACR,KAAK"}
@@ -2,7 +2,17 @@ import { PluginContext } from "../../types/context.mjs";
2
2
  import { HookFnMap } from "unplugin";
3
3
 
4
4
  //#region src/lib/unplugin/module-resolution.d.ts
5
-
5
+ interface CreateUnpluginModuleResolutionFunctionsOptions {
6
+ /**
7
+ * A prefix to apply to all resolved module IDs. This can be used to create virtual modules by prefixing them with a specific string (e.g., `\0`).
8
+ *
9
+ * @remarks
10
+ * If set to `false`, no prefix will be applied, and resolved module IDs will be returned as-is. By default, this is set to `\0`, which is a common convention for virtual modules in Rollup and Vite plugins.
11
+ *
12
+ * @defaultValue "\\0"
13
+ */
14
+ prefix?: string | false;
15
+ }
6
16
  /**
7
17
  * Creates the module resolution hook functions for a Powerlines unplugin plugin instance.
8
18
  *
@@ -15,7 +25,8 @@ import { HookFnMap } from "unplugin";
15
25
  * @param context - The plugin context.
16
26
  * @returns The module resolution hooks (`resolveId` and `load`).
17
27
  */
18
- declare function createUnpluginModuleResolutionFunctions<TContext extends PluginContext = PluginContext>(context: TContext): Pick<HookFnMap, "resolveId" | "load">;
28
+ declare function createUnpluginModuleResolutionFunctions<TContext extends PluginContext = PluginContext>(context: TContext, options?: CreateUnpluginModuleResolutionFunctionsOptions): Pick<HookFnMap, "resolveId" | "load">;
29
+ declare type __ΩCreateUnpluginModuleResolutionFunctionsOptions = any[];
19
30
  //#endregion
20
- export { createUnpluginModuleResolutionFunctions };
31
+ export { CreateUnpluginModuleResolutionFunctionsOptions, __ΩCreateUnpluginModuleResolutionFunctionsOptions, createUnpluginModuleResolutionFunctions };
21
32
  //# sourceMappingURL=module-resolution.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"module-resolution.d.mts","names":[],"sources":["../../../src/lib/unplugin/module-resolution.ts"],"sourcesContent":[],"mappings":";;;;;;;AAwCA;;;;;;;;;;iBAAgB,yDACG,gBAAgB,wBACxB,WAAW,KAAK"}
1
+ {"version":3,"file":"module-resolution.d.mts","names":[],"sources":["../../../src/lib/unplugin/module-resolution.ts"],"sourcesContent":[],"mappings":";;;;UA8BiB,8CAAA;;AAAjB;AAwBA;;;;;;EAKG,MAAA,CAAA,EAAA,MAAA,GAAA,KAAA;;;;;;;;;;;;;;iBALa,yDACG,gBAAgB,wBAExB,oBACA,iDACR,KAAK"}
@@ -1,3 +1,6 @@
1
+ import { isSetObject } from "@stryke/type-checks/is-set-object";
2
+ import { isSetString } from "@stryke/type-checks/is-set-string";
3
+
1
4
  //#region src/lib/unplugin/module-resolution.ts
2
5
  /**
3
6
  * Creates the module resolution hook functions for a Powerlines unplugin plugin instance.
@@ -11,8 +14,10 @@
11
14
  * @param context - The plugin context.
12
15
  * @returns The module resolution hooks (`resolveId` and `load`).
13
16
  */
14
- function createUnpluginModuleResolutionFunctions(context) {
17
+ function createUnpluginModuleResolutionFunctions(context, options = {}) {
15
18
  const ctx = context;
19
+ let prefix = "";
20
+ if (options.prefix !== false) prefix = options.prefix ?? "\0";
16
21
  async function resolveId(id, importer, opts = { isEntry: false }) {
17
22
  let result = await ctx.$$internal.callHook("resolveId", {
18
23
  sequential: true,
@@ -28,11 +33,17 @@ function createUnpluginModuleResolutionFunctions(context) {
28
33
  if (result) return result;
29
34
  result = await ctx.resolve(id, importer, opts);
30
35
  if (result) return result;
31
- return ctx.$$internal.callHook("resolveId", {
36
+ result = await ctx.$$internal.callHook("resolveId", {
32
37
  sequential: true,
33
38
  result: "first",
34
39
  order: "post"
35
40
  }, id, importer, opts);
41
+ if (isSetString(result)) return `${prefix}${result}`;
42
+ else if (isSetObject(result)) return {
43
+ ...result,
44
+ id: `${prefix}${result.id}`
45
+ };
46
+ return null;
36
47
  }
37
48
  async function load(id) {
38
49
  let result = await ctx.$$internal.callHook("load", {
@@ -1 +1 @@
1
- {"version":3,"file":"module-resolution.mjs","names":[],"sources":["../../../src/lib/unplugin/module-resolution.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 { LoadResult } from \"rollup\";\nimport type {\n ExternalIdResult,\n HookFnMap,\n UnpluginBuildContext,\n UnpluginContext\n} from \"unplugin\";\nimport { UNSAFE_PluginContext } from \"../../types/_internal\";\nimport { PluginContext } from \"../../types/context\";\n\n/**\n * Creates the module resolution hook functions for a Powerlines unplugin plugin instance.\n *\n * @remarks\n * This includes the `resolveId` and `load` hooks.\n *\n * @see https://rollupjs.org/plugin-development/#resolveid\n * @see https://rollupjs.org/plugin-development/#load\n *\n * @param context - The plugin context.\n * @returns The module resolution hooks (`resolveId` and `load`).\n */\nexport function createUnpluginModuleResolutionFunctions<\n TContext extends PluginContext = PluginContext\n>(context: TContext): Pick<HookFnMap, \"resolveId\" | \"load\"> {\n const ctx = context as unknown as UNSAFE_PluginContext;\n\n async function resolveId(\n this: UnpluginBuildContext & UnpluginContext,\n id: string,\n importer?: string,\n opts: {\n isEntry: boolean;\n } = { isEntry: false }\n ): Promise<string | ExternalIdResult | null | undefined> {\n let result = await ctx.$$internal.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"pre\"\n },\n id,\n importer,\n opts\n );\n if (result) {\n return result;\n }\n\n result = await ctx.$$internal.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"normal\"\n },\n id,\n importer,\n opts\n );\n if (result) {\n return result;\n }\n\n result = await ctx.resolve(id, importer, opts);\n if (result) {\n return result;\n }\n\n return ctx.$$internal.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"post\"\n },\n id,\n importer,\n opts\n );\n }\n\n async function load(\n this: UnpluginBuildContext & UnpluginContext,\n id: string\n ): Promise<LoadResult | null | undefined> {\n let result = await ctx.$$internal.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"pre\"\n },\n id\n );\n if (result) {\n return result;\n }\n\n result = await ctx.$$internal.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"normal\"\n },\n id\n );\n if (result) {\n return result;\n }\n\n result = await ctx.load(id);\n if (result) {\n return result;\n }\n\n return ctx.$$internal.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"post\"\n },\n id\n );\n }\n\n return {\n resolveId,\n load\n };\n}\n"],"mappings":";;;;;;;;;;;;;AAwCA,SAAgB,wCAEd,SAA0D;CAC1D,MAAM,MAAM;CAEZ,eAAe,UAEb,IACA,UACA,OAEI,EAAE,SAAS,OAAO,EACiC;EACvD,IAAI,SAAS,MAAM,IAAI,WAAW,SAChC,aACA;GACE,YAAY;GACZ,QAAQ;GACR,OAAO;GACR,EACD,IACA,UACA,KACD;AACD,MAAI,OACF,QAAO;AAGT,WAAS,MAAM,IAAI,WAAW,SAC5B,aACA;GACE,YAAY;GACZ,QAAQ;GACR,OAAO;GACR,EACD,IACA,UACA,KACD;AACD,MAAI,OACF,QAAO;AAGT,WAAS,MAAM,IAAI,QAAQ,IAAI,UAAU,KAAK;AAC9C,MAAI,OACF,QAAO;AAGT,SAAO,IAAI,WAAW,SACpB,aACA;GACE,YAAY;GACZ,QAAQ;GACR,OAAO;GACR,EACD,IACA,UACA,KACD;;CAGH,eAAe,KAEb,IACwC;EACxC,IAAI,SAAS,MAAM,IAAI,WAAW,SAChC,QACA;GACE,YAAY;GACZ,QAAQ;GACR,OAAO;GACR,EACD,GACD;AACD,MAAI,OACF,QAAO;AAGT,WAAS,MAAM,IAAI,WAAW,SAC5B,QACA;GACE,YAAY;GACZ,QAAQ;GACR,OAAO;GACR,EACD,GACD;AACD,MAAI,OACF,QAAO;AAGT,WAAS,MAAM,IAAI,KAAK,GAAG;AAC3B,MAAI,OACF,QAAO;AAGT,SAAO,IAAI,WAAW,SACpB,QACA;GACE,YAAY;GACZ,QAAQ;GACR,OAAO;GACR,EACD,GACD;;AAGH,QAAO;EACL;EACA;EACD"}
1
+ {"version":3,"file":"module-resolution.mjs","names":[],"sources":["../../../src/lib/unplugin/module-resolution.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 { LoadResult } from \"rollup\";\nimport type {\n ExternalIdResult,\n HookFnMap,\n UnpluginBuildContext,\n UnpluginContext\n} from \"unplugin\";\nimport { UNSAFE_PluginContext } from \"../../types/_internal\";\nimport { PluginContext } from \"../../types/context\";\n\nexport interface CreateUnpluginModuleResolutionFunctionsOptions {\n /**\n * A prefix to apply to all resolved module IDs. This can be used to create virtual modules by prefixing them with a specific string (e.g., `\\0`).\n *\n * @remarks\n * If set to `false`, no prefix will be applied, and resolved module IDs will be returned as-is. By default, this is set to `\\0`, which is a common convention for virtual modules in Rollup and Vite plugins.\n *\n * @defaultValue \"\\\\0\"\n */\n prefix?: string | false;\n}\n\n/**\n * Creates the module resolution hook functions for a Powerlines unplugin plugin instance.\n *\n * @remarks\n * This includes the `resolveId` and `load` hooks.\n *\n * @see https://rollupjs.org/plugin-development/#resolveid\n * @see https://rollupjs.org/plugin-development/#load\n *\n * @param context - The plugin context.\n * @returns The module resolution hooks (`resolveId` and `load`).\n */\nexport function createUnpluginModuleResolutionFunctions<\n TContext extends PluginContext = PluginContext\n>(\n context: TContext,\n options: CreateUnpluginModuleResolutionFunctionsOptions = {}\n): Pick<HookFnMap, \"resolveId\" | \"load\"> {\n const ctx = context as unknown as UNSAFE_PluginContext;\n\n let prefix = \"\";\n if (options.prefix !== false) {\n prefix = options.prefix ?? \"\\0\";\n }\n\n async function resolveId(\n this: UnpluginBuildContext & UnpluginContext,\n id: string,\n importer?: string,\n opts: {\n isEntry: boolean;\n } = { isEntry: false }\n ): Promise<string | ExternalIdResult | null | undefined> {\n let result = await ctx.$$internal.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"pre\"\n },\n id,\n importer,\n opts\n );\n if (result) {\n return result;\n }\n\n result = await ctx.$$internal.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"normal\"\n },\n id,\n importer,\n opts\n );\n if (result) {\n return result;\n }\n\n result = await ctx.resolve(id, importer, opts);\n if (result) {\n return result;\n }\n\n result = await ctx.$$internal.callHook(\n \"resolveId\",\n {\n sequential: true,\n result: \"first\",\n order: \"post\"\n },\n id,\n importer,\n opts\n );\n if (isSetString(result)) {\n return `${prefix}${result}`;\n } else if (isSetObject(result)) {\n return {\n ...result,\n id: `${prefix}${result.id}`\n };\n }\n\n return null;\n }\n\n async function load(\n this: UnpluginBuildContext & UnpluginContext,\n id: string\n ): Promise<LoadResult | null | undefined> {\n let result = await ctx.$$internal.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"pre\"\n },\n id\n );\n if (result) {\n return result;\n }\n\n result = await ctx.$$internal.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"normal\"\n },\n id\n );\n if (result) {\n return result;\n }\n\n result = await ctx.load(id);\n if (result) {\n return result;\n }\n\n return ctx.$$internal.callHook(\n \"load\",\n {\n sequential: true,\n result: \"first\",\n order: \"post\"\n },\n id\n );\n }\n\n return {\n resolveId,\n load\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAsDA,SAAgB,wCAGd,SACA,UAA0D,EAAE,EACrB;CACvC,MAAM,MAAM;CAEZ,IAAI,SAAS;AACb,KAAI,QAAQ,WAAW,MACrB,UAAS,QAAQ,UAAU;CAG7B,eAAe,UAEb,IACA,UACA,OAEI,EAAE,SAAS,OAAO,EACiC;EACvD,IAAI,SAAS,MAAM,IAAI,WAAW,SAChC,aACA;GACE,YAAY;GACZ,QAAQ;GACR,OAAO;GACR,EACD,IACA,UACA,KACD;AACD,MAAI,OACF,QAAO;AAGT,WAAS,MAAM,IAAI,WAAW,SAC5B,aACA;GACE,YAAY;GACZ,QAAQ;GACR,OAAO;GACR,EACD,IACA,UACA,KACD;AACD,MAAI,OACF,QAAO;AAGT,WAAS,MAAM,IAAI,QAAQ,IAAI,UAAU,KAAK;AAC9C,MAAI,OACF,QAAO;AAGT,WAAS,MAAM,IAAI,WAAW,SAC5B,aACA;GACE,YAAY;GACZ,QAAQ;GACR,OAAO;GACR,EACD,IACA,UACA,KACD;AACD,MAAI,YAAY,OAAO,CACrB,QAAO,GAAG,SAAS;WACV,YAAY,OAAO,CAC5B,QAAO;GACL,GAAG;GACH,IAAI,GAAG,SAAS,OAAO;GACxB;AAGH,SAAO;;CAGT,eAAe,KAEb,IACwC;EACxC,IAAI,SAAS,MAAM,IAAI,WAAW,SAChC,QACA;GACE,YAAY;GACZ,QAAQ;GACR,OAAO;GACR,EACD,GACD;AACD,MAAI,OACF,QAAO;AAGT,WAAS,MAAM,IAAI,WAAW,SAC5B,QACA;GACE,YAAY;GACZ,QAAQ;GACR,OAAO;GACR,EACD,GACD;AACD,MAAI,OACF,QAAO;AAGT,WAAS,MAAM,IAAI,KAAK,GAAG;AAC3B,MAAI,OACF,QAAO;AAGT,SAAO,IAAI,WAAW,SACpB,QACA;GACE,YAAY;GACZ,QAAQ;GACR,OAAO;GACR,EACD,GACD;;AAGH,QAAO;EACL;EACA;EACD"}
@@ -15,14 +15,15 @@ let unplugin = require("unplugin");
15
15
  * @param context - The plugin context.
16
16
  * @returns The unplugin instance.
17
17
  */
18
- function createUnpluginResolver(context, name = "unplugin") {
18
+ function createUnpluginResolver(context, options = {}) {
19
19
  const ctx = context;
20
20
  (0, unplugin.setParseImpl)(ctx.parse);
21
+ const name = options.name || "unplugin";
21
22
  return () => {
22
23
  const log = require_lib_logger.extendLog(ctx.log, name);
23
24
  log(__storm_software_config_tools_types.LogLevelLabel.DEBUG, `Initializing ${name.toLowerCase() === "unplugin" ? "Unplugin" : `${(0, __stryke_string_format_title_case.titleCase)(name)} - Unplugin`} plugin`);
24
25
  try {
25
- const { resolveId, load } = require_lib_unplugin_module_resolution.createUnpluginModuleResolutionFunctions(context);
26
+ const { resolveId, load } = require_lib_unplugin_module_resolution.createUnpluginModuleResolutionFunctions(context, options);
26
27
  return {
27
28
  name: name.toLowerCase() === "unplugin" ? "powerlines" : `powerlines:${(0, __stryke_string_format_kebab_case.kebabCase)(name)}`,
28
29
  api: ctx.$$internal.api,
@@ -47,14 +48,15 @@ function createUnpluginResolver(context, name = "unplugin") {
47
48
  * @param context - The plugin context.
48
49
  * @returns The unplugin instance.
49
50
  */
50
- function createUnplugin(context, name = "unplugin") {
51
+ function createUnplugin(context, options = {}) {
51
52
  const ctx = context;
52
53
  (0, unplugin.setParseImpl)(ctx.parse);
54
+ const name = options.name || "unplugin";
53
55
  return () => {
54
56
  const log = require_lib_logger.extendLog(ctx.log, name);
55
57
  log(__storm_software_config_tools_types.LogLevelLabel.DEBUG, `Initializing ${name.toLowerCase() === "unplugin" ? "Unplugin" : `${(0, __stryke_string_format_title_case.titleCase)(name)} - Unplugin`} plugin`);
56
58
  try {
57
- const { resolveId, load } = require_lib_unplugin_module_resolution.createUnpluginModuleResolutionFunctions(context);
59
+ const { resolveId, load } = require_lib_unplugin_module_resolution.createUnpluginModuleResolutionFunctions(context, options);
58
60
  async function buildStart() {
59
61
  log(__storm_software_config_tools_types.LogLevelLabel.DEBUG, "Powerlines build plugin starting...");
60
62
  await ctx.$$internal.callHook("buildStart", { sequential: true });
@@ -1,22 +1,36 @@
1
1
  import { UnpluginFactory } from "../../types/unplugin.cjs";
2
2
  import { PluginContext } from "../../types/context.cjs";
3
+ import { CreateUnpluginModuleResolutionFunctionsOptions } from "./module-resolution.cjs";
3
4
 
4
5
  //#region src/lib/unplugin/plugin.d.ts
5
-
6
+ interface CreateUnpluginResolverOptions extends CreateUnpluginModuleResolutionFunctionsOptions {
7
+ /**
8
+ * 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.
9
+ *
10
+ * @remarks
11
+ * If not provided, the plugin will be named "unplugin". If provided, the plugin will be named `${name} - Unplugin` (e.g., "MyPlugin - Unplugin").
12
+ *
13
+ * @defaultValue "unplugin"
14
+ */
15
+ name?: string;
16
+ }
6
17
  /**
7
18
  * Creates a Powerlines unplugin instance.
8
19
  *
9
20
  * @param context - The plugin context.
10
21
  * @returns The unplugin instance.
11
22
  */
12
- declare function createUnpluginResolver<TContext extends PluginContext = PluginContext>(context: TContext, name?: string): UnpluginFactory<TContext>;
23
+ declare function createUnpluginResolver<TContext extends PluginContext = PluginContext>(context: TContext, options?: CreateUnpluginResolverOptions): UnpluginFactory<TContext>;
24
+ interface CreateUnpluginOptions extends CreateUnpluginResolverOptions {}
13
25
  /**
14
26
  * Creates a Powerlines unplugin instance.
15
27
  *
16
28
  * @param context - The plugin context.
17
29
  * @returns The unplugin instance.
18
30
  */
19
- declare function createUnplugin<TContext extends PluginContext = PluginContext>(context: TContext, name?: string): UnpluginFactory<TContext>;
31
+ declare function createUnplugin<TContext extends PluginContext = PluginContext>(context: TContext, options?: CreateUnpluginOptions): UnpluginFactory<TContext>;
32
+ declare type __ΩCreateUnpluginResolverOptions = any[];
33
+ declare type __ΩCreateUnpluginOptions = any[];
20
34
  //#endregion
21
- export { createUnplugin, createUnpluginResolver };
35
+ export { CreateUnpluginOptions, CreateUnpluginResolverOptions, __ΩCreateUnpluginOptions, __ΩCreateUnpluginResolverOptions, createUnplugin, createUnpluginResolver };
22
36
  //# sourceMappingURL=plugin.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.cts","names":[],"sources":["../../../src/lib/unplugin/plugin.ts"],"sourcesContent":[],"mappings":";;;;;;;AAyCA;;;;AAEyD,iBAFzC,sBAEyC,CAAA,iBADtC,aACsC,GADtB,aACsB,CAAA,CAAA,OAAA,EAA9C,QAA8C,EAAA,IAAA,CAAA,EAAA,MAAA,CAAA,EAAhB,eAAgB,CAAA,QAAA,CAAA;;;AAwDzD;;;;AAGmB,iBAHH,cAGG,CAAA,iBAH6B,aAG7B,GAH6C,aAG7C,CAAA,CAAA,OAAA,EAFR,QAEQ,EAAA,IAAA,CAAA,EAAA,MAAA,CAAA,EAAhB,eAAgB,CAAA,QAAA,CAAA"}
1
+ {"version":3,"file":"plugin.d.cts","names":[],"sources":["../../../src/lib/unplugin/plugin.ts"],"sourcesContent":[],"mappings":";;;;;UAsCiB,6BAAA,SAAsC;;AAAvD;AAkBA;;;;;;EAKG,IAAA,CAAA,EAAA,MAAA;;AAoDH;AAQA;;;;;AAGmB,iBApEH,sBAoEG,CAAA,iBAnEA,aAmEA,GAnEgB,aAmEhB,CAAA,CAAA,OAAA,EAjER,QAiEQ,EAAA,OAAA,CAAA,EAhER,6BAgEQ,CAAA,EA/DhB,eA+DgB,CA/DA,QA+DA,CAAA;AAAhB,UAXc,qBAAA,SAA8B,6BAW5C,CAAA;;;;;;;iBAHa,gCAAgC,gBAAgB,wBACrD,oBACA,wBACR,gBAAgB"}
@@ -1,22 +1,36 @@
1
1
  import { UnpluginFactory } from "../../types/unplugin.mjs";
2
2
  import { PluginContext } from "../../types/context.mjs";
3
+ import { CreateUnpluginModuleResolutionFunctionsOptions } from "./module-resolution.mjs";
3
4
 
4
5
  //#region src/lib/unplugin/plugin.d.ts
5
-
6
+ interface CreateUnpluginResolverOptions extends CreateUnpluginModuleResolutionFunctionsOptions {
7
+ /**
8
+ * 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.
9
+ *
10
+ * @remarks
11
+ * If not provided, the plugin will be named "unplugin". If provided, the plugin will be named `${name} - Unplugin` (e.g., "MyPlugin - Unplugin").
12
+ *
13
+ * @defaultValue "unplugin"
14
+ */
15
+ name?: string;
16
+ }
6
17
  /**
7
18
  * Creates a Powerlines unplugin instance.
8
19
  *
9
20
  * @param context - The plugin context.
10
21
  * @returns The unplugin instance.
11
22
  */
12
- declare function createUnpluginResolver<TContext extends PluginContext = PluginContext>(context: TContext, name?: string): UnpluginFactory<TContext>;
23
+ declare function createUnpluginResolver<TContext extends PluginContext = PluginContext>(context: TContext, options?: CreateUnpluginResolverOptions): UnpluginFactory<TContext>;
24
+ interface CreateUnpluginOptions extends CreateUnpluginResolverOptions {}
13
25
  /**
14
26
  * Creates a Powerlines unplugin instance.
15
27
  *
16
28
  * @param context - The plugin context.
17
29
  * @returns The unplugin instance.
18
30
  */
19
- declare function createUnplugin<TContext extends PluginContext = PluginContext>(context: TContext, name?: string): UnpluginFactory<TContext>;
31
+ declare function createUnplugin<TContext extends PluginContext = PluginContext>(context: TContext, options?: CreateUnpluginOptions): UnpluginFactory<TContext>;
32
+ declare type __ΩCreateUnpluginResolverOptions = any[];
33
+ declare type __ΩCreateUnpluginOptions = any[];
20
34
  //#endregion
21
- export { createUnplugin, createUnpluginResolver };
35
+ export { CreateUnpluginOptions, CreateUnpluginResolverOptions, __ΩCreateUnpluginOptions, __ΩCreateUnpluginResolverOptions, createUnplugin, createUnpluginResolver };
22
36
  //# sourceMappingURL=plugin.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../../src/lib/unplugin/plugin.ts"],"sourcesContent":[],"mappings":";;;;;;;AAyCA;;;;AAEyD,iBAFzC,sBAEyC,CAAA,iBADtC,aACsC,GADtB,aACsB,CAAA,CAAA,OAAA,EAA9C,QAA8C,EAAA,IAAA,CAAA,EAAA,MAAA,CAAA,EAAhB,eAAgB,CAAA,QAAA,CAAA;;;AAwDzD;;;;AAGmB,iBAHH,cAGG,CAAA,iBAH6B,aAG7B,GAH6C,aAG7C,CAAA,CAAA,OAAA,EAFR,QAEQ,EAAA,IAAA,CAAA,EAAA,MAAA,CAAA,EAAhB,eAAgB,CAAA,QAAA,CAAA"}
1
+ {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../../src/lib/unplugin/plugin.ts"],"sourcesContent":[],"mappings":";;;;;UAsCiB,6BAAA,SAAsC;;AAAvD;AAkBA;;;;;;EAKG,IAAA,CAAA,EAAA,MAAA;;AAoDH;AAQA;;;;;AAGmB,iBApEH,sBAoEG,CAAA,iBAnEA,aAmEA,GAnEgB,aAmEhB,CAAA,CAAA,OAAA,EAjER,QAiEQ,EAAA,OAAA,CAAA,EAhER,6BAgEQ,CAAA,EA/DhB,eA+DgB,CA/DA,QA+DA,CAAA;AAAhB,UAXc,qBAAA,SAA8B,6BAW5C,CAAA;;;;;;;iBAHa,gCAAgC,gBAAgB,wBACrD,oBACA,wBACR,gBAAgB"}
@@ -14,14 +14,15 @@ import { setParseImpl } from "unplugin";
14
14
  * @param context - The plugin context.
15
15
  * @returns The unplugin instance.
16
16
  */
17
- function createUnpluginResolver(context, name = "unplugin") {
17
+ function createUnpluginResolver(context, options = {}) {
18
18
  const ctx = context;
19
19
  setParseImpl(ctx.parse);
20
+ const name = options.name || "unplugin";
20
21
  return () => {
21
22
  const log = extendLog(ctx.log, name);
22
23
  log(LogLevelLabel.DEBUG, `Initializing ${name.toLowerCase() === "unplugin" ? "Unplugin" : `${titleCase(name)} - Unplugin`} plugin`);
23
24
  try {
24
- const { resolveId, load } = createUnpluginModuleResolutionFunctions(context);
25
+ const { resolveId, load } = createUnpluginModuleResolutionFunctions(context, options);
25
26
  return {
26
27
  name: name.toLowerCase() === "unplugin" ? "powerlines" : `powerlines:${kebabCase(name)}`,
27
28
  api: ctx.$$internal.api,
@@ -46,14 +47,15 @@ function createUnpluginResolver(context, name = "unplugin") {
46
47
  * @param context - The plugin context.
47
48
  * @returns The unplugin instance.
48
49
  */
49
- function createUnplugin(context, name = "unplugin") {
50
+ function createUnplugin(context, options = {}) {
50
51
  const ctx = context;
51
52
  setParseImpl(ctx.parse);
53
+ const name = options.name || "unplugin";
52
54
  return () => {
53
55
  const log = extendLog(ctx.log, name);
54
56
  log(LogLevelLabel.DEBUG, `Initializing ${name.toLowerCase() === "unplugin" ? "Unplugin" : `${titleCase(name)} - Unplugin`} plugin`);
55
57
  try {
56
- const { resolveId, load } = createUnpluginModuleResolutionFunctions(context);
58
+ const { resolveId, load } = createUnpluginModuleResolutionFunctions(context, options);
57
59
  async function buildStart() {
58
60
  log(LogLevelLabel.DEBUG, "Powerlines build plugin starting...");
59
61
  await ctx.$$internal.callHook("buildStart", { sequential: true });
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.mjs","names":["transformed: TransformResult | string","result: TransformResult | string | undefined"],"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 { LogLevelLabel } from \"@storm-software/config-tools/types\";\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 { UNSAFE_PluginContext } from \"../../types/_internal\";\nimport { PluginContext } from \"../../types/context\";\nimport { UnpluginFactory } from \"../../types/unplugin\";\nimport { extendLog } from \"../logger\";\nimport { getString } from \"../utilities/source-file\";\nimport { combineContexts } from \"./helpers\";\nimport { createUnpluginModuleResolutionFunctions } from \"./module-resolution\";\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>(context: TContext, name = \"unplugin\"): UnpluginFactory<TContext> {\n const ctx = context as unknown as UNSAFE_PluginContext;\n setParseImpl(ctx.parse);\n\n return () => {\n const log = extendLog(ctx.log, name);\n log(\n LogLevelLabel.DEBUG,\n `Initializing ${\n name.toLowerCase() === \"unplugin\"\n ? \"Unplugin\"\n : `${titleCase(name)} - Unplugin`\n } plugin`\n );\n\n try {\n const { resolveId, load } =\n createUnpluginModuleResolutionFunctions<TContext>(context);\n\n return {\n name:\n name.toLowerCase() === \"unplugin\"\n ? \"powerlines\"\n : `powerlines:${kebabCase(name)}`,\n api: ctx.$$internal.api,\n resolveId: {\n filter: {\n id: {\n include: [/.*/]\n }\n },\n handler: resolveId\n },\n load: {\n filter: {\n id: {\n include: [/.*/]\n }\n },\n handler: load\n }\n };\n } catch (error) {\n log(LogLevelLabel.FATAL, (error as Error)?.message);\n\n throw error;\n }\n };\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 name = \"unplugin\"\n): UnpluginFactory<TContext> {\n const ctx = context as unknown as UNSAFE_PluginContext;\n setParseImpl(ctx.parse);\n\n return () => {\n const log = extendLog(ctx.log, name);\n log(\n LogLevelLabel.DEBUG,\n `Initializing ${\n name.toLowerCase() === \"unplugin\"\n ? \"Unplugin\"\n : `${titleCase(name)} - Unplugin`\n } plugin`\n );\n\n try {\n const { resolveId, load } =\n createUnpluginModuleResolutionFunctions<TContext>(context);\n\n async function buildStart(this: UnpluginBuildContext) {\n log(LogLevelLabel.DEBUG, \"Powerlines build plugin starting...\");\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\n ]);\n if (result) {\n transformed = result;\n }\n }\n\n return transformed;\n }\n\n async function buildEnd(this: UnpluginBuildContext): Promise<void> {\n log(LogLevelLabel.DEBUG, \"Powerlines build plugin finishing...\");\n\n return ctx.$$internal.callHook(\"buildEnd\", {\n sequential: true\n });\n }\n\n async function writeBundle(): Promise<void> {\n log(LogLevelLabel.DEBUG, \"Finalizing Powerlines project output...\");\n\n return ctx.$$internal.callHook(\"writeBundle\", {\n sequential: true\n });\n }\n\n return {\n name:\n name.toLowerCase() === \"unplugin\"\n ? \"powerlines\"\n : `powerlines:${kebabCase(name)}`,\n api: ctx.$$internal.api,\n resolveId: {\n filter: {\n id: {\n include: [/.*/]\n }\n },\n handler: resolveId\n },\n load: {\n filter: {\n id: {\n include: [/.*/]\n }\n },\n handler: load\n },\n transform,\n buildStart,\n buildEnd,\n writeBundle,\n vite: {\n sharedDuringBuild: true\n }\n };\n } catch (error) {\n log(LogLevelLabel.FATAL, (error as Error)?.message);\n\n throw error;\n }\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAyCA,SAAgB,uBAEd,SAAmB,OAAO,YAAuC;CACjE,MAAM,MAAM;AACZ,cAAa,IAAI,MAAM;AAEvB,cAAa;EACX,MAAM,MAAM,UAAU,IAAI,KAAK,KAAK;AACpC,MACE,cAAc,OACd,gBACE,KAAK,aAAa,KAAK,aACnB,aACA,GAAG,UAAU,KAAK,CAAC,aACxB,SACF;AAED,MAAI;GACF,MAAM,EAAE,WAAW,SACjB,wCAAkD,QAAQ;AAE5D,UAAO;IACL,MACE,KAAK,aAAa,KAAK,aACnB,eACA,cAAc,UAAU,KAAK;IACnC,KAAK,IAAI,WAAW;IACpB,WAAW;KACT,QAAQ,EACN,IAAI,EACF,SAAS,CAAC,KAAK,EAChB,EACF;KACD,SAAS;KACV;IACD,MAAM;KACJ,QAAQ,EACN,IAAI,EACF,SAAS,CAAC,KAAK,EAChB,EACF;KACD,SAAS;KACV;IACF;WACM,OAAO;AACd,OAAI,cAAc,OAAQ,OAAiB,QAAQ;AAEnD,SAAM;;;;;;;;;;AAWZ,SAAgB,eACd,SACA,OAAO,YACoB;CAC3B,MAAM,MAAM;AACZ,cAAa,IAAI,MAAM;AAEvB,cAAa;EACX,MAAM,MAAM,UAAU,IAAI,KAAK,KAAK;AACpC,MACE,cAAc,OACd,gBACE,KAAK,aAAa,KAAK,aACnB,aACA,GAAG,UAAU,KAAK,CAAC,aACxB,SACF;AAED,MAAI;GACF,MAAM,EAAE,WAAW,SACjB,wCAAkD,QAAQ;GAE5D,eAAe,aAAuC;AACpD,QAAI,cAAc,OAAO,sCAAsC;AAE/D,UAAM,IAAI,WAAW,SAAS,cAAc,EAC1C,YAAY,MACb,CAAC;;GAGJ,eAAe,UAEb,MACA,IAC6C;IAC7C,IAAIA,cAAwC;AAE5C,SAAK,MAAM,QAAQ,IAAI,WAAW,YAAY,YAC5C,YACD,EAAE;KACD,MAAMC,SACJ,MAAM,KAAK,QAAQ,MAAM,gBAAgB,KAAK,KAAK,EAAE,CACnD,UAAU,YAAY,EACtB,GACD,CAAC;AACJ,SAAI,OACF,eAAc;;AAIlB,WAAO;;GAGT,eAAe,WAAoD;AACjE,QAAI,cAAc,OAAO,uCAAuC;AAEhE,WAAO,IAAI,WAAW,SAAS,YAAY,EACzC,YAAY,MACb,CAAC;;GAGJ,eAAe,cAA6B;AAC1C,QAAI,cAAc,OAAO,0CAA0C;AAEnE,WAAO,IAAI,WAAW,SAAS,eAAe,EAC5C,YAAY,MACb,CAAC;;AAGJ,UAAO;IACL,MACE,KAAK,aAAa,KAAK,aACnB,eACA,cAAc,UAAU,KAAK;IACnC,KAAK,IAAI,WAAW;IACpB,WAAW;KACT,QAAQ,EACN,IAAI,EACF,SAAS,CAAC,KAAK,EAChB,EACF;KACD,SAAS;KACV;IACD,MAAM;KACJ,QAAQ,EACN,IAAI,EACF,SAAS,CAAC,KAAK,EAChB,EACF;KACD,SAAS;KACV;IACD;IACA;IACA;IACA;IACA,MAAM,EACJ,mBAAmB,MACpB;IACF;WACM,OAAO;AACd,OAAI,cAAc,OAAQ,OAAiB,QAAQ;AAEnD,SAAM"}
1
+ {"version":3,"file":"plugin.mjs","names":["transformed: TransformResult | string","result: TransformResult | string | undefined"],"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 { LogLevelLabel } from \"@storm-software/config-tools/types\";\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 { UNSAFE_PluginContext } from \"../../types/_internal\";\nimport { PluginContext } from \"../../types/context\";\nimport { UnpluginFactory } from \"../../types/unplugin\";\nimport { extendLog } from \"../logger\";\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 \"unplugin\". If provided, the plugin will be named `${name} - Unplugin` (e.g., \"MyPlugin - Unplugin\").\n *\n * @defaultValue \"unplugin\"\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 UNSAFE_PluginContext;\n setParseImpl(ctx.parse);\n\n const name = options.name || \"unplugin\";\n\n return () => {\n const log = extendLog(ctx.log, name);\n log(\n LogLevelLabel.DEBUG,\n `Initializing ${\n name.toLowerCase() === \"unplugin\"\n ? \"Unplugin\"\n : `${titleCase(name)} - Unplugin`\n } plugin`\n );\n\n try {\n const { resolveId, load } =\n createUnpluginModuleResolutionFunctions<TContext>(context, options);\n\n return {\n name:\n name.toLowerCase() === \"unplugin\"\n ? \"powerlines\"\n : `powerlines:${kebabCase(name)}`,\n api: ctx.$$internal.api,\n resolveId: {\n filter: {\n id: {\n include: [/.*/]\n }\n },\n handler: resolveId\n },\n load: {\n filter: {\n id: {\n include: [/.*/]\n }\n },\n handler: load\n }\n };\n } catch (error) {\n log(LogLevelLabel.FATAL, (error as Error)?.message);\n\n throw error;\n }\n };\n}\n\nexport interface CreateUnpluginOptions extends CreateUnpluginResolverOptions {}\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 UNSAFE_PluginContext;\n setParseImpl(ctx.parse);\n\n const name = options.name || \"unplugin\";\n\n return () => {\n const log = extendLog(ctx.log, name);\n log(\n LogLevelLabel.DEBUG,\n `Initializing ${\n name.toLowerCase() === \"unplugin\"\n ? \"Unplugin\"\n : `${titleCase(name)} - Unplugin`\n } plugin`\n );\n\n try {\n const { resolveId, load } =\n createUnpluginModuleResolutionFunctions<TContext>(context, options);\n\n async function buildStart(this: UnpluginBuildContext) {\n log(LogLevelLabel.DEBUG, \"Powerlines build plugin starting...\");\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\n ]);\n if (result) {\n transformed = result;\n }\n }\n\n return transformed;\n }\n\n async function buildEnd(this: UnpluginBuildContext): Promise<void> {\n log(LogLevelLabel.DEBUG, \"Powerlines build plugin finishing...\");\n\n return ctx.$$internal.callHook(\"buildEnd\", {\n sequential: true\n });\n }\n\n async function writeBundle(): Promise<void> {\n log(LogLevelLabel.DEBUG, \"Finalizing Powerlines project output...\");\n\n return ctx.$$internal.callHook(\"writeBundle\", {\n sequential: true\n });\n }\n\n return {\n name:\n name.toLowerCase() === \"unplugin\"\n ? \"powerlines\"\n : `powerlines:${kebabCase(name)}`,\n api: ctx.$$internal.api,\n resolveId: {\n filter: {\n id: {\n include: [/.*/]\n }\n },\n handler: resolveId\n },\n load: {\n filter: {\n id: {\n include: [/.*/]\n }\n },\n handler: load\n },\n transform,\n buildStart,\n buildEnd,\n writeBundle,\n vite: {\n sharedDuringBuild: true\n }\n };\n } catch (error) {\n log(LogLevelLabel.FATAL, (error as Error)?.message);\n\n throw error;\n }\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAwDA,SAAgB,uBAGd,SACA,UAAyC,EAAE,EAChB;CAC3B,MAAM,MAAM;AACZ,cAAa,IAAI,MAAM;CAEvB,MAAM,OAAO,QAAQ,QAAQ;AAE7B,cAAa;EACX,MAAM,MAAM,UAAU,IAAI,KAAK,KAAK;AACpC,MACE,cAAc,OACd,gBACE,KAAK,aAAa,KAAK,aACnB,aACA,GAAG,UAAU,KAAK,CAAC,aACxB,SACF;AAED,MAAI;GACF,MAAM,EAAE,WAAW,SACjB,wCAAkD,SAAS,QAAQ;AAErE,UAAO;IACL,MACE,KAAK,aAAa,KAAK,aACnB,eACA,cAAc,UAAU,KAAK;IACnC,KAAK,IAAI,WAAW;IACpB,WAAW;KACT,QAAQ,EACN,IAAI,EACF,SAAS,CAAC,KAAK,EAChB,EACF;KACD,SAAS;KACV;IACD,MAAM;KACJ,QAAQ,EACN,IAAI,EACF,SAAS,CAAC,KAAK,EAChB,EACF;KACD,SAAS;KACV;IACF;WACM,OAAO;AACd,OAAI,cAAc,OAAQ,OAAiB,QAAQ;AAEnD,SAAM;;;;;;;;;;AAaZ,SAAgB,eACd,SACA,UAAiC,EAAE,EACR;CAC3B,MAAM,MAAM;AACZ,cAAa,IAAI,MAAM;CAEvB,MAAM,OAAO,QAAQ,QAAQ;AAE7B,cAAa;EACX,MAAM,MAAM,UAAU,IAAI,KAAK,KAAK;AACpC,MACE,cAAc,OACd,gBACE,KAAK,aAAa,KAAK,aACnB,aACA,GAAG,UAAU,KAAK,CAAC,aACxB,SACF;AAED,MAAI;GACF,MAAM,EAAE,WAAW,SACjB,wCAAkD,SAAS,QAAQ;GAErE,eAAe,aAAuC;AACpD,QAAI,cAAc,OAAO,sCAAsC;AAE/D,UAAM,IAAI,WAAW,SAAS,cAAc,EAC1C,YAAY,MACb,CAAC;;GAGJ,eAAe,UAEb,MACA,IAC6C;IAC7C,IAAIA,cAAwC;AAE5C,SAAK,MAAM,QAAQ,IAAI,WAAW,YAAY,YAC5C,YACD,EAAE;KACD,MAAMC,SACJ,MAAM,KAAK,QAAQ,MAAM,gBAAgB,KAAK,KAAK,EAAE,CACnD,UAAU,YAAY,EACtB,GACD,CAAC;AACJ,SAAI,OACF,eAAc;;AAIlB,WAAO;;GAGT,eAAe,WAAoD;AACjE,QAAI,cAAc,OAAO,uCAAuC;AAEhE,WAAO,IAAI,WAAW,SAAS,YAAY,EACzC,YAAY,MACb,CAAC;;GAGJ,eAAe,cAA6B;AAC1C,QAAI,cAAc,OAAO,0CAA0C;AAEnE,WAAO,IAAI,WAAW,SAAS,eAAe,EAC5C,YAAY,MACb,CAAC;;AAGJ,UAAO;IACL,MACE,KAAK,aAAa,KAAK,aACnB,eACA,cAAc,UAAU,KAAK;IACnC,KAAK,IAAI,WAAW;IACpB,WAAW;KACT,QAAQ,EACN,IAAI,EACF,SAAS,CAAC,KAAK,EAChB,EACF;KACD,SAAS;KACV;IACD,MAAM;KACJ,QAAQ,EACN,IAAI,EACF,SAAS,CAAC,KAAK,EAChB,EACF;KACD,SAAS;KACV;IACD;IACA;IACA;IACA;IACA,MAAM,EACJ,mBAAmB,MACpB;IACF;WACM,OAAO;AACd,OAAI,cAAc,OAAQ,OAAiB,QAAQ;AAEnD,SAAM"}
@@ -1 +1 @@
1
- {"version":3,"file":"file-header.d.mts","names":[],"sources":["../../../src/lib/utilities/file-header.ts"],"sourcesContent":[],"mappings":";;;UAqBiB,iBAAA;;EAAA,cAAA,CAAA,EAAA,OAAiB;AAKlC;AAOgB,iBAPA,iBAAA,CASL,OAAA,EATgC,OASV,CAAA,EAAA,MAAA;iBAFjB,aAAA,UACL,mBACA"}
1
+ {"version":3,"file":"file-header.d.mts","names":[],"sources":["../../../src/lib/utilities/file-header.ts"],"sourcesContent":[],"mappings":";;;UAqBiB,iBAAA;;EAAA,cAAA,CAAA,EAAA,OAAiB;AAKlC;AAOgB,iBAPA,iBAAA,CASL,OAAA,EATgC,OAShC,CAAsB,EAAA,MAAA;iBAFjB,aAAA,UACL,mBACA"}
@@ -1 +1 @@
1
- {"version":3,"file":"build-helpers.d.mts","names":[],"sources":["../../src/plugin-utils/build-helpers.ts"],"sourcesContent":[],"mappings":";;;;UAyBiB,yBAAA;YACL;EADK,UAAA,EAEH,aAFG,CAAA,YAAyB,CAAA;AAW1C;;;;;;;iBAAgB,mBAAA,UACL,UACR"}
1
+ {"version":3,"file":"build-helpers.d.mts","names":[],"sources":["../../src/plugin-utils/build-helpers.ts"],"sourcesContent":[],"mappings":";;;;UAyBiB,yBAAA;YACL;EADK,UAAA,EAEH,aAFG,CAAA,YAAyB,CAC9B;AAUZ;;;;;;;iBAAgB,mBAAA,UACL,UACR"}
@@ -1 +1 @@
1
- {"version":3,"file":"merge.d.cts","names":[],"sources":["../../src/plugin-utils/merge.ts"],"sourcesContent":[],"mappings":";;;;;KA0BY,6BACO,gCACA,OAAO,YAAY,cAAc,4BACjC,OAAO,YAAY,cAAc,aAElD,iBAAiB,OAAO,YACpB,OAAO,YACP,iBAAiB,OAAO,YACtB,OAAO,YACP,cAAc;;AATtB;;;;;;AAG0B,iBAqCV,KArCU,CAAA,iBAqCa,aArCb,GAqC6B,aArC7B,CAAA,CAAA,OAAA,EAsCf,MAtCe,CAsCR,QAtCQ,CAAA,GAsCI,aAtCJ,CAsCkB,QAtClB,CAAA,EAAA,OAAA,EAuCf,MAvCe,CAuCR,QAvCQ,CAAA,GAuCI,aAvCJ,CAuCkB,QAvClB,CAAA,CAAA,EAwCvB,WAxCuB,CAwCX,QAxCW,EAAA,OAwCM,OAxCN,EAAA,OAwCsB,OAxCtB,CAAA;;;;;;;;;;;;;;;;;AAqCV,cA2BH,WA3BQ,EAAA,CAAA,GAAA,OAAA,EAAA,OAAA,EAAA,EAAA,GAqCY,cArCZ;AAAkB,8BAAA,GAAA,EAAA"}
1
+ {"version":3,"file":"merge.d.cts","names":[],"sources":["../../src/plugin-utils/merge.ts"],"sourcesContent":[],"mappings":";;;;;KA6BY,6BACO,gCACA,OAAO,YAAY,cAAc,4BACjC,OAAO,YAAY,cAAc,aAElD,iBAAiB,OAAO,YACpB,OAAO,YACP,iBAAiB,OAAO,YACtB,OAAO,YACP,cAAc;;;;AATtB;;;;AAEoD,iBAsCpC,KAtCoC,CAAA,iBAsCb,aAtCa,GAsCG,aAtCH,CAAA,CAAA,OAAA,EAuCzC,MAvCyC,CAuClC,QAvCkC,CAAA,GAuCtB,aAvCsB,CAuCR,QAvCQ,CAAA,EAAA,OAAA,EAwCzC,MAxCyC,CAwClC,QAxCkC,CAAA,GAwCtB,aAxCsB,CAwCR,QAxCQ,CAAA,CAAA,EAyCjD,WAzCiD,CAyCrC,QAzCqC,EAAA,OAyCpB,OAzCoB,EAAA,OAyCJ,OAzCI,CAAA;;;;;;;;;;;;;;;;;AAO5C,cA0DK,WA1DL,EAAA,CAAA,GAAA,OAAA,EAAA,OAAA,EAAA,EAAA,GAoEyB,cApEzB;AAAa,8BAAA,GAAA,EAAA"}
@@ -1,6 +1,7 @@
1
1
  import { Plugin } from "../types/plugin.mjs";
2
2
  import { PluginContext } from "../types/context.mjs";
3
3
  import { PartialPlugin, ResolvedConfig } from "../types/config.mjs";
4
+ import "../types/index.mjs";
4
5
 
5
6
  //#region src/plugin-utils/merge.d.ts
6
7
  type MergeResult<TContext extends PluginContext, TPluginA extends Plugin<TContext> | PartialPlugin<TContext>, TPluginB extends Plugin<TContext> | PartialPlugin<TContext>> = TPluginA extends Plugin<TContext> ? Plugin<TContext> : TPluginB extends Plugin<TContext> ? Plugin<TContext> : PartialPlugin<TContext>;
@@ -1 +1 @@
1
- {"version":3,"file":"merge.d.mts","names":[],"sources":["../../src/plugin-utils/merge.ts"],"sourcesContent":[],"mappings":";;;;;KA0BY,6BACO,gCACA,OAAO,YAAY,cAAc,4BACjC,OAAO,YAAY,cAAc,aAElD,iBAAiB,OAAO,YACpB,OAAO,YACP,iBAAiB,OAAO,YACtB,OAAO,YACP,cAAc;;AATtB;;;;;;AAG0B,iBAqCV,KArCU,CAAA,iBAqCa,aArCb,GAqC6B,aArC7B,CAAA,CAAA,OAAA,EAsCf,MAtCe,CAsCR,QAtCQ,CAAA,GAsCI,aAtCJ,CAsCkB,QAtClB,CAAA,EAAA,OAAA,EAuCf,MAvCe,CAuCR,QAvCQ,CAAA,GAuCI,aAvCJ,CAuCkB,QAvClB,CAAA,CAAA,EAwCvB,WAxCuB,CAwCX,QAxCW,EAAA,OAwCM,OAxCN,EAAA,OAwCsB,OAxCtB,CAAA;;;;;;;;;;;;;;;;;AAqCV,cA2BH,WA3BQ,EAAA,CAAA,GAAA,OAAA,EAAA,OAAA,EAAA,EAAA,GAqCY,cArCZ;AAAkB,8BAAA,GAAA,EAAA"}
1
+ {"version":3,"file":"merge.d.mts","names":[],"sources":["../../src/plugin-utils/merge.ts"],"sourcesContent":[],"mappings":";;;;;;KA6BY,6BACO,gCACA,OAAO,YAAY,cAAc,4BACjC,OAAO,YAAY,cAAc,aAElD,iBAAiB,OAAO,YACpB,OAAO,YACP,iBAAiB,OAAO,YACtB,OAAO,YACP,cAAc;;;;;AATtB;;;AAEmB,iBAsCH,KAtCG,CAAA,iBAsCoB,aAtCpB,GAsCoC,aAtCpC,CAAA,CAAA,OAAA,EAuCR,MAvCQ,CAuCD,QAvCC,CAAA,GAuCW,aAvCX,CAuCyB,QAvCzB,CAAA,EAAA,OAAA,EAwCR,MAxCQ,CAwCD,QAxCC,CAAA,GAwCW,aAxCX,CAwCyB,QAxCzB,CAAA,CAAA,EAyChB,WAzCgB,CAyCJ,QAzCI,EAAA,OAyCa,OAzCb,EAAA,OAyC6B,OAzC7B,CAAA;;;;;;;;;;;;;;;;;AAOG,cA0DT,WA1DS,EAAA,CAAA,GAAA,OAAA,EAAA,OAAA,EAAA,EAAA,GAoEW,cApEX;AAAd,8BAAA,GAAA,EAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"merge.mjs","names":["defu"],"sources":["../../src/plugin-utils/merge.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 { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport defu, { createDefu } from \"defu\";\nimport { PartialPlugin, ResolvedConfig } from \"../types/config\";\nimport { PluginContext } from \"../types/context\";\nimport { Plugin } from \"../types/plugin\";\nimport { getHookHandler, isPluginHook } from \"./helpers\";\n\nexport type MergeResult<\n TContext extends PluginContext,\n TPluginA extends Plugin<TContext> | PartialPlugin<TContext>,\n TPluginB extends Plugin<TContext> | PartialPlugin<TContext>\n> =\n TPluginA extends Plugin<TContext>\n ? Plugin<TContext>\n : TPluginB extends Plugin<TContext>\n ? Plugin<TContext>\n : PartialPlugin<TContext>;\n\nconst mergePlugin = createDefu((obj, key, value) => {\n if (isPluginHook(obj[key]) && isPluginHook(value)) {\n obj[key] = {\n ...obj[key],\n ...value,\n handler: async (...params: any[]) => {\n const [resultA, resultB] = await Promise.all([\n // eslint-disable-next-line ts/no-unsafe-call\n (getHookHandler(obj[key]) as any)(...params),\n // eslint-disable-next-line ts/no-unsafe-call\n (getHookHandler(value) as any)(...params)\n ]);\n\n return resultB && resultA ? defu(resultA, resultB) : resultA || resultB;\n }\n };\n return true;\n }\n\n return false;\n});\n\n/**\n * Merges two {@link Plugin | plugins} or {@link PartialPlugin | partial plugins} together.\n *\n * @param pluginA - The first {@link Plugin | plugin} or {@link PartialPlugin | partial plugin} to merge.\n * @param pluginB - The second {@link Plugin | plugin} or {@link PartialPlugin | partial plugin} to merge.\n * @returns The merged {@link Plugin | plugin} or {@link PartialPlugin | partial plugin}.\n */\nexport function merge<TContext extends PluginContext = PluginContext>(\n pluginA: Plugin<TContext> | PartialPlugin<TContext>,\n pluginB: Plugin<TContext> | PartialPlugin<TContext>\n): MergeResult<TContext, typeof pluginA, typeof pluginB> {\n return mergePlugin(pluginA, pluginB) as MergeResult<\n TContext,\n typeof pluginA,\n typeof pluginB\n >;\n}\n\n/**\n * Merges two configuration objects together, with special handling for string values.\n * If the value from the second object is a non-empty string, it will overwrite the value from the first object.\n *\n * @example\n * ```ts\n * const configA = { name: \"Default\", version: \"1.0.0\" };\n * const configB = { name: \"Custom\", description: \"A custom config\" };\n * const mergedConfig = mergeConfig(configA, configB);\n * // Result: { name: \"Custom\", version: \"1.0.0\", description: \"A custom config\" }\n * ```\n *\n * @param objA - The first configuration object.\n * @param objB - The second configuration object.\n * @returns The merged configuration object.\n */\nexport const mergeConfig = createDefu((obj, key, value) => {\n if (isString(obj[key]) && isString(value)) {\n if (isSetString(value)) {\n obj[key] = value;\n }\n\n return true;\n }\n\n return false;\n}) as (...configs: unknown[]) => ResolvedConfig;\n"],"mappings":";;;;;;AAqCA,MAAM,cAAc,YAAY,KAAK,KAAK,UAAU;AAClD,KAAI,aAAa,IAAI,KAAK,IAAI,aAAa,MAAM,EAAE;AACjD,MAAI,OAAO;GACT,GAAG,IAAI;GACP,GAAG;GACH,SAAS,OAAO,GAAG,WAAkB;IACnC,MAAM,CAAC,SAAS,WAAW,MAAM,QAAQ,IAAI,CAE1C,eAAe,IAAI,KAAK,CAAS,GAAG,OAAO,EAE3C,eAAe,MAAM,CAAS,GAAG,OAAO,CAC1C,CAAC;AAEF,WAAO,WAAW,UAAUA,OAAK,SAAS,QAAQ,GAAG,WAAW;;GAEnE;AACD,SAAO;;AAGT,QAAO;EACP;;;;;;;;AASF,SAAgB,MACd,SACA,SACuD;AACvD,QAAO,YAAY,SAAS,QAAQ;;;;;;;;;;;;;;;;;;AAuBtC,MAAa,cAAc,YAAY,KAAK,KAAK,UAAU;AACzD,KAAI,SAAS,IAAI,KAAK,IAAI,SAAS,MAAM,EAAE;AACzC,MAAI,YAAY,MAAM,CACpB,KAAI,OAAO;AAGb,SAAO;;AAGT,QAAO;EACP"}
1
+ {"version":3,"file":"merge.mjs","names":["defu"],"sources":["../../src/plugin-utils/merge.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 { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport defu, { createDefu } from \"defu\";\nimport type {\n PartialPlugin,\n Plugin,\n PluginContext,\n ResolvedConfig\n} from \"../types\";\nimport { getHookHandler, isPluginHook } from \"./helpers\";\n\nexport type MergeResult<\n TContext extends PluginContext,\n TPluginA extends Plugin<TContext> | PartialPlugin<TContext>,\n TPluginB extends Plugin<TContext> | PartialPlugin<TContext>\n> =\n TPluginA extends Plugin<TContext>\n ? Plugin<TContext>\n : TPluginB extends Plugin<TContext>\n ? Plugin<TContext>\n : PartialPlugin<TContext>;\n\nconst mergePlugin = createDefu((obj, key, value) => {\n if (isPluginHook(obj[key]) && isPluginHook(value)) {\n obj[key] = {\n ...obj[key],\n ...value,\n handler: async (...params: any[]) => {\n const [resultA, resultB] = await Promise.all([\n // eslint-disable-next-line ts/no-unsafe-call\n (getHookHandler(obj[key]) as any)(...params),\n // eslint-disable-next-line ts/no-unsafe-call\n (getHookHandler(value) as any)(...params)\n ]);\n\n return resultB && resultA ? defu(resultA, resultB) : resultA || resultB;\n }\n };\n return true;\n }\n\n return false;\n});\n\n/**\n * Merges two {@link Plugin | plugins} or {@link PartialPlugin | partial plugins} together.\n *\n * @param pluginA - The first {@link Plugin | plugin} or {@link PartialPlugin | partial plugin} to merge.\n * @param pluginB - The second {@link Plugin | plugin} or {@link PartialPlugin | partial plugin} to merge.\n * @returns The merged {@link Plugin | plugin} or {@link PartialPlugin | partial plugin}.\n */\nexport function merge<TContext extends PluginContext = PluginContext>(\n pluginA: Plugin<TContext> | PartialPlugin<TContext>,\n pluginB: Plugin<TContext> | PartialPlugin<TContext>\n): MergeResult<TContext, typeof pluginA, typeof pluginB> {\n return mergePlugin(pluginA, pluginB) as MergeResult<\n TContext,\n typeof pluginA,\n typeof pluginB\n >;\n}\n\n/**\n * Merges two configuration objects together, with special handling for string values.\n * If the value from the second object is a non-empty string, it will overwrite the value from the first object.\n *\n * @example\n * ```ts\n * const configA = { name: \"Default\", version: \"1.0.0\" };\n * const configB = { name: \"Custom\", description: \"A custom config\" };\n * const mergedConfig = mergeConfig(configA, configB);\n * // Result: { name: \"Custom\", version: \"1.0.0\", description: \"A custom config\" }\n * ```\n *\n * @param objA - The first configuration object.\n * @param objB - The second configuration object.\n * @returns The merged configuration object.\n */\nexport const mergeConfig = createDefu((obj, key, value) => {\n if (isString(obj[key]) && isString(value)) {\n if (isSetString(value)) {\n obj[key] = value;\n }\n\n return true;\n }\n\n return false;\n}) as (...configs: unknown[]) => ResolvedConfig;\n"],"mappings":";;;;;;AAwCA,MAAM,cAAc,YAAY,KAAK,KAAK,UAAU;AAClD,KAAI,aAAa,IAAI,KAAK,IAAI,aAAa,MAAM,EAAE;AACjD,MAAI,OAAO;GACT,GAAG,IAAI;GACP,GAAG;GACH,SAAS,OAAO,GAAG,WAAkB;IACnC,MAAM,CAAC,SAAS,WAAW,MAAM,QAAQ,IAAI,CAE1C,eAAe,IAAI,KAAK,CAAS,GAAG,OAAO,EAE3C,eAAe,MAAM,CAAS,GAAG,OAAO,CAC1C,CAAC;AAEF,WAAO,WAAW,UAAUA,OAAK,SAAS,QAAQ,GAAG,WAAW;;GAEnE;AACD,SAAO;;AAGT,QAAO;EACP;;;;;;;;AASF,SAAgB,MACd,SACA,SACuD;AACvD,QAAO,YAAY,SAAS,QAAQ;;;;;;;;;;;;;;;;;;AAuBtC,MAAa,cAAc,YAAY,KAAK,KAAK,UAAU;AACzD,KAAI,SAAS,IAAI,KAAK,IAAI,SAAS,MAAM,EAAE;AACzC,MAAI,YAAY,MAAM,CACpB,KAAI,OAAO;AAGb,SAAO;;AAGT,QAAO;EACP"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/core",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "private": false,
5
5
  "description": "An internal core package for Powerlines - please use the `powerlines` package for public usage.",
6
6
  "homepage": "https://stormsoftware.com",
@@ -512,7 +512,7 @@
512
512
  "jiti": "^2.6.1",
513
513
  "magic-string": "^0.30.21",
514
514
  "prettier": "^3.8.1",
515
- "unplugin": "3.0.0-beta.3"
515
+ "unplugin": "^3.0.0"
516
516
  },
517
517
  "devDependencies": {
518
518
  "@storm-software/testing-tools": "^1.119.85",
@@ -520,9 +520,9 @@
520
520
  "@types/diff-match-patch": "^1.0.36",
521
521
  "@types/node": "^25.3.3",
522
522
  "@types/semver": "^7.7.1",
523
- "tsdown": "0.17.0-beta.5",
523
+ "tsdown": "^0.17.2",
524
524
  "typescript": "^5.9.3"
525
525
  },
526
526
  "publishConfig": { "access": "public" },
527
- "gitHead": "b8306ac71f62b39384f058bb1e7058d0f43ecd38"
527
+ "gitHead": "a06fd299516eaa1263502746ed51daf5b8a80e80"
528
528
  }