eddev 2.0.0-beta.76 → 2.0.0-beta.78
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/HydrationOverlay.d.ts +3 -0
- package/dist/app/entry/HydrationOverlay.js +98 -0
- package/dist/app/entry/hydration-script.d.ts +1 -0
- package/dist/app/entry/hydration-script.js +18 -0
- package/dist/app/entry/ssr-root-client.js +1 -1
- package/dist/app/lib/blocks/ContentBlocks.js +1 -1
- package/dist/app/lib/devtools/components/GridIndicator.js +5 -3
- package/dist/app/lib/devtools/hooks/useTailwind.d.ts +72 -72
- package/dist/app/server/render-ssr-page.d.ts +1 -0
- package/dist/app/server/render-ssr-page.js +2 -38
- package/dist/app/server/server-context.js +4 -0
- package/dist/app/utils/hydration-debugger.d.ts +13 -0
- package/dist/app/utils/hydration-debugger.js +11 -0
- package/dist/node/cli/version.d.ts +1 -1
- package/dist/node/cli/version.js +1 -1
- package/dist/node/compiler/bundler.admin.js +1 -0
- package/dist/node/compiler/bundler.frontend.js +1 -0
- package/dist/node/compiler/get-vite-config.d.ts +1 -0
- package/dist/node/compiler/get-vite-config.js +11 -4
- package/dist/node/compiler/vinxi-app.js +44 -37
- package/dist/node/compiler/vinxi-codegen.js +108 -60
- package/dist/node/types/block-type.d.ts +2 -2
- package/package.json +1 -10
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import beautify from "beautify";
|
|
5
|
+
import { createPortal } from "react-dom";
|
|
6
|
+
import { useEffect, useState } from "react";
|
|
7
|
+
import ReactDiffViewer, { DiffMethod } from "react-diff-viewer-continued";
|
|
8
|
+
import { hydrationDebug } from "../utils/hydration-debugger";
|
|
9
|
+
import { useSnapshot } from "valtio";
|
|
10
|
+
// Remove emotion-inserted style tags from the HTML string from the server
|
|
11
|
+
// as they get removed before hydration, so they shouldn't show in the diff
|
|
12
|
+
// (pollutes the diff and makes it unusable)
|
|
13
|
+
function removeEmotionStyleTags(htmlString = "") {
|
|
14
|
+
const regex = /<style\s+data-emotion(?:="[^"]*"|[^>])*>[\s\S]*?<\/style>/g;
|
|
15
|
+
return htmlString.replace(regex, "");
|
|
16
|
+
}
|
|
17
|
+
const DiffViewer = ReactDiffViewer.default
|
|
18
|
+
? ReactDiffViewer.default
|
|
19
|
+
: ReactDiffViewer;
|
|
20
|
+
export function HydrationOverlay({ integrations }) {
|
|
21
|
+
const [SSRHtml, setSSRHtml] = useState("");
|
|
22
|
+
const [CSRHtml, setCSRHtml] = useState("");
|
|
23
|
+
const [showModal, setShowModal] = useState(true);
|
|
24
|
+
const [hasHydrationMismatch, setHasHydrationMismatch] = useState(false);
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
// @ts-ignore
|
|
27
|
+
const ssrHtml = hydrationDebug.initialHTML;
|
|
28
|
+
// hydrationDebug.add({ error: new Error(), info: null })
|
|
29
|
+
// @ts-ignore
|
|
30
|
+
// window.BUILDER_HYDRATION_OVERLAY.CSR_HTML = document.querySelector("#_app")?.innerHTML
|
|
31
|
+
// @ts-ignore
|
|
32
|
+
const newCSRHtml = document.querySelector("#_app")?.innerHTML;
|
|
33
|
+
if (!ssrHtml || !newCSRHtml)
|
|
34
|
+
return;
|
|
35
|
+
const newSSR = beautify(ssrHtml, { format: "html" });
|
|
36
|
+
setSSRHtml(newSSR);
|
|
37
|
+
const newCSR = beautify(newCSRHtml, { format: "html" });
|
|
38
|
+
setCSRHtml(newCSR);
|
|
39
|
+
setShowModal(true);
|
|
40
|
+
// @ts-ignore
|
|
41
|
+
if (hydrationDebug.events.length > 0) {
|
|
42
|
+
console.log("Showing modal?");
|
|
43
|
+
setHasHydrationMismatch(true);
|
|
44
|
+
}
|
|
45
|
+
}, []);
|
|
46
|
+
const hideModal = () => {
|
|
47
|
+
setShowModal(false);
|
|
48
|
+
};
|
|
49
|
+
const renderModal = showModal && hasHydrationMismatch && typeof document !== "undefined";
|
|
50
|
+
const events = useSnapshot(hydrationDebug.events);
|
|
51
|
+
if (!renderModal) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
const renderOverlay = () => {
|
|
55
|
+
return (_jsx("div", { style: {
|
|
56
|
+
position: "absolute",
|
|
57
|
+
top: 0,
|
|
58
|
+
left: 0,
|
|
59
|
+
right: 0,
|
|
60
|
+
bottom: 0,
|
|
61
|
+
zIndex: 999998,
|
|
62
|
+
background: "rgba(0,0,0,0.5)",
|
|
63
|
+
cursor: "pointer",
|
|
64
|
+
display: "flex",
|
|
65
|
+
flexDirection: "column",
|
|
66
|
+
fontFamily: "monospace",
|
|
67
|
+
direction: "ltr",
|
|
68
|
+
}, onClick: hideModal, children: _jsx("div", { style: {
|
|
69
|
+
zIndex: 999999,
|
|
70
|
+
margin: "4rem 6rem",
|
|
71
|
+
backgroundColor: "white",
|
|
72
|
+
borderRadius: "0.5rem",
|
|
73
|
+
overflow: "auto",
|
|
74
|
+
cursor: "auto",
|
|
75
|
+
color: "#212529",
|
|
76
|
+
}, onClick: (e) => {
|
|
77
|
+
e.stopPropagation();
|
|
78
|
+
}, children: _jsxs("div", { style: { display: "flex", flexDirection: "column" }, children: [_jsxs("div", { style: {
|
|
79
|
+
display: "flex",
|
|
80
|
+
justifyContent: "space-between",
|
|
81
|
+
borderBottom: "1px solid black",
|
|
82
|
+
alignItems: "center",
|
|
83
|
+
}, children: [_jsx("div", { style: {
|
|
84
|
+
fontSize: "2rem",
|
|
85
|
+
fontWeight: "bold",
|
|
86
|
+
padding: "1rem",
|
|
87
|
+
}, children: "Hydration Mismatch Occurred" }), _jsx("button", { style: {
|
|
88
|
+
all: "unset",
|
|
89
|
+
cursor: "pointer",
|
|
90
|
+
padding: "0.5rem",
|
|
91
|
+
marginRight: "1rem",
|
|
92
|
+
backgroundColor: "#212529",
|
|
93
|
+
borderRadius: "0.25rem",
|
|
94
|
+
color: "white",
|
|
95
|
+
}, onClick: hideModal, children: "CLOSE" })] }), _jsx("div", { style: { position: "relative", width: "100%" }, children: _jsx(DiffViewer, { oldValue: SSRHtml, newValue: CSRHtml, leftTitle: "Server-Side Render", rightTitle: "Client-Side Render", compareMethod: DiffMethod.WORDS }) })] }) }) }));
|
|
96
|
+
};
|
|
97
|
+
return createPortal(renderOverlay(), document.body);
|
|
98
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { hydrationDebug } from "../utils/hydration-debugger";
|
|
2
|
+
//@ts-nocheck
|
|
3
|
+
// window.addEventListener("error", (event) => {
|
|
4
|
+
// const msg = event.message.toLowerCase()
|
|
5
|
+
// const isHydrationMsg = msg.includes("hydration") || msg.includes("hydrating")
|
|
6
|
+
// if (isHydrationMsg) {
|
|
7
|
+
// hydrationDebug.add({
|
|
8
|
+
// error: event.error,
|
|
9
|
+
// info: null,
|
|
10
|
+
// })
|
|
11
|
+
// }
|
|
12
|
+
// })
|
|
13
|
+
const root = document.getElementById("_app");
|
|
14
|
+
if (root) {
|
|
15
|
+
hydrationDebug.initialHTML = root.innerHTML;
|
|
16
|
+
}
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
window.hydrationDebug = hydrationDebug;
|
|
@@ -7,7 +7,7 @@ import { clientMetaTags } from "../lib/routing/context.js";
|
|
|
7
7
|
import { APIProvider } from "../utils/APIProvider.js";
|
|
8
8
|
import { MetaTags } from "./MetaTags.js";
|
|
9
9
|
export function SSRClientRoot(props) {
|
|
10
|
-
return (_jsxs("html", { lang: "en", children: [_jsxs("head", { children: [_jsx(DynamicMetaTags, { tags: props.metaTags }), _jsx(Trackers, { position: "head" }), props.assets] }), _jsxs("body", { children: [_jsx(Trackers, { position: "body" }),
|
|
10
|
+
return (_jsxs("html", { lang: "en", children: [_jsxs("head", { children: [_jsx(DynamicMetaTags, { tags: props.metaTags }), _jsx(Trackers, { position: "head" }), props.assets] }), _jsxs("body", { children: [_jsx(Trackers, { position: "body" }), _jsx(APIProvider, { children: _jsx(Suspense, { children: _jsx(BrowserRouter, {}) }) }), _jsx(DevUILoader, {}), _jsx(Trackers, { position: "footer" })] })] }));
|
|
11
11
|
}
|
|
12
12
|
function DynamicMetaTags(props) {
|
|
13
13
|
const dynamicTags = useSnapshot(clientMetaTags).tags;
|
|
@@ -63,7 +63,7 @@ export const ContentBlocks = memo((props) => {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
// Attempt to wrap the block
|
|
66
|
-
return (_jsxs(Fragment, { children: [spaceBefore, _jsx(BlockErrorBoundary, { block: block, blockContext: ctx, children: blockNode }), spaceAfter] }, index));
|
|
66
|
+
return (_jsxs(Fragment, { children: [spaceBefore, _jsx(BlockErrorBoundary, { block: block, blockContext: ctx, children: blockNode }), spaceAfter] }, block.slug + "_" + index));
|
|
67
67
|
});
|
|
68
68
|
}, [blocks, props.wrapBlock, props.spacer]);
|
|
69
69
|
if (env.admin) {
|
|
@@ -18,9 +18,11 @@ export function GridIndicator() {
|
|
|
18
18
|
for (let i = 0; i < 12; i++) {
|
|
19
19
|
cols.push(_jsx("div", { style: { height: "100%", backgroundColor: "rgba(255,0,0,0.1)" } }));
|
|
20
20
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
if (env.client) {
|
|
22
|
+
useLayoutEffect(() => {
|
|
23
|
+
document.documentElement.classList.toggle("debug-grid", enabled);
|
|
24
|
+
}, [enabled]);
|
|
25
|
+
}
|
|
24
26
|
if (!enabled)
|
|
25
27
|
return null;
|
|
26
28
|
return (_jsx("div", { style: { position: "fixed", inset: 0, zIndex: 999999999, pointerEvents: "none" }, children: _jsx("div", { className: "grid-auto debug-display", style: { height: "100%" }, children: cols }) }));
|
|
@@ -883,20 +883,32 @@ export declare function useTailwindConfig(): {
|
|
|
883
883
|
readonly corePlugins?: readonly (import("tailwindcss/types/generated/corePluginList.js").CorePluginList | undefined)[] | {
|
|
884
884
|
readonly filter?: boolean | undefined;
|
|
885
885
|
readonly fill?: boolean | undefined;
|
|
886
|
-
readonly
|
|
887
|
-
readonly
|
|
888
|
-
readonly
|
|
889
|
-
readonly width?: boolean | undefined;
|
|
886
|
+
readonly position?: boolean | undefined;
|
|
887
|
+
readonly zIndex?: boolean | undefined;
|
|
888
|
+
readonly space?: boolean | undefined;
|
|
890
889
|
readonly cursor?: boolean | undefined;
|
|
891
890
|
readonly display?: boolean | undefined;
|
|
891
|
+
readonly flex?: boolean | undefined;
|
|
892
|
+
readonly flexDirection?: boolean | undefined;
|
|
892
893
|
readonly fontFamily?: boolean | undefined;
|
|
894
|
+
readonly margin?: boolean | undefined;
|
|
895
|
+
readonly backgroundColor?: boolean | undefined;
|
|
896
|
+
readonly borderRadius?: boolean | undefined;
|
|
897
|
+
readonly overflow?: boolean | undefined;
|
|
898
|
+
readonly justifyContent?: boolean | undefined;
|
|
899
|
+
readonly inset?: boolean | undefined;
|
|
900
|
+
readonly alignItems?: boolean | undefined;
|
|
901
|
+
readonly width?: boolean | undefined;
|
|
893
902
|
readonly fontSize?: boolean | undefined;
|
|
894
|
-
readonly fontStyle?: boolean | undefined;
|
|
895
903
|
readonly fontWeight?: boolean | undefined;
|
|
904
|
+
readonly padding?: boolean | undefined;
|
|
905
|
+
readonly translate?: boolean | undefined;
|
|
906
|
+
readonly content?: boolean | undefined;
|
|
907
|
+
readonly height?: boolean | undefined;
|
|
908
|
+
readonly fontStyle?: boolean | undefined;
|
|
896
909
|
readonly letterSpacing?: boolean | undefined;
|
|
897
910
|
readonly opacity?: boolean | undefined;
|
|
898
911
|
readonly order?: boolean | undefined;
|
|
899
|
-
readonly overflow?: boolean | undefined;
|
|
900
912
|
readonly pointerEvents?: boolean | undefined;
|
|
901
913
|
readonly rotate?: boolean | undefined;
|
|
902
914
|
readonly scale?: boolean | undefined;
|
|
@@ -906,22 +918,15 @@ export declare function useTailwindConfig(): {
|
|
|
906
918
|
readonly transform?: boolean | undefined;
|
|
907
919
|
readonly visibility?: boolean | undefined;
|
|
908
920
|
readonly size?: boolean | undefined;
|
|
909
|
-
readonly backgroundColor?: boolean | undefined;
|
|
910
|
-
readonly inset?: boolean | undefined;
|
|
911
921
|
readonly invert?: boolean | undefined;
|
|
912
922
|
readonly outlineOffset?: boolean | undefined;
|
|
913
|
-
readonly borderRadius?: boolean | undefined;
|
|
914
|
-
readonly padding?: boolean | undefined;
|
|
915
|
-
readonly flex?: boolean | undefined;
|
|
916
923
|
readonly blur?: boolean | undefined;
|
|
917
924
|
readonly resize?: boolean | undefined;
|
|
918
|
-
readonly position?: boolean | undefined;
|
|
919
925
|
readonly columns?: boolean | undefined;
|
|
920
926
|
readonly preflight?: boolean | undefined;
|
|
921
927
|
readonly container?: boolean | undefined;
|
|
922
928
|
readonly accessibility?: boolean | undefined;
|
|
923
929
|
readonly isolation?: boolean | undefined;
|
|
924
|
-
readonly zIndex?: boolean | undefined;
|
|
925
930
|
readonly gridColumn?: boolean | undefined;
|
|
926
931
|
readonly gridColumnStart?: boolean | undefined;
|
|
927
932
|
readonly gridColumnEnd?: boolean | undefined;
|
|
@@ -930,7 +935,6 @@ export declare function useTailwindConfig(): {
|
|
|
930
935
|
readonly gridRowEnd?: boolean | undefined;
|
|
931
936
|
readonly float?: boolean | undefined;
|
|
932
937
|
readonly clear?: boolean | undefined;
|
|
933
|
-
readonly margin?: boolean | undefined;
|
|
934
938
|
readonly boxSizing?: boolean | undefined;
|
|
935
939
|
readonly lineClamp?: boolean | undefined;
|
|
936
940
|
readonly aspectRatio?: boolean | undefined;
|
|
@@ -967,16 +971,12 @@ export declare function useTailwindConfig(): {
|
|
|
967
971
|
readonly gridAutoRows?: boolean | undefined;
|
|
968
972
|
readonly gridTemplateColumns?: boolean | undefined;
|
|
969
973
|
readonly gridTemplateRows?: boolean | undefined;
|
|
970
|
-
readonly flexDirection?: boolean | undefined;
|
|
971
974
|
readonly flexWrap?: boolean | undefined;
|
|
972
975
|
readonly placeContent?: boolean | undefined;
|
|
973
976
|
readonly placeItems?: boolean | undefined;
|
|
974
977
|
readonly alignContent?: boolean | undefined;
|
|
975
|
-
readonly alignItems?: boolean | undefined;
|
|
976
|
-
readonly justifyContent?: boolean | undefined;
|
|
977
978
|
readonly justifyItems?: boolean | undefined;
|
|
978
979
|
readonly gap?: boolean | undefined;
|
|
979
|
-
readonly space?: boolean | undefined;
|
|
980
980
|
readonly divideWidth?: boolean | undefined;
|
|
981
981
|
readonly divideStyle?: boolean | undefined;
|
|
982
982
|
readonly divideColor?: boolean | undefined;
|
|
@@ -1928,20 +1928,32 @@ export declare function useTailwindConfig(): {
|
|
|
1928
1928
|
readonly corePlugins?: readonly (import("tailwindcss/types/generated/corePluginList.js").CorePluginList | undefined)[] | {
|
|
1929
1929
|
readonly filter?: boolean | undefined;
|
|
1930
1930
|
readonly fill?: boolean | undefined;
|
|
1931
|
-
readonly
|
|
1932
|
-
readonly
|
|
1933
|
-
readonly
|
|
1934
|
-
readonly width?: boolean | undefined;
|
|
1931
|
+
readonly position?: boolean | undefined;
|
|
1932
|
+
readonly zIndex?: boolean | undefined;
|
|
1933
|
+
readonly space?: boolean | undefined;
|
|
1935
1934
|
readonly cursor?: boolean | undefined;
|
|
1936
1935
|
readonly display?: boolean | undefined;
|
|
1936
|
+
readonly flex?: boolean | undefined;
|
|
1937
|
+
readonly flexDirection?: boolean | undefined;
|
|
1937
1938
|
readonly fontFamily?: boolean | undefined;
|
|
1939
|
+
readonly margin?: boolean | undefined;
|
|
1940
|
+
readonly backgroundColor?: boolean | undefined;
|
|
1941
|
+
readonly borderRadius?: boolean | undefined;
|
|
1942
|
+
readonly overflow?: boolean | undefined;
|
|
1943
|
+
readonly justifyContent?: boolean | undefined;
|
|
1944
|
+
readonly inset?: boolean | undefined;
|
|
1945
|
+
readonly alignItems?: boolean | undefined;
|
|
1946
|
+
readonly width?: boolean | undefined;
|
|
1938
1947
|
readonly fontSize?: boolean | undefined;
|
|
1939
|
-
readonly fontStyle?: boolean | undefined;
|
|
1940
1948
|
readonly fontWeight?: boolean | undefined;
|
|
1949
|
+
readonly padding?: boolean | undefined;
|
|
1950
|
+
readonly translate?: boolean | undefined;
|
|
1951
|
+
readonly content?: boolean | undefined;
|
|
1952
|
+
readonly height?: boolean | undefined;
|
|
1953
|
+
readonly fontStyle?: boolean | undefined;
|
|
1941
1954
|
readonly letterSpacing?: boolean | undefined;
|
|
1942
1955
|
readonly opacity?: boolean | undefined;
|
|
1943
1956
|
readonly order?: boolean | undefined;
|
|
1944
|
-
readonly overflow?: boolean | undefined;
|
|
1945
1957
|
readonly pointerEvents?: boolean | undefined;
|
|
1946
1958
|
readonly rotate?: boolean | undefined;
|
|
1947
1959
|
readonly scale?: boolean | undefined;
|
|
@@ -1951,22 +1963,15 @@ export declare function useTailwindConfig(): {
|
|
|
1951
1963
|
readonly transform?: boolean | undefined;
|
|
1952
1964
|
readonly visibility?: boolean | undefined;
|
|
1953
1965
|
readonly size?: boolean | undefined;
|
|
1954
|
-
readonly backgroundColor?: boolean | undefined;
|
|
1955
|
-
readonly inset?: boolean | undefined;
|
|
1956
1966
|
readonly invert?: boolean | undefined;
|
|
1957
1967
|
readonly outlineOffset?: boolean | undefined;
|
|
1958
|
-
readonly borderRadius?: boolean | undefined;
|
|
1959
|
-
readonly padding?: boolean | undefined;
|
|
1960
|
-
readonly flex?: boolean | undefined;
|
|
1961
1968
|
readonly blur?: boolean | undefined;
|
|
1962
1969
|
readonly resize?: boolean | undefined;
|
|
1963
|
-
readonly position?: boolean | undefined;
|
|
1964
1970
|
readonly columns?: boolean | undefined;
|
|
1965
1971
|
readonly preflight?: boolean | undefined;
|
|
1966
1972
|
readonly container?: boolean | undefined;
|
|
1967
1973
|
readonly accessibility?: boolean | undefined;
|
|
1968
1974
|
readonly isolation?: boolean | undefined;
|
|
1969
|
-
readonly zIndex?: boolean | undefined;
|
|
1970
1975
|
readonly gridColumn?: boolean | undefined;
|
|
1971
1976
|
readonly gridColumnStart?: boolean | undefined;
|
|
1972
1977
|
readonly gridColumnEnd?: boolean | undefined;
|
|
@@ -1975,7 +1980,6 @@ export declare function useTailwindConfig(): {
|
|
|
1975
1980
|
readonly gridRowEnd?: boolean | undefined;
|
|
1976
1981
|
readonly float?: boolean | undefined;
|
|
1977
1982
|
readonly clear?: boolean | undefined;
|
|
1978
|
-
readonly margin?: boolean | undefined;
|
|
1979
1983
|
readonly boxSizing?: boolean | undefined;
|
|
1980
1984
|
readonly lineClamp?: boolean | undefined;
|
|
1981
1985
|
readonly aspectRatio?: boolean | undefined;
|
|
@@ -2012,16 +2016,12 @@ export declare function useTailwindConfig(): {
|
|
|
2012
2016
|
readonly gridAutoRows?: boolean | undefined;
|
|
2013
2017
|
readonly gridTemplateColumns?: boolean | undefined;
|
|
2014
2018
|
readonly gridTemplateRows?: boolean | undefined;
|
|
2015
|
-
readonly flexDirection?: boolean | undefined;
|
|
2016
2019
|
readonly flexWrap?: boolean | undefined;
|
|
2017
2020
|
readonly placeContent?: boolean | undefined;
|
|
2018
2021
|
readonly placeItems?: boolean | undefined;
|
|
2019
2022
|
readonly alignContent?: boolean | undefined;
|
|
2020
|
-
readonly alignItems?: boolean | undefined;
|
|
2021
|
-
readonly justifyContent?: boolean | undefined;
|
|
2022
2023
|
readonly justifyItems?: boolean | undefined;
|
|
2023
2024
|
readonly gap?: boolean | undefined;
|
|
2024
|
-
readonly space?: boolean | undefined;
|
|
2025
2025
|
readonly divideWidth?: boolean | undefined;
|
|
2026
2026
|
readonly divideStyle?: boolean | undefined;
|
|
2027
2027
|
readonly divideColor?: boolean | undefined;
|
|
@@ -2948,20 +2948,32 @@ export declare function useTailwindConfig(): {
|
|
|
2948
2948
|
readonly corePlugins?: readonly (import("tailwindcss/types/generated/corePluginList.js").CorePluginList | undefined)[] | {
|
|
2949
2949
|
readonly filter?: boolean | undefined;
|
|
2950
2950
|
readonly fill?: boolean | undefined;
|
|
2951
|
-
readonly
|
|
2952
|
-
readonly
|
|
2953
|
-
readonly
|
|
2954
|
-
readonly width?: boolean | undefined;
|
|
2951
|
+
readonly position?: boolean | undefined;
|
|
2952
|
+
readonly zIndex?: boolean | undefined;
|
|
2953
|
+
readonly space?: boolean | undefined;
|
|
2955
2954
|
readonly cursor?: boolean | undefined;
|
|
2956
2955
|
readonly display?: boolean | undefined;
|
|
2956
|
+
readonly flex?: boolean | undefined;
|
|
2957
|
+
readonly flexDirection?: boolean | undefined;
|
|
2957
2958
|
readonly fontFamily?: boolean | undefined;
|
|
2959
|
+
readonly margin?: boolean | undefined;
|
|
2960
|
+
readonly backgroundColor?: boolean | undefined;
|
|
2961
|
+
readonly borderRadius?: boolean | undefined;
|
|
2962
|
+
readonly overflow?: boolean | undefined;
|
|
2963
|
+
readonly justifyContent?: boolean | undefined;
|
|
2964
|
+
readonly inset?: boolean | undefined;
|
|
2965
|
+
readonly alignItems?: boolean | undefined;
|
|
2966
|
+
readonly width?: boolean | undefined;
|
|
2958
2967
|
readonly fontSize?: boolean | undefined;
|
|
2959
|
-
readonly fontStyle?: boolean | undefined;
|
|
2960
2968
|
readonly fontWeight?: boolean | undefined;
|
|
2969
|
+
readonly padding?: boolean | undefined;
|
|
2970
|
+
readonly translate?: boolean | undefined;
|
|
2971
|
+
readonly content?: boolean | undefined;
|
|
2972
|
+
readonly height?: boolean | undefined;
|
|
2973
|
+
readonly fontStyle?: boolean | undefined;
|
|
2961
2974
|
readonly letterSpacing?: boolean | undefined;
|
|
2962
2975
|
readonly opacity?: boolean | undefined;
|
|
2963
2976
|
readonly order?: boolean | undefined;
|
|
2964
|
-
readonly overflow?: boolean | undefined;
|
|
2965
2977
|
readonly pointerEvents?: boolean | undefined;
|
|
2966
2978
|
readonly rotate?: boolean | undefined;
|
|
2967
2979
|
readonly scale?: boolean | undefined;
|
|
@@ -2971,22 +2983,15 @@ export declare function useTailwindConfig(): {
|
|
|
2971
2983
|
readonly transform?: boolean | undefined;
|
|
2972
2984
|
readonly visibility?: boolean | undefined;
|
|
2973
2985
|
readonly size?: boolean | undefined;
|
|
2974
|
-
readonly backgroundColor?: boolean | undefined;
|
|
2975
|
-
readonly inset?: boolean | undefined;
|
|
2976
2986
|
readonly invert?: boolean | undefined;
|
|
2977
2987
|
readonly outlineOffset?: boolean | undefined;
|
|
2978
|
-
readonly borderRadius?: boolean | undefined;
|
|
2979
|
-
readonly padding?: boolean | undefined;
|
|
2980
|
-
readonly flex?: boolean | undefined;
|
|
2981
2988
|
readonly blur?: boolean | undefined;
|
|
2982
2989
|
readonly resize?: boolean | undefined;
|
|
2983
|
-
readonly position?: boolean | undefined;
|
|
2984
2990
|
readonly columns?: boolean | undefined;
|
|
2985
2991
|
readonly preflight?: boolean | undefined;
|
|
2986
2992
|
readonly container?: boolean | undefined;
|
|
2987
2993
|
readonly accessibility?: boolean | undefined;
|
|
2988
2994
|
readonly isolation?: boolean | undefined;
|
|
2989
|
-
readonly zIndex?: boolean | undefined;
|
|
2990
2995
|
readonly gridColumn?: boolean | undefined;
|
|
2991
2996
|
readonly gridColumnStart?: boolean | undefined;
|
|
2992
2997
|
readonly gridColumnEnd?: boolean | undefined;
|
|
@@ -2995,7 +3000,6 @@ export declare function useTailwindConfig(): {
|
|
|
2995
3000
|
readonly gridRowEnd?: boolean | undefined;
|
|
2996
3001
|
readonly float?: boolean | undefined;
|
|
2997
3002
|
readonly clear?: boolean | undefined;
|
|
2998
|
-
readonly margin?: boolean | undefined;
|
|
2999
3003
|
readonly boxSizing?: boolean | undefined;
|
|
3000
3004
|
readonly lineClamp?: boolean | undefined;
|
|
3001
3005
|
readonly aspectRatio?: boolean | undefined;
|
|
@@ -3032,16 +3036,12 @@ export declare function useTailwindConfig(): {
|
|
|
3032
3036
|
readonly gridAutoRows?: boolean | undefined;
|
|
3033
3037
|
readonly gridTemplateColumns?: boolean | undefined;
|
|
3034
3038
|
readonly gridTemplateRows?: boolean | undefined;
|
|
3035
|
-
readonly flexDirection?: boolean | undefined;
|
|
3036
3039
|
readonly flexWrap?: boolean | undefined;
|
|
3037
3040
|
readonly placeContent?: boolean | undefined;
|
|
3038
3041
|
readonly placeItems?: boolean | undefined;
|
|
3039
3042
|
readonly alignContent?: boolean | undefined;
|
|
3040
|
-
readonly alignItems?: boolean | undefined;
|
|
3041
|
-
readonly justifyContent?: boolean | undefined;
|
|
3042
3043
|
readonly justifyItems?: boolean | undefined;
|
|
3043
3044
|
readonly gap?: boolean | undefined;
|
|
3044
|
-
readonly space?: boolean | undefined;
|
|
3045
3045
|
readonly divideWidth?: boolean | undefined;
|
|
3046
3046
|
readonly divideStyle?: boolean | undefined;
|
|
3047
3047
|
readonly divideColor?: boolean | undefined;
|
|
@@ -3993,20 +3993,32 @@ export declare function useTailwindConfig(): {
|
|
|
3993
3993
|
readonly corePlugins?: readonly (import("tailwindcss/types/generated/corePluginList.js").CorePluginList | undefined)[] | {
|
|
3994
3994
|
readonly filter?: boolean | undefined;
|
|
3995
3995
|
readonly fill?: boolean | undefined;
|
|
3996
|
-
readonly
|
|
3997
|
-
readonly
|
|
3998
|
-
readonly
|
|
3999
|
-
readonly width?: boolean | undefined;
|
|
3996
|
+
readonly position?: boolean | undefined;
|
|
3997
|
+
readonly zIndex?: boolean | undefined;
|
|
3998
|
+
readonly space?: boolean | undefined;
|
|
4000
3999
|
readonly cursor?: boolean | undefined;
|
|
4001
4000
|
readonly display?: boolean | undefined;
|
|
4001
|
+
readonly flex?: boolean | undefined;
|
|
4002
|
+
readonly flexDirection?: boolean | undefined;
|
|
4002
4003
|
readonly fontFamily?: boolean | undefined;
|
|
4004
|
+
readonly margin?: boolean | undefined;
|
|
4005
|
+
readonly backgroundColor?: boolean | undefined;
|
|
4006
|
+
readonly borderRadius?: boolean | undefined;
|
|
4007
|
+
readonly overflow?: boolean | undefined;
|
|
4008
|
+
readonly justifyContent?: boolean | undefined;
|
|
4009
|
+
readonly inset?: boolean | undefined;
|
|
4010
|
+
readonly alignItems?: boolean | undefined;
|
|
4011
|
+
readonly width?: boolean | undefined;
|
|
4003
4012
|
readonly fontSize?: boolean | undefined;
|
|
4004
|
-
readonly fontStyle?: boolean | undefined;
|
|
4005
4013
|
readonly fontWeight?: boolean | undefined;
|
|
4014
|
+
readonly padding?: boolean | undefined;
|
|
4015
|
+
readonly translate?: boolean | undefined;
|
|
4016
|
+
readonly content?: boolean | undefined;
|
|
4017
|
+
readonly height?: boolean | undefined;
|
|
4018
|
+
readonly fontStyle?: boolean | undefined;
|
|
4006
4019
|
readonly letterSpacing?: boolean | undefined;
|
|
4007
4020
|
readonly opacity?: boolean | undefined;
|
|
4008
4021
|
readonly order?: boolean | undefined;
|
|
4009
|
-
readonly overflow?: boolean | undefined;
|
|
4010
4022
|
readonly pointerEvents?: boolean | undefined;
|
|
4011
4023
|
readonly rotate?: boolean | undefined;
|
|
4012
4024
|
readonly scale?: boolean | undefined;
|
|
@@ -4016,22 +4028,15 @@ export declare function useTailwindConfig(): {
|
|
|
4016
4028
|
readonly transform?: boolean | undefined;
|
|
4017
4029
|
readonly visibility?: boolean | undefined;
|
|
4018
4030
|
readonly size?: boolean | undefined;
|
|
4019
|
-
readonly backgroundColor?: boolean | undefined;
|
|
4020
|
-
readonly inset?: boolean | undefined;
|
|
4021
4031
|
readonly invert?: boolean | undefined;
|
|
4022
4032
|
readonly outlineOffset?: boolean | undefined;
|
|
4023
|
-
readonly borderRadius?: boolean | undefined;
|
|
4024
|
-
readonly padding?: boolean | undefined;
|
|
4025
|
-
readonly flex?: boolean | undefined;
|
|
4026
4033
|
readonly blur?: boolean | undefined;
|
|
4027
4034
|
readonly resize?: boolean | undefined;
|
|
4028
|
-
readonly position?: boolean | undefined;
|
|
4029
4035
|
readonly columns?: boolean | undefined;
|
|
4030
4036
|
readonly preflight?: boolean | undefined;
|
|
4031
4037
|
readonly container?: boolean | undefined;
|
|
4032
4038
|
readonly accessibility?: boolean | undefined;
|
|
4033
4039
|
readonly isolation?: boolean | undefined;
|
|
4034
|
-
readonly zIndex?: boolean | undefined;
|
|
4035
4040
|
readonly gridColumn?: boolean | undefined;
|
|
4036
4041
|
readonly gridColumnStart?: boolean | undefined;
|
|
4037
4042
|
readonly gridColumnEnd?: boolean | undefined;
|
|
@@ -4040,7 +4045,6 @@ export declare function useTailwindConfig(): {
|
|
|
4040
4045
|
readonly gridRowEnd?: boolean | undefined;
|
|
4041
4046
|
readonly float?: boolean | undefined;
|
|
4042
4047
|
readonly clear?: boolean | undefined;
|
|
4043
|
-
readonly margin?: boolean | undefined;
|
|
4044
4048
|
readonly boxSizing?: boolean | undefined;
|
|
4045
4049
|
readonly lineClamp?: boolean | undefined;
|
|
4046
4050
|
readonly aspectRatio?: boolean | undefined;
|
|
@@ -4077,16 +4081,12 @@ export declare function useTailwindConfig(): {
|
|
|
4077
4081
|
readonly gridAutoRows?: boolean | undefined;
|
|
4078
4082
|
readonly gridTemplateColumns?: boolean | undefined;
|
|
4079
4083
|
readonly gridTemplateRows?: boolean | undefined;
|
|
4080
|
-
readonly flexDirection?: boolean | undefined;
|
|
4081
4084
|
readonly flexWrap?: boolean | undefined;
|
|
4082
4085
|
readonly placeContent?: boolean | undefined;
|
|
4083
4086
|
readonly placeItems?: boolean | undefined;
|
|
4084
4087
|
readonly alignContent?: boolean | undefined;
|
|
4085
|
-
readonly alignItems?: boolean | undefined;
|
|
4086
|
-
readonly justifyContent?: boolean | undefined;
|
|
4087
4088
|
readonly justifyItems?: boolean | undefined;
|
|
4088
4089
|
readonly gap?: boolean | undefined;
|
|
4089
|
-
readonly space?: boolean | undefined;
|
|
4090
4090
|
readonly divideWidth?: boolean | undefined;
|
|
4091
4091
|
readonly divideStyle?: boolean | undefined;
|
|
4092
4092
|
readonly divideColor?: boolean | undefined;
|
|
@@ -26,7 +26,7 @@ export async function getSsrStream(args) {
|
|
|
26
26
|
console.error(err);
|
|
27
27
|
},
|
|
28
28
|
bootstrapModules: [clientManifest.inputs[clientManifest.handler].output.path],
|
|
29
|
-
bootstrapScriptContent: `window.manifest = ${JSON.stringify(await clientManifest.json())};\nwindow._PAGE_DATA = ${JSON.stringify(args.initialData)};\nwindow._TRACKERS = ${JSON.stringify(args.initialData.trackers)}
|
|
29
|
+
bootstrapScriptContent: `window.manifest = ${JSON.stringify(await clientManifest.json())};\nwindow._PAGE_DATA = ${JSON.stringify(args.initialData)};\nwindow._TRACKERS = ${JSON.stringify(args.initialData.trackers)};`,
|
|
30
30
|
});
|
|
31
31
|
});
|
|
32
32
|
return new ReadableStream({
|
|
@@ -102,42 +102,6 @@ export async function renderErrorPage(args) {
|
|
|
102
102
|
return renderPage({
|
|
103
103
|
pathname: "/_error",
|
|
104
104
|
statusCode: args.code,
|
|
105
|
+
newOrigin: args.newOrigin,
|
|
105
106
|
});
|
|
106
|
-
// const serverContext = ServerContext.main
|
|
107
|
-
// let headers = new Headers()
|
|
108
|
-
// let responseInit: ResponseInit = {
|
|
109
|
-
// headers,
|
|
110
|
-
// }
|
|
111
|
-
// try {
|
|
112
|
-
// const { appData, trackers } = await serverContext.fetchAppData()
|
|
113
|
-
// let data: RouteDataWithTrackers
|
|
114
|
-
// data = {
|
|
115
|
-
// view: "_error",
|
|
116
|
-
// viewType: "react",
|
|
117
|
-
// viewData: {},
|
|
118
|
-
// appData,
|
|
119
|
-
// trackers,
|
|
120
|
-
// }
|
|
121
|
-
// responseInit.status = 500
|
|
122
|
-
// headers.set("Content-Type", "text/html; charset=utf-8")
|
|
123
|
-
// const stream = await getSsrStream({
|
|
124
|
-
// ...args,
|
|
125
|
-
// initialData: data,
|
|
126
|
-
// })
|
|
127
|
-
// return new Response(stream, responseInit)
|
|
128
|
-
// } catch (err) {
|
|
129
|
-
// console.error(err)
|
|
130
|
-
// return new Response(
|
|
131
|
-
// '<!DOCTYPE html><html><head><title>500 Internal Server Error</title></head><body><h1>500 Internal Server Error</h1><p>"' +
|
|
132
|
-
// String(err) +
|
|
133
|
-
// '"</p></body></html>',
|
|
134
|
-
// {
|
|
135
|
-
// status: 500,
|
|
136
|
-
// statusText: "Internal Server Error",
|
|
137
|
-
// headers: {
|
|
138
|
-
// "Content-Type": "text/html; charset=utf-8",
|
|
139
|
-
// },
|
|
140
|
-
// },
|
|
141
|
-
// )
|
|
142
|
-
// }
|
|
143
107
|
}
|
|
@@ -94,6 +94,7 @@ export class ServerContext {
|
|
|
94
94
|
const result = await swr({
|
|
95
95
|
key: cacheKey,
|
|
96
96
|
cache: pageCache,
|
|
97
|
+
forceFresh: this.dev,
|
|
97
98
|
getFreshValue: async (ctx) => {
|
|
98
99
|
ctx.metadata.createdTime;
|
|
99
100
|
const fetchUrl = withQuery(withTrailingSlash(req.pathname), {
|
|
@@ -129,6 +130,7 @@ export class ServerContext {
|
|
|
129
130
|
resultData = {
|
|
130
131
|
redirect: location,
|
|
131
132
|
status: status,
|
|
133
|
+
data: "",
|
|
132
134
|
};
|
|
133
135
|
}
|
|
134
136
|
if (resultData && typeof resultData === "object") {
|
|
@@ -167,6 +169,7 @@ export class ServerContext {
|
|
|
167
169
|
result.__generated = new Date().toISOString();
|
|
168
170
|
return result;
|
|
169
171
|
},
|
|
172
|
+
forceFresh: this.dev,
|
|
170
173
|
});
|
|
171
174
|
return data;
|
|
172
175
|
}
|
|
@@ -216,6 +219,7 @@ export class ServerContext {
|
|
|
216
219
|
: await swr({
|
|
217
220
|
key,
|
|
218
221
|
cache: queryCache,
|
|
222
|
+
forceFresh: this.dev,
|
|
219
223
|
getFreshValue: async (ctx) => {
|
|
220
224
|
const result = await fetch();
|
|
221
225
|
ctx.metadata.ttl = result.cacheTime;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "2.0.0-beta.
|
|
1
|
+
export declare const VERSION = "2.0.0-beta.78";
|
package/dist/node/cli/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "2.0.0-beta.
|
|
1
|
+
export const VERSION = "2.0.0-beta.78";
|
|
@@ -21,6 +21,7 @@ export class FrontendBundler {
|
|
|
21
21
|
outDir: relative(this.project.rootDir, "./dist/frontend/"),
|
|
22
22
|
serverless: false,
|
|
23
23
|
target: "frontend",
|
|
24
|
+
client: true,
|
|
24
25
|
});
|
|
25
26
|
console.verbose("Vite config:", baseConfig);
|
|
26
27
|
await build(mergeConfig(baseConfig, defineConfig({
|
|
@@ -8,7 +8,7 @@ import tsconfigPaths from "vite-tsconfig-paths";
|
|
|
8
8
|
import { cliMode } from "../cli/cli-mode.js";
|
|
9
9
|
export function envPlugin(args) {
|
|
10
10
|
const envDefines = {
|
|
11
|
-
client: args.
|
|
11
|
+
client: args.client ? "true" : "false",
|
|
12
12
|
serverless: args.serverless ? "true" : "false",
|
|
13
13
|
dev: args.mode === "development" ? "true" : "false",
|
|
14
14
|
admin: args.target === "cms" ? "true" : "false",
|
|
@@ -28,7 +28,9 @@ export function envPlugin(args) {
|
|
|
28
28
|
return result;
|
|
29
29
|
};
|
|
30
30
|
return replace({
|
|
31
|
-
values:
|
|
31
|
+
values: {
|
|
32
|
+
...expandDefines(envDefines, ["process.env.", "process.", "env."]),
|
|
33
|
+
},
|
|
32
34
|
preventAssignment: true,
|
|
33
35
|
});
|
|
34
36
|
}
|
|
@@ -90,8 +92,13 @@ export function ssrPlugin() {
|
|
|
90
92
|
};
|
|
91
93
|
config.ssr = {
|
|
92
94
|
...config.ssr,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
+
noExternal: [
|
|
96
|
+
"eddev",
|
|
97
|
+
"vinxi",
|
|
98
|
+
"react-use",
|
|
99
|
+
// @ts-ignore
|
|
100
|
+
...(config?.optimizeDeps?.noExternal ?? []),
|
|
101
|
+
],
|
|
95
102
|
optimizeDeps: {
|
|
96
103
|
exclude: ["eddev", "vinxi"],
|
|
97
104
|
},
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { joinURL } from "ufo";
|
|
2
2
|
import { createApp } from "vinxi";
|
|
3
|
-
import tsconfigPaths from "vite-tsconfig-paths";
|
|
4
3
|
import { StatefulLog } from "../utils/stateful-log.js";
|
|
5
|
-
import { corePlugins
|
|
4
|
+
import { corePlugins } from "./get-vite-config.js";
|
|
6
5
|
import { getVinxiFolder } from "./vinxi-codegen.js";
|
|
7
6
|
export function createVinxiApp(args) {
|
|
8
7
|
const log = args.log ?? new StatefulLog({ label: "Build" });
|
|
@@ -92,6 +91,11 @@ export function createVinxiApp(args) {
|
|
|
92
91
|
},
|
|
93
92
|
},
|
|
94
93
|
},
|
|
94
|
+
vercel: {
|
|
95
|
+
config: {
|
|
96
|
+
bypassToken: process.env.VERCEL_BYPASS_TOKEN,
|
|
97
|
+
},
|
|
98
|
+
},
|
|
95
99
|
},
|
|
96
100
|
routers: [
|
|
97
101
|
...args.config.serverless.themeAssets.map((folder) => {
|
|
@@ -106,41 +110,41 @@ export function createVinxiApp(args) {
|
|
|
106
110
|
base: joinURL(args.publicUrl, folderName),
|
|
107
111
|
};
|
|
108
112
|
}),
|
|
109
|
-
{
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
},
|
|
113
|
+
// {
|
|
114
|
+
// name: "data-api",
|
|
115
|
+
// type: "http",
|
|
116
|
+
// base: "/_data/",
|
|
117
|
+
// handler: `${folder}/handler.data-api.ts`,
|
|
118
|
+
// target: "server",
|
|
119
|
+
// plugins: () => [
|
|
120
|
+
// tsconfigPaths(),
|
|
121
|
+
// envPlugin({
|
|
122
|
+
// rootDir: args.rootDir,
|
|
123
|
+
// console: log,
|
|
124
|
+
// mode: args.mode,
|
|
125
|
+
// publicUrl: args.publicUrl,
|
|
126
|
+
// serverless: true,
|
|
127
|
+
// target: "frontend",
|
|
128
|
+
// }),
|
|
129
|
+
// ],
|
|
130
|
+
// },
|
|
131
|
+
// {
|
|
132
|
+
// name: "wp-proxy",
|
|
133
|
+
// type: "http",
|
|
134
|
+
// base: "/wp-",
|
|
135
|
+
// handler: `${folder}/handler.wp-proxy.ts`,
|
|
136
|
+
// target: "server",
|
|
137
|
+
// plugins: () => [
|
|
138
|
+
// ...corePlugins({
|
|
139
|
+
// rootDir: args.rootDir,
|
|
140
|
+
// console: log,
|
|
141
|
+
// mode: args.mode,
|
|
142
|
+
// publicUrl: args.publicUrl,
|
|
143
|
+
// serverless: true,
|
|
144
|
+
// target: "frontend",
|
|
145
|
+
// }),
|
|
146
|
+
// ],
|
|
147
|
+
// },
|
|
144
148
|
{
|
|
145
149
|
name: "client",
|
|
146
150
|
type: "client",
|
|
@@ -154,6 +158,7 @@ export function createVinxiApp(args) {
|
|
|
154
158
|
publicUrl: args.publicUrl,
|
|
155
159
|
serverless: true,
|
|
156
160
|
target: "frontend",
|
|
161
|
+
client: true,
|
|
157
162
|
}),
|
|
158
163
|
],
|
|
159
164
|
base: "/_build",
|
|
@@ -171,6 +176,7 @@ export function createVinxiApp(args) {
|
|
|
171
176
|
publicUrl: args.publicUrl,
|
|
172
177
|
serverless: true,
|
|
173
178
|
target: "cms",
|
|
179
|
+
client: true,
|
|
174
180
|
}),
|
|
175
181
|
],
|
|
176
182
|
base: "/_admin",
|
|
@@ -206,6 +212,7 @@ export function createVinxiApp(args) {
|
|
|
206
212
|
publicUrl: args.publicUrl,
|
|
207
213
|
serverless: true,
|
|
208
214
|
target: "frontend",
|
|
215
|
+
client: false,
|
|
209
216
|
}),
|
|
210
217
|
],
|
|
211
218
|
},
|
|
@@ -176,120 +176,168 @@ export function createVinxiCodegen(opts) {
|
|
|
176
176
|
}
|
|
177
177
|
},
|
|
178
178
|
});
|
|
179
|
+
if (opts.serverless) {
|
|
180
|
+
// codegen.registerFile({
|
|
181
|
+
// name: "handler.data-api.ts",
|
|
182
|
+
// generate: code/* tsx */ `
|
|
183
|
+
// /// <reference types="vinxi/types/server" />
|
|
184
|
+
// import { createRouter, eventHandler, getRouterParam, getQuery, getWebRequest, getRequestHeaders, getRequestURL } from "vinxi/http"
|
|
185
|
+
// import { serverContext } from "./context.js"
|
|
186
|
+
// const router = createRouter()
|
|
187
|
+
// .get(
|
|
188
|
+
// "/route/",
|
|
189
|
+
// eventHandler(async (event) => {
|
|
190
|
+
// const id = "/"
|
|
191
|
+
// const url = getRequestURL(event);
|
|
192
|
+
// return await serverContext.fetchRouteData({
|
|
193
|
+
// pathname: id,
|
|
194
|
+
// newOrigin: url.origin,
|
|
195
|
+
// })
|
|
196
|
+
// }),
|
|
197
|
+
// )
|
|
198
|
+
// .get(
|
|
199
|
+
// "/route/**:name",
|
|
200
|
+
// eventHandler(async (event) => {
|
|
201
|
+
// const id = "/" + getRouterParam(event, "name")
|
|
202
|
+
// const url = getRequestURL(event);
|
|
203
|
+
// return await serverContext.fetchRouteData({
|
|
204
|
+
// pathname: id,
|
|
205
|
+
// newOrigin: url.origin,
|
|
206
|
+
// })
|
|
207
|
+
// }),
|
|
208
|
+
// )
|
|
209
|
+
// .get(
|
|
210
|
+
// "/query/**:name",
|
|
211
|
+
// eventHandler(async (event) => {
|
|
212
|
+
// const id = "/" + getRouterParam(event, "name")
|
|
213
|
+
// const paramString = getQuery(event).params
|
|
214
|
+
// const params = typeof paramString === "string" && paramString.length ? JSON.parse(paramString) : {}
|
|
215
|
+
// return await serverContext.fetchNamedQuery({
|
|
216
|
+
// name: id,
|
|
217
|
+
// params: params,
|
|
218
|
+
// headers: getRequestHeaders(event),
|
|
219
|
+
// })
|
|
220
|
+
// }),
|
|
221
|
+
// )
|
|
222
|
+
// .post(
|
|
223
|
+
// "/mutation/**:name",
|
|
224
|
+
// eventHandler(async (event) => {
|
|
225
|
+
// const id = "/" + getRouterParam(event, "name")
|
|
226
|
+
// const body = await getWebRequest(event).json()
|
|
227
|
+
// return await serverContext.fetchMutation({
|
|
228
|
+
// name: id,
|
|
229
|
+
// body,
|
|
230
|
+
// headers: getRequestHeaders(event),
|
|
231
|
+
// })
|
|
232
|
+
// }),
|
|
233
|
+
// )
|
|
234
|
+
// export default router.handler
|
|
235
|
+
// `,
|
|
236
|
+
// })
|
|
237
|
+
}
|
|
179
238
|
if (opts.serverless) {
|
|
180
239
|
codegen.registerFile({
|
|
181
|
-
name: "handler.
|
|
240
|
+
name: "handler.ssr-page.ts",
|
|
182
241
|
generate: code /* tsx */ `
|
|
183
242
|
/// <reference types="vinxi/types/server" />
|
|
184
|
-
import
|
|
243
|
+
import "../../views/index.css"
|
|
244
|
+
import "./manifest/blocks.js"
|
|
245
|
+
import "./manifest/styles.js"
|
|
246
|
+
import "./manifest/views.js"
|
|
247
|
+
import "./context.js"
|
|
248
|
+
import { proxyWpAdmin, renderPage, ServerContext } from "eddev/server"
|
|
249
|
+
import {
|
|
250
|
+
createRouter,
|
|
251
|
+
eventHandler,
|
|
252
|
+
getQuery,
|
|
253
|
+
getRequestHeaders,
|
|
254
|
+
getRequestURL,
|
|
255
|
+
getRouterParam,
|
|
256
|
+
getWebRequest,
|
|
257
|
+
} from "vinxi/http"
|
|
258
|
+
import { handleRPC } from "./rpc.js"
|
|
185
259
|
import { serverContext } from "./context.js"
|
|
186
260
|
|
|
187
261
|
const router = createRouter()
|
|
188
262
|
.get(
|
|
189
|
-
"/route/",
|
|
263
|
+
"/_data/route/",
|
|
190
264
|
eventHandler(async (event) => {
|
|
191
265
|
const id = "/"
|
|
192
|
-
const url = getRequestURL(event)
|
|
266
|
+
const url = getRequestURL(event)
|
|
193
267
|
|
|
194
|
-
return await serverContext.fetchRouteData({
|
|
195
|
-
pathname: id,
|
|
196
|
-
newOrigin: url.origin,
|
|
197
|
-
})
|
|
268
|
+
return await serverContext.fetchRouteData({ pathname: id, newOrigin: url.origin })
|
|
198
269
|
}),
|
|
199
270
|
)
|
|
200
271
|
.get(
|
|
201
|
-
"/route/**:name",
|
|
272
|
+
"/_data/route/**:name",
|
|
202
273
|
eventHandler(async (event) => {
|
|
203
274
|
const id = "/" + getRouterParam(event, "name")
|
|
204
|
-
const url = getRequestURL(event)
|
|
275
|
+
const url = getRequestURL(event)
|
|
205
276
|
|
|
206
|
-
return await serverContext.fetchRouteData({
|
|
207
|
-
pathname: id,
|
|
208
|
-
newOrigin: url.origin,
|
|
209
|
-
})
|
|
277
|
+
return await serverContext.fetchRouteData({ pathname: id, newOrigin: url.origin })
|
|
210
278
|
}),
|
|
211
279
|
)
|
|
212
280
|
.get(
|
|
213
|
-
"/query/**:name",
|
|
281
|
+
"/_data/query/**:name",
|
|
214
282
|
eventHandler(async (event) => {
|
|
215
283
|
const id = "/" + getRouterParam(event, "name")
|
|
216
284
|
const paramString = getQuery(event).params
|
|
217
285
|
|
|
218
286
|
const params = typeof paramString === "string" && paramString.length ? JSON.parse(paramString) : {}
|
|
219
287
|
|
|
220
|
-
return await serverContext.fetchNamedQuery({
|
|
221
|
-
name: id,
|
|
222
|
-
params: params,
|
|
223
|
-
headers: getRequestHeaders(event),
|
|
224
|
-
})
|
|
288
|
+
return await serverContext.fetchNamedQuery({ name: id, params: params, headers: getRequestHeaders(event) })
|
|
225
289
|
}),
|
|
226
290
|
)
|
|
227
291
|
.post(
|
|
228
|
-
"/mutation/**:name",
|
|
292
|
+
"/_data/mutation/**:name",
|
|
229
293
|
eventHandler(async (event) => {
|
|
230
294
|
const id = "/" + getRouterParam(event, "name")
|
|
231
295
|
const body = await getWebRequest(event).json()
|
|
232
|
-
return await serverContext.fetchMutation({
|
|
233
|
-
name: id,
|
|
234
|
-
body,
|
|
235
|
-
headers: getRequestHeaders(event),
|
|
236
|
-
})
|
|
296
|
+
return await serverContext.fetchMutation({ name: id, body, headers: getRequestHeaders(event) })
|
|
237
297
|
}),
|
|
238
298
|
)
|
|
239
299
|
|
|
240
|
-
export default router.handler
|
|
241
|
-
|
|
242
|
-
`,
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
if (opts.serverless) {
|
|
246
|
-
codegen.registerFile({
|
|
247
|
-
name: "handler.ssr-page.ts",
|
|
248
|
-
generate: code /* tsx */ `
|
|
249
|
-
/// <reference types="vinxi/types/server" />
|
|
250
|
-
import "../../views/index.css"
|
|
251
|
-
import "./manifest/blocks.js"
|
|
252
|
-
import "./manifest/styles.js"
|
|
253
|
-
import "./manifest/views.js"
|
|
254
|
-
import "./context.js"
|
|
255
|
-
import { handleRPC } from "./rpc.js"
|
|
256
|
-
import { proxyWpAdmin, ServerContext, renderPage } from "eddev/server"
|
|
257
|
-
import { eventHandler, getRequestURL } from "vinxi/http"
|
|
258
|
-
|
|
259
300
|
export default eventHandler({
|
|
260
301
|
handler: async (event) => {
|
|
261
302
|
const serverContext = ServerContext.main
|
|
262
303
|
const url = getRequestURL(event)
|
|
263
304
|
|
|
305
|
+
// RPC
|
|
264
306
|
const isRPC = serverContext.rpcBases.some((base) => url.pathname.startsWith(base))
|
|
265
307
|
if (isRPC) {
|
|
266
308
|
return handleRPC(event)
|
|
267
309
|
}
|
|
268
310
|
|
|
269
|
-
|
|
311
|
+
// Data API
|
|
312
|
+
if (url.pathname.startsWith("/_data/")) {
|
|
313
|
+
return router.handler(event)
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
// Proxy WordPress
|
|
317
|
+
if (url.pathname.includes(".") || url.pathname.startsWith("/graphql") || url.pathname.startsWith("/wp-")) {
|
|
270
318
|
return proxyWpAdmin(event)
|
|
271
319
|
}
|
|
272
320
|
|
|
321
|
+
// SSR
|
|
273
322
|
return renderPage({ pathname: url.pathname, newOrigin: url.origin })
|
|
274
|
-
}
|
|
323
|
+
},
|
|
275
324
|
})
|
|
276
325
|
`,
|
|
277
326
|
});
|
|
278
327
|
}
|
|
279
328
|
if (opts.serverless) {
|
|
280
|
-
codegen.registerFile({
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
});
|
|
329
|
+
// codegen.registerFile({
|
|
330
|
+
// name: "handler.wp-proxy.ts",
|
|
331
|
+
// generate: code/* tsx */ `
|
|
332
|
+
// /// <reference types="vinxi/types/server" />
|
|
333
|
+
// import { proxyWpAdmin } from "eddev/server"
|
|
334
|
+
// import { eventHandler } from "vinxi/http"
|
|
335
|
+
// import "./context.js"
|
|
336
|
+
// export default eventHandler(async (event) => {
|
|
337
|
+
// return proxyWpAdmin(event)
|
|
338
|
+
// })
|
|
339
|
+
// `,
|
|
340
|
+
// })
|
|
293
341
|
}
|
|
294
342
|
codegen.registerFile({
|
|
295
343
|
name: "manifest/blocks.ts",
|
|
@@ -52,7 +52,7 @@ export declare const BlockMetaSchema: z.ZodObject<{
|
|
|
52
52
|
dynamic: boolean;
|
|
53
53
|
cache: boolean;
|
|
54
54
|
allowMultiple: boolean;
|
|
55
|
-
frontendMode: "
|
|
55
|
+
frontendMode: "default" | "hidden" | "childrenOnly";
|
|
56
56
|
inserter: boolean;
|
|
57
57
|
icon?: string | undefined;
|
|
58
58
|
description?: string | undefined;
|
|
@@ -88,7 +88,7 @@ export declare const BlockMetaSchema: z.ZodObject<{
|
|
|
88
88
|
postTypes: string[];
|
|
89
89
|
fieldName: string;
|
|
90
90
|
} | undefined;
|
|
91
|
-
frontendMode?: "
|
|
91
|
+
frontendMode?: "default" | "hidden" | "childrenOnly" | undefined;
|
|
92
92
|
inserter?: boolean | undefined;
|
|
93
93
|
}>;
|
|
94
94
|
export type BlockMetadata = z.infer<typeof BlockMetaSchema>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eddev",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.78",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -76,19 +76,16 @@
|
|
|
76
76
|
"license": "ISC",
|
|
77
77
|
"dependencies": {
|
|
78
78
|
"@babel/types": "^7.25.2",
|
|
79
|
-
"@clack/prompts": "^0.7.0",
|
|
80
79
|
"@epic-web/cachified": "^5.2.0",
|
|
81
80
|
"@graphql-codegen/core": "^4.0.0",
|
|
82
81
|
"@graphql-codegen/typescript": "^4.0.1",
|
|
83
82
|
"@graphql-codegen/typescript-operations": "^4.0.1",
|
|
84
83
|
"@graphql-tools/load": "^8.0.0",
|
|
85
84
|
"@graphql-tools/url-loader": "^8.0.0",
|
|
86
|
-
"@inquirer/prompts": "^5.0.6",
|
|
87
85
|
"@nozbe/microfuzz": "^1.0.0",
|
|
88
86
|
"@rollup/plugin-replace": "^5.0.5",
|
|
89
87
|
"@tanstack/react-query": "^5.51.23",
|
|
90
88
|
"@trpc/client": "^11.0.0-rc.608",
|
|
91
|
-
"@trpc/react-query": "^11.0.0-rc.608",
|
|
92
89
|
"@trpc/server": "^11.0.0-rc.608",
|
|
93
90
|
"@types/qs": "^6.9.15",
|
|
94
91
|
"@vinxi/react": "^0.2.5",
|
|
@@ -104,15 +101,11 @@
|
|
|
104
101
|
"hono": "^4.6.2",
|
|
105
102
|
"ink": "^5.0.1",
|
|
106
103
|
"ink-spinner": "^5.0.0",
|
|
107
|
-
"ink-text-input": "^6.0.0",
|
|
108
|
-
"listhen": "^1.6.0",
|
|
109
104
|
"lru-cache": "10.4.1",
|
|
110
105
|
"mkcert": "^3.2.0",
|
|
111
|
-
"mnemonist": "^0.39.8",
|
|
112
106
|
"obj-console": "^1.0.2",
|
|
113
107
|
"object-code": "^1.3.3",
|
|
114
108
|
"qs": "^6.13.0",
|
|
115
|
-
"react-super-seo": "^1.1.9",
|
|
116
109
|
"superjson": "^2.2.1",
|
|
117
110
|
"ts-poet": "^6.6.0",
|
|
118
111
|
"ufo": "^1.3.1",
|
|
@@ -126,8 +119,6 @@
|
|
|
126
119
|
"zod-validation-error": "^2.1.0"
|
|
127
120
|
},
|
|
128
121
|
"devDependencies": {
|
|
129
|
-
"@types/express": "^4.17.21",
|
|
130
|
-
"@types/express-http-proxy": "^1.6.6",
|
|
131
122
|
"@types/node": "^20.9.0",
|
|
132
123
|
"@types/react": "^18.3.3",
|
|
133
124
|
"@types/react-dom": "^18.3.0",
|