Skip to content

Commit 843d160

Browse files
committed
🐛 Fix routify version mismatch bug #13
1 parent 0e55b75 commit 843d160

File tree

8 files changed

+2068
-1808
lines changed

8 files changed

+2068
-1808
lines changed

client/.routify/instance.default.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { Router, createRouter } from '@roxi/routify'
22
import routes from './routes.default.js'
33

4+
// remove previous routers to avoid bumping router names (/path => /1/path)
5+
globalThis.__routify.reset()
46
export const router = createRouter({routes})
57
export { Router, routes }

client/.routify/render.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
import * as module from '../src/App.svelte'
3-
import { renderModule } from '@roxi/routify/tools'
3+
import { renderModule } from '@roxi/routify/tools/ssr4.js'
44
import { map } from './route-map.js'
55

66
export const render = url => renderModule(module, { url, routesMap: map })

client/.routify/route-map.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11

22
export const map = {
3-
default: () => import('./routes.default.js').then(m => m.default)
3+
'default': () => import('./routes.default.js').then(m => m.default)
44
}

client/.routify/routes.default.js

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11

22

3-
export default {
3+
export const routes = {
44
"meta": {},
55
"id": "_default",
6-
"_regex": {},
7-
"_paramKeys": {},
6+
"name": "",
87
"file": {
98
"path": "src/routes",
109
"dir": "src",
@@ -18,8 +17,6 @@ export default {
1817
{
1918
"meta": {},
2019
"id": "_default_Advice_svelte",
21-
"_regex": {},
22-
"_paramKeys": {},
2320
"name": "Advice",
2421
"file": {
2522
"path": "src/routes/Advice.svelte",
@@ -34,8 +31,6 @@ export default {
3431
{
3532
"meta": {},
3633
"id": "_default_Detail_svelte",
37-
"_regex": {},
38-
"_paramKeys": {},
3934
"name": "Detail",
4035
"file": {
4136
"path": "src/routes/Detail.svelte",
@@ -50,8 +45,6 @@ export default {
5045
{
5146
"meta": {},
5247
"id": "_default_Index_svelte",
53-
"_regex": {},
54-
"_paramKeys": {},
5548
"name": "Index",
5649
"file": {
5750
"path": "src/routes/Index.svelte",
@@ -66,10 +59,10 @@ export default {
6659
{
6760
"meta": {
6861
"dynamic": true,
69-
"dynamicSpread": true
62+
"dynamicSpread": true,
63+
"order": false,
64+
"inline": false
7065
},
71-
"_regex": {},
72-
"_paramKeys": {},
7366
"name": "[...404]",
7467
"file": {
7568
"path": ".routify/components/[...404].svelte",
@@ -82,4 +75,5 @@ export default {
8275
"children": []
8376
}
8477
]
85-
}
78+
}
79+
export default routes

client/.routify/routify-init.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ appInstance.routeMaps = map
77
// We need to import the App module since a router is likely declared here. This saves us pre-creating the router in the preload step below.
88
import * as module from '../src/App.svelte'
99

10-
Promise.all([
10+
const preloadPromise = Promise.all([
1111
module.load?.(),
1212
// PreloadUrl parses the url and preloads each url chunk in a router that matches its name. So for '/hello;widget=/world',
1313
// it will preload '/hello' in the default router and '/world' in the 'widget' router.
1414
// If the respective routers don't exist, preloadUrl will use routesMap to pre-create a router and match it with the url chunk.
1515
preloadUrl({ routesMap: map })
1616
])
1717

18-
export const app = import('../src/main.js')
18+
export const app = preloadPromise.then(() => import('../src/main.js'))

client/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"start": "npm run dev",
99
"dev": "vite",
1010
"build": "vite build",
11-
"release": "npm run routify && vite build",
1211
"preview": "vite preview",
1312
"routify": "npx @roxi/routify build && cp ./src/components/404.svelte .routify/components/[...404].svelte",
1413
"gen-sitemap": "node scripts/gen-sitemap.js",
@@ -31,7 +30,7 @@
3130
"tailwind-merge": "^2.2.2"
3231
},
3332
"devDependencies": {
34-
"@roxi/routify": "^3.0.0-next.160",
33+
"@roxi/routify": "3.0.0-next.160",
3534
"@sveltejs/vite-plugin-svelte": "^2.0.2",
3635
"@tailwindcss/typography": "^0.5.9",
3736
"@tsconfig/svelte": "^3.0.0",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"version": "2.0.0",
55
"author": "nicejade",
66
"scripts": {
7-
"build:client": "lerna run release --scope=client",
7+
"build:client": "lerna run build --scope=client",
88
"build:server": "lerna run build --scope=server",
99
"build": "npm run build:client && npm run build:server",
1010
"start": "lerna run deploy --scope=server",

0 commit comments

Comments
 (0)