zudoku 0.3.0-dev.35 → 0.3.0-dev.37
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/app/entry.client.js +1 -1
- package/dist/app/entry.client.js.map +1 -1
- package/dist/internal.d.ts +2 -0
- package/dist/internal.js +3 -0
- package/dist/internal.js.map +1 -0
- package/dist/lib/components/index.d.ts +2 -0
- package/dist/lib/components/index.js +2 -0
- package/dist/lib/components/index.js.map +1 -1
- package/dist/{app → lib}/main.d.ts +3 -3
- package/dist/{app → lib}/main.js +4 -3
- package/dist/lib/main.js.map +1 -0
- package/dist/vite/config.js +5 -2
- package/dist/vite/config.js.map +1 -1
- package/dist/vite/plugin-component.js +1 -0
- package/dist/vite/plugin-component.js.map +1 -1
- package/dist/{app → vite/ssr}/entry.server.d.ts +1 -1
- package/dist/{app → vite/ssr}/entry.server.js +3 -3
- package/dist/vite/ssr/entry.server.js.map +1 -0
- package/dist/{app → vite/ssr}/zudoku-manifest.js +1 -1
- package/dist/vite/ssr/zudoku-manifest.js.map +1 -0
- package/lib/{AnchorLink-DCzimaMt.js → AnchorLink-Sx89bfCW.js} +2 -2
- package/lib/{AnchorLink-DCzimaMt.js.map → AnchorLink-Sx89bfCW.js.map} +1 -1
- package/lib/Markdown-DMEnjeMH.js +14499 -0
- package/lib/Markdown-DMEnjeMH.js.map +1 -0
- package/lib/{MdxPage-CGTgSCJL.js → MdxPage-s9RlKFtt.js} +25 -26
- package/lib/{MdxPage-CGTgSCJL.js.map → MdxPage-s9RlKFtt.js.map} +1 -1
- package/lib/{OperationList-BDAtLdf9.js → OperationList-9NIdTqS0.js} +15 -16
- package/lib/{OperationList-BDAtLdf9.js.map → OperationList-9NIdTqS0.js.map} +1 -1
- package/lib/{Select-DIOQWPp3.js → Select-CJamK_wp.js} +2 -2
- package/lib/{Select-DIOQWPp3.js.map → Select-CJamK_wp.js.map} +1 -1
- package/lib/{Spinner-B9MAj2Pw.js → Spinner-3YT-WUu5.js} +2 -2
- package/lib/{Spinner-B9MAj2Pw.js.map → Spinner-3YT-WUu5.js.map} +1 -1
- package/lib/hook-Cq3Jb1lX.js +77 -0
- package/lib/hook-Cq3Jb1lX.js.map +1 -0
- package/lib/{index-CdZQPXUQ.js → index-DhKGMJM2.js} +17 -18
- package/lib/{index-CdZQPXUQ.js.map → index-DhKGMJM2.js.map} +1 -1
- package/lib/zudoku.components.js +103 -102
- package/lib/zudoku.components.js.map +1 -1
- package/lib/zudoku.plugin-api-keys.js +50 -92
- package/lib/zudoku.plugin-api-keys.js.map +1 -1
- package/lib/zudoku.plugin-markdown.js +1 -1
- package/lib/zudoku.plugin-openapi.js +2 -2
- package/package.json +7 -1
- package/src/app/entry.client.tsx +1 -2
- package/src/lib/components/index.ts +2 -0
- package/src/{app → lib}/main.tsx +4 -3
- package/dist/app/entry.server.js.map +0 -1
- package/dist/app/main.js.map +0 -1
- package/dist/app/zudoku-manifest.js.map +0 -1
- package/lib/Markdown-kde-UTpz.js +0 -8620
- package/lib/Markdown-kde-UTpz.js.map +0 -1
- package/lib/MdxComponents-BZ-Y_6jI.js +0 -5885
- package/lib/MdxComponents-BZ-Y_6jI.js.map +0 -1
- package/lib/hook-D1DiFbcT.js +0 -35
- package/lib/hook-D1DiFbcT.js.map +0 -1
- package/src/app/entry.server.tsx +0 -158
- package/src/app/zudoku-manifest.ts +0 -22
- /package/dist/{app → vite/ssr}/zudoku-manifest.d.ts +0 -0
package/lib/hook-D1DiFbcT.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { j as s } from "./jsx-runtime-Bt86M5tA.js";
|
|
2
|
-
import { u as i } from "./DevPortalProvider-Demv4Ngx.js";
|
|
3
|
-
import { u as a } from "./state-Ds_OxRHP.js";
|
|
4
|
-
function r({ error: t }) {
|
|
5
|
-
const n = (t == null ? void 0 : t.message) ?? "Something went wrong", e = t == null ? void 0 : t.stack;
|
|
6
|
-
return /* @__PURE__ */ s.jsx("div", { className: "flex h-screen max-h-screen min-h-full items-center justify-center bg-primary-background px-4 py-16 lg:px-8", children: /* @__PURE__ */ s.jsxs("div", { className: "mx-auto max-w-[85%] sm:max-w-[50%]", children: [
|
|
7
|
-
/* @__PURE__ */ s.jsx("h1", { className: "text-4xl font-bold tracking-tight text-h1-text sm:text-5xl", children: "Something went wrong" }),
|
|
8
|
-
/* @__PURE__ */ s.jsx("p", { className: "mt-5 text-h1-text", children: n }),
|
|
9
|
-
e ? /* @__PURE__ */ s.jsx("pre", { className: "mt-5 max-h-[400px] w-full overflow-scroll rounded-md border border-input-border bg-input-background p-3 text-property-name-text text-red-700", children: e }) : null
|
|
10
|
-
] }) });
|
|
11
|
-
}
|
|
12
|
-
const u = () => {
|
|
13
|
-
const { authentication: t } = i(), n = a(), e = typeof t < "u";
|
|
14
|
-
return {
|
|
15
|
-
isAuthEnabled: e,
|
|
16
|
-
isPending: n.isPending,
|
|
17
|
-
profile: n.profile,
|
|
18
|
-
isAuthenticated: n.profile,
|
|
19
|
-
login: async () => {
|
|
20
|
-
if (!e)
|
|
21
|
-
throw new Error("Authentication is not enabled.");
|
|
22
|
-
await t.login();
|
|
23
|
-
},
|
|
24
|
-
logout: async () => {
|
|
25
|
-
if (!e)
|
|
26
|
-
throw new Error("Authentication is not enabled.");
|
|
27
|
-
await t.logout(), window.location.href = "/";
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
export {
|
|
32
|
-
r as E,
|
|
33
|
-
u
|
|
34
|
-
};
|
|
35
|
-
//# sourceMappingURL=hook-D1DiFbcT.js.map
|
package/lib/hook-D1DiFbcT.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hook-D1DiFbcT.js","sources":["../src/lib/errors/ErrorAlert.tsx","../src/lib/authentication/hook.ts"],"sourcesContent":["// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function ErrorAlert({ error }: { error: any }) {\n const message = error?.message ?? \"Something went wrong\";\n const stack = error?.stack;\n\n return (\n <div className=\"flex h-screen max-h-screen min-h-full items-center justify-center bg-primary-background px-4 py-16 lg:px-8\">\n <div className=\"mx-auto max-w-[85%] sm:max-w-[50%]\">\n <h1 className=\"text-4xl font-bold tracking-tight text-h1-text sm:text-5xl\">\n Something went wrong\n </h1>\n <p className=\"mt-5 text-h1-text\">{message}</p>\n {stack ? (\n <pre className=\"mt-5 max-h-[400px] w-full overflow-scroll rounded-md border border-input-border bg-input-background p-3 text-property-name-text text-red-700\">\n {stack}\n </pre>\n ) : null}\n </div>\n </div>\n );\n}\n","import { useDevPortal } from \"../components/context/DevPortalProvider.js\";\nimport { useAuthState } from \"./state.js\";\n\nexport const useAuth = () => {\n const { authentication } = useDevPortal();\n const authState = useAuthState();\n const isAuthEnabled = typeof authentication !== \"undefined\";\n\n return {\n isAuthEnabled,\n isPending: authState.isPending,\n profile: authState.profile,\n isAuthenticated: authState.profile,\n\n login: async () => {\n if (!isAuthEnabled) {\n throw new Error(\"Authentication is not enabled.\");\n }\n // TODO: Should handle errors/state\n await authentication.login();\n },\n\n logout: async () => {\n if (!isAuthEnabled) {\n throw new Error(\"Authentication is not enabled.\");\n }\n // TODO: Should handle errors/state\n await authentication.logout();\n\n // Redirect to home\n window.location.href = \"/\";\n },\n };\n};\n"],"names":["ErrorAlert","error","message","stack","jsxs","jsx","useAuth","authentication","useDevPortal","authState","useAuthState","isAuthEnabled"],"mappings":";;;AACgB,SAAAA,EAAW,EAAE,OAAAC,KAAyB;AAC9C,QAAAC,KAAUD,KAAA,gBAAAA,EAAO,YAAW,wBAC5BE,IAAQF,KAAA,gBAAAA,EAAO;AAErB,+BACG,OAAI,EAAA,WAAU,8GACb,UAACG,gBAAAA,EAAA,KAAA,OAAA,EAAI,WAAU,sCACb,UAAA;AAAA,IAACC,gBAAAA,EAAA,IAAA,MAAA,EAAG,WAAU,8DAA6D,UAE3E,wBAAA;AAAA,IACCA,gBAAAA,EAAA,IAAA,KAAA,EAAE,WAAU,qBAAqB,UAAQH,GAAA;AAAA,IACzCC,IACEE,gBAAAA,EAAAA,IAAA,OAAA,EAAI,WAAU,gJACZ,YACH,CAAA,IACE;AAAA,EAAA,EACN,CAAA,EACF,CAAA;AAEJ;ACjBO,MAAMC,IAAU,MAAM;AACrB,QAAA,EAAE,gBAAAC,MAAmBC,KACrBC,IAAYC,KACZC,IAAgB,OAAOJ,IAAmB;AAEzC,SAAA;AAAA,IACL,eAAAI;AAAA,IACA,WAAWF,EAAU;AAAA,IACrB,SAASA,EAAU;AAAA,IACnB,iBAAiBA,EAAU;AAAA,IAE3B,OAAO,YAAY;AACjB,UAAI,CAACE;AACG,cAAA,IAAI,MAAM,gCAAgC;AAGlD,YAAMJ,EAAe;IACvB;AAAA,IAEA,QAAQ,YAAY;AAClB,UAAI,CAACI;AACG,cAAA,IAAI,MAAM,gCAAgC;AAGlD,YAAMJ,EAAe,UAGrB,OAAO,SAAS,OAAO;AAAA,IACzB;AAAA,EAAA;AAEJ;"}
|
package/src/app/entry.server.tsx
DELETED
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import type express from "express";
|
|
2
|
-
import logger from "loglevel";
|
|
3
|
-
import { Transform } from "node:stream";
|
|
4
|
-
import { StrictMode } from "react";
|
|
5
|
-
import { renderToPipeableStream, renderToStaticMarkup } from "react-dom/server";
|
|
6
|
-
import { HelmetData, HelmetProvider } from "react-helmet-async";
|
|
7
|
-
import { isRouteErrorResponse } from "react-router-dom";
|
|
8
|
-
import {
|
|
9
|
-
createStaticHandler,
|
|
10
|
-
createStaticRouter,
|
|
11
|
-
StaticRouterProvider,
|
|
12
|
-
} from "react-router-dom/server.js";
|
|
13
|
-
import "virtual:vite-zudoku-custom-css.css";
|
|
14
|
-
import config from "virtual:zudoku-config";
|
|
15
|
-
import { ServerError } from "../lib/errors/ServerError.js";
|
|
16
|
-
import "./main.css";
|
|
17
|
-
import { getRoutesByConfig } from "./main.js";
|
|
18
|
-
|
|
19
|
-
export const render = async ({
|
|
20
|
-
template,
|
|
21
|
-
expressRequest,
|
|
22
|
-
fetchRequest,
|
|
23
|
-
response,
|
|
24
|
-
}: {
|
|
25
|
-
template: string;
|
|
26
|
-
expressRequest?: express.Request;
|
|
27
|
-
fetchRequest?: Request;
|
|
28
|
-
response: express.Response;
|
|
29
|
-
}) => {
|
|
30
|
-
const routes = getRoutesByConfig(config);
|
|
31
|
-
const { query, dataRoutes } = createStaticHandler(routes);
|
|
32
|
-
|
|
33
|
-
const request = expressRequest
|
|
34
|
-
? createFetchRequest(expressRequest, response)
|
|
35
|
-
: fetchRequest;
|
|
36
|
-
|
|
37
|
-
if (!request) {
|
|
38
|
-
throw new Error("Either fetchRequest or expressRequest must be provided");
|
|
39
|
-
}
|
|
40
|
-
const context = await query(request);
|
|
41
|
-
let status = 200;
|
|
42
|
-
|
|
43
|
-
if (context instanceof Response) {
|
|
44
|
-
if ([301, 302, 303, 307, 308].includes(context.status)) {
|
|
45
|
-
return response.redirect(
|
|
46
|
-
context.status,
|
|
47
|
-
context.headers.get("Location")!,
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
throw context;
|
|
52
|
-
} else if (context.errors) {
|
|
53
|
-
// when throwing a Response from a loader it will be caught here
|
|
54
|
-
// unfortunately it is not `instanceof Response` for some reason
|
|
55
|
-
const firstError = Object.values(context.errors).find(isRouteErrorResponse);
|
|
56
|
-
|
|
57
|
-
if (firstError?.status) {
|
|
58
|
-
status = firstError.status;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const router = createStaticRouter(dataRoutes, context);
|
|
63
|
-
const helmetContext = {} as HelmetData["context"];
|
|
64
|
-
|
|
65
|
-
const { pipe } = renderToPipeableStream(
|
|
66
|
-
<StrictMode>
|
|
67
|
-
<HelmetProvider context={helmetContext}>
|
|
68
|
-
<StaticRouterProvider router={router} context={context} />
|
|
69
|
-
</HelmetProvider>
|
|
70
|
-
</StrictMode>,
|
|
71
|
-
{
|
|
72
|
-
onShellError(error) {
|
|
73
|
-
response.status(500);
|
|
74
|
-
response.set({ "Content-Type": "text/html" });
|
|
75
|
-
|
|
76
|
-
const html = renderToStaticMarkup(<ServerError error={error} />);
|
|
77
|
-
|
|
78
|
-
response.send(html);
|
|
79
|
-
},
|
|
80
|
-
// for SSG we could use onAllReady instead of onShellReady
|
|
81
|
-
// https://react.dev/reference/react-dom/server/renderToPipeableStream#waiting-for-all-content-to-load-for-crawlers-and-static-generation
|
|
82
|
-
onShellReady() {
|
|
83
|
-
response.set({ "Content-Type": "text/html" });
|
|
84
|
-
response.status(status);
|
|
85
|
-
|
|
86
|
-
const transformStream = new Transform({
|
|
87
|
-
transform(chunk, encoding, callback) {
|
|
88
|
-
response.write(chunk, encoding);
|
|
89
|
-
callback();
|
|
90
|
-
},
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
const [htmlStart, htmlEnd] = template.split("<!--app-html-->");
|
|
94
|
-
|
|
95
|
-
response.write(
|
|
96
|
-
htmlStart.replace(
|
|
97
|
-
"<!--app-helmet-->",
|
|
98
|
-
[
|
|
99
|
-
helmetContext.helmet.title.toString(),
|
|
100
|
-
helmetContext.helmet.meta.toString(),
|
|
101
|
-
helmetContext.helmet.link.toString(),
|
|
102
|
-
helmetContext.helmet.style.toString(),
|
|
103
|
-
helmetContext.helmet.script.toString(),
|
|
104
|
-
].join("\n"),
|
|
105
|
-
),
|
|
106
|
-
);
|
|
107
|
-
|
|
108
|
-
transformStream.on("finish", () => {
|
|
109
|
-
response.end(htmlEnd);
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
pipe(transformStream);
|
|
113
|
-
},
|
|
114
|
-
onError(error) {
|
|
115
|
-
status = 500;
|
|
116
|
-
logger.error(error);
|
|
117
|
-
},
|
|
118
|
-
},
|
|
119
|
-
);
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
export function createFetchRequest(
|
|
123
|
-
req: express.Request,
|
|
124
|
-
res: express.Response,
|
|
125
|
-
): Request {
|
|
126
|
-
const origin = `${req.protocol}://${req.get("host")}`;
|
|
127
|
-
// Note: This had to take originalUrl into account for presumably vite's proxying
|
|
128
|
-
const url = new URL(req.originalUrl || req.url, origin);
|
|
129
|
-
|
|
130
|
-
const controller = new AbortController();
|
|
131
|
-
res.on("close", () => controller.abort());
|
|
132
|
-
|
|
133
|
-
const headers = new Headers();
|
|
134
|
-
|
|
135
|
-
for (const [key, values] of Object.entries(req.headers)) {
|
|
136
|
-
if (values) {
|
|
137
|
-
if (Array.isArray(values)) {
|
|
138
|
-
for (const value of values) {
|
|
139
|
-
headers.append(key, value);
|
|
140
|
-
}
|
|
141
|
-
} else {
|
|
142
|
-
headers.set(key, values);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
const init: RequestInit = {
|
|
148
|
-
method: req.method,
|
|
149
|
-
headers,
|
|
150
|
-
signal: controller.signal,
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
if (req.method !== "GET" && req.method !== "HEAD") {
|
|
154
|
-
init.body = req.body;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
return new Request(url.href, init);
|
|
158
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { RouteObject } from "react-router-dom";
|
|
2
|
-
import config from "virtual:zudoku-config";
|
|
3
|
-
import { getRoutesByConfig } from "./main.js";
|
|
4
|
-
|
|
5
|
-
const routes = getRoutesByConfig(config);
|
|
6
|
-
|
|
7
|
-
const flattenPaths = (routes: RouteObject[], basePath = "") => {
|
|
8
|
-
return routes.reduce<string[]>((acc, route) => {
|
|
9
|
-
if (route.path) {
|
|
10
|
-
const fullPath = `${basePath}/${route.path}`.replace(/\/+/g, "/");
|
|
11
|
-
route.path !== "/" && acc.push(fullPath);
|
|
12
|
-
if (route.children) {
|
|
13
|
-
acc = acc.concat(flattenPaths(route.children, fullPath));
|
|
14
|
-
}
|
|
15
|
-
} else if (route.children) {
|
|
16
|
-
acc = acc.concat(flattenPaths(route.children, basePath));
|
|
17
|
-
}
|
|
18
|
-
return acc;
|
|
19
|
-
}, []);
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export const paths = flattenPaths(routes);
|
|
File without changes
|