rasengan 1.0.0-beta.55 → 1.0.0-beta.57

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,9 @@
1
1
  ## Unreleased
2
2
 
3
+ ## 1.0.0-beta.57 (2025-03-04)
4
+
5
+ ## 1.0.0-beta.56 (2025-03-03)
6
+
3
7
  ## 1.0.0-beta.55 (2025-02-28)
4
8
 
5
9
  ## 1.0.0-beta.54 (2025-02-28)
@@ -1,15 +1,16 @@
1
+ import path from 'node:path';
1
2
  /**
2
3
  * Adapts the provided file path to a valid URL format based on the operating system.
3
4
  *
4
5
  * @param path - The file path to be adapted.
5
6
  * @returns The adapted file path in a valid URL format.
6
7
  */
7
- export const resolvePath = (path) => {
8
+ export const resolvePath = (pathValue) => {
8
9
  // Check the OS
9
10
  const isWindows = process.platform === 'win32';
10
11
  // Adapt the path
11
12
  if (isWindows) {
12
- return `file:///${path}`;
13
+ return `file:///${path.normalize(pathValue)}`;
13
14
  }
14
- return path;
15
+ return path.normalize(pathValue);
15
16
  };
@@ -38,8 +38,9 @@ export const defineRouter = (option) => {
38
38
  pageComponentList.push(p);
39
39
  }
40
40
  }
41
+ let routers = await Promise.all(imports ?? []);
41
42
  // Set properties
42
- router.routers = imports || [];
43
+ router.routers = routers;
43
44
  router.layout = layout || DefaultLayout;
44
45
  router.pages = pageComponentList;
45
46
  router.loaderComponent = loaderComponent || (() => null);
