@thelacanians/vue-native-navigation 0.3.0 → 0.4.0
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/dist/index.cjs +29 -12
- package/dist/index.js +29 -12
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -106,6 +106,12 @@ function createRouter(optionsOrRoutes) {
|
|
|
106
106
|
called = true;
|
|
107
107
|
resolve(void 0);
|
|
108
108
|
}
|
|
109
|
+
}).catch((err) => {
|
|
110
|
+
if (!called) {
|
|
111
|
+
called = true;
|
|
112
|
+
console.error("[VueNative] Navigation guard error:", err);
|
|
113
|
+
resolve(false);
|
|
114
|
+
}
|
|
109
115
|
});
|
|
110
116
|
}
|
|
111
117
|
});
|
|
@@ -129,14 +135,12 @@ function createRouter(optionsOrRoutes) {
|
|
|
129
135
|
const beforeResult = await runGuards(beforeGuards, to, from);
|
|
130
136
|
if (beforeResult === false) return;
|
|
131
137
|
if (typeof beforeResult === "string") {
|
|
132
|
-
navigate(beforeResult);
|
|
133
|
-
return;
|
|
138
|
+
return navigate(beforeResult);
|
|
134
139
|
}
|
|
135
140
|
const resolveResult = await runGuards(resolveGuards, to, from);
|
|
136
141
|
if (resolveResult === false) return;
|
|
137
142
|
if (typeof resolveResult === "string") {
|
|
138
|
-
navigate(resolveResult);
|
|
139
|
-
return;
|
|
143
|
+
return navigate(resolveResult);
|
|
140
144
|
}
|
|
141
145
|
stack.value = [...stack.value, to];
|
|
142
146
|
currentRoute.value = to;
|
|
@@ -159,14 +163,12 @@ function createRouter(optionsOrRoutes) {
|
|
|
159
163
|
const beforeResult = await runGuards(beforeGuards, to, from);
|
|
160
164
|
if (beforeResult === false) return;
|
|
161
165
|
if (typeof beforeResult === "string") {
|
|
162
|
-
navigate(beforeResult);
|
|
163
|
-
return;
|
|
166
|
+
return navigate(beforeResult);
|
|
164
167
|
}
|
|
165
168
|
const resolveResult = await runGuards(resolveGuards, to, from);
|
|
166
169
|
if (resolveResult === false) return;
|
|
167
170
|
if (typeof resolveResult === "string") {
|
|
168
|
-
navigate(resolveResult);
|
|
169
|
-
return;
|
|
171
|
+
return navigate(resolveResult);
|
|
170
172
|
}
|
|
171
173
|
stack.value = [...stack.value.slice(0, -1), to];
|
|
172
174
|
currentRoute.value = to;
|
|
@@ -183,14 +185,12 @@ function createRouter(optionsOrRoutes) {
|
|
|
183
185
|
const beforeResult = await runGuards(beforeGuards, to, from);
|
|
184
186
|
if (beforeResult === false) return;
|
|
185
187
|
if (typeof beforeResult === "string") {
|
|
186
|
-
navigate(beforeResult);
|
|
187
|
-
return;
|
|
188
|
+
return navigate(beforeResult);
|
|
188
189
|
}
|
|
189
190
|
const resolveResult = await runGuards(resolveGuards, to, from);
|
|
190
191
|
if (resolveResult === false) return;
|
|
191
192
|
if (typeof resolveResult === "string") {
|
|
192
|
-
navigate(resolveResult);
|
|
193
|
-
return;
|
|
193
|
+
return navigate(resolveResult);
|
|
194
194
|
}
|
|
195
195
|
stack.value = [to];
|
|
196
196
|
currentRoute.value = to;
|
|
@@ -212,6 +212,10 @@ function createRouter(optionsOrRoutes) {
|
|
|
212
212
|
}
|
|
213
213
|
function handleURL(url) {
|
|
214
214
|
if (!linkingConfig) return false;
|
|
215
|
+
if (url.length > 2048) {
|
|
216
|
+
console.warn("[VueNative] URL too long, ignoring:", url.slice(0, 100) + "...");
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
215
219
|
let path = url;
|
|
216
220
|
for (const prefix of linkingConfig.prefixes) {
|
|
217
221
|
if (url.startsWith(prefix)) {
|
|
@@ -230,6 +234,19 @@ function createRouter(optionsOrRoutes) {
|
|
|
230
234
|
return false;
|
|
231
235
|
}
|
|
232
236
|
function getState() {
|
|
237
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
238
|
+
for (const entry of stack.value) {
|
|
239
|
+
if (entry.params) {
|
|
240
|
+
for (const [key, val] of Object.entries(entry.params)) {
|
|
241
|
+
if (typeof val === "function" || typeof val === "symbol") {
|
|
242
|
+
console.warn(
|
|
243
|
+
`[vue-native/navigation] Route "${entry.config.name}" has non-serializable param "${key}" (${typeof val}). This value will be lost during state persistence.`
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
233
250
|
return {
|
|
234
251
|
stack: stack.value.map((entry) => ({
|
|
235
252
|
name: entry.config.name,
|
package/dist/index.js
CHANGED
|
@@ -82,6 +82,12 @@ function createRouter(optionsOrRoutes) {
|
|
|
82
82
|
called = true;
|
|
83
83
|
resolve(void 0);
|
|
84
84
|
}
|
|
85
|
+
}).catch((err) => {
|
|
86
|
+
if (!called) {
|
|
87
|
+
called = true;
|
|
88
|
+
console.error("[VueNative] Navigation guard error:", err);
|
|
89
|
+
resolve(false);
|
|
90
|
+
}
|
|
85
91
|
});
|
|
86
92
|
}
|
|
87
93
|
});
|
|
@@ -105,14 +111,12 @@ function createRouter(optionsOrRoutes) {
|
|
|
105
111
|
const beforeResult = await runGuards(beforeGuards, to, from);
|
|
106
112
|
if (beforeResult === false) return;
|
|
107
113
|
if (typeof beforeResult === "string") {
|
|
108
|
-
navigate(beforeResult);
|
|
109
|
-
return;
|
|
114
|
+
return navigate(beforeResult);
|
|
110
115
|
}
|
|
111
116
|
const resolveResult = await runGuards(resolveGuards, to, from);
|
|
112
117
|
if (resolveResult === false) return;
|
|
113
118
|
if (typeof resolveResult === "string") {
|
|
114
|
-
navigate(resolveResult);
|
|
115
|
-
return;
|
|
119
|
+
return navigate(resolveResult);
|
|
116
120
|
}
|
|
117
121
|
stack.value = [...stack.value, to];
|
|
118
122
|
currentRoute.value = to;
|
|
@@ -135,14 +139,12 @@ function createRouter(optionsOrRoutes) {
|
|
|
135
139
|
const beforeResult = await runGuards(beforeGuards, to, from);
|
|
136
140
|
if (beforeResult === false) return;
|
|
137
141
|
if (typeof beforeResult === "string") {
|
|
138
|
-
navigate(beforeResult);
|
|
139
|
-
return;
|
|
142
|
+
return navigate(beforeResult);
|
|
140
143
|
}
|
|
141
144
|
const resolveResult = await runGuards(resolveGuards, to, from);
|
|
142
145
|
if (resolveResult === false) return;
|
|
143
146
|
if (typeof resolveResult === "string") {
|
|
144
|
-
navigate(resolveResult);
|
|
145
|
-
return;
|
|
147
|
+
return navigate(resolveResult);
|
|
146
148
|
}
|
|
147
149
|
stack.value = [...stack.value.slice(0, -1), to];
|
|
148
150
|
currentRoute.value = to;
|
|
@@ -159,14 +161,12 @@ function createRouter(optionsOrRoutes) {
|
|
|
159
161
|
const beforeResult = await runGuards(beforeGuards, to, from);
|
|
160
162
|
if (beforeResult === false) return;
|
|
161
163
|
if (typeof beforeResult === "string") {
|
|
162
|
-
navigate(beforeResult);
|
|
163
|
-
return;
|
|
164
|
+
return navigate(beforeResult);
|
|
164
165
|
}
|
|
165
166
|
const resolveResult = await runGuards(resolveGuards, to, from);
|
|
166
167
|
if (resolveResult === false) return;
|
|
167
168
|
if (typeof resolveResult === "string") {
|
|
168
|
-
navigate(resolveResult);
|
|
169
|
-
return;
|
|
169
|
+
return navigate(resolveResult);
|
|
170
170
|
}
|
|
171
171
|
stack.value = [to];
|
|
172
172
|
currentRoute.value = to;
|
|
@@ -188,6 +188,10 @@ function createRouter(optionsOrRoutes) {
|
|
|
188
188
|
}
|
|
189
189
|
function handleURL(url) {
|
|
190
190
|
if (!linkingConfig) return false;
|
|
191
|
+
if (url.length > 2048) {
|
|
192
|
+
console.warn("[VueNative] URL too long, ignoring:", url.slice(0, 100) + "...");
|
|
193
|
+
return false;
|
|
194
|
+
}
|
|
191
195
|
let path = url;
|
|
192
196
|
for (const prefix of linkingConfig.prefixes) {
|
|
193
197
|
if (url.startsWith(prefix)) {
|
|
@@ -206,6 +210,19 @@ function createRouter(optionsOrRoutes) {
|
|
|
206
210
|
return false;
|
|
207
211
|
}
|
|
208
212
|
function getState() {
|
|
213
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
214
|
+
for (const entry of stack.value) {
|
|
215
|
+
if (entry.params) {
|
|
216
|
+
for (const [key, val] of Object.entries(entry.params)) {
|
|
217
|
+
if (typeof val === "function" || typeof val === "symbol") {
|
|
218
|
+
console.warn(
|
|
219
|
+
`[vue-native/navigation] Route "${entry.config.name}" has non-serializable param "${key}" (${typeof val}). This value will be lost during state persistence.`
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
209
226
|
return {
|
|
210
227
|
stack: stack.value.map((entry) => ({
|
|
211
228
|
name: entry.config.name,
|