@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.
- package/dist/cli/cli.js +21 -18
- package/dist/declarations/app/main.d.ts +4 -3
- package/dist/declarations/config/config.d.ts +1 -0
- package/dist/declarations/config/create-plugin.d.ts +2 -2
- package/dist/declarations/config/validators/ZudokuConfig.d.ts +2 -3
- package/dist/declarations/index.d.ts +7 -3
- package/dist/declarations/lib/components/PluginHeads.d.ts +2 -2
- package/dist/declarations/lib/components/Zudoku.d.ts +7 -1
- package/dist/declarations/lib/components/context/ZudokuContext.d.ts +1 -0
- package/dist/declarations/lib/components/context/ZudokuProvider.d.ts +3 -0
- package/dist/declarations/lib/components/index.d.ts +5 -0
- package/dist/declarations/lib/core/ZudokuContext.d.ts +5 -5
- package/dist/declarations/lib/core/plugins.d.ts +13 -13
- package/dist/declarations/lib/hooks/index.d.ts +1 -0
- package/dist/declarations/lib/hooks/useEvent.d.ts +4 -4
- package/dist/declarations/lib/plugins/api-catalog/index.d.ts +2 -2
- package/dist/declarations/lib/plugins/api-keys/index.d.ts +2 -2
- package/dist/declarations/lib/plugins/markdown/index.d.ts +2 -2
- package/dist/declarations/lib/plugins/openapi/index.d.ts +2 -2
- package/dist/declarations/lib/plugins/search-inkeep/index.d.ts +2 -2
- package/dist/declarations/lib/plugins/search-pagefind/index.d.ts +2 -2
- package/dist/declarations/lib/testing/index.d.ts +3 -2
- package/dist/declarations/lib/util/invariant.d.ts +6 -4
- package/dist/flat-config.d.ts +0 -1
- package/package.json +1 -1
- package/src/app/main.tsx +14 -11
- package/src/config/config.ts +7 -0
- package/src/config/create-plugin.ts +3 -3
- package/src/config/validators/BuildSchema.ts +7 -2
- package/src/config/validators/ZudokuConfig.ts +2 -3
- package/src/index.ts +13 -3
- package/src/lib/authentication/providers/clerk.tsx +2 -2
- package/src/lib/components/PluginHeads.tsx +2 -2
- package/src/lib/components/Zudoku.tsx +13 -8
- package/src/lib/components/context/ZudokuContext.ts +15 -5
- package/src/lib/components/context/ZudokuProvider.tsx +7 -1
- package/src/lib/components/index.ts +9 -1
- package/src/lib/core/ZudokuContext.ts +8 -8
- package/src/lib/core/plugins.ts +13 -13
- package/src/lib/hooks/index.ts +2 -0
- package/src/lib/hooks/useEvent.ts +12 -12
- package/src/lib/plugins/api-catalog/index.tsx +2 -2
- package/src/lib/plugins/api-keys/index.tsx +2 -2
- package/src/lib/plugins/markdown/index.tsx +2 -2
- package/src/lib/plugins/openapi/Sidecar.tsx +4 -2
- package/src/lib/plugins/openapi/index.tsx +6 -3
- package/src/lib/plugins/search-inkeep/index.tsx +2 -2
- package/src/lib/plugins/search-pagefind/index.tsx +2 -2
- package/src/lib/testing/index.tsx +11 -2
- package/src/lib/util/invariant.ts +16 -6
- package/src/types.d.ts +6 -6
- 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?:
|
|
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
|
|
20
|
+
throw new ApitogoError(provided ?? "Invariant failed", options);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
export type
|
|
23
|
+
export type ApitogoErrorOptions = {
|
|
24
24
|
developerHint?: string;
|
|
25
25
|
title?: string;
|
|
26
26
|
cause?: Error;
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
|
|
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 }:
|
|
40
|
+
{ developerHint, title, cause }: ApitogoErrorOptions = {},
|
|
36
41
|
) {
|
|
37
42
|
super(message, { cause });
|
|
38
|
-
this.name = "
|
|
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").
|
|
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").
|
|
19
|
-
export const configuredApiCatalogPlugins: import("./lib/core/plugins.ts").
|
|
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").
|
|
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").
|
|
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").
|
|
36
|
+
| import("./lib/core/plugins.ts").ApitogoPlugin
|
|
37
37
|
| undefined;
|
|
38
38
|
}
|
|
39
39
|
|
package/src/vite/config.ts
CHANGED
|
@@ -242,12 +242,16 @@ export async function getViteConfig(
|
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
244
|
|
|
245
|
-
// Create pagefind stub before Vite starts
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
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;
|