@lukoweb/apitogo 0.1.20 → 0.1.22

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.
Files changed (51) hide show
  1. package/dist/cli/cli.js +96 -84
  2. package/dist/declarations/app/main.d.ts +4 -3
  3. package/dist/declarations/config/config.d.ts +1 -0
  4. package/dist/declarations/config/create-plugin.d.ts +2 -2
  5. package/dist/declarations/config/validators/ZudokuConfig.d.ts +2 -3
  6. package/dist/declarations/index.d.ts +7 -3
  7. package/dist/declarations/lib/components/PluginHeads.d.ts +2 -2
  8. package/dist/declarations/lib/components/Zudoku.d.ts +7 -1
  9. package/dist/declarations/lib/components/context/ZudokuContext.d.ts +1 -0
  10. package/dist/declarations/lib/components/context/ZudokuProvider.d.ts +3 -0
  11. package/dist/declarations/lib/components/index.d.ts +5 -0
  12. package/dist/declarations/lib/core/ZudokuContext.d.ts +5 -5
  13. package/dist/declarations/lib/core/plugins.d.ts +13 -13
  14. package/dist/declarations/lib/hooks/index.d.ts +1 -0
  15. package/dist/declarations/lib/hooks/useEvent.d.ts +4 -4
  16. package/dist/declarations/lib/plugins/api-catalog/index.d.ts +2 -2
  17. package/dist/declarations/lib/plugins/api-keys/index.d.ts +2 -2
  18. package/dist/declarations/lib/plugins/markdown/index.d.ts +2 -2
  19. package/dist/declarations/lib/plugins/openapi/index.d.ts +2 -2
  20. package/dist/declarations/lib/plugins/search-inkeep/index.d.ts +2 -2
  21. package/dist/declarations/lib/plugins/search-pagefind/index.d.ts +2 -2
  22. package/dist/declarations/lib/testing/index.d.ts +3 -2
  23. package/dist/declarations/lib/util/invariant.d.ts +6 -4
  24. package/package.json +1 -1
  25. package/src/app/main.tsx +14 -11
  26. package/src/config/config.ts +7 -0
  27. package/src/config/create-plugin.ts +3 -3
  28. package/src/config/validators/BuildSchema.ts +7 -2
  29. package/src/config/validators/ZudokuConfig.ts +2 -3
  30. package/src/index.ts +13 -3
  31. package/src/lib/authentication/providers/clerk.tsx +2 -2
  32. package/src/lib/components/PluginHeads.tsx +2 -2
  33. package/src/lib/components/Zudoku.tsx +13 -8
  34. package/src/lib/components/context/ZudokuContext.ts +15 -5
  35. package/src/lib/components/context/ZudokuProvider.tsx +7 -1
  36. package/src/lib/components/index.ts +9 -1
  37. package/src/lib/core/ZudokuContext.ts +8 -8
  38. package/src/lib/core/plugins.ts +13 -13
  39. package/src/lib/hooks/index.ts +2 -0
  40. package/src/lib/hooks/useEvent.ts +12 -12
  41. package/src/lib/plugins/api-catalog/index.tsx +2 -2
  42. package/src/lib/plugins/api-keys/index.tsx +2 -2
  43. package/src/lib/plugins/markdown/index.tsx +2 -2
  44. package/src/lib/plugins/openapi/Sidecar.tsx +4 -2
  45. package/src/lib/plugins/openapi/index.tsx +6 -3
  46. package/src/lib/plugins/search-inkeep/index.tsx +2 -2
  47. package/src/lib/plugins/search-pagefind/index.tsx +2 -2
  48. package/src/lib/testing/index.tsx +11 -2
  49. package/src/lib/util/invariant.ts +16 -6
  50. package/src/types.d.ts +6 -6
  51. package/src/vite/config.ts +24 -0
@@ -11,8 +11,8 @@ import type { AuthenticationPlugin } from "../authentication/authentication.js";
11
11
  import { type AuthState } from "../authentication/state.js";
12
12
  import type { SlotType } from "../components/context/SlotProvider.js";
13
13
  import type { MdxComponentsType } from "../util/MdxComponents.js";
