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 +4 -0
- package/lib/esm/core/config/utils/path.js +4 -3
- package/lib/esm/routing/utils/define-router.js +2 -1
- package/lib/esm/routing/utils/generate-routes.js +7 -7
- package/lib/esm/server/node/index.js +3 -2
- package/lib/esm/server/runtime/utils.js +5 -0
- package/lib/tsconfig.esm.tsbuildinfo +1 -1
- package/lib/tsconfig.types.tsbuildinfo +1 -1
- package/lib/types/core/config/utils/path.d.ts +1 -1
- package/lib/types/routing/types.d.ts +1 -1
- package/lib/types/server/runtime/utils.d.ts +4 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -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 = (
|
|
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 =
|
|
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
|
|
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
|
|
239
|
-
if (
|
|
240
|
-
route.children.push(
|
|
238
|
+
for (const importedRoute of importedRoutes) {
|
|
239
|
+
if (importedRoute.nested) {
|
|
240
|
+
route.children.push(importedRoute);
|
|
241
241
|
}
|
|
242
242
|
else {
|
|
243
|
-
routes.push(
|
|
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();
|
|
@@ -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.
|
|
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.
|
|
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"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rasengan",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.0.0-beta.
|
|
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": "
|
|
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",
|