rasengan 1.0.0-beta.57 → 1.0.0-beta.58

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/CHANGELOG.md CHANGED
@@ -1,5 +1,7 @@
1
1
  ## Unreleased
2
2
 
3
+ ## 1.0.0-beta.58 (2025-03-12)
4
+
3
5
  ## 1.0.0-beta.57 (2025-03-04)
4
6
 
5
7
  ## 1.0.0-beta.56 (2025-03-03)
@@ -1,30 +1,32 @@
1
1
  import { resolve } from 'path';
2
2
  import fs from 'fs';
3
3
  import { loadModuleSSR } from '../config/utils/load-modules.js';
4
- function loadRasenganConfig() {
4
+ function loadRasenganGlobal() {
5
5
  return {
6
6
  name: 'vite-plugin-rasengan-config',
7
7
  async config(_, { command }) {
8
8
  if (command !== 'build')
9
9
  return;
10
- const configPath = resolve(process.cwd(), 'rasengan.config.js');
11
- if (!fs.existsSync(configPath)) {
12
- throw new Error(`Configuration file not found at: ${configPath}`);
10
+ const packageJsonPath = resolve(process.cwd(), 'package.json');
11
+ if (!fs.existsSync(packageJsonPath)) {
12
+ throw new Error(`Package.json file not found at: ${packageJsonPath}`);
13
13
  }
14
- const rasenganConfig = await (await loadModuleSSR(configPath)).default;
15
- const partialConfig = {
16
- server: rasenganConfig.server ?? {},
17
- redirects: rasenganConfig.redirects
18
- ? await rasenganConfig.redirects()
19
- : [],
14
+ const packageJsonRaw = fs.readFileSync(packageJsonPath, {
15
+ encoding: 'utf-8',
16
+ });
17
+ const packageJson = JSON.parse(packageJsonRaw);
18
+ const rasenganConfig = {
19
+ version: packageJson.version,
20
+ ssr: true,
20
21
  };
21
22
  // Inject the configuration as a global constant
22
23
  return {
23
24
  define: {
24
- ['__RASENGAN_CONFIG__']: JSON.stringify(partialConfig),
25
+ ['Rasengan']: JSON.stringify(rasenganConfig),
25
26
  },
26
27
  };
27
28
  },
29
+ apply: 'build',
28
30
  };
29
31
  }
30
32
  function rasenganConfigPlugin() {
@@ -113,4 +115,4 @@ export function rasengan({ adapter = { name: Adapters.DEFAULT, prepare: async ()
113
115
  },
114
116
  };
115
117
  }
116
- export const plugins = [];
118
+ export const plugins = [loadRasenganGlobal()];
@@ -34,7 +34,7 @@ export const HeadComponent = ({ metadata, assets = [], children = undefined, })
34
34
  const description = metadata.page.description;
35
35
  return { title, description };
36
36
  }, [metadata]);
37
- return (_jsxs("head", { children: [metaTags, assets, _jsx("title", { children: title }), _jsx("meta", { name: "description", content: description, "data-rg": "true" }), children] }));
37
+ return (_jsxs("head", { children: [_jsx("meta", { name: "generator", content: "Rasengan.js" }), metaTags, assets, _jsx("title", { children: title }), _jsx("meta", { name: "description", content: description, "data-rg": "true" }), children] }));
38
38
  };
39
39
  /**
40
40
  * Body component
@@ -24,7 +24,7 @@ const generateRoutesGroup = (path, children) => {
24
24
  pages.push(...childrenPages);
25
25
  }
26
26
  else {
27
- const routePath = path[0] === '/' ? path : `/${path}`;
27
+ const routePath = path === '/' ? '' : path[0] === '/' ? path : `/${path}`;
28
28
  // Check if the page is a PageComponent
29
29
  if (page['path']) {
30
30
  const pagePath = page['path'][0] === '/' ? page['path'].slice(1) : page['path'];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rasengan",
3
3
  "private": false,
4
- "version": "1.0.0-beta.57",
4
+ "version": "1.0.0-beta.58",
5
5
  "description": "The modern React Framework",
6
6
  "type": "module",
7
7
  "main": "lib/esm/index.js",
@@ -79,7 +79,7 @@
79
79
  "sass": "*",
80
80
  "stylus": "*",
81
81
  "vite": "^6.0.0",
82
- "@rasenganjs/mdx": "^1.0.6"
82
+ "@rasenganjs/mdx": "^1.1.0-beta.0"
83
83
  },
84
84
  "peerDependenciesMeta": {
85
85
  "@types/node": {