🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

unplugin-vue-router

Package Overview
Dependencies
Maintainers
0
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unplugin-vue-router - npm Package Compare versions

Comparing version

to
0.10.8

2

dist/data-loaders/pinia-colada.d.ts

@@ -30,3 +30,3 @@ import { RouteMap, RouteLocationNormalizedLoaded, LocationQuery } from 'vue-router';

*/
key: (to: RouteLocationNormalizedLoaded<Name>) => EntryKey;
key: EntryKey | ((to: RouteLocationNormalizedLoaded<Name>) => EntryKey);
/**

@@ -33,0 +33,0 @@ * Function that returns a promise with the data.

@@ -42,3 +42,3 @@ import {

const isSSR = router[IS_SSR_KEY];
const key = keyText(options.key(to));
const key = serializeQueryKey(options.key, to);
if (!entries.has(loader)) {

@@ -89,8 +89,11 @@ const route = shallowRef(to);

const [trackedRoute, params, query, hash] = trackRoute(route);
entry.tracked.set(keyText(options.key(trackedRoute)).join("|"), {
ready: false,
params,
query,
hash
});
entry.tracked.set(
joinKeys(serializeQueryKey(options.key, trackedRoute)),
{
ready: false,
params,
query,
hash
}
);
return loader(trackedRoute, {

@@ -100,3 +103,3 @@ signal: route.meta[ABORT_CONTROLLER_KEY]?.signal

},
key: () => options.key(entry.route.value)
key: () => toValueWithParameters(options.key, entry.route.value)
// TODO: cleanup if gc

@@ -121,3 +124,3 @@ // onDestroy() {

if (entry.route.value !== to) {
const tracked = entry.tracked.get(key.join("|"));
const tracked = entry.tracked.get(joinKeys(key));
reload = !tracked || hasRouteChanged(to, tracked);

@@ -163,3 +166,3 @@ }

function commit(to) {
const key = keyText(options.key(to));
const key = serializeQueryKey(options.key, to);
if (this.pendingTo === to) {

@@ -175,3 +178,9 @@ if (process.env.NODE_ENV === "development") {

this.data.value = this.staged;
this.tracked.get(key.join("|")).ready = true;
if (process.env.NODE_ENV === "development" && !this.tracked.has(joinKeys(key))) {
console.warn(
`A query was defined with the same key as the loader "[${key.join(", ")}]" but with different "query" function.
See https://pinia-colada.esm.dev/#TODO`
);
}
this.tracked.get(joinKeys(key)).ready = true;
}

@@ -267,2 +276,3 @@ this.error.value = this.stagedError;

}
var joinKeys = (keys) => keys.join("|");
function hasRouteChanged(to, tracked) {

@@ -276,6 +286,13 @@ return !tracked.ready || !isSubsetOf(tracked.params, to.params) || !isSubsetOf(tracked.query, to.query) || tracked.hash.v != null && tracked.hash.v !== to.hash;

};
var keyText = (key) => {
var toValueWithParameters = (optionValue, arg) => {
return typeof optionValue === "function" ? (
// This should work in TS without a cast
optionValue(arg)
) : optionValue;
};
function serializeQueryKey(keyOption, to) {
const key = toValueWithParameters(keyOption, to);
const keys = Array.isArray(key) ? key : [key];
return keys.map(stringifyFlatObject);
};
}
function stringifyFlatObject(obj) {

@@ -282,0 +299,0 @@ return obj && typeof obj === "object" ? JSON.stringify(obj, Object.keys(obj).sort()) : String(obj);

@@ -321,5 +321,5 @@ import * as vue_router from 'vue-router';

* List of _expected_ errors that shouldn't abort the navigation (for non-lazy loaders). Provide a list of
* constructors that can be checked with `instanceof`.
* constructors that can be checked with `instanceof` or a custom function that returns `true` for expected errors.
*/
errors?: Array<new (...args: any) => any>;
errors?: Array<new (...args: any) => any> | ((reason?: unknown) => boolean);
}

