@taujs/server 0.1.0 → 0.1.1
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/data.js +12 -10
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -0
- package/package.json +1 -1
package/dist/data.js
CHANGED
|
@@ -59,7 +59,7 @@ var useSSRStore = () => {
|
|
|
59
59
|
|
|
60
60
|
// src/SSRHydration.tsx
|
|
61
61
|
import React2 from "react";
|
|
62
|
-
import { hydrateRoot } from "react-dom/client";
|
|
62
|
+
import { createRoot, hydrateRoot } from "react-dom/client";
|
|
63
63
|
|
|
64
64
|
// src/utils/Logger.ts
|
|
65
65
|
var createLogger = (debug) => ({
|
|
@@ -87,18 +87,20 @@ var hydrateApp = ({ appComponent, initialDataKey = "__INITIAL_DATA__", rootEleme
|
|
|
87
87
|
}
|
|
88
88
|
const initialData = window[initialDataKey];
|
|
89
89
|
if (!initialData) {
|
|
90
|
-
warn(`Initial data key "${initialDataKey}" is undefined on window
|
|
90
|
+
warn(`Initial data key "${initialDataKey}" is undefined on window. Defaulting to SPA createRoot`);
|
|
91
|
+
const root = createRoot(rootElement);
|
|
92
|
+
root.render(/* @__PURE__ */ jsx2(React2.StrictMode, { children: appComponent }));
|
|
91
93
|
} else {
|
|
92
94
|
log("Initial data loaded:", initialData);
|
|
95
|
+
const initialDataPromise = Promise.resolve(initialData);
|
|
96
|
+
const store = createSSRStore(initialDataPromise);
|
|
97
|
+
log("Store created:", store);
|
|
98
|
+
hydrateRoot(
|
|
99
|
+
rootElement,
|
|
100
|
+
/* @__PURE__ */ jsx2(React2.StrictMode, { children: /* @__PURE__ */ jsx2(SSRStoreProvider, { store, children: appComponent }) })
|
|
101
|
+
);
|
|
102
|
+
log("Hydration completed");
|
|
93
103
|
}
|
|
94
|
-
const initialDataPromise = Promise.resolve(initialData);
|
|
95
|
-
const store = createSSRStore(initialDataPromise);
|
|
96
|
-
log("Store created:", store);
|
|
97
|
-
hydrateRoot(
|
|
98
|
-
rootElement,
|
|
99
|
-
/* @__PURE__ */ jsx2(React2.StrictMode, { children: /* @__PURE__ */ jsx2(SSRStoreProvider, { store, children: appComponent }) })
|
|
100
|
-
);
|
|
101
|
-
log("Hydration completed");
|
|
102
104
|
};
|
|
103
105
|
if (document.readyState !== "loading") {
|
|
104
106
|
bootstrap();
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -295,6 +295,13 @@ var SSRServer = (0, import_fastify_plugin.default)(
|
|
|
295
295
|
const { createServer } = await import("vite");
|
|
296
296
|
viteDevServer = await createServer({
|
|
297
297
|
appType: "custom",
|
|
298
|
+
css: {
|
|
299
|
+
preprocessorOptions: {
|
|
300
|
+
scss: {
|
|
301
|
+
api: "modern-compiler"
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
},
|
|
298
305
|
mode: "development",
|
|
299
306
|
plugins: [
|
|
300
307
|
...isDebug ? [
|