@zenithbuild/router 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +64 -64
- package/src/navigation/ZenLink.zen +7 -12
package/package.json
CHANGED
|
@@ -1,66 +1,66 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
"exports": {
|
|
23
|
-
".": "./src/index.ts",
|
|
24
|
-
"./manifest": "./src/manifest.ts",
|
|
25
|
-
"./runtime": "./src/runtime.ts",
|
|
26
|
-
"./navigation": "./src/navigation/index.ts",
|
|
27
|
-
"./types": "./src/types.ts"
|
|
28
|
-
},
|
|
29
|
-
"keywords": [
|
|
30
|
-
"zenith",
|
|
31
|
-
"router",
|
|
32
|
-
"spa",
|
|
33
|
-
"file-based-routing",
|
|
34
|
-
"compile-time"
|
|
35
|
-
],
|
|
36
|
-
"author": "Zenith Team",
|
|
37
|
-
"repository": {
|
|
38
|
-
"type": "git",
|
|
39
|
-
"url": "git+ssh://git@github.com/zenithbuild/zenith-router.git"
|
|
40
|
-
},
|
|
41
|
-
"scripts": {
|
|
42
|
-
"format": "prettier --write \"**/*.ts\"",
|
|
43
|
-
"format:check": "prettier --check \"**/*.ts\"",
|
|
44
|
-
"typecheck": "tsc --noEmit",
|
|
45
|
-
"build": "napi build --release",
|
|
46
|
-
"build:debug": "napi build",
|
|
47
|
-
"release": "bun run scripts/release.ts",
|
|
48
|
-
"release:dry": "bun run scripts/release.ts --dry-run",
|
|
49
|
-
"release:patch": "bun run scripts/release.ts --bump=patch",
|
|
50
|
-
"release:minor": "bun run scripts/release.ts --bump=minor",
|
|
51
|
-
"release:major": "bun run scripts/release.ts --bump=major"
|
|
52
|
-
},
|
|
53
|
-
"publishConfig": {
|
|
54
|
-
"access": "public"
|
|
55
|
-
},
|
|
56
|
-
"private": false,
|
|
57
|
-
"devDependencies": {
|
|
58
|
-
"@napi-rs/cli": "^2.18.4",
|
|
59
|
-
"@types/bun": "latest",
|
|
60
|
-
"@types/node": "latest",
|
|
61
|
-
"prettier": "^3.7.4"
|
|
62
|
-
},
|
|
63
|
-
"peerDependencies": {
|
|
64
|
-
"typescript": "^5"
|
|
2
|
+
"name": "@zenithbuild/router",
|
|
3
|
+
"version": "1.0.8",
|
|
4
|
+
"description": "File-based SPA router for Zenith framework with deterministic, compile-time route resolution",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./src/index.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"src",
|
|
10
|
+
"dist",
|
|
11
|
+
"tsconfig.json",
|
|
12
|
+
"index.js",
|
|
13
|
+
"index.d.ts",
|
|
14
|
+
"zenith-router.node"
|
|
15
|
+
],
|
|
16
|
+
"napi": {
|
|
17
|
+
"name": "zenith-router",
|
|
18
|
+
"package": {
|
|
19
|
+
"name": "@zenithbuild/router"
|
|
65
20
|
}
|
|
66
|
-
}
|
|
21
|
+
},
|
|
22
|
+
"exports": {
|
|
23
|
+
".": "./src/index.ts",
|
|
24
|
+
"./manifest": "./src/manifest.ts",
|
|
25
|
+
"./runtime": "./src/runtime.ts",
|
|
26
|
+
"./navigation": "./src/navigation/index.ts",
|
|
27
|
+
"./types": "./src/types.ts"
|
|
28
|
+
},
|
|
29
|
+
"keywords": [
|
|
30
|
+
"zenith",
|
|
31
|
+
"router",
|
|
32
|
+
"spa",
|
|
33
|
+
"file-based-routing",
|
|
34
|
+
"compile-time"
|
|
35
|
+
],
|
|
36
|
+
"author": "Zenith Team",
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "git+ssh://git@github.com/zenithbuild/zenith-router.git"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"format": "prettier --write \"**/*.ts\"",
|
|
43
|
+
"format:check": "prettier --check \"**/*.ts\"",
|
|
44
|
+
"typecheck": "tsc --noEmit",
|
|
45
|
+
"build": "napi build --release",
|
|
46
|
+
"build:debug": "napi build",
|
|
47
|
+
"release": "bun run scripts/release.ts",
|
|
48
|
+
"release:dry": "bun run scripts/release.ts --dry-run",
|
|
49
|
+
"release:patch": "bun run scripts/release.ts --bump=patch",
|
|
50
|
+
"release:minor": "bun run scripts/release.ts --bump=minor",
|
|
51
|
+
"release:major": "bun run scripts/release.ts --bump=major"
|
|
52
|
+
},
|
|
53
|
+
"publishConfig": {
|
|
54
|
+
"access": "public"
|
|
55
|
+
},
|
|
56
|
+
"private": false,
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@napi-rs/cli": "^2.18.4",
|
|
59
|
+
"@types/bun": "latest",
|
|
60
|
+
"@types/node": "latest",
|
|
61
|
+
"prettier": "^3.7.4"
|
|
62
|
+
},
|
|
63
|
+
"peerDependencies": {
|
|
64
|
+
"typescript": "^5"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -87,19 +87,17 @@ function handleClick(event, el) {
|
|
|
87
87
|
|
|
88
88
|
// Only navigate if path is different (idempotent navigation)
|
|
89
89
|
if (normalizedHref !== currentPath) {
|
|
90
|
-
console.log('[ZenLink] Navigating to:', linkHref)
|
|
91
90
|
// Navigate using SPA router
|
|
92
91
|
if (window.__zenith_router && window.__zenith_router.navigate) {
|
|
93
|
-
console.log('[ZenLink] Using router.navigate')
|
|
94
92
|
window.__zenith_router.navigate(linkHref)
|
|
95
93
|
} else {
|
|
96
|
-
console.log('[ZenLink] Using fallback history API')
|
|
97
94
|
// Fallback to history API
|
|
98
95
|
window.history.pushState(null, '', linkHref)
|
|
99
96
|
window.dispatchEvent(new PopStateEvent('popstate'))
|
|
100
97
|
}
|
|
101
98
|
} else {
|
|
102
|
-
|
|
99
|
+
// Already on route
|
|
100
|
+
|
|
103
101
|
}
|
|
104
102
|
}
|
|
105
103
|
|
|
@@ -113,9 +111,9 @@ function handleMouseEnter(event, el) {
|
|
|
113
111
|
}
|
|
114
112
|
|
|
115
113
|
const shouldPreload = typeof preload !== 'undefined' ? preload : false
|
|
116
|
-
|
|
114
|
+
|
|
117
115
|
if (!shouldPreload) {
|
|
118
|
-
|
|
116
|
+
|
|
119
117
|
return
|
|
120
118
|
}
|
|
121
119
|
|
|
@@ -129,18 +127,15 @@ function handleMouseEnter(event, el) {
|
|
|
129
127
|
return
|
|
130
128
|
}
|
|
131
129
|
|
|
132
|
-
|
|
130
|
+
|
|
133
131
|
|
|
134
132
|
// Prefetch the route
|
|
135
133
|
if (window.__zenith_router && window.__zenith_router.prefetch) {
|
|
136
|
-
|
|
137
|
-
window.__zenith_router.prefetch(linkHref).then(() => {
|
|
138
|
-
console.log('[ZenLink] Prefetch complete for:', linkHref)
|
|
139
|
-
}).catch((error) => {
|
|
134
|
+
window.__zenith_router.prefetch(linkHref).catch((error) => {
|
|
140
135
|
console.warn('[ZenLink] Prefetch failed for:', linkHref, error)
|
|
141
136
|
})
|
|
142
137
|
} else {
|
|
143
|
-
console.warn('[ZenLink] Router prefetch not available')
|
|
138
|
+
// console.warn('[ZenLink] Router prefetch not available')
|
|
144
139
|
}
|
|
145
140
|
}
|
|
146
141
|
|