Skip to content

Commit

Permalink
minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed May 24, 2021
1 parent ba150e2 commit 59318f6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
1 change: 0 additions & 1 deletion examples/vue-router/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
/node_modules/
dist
12 changes: 6 additions & 6 deletions src/route.shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ function resolveRouteFunction(
type PageRoute<T=string | Function | RouteFunctionMatch> = {
pageRouteFile?: string
pageRoute: T
id: PageId
pageId: PageId
}
async function loadPageRoutes(): Promise<Record<PageId, PageRoute>> {
const userRouteFiles = await getPageFiles('.page.route')
Expand All @@ -261,10 +261,10 @@ async function loadPageRoutes(): Promise<Record<PageId, PageRoute>> {
`The default export of ${filePath} should be a string or a function.`
)
const pageRoute = fileExports.default
const id = computePageId(filePath)
const pageId = computePageId(filePath)
const pageRouteFile = filePath

pageRoutes[id] = { pageRoute, pageRouteFile, id }
pageRoutes[pageId] = { pageRoute, pageRouteFile, pageId }
})
)

Expand Down Expand Up @@ -302,8 +302,8 @@ function getRouteStrings(routes: PageRoute[], pageIds: PageId[]) {
const { sortRoutes } = getCustomRouter();

const fsRouteStrings : PageRoute[] = pageIds
.filter(pageId => !routes.some(route => route.id === pageId) && !isErrorPage(pageId))
.map(id => ({ pageRoute: getFilesystemRoute(id, pageIds), id }));
.filter(pageId => !routes.some(route => route.pageId === pageId) && !isErrorPage(pageId))
.map(pageId => ({ pageRoute: getFilesystemRoute(pageId, pageIds), pageId }));

const routeStrings = Object.values(routes)
.filter(route => !isCallable(route.pageRoute));
Expand Down Expand Up @@ -338,7 +338,7 @@ async function matchPathToRegexpRoutes(

for (var ii = 0; ii < routes.length; ++ii) {
const route = routes[ii];
const { pageRoute, id: pageId } = route;
const { pageRoute, pageId } = route;

// Route with `.page.route.js` defined route string
if (typeof pageRoute === 'string') {
Expand Down
5 changes: 1 addition & 4 deletions src/ssrEnv.node.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ViteDevServer } from 'vite'
import { RoutingHandler } from './route.shared';

export { setSsrEnv }
export { getSsrEnv }
Expand All @@ -10,15 +9,13 @@ type SsrEnv =
isProduction: false
viteDevServer: ViteDevServer
root: string
baseUrl: string,
customRouting?: RoutingHandler
baseUrl: string
}
| {
isProduction: true
viteDevServer: undefined
root?: string
baseUrl: string
customRouting?: RoutingHandler
}

function getSsrEnv(): SsrEnv {
Expand Down

0 comments on commit 59318f6

Please sign in to comment.