@lukoweb/apitogo 0.1.21 → 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 +21 -18
  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 +10 -6
package/dist/cli/cli.js CHANGED
@@ -108,17 +108,17 @@ function invariant(condition, message, options) {
108
108
  return;
109
109
  }
110
110
  const provided = typeof message === "function" ? message() : message;
111
- throw new ZudokuError(provided ?? "Invariant failed", options);
111
+ throw new ApitogoError(provided ?? "Invariant failed", options);
112
112
  }
113
- var ZudokuError;
113
+ var ApitogoError;
114
114
  var init_invariant = __esm({
115
115
  "src/lib/util/invariant.ts"() {
116
- ZudokuError = class extends Error {
116
+ ApitogoError = class extends Error {
117
117
  developerHint;
118
118
  title;
119
119
  constructor(message, { developerHint, title, cause } = {}) {
120
120
  super(message, { cause });
121
- this.name = "ZudokuError";
121
+ this.name = "ApitogoError";
122
122
  this.title = title;
123
123
  this.developerHint = developerHint;
124
124
  }
@@ -3315,7 +3315,6 @@ var init_ZudokuConfig = __esm({
3315
3315
  logoUrl: z7.string(),
3316
3316
  dir: z7.enum(["ltr", "rtl"]).optional(),
3317
3317
  logo: LogoSchema,
3318
- showPoweredBy: z7.boolean().optional(),
3319
3318
  banner: z7.object({
3320
3319
  message: z7.custom(),
3321
3320
  color: z7.custom(
@@ -3822,7 +3821,7 @@ import {
3822
3821
  // package.json
3823
3822
  var package_default = {
3824
3823
  name: "@lukoweb/apitogo",
3825
- version: "0.1.21",
3824
+ version: "0.1.22",
3826
3825
  type: "module",
3827
3826
  sideEffects: [
3828
3827
  "**/*.css",
@@ -4428,7 +4427,12 @@ var BuildConfigSchema2 = z8.object({
4428
4427
  rehypePlugins: PluginConfigSchema.optional(),
4429
4428
  prerender: z8.object({ workers: z8.number().optional() }).optional()
4430
4429
  });
4431
- var zudokuBuildConfigFiles = [
4430
+ var buildConfigFiles = [
4431
+ "apitogo.build.js",
4432
+ "apitogo.build.jsx",
4433
+ "apitogo.build.ts",
4434
+ "apitogo.build.tsx",
4435
+ "apitogo.build.mjs",
4432
4436
  "zudoku.build.js",
4433
4437
  "zudoku.build.jsx",
4434
4438
  "zudoku.build.ts",
@@ -4436,7 +4440,7 @@ var zudokuBuildConfigFiles = [
4436
4440
  "zudoku.build.mjs"
4437
4441
  ];
4438
4442
  async function getBuildConfigFilePath(rootDir) {
4439
- for (const fileName of zudokuBuildConfigFiles) {
4443
+ for (const fileName of buildConfigFiles) {
4440
4444
  const filepath = path7.join(rootDir, fileName);
4441
4445
  if (await fileExists(filepath)) {
4442
4446
  return filepath;
@@ -7662,11 +7666,9 @@ async function getViteConfig(dir, configEnv) {
7662
7666
  });
7663
7667
  }
7664
7668
  }
7665
- if (config2.search?.type === "pagefind") {
7666
- const publicDir = resolveMergedPublicDir(dir, mergedViteConfig);
7667
- if (publicDir) {
7668
- await ensurePagefindDevStub(publicDir);
7669
- }
7669
+ const publicDir = resolveMergedPublicDir(dir, mergedViteConfig);
7670
+ if (publicDir && (configEnv.mode === "development" || config2.search?.type === "pagefind")) {
7671
+ await ensurePagefindDevStub(publicDir);
7670
7672
  }
7671
7673
  return mergedViteConfig;
7672
7674
  }
@@ -9459,9 +9461,10 @@ var titleCase = (value) => value.split(/[-_\s]+/).filter(Boolean).map((part) =>
9459
9461
  var docSortRank = (docPath) => {
9460
9462
  const lastSegment = docPath.split("/").at(-1) ?? docPath;
9461
9463
  if (lastSegment === "introduction") return 0;
9462
- if (lastSegment === "getting-started") return 1;
9463
- if (lastSegment === "index") return 2;
9464
- return 3;
9464
+ if (lastSegment === "example") return 1;
9465
+ if (lastSegment === "getting-started") return 2;
9466
+ if (lastSegment === "index") return 3;
9467
+ return 4;
9465
9468
  };
9466
9469
  var sortDocPaths = (docPaths) => [...docPaths].sort((a, b) => {
9467
9470
  const rankDiff = docSortRank(a) - docSortRank(b);
@@ -10026,7 +10029,7 @@ ${colors10.gray("Upgrade to receive the latest features and fixes.")}`
10026
10029
  }
10027
10030
  async function getLatestVersion() {
10028
10031
  const response = await fetch(
10029
- "https://api.github.com/repos/zuplo/zudoku/releases?per_page=1"
10032
+ "https://api.github.com/repos/lukoweb/apitogo-doc-tool/releases?per_page=1"
10030
10033
  );
10031
10034
  if (response.status === 200) {
10032
10035
  const result = await response.json();
@@ -10121,7 +10124,7 @@ var warnPackageVersionMismatch = () => {
10121
10124
  const pkgManager = getPkgManager();
10122
10125
  const message = `${colors11.yellow("React version mismatch detected!")}
10123
10126
 
10124
- Zudoku requires specific versions of React
10127
+ APIToGo requires specific versions of React
10125
10128
  and React DOM to function correctly.
10126
10129
 
10127
10130
  Installed: ${colors11.bold(`react@${installed.react}, react-dom@${installed["react-dom"]}`)}
@@ -1,12 +1,13 @@
1
1
  import type { RouteObject } from "react-router";
2
2
  import type { HighlighterCore } from "shiki";
3
3
  import "virtual:zudoku-theme.css";
4
- import type { ZudokuConfig } from "../config/config.js";
4
+ import type { ApitogoConfig } from "../config/config.js";
5
5
  import "./main.css";
6
6
  import "./polyfills.js";
7
7
  import type { ZudokuContextOptions } from "../lib/core/ZudokuContext.js";
8
8
  export declare const shikiReady: Promise<HighlighterCore>;
9
- export declare const convertZudokuConfigToOptions: (config: ZudokuConfig) => ZudokuContextOptions;
9
+ export declare const convertApitogoConfigToOptions: (config: ApitogoConfig) => ZudokuContextOptions;
10
+ export declare const convertZudokuConfigToOptions: (config: ApitogoConfig) => ZudokuContextOptions;
10
11
  export declare const getRoutesByOptions: (options: ZudokuContextOptions, enableStatusPages?: boolean) => ({
11
12
  errorElement: import("react/jsx-runtime").JSX.Element;
12
13
  caseSensitive?: boolean | undefined;
@@ -98,4 +99,4 @@ export declare const getRoutesByOptions: (options: ZudokuContextOptions, enableS
98
99
  ErrorBoundary?: (() => Promise<import("react").ComponentType<{}> | null | undefined>) | undefined;
99
100
  }) | import("react-router").LazyRouteFunction<RouteObject>;
100
101
  })[];
101
- export declare const getRoutesByConfig: (config: ZudokuConfig) => RouteObject[];
102
+ export declare const getRoutesByConfig: (config: ApitogoConfig) => RouteObject[];
@@ -1,6 +1,7 @@
1
1
  import type { ConfigWithMeta } from "./loader.js";
2
2
  import type { BuildConfig } from "./validators/BuildSchema.js";
3
3
  import type { AuthenticationConfig, ZudokuConfig } from "./validators/ZudokuConfig.js";
4
+ export type ApitogoBuildConfig = BuildConfig;
4
5
  export type ZudokuBuildConfig = BuildConfig;
5
6
  export type LoadedConfig = ConfigWithMeta;
6
7
  export type { ZudokuConfig as ApitogoConfig };
@@ -1,2 +1,2 @@
1
- import { type ZudokuPlugin } from "../lib/core/plugins.js";
2
- export declare const createPlugin: <TOptions extends unknown[]>(factory: (...options: TOptions) => ZudokuPlugin) => ((...options: TOptions) => ZudokuPlugin);
1
+ import { type ApitogoPlugin } from "../lib/core/plugins.js";
2
+ export declare const createPlugin: <TOptions extends unknown[]>(factory: (...options: TOptions) => ApitogoPlugin) => ((...options: TOptions) => ApitogoPlugin);
@@ -5,7 +5,7 @@ import { z } from "zod";
5
5
  import type { UseAuthReturn } from "../../lib/authentication/hook.js";
6
6
  import type { AuthState } from "../../lib/authentication/state.js";
7
7
  import type { SlotType } from "../../lib/components/context/SlotProvider.js";
8
- import type { ZudokuPlugin } from "../../lib/core/plugins.js";
8
+ import type { ApitogoPlugin } from "../../lib/core/plugins.js";
9
9
  import type { ZudokuContext } from "../../lib/core/ZudokuContext.js";
10
10
  import type { FilterCatalogItemsFn } from "../../lib/plugins/api-catalog/index.js";
11
11
  import type { ApiConsumer } from "../../lib/plugins/api-keys/index.js";
@@ -420,7 +420,7 @@ export declare const ZudokuConfig: z.ZodObject<{
420
420
  render: z.ZodOptional<z.ZodCustom<ComponentType<ExposedComponentProps>, ComponentType<ExposedComponentProps>>>;
421
421
  prose: z.ZodOptional<z.ZodBoolean>;
422
422
  }, z.core.$strip>>>;
423
- plugins: z.ZodOptional<z.ZodArray<z.ZodCustom<ZudokuPlugin, ZudokuPlugin>>>;
423
+ plugins: z.ZodOptional<z.ZodArray<z.ZodCustom<ApitogoPlugin, ApitogoPlugin>>>;
424
424
  build: z.ZodOptional<z.ZodCustom<{
425
425
  remarkPlugins?: Options["remarkPlugins"];
426
426
  rehypePlugins?: Options["rehypePlugins"];
@@ -464,7 +464,6 @@ export declare const ZudokuConfig: z.ZodObject<{
464
464
  href: z.ZodOptional<z.ZodString>;
465
465
  reloadDocument: z.ZodOptional<z.ZodBoolean>;
466
466
  }, z.core.$strip>>;
467
- showPoweredBy: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
468
467
  banner: z.ZodOptional<z.ZodObject<{
469
468
  message: z.ZodCustom<NonNullable<ReactNode>, NonNullable<ReactNode>>;
470
469
  color: z.ZodOptional<z.ZodCustom<"info" | (string & {}) | "note" | "tip" | "caution" | "danger", "info" | (string & {}) | "note" | "tip" | "caution" | "danger">>;
@@ -1,10 +1,14 @@
1
- export type { ApitogoConfig, ZudokuBuildConfig } from "./config/config.js";
1
+ export type { ApitogoBuildConfig, ApitogoConfig, ZudokuBuildConfig, } from "./config/config.js";
2
2
  export { createPlugin } from "./config/create-plugin.js";
3
3
  export type { InputNavigation as Navigation } from "./config/validators/InputNavigationSchema.js";
4
4
  export type { SlotType } from "./lib/components/context/SlotProvider.js";
5
5
  export { type CustomSlotNames, Slot, type SlotName, } from "./lib/components/Slot.js";
6
- export type { ApiIdentityPlugin, AuthenticationPlugin, CommonPlugin, NavigationPlugin, ProfileMenuPlugin, ProfileNavigationItem, RouteObject, SearchProviderPlugin, TransformConfigContext, ZudokuPlugin, } from "./lib/core/plugins.js";
7
- export { type ApiIdentity, ZudokuContext } from "./lib/core/ZudokuContext.js";
6
+ export type { ApiIdentityPlugin, AuthenticationPlugin, CommonPlugin, NavigationPlugin, ProfileMenuPlugin, ProfileNavigationItem, RouteObject, SearchProviderPlugin, TransformConfigContext, ApitogoPlugin, } from "./lib/core/plugins.js";
7
+ export type { ApiIdentity, ApitogoEvents } from "./lib/core/ZudokuContext.js";
8
+ export type { ZudokuContextOptions } from "./lib/core/ZudokuContext.js";
9
+ export type { ZudokuContextOptions as ApitogoContextOptions } from "./lib/core/ZudokuContext.js";
10
+ export { ZudokuContext } from "./lib/core/ZudokuContext.js";
11
+ export { ZudokuContext as ApitogoContext } from "./lib/core/ZudokuContext.js";
8
12
  export { useEvent } from "./lib/hooks/index.js";
9
13
  export type { MDXImport } from "./lib/plugins/markdown/index.js";
10
14
  export { defaultLanguages } from "./lib/shiki.js";
@@ -1,6 +1,6 @@
1
1
  import type { Location } from "react-router";
2
- import { type ZudokuPlugin } from "../core/plugins.js";
2
+ import { type ApitogoPlugin } from "../core/plugins.js";
3
3
  export declare const PluginHeads: ({ plugins, location, }: {
4
- plugins: ZudokuPlugin[];
4
+ plugins: ApitogoPlugin[];
5
5
  location: Location;
6
6
  }) => import("react/jsx-runtime").JSX.Element[];
@@ -1,9 +1,15 @@
1
1
  import { type PropsWithChildren } from "react";
2
2
  import { type ZudokuContextOptions } from "../core/ZudokuContext.js";
3
+ declare const Apitogo: {
4
+ (props: PropsWithChildren<ZudokuContextOptions & {
5
+ env?: Record<string, string>;
6
+ }>): import("react/jsx-runtime").JSX.Element;
7
+ displayName: string;
8
+ };
3
9
  declare const Zudoku: {
4
10
  (props: PropsWithChildren<ZudokuContextOptions & {
5
11
  env?: Record<string, string>;
6
12
  }>): import("react/jsx-runtime").JSX.Element;
7
13
  displayName: string;
8
14
  };
9
- export { Zudoku };
15
+ export { Apitogo, Zudoku };
@@ -1,4 +1,5 @@
1
1
  import type { NavigationItem } from "../../../config/validators/NavigationSchema.js";
2
+ export declare const useApitogo: () => import("../../core/ZudokuContext.js").ZudokuContext;
2
3
  export declare const useZudoku: () => import("../../core/ZudokuContext.js").ZudokuContext;
3
4
  export declare const useApiIdentities: () => import("@tanstack/react-query").UseQueryResult<import("../../core/ZudokuContext.js").ApiIdentity[], Error>;
4
5
  export declare const useCurrentNavigation: () => {
@@ -3,3 +3,6 @@ import type { ZudokuContext } from "../../core/ZudokuContext.js";
3
3
  export declare const ZudokuProvider: ({ children, context, }: PropsWithChildren<{
4
4
  context: ZudokuContext;
5
5
  }>) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const ApitogoProvider: ({ children, context, }: PropsWithChildren<{
7
+ context: ZudokuContext;
8
+ }>) => import("react/jsx-runtime").JSX.Element;
@@ -2,6 +2,7 @@ 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";
5
6
  export { ZudokuError } from "../util/invariant.js";
6
7
  export { ClientOnly } from "./ClientOnly.js";
7
8
  export { Heading } from "./Heading.js";
@@ -10,9 +11,13 @@ export { Search } from "./Search.js";
10
11
  export { type CustomSlotNames, Slot } from "./Slot.js";
11
12
  export { Spinner } from "./Spinner.js";
12
13
  export { Typography } from "./Typography.js";
14
+ export { Apitogo } from "./Zudoku.js";
13
15
  export { Zudoku } from "./Zudoku.js";
16
+ export { ApitogoProvider } from "./context/ZudokuProvider.js";
17
+ export { ZudokuProvider } from "./context/ZudokuProvider.js";
14
18
  export { useMDXComponents } from "@mdx-js/react";
15
19
  export { useTheme } from "next-themes";
16
20
  export { useAuth } from "../authentication/hook.js";
17
21
  export { CACHE_KEYS, useCache } from "./cache.js";
22
+ export { useApitogo } from "./context/ZudokuContext.js";
18
23
  export { useZudoku } from "./context/ZudokuContext.js";
@@ -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.21",
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;