eddev 2.0.0-beta.105 → 2.0.0-beta.107
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/spa-root.js +1 -2
- package/dist/app/entry/ssr-root-client.js +2 -2
- package/dist/app/entry/ssr-root.js +12 -13
- package/dist/app/server/render-ssr-page.js +11 -5
- package/dist/node/cli/version.d.ts +1 -1
- package/dist/node/cli/version.js +1 -1
- package/dist/node/compiler/get-vite-config.js +5 -1
- package/dist/node/compiler/vinxi-codegen.js +3 -3
- package/package.json +1 -1
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Suspense } from "react";
|
|
3
2
|
import { DevUILoader } from "../lib/devtools/loader.js";
|
|
4
3
|
import { BrowserRouter } from "../lib/routing/components/BrowserRouter.js";
|
|
5
4
|
import { APIProvider } from "../utils/APIProvider.js";
|
|
6
5
|
export function SPARoot() {
|
|
7
|
-
return (_jsxs(APIProvider, { children: [_jsx(
|
|
6
|
+
return (_jsxs(APIProvider, { children: [_jsx(BrowserRouter, {}), _jsx(DevUILoader, {})] }));
|
|
8
7
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useEffect } from "react";
|
|
3
3
|
import { useSnapshot } from "valtio";
|
|
4
4
|
import { BrowserRouter } from "../lib/routing/components/BrowserRouter.js";
|
|
5
5
|
import { clientMetaTags } from "../lib/routing/context.js";
|
|
6
6
|
import { APIProvider } from "../utils/APIProvider.js";
|
|
7
7
|
export function SSRClientRoot(props) {
|
|
8
|
-
return (_jsxs(APIProvider, { children: [_jsx(DynamicMetaTags, {}), _jsx(
|
|
8
|
+
return (_jsxs(APIProvider, { children: [_jsx(DynamicMetaTags, {}), _jsx(BrowserRouter, {})] }));
|
|
9
9
|
}
|
|
10
10
|
function DynamicMetaTags() {
|
|
11
11
|
const dynamicTags = useSnapshot(clientMetaTags).tags;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Suspense } from "react";
|
|
3
2
|
import { SSRRouter } from "../lib/routing/components/SSRRouter.js";
|
|
4
3
|
import { getRouteMeta, normalizeRoute } from "../lib/routing/utils.js";
|
|
5
4
|
import { APIProvider } from "../utils/APIProvider.js";
|
|
@@ -7,16 +6,16 @@ export function SSRRoot(props) {
|
|
|
7
6
|
const loader = props.loader;
|
|
8
7
|
loader.setAppData(props.initialData.appData.data);
|
|
9
8
|
loader.populateRouteData(props.pathname, props.initialData);
|
|
10
|
-
return (_jsx(APIProvider, { children: _jsx(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
9
|
+
return (_jsx(APIProvider, { children: _jsx(SSRRouter, { loader: loader, route: normalizeRoute({
|
|
10
|
+
id: "initial",
|
|
11
|
+
component: loader.getRouteComponent(props.initialData.view),
|
|
12
|
+
key: "",
|
|
13
|
+
props: props.initialData.viewData.data,
|
|
14
|
+
view: props.initialData.view,
|
|
15
|
+
search: "",
|
|
16
|
+
pathname: props.pathname,
|
|
17
|
+
query: {},
|
|
18
|
+
hash: "",
|
|
19
|
+
meta: getRouteMeta(props.initialData),
|
|
20
|
+
}) }) }));
|
|
22
21
|
}
|
|
@@ -6,11 +6,12 @@ import { SSRRoot } from "../entry/ssr-root.js";
|
|
|
6
6
|
import { RouteLoader } from "../lib/routing/loader.js";
|
|
7
7
|
import { AssetCaptureContext } from "../utils/asset-capture.js";
|
|
8
8
|
import { ServerContext } from "./server-context.js";
|
|
9
|
+
import { Suspense } from "react";
|
|
9
10
|
export async function getSsrStream(args) {
|
|
10
11
|
const clientManifest = ServerContext.main.runtime.getManifest("client");
|
|
11
12
|
const preloadAssets = new Set([clientManifest.handler]);
|
|
12
13
|
const includedAssets = new Set();
|
|
13
|
-
const jsx = (_jsx(AssetCaptureContext.Provider, { value: preloadAssets, children: _jsx(SSRRoot, { metaTags: args.initialData?.meta?.head || [], pathname: args.pathname, initialData: args.initialData, loader: new RouteLoader() }) }));
|
|
14
|
+
const jsx = (_jsx(Suspense, { children: _jsx(AssetCaptureContext.Provider, { value: preloadAssets, children: _jsx(SSRRoot, { metaTags: args.initialData?.meta?.head || [], pathname: args.pathname, initialData: args.initialData, loader: new RouteLoader() }) }) }));
|
|
14
15
|
const stream = await new Promise(async (resolve, reject) => {
|
|
15
16
|
// console.log("Rendering to pipable")
|
|
16
17
|
const stream = renderToPipeableStream(jsx, {
|
|
@@ -61,7 +62,6 @@ export async function getSsrStream(args) {
|
|
|
61
62
|
for (const input of preloadAssets) {
|
|
62
63
|
const assets = await clientManifest.inputs[input].assets();
|
|
63
64
|
controller.enqueue(new TextEncoder().encode(`\n<!-- for ${input} -->`));
|
|
64
|
-
controller.enqueue(new TextEncoder().encode(`\n<!-- ${JSON.stringify(assets)} -->\n`));
|
|
65
65
|
for (const _asset of assets) {
|
|
66
66
|
const asset = _asset;
|
|
67
67
|
// Ensure that each asset is only included once
|
|
@@ -69,11 +69,17 @@ export async function getSsrStream(args) {
|
|
|
69
69
|
if (!key) {
|
|
70
70
|
throw new Error("Asset must have a key: " + JSON.stringify(asset));
|
|
71
71
|
}
|
|
72
|
-
if (
|
|
72
|
+
if (includedAssets.has(key))
|
|
73
73
|
continue;
|
|
74
|
-
|
|
74
|
+
includedAssets.add(key);
|
|
75
75
|
// Render the asset
|
|
76
|
-
|
|
76
|
+
try {
|
|
77
|
+
const tag = renderAsset(asset);
|
|
78
|
+
controller.enqueue(new TextEncoder().encode(tag + "\n"));
|
|
79
|
+
}
|
|
80
|
+
catch (err) {
|
|
81
|
+
controller.enqueue(new TextEncoder().encode(`\n<!-- ${JSON.stringify(err)} -->\n`));
|
|
82
|
+
}
|
|
77
83
|
}
|
|
78
84
|
}
|
|
79
85
|
// console.log("ASSETS", await clientManifest)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "2.0.0-beta.
|
|
1
|
+
export declare const VERSION = "2.0.0-beta.106";
|
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.106";
|
|
@@ -68,7 +68,11 @@ export function reactPlugin() {
|
|
|
68
68
|
if (t.isExpression(body)) {
|
|
69
69
|
body = t.blockStatement([t.returnStatement(body)]);
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
const componentName = pascalCase(type) + "_" + name.replace(/[^a-z0-9]/g, "_").replace(/_+/g, "_");
|
|
72
|
+
path.replaceWithMultiple([
|
|
73
|
+
t.exportDefaultDeclaration(t.functionDeclaration(t.identifier(componentName), args[1].params, body, args[1].generator, args[1].async)),
|
|
74
|
+
t.expressionStatement(t.assignmentExpression("=", t.memberExpression(t.identifier(componentName), t.identifier("displayName")), t.stringLiteral(pascalCase(type) + "(" + name + ")"))),
|
|
75
|
+
]);
|
|
72
76
|
}
|
|
73
77
|
}
|
|
74
78
|
}
|
|
@@ -133,13 +133,13 @@ export function createVinxiCodegen(opts) {
|
|
|
133
133
|
window.$reactRoot ||
|
|
134
134
|
hydrateRoot(
|
|
135
135
|
document.getElementById('_root')!,
|
|
136
|
-
<SSRClientRoot assets={getAssets()} metaTags={window._PAGE_DATA.meta.head}
|
|
136
|
+
<React.Suspense><SSRClientRoot assets={getAssets()} metaTags={window._PAGE_DATA.meta.head} /></React.Suspense>,
|
|
137
137
|
)
|
|
138
138
|
|
|
139
139
|
if (import.meta.hot) {
|
|
140
140
|
import.meta.hot.accept((mod) => {
|
|
141
141
|
if (mod) {
|
|
142
|
-
const app = <SSRClientRoot assets={getAssets()} metaTags={window._PAGE_DATA.meta.head}
|
|
142
|
+
const app = <React.Suspense><SSRClientRoot assets={getAssets()} metaTags={window._PAGE_DATA.meta.head} /></React.Suspense>
|
|
143
143
|
window.$reactRoot?.render(app)
|
|
144
144
|
}
|
|
145
145
|
})
|
|
@@ -170,7 +170,7 @@ export function createVinxiCodegen(opts) {
|
|
|
170
170
|
|
|
171
171
|
devToolsStore.loadTailwindConfig = () => import('./manifest/tailwind-config')
|
|
172
172
|
|
|
173
|
-
createRoot(document.getElementById("root")!).render(<SPARoot
|
|
173
|
+
createRoot(document.getElementById("root")!).render(<React.Suspense><SPARoot /></React.Suspense>)
|
|
174
174
|
`;
|
|
175
175
|
}
|
|
176
176
|
},
|