14
- import { type ProfileNavigationItem, type ZudokuPlugin } from "./plugins.js";
15
- export interface ZudokuEvents {
14
+ import { type ProfileNavigationItem, type ApitogoPlugin } from "./plugins.js";
15
+ export interface ApitogoEvents {
16
16
  location: (event: {
17
17
  from?: Location;
18
18
  to: Location;
@@ -85,7 +85,7 @@ export type ZudokuContextOptions = {
85
85
  authentication?: AuthenticationPlugin;
86
86
  navigation?: Navigation;
87
87
  navigationRules?: ResolvedNavigationRule[];
88
- plugins?: ZudokuPlugin[];
88
+ plugins?: ApitogoPlugin[];
89
89
  slots?: Record<string, SlotType>;
90
90
  UNSAFE_slotlets?: Record<string, SlotType>;
91
91
  mdx?: {
@@ -115,8 +115,8 @@ export declare class ZudokuContext {
115
115
  readonly initialize: Promise<void> | undefined;
116
116
  constructor(options: ZudokuContextOptions, queryClient: QueryClient, env: Record<string, string | undefined>);
117
117
  getApiIdentities: () => Promise<ApiIdentity[]>;
118
- addEventListener<E extends keyof ZudokuEvents>(event: E, callback: ZudokuEvents[E]): import("nanoevents").Unsubscribe;
119
- emitEvent: <E extends keyof ZudokuEvents>(event: E, ...data: Parameters<ZudokuEvents[E]>) => void;
118
+ addEventListener<E extends keyof ApitogoEvents>(event: E, callback: ApitogoEvents[E]): import("nanoevents").Unsubscribe;
119
+ emitEvent: <E extends keyof ApitogoEvents>(event: E, ...data: Parameters<ApitogoEvents[E]>) => void;
120
120
  getPluginNavigation: (path: string) => Promise<import("../../config/validators/NavigationSchema.js").NavigationItem[]>;
121
121
  getProfileMenuItems: () => ProfileNavigationItem[];
122
122
  signRequest: (request: Request) => Promise<Request>;
@@ -6,9 +6,9 @@ import type { ProtectedRoutesInput } from "../../config/validators/ProtectedRout
6
6
  import type { ZudokuConfig } from "../../config/validators/ZudokuConfig.js";
7
7
  import type { AuthenticationPlugin } from "../authentication/authentication.js";
8
8
  import type { MdxComponentsType } from "../util/MdxComponents.js";
9
- import type { ApiIdentity, ZudokuContext, ZudokuEvents } from "./ZudokuContext.js";
9
+ import type { ApiIdentity, ApitogoEvents, ZudokuContext } from "./ZudokuContext.js";
10
10
  export { runPluginTransformConfig } from "./transform-config.js";
11
- export type ZudokuPlugin = CommonPlugin | ProfileMenuPlugin | NavigationPlugin | ApiIdentityPlugin | SearchProviderPlugin | EventConsumerPlugin | AuthenticationPlugin | TransformConfigPlugin;
11
+ export type ApitogoPlugin = CommonPlugin | ProfileMenuPlugin | NavigationPlugin | ApiIdentityPlugin | SearchProviderPlugin | EventConsumerPlugin | AuthenticationPlugin | TransformConfigPlugin;
12
12
  export type { AuthenticationPlugin, RouteObject };
13
13
  export interface NavigationPlugin {
14
14
  getRoutes: () => RouteObject[];
@@ -57,18 +57,18 @@ export interface CommonPlugin {
57
57
  }) => ReactNode | undefined;
58
58
  getMdxComponents?: () => MdxComponentsType;
59
59
  }
60
- export type EventConsumerPlugin<Event extends ZudokuEvents = ZudokuEvents> = {
60
+ export type EventConsumerPlugin<Event extends ApitogoEvents = ApitogoEvents> = {
61
61
  events: {
62
62
  [K in keyof Event]?: Event[K];
63
63
  };
64
64
  };
65
- export declare const isEventConsumerPlugin: (obj: ZudokuPlugin) => obj is EventConsumerPlugin;
66
- export declare const isProfileMenuPlugin: (obj: ZudokuPlugin) => obj is ProfileMenuPlugin;
67
- export declare const isNavigationPlugin: (obj: ZudokuPlugin) => obj is NavigationPlugin;
68
- export declare const isAuthenticationPlugin: (obj: ZudokuPlugin) => obj is AuthenticationPlugin;
69
- export declare const isSearchPlugin: (obj: ZudokuPlugin) => obj is SearchProviderPlugin;
70
- export declare const needsInitialization: (obj: ZudokuPlugin) => obj is CommonPlugin;
71
- export declare const hasHead: (obj: ZudokuPlugin) => obj is CommonPlugin;
72
- export declare const isMdxProviderPlugin: (obj: ZudokuPlugin) => obj is CommonPlugin;
73
- export declare const isApiIdentityPlugin: (obj: ZudokuPlugin) => obj is ApiIdentityPlugin;
74
- export declare const isTransformConfigPlugin: (obj: ZudokuPlugin) => obj is TransformConfigPlugin;
65
+ export declare const isEventConsumerPlugin: (obj: ApitogoPlugin) => obj is EventConsumerPlugin;
66
+ export declare const isProfileMenuPlugin: (obj: ApitogoPlugin) => obj is ProfileMenuPlugin;
67
+ export declare const isNavigationPlugin: (obj: ApitogoPlugin) => obj is NavigationPlugin;
68
+ export declare const isAuthenticationPlugin: (obj: ApitogoPlugin) => obj is AuthenticationPlugin;
69
+ export declare const isSearchPlugin: (obj: ApitogoPlugin) => obj is SearchProviderPlugin;
70
+ export declare const needsInitialization: (obj: ApitogoPlugin) => obj is CommonPlugin;
71
+ export declare const hasHead: (obj: ApitogoPlugin) => obj is CommonPlugin;
72
+ export declare const isMdxProviderPlugin: (obj: ApitogoPlugin) => obj is CommonPlugin;
73
+ export declare const isApiIdentityPlugin: (obj: ApitogoPlugin) => obj is ApiIdentityPlugin;
74
+ export declare const isTransformConfigPlugin: (obj: ApitogoPlugin) => obj is TransformConfigPlugin;
@@ -2,6 +2,7 @@ export { useMDXComponents } from "@mdx-js/react";
2
2
  export { useTheme } from "next-themes";
3
3
  export { useAuth, useRefreshUserProfile, useVerifiedEmail, } from "../authentication/hook.js";
4
4
  export { CACHE_KEYS, useCache } from "../components/cache.js";
5
+ export { useApitogo } from "../components/context/ZudokuContext.js";
5
6
  export { useZudoku } from "../components/context/ZudokuContext.js";
6
7
  export { useExposedProps } from "../util/useExposedProps.js";
7
8
  export { useEvent } from "./useEvent.js";
@@ -1,5 +1,5 @@
1
- import type { ZudokuEvents } from "../core/ZudokuContext.js";
2
- type EventParameters<Event extends keyof ZudokuEvents> = Parameters<ZudokuEvents[Event]>;
3
- export declare function useEvent<E extends keyof ZudokuEvents>(event: E): EventParameters<E>;
4
- export declare function useEvent<E extends keyof ZudokuEvents, R>(event: E, callback: (...args: EventParameters<E>) => R): R;
1
+ import type { ApitogoEvents } from "../core/ZudokuContext.js";
2
+ type EventParameters<Event extends keyof ApitogoEvents> = Parameters<ApitogoEvents[Event]>;
3
+ export declare function useEvent<E extends keyof ApitogoEvents>(event: E): EventParameters<E>;
4
+ export declare function useEvent<E extends keyof ApitogoEvents, R>(event: E, callback: (...args: EventParameters<E>) => R): R;
5
5
  export {};
@@ -1,5 +1,5 @@
1
1
  import type { AuthState } from "../../authentication/state.js";
2
- import type { ZudokuPlugin } from "../../core/plugins.js";
2
+ import type { ApitogoPlugin } from "../../core/plugins.js";
3
3
  export declare const getKey: (category: string, tag: string) => string;
4
4
  export type ApiCatalogItem = {
5
5
  path: string;
@@ -28,4 +28,4 @@ export declare const apiCatalogPlugin: ({ path, items, label, categories, filter
28
28
  categories?: CatalogCategory[];
29
29
  items: ApiCatalogItem[];
30
30
  filterCatalogItems?: FilterCatalogItemsFn;
31
- }) => ZudokuPlugin;
31
+ }) => ApitogoPlugin;
@@ -1,6 +1,6 @@
1
1
  import type { ApiKeysOptions } from "../../../config/validators/ZudokuConfig.js";
2
2
  import type { UseAuthReturn } from "../../authentication/hook.js";
3
- import type { ApiIdentityPlugin, ProfileMenuPlugin, ZudokuPlugin } from "../../core/plugins.js";
3
+ import type { ApiIdentityPlugin, ProfileMenuPlugin, ApitogoPlugin } from "../../core/plugins.js";
4
4
  import type { ZudokuContext } from "../../core/ZudokuContext.js";
5
5
  export type ApiKeyService = {
6
6
  getConsumers: (context: ZudokuContext) => Promise<ApiConsumer[]>;
@@ -47,5 +47,5 @@ type InternalApiKeyPluginOptions = {
47
47
  deploymentName?: string;
48
48
  isZuplo?: boolean;
49
49
  };
50
- export declare const apiKeyPlugin: ({ deploymentName, isZuplo, ...options }: Omit<ApiKeysOptions, "enabled"> & InternalApiKeyPluginOptions) => ZudokuPlugin & ApiIdentityPlugin & ProfileMenuPlugin;
50
+ export declare const apiKeyPlugin: ({ deploymentName, isZuplo, ...options }: Omit<ApiKeysOptions, "enabled"> & InternalApiKeyPluginOptions) => ApitogoPlugin & ApiIdentityPlugin & ProfileMenuPlugin;
51
51
  export {};
@@ -2,7 +2,7 @@ import type { MDXProps } from "mdx/types.js";
2
2
  import type { JSX } from "react";
3
3
  import type { ZudokuDocsConfig } from "../../../config/validators/ZudokuConfig.js";
4
4
  import type { Toc } from "../../../vite/mdx/rehype-extract-toc-with-jsx.js";
5
- import type { ZudokuPlugin } from "../../core/plugins.js";
5
+ import type { ApitogoPlugin } from "../../core/plugins.js";
6
6
  export interface MarkdownPluginOptions extends ZudokuDocsConfig {
7
7
  basePath: string;
8
8
  fileImports: Record<string, () => Promise<MDXImport>>;
@@ -31,4 +31,4 @@ export type MDXImport = {
31
31
  __filepath: string;
32
32
  default: (props: MDXProps) => JSX.Element;
33
33
  };
34
- export declare const markdownPlugin: (options: MarkdownPluginOptions) => ZudokuPlugin;
34
+ export declare const markdownPlugin: (options: MarkdownPluginOptions) => ApitogoPlugin;
@@ -1,4 +1,4 @@
1
- import type { ZudokuPlugin } from "../../core/plugins.js";
1
+ import type { ApitogoPlugin } from "../../core/plugins.js";
2
2
  import type { GetNavigationOperationsQuery as GetNavigationOperationsQueryResult } from "./graphql/graphql.js";
3
3
  import type { OasPluginConfig } from "./interfaces.js";
4
4
  export declare const GetNavigationOperationsQuery: import("./graphql/graphql.js").TypedDocumentString<GetNavigationOperationsQueryResult, import("./graphql/graphql.js").Exact<{
@@ -8,4 +8,4 @@ export declare const GetNavigationOperationsQuery: import("./graphql/graphql.js"
8
8
  export type OperationResult = GetNavigationOperationsQueryResult["schema"]["tags"][number]["operations"][number];
9
9
  export type OpenApiPluginOptions = OasPluginConfig;
10
10
  export declare const UNTAGGED_PATH = "~endpoints";
11
- export declare const openApiPlugin: (config: OasPluginConfig) => ZudokuPlugin;
11
+ export declare const openApiPlugin: (config: OasPluginConfig) => ApitogoPlugin;
@@ -1,8 +1,8 @@
1
1
  import type { InkeepBaseSettings, InkeepJS } from "@inkeep/cxkit-types";
2
- import type { ZudokuPlugin } from "../../core/plugins.js";
2
+ import type { ApitogoPlugin } from "../../core/plugins.js";
3
3
  declare global {
4
4
  interface Window {
5
5
  Inkeep: InkeepJS | undefined;
6
6
  }
7
7
  }
8
- export declare const inkeepSearchPlugin: (settings: InkeepBaseSettings) => ZudokuPlugin;
8
+ export declare const inkeepSearchPlugin: (settings: InkeepBaseSettings) => ApitogoPlugin;
@@ -1,6 +1,6 @@
1
1
  import type { ZudokuConfig } from "../../../config/validators/ZudokuConfig.js";
2
- import type { ZudokuPlugin } from "../../core/plugins.js";
2
+ import type { ApitogoPlugin } from "../../core/plugins.js";
3
3
  export type PagefindOptions = Extract<ZudokuConfig["search"], {
4
4
  type: "pagefind";
5
5
  }>;
6
- export declare const pagefindSearchPlugin: (options: PagefindOptions) => ZudokuPlugin;
6
+ export declare const pagefindSearchPlugin: (options: PagefindOptions) => ApitogoPlugin;
@@ -5,12 +5,13 @@ type QueryData = {
5
5
  queryKey: QueryKey;
6
6
  data: unknown;
7
7
  };
8
- type StaticZudokuProps = ZudokuContextOptions & {
8
+ export type StaticZudokuProps = ZudokuContextOptions & {
9
9
  path: string;
10
10
  queryData?: QueryData[];
11
11
  env?: Record<string, string>;
12
12
  isAuthenticated?: boolean;
13
13
  redirects?: ZudokuRedirect[];
14
14
  };
15
+ export type StaticApitogoProps = StaticZudokuProps;
15
16
  declare const StaticZudoku: ({ path, queryData, env, isAuthenticated, redirects, ...options }: StaticZudokuProps) => import("react/jsx-runtime").JSX.Element;
16
- export { StaticZudoku, type StaticZudokuProps, type QueryData };
17
+ export { StaticZudoku, StaticZudoku as StaticApitogo, type QueryData };
@@ -1,11 +1,13 @@
1
- export default function invariant(condition: any, message?: string | (() => string), options?: ZudokuErrorOptions): asserts condition;
2
- export type ZudokuErrorOptions = {
1
+ export default function invariant(condition: any, message?: string | (() => string), options?: ApitogoErrorOptions): asserts condition;
2
+ export type ApitogoErrorOptions = {
3
3
  developerHint?: string;
4
4
  title?: string;
5
5
  cause?: Error;
6
6
  };
7
- export declare class ZudokuError extends Error {
7
+ export type ZudokuErrorOptions = ApitogoErrorOptions;
8
+ export declare class ApitogoError extends Error {
8
9
  developerHint: string | undefined;
9
10
  title: string | undefined;
10
- constructor(message: string, { developerHint, title, cause }?: ZudokuErrorOptions);
11
+ constructor(message: string, { developerHint, title, cause }?: ApitogoErrorOptions);
11
12
  }
13
+ export declare const ZudokuError: typeof ApitogoError;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lukoweb/apitogo",
3
- "version": "0.1.20",
3
+ "version": "0.1.22",
4
4
  "type": "module",
5
5
  "sideEffects": [
6
6
  "**/*.css",
package/src/app/main.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import { Zudoku } from "@lukoweb/apitogo/components";
1
+ import { Apitogo } from "@lukoweb/apitogo/components";
2
2
  import { Outlet } from "@lukoweb/apitogo/router";
3
3
  import type { RouteObject } from "react-router";
4
4
  import type { HighlighterCore } from "shiki";
@@ -17,7 +17,7 @@ import {
17
17
  configuredNavigationRules,
18
18
  } from "virtual:zudoku-navigation";
19
19
  import { configuredSearchPlugin } from "virtual:zudoku-search-plugin";
20
- import type { ZudokuConfig } from "../config/config.js";
20
+ import type { ApitogoConfig } from "../config/config.js";
21
21
  import { BuildCheck } from "../lib/components/BuildCheck.js";
22
22
  import "./main.css";
23
23
  import { Meta } from "../lib/components/Meta.js";
@@ -39,8 +39,8 @@ export const shikiReady: Promise<HighlighterCore> =
39
39
  return highlighter;
40
40
  });
41
41
 
42
- export const convertZudokuConfigToOptions = (
43
- config: ZudokuConfig,
42
+ export const convertApitogoConfigToOptions = (
43
+ config: ApitogoConfig,
44
44
  ): ZudokuContextOptions => {
45
45
  const siteTitle =
46
46
  config.metadata?.applicationName ?? config.site?.title ?? "APIToGo";
@@ -52,9 +52,7 @@ export const convertZudokuConfigToOptions = (
52
52
  protectedRoutes: config.protectedRoutes,
53
53
  site: {
54
54
  ...config.site,
55
- showPoweredBy:
56
- ZuploEnv.buildConfig?.entitlements.devPortalZuploBranding ??
57
- config.site?.showPoweredBy,
55
+ showPoweredBy: ZuploEnv.buildConfig?.entitlements.devPortalZuploBranding,
58
56
  logo: config.site?.logo,
59
57
  },
60
58
  slots: config.slots,
@@ -89,6 +87,11 @@ export const convertZudokuConfigToOptions = (
89
87
  };
90
88
  };
91
89
 
90
+ /**
91
+ * @deprecated Use {@link convertApitogoConfigToOptions} instead.
92
+ */
93
+ export const convertZudokuConfigToOptions = convertApitogoConfigToOptions;
94
+
92
95
  export const getRoutesByOptions = (
93
96
  options: ZudokuContextOptions,
94
97
  enableStatusPages = true,
@@ -119,8 +122,8 @@ export const getRoutesByOptions = (
119
122
  return routes;
120
123
  };
121
124
 
122
- export const getRoutesByConfig = (config: ZudokuConfig): RouteObject[] => {
123
- const options = convertZudokuConfigToOptions(config);
125
+ export const getRoutesByConfig = (config: ApitogoConfig): RouteObject[] => {
126
+ const options = convertApitogoConfigToOptions(config);
124
127
  const routes = getRoutesByOptions(
125
128
  options,
126
129
  import.meta.env.IS_ZUPLO || config.enableStatusPages,
@@ -130,13 +133,13 @@ export const getRoutesByConfig = (config: ZudokuConfig): RouteObject[] => {
130
133
  ...createRedirectRoutes(config.redirects),
131
134
  {
132
135
  element: (
133
- <Zudoku {...options} env={import.meta.env}>
136
+ <Apitogo {...options} env={import.meta.env}>
134
137
  <BuildCheck
135
138
  buildId={import.meta.env.ZUPLO_BUILD_ID}
136
139
  environmentType={import.meta.env.ZUPLO_ENVIRONMENT_TYPE}
137
140
  />
138
141
  <Outlet />
139
- </Zudoku>
142
+ </Apitogo>
140
143
  ),
141
144
  hydrateFallbackElement: <div>Loading...</div>,
142
145
  children: [
@@ -5,7 +5,14 @@ import type {
5
5
  ZudokuConfig,
6
6
  } from "./validators/ZudokuConfig.js";
7
7
 
8
+ /** Build-time config for APIToGo (`apitogo.build.ts` / legacy `zudoku.build.ts`). */
9
+ export type ApitogoBuildConfig = BuildConfig;
10
+
11
+ /**
12
+ * @deprecated Use {@link ApitogoBuildConfig} instead.
13
+ */
8
14
  export type ZudokuBuildConfig = BuildConfig;
15
+
9
16
  export type LoadedConfig = ConfigWithMeta;
10
17
  export type { ZudokuConfig as ApitogoConfig };
11
18
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isTransformConfigPlugin,
3
- type ZudokuPlugin,
3
+ type ApitogoPlugin,
4
4
  } from "../lib/core/plugins.js";
5
5
 
6
6
  // Regex from stacktrace-parser for Node.js stack traces
@@ -36,8 +36,8 @@ const getCallerDir = () => {
36
36
  };
37
37
 
38
38
  export const createPlugin = <TOptions extends unknown[]>(
39
- factory: (...options: TOptions) => ZudokuPlugin,
40
- ): ((...options: TOptions) => ZudokuPlugin) => {
39
+ factory: (...options: TOptions) => ApitogoPlugin,
40
+ ): ((...options: TOptions) => ApitogoPlugin) => {
41
41
  const pluginDir = getCallerDir();
42
42
 
43
43
  return (...options: TOptions) => {
@@ -34,7 +34,12 @@ export const BuildConfigSchema = z.object({
34
34
  prerender: z.object({ workers: z.number().optional() }).optional(),
35
35
  });
36
36
 
37
- const zudokuBuildConfigFiles = [
37
+ const buildConfigFiles = [
38
+ "apitogo.build.js",
39
+ "apitogo.build.jsx",
40
+ "apitogo.build.ts",
41
+ "apitogo.build.tsx",
42
+ "apitogo.build.mjs",
38
43
  "zudoku.build.js",
39
44
  "zudoku.build.jsx",
40
45
  "zudoku.build.ts",
@@ -43,7 +48,7 @@ const zudokuBuildConfigFiles = [
43
48
  ];
44
49
 
45
50
  async function getBuildConfigFilePath(rootDir: string) {
46
- for (const fileName of zudokuBuildConfigFiles) {
51
+ for (const fileName of buildConfigFiles) {
47
52
  const filepath = path.join(rootDir, fileName);
48
53
  if (await fileExists(filepath)) {
49
54
  return filepath;
@@ -7,7 +7,7 @@ import { z } from "zod";
7
7
  import type { UseAuthReturn } from "../../lib/authentication/hook.js";
8
8
  import type { AuthState } from "../../lib/authentication/state.js";
9
9
  import type { SlotType } from "../../lib/components/context/SlotProvider.js";
10
- import type { ZudokuPlugin } from "../../lib/core/plugins.js";
10
+ import type { ApitogoPlugin } from "../../lib/core/plugins.js";
11
11
  import type { ZudokuContext } from "../../lib/core/ZudokuContext.js";
12
12
  import type { FilterCatalogItemsFn } from "../../lib/plugins/api-catalog/index.js";
13
13
  import type { ApiConsumer } from "../../lib/plugins/api-keys/index.js";
@@ -553,7 +553,6 @@ const SiteSchema = z
553
553
  logoUrl: z.string(),
554
554
  dir: z.enum(["ltr", "rtl"]).optional(),
555
555
  logo: LogoSchema,
556
- showPoweredBy: z.boolean().optional(),
557
556
  banner: z.object({
558
557
  message: z.custom<NonNullable<ReactNode>>(),
559
558
  color: z
@@ -627,7 +626,7 @@ const BaseConfigSchema = z.object({
627
626
  prose: z.boolean().optional(),
628
627
  }),
629
628
  ),
630
- plugins: z.array(z.custom<ZudokuPlugin>()),
629
+ plugins: z.array(z.custom<ApitogoPlugin>()),
631
630
  build: z.custom<{
632
631
  remarkPlugins?: Options["remarkPlugins"];
633
632
  rehypePlugins?: Options["rehypePlugins"];
package/src/index.ts CHANGED
@@ -1,4 +1,8 @@
1
- export type { ApitogoConfig, ZudokuBuildConfig } from "./config/config.js";
1
+ export type {
2
+ ApitogoBuildConfig,
3
+ ApitogoConfig,
4
+ ZudokuBuildConfig,
5
+ } from "./config/config.js";
2
6
  export { createPlugin } from "./config/create-plugin.js";
3
7
  export type { InputNavigation as Navigation } from "./config/validators/InputNavigationSchema.js";
4
8
  export type { SlotType } from "./lib/components/context/SlotProvider.js";
@@ -17,9 +21,15 @@ export type {
17
21
  RouteObject,
18
22
  SearchProviderPlugin,
19
23
  TransformConfigContext,
20
- ZudokuPlugin,
24
+ ApitogoPlugin,
21
25
  } from "./lib/core/plugins.js";
22
- export { type ApiIdentity, ZudokuContext } from "./lib/core/ZudokuContext.js";
26
+ export type { ApiIdentity, ApitogoEvents } from "./lib/core/ZudokuContext.js";
27
+ /** @deprecated Use {@link ApitogoContextOptions} instead. */
28
+ export type { ZudokuContextOptions } from "./lib/core/ZudokuContext.js";
29
+ export type { ZudokuContextOptions as ApitogoContextOptions } from "./lib/core/ZudokuContext.js";
30
+ /** @deprecated Use {@link ApitogoContext} instead. */
31
+ export { ZudokuContext } from "./lib/core/ZudokuContext.js";
32
+ export { ZudokuContext as ApitogoContext } from "./lib/core/ZudokuContext.js";
23
33
  /** @deprecated Import from `apitogo/hooks` instead */
24
34
  export { useEvent } from "./lib/hooks/index.js";
25
35
  export type { MDXImport } from "./lib/plugins/markdown/index.js";
@@ -1,5 +1,5 @@
1
1
  import type { Clerk } from "@clerk/clerk-js";
2
- import type { ZudokuPlugin } from "@lukoweb/apitogo/plugins";
2
+ import type { ApitogoPlugin } from "@lukoweb/apitogo/plugins";
3
3
  import type { ClerkAuthenticationConfig } from "../../../config/config.js";
4
4
  import type {
5
5
  AuthActionContext,
@@ -62,7 +62,7 @@ const clerkAuth: AuthenticationProviderInitializer<
62
62
  redirectToAfterSignOut = "/",
63
63
  redirectToAfterSignUp,
64
64
  redirectToAfterSignIn,
65
- }): AuthenticationPlugin & ZudokuPlugin => {
65
+ }): AuthenticationPlugin & ApitogoPlugin => {
66
66
  const getClerk = (): Promise<Clerk> => {
67
67
  if (typeof window === "undefined") {
68
68
  return Promise.reject(new Error("Clerk is not available during SSR"));
@@ -1,12 +1,12 @@
1
1
  import { Helmet } from "@zudoku/react-helmet-async";
2
2
  import type { Location } from "react-router";
3
- import { hasHead, type ZudokuPlugin } from "../core/plugins.js";
3
+ import { hasHead, type ApitogoPlugin } from "../core/plugins.js";
4
4
 
5
5
  export const PluginHeads = ({
6
6
  plugins,
7
7
  location,
8
8
  }: {
9
- plugins: ZudokuPlugin[];
9
+ plugins: ApitogoPlugin[];
10
10
  location: Location;
11
11
  }) =>
12
12
  plugins
@@ -20,10 +20,10 @@ import { MdxComponents } from "../util/MdxComponents.js";
20
20
  import { RouterEventsEmitter } from "./context/RouterEventsEmitter.js";
21
21
  import { SlotProvider } from "./context/SlotProvider.js";
22
22
  import { ViewportAnchorProvider } from "./context/ViewportAnchorContext.js";
23
- import { ZudokuProvider } from "./context/ZudokuProvider.js";
23
+ import { ApitogoProvider } from "./context/ZudokuProvider.js";
24
24
  import { PluginHeads } from "./PluginHeads.js";
25
25
 
26
- let zudokuContext: ZudokuContext | undefined;
26
+ let apitogoContext: ZudokuContext | undefined;
27
27
 
28
28
  const ZudokuInner = memo(
29
29
  ({
@@ -61,12 +61,12 @@ const ZudokuInner = memo(
61
61
  setDidNavigate(true);
62
62
  }, [didNavigate, navigation.location]);
63
63
 
64
- zudokuContext ??= new ZudokuContext(props, queryClient, env);
64
+ apitogoContext ??= new ZudokuContext(props, queryClient, env);
65
65
 
66
66
  return (
67
67
  <>
68
68
  <PluginHeads plugins={props.plugins ?? []} location={location} />
69
- <ZudokuProvider context={zudokuContext}>
69
+ <ApitogoProvider context={apitogoContext}>
70
70
  <RouterEventsEmitter />
71
71
  <SlotProvider slots={props.slots ?? props.UNSAFE_slotlets}>
72
72
  <MDXProvider components={mdxComponents}>
@@ -77,7 +77,7 @@ const ZudokuInner = memo(
77
77
  </ThemeProvider>
78
78
  </MDXProvider>
79
79
  </SlotProvider>
80
- </ZudokuProvider>
80
+ </ApitogoProvider>
81
81
  </>
82
82
  );
83
83
  },
@@ -85,7 +85,7 @@ const ZudokuInner = memo(
85
85
 
86
86
  ZudokuInner.displayName = "ZudokuInner";
87
87
 
88
- const Zudoku = (
88
+ const Apitogo = (
89
89
  props: PropsWithChildren<
90
90
  ZudokuContextOptions & { env?: Record<string, string> }
91
91
  >,
@@ -96,6 +96,11 @@ const Zudoku = (
96
96
  </ErrorBoundary>
97
97
  );
98
98
  };
99
- Zudoku.displayName = "Zudoku";
99
+ Apitogo.displayName = "Apitogo";
100
100
 
101
- export { Zudoku };
101
+ /**
102
+ * @deprecated Use {@link Apitogo} instead.
103
+ */
104
+ const Zudoku = Apitogo;
105
+
106
+ export { Apitogo, Zudoku };
@@ -9,18 +9,28 @@ import { CACHE_KEYS, useCache } from "../cache.js";
9
9
  import { getItemPath, traverseNavigation } from "../navigation/utils.js";
10
10
  import { ZudokuReactContext } from "./ZudokuReactContext.js";
11
11
 
12
- export const useZudoku = () => {
12
+ const useApitogoContext = () => {
13
13
  const context = useContext(ZudokuReactContext);
14
14
 
15
15
  if (!context) {
16
- throw new Error("useZudoku must be used within a ZudokuProvider.");
16
+ throw new Error(
17
+ "useApitogo must be used within an ApitogoProvider (from @lukoweb/apitogo/components).",
18
+ );
17
19
  }
18
20
 
19
21
  return context;
20
22
  };
21
23
 
24
+ /** Prefer this over {@link useZudoku}. */
25
+ export const useApitogo = useApitogoContext;
26
+
27
+ /**
28
+ * @deprecated Use {@link useApitogo} instead.
29
+ */
30
+ export const useZudoku = useApitogoContext;
31
+
22
32
  export const useApiIdentities = () => {
23
- const { getApiIdentities } = useZudoku();
33
+ const { getApiIdentities } = useApitogo();
24
34
  const { isAuthenticated } = useAuthState();
25
35
  const { invalidateCache } = useCache();
26
36
 
@@ -55,7 +65,7 @@ const extractAllPaths = (items: NavigationItem[]) => {
55
65
  };
56
66
 
57
67
  export const useCurrentNavigation = () => {
58
- const context = useZudoku();
68
+ const context = useApitogo();
59
69
  const { getPluginNavigation, navigation, navigationRules } = context;
60
70
  const location = useLocation();
61
71
  const loggedWarnings = useRef(new Set<string>());
@@ -112,7 +122,7 @@ export const useCurrentNavigation = () => {
112
122
  if (!loggedWarnings.current.has(warning)) {
113
123
  loggedWarnings.current.add(warning);
114
124
  // biome-ignore lint/suspicious/noConsole: Dev-only navigation rule warnings
115
- console.warn(`[Zudoku] Navigation rule: ${warning}`);
125
+ console.warn(`[APIToGo] Navigation rule: ${warning}`);
116
126
  }
117
127
  }
118
128
  }
@@ -2,7 +2,7 @@ import { use, type PropsWithChildren } from "react";
2
2
  import type { ZudokuContext } from "../../core/ZudokuContext.js";
3
3
  import { ZudokuReactContext } from "./ZudokuReactContext.js";
4
4
 
5
- export const ZudokuProvider = ({
5
+ const ZudokuProviderImpl = ({
6
6
  children,
7
7
  context,
8
8
  }: PropsWithChildren<{ context: ZudokuContext }>) => {
@@ -14,3 +14,9 @@ export const ZudokuProvider = ({
14
14
  </ZudokuReactContext.Provider>
15
15
  );
16
16
  };
17
+
18
+ /** @deprecated Use {@link ApitogoProvider} instead. */
19
+ export const ZudokuProvider = ZudokuProviderImpl;
20
+
21
+ /** Prefer this over {@link ZudokuProvider}. */
22
+ export const ApitogoProvider = ZudokuProviderImpl;
@@ -2,6 +2,8 @@ export { Helmet as Head } from "@zudoku/react-helmet-async";
2
2
  export { Link } from "react-router";
3
3
  export { Button } from "../ui/Button.js";
4
4
  export { Callout } from "../ui/Callout.js";
5
+ export { ApitogoError } from "../util/invariant.js";
6
+ /** @deprecated Use {@link ApitogoError} instead. */
5
7
  export { ZudokuError } from "../util/invariant.js";
6
8
  export { ClientOnly } from "./ClientOnly.js";
7
9
  export { Heading } from "./Heading.js";
@@ -10,7 +12,12 @@ export { Search } from "./Search.js";
10
12
  export { type CustomSlotNames, Slot } from "./Slot.js";
11
13
  export { Spinner } from "./Spinner.js";
12
14
  export { Typography } from "./Typography.js";
15
+ export { Apitogo } from "./Zudoku.js";
16
+ /** @deprecated Use {@link Apitogo} instead. */
13
17
  export { Zudoku } from "./Zudoku.js";
18
+ export { ApitogoProvider } from "./context/ZudokuProvider.js";
19
+ /** @deprecated Use {@link ApitogoProvider} instead. */
20
+ export { ZudokuProvider } from "./context/ZudokuProvider.js";
14
21
 
15
22
  //
16
23
 
@@ -22,5 +29,6 @@ export { useTheme } from "next-themes";
22
29
  export { useAuth } from "../authentication/hook.js";
23
30
  /** @deprecated Import from `apitogo/hooks` instead */
24
31
  export { CACHE_KEYS, useCache } from "./cache.js";
25
- /** @deprecated Import from `apitogo/hooks` instead */
32
+ export { useApitogo } from "./context/ZudokuContext.js";
33
+ /** @deprecated Import {@link useApitogo} from `apitogo/hooks` instead */
26
34
  export { useZudoku } from "./context/ZudokuContext.js";