🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

soonloh

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

soonloh

A code generator companion for routers featuring build tool/framework-agnostic type-safe file-based routes.

latest
Source
npmnpm
Version
0.5.2
Version published
Maintainers
1
Created
Source

soonloh(순로; 順路)

A code generator companion for routers featuring build tool/framework-agnostic type-safe file-based routes.

Quick Start

  • Install an appropriate build tool integration.

    Vite
    import soonlohVite from 'soonloh/vite';
    
    export default defineConfig({
        plugins: [
            ...,
            soonlohVite(),
        ],
        ...,
    })
    
  • Add soonloh.config.ts.

    import * as soonloh from 'soonloh';
    import { snzrwm } from 'soonloh/builtin-parsers';
    import { genLink } from 'soonloh/builtin-generators';
    
    export default soonloh.config({
      routerRoot: 'src/app/',
      parser: snzrwm.parser({}),
      generators: [genLink({})],
    });
    
  • :tada: It generates a code based on the file routes.

Built-in Parsers

snzrwm

The Soonzorowoom(순조로움) parser. You must end the filename with page, route or ALLCAPS so the parser can recognize. The segments not only split by / but also by ..

Examples

  • api/post/like.$id.POST.tsx meaning POST /api/post/like/:id
  • (website)/post.[$id]/page.tsx meaning GET /post or GET /post/:id
  • (seo)/{sitemap.xml}/route.tsx meaning GET /sitemap.xml
  • wiki/$+entry.page.tsx meaning GET /wiki/A, GET /wiki/A/B, ... and so on

Reference

SyntaxFeature
_ignoreIgnore the path recursively
$paramSingle value param
$+paramsMulti value params separated by /
[brackets]By combining with params, make it optional
(parenthesis)Make a grouping folder without affecting routes
{curly braces}Escape the syntaxes above

Comparison

[!NOTE] soonloh is not an alternative to the existing router libraries. It is an companion codegen making them Build Their Own Type-safe File Routes.

unrouting

  • Both make url paths from file paths
  • soonloh: provide build tools integration so people can build their own codegen
  • unrouting: provide integration for radix3, vue router, etc

generouted

TBD

TanStack Router

TBD

React Router > FS Routes

TBD

Next.js (App Router)

TBD

Next.js (Pages Router)

TBD

FAQs

Package last updated on 25 Dec 2025

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