@absolutejs/absolute 0.19.0-beta.673 → 0.19.0-beta.674

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.
@@ -1,2 +1,16 @@
1
- import type { ConfigInput } from '../../types/build';
2
- export declare const defineConfig: <TConfig extends ConfigInput>(config: TConfig) => TConfig;
1
+ import type { AbsoluteServiceConfig, CommandServiceConfig, ConfigInput, ReservedConfigKey } from '../../types/build';
2
+ type ServiceName<TConfig> = Extract<keyof TConfig, string>;
3
+ type HasReservedConfigKeys<TConfig> = Extract<ServiceName<TConfig>, ReservedConfigKey> extends never ? false : true;
4
+ type ServiceDependsOn<TConfig, TSelf extends string> = readonly Exclude<ServiceName<TConfig>, TSelf>[];
5
+ type TypedAbsoluteServiceConfig<TConfig, TSelf extends string> = Omit<AbsoluteServiceConfig, 'dependsOn'> & {
6
+ dependsOn?: ServiceDependsOn<TConfig, TSelf>;
7
+ };
8
+ type TypedCommandServiceConfig<TConfig, TSelf extends string> = Omit<CommandServiceConfig, 'dependsOn'> & {
9
+ dependsOn?: ServiceDependsOn<TConfig, TSelf>;
10
+ };
11
+ type TypedWorkspaceConfig<TConfig extends Record<string, unknown>> = {
12
+ [K in keyof TConfig]: K extends string ? TypedAbsoluteServiceConfig<TConfig, K> | TypedCommandServiceConfig<TConfig, K> : never;
13
+ };
14
+ type ValidateConfig<TConfig extends Record<string, unknown>> = HasReservedConfigKeys<TConfig> extends true ? TConfig extends AbsoluteServiceConfig ? TConfig : never : TypedWorkspaceConfig<TConfig>;
15
+ export declare const defineConfig: <const TConfig extends Record<string, unknown>>(config: TConfig & ValidateConfig<TConfig>) => TConfig & ConfigInput;
16
+ export {};
@@ -93,6 +93,7 @@ export type ServiceConfig = AbsoluteServiceConfig | CommandServiceConfig;
93
93
  export type WorkspaceConfig = Record<string, ServiceConfig>;
94
94
  export type BuildConfig = AbsoluteServiceConfig;
95
95
  export type ConfigInput = BuildConfig | WorkspaceConfig;
96
+ export type ReservedConfigKey = keyof BuildConfig;
96
97
  export type BuildResult = ReturnType<typeof build>;
97
98
  export type DevBuildResult = ReturnType<typeof devBuild>;
98
99
  export type Result = BuildResult | DevBuildResult;
package/package.json CHANGED
@@ -302,5 +302,5 @@
302
302
  "typecheck": "bun run src/cli/index.ts typecheck --config example/absolute.config.ts"
303
303
  },
304
304
  "types": "./dist/src/index.d.ts",
305
- "version": "0.19.0-beta.673"
305
+ "version": "0.19.0-beta.674"
306
306
  }