Skip to content

Commit

Permalink
fix: windows compatible regex and filename (#87)
Browse files Browse the repository at this point in the history
Co-authored-by: Heb <xsh4k3@gmail.com>
  • Loading branch information
EvanSchleret and Hebilicious committed Nov 9, 2023
1 parent a874e82 commit 105153c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/form-actions-nuxt/src/runtime/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export const NITRO_LOADER_PREFIX = "_@loader_" as const
export const GENERATED_TEXT = "/** This file is auto-generated by the form-actions module. /!\\ Do not modify it manually ! */ \n"

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

export function getLoaderRoute(path: string) {
const regex = /server\/\.generated\/\.loader\/(.*?)\.get\.ts/
const regex = /server[\/\\]\.generated[\/\\]\.loader[\/\\](.*?)\.get\.ts/
const loaderRoute = regex.exec(path)?.[1]
if (!loaderRoute) throw new Error(`Could not parse loader route from ${path}`)
return addLoaderPrefix(loaderRoute)
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"paths": {
"#imports": ["./node_modules/nuxt/app.d.ts"],
"#app": ["./node_modules/nuxt/dist/app"],
"#build/types/loader-types.d.ts": ["./packages/form-actions-nuxt/src/runtime/virtual:loader-types.d.ts"]
"#build/types/loader-types.d.ts": ["./packages/form-actions-nuxt/src/runtime/virtual.loader-types.d.ts"]
}
},
"exclude": [
Expand Down

0 comments on commit 105153c

Please sign in to comment.