zudoku 0.3.0-dev.20 → 0.3.0-dev.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 (78) hide show
  1. package/dist/config/config.d.ts +1 -1
  2. package/dist/lib/authentication/authentication.d.ts +1 -1
  3. package/dist/lib/plugins/api-keys/index.js +1 -0
  4. package/dist/lib/plugins/api-keys/index.js.map +1 -1
  5. package/dist/lib/plugins/markdown/generateRoutes.js +1 -1
  6. package/dist/lib/plugins/markdown/generateRoutes.js.map +1 -1
  7. package/dist/lib/plugins/openapi/OperationList.js +1 -1
  8. package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
  9. package/dist/lib/plugins/openapi/PlaygroundDialogWrapper.js +1 -1
  10. package/dist/lib/plugins/openapi/PlaygroundDialogWrapper.js.map +1 -1
  11. package/dist/lib/plugins/openapi/Route.d.ts +6 -0
  12. package/dist/lib/plugins/openapi/Route.js +8 -0
  13. package/dist/lib/plugins/openapi/Route.js.map +1 -0
  14. package/dist/lib/plugins/openapi/context.d.ts +5 -0
  15. package/dist/lib/plugins/openapi/context.js +11 -0
  16. package/dist/lib/plugins/openapi/context.js.map +1 -0
  17. package/dist/lib/plugins/openapi/index.d.ts +1 -19
  18. package/dist/lib/plugins/openapi/index.js +17 -18
  19. package/dist/lib/plugins/openapi/index.js.map +1 -1
  20. package/dist/lib/plugins/openapi/interfaces.d.ts +15 -0
  21. package/dist/lib/plugins/openapi/interfaces.js +2 -0
  22. package/dist/lib/plugins/openapi/interfaces.js.map +1 -0
  23. package/dist/vite/build.js +4 -1
  24. package/dist/vite/build.js.map +1 -1
  25. package/dist/vite/config.d.ts +7 -7
  26. package/dist/vite/config.js +33 -38
  27. package/dist/vite/config.js.map +1 -1
  28. package/dist/vite/config.test.js +6 -3
  29. package/dist/vite/config.test.js.map +1 -1
  30. package/dist/vite/dev-server.js +3 -3
  31. package/dist/vite/dev-server.js.map +1 -1
  32. package/dist/vite/plugin-api-keys.js +2 -2
  33. package/dist/vite/plugin-api-keys.js.map +1 -1
  34. package/dist/vite/plugin-api.js +2 -2
  35. package/dist/vite/plugin-api.js.map +1 -1
  36. package/dist/vite/plugin-auth.js +2 -2
  37. package/dist/vite/plugin-auth.js.map +1 -1
  38. package/dist/vite/plugin-config.d.ts +1 -1
  39. package/dist/vite/plugin-config.js +7 -6
  40. package/dist/vite/plugin-config.js.map +1 -1
  41. package/dist/vite/plugin-redirect.js +2 -2
  42. package/dist/vite/plugin-redirect.js.map +1 -1
  43. package/lib/{util-voKLTRDG.js → AnchorLink-DIUlXlf0.js} +149 -184
  44. package/lib/DevPortalProvider-gzyAGqHT.js +1080 -0
  45. package/lib/{Markdown-5LmPZyLV.js → Markdown-BjA7peYW.js} +3 -3
  46. package/lib/{MdxComponents-DYD_QPVF.js → MdxComponents-W-fE1ISO.js} +130 -129
  47. package/lib/MdxPage-DQ7lZBzE.js +216 -0
  48. package/lib/OperationList-DuIBqFNA.js +5545 -0
  49. package/lib/Route-B98Y2MdH.js +13 -0
  50. package/lib/{Select-DR3PiqjV.js → Select-DczD5e29.js} +24 -22
  51. package/lib/{Spinner-DjQ2eBxC.js → Spinner-CSoij67T.js} +3 -3
  52. package/lib/cn-DpqTslo9.js +2341 -0
  53. package/lib/context-_fYfJFgk.js +13 -0
  54. package/lib/{hook-FCY9-FHO.js → hook-CBXxHulF.js} +1 -1
  55. package/lib/{index-By9bEW57.js → index-C7O9D7f6.js} +15 -15
  56. package/lib/index-CKvOcM7w.js +712 -0
  57. package/lib/index-Cg6lXS1z.js +709 -0
  58. package/lib/index-ClDDiRmC.js +463 -0
  59. package/lib/router-DibNxKUP.js +3008 -0
  60. package/lib/util-CaVongBq.js +40 -0
  61. package/lib/zudoku.auth-openid.js +7 -6
  62. package/lib/zudoku.components.js +73 -69
  63. package/lib/zudoku.plugin-api-keys.js +26 -23
  64. package/lib/zudoku.plugin-markdown.js +33 -237
  65. package/lib/zudoku.plugin-openapi.js +5 -6238
  66. package/lib/zudoku.plugin-redirect.js +7 -6
  67. package/package.json +1 -2
  68. package/src/lib/authentication/authentication.ts +1 -1
  69. package/src/lib/plugins/api-keys/index.tsx +1 -0
  70. package/src/lib/plugins/markdown/generateRoutes.tsx +2 -2
  71. package/src/lib/plugins/openapi/OperationList.tsx +1 -1
  72. package/src/lib/plugins/openapi/PlaygroundDialogWrapper.tsx +1 -1
  73. package/src/lib/plugins/openapi/Route.tsx +21 -0
  74. package/src/lib/plugins/openapi/context.tsx +16 -0
  75. package/src/lib/plugins/openapi/index.tsx +19 -46
  76. package/src/lib/plugins/openapi/interfaces.ts +9 -0
  77. package/lib/DevPortalProvider-CRKuwoXc.js +0 -4123
  78. package/lib/index-PyGcnQFX.js +0 -3462
