MCPcopy Index your code
hub / github.com/antfu/vite-plugin-editor-nav

github.com/antfu/vite-plugin-editor-nav @v0.0.4

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.0.4 ↗ · + Follow
14 symbols 34 edges 9 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

vite-plugin-editor-nav

Auto-navigation to the page your are working in your editor for Vite

Install

ℹ️ Vite 2 is required

npm i vite-plugin-editor-nav -D # yarn add vite-plugin-editor-nav -D

This is a tool for DX and only works in dev mode.

Configration

Editors

VS Code

Install VSCode as FS extension and add this to your .vscode/settings.json

// .vscode/settings.json
{
  "as-fs.enabled": true
}

See more details on the readme page.

Vite

Vue Router

Recommend to use vite-plugin-voie for file-based routing.

// vite.config.js
import Vue from '@vitejs/plugin-vue'
import EditorNav from 'vite-plugin-editor-nav'

export default {
  plugins: [
    Vue(),
    EditorNav({
      preset: 'vue-router',
      routeBase: 'src/pages', // related to your Vite root,
    })
  ]
}

Then add this to your main.js

// main.js
import { createApp } from 'vue'
import { createRouter } from 'vue-router'

/*...*/

const router = createRouter({ /*...*/ })
const app = createApp( /*...*/ )

app.use(router)

// pass the vue-router instance to it
import('vite-plugin-editor-nav/client').then(i => i.default(router))

Vitepress

Vitepress uses a custom router and has @vite/plugin-vue already embedded. All you need is

// vite.config.js
import EditorNav from 'vite-plugin-editor-nav'

export default {
  plugins: [
    EditorNav({
      preset: 'vitepress',
    })
  ]
}

Then add this to .vitepress/theme/config.js

// .vitepress/theme/config.js
import DefaultTheme from 'vitepress/dist/client/theme-default'

export default {
  ...DefaultTheme
  enhanceApp({ app, router }) {
    // this
    import('vite-plugin-editor-nav/client').then(i => i.default(router))
  },
}

React

Not supported yet, PR welcome!

License

MIT License © 2021 Anthony Fu

Extension points exported contracts — how you extend this code

Options (Interface)
(no doc)
src/types.ts
PresetUserOptions (Interface)
(no doc)
src/types.ts
UserOptions (Interface)
(no doc)
src/types.ts

Core symbols most depended-on inside this repo

extensionsToGlob
called by 2
src/utils.ts
resolveOptions
called by 1
src/index.ts
getFileRouteMap
called by 1
src/types.ts
VitePluginEditorNav
called by 0
src/index.ts
configResolved
called by 0
src/index.ts
handleHotUpdate
called by 0
src/index.ts
resolveId
called by 0
src/index.ts
load
called by 0
src/index.ts

Shape

Function 10
Interface 3
Method 1

Languages

TypeScript100%

Modules by API surface

src/index.ts6 symbols
src/types.ts4 symbols
src/utils.ts2 symbols
src/presets/vue-router.ts1 symbols
src/presets/vitepress.ts1 symbols

For agents

$ claude mcp add vite-plugin-editor-nav \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact