Prevent not exported routes error (#76)

* fix: prevent no exported route compiler error

* feat: update version to v0.11.1

* fix: formatting
This commit is contained in:
Valerio Ageno
2024-11-04 19:25:46 +01:00
committed by GitHub
parent 9cb0f62da7
commit edfbd03f13
21 changed files with 32 additions and 19 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "tuono"
version = "0.11.0"
version = "0.11.1"
edition = "2021"
authors = ["V. Ageno <valerioageno@yahoo.it>"]
description = "The react/rust fullstack framework"
+2 -2
View File
@@ -1,6 +1,6 @@
[package]
name = "tuono_lib"
version = "0.11.0"
version = "0.11.1"
edition = "2021"
authors = ["V. Ageno <valerioageno@yahoo.it>"]
description = "The react/rust fullstack framework"
@@ -33,7 +33,7 @@ either = "1.13.0"
tower-http = {version = "0.6.0", features = ["fs"]}
colored = "2.1.0"
tuono_lib_macros = {path = "../tuono_lib_macros", version = "0.11.0"}
tuono_lib_macros = {path = "../tuono_lib_macros", version = "0.11.1"}
# Match the same version used by axum
tokio-tungstenite = "0.24.0"
futures-util = { version = "0.3", default-features = false, features = ["sink", "std"] }
+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "tuono_lib_macros"
version = "0.11.0"
version = "0.11.1"
edition = "2021"
description = "The react/rust fullstack framework"
keywords = [ "react", "typescript", "fullstack", "web", "ssr"]
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "tuono-fs-router-vite-plugin",
"version": "0.11.0",
"version": "0.11.1",
"description": "Plugin for the tuono's file system router. Tuono is the react/rust fullstack framework",
"scripts": {
"dev": "vite build --watch",
@@ -21,6 +21,7 @@ import { ROUTES_FOLDER, ROOT_PATH_ID, GENERATED_ROUTE_TREE } from './constants'
import { format } from 'prettier'
import { sortRouteNodes } from './sort-route-nodes'
import isDefaultExported from './utils/is-default-exported'
let latestTask = 0
@@ -50,6 +51,13 @@ async function getRouteNodes(
if (dirent.isDirectory()) {
await recurse(relativePath)
} else if (fullPath.match(/\.(tsx|ts|jsx|js|mdx)$/)) {
// Check that the route is correctly default exported
if (
fullPath.match(/\.(tsx|ts|jsx|js)$/) &&
!isDefaultExported((await fsp.readFile(fullPath)).toString())
) {
return
}
const filePath = replaceBackslash(path.join(dir, dirent.name))
const filePathNoExt = removeExt(filePath)
let routePath =
@@ -0,0 +1,4 @@
export default function isDefaultExported(source: string): boolean {
const regex = new RegExp('export default')
return regex.test(source)
}
@@ -1 +1,2 @@
/** */
// export default
@@ -1 +1 @@
/** */
/** export default */
@@ -1 +1 @@
/** */
/** export default */
@@ -1 +1 @@
/** */
/** export default */
@@ -1 +1 @@
/** */
/** export default */
@@ -1 +1 @@
/** */
/** export default */
@@ -1 +1 @@
/** */
/** export default */
@@ -1 +1 @@
/** */
/** export default */
@@ -1 +1 @@
/** */
/** export default */
@@ -1 +1 @@
/** */
/** export default */
@@ -1 +1 @@
/** */
/** export default */
@@ -1 +1 @@
/** */
/** export default */
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "tuono-lazy-fn-vite-plugin",
"version": "0.11.0",
"version": "0.11.1",
"description": "Plugin for the tuono's lazy fn. Tuono is the react/rust fullstack framework",
"scripts": {
"dev": "vite build --watch",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "tuono-router",
"version": "0.11.0",
"version": "0.11.1",
"description": "React routing component for the framework tuono. Tuono is the react/rust fullstack framework",
"scripts": {
"dev": "vite build --watch",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "tuono",
"version": "0.11.0",
"version": "0.11.1",
"description": "The react/rust fullstack framework",
"scripts": {
"dev": "vite build --watch",