@@ -1,10 +1,11 @@
1
- import { j as a, N as i } from "./index-PyGcnQFX.js";
2
- const m = (e) => ({
3
- getRoutes: () => e.redirects.map(({ from: t, to: r, replace: s }) => ({
4
- path: t,
5
- element: /* @__PURE__ */ a.jsx(i, { to: r, replace: s })
1
+ import { j as s } from "./router-DibNxKUP.js";
2
+ import { N as i } from "./index-ClDDiRmC.js";
3
+ const p = (t) => ({
4
+ getRoutes: () => t.redirects.map(({ from: e, to: r, replace: o }) => ({
5
+ path: e,
6
+ element: /* @__PURE__ */ s.jsx(i, { to: r, replace: o })
6
7
  }))
7
8
  });
8
9
  export {
9
- m as redirectPlugin
10
+ p as redirectPlugin
10
11
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zudoku",
3
- "version": "0.3.0-dev.20",
3
+ "version": "0.3.0-dev.22",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -78,7 +78,6 @@
78
78
  "autoprefixer": "10.4.19",
79
79
  "chokidar": "^3.6.0",
80
80
  "dotenv": "16.4.5",
81
- "esbuild": "0.23.0",
82
81
  "express": "4.19.2",
83
82
  "graphql": "16.9.0",
84
83
  "graphql-type-json": "0.3.2",
@@ -1,4 +1,4 @@
1
- import { CommonPlugin, NavigationPlugin } from "../../lib/core/plugins.js";
1
+ import { CommonPlugin, NavigationPlugin } from "../core/plugins.js";
2
2
 
3
3
  type AuthenticationPlugin = NavigationPlugin & CommonPlugin;
4
4
 
@@ -139,6 +139,7 @@ export const apiKeyPlugin = (
139
139
  }
140
140
  },
141
141
  getRoutes: () => {
142
+ // TODO: Make lazy
142
143
  return [
143
144
  {
144
145
  element: <ProtectedRoute />,
@@ -2,7 +2,7 @@ import { useTopNavigationItem } from "../../components/context/DevPortalProvider
2
2
  import { isPathItem } from "../../components/navigation/util.js";
3
3
  import { Navigate, type RouteObject } from "../../core/router.js";
4
4
  import { traverseNavigation } from "../../util/traverseNavigation.js";
5
- import { MdxPage } from "./MdxPage.js";
5
+
6
6
  import {
7
7
  MarkdownPluginDefaultOptions,
8
8
  MarkdownPluginOptions,
@@ -29,8 +29,8 @@ export const generateRoutes = (
29
29
  return {
30
30
  path: routePath,
31
31
  lazy: async () => {
32
+ const { MdxPage } = await import("./MdxPage.js");
32
33
  const { default: Component, ...props } = await importPromise();
33
-
34
34
  return {
35
35
  element: (
36
36
  <MdxPage
@@ -4,8 +4,8 @@ import { Heading } from "../../components/Heading.js";
4
4
  import { Markdown } from "../../components/Markdown.js";
5
5
  import { cn } from "../../util/cn.js";
6
6
  import { OperationListItem } from "./OperationListItem.js";
7
+ import { useOasConfig } from "./context.js";
7
8
  import { graphql } from "./graphql/index.js";
8
- import { useOasConfig } from "./index.js";
9
9
  import { SchemaProseClasses } from "./util/prose.js";
10
10
  import { useQuery } from "./util/urql.js";
11
11
 
@@ -1,5 +1,5 @@
1
+ import { useOasConfig } from "./context.js";
1
2
  import { graphql } from "./graphql/index.js";
2
- import { useOasConfig } from "./index.js";
3
3
  import type { OperationListItemResult } from "./OperationList.js";
4
4
  import { PlaygroundDialog } from "./playground/PlaygroundDialog.js";
5
5
 
@@ -0,0 +1,21 @@
1
+ import { Outlet } from "../../core/router.js";
2
+ import { OasConfigProvider } from "./context.js";
3
+ import { OasPluginConfig } from "./interfaces.js";
4
+
5
+ import { Provider, Client as UrqlClient } from "./util/urql.js";
6
+
7
+ export function OpenApiRoute({
8
+ config,
9
+ client,
10
+ }: {
11
+ config: OasPluginConfig;
12
+ client: typeof UrqlClient;
13
+ }) {
14
+ return (
15
+ <Provider value={client}>
16
+ <OasConfigProvider value={{ config }}>
17
+ <Outlet />
18
+ </OasConfigProvider>
19
+ </Provider>
20
+ );
21
+ }
@@ -0,0 +1,16 @@
1
+ import { createContext, useContext } from "react";
2
+ import { OasPluginConfig } from "./interfaces.js";
3
+
4
+ const OasContext = createContext<{ config: OasPluginConfig } | undefined>(
5
+ undefined,
6
+ );
7
+
8
+ export const OasConfigProvider = OasContext.Provider;
9
+
10
+ export const useOasConfig = () => {
11
+ const ctx = useContext(OasContext);
12
+ if (!ctx) {
13
+ throw new Error("useOasConfig must be used within a OasConfigProvider");
14
+ }
15
+ return ctx.config;
16
+ };
@@ -1,60 +1,18 @@
1
- import { createContext, useContext } from "react";
2
1
  import {
3
2
  type DevPortalPlugin,
4
3
  type PluginNavigationCategory,
5
4
  } from "../../core/plugins.js";
6
- import { Outlet, matchPath, type RouteObject } from "../../core/router.js";
5
+ import { matchPath, type RouteObject } from "../../core/router.js";
7
6
  import { MethodBadge } from "./MethodBadge.js";
8
- import { OperationList } from "./OperationList.js";
9
7
  import { graphql } from "./graphql/index.js";
10
8
  import {
11
- Provider,
12
9
  Client as UrqlClient,
13
10
  cacheExchange,
14
11
  fetchExchange,
15
12
  } from "./util/urql.js";
16
13
 
17
14
  import { createSharedWorkerClient } from "virtual:zudoku-openapi-worker";
18
-
19
- const OasContext = createContext<{ config: OasPluginConfig } | undefined>(
20
- undefined,
21
- );
22
-
23
- export const OasConfigProvider = OasContext.Provider;
24
-
25
- export const useOasConfig = () => {
26
- const ctx = useContext(OasContext);
27
- if (!ctx) {
28
- throw new Error("useOasConfig must be used within a OasConfigProvider");
29
- }
30
- return ctx.config;
31
- };
32
-
33
- type OasSource =
34
- | { type: "url"; input: string }
35
- | { type: "yaml"; input: string }
36
- | { type: "json"; input: object };
37
-
38
- export type OasPluginConfig = {
39
- server?: string;
40
- path?: string;
41
- } & OasSource;
42
-
43
- const OasContextProvider = ({
44
- config,
45
- client,
46
- }: {
47
- config: OasPluginConfig;
48
- client: typeof UrqlClient;
49
- }) => {
50
- return (
51
- <Provider value={client}>
52
- <OasConfigProvider value={{ config }}>
53
- <Outlet />
54
- </OasConfigProvider>
55
- </Provider>
56
- );
57
- };
15
+ import { OasPluginConfig } from "./interfaces.js";
58
16
 
59
17
  const GetCategoriesQuery = graphql(`
60
18
  query GetCategories($input: JSON!, $type: SchemaType!) {
@@ -148,11 +106,26 @@ export const openApiPlugin = (config: OasPluginConfig): DevPortalPlugin => {
148
106
  getRoutes: () =>
149
107
  [
150
108
  {
151
- element: <OasContextProvider config={config} client={client} />,
109
+ async lazy() {
110
+ const { OpenApiRoute } = await import("./Route.js");
111
+ return {
112
+ element: <OpenApiRoute client={client} config={config} />,
113
+ };
114
+ },
152
115
  children: [
153
116
  {
154
117
  path: basePath,
155
- children: [{ index: true, element: <OperationList /> }],
118
+ children: [
119
+ {
120
+ index: true,
121
+ async lazy() {
122
+ const { OperationList } = await import(
123
+ "./OperationList.js"
124
+ );
125
+ return { element: <OperationList /> };
126
+ },
127
+ },
128
+ ],
156
129
  },
157
130
  ],
158
131
  },
@@ -0,0 +1,9 @@
1
+ type OasSource =
2
+ | { type: "url"; input: string }
3
+ | { type: "yaml"; input: string }
4
+ | { type: "json"; input: object };
5
+
6
+ export type OasPluginConfig = {
7
+ server?: string;
8
+ path?: string;
9
+ } & OasSource;