Skip to content

Commit 105153c

Browse files
fix: windows compatible regex and filename (#87)
Co-authored-by: Heb <[email protected]>
1 parent a874e82 commit 105153c

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

packages/form-actions-nuxt/src/runtime/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export const NITRO_LOADER_PREFIX = "_@loader_" as const
33
export const GENERATED_TEXT = "/** This file is auto-generated by the form-actions module. /!\\ Do not modify it manually ! */ \n"
44

55
export function getActionRoute(actionPath: string) {
6-
const actionRegex = /actions\/(.*?)\.ts/
6+
const actionRegex = /.*actions[\/\\](.*?)\.ts/
77
const actionRoute = actionRegex.exec(actionPath)?.[1]
88
if (!actionRoute) throw new Error(`Could not parse action route from ${actionPath}`)
99
return actionRoute
@@ -12,7 +12,7 @@ export function getActionRoute(actionPath: string) {
1212
export const addLoaderPrefix = (route: string) => `/${NITRO_LOADER_PREFIX}/${route}`
1313

1414
export function getLoaderRoute(path: string) {
15-
const regex = /server\/\.generated\/\.loader\/(.*?)\.get\.ts/
15+
const regex = /server[\/\\]\.generated[\/\\]\.loader[\/\\](.*?)\.get\.ts/
1616
const loaderRoute = regex.exec(path)?.[1]
1717
if (!loaderRoute) throw new Error(`Could not parse loader route from ${path}`)
1818
return addLoaderPrefix(loaderRoute)

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"paths": {
66
"#imports": ["./node_modules/nuxt/app.d.ts"],
77
"#app": ["./node_modules/nuxt/dist/app"],
8-
"#build/types/loader-types.d.ts": ["./packages/form-actions-nuxt/src/runtime/virtual:loader-types.d.ts"]
8+
"#build/types/loader-types.d.ts": ["./packages/form-actions-nuxt/src/runtime/virtual.loader-types.d.ts"]
99
}
1010
},
1111
"exclude": [

0 commit comments

Comments
 (0)