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

delir

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

delir

Generates a Route Manifest for you. It allows you to refer to a page by name instead of location

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Delir generates a Route Manifest for you. It allows you to refer to a page by name instead of location:

Install

  npm install -g delir

How to use

  delir ./your-output-file
  delir ./your-output-file --workspace ./your-next-app-folder

Example

// Assume you have a page at app/pages/products/[productId].tsx
export default function ProductsPage() { ...

// You can then use Routes...
import { Link } from "next"
import { Routes } from "../path-to-manifest-file"

// ...to refer to it by name...
<Link href={Routes.ProductsPage({ productId: 123 })} />

// ...instead of looking up the location!
<Link href={`/products/${123}`} />

The Route Manifest has some advantages:

  • improved expressiveness
  • simplifies moving pages to new locations

Query Parameters {#query-parameters}

Query parameters can be specified together with route parameters.

// instead of ...
<Link href={`/products/${pid}?offerCode=capybara`} />

// ... you can do:
<Link href={Routes.Product({ pid, offerCode: "capybara" })} />

Simple cli which is an extract of the routes manifest feature from blitz. Thanks for the super framework ❤️

Route matching

// Assume you have a page at app/pages/products/[productId].tsx
export default function ProductsPage() { ... }

import { useRouter } from 'next/router';
// You can then use Routes...
import { Routes } from "../path-to-manifest-file";

// in your server api
Routes.ProductsPage.isActive(someobject.path)

// generically without next router
Routes.ProductsPage.isActive(window.location.pathname)

// with asPath from useRouter
const { asPath } = useRouter();
Routes.ProductsPage.isActive(asPath);

Keywords

FAQs

Package last updated on 15 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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