@@ -326,0 +326,0 @@ /**

@@ -89,3 +89,3 @@ // src/data-loaders/navigation-guard.ts

isSSR,
errors = [],
errors: globalErrors = [],
selectNavigationResult = (results) => results[0].value

@@ -102,3 +102,3 @@ }) {

}
if (process.env.NODE_ENV === "development") {
if (process.env.NODE_ENV === "development" && !isSSR) {
console.warn(

@@ -161,3 +161,3 @@ "[vue-router]: Data Loader is experimental and subject to breaking changes in the future."

loaders.map((loader) => {
const { server, lazy } = loader._.options;
const { server, lazy, errors } = loader._.options;
if (!server && isSSR) {

@@ -173,8 +173,8 @@ return;

// return the non-lazy loader to commit changes after all loaders are done
ret.catch(
(reason) => (
// Check if the error is an expected error to discard it
loader._.options.errors?.some((Err) => reason instanceof Err) || (Array.isArray(errors) ? errors.some((Err) => reason instanceof Err) : errors(reason)) ? void 0 : Promise.reject(reason)
)
)
ret.catch((reason) => {
if (errors && (Array.isArray(errors) ? errors.some((Err) => reason instanceof Err) : errors(reason))) {
return;
}
return (Array.isArray(globalErrors) ? globalErrors.some((Err) => reason instanceof Err) : globalErrors(reason)) ? void 0 : Promise.reject(reason);
})
);

@@ -181,0 +181,0 @@ })

{
"name": "unplugin-vue-router",
"version": "0.10.7",
"version": "0.10.8",
"type": "module",

@@ -152,3 +152,3 @@ "description": "File based typed routing for Vue Router",

"dependencies": {
"@babel/types": "^7.25.2",
"@babel/types": "^7.25.4",
"@rollup/pluginutils": "^5.1.0",

@@ -165,3 +165,3 @@ "@vue-macros/common": "^1.12.2",

"scule": "^1.3.0",
"unplugin": "^1.12.1",
"unplugin": "^1.12.2",
"yaml": "^2.5.0"

@@ -178,6 +178,6 @@ },

"devDependencies": {
"@pinia/colada": "^0.8.1",
"@shikijs/vitepress-twoslash": "1.12.1",
"@tanstack/vue-query": "^5.51.21",
"@types/node": "^20.14.15",
"@pinia/colada": "^0.8.2",
"@shikijs/vitepress-twoslash": "1.14.1",
"@tanstack/vue-query": "^5.52.0",
"@types/node": "^20.16.1",
"@vitest/coverage-v8": "^2.0.5",

@@ -190,5 +190,5 @@ "@vitest/ui": "^2.0.5",

"enquirer": "^2.4.1",
"execa": "^9.3.0",
"firebase": "^10.12.5",
"happy-dom": "^14.12.3",
"execa": "^9.3.1",
"firebase": "^10.13.0",
"happy-dom": "^15.0.0",
"lint-staged": "^15.2.9",

@@ -201,3 +201,3 @@ "minimist": "^1.2.8",

"rimraf": "^6.0.1",
"rollup": "^4.20.0",
"rollup": "^4.21.0",
"semver": "^7.6.3",

@@ -209,14 +209,14 @@ "ts-expect": "^1.3.0",

"unplugin-vue-markdown": "^0.26.2",
"vite": "^5.4.0",
"vite-plugin-vue-devtools": "^7.3.8",
"vitepress": "1.3.2",
"vite": "^5.4.2",
"vite-plugin-vue-devtools": "^7.3.9",
"vitepress": "1.3.4",
"vitest": "^2.0.5",
"vue": "^3.4.37",
"vue": "^3.4.38",
"vue-router": "^4.4.3",
"vue-router-mock": "^1.1.0",
"vue-tsc": "^2.0.29",
"vuefire": "^3.1.24",
"webpack": "^5.93.0",
"vuefire": "^3.2.0",
"webpack": "^5.94.0",
"yorkie": "^2.0.0",
"unplugin-vue-router": "0.10.7"
"unplugin-vue-router": "0.10.8"
},

@@ -223,0 +223,0 @@ "scripts": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet