rasengan 1.2.0-beta.1 → 1.2.0-beta.7

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.
Files changed (34) hide show
  1. package/CHANGELOG.md +18 -5
  2. package/lib/esm/core/config/utils/define-config.js +10 -1
  3. package/lib/esm/core/config/utils/path.js +1 -1
  4. package/lib/esm/core/config/vite/defaults.js +30 -2
  5. package/lib/esm/core/plugins/index.js +46 -13
  6. package/lib/esm/entries/server/entry.server.js +9 -3
  7. package/lib/esm/routing/index.js +1 -1
  8. package/lib/esm/routing/providers/metadata.js +9 -3
  9. package/lib/esm/routing/utils/define-router.js +19 -6
  10. package/lib/esm/routing/utils/define-static-paths.js +10 -0
  11. package/lib/esm/routing/utils/generate-routes.js +332 -242
  12. package/lib/esm/routing/utils/index.js +1 -0
  13. package/lib/esm/server/build/index.js +2 -1
  14. package/lib/esm/server/build/manifest.js +3 -0
  15. package/lib/esm/server/build/rendering.js +8 -6
  16. package/lib/esm/server/node/index.js +163 -3
  17. package/lib/esm/server/node/rendering.js +1 -4
  18. package/lib/esm/server/node/utils.js +131 -0
  19. package/lib/tsconfig.esm.tsbuildinfo +1 -1
  20. package/lib/tsconfig.types.tsbuildinfo +1 -1
  21. package/lib/types/core/config/type.d.ts +22 -0
  22. package/lib/types/entries/server/entry.server.d.ts +1 -1
  23. package/lib/types/routing/index.d.ts +1 -1
  24. package/lib/types/routing/types.d.ts +26 -3
  25. package/lib/types/routing/utils/define-static-paths.d.ts +10 -0
  26. package/lib/types/routing/utils/generate-routes.d.ts +8 -0
  27. package/lib/types/routing/utils/index.d.ts +1 -0
  28. package/lib/types/server/build/index.d.ts +3 -1
  29. package/lib/types/server/build/manifest.d.ts +11 -0
  30. package/lib/types/server/build/rendering.d.ts +1 -0
  31. package/lib/types/server/node/index.d.ts +30 -1
  32. package/lib/types/server/node/utils.d.ts +25 -0
  33. package/package.json +3 -3
  34. package/vite.config.ts +27 -1
@@ -16,3 +16,28 @@ export declare function sendRasenganResponse(res: Express.Response, nodeResponse
16
16
  * @returns
17
17
  */
18
18
  export declare function createRasenganHeaders(requestHeaders: Record<string, string | string[]>): Headers;
19
+ /**
20
+ * Creates a fake Express-like request and response for static prerendering.
21
+ * This mimics the shape expected by `createRasenganRequest(req, res)`.
22
+ */
23
+ export declare function createFakeRasenganRequest(pathname: string, options?: {
24
+ host?: string;
25
+ protocol?: 'http' | 'https';
26
+ method?: string;
27
+ headers?: Record<string, string>;
28
+ body?: string | Buffer;
29
+ }): {
30
+ req: any;
31
+ res: any;
32
+ };
33
+ /**
34
+ * Log formatted and grouped HTML build output, similar to Vite/Next.js style.
35
+ * @param files List of absolute or relative HTML file paths
36
+ */
37
+ export declare function logRenderedPagesGrouped(files: string[]): Promise<void>;
38
+ /**
39
+ * Match a route pattern like "/blog/**" or "/profile"
40
+ * to a list of available page paths.
41
+ */
42
+ export declare function filterRoutesForPrerender(routes: string[], availablePages: string[]): string[];
43
+ export declare function convertSecondsToMinutes(seconds: number): string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rasengan",
3
3
  "private": false,
4
- "version": "1.2.0-beta.1",
4
+ "version": "1.2.0-beta.7",
5
5
  "description": "The modern React Framework",
6
6
  "type": "module",
7
7
  "main": "lib/esm/index.js",
@@ -72,10 +72,10 @@
72
72
  "react-router": "^7.5.2"
73
73
  },
74
74
  "peerDependencies": {
75
- "react": "^19.0.0",
76
- "react-dom": "^19.0.0",
77
75
  "@types/node": "^18.0.0 || >=20.0.0",
78
76
  "less": "*",
77
+ "react": "^19.0.0",
78
+ "react-dom": "^19.0.0",
79
79
  "sass": "*",
80
80
  "stylus": "*",
81
81
  "vite": "^6.3.0 || ^7.0.0",
package/vite.config.ts CHANGED
@@ -21,9 +21,35 @@ export default defineConfig(async ({ mode }): Promise<UserConfig> => {
21
21
  // Get base config
22
22
  const baseConfig = createDefaultViteConfig(rootPath, __dirname, mode, config);
23
23
 
24
+ // Check if rc is configured
25
+ const rcMode = config.sageMode.reactCompiler;
26
+ const rcBabelConfig =
27
+ typeof rcMode === 'object'
28
+ ? {
29
+ plugins: [
30
+ [
31
+ 'babel-plugin-react-compiler',
32
+ {
33
+ compilationMode: 'annotation',
34
+ },
35
+ ],
36
+ ],
37
+ }
38
+ : {
39
+ plugins: ['babel-plugin-react-compiler'],
40
+ };
41
+
24
42
  // Merge with user plugins
25
43
  return {
26
44
  ...baseConfig,
27
- plugins: [react(), ...plugins, ...(config.vite?.plugins || [])],
45
+ plugins: [
46
+ rcMode
47
+ ? react({
48
+ babel: rcBabelConfig,
49
+ })
50
+ : react(),
51
+ ...plugins,
52
+ ...(config.vite?.plugins || []),
53
+ ],
28
54
  };
29
55
  });