mirror of
https://github.com/tuono-labs/tuono
synced 2026-07-25 12:52:47 -07:00
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:
@@ -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"
|
||||
|
||||
@@ -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,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,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
@@ -1 +1 @@
|
||||
/** */
|
||||
/** export default */
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
/** */
|
||||
/** export default */
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
/** */
|
||||
/** export default */
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
/** */
|
||||
/** export default */
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
/** */
|
||||
/** export default */
|
||||
|
||||
+1
-1
@@ -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,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,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,6 +1,6 @@
|
||||
{
|
||||
"name": "tuono",
|
||||
"version": "0.11.0",
|
||||
"version": "0.11.1",
|
||||
"description": "The react/rust fullstack framework",
|
||||
"scripts": {
|
||||
"dev": "vite build --watch",
|
||||
|
||||
Reference in New Issue
Block a user