@taujs/server 0.0.9 → 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 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
@@ -20,7 +20,7 @@ type RenderCallbacks = {
20
20
  type FetchConfig = {
21
21
  url?: string;
22
22
  options: RequestInit & {
23
- params?: any;
23
+ params?: Record<string, unknown>;
24
24
  };
25
25
  serviceName?: string;
26
26
  serviceMethod?: string;
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 ? [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taujs/server",
3
- "version": "0.0.9",
3
+ "version": "0.1.1",
4
4
  "description": "taujs | τjs",
5
5
  "author": "Aoede <taujs@aoede.uk.net> (https://www.aoede.uk.net)",
6
6
  "license": "MIT",
@@ -39,7 +39,7 @@
39
39
  "dist"
40
40
  ],
41
41
  "dependencies": {
42
- "@fastify/static": "^8.0.2",
42
+ "@fastify/static": "^7.0.4",
43
43
  "path-to-regexp": "^8.1.0"
44
44
  },
45
45
  "devDependencies": {
@@ -52,7 +52,7 @@
52
52
  "@types/react": "^18.3.3",
53
53
  "@types/react-dom": "^18.3.0",
54
54
  "@vitest/coverage-v8": "^2.1.0",
55
- "fastify": "^5.0.0",
55
+ "fastify": "^4.28.1",
56
56
  "jsdom": "^25.0.0",
57
57
  "prettier": "^3.3.3",
58
58
  "react-dom": "^18.3.1",
@@ -62,7 +62,7 @@
62
62
  "vitest": "^2.0.5"
63
63
  },
64
64
  "peerDependencies": {
65
- "fastify": "^5.0.0",
65
+ "fastify": "^4.28.1",
66
66
  "react": "^18.3.1",
67
67
  "react-dom": "^18.3.1",
68
68
  "typescript": "^5.5.4",