Socket
Book a DemoInstallSign in
Socket

choi2021

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

choi2021

πŸ—ΊοΈ Visualize Next.js routes as an interactive diagram. Automatically parse route structures and navigation relationships in your Next.js project.

1.0.0
latest
Source
npmnpm
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
Β 
Created
Source

πŸ—ΊοΈ Next.js Route Map

Next.js ν”„λ‘œμ νŠΈμ˜ 라우트 ꡬ쑰λ₯Ό μΈν„°λž™ν‹°λΈŒν•œ μ‹œκ°μ  λ‹€μ΄μ–΄κ·Έλž¨μœΌλ‘œ λ³€ν™˜ν•˜λŠ” CLI 도ꡬ

npm version License: MIT

✨ νŠΉμ§•

  • πŸš€ κ°„λ‹¨ν•œ μ‚¬μš©λ²•: ν•œ 쀄 λͺ…λ Ήμ–΄λ‘œ 라우트 λ§΅ 생성
  • 🎨 μΈν„°λž™ν‹°λΈŒ μ‹œκ°ν™”: Cytoscape.js 기반의 동적 κ·Έλž˜ν”„
  • πŸ“± λͺ¨λ“  라우트 νƒ€μž… 지원: νŽ˜μ΄μ§€, API, 동적 라우트 λͺ¨λ‘ 감지
  • πŸ”— λ„€λΉ„κ²Œμ΄μ…˜ 좔적: router.push(), Link μ»΄ν¬λ„ŒνŠΈ μ—°κ²° 관계 뢄석
  • πŸ“„ 단일 HTML 파일: μ„œλ²„ 없이 λΈŒλΌμš°μ €μ—μ„œ λ°”λ‘œ μ‹€ν–‰
  • 🎯 제둜 μ„€μ •: 별도 μ„€μ • 없이 μ¦‰μ‹œ μ‚¬μš© κ°€λŠ₯

πŸš€ λΉ λ₯Έ μ‹œμž‘

npx둜 μ¦‰μ‹œ μ‚¬μš© (ꢌμž₯)

npx next-route-map map --path ./your-nextjs-project

κΈ€λ‘œλ²Œ μ„€μΉ˜

npm install -g next-route-map
next-route-map map --path ./your-nextjs-project

πŸ“– μ‚¬μš©λ²•

κΈ°λ³Έ μ‚¬μš©λ²•

# ν˜„μž¬ λ””λ ‰ν† λ¦¬μ˜ Next.js ν”„λ‘œμ νŠΈ 뢄석
npx next-route-map map

# νŠΉμ • 경둜의 ν”„λ‘œμ νŠΈ 뢄석
npx next-route-map map --path ./my-next-app

# 도움말 보기
npx next-route-map --help

λͺ…λ Ήμ–΄ μ˜΅μ…˜

next-route-map map [options]

Options:
  -p, --path <path>     Next.js ν”„λ‘œμ νŠΈ 경둜 (κΈ°λ³Έκ°’: ".")
  -h, --help           도움말 ν‘œμ‹œ

🎨 μƒμ„±λ˜λŠ” μ‹œκ°ν™”

도ꡬλ₯Ό μ‹€ν–‰ν•˜λ©΄ route-visualizer.html 파일이 μƒμ„±λ˜λ©°, λ‹€μŒκ³Ό 같은 κΈ°λŠ₯을 μ œκ³΅ν•©λ‹ˆλ‹€:

πŸ“Š λ…Έλ“œ νƒ€μž…λ³„ 색상 ꡬ뢄

  • 🟒 일반 νŽ˜μ΄μ§€: μ΄ˆλ‘μƒ‰ (예: /about, /contact)
  • πŸ”΅ 동적 라우트: νŒŒλž€μƒ‰ (예: /user/[id], /blog/[...slug])
  • 🟠 API 라우트: 주황색 (예: /api/users, /api/auth)

πŸ”— μ—°κ²° 관계 ν‘œμ‹œ

  • νŒŒλž€μƒ‰ ν™”μ‚΄ν‘œ: router.push() λ„€λΉ„κ²Œμ΄μ…˜
  • 빨간색 ν™”μ‚΄ν‘œ: router.replace() λ„€λΉ„κ²Œμ΄μ…˜
  • μ΄ˆλ‘μƒ‰ ν™”μ‚΄ν‘œ: <Link> μ»΄ν¬λ„ŒνŠΈ μ—°κ²°

πŸ–±οΈ μΈν„°λž™ν‹°λΈŒ κΈ°λŠ₯

  • 쀌/팬: 마우슀 휠과 λ“œλž˜κ·Έλ‘œ ν™•λŒ€/μΆ•μ†Œ 및 이동
  • μ—£μ§€ 클릭: 연결선을 ν΄λ¦­ν•˜λ©΄ μ†ŒμŠ€ μ½”λ“œ 정보 ν‘œμ‹œ
  • μžλ™ λ ˆμ΄μ•„μ›ƒ: 계측적 ꡬ쑰둜 μžλ™ μ •λ ¬

πŸ“ μ§€μ›ν•˜λŠ” ν”„λ‘œμ νŠΈ ꡬ쑰

Pages Router (Next.js 12 μ΄ν•˜)

pages/
β”œβ”€β”€ index.js          β†’ /
β”œβ”€β”€ about.js          β†’ /about
β”œβ”€β”€ user/
β”‚   β”œβ”€β”€ index.js      β†’ /user
β”‚   └── [id].js       β†’ /user/[id]
└── api/
    └── users.js      β†’ /api/users

