@powerlines/core 0.2.22 → 0.2.23
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/_virtual/{rolldown_runtime.cjs → _rolldown/runtime.cjs} +1 -1
- package/dist/constants/commands.d.cts.map +1 -1
- package/dist/constants/commands.d.mts.map +1 -1
- package/dist/constants/environments.d.cts.map +1 -1
- package/dist/constants/environments.d.mts.map +1 -1
- package/dist/constants/fs.d.cts.map +1 -1
- package/dist/constants/fs.d.mts.map +1 -1
- package/dist/constants/hooks.d.cts.map +1 -1
- package/dist/constants/hooks.d.mts.map +1 -1
- package/dist/constants/index.cjs +1 -0
- package/dist/constants/meta.d.cts.map +1 -1
- package/dist/constants/meta.d.mts.map +1 -1
- package/dist/constants/plugin.d.cts.map +1 -1
- package/dist/constants/plugin.d.mts.map +1 -1
- package/dist/index.cjs +1 -0
- package/dist/index.d.mts +0 -2
- package/dist/lib/config.cjs +18 -17
- package/dist/lib/config.d.cts.map +1 -1
- package/dist/lib/config.d.mts.map +1 -1
- package/dist/lib/config.mjs +3 -3
- package/dist/lib/config.mjs.map +1 -1
- package/dist/lib/entry.cjs +28 -27
- package/dist/lib/entry.d.cts.map +1 -1
- package/dist/lib/entry.d.mts +0 -1
- package/dist/lib/entry.d.mts.map +1 -1
- package/dist/lib/entry.mjs.map +1 -1
- package/dist/lib/index.cjs +1 -0
- package/dist/lib/index.d.mts +0 -2
- package/dist/lib/logger.cjs +14 -13
- package/dist/lib/logger.d.cts.map +1 -1
- package/dist/lib/logger.d.mts +0 -1
- package/dist/lib/logger.d.mts.map +1 -1
- package/dist/lib/unplugin/helpers.cjs +4 -3
- package/dist/lib/unplugin/helpers.d.cts +0 -1
- package/dist/lib/unplugin/helpers.d.cts.map +1 -1
- package/dist/lib/unplugin/helpers.d.mts +0 -1
- package/dist/lib/unplugin/helpers.d.mts.map +1 -1
- package/dist/lib/unplugin/helpers.mjs +2 -2
- package/dist/lib/unplugin/helpers.mjs.map +1 -1
- package/dist/lib/unplugin/index.cjs +1 -0
- package/dist/lib/unplugin/module-resolution.cjs +11 -10
- package/dist/lib/unplugin/module-resolution.d.cts.map +1 -1
- package/dist/lib/unplugin/module-resolution.d.mts.map +1 -1
- package/dist/lib/unplugin/plugin.cjs +14 -13
- package/dist/lib/unplugin/plugin.d.cts.map +1 -1
- package/dist/lib/unplugin/plugin.d.mts.map +1 -1
- package/dist/lib/unplugin/plugin.mjs.map +1 -1
- package/dist/lib/utilities/file-header.cjs +5 -4
- package/dist/lib/utilities/file-header.d.cts.map +1 -1
- package/dist/lib/utilities/file-header.d.mts.map +1 -1
- package/dist/lib/utilities/format.cjs +8 -7
- package/dist/lib/utilities/format.d.cts +0 -1
- package/dist/lib/utilities/format.d.cts.map +1 -1
- package/dist/lib/utilities/format.d.mts +0 -1
- package/dist/lib/utilities/format.d.mts.map +1 -1
- package/dist/lib/utilities/index.cjs +1 -0
- package/dist/lib/utilities/source-file.cjs +10 -9
- package/dist/lib/utilities/source-file.d.cts +0 -1
- package/dist/lib/utilities/source-file.d.cts.map +1 -1
- package/dist/lib/utilities/source-file.d.mts +0 -1
- package/dist/lib/utilities/source-file.d.mts.map +1 -1
- package/dist/lib/utilities/source-map.cjs +3 -2
- package/dist/lib/utilities/source-map.d.cts +0 -1
- package/dist/lib/utilities/source-map.d.cts.map +1 -1
- package/dist/lib/utilities/source-map.d.mts +0 -1
- package/dist/lib/utilities/source-map.d.mts.map +1 -1
- package/dist/lib/utilities/write-file.cjs +7 -6
- package/dist/lib/utilities/write-file.d.cts +0 -1
- package/dist/lib/utilities/write-file.d.cts.map +1 -1
- package/dist/lib/utilities/write-file.d.mts +0 -1
- package/dist/lib/utilities/write-file.d.mts.map +1 -1
- package/dist/plugin-base.cjs +8 -9
- package/dist/plugin-base.d.cts.map +1 -1
- package/dist/plugin-base.d.mts.map +1 -1
- package/dist/plugin-base.mjs +1 -2
- package/dist/plugin-base.mjs.map +1 -1
- package/dist/plugin-utils/build-helpers.cjs +12 -11
- package/dist/plugin-utils/build-helpers.d.cts.map +1 -1
- package/dist/plugin-utils/build-helpers.d.mts.map +1 -1
- package/dist/plugin-utils/context-helpers.cjs +18 -17
- package/dist/plugin-utils/context-helpers.d.cts +0 -1
- package/dist/plugin-utils/context-helpers.d.cts.map +1 -1
- package/dist/plugin-utils/context-helpers.d.mts +0 -1
- package/dist/plugin-utils/context-helpers.d.mts.map +1 -1
- package/dist/plugin-utils/context-helpers.mjs.map +1 -1
- package/dist/plugin-utils/extend.cjs +12 -11
- package/dist/plugin-utils/extend.d.cts +0 -1
- package/dist/plugin-utils/extend.d.cts.map +1 -1
- package/dist/plugin-utils/extend.d.mts +0 -1
- package/dist/plugin-utils/extend.d.mts.map +1 -1
- package/dist/plugin-utils/format-package-json.cjs +6 -5
- package/dist/plugin-utils/format-package-json.d.cts +0 -1
- package/dist/plugin-utils/format-package-json.d.cts.map +1 -1
- package/dist/plugin-utils/format-package-json.d.mts +0 -1
- package/dist/plugin-utils/format-package-json.d.mts.map +1 -1
- package/dist/plugin-utils/get-config-path.cjs +35 -34
- package/dist/plugin-utils/get-config-path.d.cts +0 -1
- package/dist/plugin-utils/get-config-path.d.cts.map +1 -1
- package/dist/plugin-utils/get-config-path.d.mts +0 -1
- package/dist/plugin-utils/get-config-path.d.mts.map +1 -1
- package/dist/plugin-utils/helpers.cjs +15 -14
- package/dist/plugin-utils/helpers.d.cts +10 -11
- package/dist/plugin-utils/helpers.d.cts.map +1 -1
- package/dist/plugin-utils/helpers.d.mts +10 -11
- package/dist/plugin-utils/helpers.d.mts.map +1 -1
- package/dist/plugin-utils/helpers.mjs.map +1 -1
- package/dist/plugin-utils/index.cjs +1 -0
- package/dist/plugin-utils/merge.cjs +7 -6
- package/dist/plugin-utils/merge.d.cts.map +1 -1
- package/dist/plugin-utils/merge.d.mts +0 -2
- package/dist/plugin-utils/merge.d.mts.map +1 -1
- package/dist/plugin-utils/merge.mjs +2 -2
- package/dist/plugin-utils/merge.mjs.map +1 -1
- package/dist/plugin-utils/modules.cjs +1 -0
- package/dist/plugin-utils/modules.d.cts +0 -1
- package/dist/plugin-utils/modules.d.cts.map +1 -1
- package/dist/plugin-utils/modules.d.mts +0 -1
- package/dist/plugin-utils/modules.d.mts.map +1 -1
- package/dist/plugin-utils/modules.mjs.map +1 -1
- package/dist/plugin-utils/paths.cjs +5 -4
- package/dist/plugin-utils/paths.d.cts +0 -1
- package/dist/plugin-utils/paths.d.cts.map +1 -1
- package/dist/plugin-utils/paths.d.mts +0 -1
- package/dist/plugin-utils/paths.d.mts.map +1 -1
- package/dist/types/_internal.d.cts +0 -1
- package/dist/types/_internal.d.cts.map +1 -1
- package/dist/types/_internal.d.mts +0 -1
- package/dist/types/_internal.d.mts.map +1 -1
- package/dist/types/api.d.cts +0 -1
- package/dist/types/api.d.cts.map +1 -1
- package/dist/types/api.d.mts +0 -1
- package/dist/types/api.d.mts.map +1 -1
- package/dist/types/commands.d.cts.map +1 -1
- package/dist/types/commands.d.mts.map +1 -1
- package/dist/types/config.d.cts.map +1 -1
- package/dist/types/config.d.mts.map +1 -1
- package/dist/types/context.d.cts.map +1 -1
- package/dist/types/context.d.mts.map +1 -1
- package/dist/types/fs.d.cts.map +1 -1
- package/dist/types/fs.d.mts.map +1 -1
- package/dist/types/hooks.d.cts +10 -10
- package/dist/types/hooks.d.cts.map +1 -1
- package/dist/types/hooks.d.mts +10 -10
- package/dist/types/hooks.d.mts.map +1 -1
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts.map +1 -1
- package/dist/types/tsconfig.d.cts.map +1 -1
- package/dist/types/tsconfig.d.mts.map +1 -1
- package/dist/types/unplugin.d.cts.map +1 -1
- package/dist/types/unplugin.d.mts.map +1 -1
- package/package.json +5 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.cts","names":[],"sources":["../../src/constants/commands.ts"],"
|
|
1
|
+
{"version":3,"file":"commands.d.cts","names":[],"sources":["../../src/constants/commands.ts"],"mappings":";cAkBa,kBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.mts","names":[],"sources":["../../src/constants/commands.ts"],"
|
|
1
|
+
{"version":3,"file":"commands.d.mts","names":[],"sources":["../../src/constants/commands.ts"],"mappings":";cAkBa,kBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environments.d.cts","names":[],"sources":["../../src/constants/environments.ts"],"
|
|
1
|
+
{"version":3,"file":"environments.d.cts","names":[],"sources":["../../src/constants/environments.ts"],"mappings":";cAkBa,mBAAA;AAAA,cACA,kBAAA;AAAA,cAGA,kBAAA;AAAA,cACA,kBAAA;AAAA,cACA,eAAA;AAAA,cACA,eAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environments.d.mts","names":[],"sources":["../../src/constants/environments.ts"],"
|
|
1
|
+
{"version":3,"file":"environments.d.mts","names":[],"sources":["../../src/constants/environments.ts"],"mappings":";cAkBa,mBAAA;AAAA,cACA,kBAAA;AAAA,cAGA,kBAAA;AAAA,cACA,kBAAA;AAAA,cACA,eAAA;AAAA,cACA,eAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fs.d.cts","names":[],"sources":["../../src/constants/fs.ts"],"
|
|
1
|
+
{"version":3,"file":"fs.d.cts","names":[],"sources":["../../src/constants/fs.ts"],"mappings":";cAmBa,aAAA;AAAA,cAGA,cAAA;AAAA,cAEA,eAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fs.d.mts","names":[],"sources":["../../src/constants/fs.ts"],"
|
|
1
|
+
{"version":3,"file":"fs.d.mts","names":[],"sources":["../../src/constants/fs.ts"],"mappings":";cAmBa,aAAA;AAAA,cAGA,cAAA;AAAA,cAEA,eAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.cts","names":[],"sources":["../../src/constants/hooks.ts"],"
|
|
1
|
+
{"version":3,"file":"hooks.d.cts","names":[],"sources":["../../src/constants/hooks.ts"],"mappings":";cAkBa,iBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.mts","names":[],"sources":["../../src/constants/hooks.ts"],"
|
|
1
|
+
{"version":3,"file":"hooks.d.mts","names":[],"sources":["../../src/constants/hooks.ts"],"mappings":";cAkBa,iBAAA"}
|
package/dist/constants/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.d.cts","names":[],"sources":["../../src/constants/meta.ts"],"
|
|
1
|
+
{"version":3,"file":"meta.d.cts","names":[],"sources":["../../src/constants/meta.ts"],"mappings":";cAkBa,gBAAA;AAAA,cACA,iBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.d.mts","names":[],"sources":["../../src/constants/meta.ts"],"
|
|
1
|
+
{"version":3,"file":"meta.d.mts","names":[],"sources":["../../src/constants/meta.ts"],"mappings":";cAkBa,gBAAA;AAAA,cACA,iBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/constants/plugin.ts"],"
|
|
1
|
+
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/constants/plugin.ts"],"mappings":";cAoBa,yBAAA;AAAA,cAYA,gBAAA;AAAA,cAOA,sBAAA;AAAA,cAQA,mBAAA;AAAA,cAcA,mBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/constants/plugin.ts"],"
|
|
1
|
+
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/constants/plugin.ts"],"mappings":";cAoBa,yBAAA;AAAA,cAYA,gBAAA;AAAA,cAOA,sBAAA;AAAA,cAQA,mBAAA;AAAA,cAcA,mBAAA"}
|
package/dist/index.cjs
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -8,7 +8,6 @@ import { DeepkitOptions, ParsedTypeScriptConfig, RawReflectionMode, ReflectionLe
|
|
|
8
8
|
import { APIContext, BuildPluginContext, Context, EmitEntryOptions, EmitOptions, EnvironmentContext, EnvironmentContextPlugin, FetchOptions, InitContextOptions, MetaInfo, ParseOptions, PluginContext, ResolveResult, Resolver, SelectHookResult, SelectHookResultItem, SelectHooksOptions, SourceFile, TransformResult, UnimportContext, UnresolvedContext, WithUnpluginBuildContext, WorkerProcess, __ΩAPIContext, __ΩBuildPluginContext, __ΩContext, __ΩEmitEntryOptions, __ΩEmitOptions, __ΩEnvironmentContext, __ΩEnvironmentContextPlugin, __ΩFetchOptions, __ΩInitContextOptions, __ΩMetaInfo, __ΩParseOptions, __ΩPluginContext, __ΩResolveResult, __ΩResolver, __ΩSelectHookResult, __ΩSelectHookResultItem, __ΩSelectHooksOptions, __ΩSourceFile, __ΩTransformResult, __ΩUnimportContext, __ΩUnresolvedContext, __ΩWithUnpluginBuildContext, __ΩWorkerProcess } from "./types/context.mjs";
|
|
9
9
|
import { AnyUserConfig, BuildInlineConfig, CleanInlineConfig, Config, ConfigEnv, DeployInlineConfig, DocsInlineConfig, EnvironmentConfig, EnvironmentResolvedConfig, InitialUserConfig, InlineConfig, LintInlineConfig, LogFn, LogLevel, NewInlineConfig, OutputConfig, OutputResolvedConfig, ParsedUserConfig, PartialPlugin, PartialPluginFactory, PluginConfig, PluginConfigObject, PluginConfigTuple, PluginFactory, PowerlinesCommand, PrepareInlineConfig, ProjectType, ResolveConfig, ResolveResolvedConfig, ResolvedAssetGlob, ResolvedConfig, ResolvedEntryTypeDefinition, UserConfig, WorkspaceConfig, __ΩAnyUserConfig, __ΩBuildInlineConfig, __ΩCleanInlineConfig, __ΩConfig, __ΩConfigEnv, __ΩDeployInlineConfig, __ΩDocsInlineConfig, __ΩEnvironmentConfig, __ΩEnvironmentResolvedConfig, __ΩInitialUserConfig, __ΩInlineConfig, __ΩLintInlineConfig, __ΩLogFn, __ΩLogLevel, __ΩNewInlineConfig, __ΩOutputConfig, __ΩOutputResolvedConfig, __ΩParsedUserConfig, __ΩPartialPlugin, __ΩPartialPluginFactory, __ΩPluginConfig, __ΩPluginConfigObject, __ΩPluginConfigTuple, __ΩPluginFactory, __ΩPowerlinesCommand, __ΩPrepareInlineConfig, __ΩProjectType, __ΩResolveConfig, __ΩResolveResolvedConfig, __ΩResolvedAssetGlob, __ΩResolvedConfig, __ΩResolvedEntryTypeDefinition, __ΩUserConfig, __ΩWorkspaceConfig } from "./types/config.mjs";
|
|
10
10
|
import { PartiallyResolvedContext, __ΩPartiallyResolvedContext, defineConfig, loadUserConfigFile, loadWorkspaceConfig } from "./lib/config.mjs";
|
|
11
|
-
import "./types/index.mjs";
|
|
12
11
|
import { getUniqueInputs, isResolvedEntryTypeDefinition, isTypeDefinition, resolveEntryOutput, resolveInput, resolveInputs, resolveInputsSync } from "./lib/entry.mjs";
|
|
13
12
|
import { CreateLogOptions, __ΩCreateLogOptions, createLog, extendLog } from "./lib/logger.mjs";
|
|
14
13
|
import { combineContexts, isUnpluginBuilderVariant } from "./lib/unplugin/helpers.mjs";
|
|
@@ -19,5 +18,4 @@ import { format, formatFolder } from "./lib/utilities/format.mjs";
|
|
|
19
18
|
import { getMagicString, getSourceFile, getString } from "./lib/utilities/source-file.mjs";
|
|
20
19
|
import { generateSourceMap } from "./lib/utilities/source-map.mjs";
|
|
21
20
|
import { writeFile } from "./lib/utilities/write-file.mjs";
|
|
22
|
-
import "./lib/index.mjs";
|
|
23
21
|
export { API, APIContext, AnyUserConfig, BuildInlineConfig, BuildPluginContext, BuilderVariant, CallHookOptions, CleanInlineConfig, CommandType, Commands, Config, ConfigEnv, Context, CreateLogOptions, CreateUnpluginModuleResolutionFunctionsOptions, CreateUnpluginOptions, CreateUnpluginResolverOptions, DeepkitOptions, DeployInlineConfig, DocsInlineConfig, EmitEntryOptions, EmitOptions, EnvironmentConfig, EnvironmentContext, EnvironmentContextPlugin, EnvironmentResolvedConfig, FetchOptions, FileHeaderOptions, HookFields, HookListOrders, Hooks, 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, ResolveResult, 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, __ΩBuildInlineConfig, __ΩBuildPluginContext, __ΩBuilderVariant, __ΩCallHookOptions, __ΩCleanInlineConfig, __ΩCommandType, __ΩCommands, __ΩConfig, __ΩConfigEnv, __ΩContext, __ΩCreateLogOptions, __ΩCreateUnpluginModuleResolutionFunctionsOptions, __ΩCreateUnpluginOptions, __ΩCreateUnpluginResolverOptions, __ΩDeepkitOptions, __ΩDeployInlineConfig, __ΩDocsInlineConfig, __ΩEmitEntryOptions, __ΩEmitOptions, __ΩEnvironmentConfig, __ΩEnvironmentContext, __ΩEnvironmentContextPlugin, __ΩEnvironmentResolvedConfig, __ΩFetchOptions, __ΩFileHeaderOptions, __ΩHookFields, __ΩHookListOrders, __ΩHooks, __Ω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, __ΩResolveResult, __Ω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, getFileHeader, getFileHeaderWarning, getFileHeaderWarningText, getMagicString, getSourceFile, getString, getTypescriptFileHeader, getUniqueInputs, isResolvedEntryTypeDefinition, isTypeDefinition, isUnpluginBuilderVariant, loadUserConfigFile, loadWorkspaceConfig, resolveEntryOutput, resolveInput, resolveInputs, resolveInputsSync, writeFile };
|
package/dist/lib/config.cjs
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
let
|
|
4
|
-
let
|
|
5
|
-
let
|
|
6
|
-
let
|
|
7
|
-
let
|
|
8
|
-
let
|
|
9
|
-
let
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
let _storm_software_config_tools_get_config = require("@storm-software/config-tools/get-config");
|
|
4
|
+
let _stryke_fs_exists = require("@stryke/fs/exists");
|
|
5
|
+
let _stryke_path_append = require("@stryke/path/append");
|
|
6
|
+
let _stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
7
|
+
let _stryke_path_replace = require("@stryke/path/replace");
|
|
8
|
+
let _stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
|
|
9
|
+
let _stryke_type_checks_is_function = require("@stryke/type-checks/is-function");
|
|
10
|
+
let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
10
11
|
let c12 = require("c12");
|
|
11
12
|
let defu = require("defu");
|
|
12
|
-
defu =
|
|
13
|
+
defu = require_runtime.__toESM(defu);
|
|
13
14
|
|
|
14
15
|
//#region src/lib/config.ts
|
|
15
16
|
/**
|
|
@@ -20,7 +21,7 @@ defu = require_rolldown_runtime.__toESM(defu);
|
|
|
20
21
|
* @returns A promise that resolves to the loaded workspace configuration.
|
|
21
22
|
*/
|
|
22
23
|
async function loadWorkspaceConfig(workspaceRoot, cwd) {
|
|
23
|
-
return (0, defu.default)({ workspaceRoot }, await (0,
|
|
24
|
+
return (0, defu.default)({ workspaceRoot }, await (0, _storm_software_config_tools_get_config.getWorkspaceConfig)(true, {
|
|
24
25
|
cwd,
|
|
25
26
|
workspaceRoot,
|
|
26
27
|
useDefault: true
|
|
@@ -41,19 +42,19 @@ async function loadWorkspaceConfig(workspaceRoot, cwd) {
|
|
|
41
42
|
async function loadUserConfigFile(projectRoot, workspaceRoot, jiti, command, mode = "production", configFile, framework = "powerlines") {
|
|
42
43
|
let resolvedUserConfig = {};
|
|
43
44
|
let resolvedUserConfigFile;
|
|
44
|
-
if (configFile) resolvedUserConfigFile = (0,
|
|
45
|
-
if (!resolvedUserConfigFile) resolvedUserConfigFile = (0,
|
|
45
|
+
if (configFile) resolvedUserConfigFile = (0, _stryke_fs_exists.existsSync)((0, _stryke_path_replace.replacePath)(configFile, projectRoot)) ? (0, _stryke_path_replace.replacePath)(configFile, projectRoot) : (0, _stryke_fs_exists.existsSync)((0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(projectRoot, workspaceRoot), (0, _stryke_path_replace.replacePath)(configFile, projectRoot))) ? (0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(projectRoot, workspaceRoot), (0, _stryke_path_replace.replacePath)(configFile, projectRoot)) : (0, _stryke_fs_exists.existsSync)((0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(projectRoot, workspaceRoot), configFile)) ? (0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(projectRoot, workspaceRoot), configFile) : void 0;
|
|
46
|
+
if (!resolvedUserConfigFile) resolvedUserConfigFile = (0, _stryke_fs_exists.existsSync)((0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(projectRoot, workspaceRoot), `${framework}.${mode}.config.ts`)) ? (0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(projectRoot, workspaceRoot), `${framework}.${mode}.config.ts`) : (0, _stryke_fs_exists.existsSync)((0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(projectRoot, workspaceRoot), `${framework}.${mode}.config.js`)) ? (0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(projectRoot, workspaceRoot), `${framework}.${mode}.config.js`) : (0, _stryke_fs_exists.existsSync)((0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(projectRoot, workspaceRoot), `${framework}.${mode}.config.mts`)) ? (0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(projectRoot, workspaceRoot), `${framework}.${mode}.config.mts`) : (0, _stryke_fs_exists.existsSync)((0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(projectRoot, workspaceRoot), `${framework}.${mode}.config.mjs`)) ? (0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(projectRoot, workspaceRoot), `${framework}.${mode}.config.mjs`) : (0, _stryke_fs_exists.existsSync)((0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(projectRoot, workspaceRoot), `${framework}.config.ts`)) ? (0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(projectRoot, workspaceRoot), `${framework}.config.ts`) : (0, _stryke_fs_exists.existsSync)((0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(projectRoot, workspaceRoot), `${framework}.config.js`)) ? (0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(projectRoot, workspaceRoot), `${framework}.config.js`) : (0, _stryke_fs_exists.existsSync)((0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(projectRoot, workspaceRoot), `${framework}.config.mts`)) ? (0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(projectRoot, workspaceRoot), `${framework}.config.mts`) : (0, _stryke_fs_exists.existsSync)((0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(projectRoot, workspaceRoot), `${framework}.config.mjs`)) ? (0, _stryke_path_join_paths.joinPaths)((0, _stryke_path_append.appendPath)(projectRoot, workspaceRoot), `${framework}.config.mjs`) : void 0;
|
|
46
47
|
if (resolvedUserConfigFile) {
|
|
47
48
|
const resolved = await jiti.import(jiti.esmResolve(resolvedUserConfigFile));
|
|
48
49
|
if (resolved) {
|
|
49
50
|
let config = {};
|
|
50
|
-
if ((0,
|
|
51
|
+
if ((0, _stryke_type_checks_is_function.isFunction)(resolved)) config = await Promise.resolve(resolved({
|
|
51
52
|
command,
|
|
52
53
|
mode,
|
|
53
54
|
isSsrBuild: false,
|
|
54
55
|
isPreview: false
|
|
55
56
|
}));
|
|
56
|
-
if ((0,
|
|
57
|
+
if ((0, _stryke_type_checks_is_set_object.isSetObject)(config)) resolvedUserConfig = {
|
|
57
58
|
...config,
|
|
58
59
|
config,
|
|
59
60
|
configFile: resolvedUserConfigFile
|
|
@@ -65,11 +66,11 @@ async function loadUserConfigFile(projectRoot, workspaceRoot, jiti, command, mod
|
|
|
65
66
|
name: framework,
|
|
66
67
|
envName: mode,
|
|
67
68
|
globalRc: true,
|
|
68
|
-
packageJson: (0,
|
|
69
|
+
packageJson: (0, _stryke_string_format_camel_case.camelCase)(framework),
|
|
69
70
|
dotenv: true,
|
|
70
71
|
jiti
|
|
71
72
|
});
|
|
72
|
-
return (0, defu.default)(resolvedUserConfig, (0,
|
|
73
|
+
return (0, defu.default)(resolvedUserConfig, (0, _stryke_type_checks_is_set_object.isSetObject)(result?.config) ? {
|
|
73
74
|
...result.config,
|
|
74
75
|
...result
|
|
75
76
|
} : {});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.cts","names":[],"sources":["../../src/lib/config.ts"],"
|
|
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,aAAA,UACA,GAAA,WACC,OAAA,CAAQ,eAAA;;;;;;;;;;;;;iBAyBW,kBAAA,CACpB,WAAA,UACA,aAAA,UACA,IAAA,EAAM,IAAA,EACN,OAAA,GAAU,iBAAA,EACV,IAAA,WACA,UAAA,WACA,SAAA,YACC,OAAA,CAAQ,gBAAA;AApCX;;;;;;AAAA,iBA+LgB,YAAA,CAAa,MAAA,EAAQ,aAAA,GAAgB,UAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.mts","names":[],"sources":["../../src/lib/config.ts"],"
|
|
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,aAAA,UACA,GAAA,WACC,OAAA,CAAQ,eAAA;;;;;;;;;;;;;iBAyBW,kBAAA,CACpB,WAAA,UACA,aAAA,UACA,IAAA,EAAM,IAAA,EACN,OAAA,GAAU,iBAAA,EACV,IAAA,WACA,UAAA,WACA,SAAA,YACC,OAAA,CAAQ,gBAAA;AApCX;;;;;;AAAA,iBA+LgB,YAAA,CAAa,MAAA,EAAQ,aAAA,GAAgB,UAAA;AAAA"}
|
package/dist/lib/config.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import { camelCase } from "@stryke/string-format/camel-case";
|
|
|
7
7
|
import { isFunction } from "@stryke/type-checks/is-function";
|
|
8
8
|
import { isSetObject } from "@stryke/type-checks/is-set-object";
|
|
9
9
|
import { loadConfig } from "c12";
|
|
10
|
-
import defu
|
|
10
|
+
import defu from "defu";
|
|
11
11
|
|
|
12
12
|
//#region src/lib/config.ts
|
|
13
13
|
/**
|
|
@@ -18,7 +18,7 @@ import defu$1 from "defu";
|
|
|
18
18
|
* @returns A promise that resolves to the loaded workspace configuration.
|
|
19
19
|
*/
|
|
20
20
|
async function loadWorkspaceConfig(workspaceRoot, cwd) {
|
|
21
|
-
return defu
|
|
21
|
+
return defu({ workspaceRoot }, await getWorkspaceConfig(true, {
|
|
22
22
|
cwd,
|
|
23
23
|
workspaceRoot,
|
|
24
24
|
useDefault: true
|
|
@@ -67,7 +67,7 @@ async function loadUserConfigFile(projectRoot, workspaceRoot, jiti, command, mod
|
|
|
67
67
|
dotenv: true,
|
|
68
68
|
jiti
|
|
69
69
|
});
|
|
70
|
-
return defu
|
|
70
|
+
return defu(resolvedUserConfig, isSetObject(result?.config) ? {
|
|
71
71
|
...result.config,
|
|
72
72
|
...result
|
|
73
73
|
} : {});
|
package/dist/lib/config.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.mjs","names":["defu","resolvedUserConfig: Partial<ParsedUserConfig>","resolvedUserConfigFile: string | undefined","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 PowerlinesCommand,\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 workspaceRoot - The root directory of the workspace.\n * @param cwd - 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 workspaceRoot: string,\n cwd: string\n): Promise<WorkspaceConfig> {\n return defu(\n {\n workspaceRoot\n },\n await getWorkspaceConfig(true, {\n cwd,\n workspaceRoot,\n useDefault: true\n })\n );\n}\n\n/**\n * Loads the user configuration file for the project.\n *\n * @param projectRoot - The root directory of the project.\n * @param workspaceRoot - The root directory of the workspace.\n * @param jiti - An instance of Jiti to resolve modules from\n * @param command - The {@link PowerlinesCommand} string associated with the current running process\n * @param mode - The mode in which the project is running (default is \"production\").\n * @param configFile - An optional path to a specific configuration file.\n * @param framework - The framework name to use for default configuration file names.\n * @returns A promise that resolves to the resolved user configuration.\n */\nexport async function loadUserConfigFile(\n projectRoot: string,\n workspaceRoot: string,\n jiti: Jiti,\n command?: PowerlinesCommand,\n mode = \"production\",\n configFile?: string,\n framework = \"powerlines\"\n): Promise<ParsedUserConfig> {\n let resolvedUserConfig: Partial<ParsedUserConfig> = {};\n\n let resolvedUserConfigFile: string | undefined;\n if (configFile) {\n resolvedUserConfigFile = existsSync(replacePath(configFile, projectRoot))\n ? replacePath(configFile, projectRoot)\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n replacePath(configFile, projectRoot)\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n replacePath(configFile, projectRoot)\n )\n : existsSync(\n joinPaths(appendPath(projectRoot, workspaceRoot), configFile)\n )\n ? joinPaths(appendPath(projectRoot, workspaceRoot), configFile)\n : undefined;\n }\n\n if (!resolvedUserConfigFile) {\n resolvedUserConfigFile = existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.ts`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.ts`\n )\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.js`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.js`\n )\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.mts`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.mts`\n )\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.mjs`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.mjs`\n )\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.ts`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.ts`\n )\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.js`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.js`\n )\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.mts`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.mts`\n )\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.mjs`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.mjs`\n )\n : undefined;\n }\n\n if (resolvedUserConfigFile) {\n const resolved = await jiti.import(jiti.esmResolve(resolvedUserConfigFile));\n if (resolved) {\n let config = {};\n if (isFunction(resolved)) {\n config = await Promise.resolve(\n resolved({\n command,\n mode,\n isSsrBuild: false,\n isPreview: false\n })\n );\n }\n\n if (isSetObject(config)) {\n resolvedUserConfig = {\n ...config,\n config: config as UserConfig,\n configFile: resolvedUserConfigFile\n };\n }\n }\n }\n\n const result = await loadConfigC12({\n cwd: projectRoot,\n name: framework,\n envName: mode,\n globalRc: true,\n packageJson: camelCase(framework),\n dotenv: true,\n jiti\n });\n\n return defu(\n resolvedUserConfig,\n isSetObject(result?.config) ? { ...result.config, ...result } : {}\n ) as ParsedUserConfig;\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 and returns it typed as a {@link UserConfig} object.\n */\nexport function defineConfig(config: AnyUserConfig): UserConfig {\n return config as any;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqDA,eAAsB,oBACpB,eACA,KAC0B;AAC1B,QAAOA,OACL,EACE,eACD,EACD,MAAM,mBAAmB,MAAM;EAC7B;EACA;EACA,YAAY;EACb,CAAC,CACH;;;;;;;;;;;;;;AAeH,eAAsB,mBACpB,aACA,eACA,MACA,SACA,OAAO,cACP,YACA,YAAY,cACe;CAC3B,IAAIC,qBAAgD,EAAE;CAEtD,IAAIC;AACJ,KAAI,WACF,0BAAyB,WAAW,YAAY,YAAY,YAAY,CAAC,GACrE,YAAY,YAAY,YAAY,GACpC,WACI,U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ACd,GACD;AAGpB,KAAI,wBAAwB;EAC1B,MAAM,WAAW,MAAM,KAAK,OAAO,KAAK,WAAW,uBAAuB,CAAC;AAC3E,MAAI,UAAU;GACZ,IAAI,SAAS,EAAE;AACf,OAAI,WAAW,SAAS,CACtB,UAAS,MAAM,QAAQ,QACrB,SAAS;IACP;IACA;IACA,YAAY;IACZ,WAAW;IACZ,CAAC,CACH;AAGH,OAAI,YAAY,OAAO,CACrB,sBAAqB;IACnB,GAAG;IACK;IACR,YAAY;IACb;;;CAKP,MAAM,SAAS,MAAMC,WAAc;EACjC,KAAK;EACL,MAAM;EACN,SAAS;EACT,UAAU;EACV,aAAa,UAAU,UAAU;EACjC,QAAQ;EACR;EACD,CAAC;AAEF,QAAOH,OACL,oBACA,YAAY,QAAQ,OAAO,GAAG;EAAE,GAAG,OAAO;EAAQ,GAAG;EAAQ,GAAG,EAAE,CACnE;;;;;;;;AASH,SAAgB,aAAa,QAAmC;AAC9D,QAAO"}
|
|
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 PowerlinesCommand,\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 workspaceRoot - The root directory of the workspace.\n * @param cwd - 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 workspaceRoot: string,\n cwd: string\n): Promise<WorkspaceConfig> {\n return defu(\n {\n workspaceRoot\n },\n await getWorkspaceConfig(true, {\n cwd,\n workspaceRoot,\n useDefault: true\n })\n );\n}\n\n/**\n * Loads the user configuration file for the project.\n *\n * @param projectRoot - The root directory of the project.\n * @param workspaceRoot - The root directory of the workspace.\n * @param jiti - An instance of Jiti to resolve modules from\n * @param command - The {@link PowerlinesCommand} string associated with the current running process\n * @param mode - The mode in which the project is running (default is \"production\").\n * @param configFile - An optional path to a specific configuration file.\n * @param framework - The framework name to use for default configuration file names.\n * @returns A promise that resolves to the resolved user configuration.\n */\nexport async function loadUserConfigFile(\n projectRoot: string,\n workspaceRoot: string,\n jiti: Jiti,\n command?: PowerlinesCommand,\n mode = \"production\",\n configFile?: string,\n framework = \"powerlines\"\n): Promise<ParsedUserConfig> {\n let resolvedUserConfig: Partial<ParsedUserConfig> = {};\n\n let resolvedUserConfigFile: string | undefined;\n if (configFile) {\n resolvedUserConfigFile = existsSync(replacePath(configFile, projectRoot))\n ? replacePath(configFile, projectRoot)\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n replacePath(configFile, projectRoot)\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n replacePath(configFile, projectRoot)\n )\n : existsSync(\n joinPaths(appendPath(projectRoot, workspaceRoot), configFile)\n )\n ? joinPaths(appendPath(projectRoot, workspaceRoot), configFile)\n : undefined;\n }\n\n if (!resolvedUserConfigFile) {\n resolvedUserConfigFile = existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.ts`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.ts`\n )\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.js`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.js`\n )\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.mts`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.mts`\n )\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.mjs`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.${mode}.config.mjs`\n )\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.ts`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.ts`\n )\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.js`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.js`\n )\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.mts`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.mts`\n )\n : existsSync(\n joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.mjs`\n )\n )\n ? joinPaths(\n appendPath(projectRoot, workspaceRoot),\n `${framework}.config.mjs`\n )\n : undefined;\n }\n\n if (resolvedUserConfigFile) {\n const resolved = await jiti.import(jiti.esmResolve(resolvedUserConfigFile));\n if (resolved) {\n let config = {};\n if (isFunction(resolved)) {\n config = await Promise.resolve(\n resolved({\n command,\n mode,\n isSsrBuild: false,\n isPreview: false\n })\n );\n }\n\n if (isSetObject(config)) {\n resolvedUserConfig = {\n ...config,\n config: config as UserConfig,\n configFile: resolvedUserConfigFile\n };\n }\n }\n }\n\n const result = await loadConfigC12({\n cwd: projectRoot,\n name: framework,\n envName: mode,\n globalRc: true,\n packageJson: camelCase(framework),\n dotenv: true,\n jiti\n });\n\n return defu(\n resolvedUserConfig,\n isSetObject(result?.config) ? { ...result.config, ...result } : {}\n ) as ParsedUserConfig;\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 and returns it typed as a {@link UserConfig} object.\n */\nexport function defineConfig(config: AnyUserConfig): UserConfig {\n return config as any;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqDA,eAAsB,oBACpB,eACA,KAC0B;AAC1B,QAAO,KACL,EACE,eACD,EACD,MAAM,mBAAmB,MAAM;EAC7B;EACA;EACA,YAAY;EACb,CAAC,CACH;;;;;;;;;;;;;;AAeH,eAAsB,mBACpB,aACA,eACA,MACA,SACA,OAAO,cACP,YACA,YAAY,cACe;CAC3B,IAAI,qBAAgD,EAAE;CAEtD,IAAI;AACJ,KAAI,WACF,0BAAyB,WAAW,YAAY,YAAY,YAAY,CAAC,GACrE,YAAY,YAAY,YAAY,GACpC,WACI,UACE,WAAW,aAAa,cAAc,EACtC,YAAY,YAAY,YAAY,CACrC,CACF,GACD,UACE,WAAW,aAAa,cAAc,EACtC,YAAY,YAAY,YAAY,CACrC,GACD,WACI,UAAU,WAAW,aAAa,cAAc,EAAE,WAAW,CAC9D,GACD,UAAU,WAAW,aAAa,cAAc,EAAE,WAAW,GAC7D;AAGV,KAAI,CAAC,u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,CAAC,CACH;AAGH,OAAI,YAAY,OAAO,CACrB,sBAAqB;IACnB,GAAG;IACK;IACR,YAAY;IACb;;;CAKP,MAAM,SAAS,MAAMA,WAAc;EACjC,KAAK;EACL,MAAM;EACN,SAAS;EACT,UAAU;EACV,aAAa,UAAU,UAAU;EACjC,QAAQ;EACR;EACD,CAAC;AAEF,QAAO,KACL,oBACA,YAAY,QAAQ,OAAO,GAAG;EAAE,GAAG,OAAO;EAAQ,GAAG;EAAQ,GAAG,EAAE,CACnE;;;;;;;;AASH,SAAgB,aAAa,QAAmC;AAC9D,QAAO"}
|
package/dist/lib/entry.cjs
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
2
3
|
const require_plugin_utils_paths = require('../plugin-utils/paths.cjs');
|
|
3
|
-
let
|
|
4
|
-
let
|
|
5
|
-
let
|
|
6
|
-
let
|
|
7
|
-
let
|
|
8
|
-
let
|
|
9
|
-
let
|
|
10
|
-
let
|
|
11
|
-
let
|
|
12
|
-
let
|
|
13
|
-
let
|
|
4
|
+
let _stryke_path_append = require("@stryke/path/append");
|
|
5
|
+
let _stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
6
|
+
let _stryke_path_replace = require("@stryke/path/replace");
|
|
7
|
+
let _stryke_convert_parse_type_definition = require("@stryke/convert/parse-type-definition");
|
|
8
|
+
let _stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
9
|
+
let _stryke_hash = require("@stryke/hash");
|
|
10
|
+
let _stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
|
|
11
|
+
let _stryke_path_is_type = require("@stryke/path/is-type");
|
|
12
|
+
let _stryke_type_checks_is_object = require("@stryke/type-checks/is-object");
|
|
13
|
+
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
14
|
+
let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
|
|
14
15
|
|
|
15
16
|
//#region src/lib/entry.ts
|
|
16
17
|
function resolveEntryOutput(context, typeDefinition) {
|
|
17
|
-
return (0,
|
|
18
|
+
return (0, _stryke_path_replace.replaceExtension)((0, _stryke_path_replace.replacePath)((0, _stryke_path_replace.replacePath)((0, _stryke_path_replace.replacePath)((0, _stryke_path_replace.replacePath)((0, _stryke_path_replace.replacePath)(typeDefinition.file, (0, _stryke_path_join_paths.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root, "src")), (0, _stryke_path_join_paths.joinPaths)(context.workspaceConfig.workspaceRoot, context.config.root)), (0, _stryke_path_join_paths.joinPaths)(context.config.root, "src")), context.config.root), "src"));
|
|
18
19
|
}
|
|
19
20
|
function resolveInput(context, typeDefinition, input, output) {
|
|
20
21
|
return {
|
|
21
22
|
...typeDefinition,
|
|
22
|
-
input: (0,
|
|
23
|
+
input: (0, _stryke_type_checks_is_set_string.isSetString)(input) ? { file: String(input) } : typeDefinition,
|
|
23
24
|
output: output || resolveEntryOutput(context, typeDefinition)
|
|
24
25
|
};
|
|
25
26
|
}
|
|
@@ -31,25 +32,25 @@ function resolveInput(context, typeDefinition, input, output) {
|
|
|
31
32
|
* @returns A promise that resolves to an array of resolved entry type definitions.
|
|
32
33
|
*/
|
|
33
34
|
async function resolveInputs(context, typeDefinitions) {
|
|
34
|
-
return (await Promise.all(((0,
|
|
35
|
+
return (await Promise.all(((0, _stryke_type_checks_is_object.isObject)(typeDefinitions) && !isTypeDefinition(typeDefinitions) ? Object.values(typeDefinitions).flat() : (0, _stryke_convert_to_array.toArray)(typeDefinitions)).map(async (entry) => {
|
|
35
36
|
if (isResolvedEntryTypeDefinition(entry)) return {
|
|
36
37
|
...entry,
|
|
37
38
|
output: entry.output ? require_plugin_utils_paths.replacePathTokens(context, entry.output) : void 0,
|
|
38
39
|
file: require_plugin_utils_paths.replacePathTokens(context, entry.file)
|
|
39
40
|
};
|
|
40
41
|
let typeDefinition;
|
|
41
|
-
if ((0,
|
|
42
|
+
if ((0, _stryke_type_checks_is_string.isString)(entry)) typeDefinition = (0, _stryke_convert_parse_type_definition.parseTypeDefinition)(require_plugin_utils_paths.replacePathTokens(context, entry));
|
|
42
43
|
else {
|
|
43
44
|
typeDefinition = entry;
|
|
44
45
|
typeDefinition.file = require_plugin_utils_paths.replacePathTokens(context, typeDefinition.file);
|
|
45
46
|
}
|
|
46
|
-
const filePath = (0,
|
|
47
|
+
const filePath = (0, _stryke_path_is_type.isAbsolutePath)(typeDefinition.file) ? typeDefinition.file : (0, _stryke_path_append.appendPath)(typeDefinition.file, context.config.root);
|
|
47
48
|
if (await context.fs.isFile(filePath)) return resolveInput(context, {
|
|
48
|
-
file: (0,
|
|
49
|
+
file: (0, _stryke_path_replace.replacePath)(filePath, context.config.root),
|
|
49
50
|
name: typeDefinition.name
|
|
50
51
|
}, entry.input, entry.output);
|
|
51
|
-
return (await context.fs.glob((0,
|
|
52
|
-
file: (0,
|
|
52
|
+
return (await context.fs.glob((0, _stryke_path_append.appendPath)(filePath, context.workspaceConfig.workspaceRoot))).map((file) => resolveInput(context, {
|
|
53
|
+
file: (0, _stryke_path_replace.replacePath)(file, context.config.root),
|
|
53
54
|
name: typeDefinition.name
|
|
54
55
|
}, entry.input, entry.output));
|
|
55
56
|
}).flat().filter(Boolean))).flat();
|
|
@@ -62,24 +63,24 @@ async function resolveInputs(context, typeDefinitions) {
|
|
|
62
63
|
* @returns A promise that resolves to an array of resolved entry type definitions.
|
|
63
64
|
*/
|
|
64
65
|
function resolveInputsSync(context, typeDefinitions) {
|
|
65
|
-
return ((0,
|
|
66
|
+
return ((0, _stryke_type_checks_is_object.isObject)(typeDefinitions) && !isTypeDefinition(typeDefinitions) ? Object.values(typeDefinitions).flat() : (0, _stryke_convert_to_array.toArray)(typeDefinitions)).map((entry) => {
|
|
66
67
|
if (isResolvedEntryTypeDefinition(entry)) return {
|
|
67
68
|
...entry,
|
|
68
69
|
output: entry.output ? require_plugin_utils_paths.replacePathTokens(context, entry.output) : void 0,
|
|
69
70
|
file: require_plugin_utils_paths.replacePathTokens(context, entry.file)
|
|
70
71
|
};
|
|
71
72
|
let typeDefinition;
|
|
72
|
-
if ((0,
|
|
73
|
+
if ((0, _stryke_type_checks_is_string.isString)(entry)) typeDefinition = (0, _stryke_convert_parse_type_definition.parseTypeDefinition)(require_plugin_utils_paths.replacePathTokens(context, entry));
|
|
73
74
|
else {
|
|
74
75
|
typeDefinition = entry;
|
|
75
76
|
typeDefinition.file = require_plugin_utils_paths.replacePathTokens(context, typeDefinition.file);
|
|
76
77
|
}
|
|
77
|
-
const filePath = (0,
|
|
78
|
+
const filePath = (0, _stryke_path_is_type.isAbsolutePath)(typeDefinition.file) ? typeDefinition.file : (0, _stryke_path_append.appendPath)(typeDefinition.file, context.config.root);
|
|
78
79
|
if (context.fs.isFileSync(filePath)) return resolveInput(context, {
|
|
79
|
-
file: (0,
|
|
80
|
+
file: (0, _stryke_path_append.appendPath)(filePath, context.workspaceConfig.workspaceRoot),
|
|
80
81
|
name: typeDefinition.name
|
|
81
82
|
});
|
|
82
|
-
return context.fs.globSync((0,
|
|
83
|
+
return context.fs.globSync((0, _stryke_path_append.appendPath)(filePath, context.workspaceConfig.workspaceRoot)).map((file) => resolveInput(context, {
|
|
83
84
|
file,
|
|
84
85
|
name: typeDefinition.name
|
|
85
86
|
}));
|
|
@@ -92,7 +93,7 @@ function resolveInputsSync(context, typeDefinitions) {
|
|
|
92
93
|
* @returns True if the entry is a type definition, false otherwise.
|
|
93
94
|
*/
|
|
94
95
|
function isTypeDefinition(entry) {
|
|
95
|
-
return !(0,
|
|
96
|
+
return !(0, _stryke_type_checks_is_string.isString)(entry) && entry.file !== void 0;
|
|
96
97
|
}
|
|
97
98
|
/**
|
|
98
99
|
* Checks if the provided entry is a resolved entry type definition.
|
|
@@ -110,7 +111,7 @@ function isResolvedEntryTypeDefinition(entry) {
|
|
|
110
111
|
* @returns An array of unique inputs (by file path or content hash).
|
|
111
112
|
*/
|
|
112
113
|
function getUniqueInputs(inputs = []) {
|
|
113
|
-
return (0,
|
|
114
|
+
return (0, _stryke_type_checks_is_object.isObject)(inputs) ? inputs : (0, _stryke_helpers_get_unique.getUniqueBy)((0, _stryke_convert_to_array.toArray)(inputs), (item) => (0, _stryke_type_checks_is_set_string.isSetString)(item) ? item : (0, _stryke_hash.murmurhash)(item ?? {}, { maxLength: 24 }));
|
|
114
115
|
}
|
|
115
116
|
|
|
116
117
|
//#endregion
|
package/dist/lib/entry.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry.d.cts","names":[],"sources":["../../src/lib/entry.ts"],"
|
|
1
|
+
{"version":3,"file":"entry.d.cts","names":[],"sources":["../../src/lib/entry.ts"],"mappings":";;;;;iBAsCgB,kBAAA,CACd,OAAA,EAAS,OAAA,EACT,cAAA,EAAgB,cAAA;AAAA,iBA6BF,YAAA,CACd,OAAA,EAAS,OAAA,EACT,cAAA,EAAgB,cAAA,EAChB,KAAA,GAAQ,uBAAA,EACR,MAAA,YACC,2BAAA;;;;;;;;iBAemB,aAAA,CACpB,OAAA,EAAS,OAAA,EACT,eAAA,EACI,uBAAA,GACA,uBAAA,KACA,MAAA,SAAe,uBAAA,GAA0B,uBAAA,MAC5C,OAAA,CAAQ,2BAAA;;AA1BX;;;;;;iBAqGgB,iBAAA,CACd,OAAA,EAAS,OAAA,EACT,eAAA,EACI,uBAAA,GACA,uBAAA,KACA,MAAA,SAAe,uBAAA,GAA0B,uBAAA,MAC5C,2BAAA;;;;;;;iBAwDa,gBAAA,CAAiB,KAAA,QAAa,KAAA,IAAS,cAAA;;;;;;AA/IvD;iBAyJgB,6BAAA,CACd,KAAA,EAAO,uBAAA,GAA0B,2BAAA,GAChC,KAAA,IAAS,2BAAA;;;;;;;iBAaI,eAAA,CAAgB,MAAA,GAAQ,MAAA,YAAuB,MAAA"}
|
package/dist/lib/entry.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Context } from "../types/context.mjs";
|
|
2
2
|
import { Config, ResolvedEntryTypeDefinition } from "../types/config.mjs";
|
|
3
|
-
import "../types/index.mjs";
|
|
4
3
|
import { TypeDefinition, TypeDefinitionParameter } from "@stryke/types/configuration";
|
|
5
4
|
|
|
6
5
|
//#region src/lib/entry.d.ts
|
package/dist/lib/entry.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry.d.mts","names":[],"sources":["../../src/lib/entry.ts"],"
|
|
1
|
+
{"version":3,"file":"entry.d.mts","names":[],"sources":["../../src/lib/entry.ts"],"mappings":";;;;;iBAsCgB,kBAAA,CACd,OAAA,EAAS,OAAA,EACT,cAAA,EAAgB,cAAA;AAAA,iBA6BF,YAAA,CACd,OAAA,EAAS,OAAA,EACT,cAAA,EAAgB,cAAA,EAChB,KAAA,GAAQ,uBAAA,EACR,MAAA,YACC,2BAAA;AApCH;;;;;;;AAAA,iBAmDsB,aAAA,CACpB,OAAA,EAAS,OAAA,EACT,eAAA,EACI,uBAAA,GACA,uBAAA,KACA,MAAA,SAAe,uBAAA,GAA0B,uBAAA,MAC5C,OAAA,CAAQ,2BAAA;;;AA1BX;;;;;iBAqGgB,iBAAA,CACd,OAAA,EAAS,OAAA,EACT,eAAA,EACI,uBAAA,GACA,uBAAA,KACA,MAAA,SAAe,uBAAA,GAA0B,uBAAA,MAC5C,2BAAA;;;;;;;iBAwDa,gBAAA,CAAiB,KAAA,QAAa,KAAA,IAAS,cAAA;;;;;;;iBAUvC,6BAAA,CACd,KAAA,EAAO,uBAAA,GAA0B,2BAAA,GAChC,KAAA,IAAS,2BAAA;;;;;;;iBAaI,eAAA,CAAgB,MAAA,GAAQ,MAAA,YAAuB,MAAA"}
|
package/dist/lib/entry.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entry.mjs","names":["typeDefinition: TypeDefinition"],"sources":["../../src/lib/entry.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 { parseTypeDefinition } from \"@stryke/convert/parse-type-definition\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { murmurhash } from \"@stryke/hash\";\nimport { getUniqueBy } from \"@stryke/helpers/get-unique\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { isAbsolutePath } from \"@stryke/path/is-type\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replaceExtension, replacePath } from \"@stryke/path/replace\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport type {\n TypeDefinition,\n TypeDefinitionParameter\n} from \"@stryke/types/configuration\";\nimport { replacePathTokens } from \"../plugin-utils/paths\";\nimport { Config } from \"../types\";\nimport { ResolvedEntryTypeDefinition } from \"../types/config\";\nimport type { Context } from \"../types/context\";\n\nexport function resolveEntryOutput(\n context: Context,\n typeDefinition: TypeDefinition\n): string {\n return replaceExtension(\n replacePath(\n replacePath(\n replacePath(\n replacePath(\n replacePath(\n typeDefinition.file,\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n \"src\"\n )\n ),\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root\n )\n ),\n joinPaths(context.config.root, \"src\")\n ),\n context.config.root\n ),\n \"src\"\n )\n );\n}\n\nexport function resolveInput(\n context: Context,\n typeDefinition: TypeDefinition,\n input?: TypeDefinitionParameter,\n output?: string\n): ResolvedEntryTypeDefinition {\n return {\n ...typeDefinition,\n input: isSetString(input) ? { file: String(input) } : typeDefinition,\n output: output || resolveEntryOutput(context, typeDefinition)\n };\n}\n\n/**\n * Resolves multiple type definitions into their corresponding resolved entry type definitions.\n *\n * @param context - The current context\n * @param typeDefinitions - The type definitions to resolve.\n * @returns A promise that resolves to an array of resolved entry type definitions.\n */\nexport async function resolveInputs(\n context: Context,\n typeDefinitions:\n | TypeDefinitionParameter\n | TypeDefinitionParameter[]\n | Record<string, TypeDefinitionParameter | TypeDefinitionParameter[]>\n): Promise<ResolvedEntryTypeDefinition[]> {\n return (\n await Promise.all(\n (isObject(typeDefinitions) && !isTypeDefinition(typeDefinitions)\n ? Object.values(typeDefinitions).flat()\n : toArray(typeDefinitions)\n )\n .map(async entry => {\n if (isResolvedEntryTypeDefinition(entry)) {\n return {\n ...entry,\n output: entry.output\n ? replacePathTokens(context, entry.output)\n : undefined,\n file: replacePathTokens(context, entry.file)\n };\n }\n\n let typeDefinition: TypeDefinition;\n if (isString(entry)) {\n typeDefinition = parseTypeDefinition(\n replacePathTokens(context, entry)\n )!;\n } else {\n typeDefinition = entry;\n typeDefinition.file = replacePathTokens(\n context,\n typeDefinition.file\n );\n }\n\n const filePath = isAbsolutePath(typeDefinition.file)\n ? typeDefinition.file\n : appendPath(typeDefinition.file, context.config.root);\n if (await context.fs.isFile(filePath)) {\n return resolveInput(\n context,\n {\n file: replacePath(filePath, context.config.root),\n name: typeDefinition.name\n },\n (entry as ResolvedEntryTypeDefinition).input,\n (entry as ResolvedEntryTypeDefinition).output\n );\n }\n\n return (\n await context.fs.glob(\n appendPath(filePath, context.workspaceConfig.workspaceRoot)\n )\n ).map(file =>\n resolveInput(\n context,\n {\n file: replacePath(file, context.config.root),\n name: typeDefinition.name\n },\n (entry as ResolvedEntryTypeDefinition).input,\n (entry as ResolvedEntryTypeDefinition).output\n )\n );\n })\n .flat()\n .filter(Boolean)\n )\n ).flat();\n}\n\n/**\n * Resolves multiple type definitions into their corresponding resolved entry type definitions.\n *\n * @param context - The current context\n * @param typeDefinitions - The type definitions to resolve.\n * @returns A promise that resolves to an array of resolved entry type definitions.\n */\nexport function resolveInputsSync(\n context: Context,\n typeDefinitions:\n | TypeDefinitionParameter\n | TypeDefinitionParameter[]\n | Record<string, TypeDefinitionParameter | TypeDefinitionParameter[]>\n): ResolvedEntryTypeDefinition[] {\n return (\n isObject(typeDefinitions) && !isTypeDefinition(typeDefinitions)\n ? Object.values(typeDefinitions).flat()\n : toArray(typeDefinitions)\n )\n .map(entry => {\n if (isResolvedEntryTypeDefinition(entry)) {\n return {\n ...entry,\n output: entry.output\n ? replacePathTokens(context, entry.output)\n : undefined,\n file: replacePathTokens(context, entry.file)\n };\n }\n\n let typeDefinition: TypeDefinition;\n if (isString(entry)) {\n typeDefinition = parseTypeDefinition(\n replacePathTokens(context, entry)\n )!;\n } else {\n typeDefinition = entry;\n typeDefinition.file = replacePathTokens(context, typeDefinition.file);\n }\n\n const filePath = isAbsolutePath(typeDefinition.file)\n ? typeDefinition.file\n : appendPath(typeDefinition.file, context.config.root);\n if (context.fs.isFileSync(filePath)) {\n return resolveInput(context, {\n file: appendPath(filePath, context.workspaceConfig.workspaceRoot),\n name: typeDefinition.name\n });\n }\n\n return context.fs\n .globSync(appendPath(filePath, context.workspaceConfig.workspaceRoot))\n .map(file =>\n resolveInput(context, {\n file,\n name: typeDefinition.name\n })\n );\n })\n .flat()\n .filter(Boolean);\n}\n\n/**\n * Checks if the provided entry is a type definition.\n *\n * @param entry - The entry to check.\n * @returns True if the entry is a type definition, false otherwise.\n */\nexport function isTypeDefinition(entry: any): entry is TypeDefinition {\n return !isString(entry) && entry.file !== undefined;\n}\n\n/**\n * Checks if the provided entry is a resolved entry type definition.\n *\n * @param entry - The entry to check.\n * @returns True if the entry is a resolved entry type definition, false otherwise.\n */\nexport function isResolvedEntryTypeDefinition(\n entry: TypeDefinitionParameter | ResolvedEntryTypeDefinition\n): entry is ResolvedEntryTypeDefinition {\n return (\n isTypeDefinition(entry) &&\n (entry as ResolvedEntryTypeDefinition).output !== undefined\n );\n}\n\n/**\n * Get unique inputs from the provided list.\n *\n * @param inputs - The entry points to process.\n * @returns An array of unique inputs (by file path or content hash).\n */\nexport function getUniqueInputs(inputs: Config[\"input\"] = []): Config[\"input\"] {\n return isObject(inputs)\n ? inputs\n : getUniqueBy(toArray(inputs), (item: TypeDefinitionParameter) =>\n isSetString(item) ? item : murmurhash(item ?? {}, { maxLength: 24 })\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAsCA,SAAgB,mBACd,SACA,gBACQ;AACR,QAAO,iBACL,YACE,YACE,YACE,YACE,YACE,eAAe,MACf,UACE,QAAQ,gBAAgB,eACxB,QAAQ,OAAO,MACf,MACD,CACF,EACD,UACE,QAAQ,gBAAgB,eACxB,QAAQ,OAAO,KAChB,CACF,EACD,UAAU,QAAQ,OAAO,MAAM,MAAM,CACtC,EACD,QAAQ,OAAO,KAChB,EACD,MACD,CACF;;AAGH,SAAgB,aACd,SACA,gBACA,OACA,QAC6B;AAC7B,QAAO;EACL,GAAG;EACH,OAAO,YAAY,MAAM,GAAG,EAAE,MAAM,OAAO,MAAM,EAAE,GAAG;EACtD,QAAQ,UAAU,mBAAmB,SAAS,eAAe;EAC9D;;;;;;;;;AAUH,eAAsB,cACpB,SACA,iBAIwC;AACxC,SACE,MAAM,QAAQ,KACX,SAAS,gBAAgB,IAAI,CAAC,iBAAiB,gBAAgB,GAC5D,OAAO,OAAO,gBAAgB,CAAC,MAAM,GACrC,QAAQ,gBAAgB,EAEzB,IAAI,OAAM,UAAS;AAClB,MAAI,8BAA8B,MAAM,CACtC,QAAO;GACL,GAAG;GACH,QAAQ,MAAM,SACV,kBAAkB,SAAS,MAAM,OAAO,GACxC;GACJ,MAAM,kBAAkB,SAAS,MAAM,KAAK;GAC7C;EAGH,IAAIA;AACJ,MAAI,SAAS,MAAM,CACjB,kBAAiB,oBACf,kBAAkB,SAAS,MAAM,CAClC;OACI;AACL,oBAAiB;AACjB,kBAA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eAAe;GACtB,CAAC;AAGJ,SAAO,QAAQ,GACZ,SAAS,WAAW,UAAU,QAAQ,gBAAgB,cAAc,CAAC,CACrE,KAAI,SACH,aAAa,SAAS;GACpB;GACA,MAAM,eAAe;GACtB,CAAC,CACH;GACH,CACD,MAAM,CACN,OAAO,QAAQ;;;;;;;;AASpB,SAAgB,iBAAiB,OAAqC;AACpE,QAAO,CAAC,SAAS,MAAM,IAAI,MAAM,SAAS;;;;;;;;AAS5C,SAAgB,8BACd,OACsC;AACtC,QACE,iBAAiB,MAAM,IACtB,MAAsC,WAAW;;;;;;;;AAUtD,SAAgB,gBAAgB,SAA0B,EAAE,EAAmB;AAC7E,QAAO,SAAS,OAAO,GACnB,SACA,YAAY,QAAQ,OAAO,GAAG,SAC5B,YAAY,KAAK,GAAG,OAAO,WAAW,QAAQ,EAAE,EAAE,EAAE,WAAW,IAAI,CAAC,CACrE"}
|
|
1
|
+
{"version":3,"file":"entry.mjs","names":[],"sources":["../../src/lib/entry.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 { parseTypeDefinition } from \"@stryke/convert/parse-type-definition\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { murmurhash } from \"@stryke/hash\";\nimport { getUniqueBy } from \"@stryke/helpers/get-unique\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { isAbsolutePath } from \"@stryke/path/is-type\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replaceExtension, replacePath } from \"@stryke/path/replace\";\nimport { isObject } from \"@stryke/type-checks/is-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport type {\n TypeDefinition,\n TypeDefinitionParameter\n} from \"@stryke/types/configuration\";\nimport { replacePathTokens } from \"../plugin-utils/paths\";\nimport { Config } from \"../types\";\nimport { ResolvedEntryTypeDefinition } from \"../types/config\";\nimport type { Context } from \"../types/context\";\n\nexport function resolveEntryOutput(\n context: Context,\n typeDefinition: TypeDefinition\n): string {\n return replaceExtension(\n replacePath(\n replacePath(\n replacePath(\n replacePath(\n replacePath(\n typeDefinition.file,\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root,\n \"src\"\n )\n ),\n joinPaths(\n context.workspaceConfig.workspaceRoot,\n context.config.root\n )\n ),\n joinPaths(context.config.root, \"src\")\n ),\n context.config.root\n ),\n \"src\"\n )\n );\n}\n\nexport function resolveInput(\n context: Context,\n typeDefinition: TypeDefinition,\n input?: TypeDefinitionParameter,\n output?: string\n): ResolvedEntryTypeDefinition {\n return {\n ...typeDefinition,\n input: isSetString(input) ? { file: String(input) } : typeDefinition,\n output: output || resolveEntryOutput(context, typeDefinition)\n };\n}\n\n/**\n * Resolves multiple type definitions into their corresponding resolved entry type definitions.\n *\n * @param context - The current context\n * @param typeDefinitions - The type definitions to resolve.\n * @returns A promise that resolves to an array of resolved entry type definitions.\n */\nexport async function resolveInputs(\n context: Context,\n typeDefinitions:\n | TypeDefinitionParameter\n | TypeDefinitionParameter[]\n | Record<string, TypeDefinitionParameter | TypeDefinitionParameter[]>\n): Promise<ResolvedEntryTypeDefinition[]> {\n return (\n await Promise.all(\n (isObject(typeDefinitions) && !isTypeDefinition(typeDefinitions)\n ? Object.values(typeDefinitions).flat()\n : toArray(typeDefinitions)\n )\n .map(async entry => {\n if (isResolvedEntryTypeDefinition(entry)) {\n return {\n ...entry,\n output: entry.output\n ? replacePathTokens(context, entry.output)\n : undefined,\n file: replacePathTokens(context, entry.file)\n };\n }\n\n let typeDefinition: TypeDefinition;\n if (isString(entry)) {\n typeDefinition = parseTypeDefinition(\n replacePathTokens(context, entry)\n )!;\n } else {\n typeDefinition = entry;\n typeDefinition.file = replacePathTokens(\n context,\n typeDefinition.file\n );\n }\n\n const filePath = isAbsolutePath(typeDefinition.file)\n ? typeDefinition.file\n : appendPath(typeDefinition.file, context.config.root);\n if (await context.fs.isFile(filePath)) {\n return resolveInput(\n context,\n {\n file: replacePath(filePath, context.config.root),\n name: typeDefinition.name\n },\n (entry as ResolvedEntryTypeDefinition).input,\n (entry as ResolvedEntryTypeDefinition).output\n );\n }\n\n return (\n await context.fs.glob(\n appendPath(filePath, context.workspaceConfig.workspaceRoot)\n )\n ).map(file =>\n resolveInput(\n context,\n {\n file: replacePath(file, context.config.root),\n name: typeDefinition.name\n },\n (entry as ResolvedEntryTypeDefinition).input,\n (entry as ResolvedEntryTypeDefinition).output\n )\n );\n })\n .flat()\n .filter(Boolean)\n )\n ).flat();\n}\n\n/**\n * Resolves multiple type definitions into their corresponding resolved entry type definitions.\n *\n * @param context - The current context\n * @param typeDefinitions - The type definitions to resolve.\n * @returns A promise that resolves to an array of resolved entry type definitions.\n */\nexport function resolveInputsSync(\n context: Context,\n typeDefinitions:\n | TypeDefinitionParameter\n | TypeDefinitionParameter[]\n | Record<string, TypeDefinitionParameter | TypeDefinitionParameter[]>\n): ResolvedEntryTypeDefinition[] {\n return (\n isObject(typeDefinitions) && !isTypeDefinition(typeDefinitions)\n ? Object.values(typeDefinitions).flat()\n : toArray(typeDefinitions)\n )\n .map(entry => {\n if (isResolvedEntryTypeDefinition(entry)) {\n return {\n ...entry,\n output: entry.output\n ? replacePathTokens(context, entry.output)\n : undefined,\n file: replacePathTokens(context, entry.file)\n };\n }\n\n let typeDefinition: TypeDefinition;\n if (isString(entry)) {\n typeDefinition = parseTypeDefinition(\n replacePathTokens(context, entry)\n )!;\n } else {\n typeDefinition = entry;\n typeDefinition.file = replacePathTokens(context, typeDefinition.file);\n }\n\n const filePath = isAbsolutePath(typeDefinition.file)\n ? typeDefinition.file\n : appendPath(typeDefinition.file, context.config.root);\n if (context.fs.isFileSync(filePath)) {\n return resolveInput(context, {\n file: appendPath(filePath, context.workspaceConfig.workspaceRoot),\n name: typeDefinition.name\n });\n }\n\n return context.fs\n .globSync(appendPath(filePath, context.workspaceConfig.workspaceRoot))\n .map(file =>\n resolveInput(context, {\n file,\n name: typeDefinition.name\n })\n );\n })\n .flat()\n .filter(Boolean);\n}\n\n/**\n * Checks if the provided entry is a type definition.\n *\n * @param entry - The entry to check.\n * @returns True if the entry is a type definition, false otherwise.\n */\nexport function isTypeDefinition(entry: any): entry is TypeDefinition {\n return !isString(entry) && entry.file !== undefined;\n}\n\n/**\n * Checks if the provided entry is a resolved entry type definition.\n *\n * @param entry - The entry to check.\n * @returns True if the entry is a resolved entry type definition, false otherwise.\n */\nexport function isResolvedEntryTypeDefinition(\n entry: TypeDefinitionParameter | ResolvedEntryTypeDefinition\n): entry is ResolvedEntryTypeDefinition {\n return (\n isTypeDefinition(entry) &&\n (entry as ResolvedEntryTypeDefinition).output !== undefined\n );\n}\n\n/**\n * Get unique inputs from the provided list.\n *\n * @param inputs - The entry points to process.\n * @returns An array of unique inputs (by file path or content hash).\n */\nexport function getUniqueInputs(inputs: Config[\"input\"] = []): Config[\"input\"] {\n return isObject(inputs)\n ? inputs\n : getUniqueBy(toArray(inputs), (item: TypeDefinitionParameter) =>\n isSetString(item) ? item : murmurhash(item ?? {}, { maxLength: 24 })\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAsCA,SAAgB,mBACd,SACA,gBACQ;AACR,QAAO,iBACL,YACE,YACE,YACE,YACE,YACE,eAAe,MACf,UACE,QAAQ,gBAAgB,eACxB,QAAQ,OAAO,MACf,MACD,CACF,EACD,UACE,QAAQ,gBAAgB,eACxB,QAAQ,OAAO,KAChB,CACF,EACD,UAAU,QAAQ,OAAO,MAAM,MAAM,CACtC,EACD,QAAQ,OAAO,KAChB,EACD,MACD,CACF;;AAG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.d.mts
CHANGED
|
@@ -4,11 +4,9 @@ import { CreateLogOptions, __ΩCreateLogOptions, createLog, extendLog } from "./
|
|
|
4
4
|
import { combineContexts, isUnpluginBuilderVariant } from "./unplugin/helpers.mjs";
|
|
5
5
|
import { CreateUnpluginModuleResolutionFunctionsOptions, __ΩCreateUnpluginModuleResolutionFunctionsOptions, createUnpluginModuleResolutionFunctions } from "./unplugin/module-resolution.mjs";
|
|
6
6
|
import { CreateUnpluginOptions, CreateUnpluginResolverOptions, __ΩCreateUnpluginOptions, __ΩCreateUnpluginResolverOptions, createUnplugin, createUnpluginResolver } from "./unplugin/plugin.mjs";
|
|
7
|
-
import "./unplugin/index.mjs";
|
|
8
7
|
import { FileHeaderOptions, __ΩFileHeaderOptions, getFileHeader, getFileHeaderWarning, getFileHeaderWarningText, getTypescriptFileHeader } from "./utilities/file-header.mjs";
|
|
9
8
|
import { format, formatFolder } from "./utilities/format.mjs";
|
|
10
9
|
import { getMagicString, getSourceFile, getString } from "./utilities/source-file.mjs";
|
|
11
10
|
import { generateSourceMap } from "./utilities/source-map.mjs";
|
|
12
11
|
import { writeFile } from "./utilities/write-file.mjs";
|
|
13
|
-
import "./utilities/index.mjs";
|
|
14
12
|
export { CreateLogOptions, CreateUnpluginModuleResolutionFunctionsOptions, CreateUnpluginOptions, CreateUnpluginResolverOptions, FileHeaderOptions, PartiallyResolvedContext, __ΩCreateLogOptions, __ΩCreateUnpluginModuleResolutionFunctionsOptions, __ΩCreateUnpluginOptions, __ΩCreateUnpluginResolverOptions, __ΩFileHeaderOptions, __ΩPartiallyResolvedContext, combineContexts, createLog, createUnplugin, createUnpluginModuleResolutionFunctions, createUnpluginResolver, defineConfig, extendLog, format, formatFolder, generateSourceMap, getFileHeader, getFileHeaderWarning, getFileHeaderWarningText, getMagicString, getSourceFile, getString, getTypescriptFileHeader, getUniqueInputs, isResolvedEntryTypeDefinition, isTypeDefinition, isUnpluginBuilderVariant, loadUserConfigFile, loadWorkspaceConfig, resolveEntryOutput, resolveInput, resolveInputs, resolveInputsSync, writeFile };
|
package/dist/lib/logger.cjs
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
let
|
|
4
|
-
let
|
|
5
|
-
let
|
|
6
|
-
let
|
|
7
|
-
let
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
let _storm_software_config_tools_logger = require("@storm-software/config-tools/logger");
|
|
4
|
+
let _storm_software_config_tools_types = require("@storm-software/config-tools/types");
|
|
5
|
+
let _storm_software_config_tools_utilities_colors = require("@storm-software/config-tools/utilities/colors");
|
|
6
|
+
let _stryke_helpers_noop = require("@stryke/helpers/noop");
|
|
7
|
+
let _stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
|
|
8
|
+
let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
8
9
|
let chalk = require("chalk");
|
|
9
|
-
chalk =
|
|
10
|
+
chalk = require_runtime.__toESM(chalk);
|
|
10
11
|
|
|
11
12
|
//#region src/lib/logger.ts
|
|
12
13
|
/**
|
|
@@ -17,13 +18,13 @@ chalk = require_rolldown_runtime.__toESM(chalk);
|
|
|
17
18
|
* @returns A logging function.
|
|
18
19
|
*/
|
|
19
20
|
const createLog = (name, options = {}) => {
|
|
20
|
-
const logLevel = options.logLevel === null ?
|
|
21
|
-
if (logLevel ===
|
|
21
|
+
const logLevel = options.logLevel === null ? _storm_software_config_tools_types.LogLevelLabel.SILENT : options.logLevel || _storm_software_config_tools_types.LogLevelLabel.INFO;
|
|
22
|
+
if (logLevel === _storm_software_config_tools_types.LogLevelLabel.SILENT) return _stryke_helpers_noop.noop;
|
|
22
23
|
if (options.customLogger) return options.customLogger;
|
|
23
|
-
return (type, ...args) => (0,
|
|
24
|
+
return (type, ...args) => (0, _storm_software_config_tools_logger.getLogFn)((0, _storm_software_config_tools_logger.getLogLevel)(type), {
|
|
24
25
|
...options,
|
|
25
26
|
logLevel
|
|
26
|
-
})(`${chalk.default.bold.hex((0,
|
|
27
|
+
})(`${chalk.default.bold.hex((0, _storm_software_config_tools_utilities_colors.getColor)("brand", options))(`${name ? (0, _stryke_string_format_kebab_case.kebabCase)(name) : ""}${options.name ? `${name ? chalk.default.gray(" > ") : ""}${(0, _stryke_string_format_kebab_case.kebabCase)(options.name)}` : ""}${chalk.default.gray(" > ")}`)}${args.join(" ")} `.trim());
|
|
27
28
|
};
|
|
28
29
|
const BADGE_COLORS = [
|
|
29
30
|
"#00A0DD",
|
|
@@ -50,7 +51,7 @@ const BADGE_COLORS = [
|
|
|
50
51
|
"#8B5CF6"
|
|
51
52
|
];
|
|
52
53
|
const extendLog = (logFn, name) => {
|
|
53
|
-
return (type, ...args) => logFn(type, ` ${chalk.default.inverse.hex(BADGE_COLORS[name.split("").map((char) => char.charCodeAt(0)).reduce((ret, charCode) => ret + charCode, 0) % BADGE_COLORS.length] || BADGE_COLORS[0])(` ${(0,
|
|
54
|
+
return (type, ...args) => logFn(type, ` ${chalk.default.inverse.hex(BADGE_COLORS[name.split("").map((char) => char.charCodeAt(0)).reduce((ret, charCode) => ret + charCode, 0) % BADGE_COLORS.length] || BADGE_COLORS[0])(` ${(0, _stryke_string_format_title_case.titleCase)(name)} `)} ${args.join(" ")} `);
|
|
54
55
|
};
|
|
55
56
|
|
|
56
57
|
//#endregion
|