@lukoweb/apitogo 0.1.21 → 0.1.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.
Files changed (52) 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/dist/flat-config.d.ts +0 -1
  25. package/package.json +1 -1
  26. package/src/app/main.tsx +14 -11
  27. package/src/config/config.ts +7 -0
  28. package/src/config/create-plugin.ts +3 -3
  29. package/src/config/validators/BuildSchema.ts +7 -2
  30. package/src/config/validators/ZudokuConfig.ts +2 -3
  31. package/src/index.ts +13 -3
  32. package/src/lib/authentication/providers/clerk.tsx +2 -2
  33. package/src/lib/components/PluginHeads.tsx +2 -2
  34. package/src/lib/components/Zudoku.tsx +13 -8
  35. package/src/lib/components/context/ZudokuContext.ts +15 -5
  36. package/src/lib/components/context/ZudokuProvider.tsx +7 -1
  37. package/src/lib/components/index.ts +9 -1
  38. package/src/lib/core/ZudokuContext.ts +8 -8
  39. package/src/lib/core/plugins.ts +13 -13
  40. package/src/lib/hooks/index.ts +2 -0
  41. package/src/lib/hooks/useEvent.ts +12 -12
  42. package/src/lib/plugins/api-catalog/index.tsx +2 -2
  43. package/src/lib/plugins/api-keys/index.tsx +2 -2
  44. package/src/lib/plugins/markdown/index.tsx +2 -2
  45. package/src/lib/plugins/openapi/Sidecar.tsx +4 -2
  46. package/src/lib/plugins/openapi/index.tsx +6 -3
  47. package/src/lib/plugins/search-inkeep/index.tsx +2 -2
  48. package/src/lib/plugins/search-pagefind/index.tsx +2 -2
  49. package/src/lib/testing/index.tsx +11 -2
  50. package/src/lib/util/invariant.ts +16 -6
  51. package/src/types.d.ts +6 -6
  52. package/src/vite/config.ts +10 -6
@@ -7,7 +7,7 @@ export default function invariant(
7
7
  * the message takes a fair amount of effort to compute
8
8
  */
9
9
  message?: string | (() => string),
10
- options?: ZudokuErrorOptions,
10
+ options?: ApitogoErrorOptions,
11
11
  ): asserts condition {
12
12
  if (condition) {
13
13
  return;
@@ -17,26 +17,36 @@ export default function invariant(
17
17
  const provided: string | undefined =
18
18
  typeof message === "function" ? message() : message;
19
19
 
20
- throw new ZudokuError(provided ?? "Invariant failed", options);
20
+ throw new ApitogoError(provided ?? "Invariant failed", options);
21
21
  }
22
22
 
23
- export type ZudokuErrorOptions = {
23
+ export type ApitogoErrorOptions = {
24
24
  developerHint?: string;
25
25
  title?: string;
26
26
  cause?: Error;
27
27
  };
28
28
 
29
- export class ZudokuError extends Error {
29
+ /**
30
+ * @deprecated Use {@link ApitogoErrorOptions} instead.
31
+ */
32
+ export type ZudokuErrorOptions = ApitogoErrorOptions;
33
+
34
+ export class ApitogoError extends Error {
30
35
  public developerHint: string | undefined;
31
36
  public title: string | undefined;
32
37
 
33
38
  constructor(
34
39
  message: string,
35
- { developerHint, title, cause }: ZudokuErrorOptions = {},
40
+ { developerHint, title, cause }: ApitogoErrorOptions = {},
36
41
  ) {
37
42
  super(message, { cause });
38
- this.name = "ZudokuError";
43
+ this.name = "ApitogoError";
39
44
  this.title = title;
40
45
  this.developerHint = developerHint;
41
46
  }
42
47
  }
48
+
49
+ /**
50
+ * @deprecated Use {@link ApitogoError} instead.
51
+ */
52
+ export const ZudokuError = ApitogoError;
package/src/types.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  declare module "virtual:zudoku-docs-plugin" {
2
2
  export const configuredDocsPlugin:
3
- | import("./lib/core/plugins.ts").ZudokuPlugin
3
+ | import("./lib/core/plugins.ts").ApitogoPlugin
4
4
  | undefined;
5
5
  /**
6
6
  * Map of markdown files and imports
@@ -15,25 +15,25 @@ declare module "virtual:zudoku-navigation" {
15
15
  }
16
16
 
17
17
  declare module "virtual:zudoku-api-plugins" {
18
- export const configuredApiPlugins: import("./lib/core/plugins.ts").ZudokuPlugin[];
19
- export const configuredApiCatalogPlugins: import("./lib/core/plugins.ts").ZudokuPlugin[];
18
+ export const configuredApiPlugins: import("./lib/core/plugins.ts").ApitogoPlugin[];
19
+ export const configuredApiCatalogPlugins: import("./lib/core/plugins.ts").ApitogoPlugin[];
20
20
  }
21
21
 
22
22
  declare module "virtual:zudoku-search-plugin" {
23
23
  export const configuredSearchPlugin:
24
- | import("./lib/core/plugins.ts").ZudokuPlugin
24
+ | import("./lib/core/plugins.ts").ApitogoPlugin
25
25
  | undefined;
26
26
  }
27
27
 
28
28
  declare module "virtual:zudoku-api-keys-plugin" {
29
29
  export const configuredApiKeysPlugin:
30
- | import("./lib/core/plugins.ts").ZudokuPlugin
30
+ | import("./lib/core/plugins.ts").ApitogoPlugin
31
31
  | undefined;
32
32
  }
33
33
 
34
34
  declare module "virtual:zudoku-custom-pages-plugin" {
35
35
  export const configuredCustomPagesPlugin:
36
- | import("./lib/core/plugins.ts").ZudokuPlugin
36
+ | import("./lib/core/plugins.ts").ApitogoPlugin
37
37
  | undefined;
38
38
  }
39
39
 
@@ -242,12 +242,16 @@ export async function getViteConfig(
242
242
  }
243
243
  }
244
244
 
245
- // Create pagefind stub before Vite starts (dep scan / esbuild can open this path before plugin hooks run).
246
- if (config.search?.type === "pagefind") {
247
- const publicDir = resolveMergedPublicDir(dir, mergedViteConfig);
248
- if (publicDir) {
249
- await ensurePagefindDevStub(publicDir);
250
- }
245
+ // Create pagefind stub before Vite starts. In development, `optimizeDeps.entries` crawls all of
246
+ // `src/lib/**`, which includes PagefindSearch's dev import of `/pagefind/pagefind.js`; esbuild
247
+ // must be able to open that path even when search is not configured. Pagefind users still get
248
+ // the stub until a real index is written (dev index or production prerender).
249
+ const publicDir = resolveMergedPublicDir(dir, mergedViteConfig);
250
+ if (
251
+ publicDir &&
252
+ (configEnv.mode === "development" || config.search?.type === "pagefind")
253
+ ) {
254
+ await ensurePagefindDevStub(publicDir);
251
255
  }
252
256
 
253
257
  return mergedViteConfig;