@@ -150,7 +150,7 @@ export const generateRoutes = (router, isRoot = true, parentLayout = undefined)
150
150
  const route = {
151
151
  path: !isRoot
152
152
  ? router.useParentLayout
153
- ? parentLayout.path + Layout.path
153
+ ? parentLayout.path + (Layout.path === '/' ? '' : Layout.path)
154
154
  : Layout.path
155
155
  : Layout.path,
156
156
  errorElement: _jsx(ErrorBoundary, {}),
@@ -232,17 +232,17 @@ export const generateRoutes = (router, isRoot = true, parentLayout = undefined)
232
232
  pages.forEach((page) => {
233
233
  route.children.push(page);
234
234
  });
235
- // Loop through imported routers in order to apply the same thing.
235
+ // Loop through imported routers in order to apply the same logic like above.
236
236
  for (const importedRouter of router.routers) {
237
237
  const importedRoutes = generateRoutes(importedRouter, false, Layout);
238
- importedRoutes.forEach((route) => {
239
- if (route.nested) {
240
- route.children.push(route);
238
+ for (const importedRoute of importedRoutes) {
239
+ if (importedRoute.nested) {
240
+ route.children.push(importedRoute);
241
241
  }
242
242
  else {
243
- routes.push(route);
243
+ routes.push(importedRoute);
244
244
  }
245
- });
245
+ }
246
246
  }
247
247
  // Make sure to add the route at the beginning of the list
248
248
  routes.unshift(route);
@@ -7,15 +7,16 @@ import createRasenganRequest from './utils.js';
7
7
  import { extractHeadersFromRRContext, extractMetaFromRRContext, isRedirectResponse, isStaticRedirectFromConfig, } from '../dev/utils.js';
8
8
  import { handleRedirectRequest } from '../dev/handlers.js';
9
9
  import { loadModuleSSR } from '../../core/config/utils/load-modules.js';
10
+ import { resolvePath } from '../../core/config/utils/path.js';
10
11
  export function createRequestHandler(options) {
11
12
  const { build: buildOptions } = options;
12
13
  const manifest = new ManifestManager(path.posix.join(buildOptions.buildDirectory, buildOptions.clientPathDirectory, buildOptions.manifestPathDirectory, 'manifest.json'));
13
14
  return async function requestHandler(req, res) {
14
15
  try {
15
16
  // Get server entry
16
- const entry = await import(path.posix.join(buildOptions.buildDirectory, buildOptions.serverPathDirectory, buildOptions.entryServerPath));
17
+ const entry = await import(resolvePath(path.posix.join(buildOptions.buildDirectory, buildOptions.serverPathDirectory, buildOptions.entryServerPath)));
17
18
  // Get AppRouter
18
- const AppRouter = await (await import(path.posix.join(buildOptions.buildDirectory, buildOptions.serverPathDirectory, 'app.router.js'))).default;
19
+ const AppRouter = await (await import(resolvePath(path.posix.join(buildOptions.buildDirectory, buildOptions.serverPathDirectory, 'app.router.js')))).default;
19
20
  // Get Config
20
21
  const configHandler = await (await loadModuleSSR(path.posix.join(buildOptions.buildDirectory, buildOptions.serverPathDirectory, 'config.js'))).default;
21
22
  const config = await configHandler();
@@ -0,0 +1,5 @@
1
+ import os from 'node:os';
2
+ /**
3
+ * Check if the current OS is the provided one
4
+ */
5
+ export const checkOsPlateform = (osname) => osname === os.platform();
@@ -1 +1 @@
1
- {"root":["../src/client.ts","../src/index.ts","../src/plugin.ts","../src/server.ts","../src/cli/index.ts","../src/core/index.ts","../src/core/types.ts","../src/core/config/index.ts","../src/core/config/type.ts","../src/core/config/utils/define-config.ts","../src/core/config/utils/load-modules.ts","../src/core/config/utils/path.ts","../src/core/config/vite/defaults.ts","../src/core/dynamic/index.tsx","../src/core/middlewares/index.ts","../src/core/middlewares/logger.ts","../src/core/plugins/index.ts","../src/core/utils/log.ts","../src/entries/client/render.tsx","../src/entries/server/entry.server.tsx","../src/entries/server/index.tsx","../src/routing/index.ts","../src/routing/interfaces.tsx","../src/routing/types.ts","../src/routing/components/index.tsx","../src/routing/components/template.tsx","../src/routing/utils/define-router.tsx","../src/routing/utils/define-routes-group.tsx","../src/routing/utils/generate-metadata.tsx","../src/routing/utils/generate-routes.tsx","../src/routing/utils/index.tsx","../src/scripts/build-command.js","../src/scripts/generate-package-json.js","../src/scripts/utils/check-os.js","../src/scripts/utils/copy.js","../src/server/build/index.ts","../src/server/build/manifest.tsx","../src/server/dev/handlers.tsx","../src/server/dev/server.ts","../src/server/dev/utils.ts","../src/server/node/index.tsx","../src/server/node/rendering.ts","../src/server/node/stream.ts","../src/server/node/utils.ts","../src/server/runtime/mode.ts","../src/server/virtual/index.ts","../types/client.d.ts"],"version":"5.7.2"}
1
+ {"root":["../src/client.ts","../src/index.ts","../src/plugin.ts","../src/server.ts","../src/cli/index.ts","../src/core/index.ts","../src/core/types.ts","../src/core/config/index.ts","../src/core/config/type.ts","../src/core/config/utils/define-config.ts","../src/core/config/utils/load-modules.ts","../src/core/config/utils/path.ts","../src/core/config/vite/defaults.ts","../src/core/dynamic/index.tsx","../src/core/middlewares/index.ts","../src/core/middlewares/logger.ts","../src/core/plugins/index.ts","../src/core/utils/log.ts","../src/entries/client/render.tsx","../src/entries/server/entry.server.tsx","../src/entries/server/index.tsx","../src/routing/index.ts","../src/routing/interfaces.tsx","../src/routing/types.ts","../src/routing/components/index.tsx","../src/routing/components/template.tsx","../src/routing/utils/define-router.tsx","../src/routing/utils/define-routes-group.tsx","../src/routing/utils/generate-metadata.tsx","../src/routing/utils/generate-routes.tsx","../src/routing/utils/index.tsx","../src/scripts/build-command.js","../src/scripts/generate-package-json.js","../src/scripts/utils/check-os.js","../src/scripts/utils/copy.js","../src/server/build/index.ts","../src/server/build/manifest.tsx","../src/server/dev/handlers.tsx","../src/server/dev/server.ts","../src/server/dev/utils.ts","../src/server/node/index.tsx","../src/server/node/rendering.ts","../src/server/node/stream.ts","../src/server/node/utils.ts","../src/server/runtime/mode.ts","../src/server/runtime/utils.ts","../src/server/virtual/index.ts","../types/client.d.ts"],"version":"5.8.2"}
@@ -1 +1 @@
1
- {"root":["../src/client.ts","../src/index.ts","../src/plugin.ts","../src/server.ts","../src/cli/index.ts","../src/core/index.ts","../src/core/types.ts","../src/core/config/index.ts","../src/core/config/type.ts","../src/core/config/utils/define-config.ts","../src/core/config/utils/load-modules.ts","../src/core/config/utils/path.ts","../src/core/config/vite/defaults.ts","../src/core/dynamic/index.tsx","../src/core/middlewares/index.ts","../src/core/middlewares/logger.ts","../src/core/plugins/index.ts","../src/core/utils/log.ts","../src/entries/client/render.tsx","../src/entries/server/entry.server.tsx","../src/entries/server/index.tsx","../src/routing/index.ts","../src/routing/interfaces.tsx","../src/routing/types.ts","../src/routing/components/index.tsx","../src/routing/components/template.tsx","../src/routing/utils/define-router.tsx","../src/routing/utils/define-routes-group.tsx","../src/routing/utils/generate-metadata.tsx","../src/routing/utils/generate-routes.tsx","../src/routing/utils/index.tsx","../src/scripts/build-command.js","../src/scripts/generate-package-json.js","../src/scripts/utils/check-os.js","../src/scripts/utils/copy.js","../src/server/build/index.ts","../src/server/build/manifest.tsx","../src/server/dev/handlers.tsx","../src/server/dev/server.ts","../src/server/dev/utils.ts","../src/server/node/index.tsx","../src/server/node/rendering.ts","../src/server/node/stream.ts","../src/server/node/utils.ts","../src/server/runtime/mode.ts","../src/server/virtual/index.ts","../types/client.d.ts"],"version":"5.7.2"}
1
+ {"root":["../src/client.ts","../src/index.ts","../src/plugin.ts","../src/server.ts","../src/cli/index.ts","../src/core/index.ts","../src/core/types.ts","../src/core/config/index.ts","../src/core/config/type.ts","../src/core/config/utils/define-config.ts","../src/core/config/utils/load-modules.ts","../src/core/config/utils/path.ts","../src/core/config/vite/defaults.ts","../src/core/dynamic/index.tsx","../src/core/middlewares/index.ts","../src/core/middlewares/logger.ts","../src/core/plugins/index.ts","../src/core/utils/log.ts","../src/entries/client/render.tsx","../src/entries/server/entry.server.tsx","../src/entries/server/index.tsx","../src/routing/index.ts","../src/routing/interfaces.tsx","../src/routing/types.ts","../src/routing/components/index.tsx","../src/routing/components/template.tsx","../src/routing/utils/define-router.tsx","../src/routing/utils/define-routes-group.tsx","../src/routing/utils/generate-metadata.tsx","../src/routing/utils/generate-routes.tsx","../src/routing/utils/index.tsx","../src/scripts/build-command.js","../src/scripts/generate-package-json.js","../src/scripts/utils/check-os.js","../src/scripts/utils/copy.js","../src/server/build/index.ts","../src/server/build/manifest.tsx","../src/server/dev/handlers.tsx","../src/server/dev/server.ts","../src/server/dev/utils.ts","../src/server/node/index.tsx","../src/server/node/rendering.ts","../src/server/node/stream.ts","../src/server/node/utils.ts","../src/server/runtime/mode.ts","../src/server/runtime/utils.ts","../src/server/virtual/index.ts","../types/client.d.ts"],"version":"5.8.2"}
@@ -4,4 +4,4 @@
4
4
  * @param path - The file path to be adapted.
5
5
  * @returns The adapted file path in a valid URL format.
6
6
  */
7
- export declare const resolvePath: (path: string) => string;
7
+ export declare const resolvePath: (pathValue: string) => string;
@@ -62,7 +62,7 @@ export type RouterProps = {
62
62
  /**
63
63
  * Usefull to collect sub routers
64
64
  */
65
- imports?: Array<RouterComponent>;
65
+ imports?: Array<Promise<RouterComponent>>;
66
66
  /**
67
67
  * Usefull to define a layout
68
68
  */
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Check if the current OS is the provided one
3
+ */
4
+ export declare const checkOsPlateform: (osname: "aix" | "darwin" | "freebsd" | "linux" | "openbsd" | "sunos" | "win32") => boolean;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rasengan",
3
3
  "private": false,
4
- "version": "1.0.0-beta.55",
4
+ "version": "1.0.0-beta.57",
5
5
  "description": "The modern React Framework",
6
6
  "type": "module",
7
7
  "main": "lib/esm/index.js",
@@ -135,7 +135,7 @@
135
135
  ],
136
136
  "scripts": {
137
137
  "build:compile": "tsc -b ./tsconfig.esm.json ./tsconfig.types.json",
138
- "build:clean": "rm -rf ./lib",
138
+ "build:clean": "rimraf ./lib",
139
139
  "build": "pnpm run build:clean & pnpm run build:compile",
140
140
  "deploy": "pnpm publish --access public",
141
141
  "deploy:beta": "pnpm run deploy --tag beta",