zudoku 0.0.0-z6bcd96da → 0.0.0-z7b86faab

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.
@@ -171,8 +171,8 @@ export declare const FooterSocialSchema: z.ZodObject<{
171
171
  export declare const FooterSchema: z.ZodOptional<z.ZodObject<{
172
172
  columns: z.ZodOptional<z.ZodArray<z.ZodObject<{
173
173
  position: z.ZodOptional<z.ZodEnum<{
174
- center: "center";
175
174
  end: "end";
175
+ center: "center";
176
176
  start: "start";
177
177
  }>>;
178
178
  title: z.ZodString;
@@ -212,8 +212,8 @@ export declare const FooterSchema: z.ZodOptional<z.ZodObject<{
212
212
  href: z.ZodOptional<z.ZodString>;
213
213
  }, z.core.$strip>>;
214
214
  position: z.ZodOptional<z.ZodEnum<{
215
- center: "center";
216
215
  end: "end";
216
+ center: "center";
217
217
  start: "start";
218
218
  }>>;
219
219
  }, z.core.$strip>>;
@@ -283,10 +283,10 @@ declare const AuthenticationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
283
283
  github: "github";
284
284
  phone: "phone";
285
285
  twitter: "twitter";
286
+ password: "password";
286
287
  google: "google";
287
288
  microsoft: "microsoft";
288
289
  yahoo: "yahoo";
289
- password: "password";
290
290
  }>>>;
291
291
  redirectToAfterSignUp: z.ZodOptional<z.ZodString>;
292
292
  redirectToAfterSignIn: z.ZodOptional<z.ZodString>;
@@ -442,8 +442,8 @@ export declare const ZudokuConfig: z.ZodObject<{
442
442
  footer: z.ZodOptional<z.ZodOptional<z.ZodObject<{
443
443
  columns: z.ZodOptional<z.ZodArray<z.ZodObject<{
444
444
  position: z.ZodOptional<z.ZodEnum<{
445
- center: "center";
446
445
  end: "end";
446
+ center: "center";
447
447
  start: "start";
448
448
  }>>;
449
449
  title: z.ZodString;
@@ -483,8 +483,8 @@ export declare const ZudokuConfig: z.ZodObject<{
483
483
  href: z.ZodOptional<z.ZodString>;
484
484
  }, z.core.$strip>>;
485
485
  position: z.ZodOptional<z.ZodEnum<{
486
- center: "center";
487
486
  end: "end";
487
+ center: "center";
488
488
  start: "start";
489
489
  }>>;
490
490
  }, z.core.$strip>>>;
@@ -674,10 +674,10 @@ export declare const ZudokuConfig: z.ZodObject<{
674
674
  github: "github";
675
675
  phone: "phone";
676
676
  twitter: "twitter";
677
+ password: "password";
677
678
  google: "google";
678
679
  microsoft: "microsoft";
679
680
  yahoo: "yahoo";
680
- password: "password";
681
681
  }>>>;
682
682
  redirectToAfterSignUp: z.ZodOptional<z.ZodString>;
683
683
  redirectToAfterSignIn: z.ZodOptional<z.ZodString>;
@@ -3,10 +3,11 @@ import type { ReactNode } from "react";
3
3
  import type { Location, RouteObject } from "react-router";
4
4
  import type { Navigation } from "../../config/validators/NavigationSchema.js";
5
5
  import type { ProtectedRoutesInput } from "../../config/validators/ProtectedRoutesSchema.js";
6
+ import type { ZudokuConfig } from "../../config/validators/validate.js";
6
7
  import type { AuthenticationPlugin } from "../authentication/authentication.js";
7
8
  import type { MdxComponentsType } from "../util/MdxComponents.js";
8
9
  import type { ApiIdentity, ZudokuContext, ZudokuEvents } from "./ZudokuContext.js";
9
- export type ZudokuPlugin = CommonPlugin | ProfileMenuPlugin | NavigationPlugin | ApiIdentityPlugin | SearchProviderPlugin | EventConsumerPlugin | AuthenticationPlugin;
10
+ export type ZudokuPlugin = CommonPlugin | ProfileMenuPlugin | NavigationPlugin | ApiIdentityPlugin | SearchProviderPlugin | EventConsumerPlugin | AuthenticationPlugin | TransformConfigPlugin;
10
11
  export type { AuthenticationPlugin, RouteObject };
11
12
  export interface NavigationPlugin {
12
13
  getRoutes: () => RouteObject[];
@@ -35,6 +36,14 @@ export type ProfileNavigationItem = {
35
36
  children?: ProfileNavigationItem[];
36
37
  icon?: LucideIcon;
37
38
  };
39
+ export interface ConfigHookContext {
40
+ mode: typeof process.env.ZUDOKU_ENV;
41
+ rootDir: string;
42
+ configPath: string;
43
+ }
44
+ export interface TransformConfigPlugin {
45
+ transformConfig?: (config: ZudokuConfig, ctx: ConfigHookContext) => Partial<ZudokuConfig> | void | Promise<Partial<ZudokuConfig> | void>;
46
+ }
38
47
  export interface CommonPlugin {
39
48
  initialize?: (context: ZudokuContext) => Promise<void | boolean> | void | boolean;
40
49
  getHead?: (args: {
@@ -56,3 +65,4 @@ export declare const needsInitialization: (obj: ZudokuPlugin) => obj is CommonPl
56
65
  export declare const hasHead: (obj: ZudokuPlugin) => obj is CommonPlugin;
57
66
  export declare const isMdxProviderPlugin: (obj: ZudokuPlugin) => obj is CommonPlugin;
58
67
  export declare const isApiIdentityPlugin: (obj: ZudokuPlugin) => obj is ApiIdentityPlugin;
68
+ export declare const isTransformConfigPlugin: (obj: ZudokuPlugin) => obj is TransformConfigPlugin;
@@ -9,4 +9,5 @@ export const needsInitialization = (obj) => "initialize" in obj && typeof obj.in
9
9
  export const hasHead = (obj) => "getHead" in obj && typeof obj.getHead === "function";
10
10
  export const isMdxProviderPlugin = (obj) => "getMdxComponents" in obj && typeof obj.getMdxComponents === "function";
11
11
  export const isApiIdentityPlugin = (obj) => "getIdentities" in obj && typeof obj.getIdentities === "function";
12
+ export const isTransformConfigPlugin = (obj) => "transformConfig" in obj && typeof obj.transformConfig === "function";
12
13
  //# sourceMappingURL=plugins.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../../src/lib/core/plugins.ts"],"names":[],"mappings":"AA8BA,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,MAAyB,EACN,EAAE,CAAC,MAAM,CAAC;AAE/B,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,MAAyB,EACN,EAAE,CAAC,MAAM,CAAC;AAsC/B,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,GAAiB,EACW,EAAE,CAC9B,QAAQ,IAAI,GAAG,IAAI,OAAO,GAAG,CAAC,MAAM,KAAK,QAAQ,CAAC;AAEpD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,GAAiB,EACS,E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AE,CAC5B,eAAe,IAAI,GAAG,IAAI,OAAO,GAAG,CAAC,aAAa,KAAK,UAAU,CAAC;AAEpE,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,GAAiB,EACa,EAAE,CAChC,iBAAiB,IAAI,GAAG,IAAI,OAAO,GAAG,CAAC,eAAe,KAAK,UAAU,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { ConfigWithMeta } from "../../config/loader.js";
2
+ export declare const runTransformConfigHooks: (config: ConfigWithMeta) => Promise<ConfigWithMeta>;
@@ -0,0 +1,22 @@
1
+ import createDeepmerge from "@fastify/deepmerge";
2
+ import { isTransformConfigPlugin } from "./plugins.js";
3
+ const mergeConfig = createDeepmerge({
4
+ mergeArray: (opt) => (_, source) => opt.clone(source),
5
+ });
6
+ export const runTransformConfigHooks = async (config) => {
7
+ const ctx = {
8
+ mode: config.__meta.mode,
9
+ rootDir: config.__meta.rootDir,
10
+ configPath: config.__meta.configPath,
11
+ };
12
+ const plugins = config.plugins ?? [];
13
+ let result = config;
14
+ for (const plugin of plugins.filter(isTransformConfigPlugin)) {
15
+ const partial = await plugin.transformConfig?.(result, ctx);
16
+ if (!partial)
17
+ continue;
18
+ result = mergeConfig(result, partial);
19
+ }
20
+ return result;
21
+ };
22
+ //# sourceMappingURL=transform-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transform-config.js","sourceRoot":"","sources":["../../../src/lib/core/transform-config.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,oBAAoB,CAAC;AAEjD,OAAO,EAA0B,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAE/E,MAAM,WAAW,GAAG,eAAe,CAAC;IAClC,UAAU,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC;CACtD,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,uBAAuB,GAAG,KAAK,EAC1C,MAAsB,EACG,EAAE;IAC3B,MAAM,GAAG,GAAG;QACV,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI;QACxB,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO;QAC9B,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU;KACT,CAAC;IAC9B,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,EAAE,CAAC;IAErC,IAAI,MAAM,GAAG,MAAM,CAAC;IAEpB,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,uBAAuB,CAAC,EAAE,CAAC;QAC7D,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,eAAe,EAAE,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC5D,IAAI,CAAC,OAAO;YAAE,SAAS;QAEvB,MAAM,GAAG,WAAW,CAAC,MAAM,EAAE,OAAO,CAAmB,CAAC;IAC1D,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
@@ -28,7 +28,7 @@ declare const CommandInput: React.ForwardRefExoticComponent<Omit<Omit<Pick<Pick<
28
28
  ref?: React.Ref<HTMLInputElement>;
29
29
  } & {
30
30
  asChild?: boolean;
31
- }, "key" | "asChild" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "type" | "value" | "onChange"> & {
31
+ }, "key" | "asChild" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "value" | "type" | "onChange"> & {
32
32
  value?: string;
33
33
  onValueChange?: (search: string) => void;
34
34
  } & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
@@ -36,7 +36,7 @@ declare const CommandInlineInput: React.ForwardRefExoticComponent<Omit<Omit<Pick
36
36
  ref?: React.Ref<HTMLInputElement>;
37
37
  } & {
38
38
  asChild?: boolean;
39
- }, "key" | "asChild" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "type" | "value" | "onChange"> & {
39
+ }, "key" | "asChild" | keyof React.InputHTMLAttributes<HTMLInputElement>>, "value" | "type" | "onChange"> & {
40
40
  value?: string;
41
41
  onValueChange?: (search: string) => void;
42
42
  } & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
@@ -80,7 +80,7 @@ declare const CommandItem: React.ForwardRefExoticComponent<Omit<{
80
80
  ref?: React.Ref<HTMLDivElement>;
81
81
  } & {
82
82
  asChild?: boolean;
83
- }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>>, "disabled" | "value" | "onSelect"> & {
83
+ }, "key" | "asChild" | keyof React.HTMLAttributes<HTMLDivElement>>, "value" | "disabled" | "onSelect"> & {
84
84
  disabled?: boolean;
85
85
  onSelect?: (value: string) => void;
86
86
  value?: string;