App Router (Next.js 13+)

app/
β”œβ”€β”€ page.js           β†’ /
β”œβ”€β”€ about/
β”‚   └── page.js       β†’ /about
β”œβ”€β”€ user/
β”‚   β”œβ”€β”€ page.js       β†’ /user
β”‚   └── [id]/
β”‚       └── page.js   β†’ /user/[id]
└── api/
    └── users/
        └── route.js  β†’ /api/users

πŸ” κ°μ§€λ˜λŠ” λ„€λΉ„κ²Œμ΄μ…˜ νŒ¨ν„΄

λ„κ΅¬λŠ” λ‹€μŒκ³Ό 같은 μ½”λ“œ νŒ¨ν„΄μ„ μžλ™μœΌλ‘œ κ°μ§€ν•©λ‹ˆλ‹€:

// router.push() 호좜
import { useRouter } from "next/router";
const router = useRouter();
router.push("/dashboard");

// Link μ»΄ν¬λ„ŒνŠΈ
import Link from "next/link";
<Link href="/profile">ν”„λ‘œν•„</Link>;

// router.replace() 호좜
router.replace("/login");

βš™οΈ μš”κ΅¬μ‚¬ν•­

  • Node.js: 14.0.0 이상
  • Next.js ν”„λ‘œμ νŠΈ: Pages Router λ˜λŠ” App Router
  • λΈŒλΌμš°μ €: λͺ¨λ˜ λΈŒλΌμš°μ € (Chrome, Firefox, Safari, Edge)

πŸ“ 예제 좜λ ₯

도ꡬ μ‹€ν–‰ ν›„ μƒμ„±λ˜λŠ” HTML νŒŒμΌμ„ λΈŒλΌμš°μ €μ—μ„œ μ—΄λ©΄:

πŸ—ΊοΈ  Next.js 라우트 λ§΅ 생성 쀑...
πŸ“ ν”„λ‘œμ νŠΈ 경둜: ./my-next-app
🎨 ν…Œλ§ˆ: light
πŸ“Š 좜λ ₯ ν˜•μ‹: web
μ‹œκ°ν™” 파일 생성: ./my-next-app/route-visualizer.html

πŸ› οΈ 개발자 정보

ν”„λ‘œμ νŠΈ ꡬ쑰

next-route-map/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ cli/           # CLI λͺ…λ Ήμ–΄ 처리
β”‚   β”œβ”€β”€ parser/        # 라우트 νŒŒμ‹± μ—”μ§„
β”‚   └── types/         # TypeScript νƒ€μž… μ •μ˜
β”œβ”€β”€ dist/              # λΉŒλ“œλœ 파일
└── example-next/      # ν…ŒμŠ€νŠΈμš© Next.js ν”„λ‘œμ νŠΈ

기술 μŠ€νƒ

  • TypeScript: νƒ€μž… μ•ˆμ „μ„±
  • Commander.js: CLI ν”„λ ˆμž„μ›Œν¬
  • Glob: 파일 νŒ¨ν„΄ λ§€μΉ­
  • Cytoscape.js: κ·Έλž˜ν”„ μ‹œκ°ν™”

🀝 κΈ°μ—¬ν•˜κΈ°

  • 이 μ €μž₯μ†Œλ₯Ό ν¬ν¬ν•©λ‹ˆλ‹€
  • κΈ°λŠ₯ 브랜치λ₯Ό μƒμ„±ν•©λ‹ˆλ‹€ (git checkout -b feature/amazing-feature)
  • 변경사항을 μ»€λ°‹ν•©λ‹ˆλ‹€ (git commit -m 'Add amazing feature')
  • λΈŒλžœμΉ˜μ— ν‘Έμ‹œν•©λ‹ˆλ‹€ (git push origin feature/amazing-feature)
  • Pull Requestλ₯Ό μƒμ„±ν•©λ‹ˆλ‹€

πŸ“„ λΌμ΄μ„ μŠ€

이 ν”„λ‘œμ νŠΈλŠ” MIT λΌμ΄μ„ μŠ€ ν•˜μ— λ°°ν¬λ©λ‹ˆλ‹€. μžμ„Έν•œ λ‚΄μš©μ€ LICENSE νŒŒμΌμ„ μ°Έμ‘°ν•˜μ„Έμš”.

πŸ› 버그 리포트 & κΈ°λŠ₯ μš”μ²­

λ¬Έμ œκ°€ λ°œμƒν•˜κ±°λ‚˜ μƒˆλ‘œμš΄ κΈ°λŠ₯을 μ œμ•ˆν•˜κ³  μ‹ΆμœΌμ‹œλ©΄ GitHub Issues에 등둝해 μ£Όμ„Έμš”.

πŸ“š κ΄€λ ¨ ν”„λ‘œμ νŠΈ

  • Next.js - React ν”„λ ˆμž„μ›Œν¬
  • Cytoscape.js - κ·Έλž˜ν”„ μ‹œκ°ν™” 라이브러리
  • webpack-bundle-analyzer - λ²ˆλ“€ 뢄석 도ꡬ (μ˜κ°μ„ 받은 ν”„λ‘œμ νŠΈ)

⭐ 이 ν”„λ‘œμ νŠΈκ°€ μœ μš©ν•˜λ‹€λ©΄ GitHubμ—μ„œ μŠ€νƒ€λ₯Ό λˆŒλŸ¬μ£Όμ„Έμš”!

Keywords

nextjs

FAQs

Package last updated on 25 May 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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚑️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.