Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

svelte-guard-history-router

Package Overview
Dependencies
Maintainers
1
Versions
276
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svelte-guard-history-router - npm Package Compare versions

Comparing version 1.3.2 to 2.0.0

src/base-router.mjs

10

package.json
{
"name": "svelte-guard-history-router",
"version": "1.3.2",
"version": "2.0.0",
"publishConfig": {

@@ -35,8 +35,8 @@ "access": "public"

"devDependencies": {
"@rollup/plugin-node-resolve": "^8.0.1",
"@rollup/plugin-node-resolve": "^8.1.0",
"documentation": "^13.0.1",
"rollup": "^2.15.0",
"rollup": "^2.18.0",
"rollup-plugin-dev": "^1.1.2",
"rollup-plugin-svelte": "^5.2.2",
"semantic-release": "^17.0.8",
"rollup-plugin-svelte": "^5.2.3",
"semantic-release": "^17.1.0",
"svelte": "^3.23.2",

@@ -43,0 +43,0 @@ "testcafe": "^1.8.6"

@@ -18,5 +18,8 @@ [![Svelte v3](https://img.shields.io/badge/svelte-v3-orange.svg)](https://svelte.dev)

- Named params
- Guards to act when entering / leaving a route
- Standart `<a href="/home">Home</a>` elements
- Named params
- Guards to act when entering / leaving a route
- Automatic route ranking
- Route stores
- Object / parameter mapping
- Standart `<a href="/home">Home</a>` elements

@@ -26,3 +29,3 @@ # usage

```js
import { Router, route, Guard } from 'svelte-guard-history-router';
import { BaseRouter, route, Guard } from 'svelte-guard-history-router';
import Categories from "./Categories.svelte";

@@ -32,3 +35,2 @@ import Category from "./Category.svelte";

import Articles from "./Articles.svelte";
import About from "./About.svelte";
import Login from "./Login.svelte";

@@ -41,3 +43,3 @@

if(!session) {
transition.redirect('/login');
return transition.redirect('/login');
}

@@ -47,10 +49,7 @@ }

export const router = new Router(
export const router = new BaseRouter(
[
route("*", Home),
route("/about", About),
route("/login", Login),
route("/article", sessionGuard, Articles),
route("/article/:article", sessionGuard, Article),
route("/category", sessionGuard, Categories),
route("/category/:category", sessionGuard, Category)

@@ -65,2 +64,3 @@ ],

import {
Router,
Outlet,

@@ -70,16 +70,21 @@ link,

} from "svelte-guard-history-router";
import About from "./About.svelte";
import Home from "./Home.svelte";
import Articles from "./Articles.svelte";
import { router } from "./main.mjs";
</script>
<Router>
<nav>
<a href="/" use:link={router} use:active={router}>Router Example</a>
<Route path="/" component={Home}>Router Example</Route>
<ul class="left">
<li>
<a href="/about" use:link={router} use:active={router}>About</a>
<Route path="/about" component={About}>About</Route>
</li>
<li>
<a href="/article" use:link={router} use:active={router}>Articles</a>
<Route path="/article" component={Articles}>Articles</Route>
</li>
<li>
<a href="/category" use:link={router} use:active={router}>Categories</a>
<Route path="/category" component={Categories}>Categories</Route>
</li>

@@ -89,4 +94,5 @@ </ul>

<main>
<Outlet {router}/>
<Outlet/>
</main>
</Router>
```

@@ -93,0 +99,0 @@

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc