|  | 
| 1 |  | -import { existsSync } from 'node:fs' | 
| 2 |  | -import type { Resolver } from '@nuxt/kit' | 
| 3 |  | -import type { Nuxt } from 'nuxt/schema' | 
|  | 1 | +// import { existsSync } from 'node:fs' | 
|  | 2 | +// import type { Resolver } from '@nuxt/kit' | 
|  | 3 | +// import type { Nuxt } from 'nuxt/schema' | 
| 4 | 4 | 
 | 
| 5 |  | -const DEVTOOLS_UI_ROUTE = '/__codemirror_nuxt_devtools' | 
| 6 |  | -const DEVTOOLS_UI_LOCAL_PORT = 3300 | 
|  | 5 | +// const DEVTOOLS_UI_ROUTE = '/__codemirror_nuxt_devtools' | 
|  | 6 | +// const DEVTOOLS_UI_LOCAL_PORT = 3300 | 
| 7 | 7 | 
 | 
| 8 |  | -export function setupDevToolsUI(nuxt: Nuxt, resolver: Resolver) { | 
| 9 |  | -  const clientPath = resolver.resolve('./client') | 
| 10 |  | -  const isProductionBuild = existsSync(clientPath) | 
|  | 8 | +// export function setupDevToolsUI(nuxt: Nuxt, resolver: Resolver) { | 
|  | 9 | +// const clientPath = resolver.resolve('./client') | 
|  | 10 | +// const isProductionBuild = existsSync(clientPath) | 
| 11 | 11 | 
 | 
| 12 |  | -  // Serve production-built client (used when package is published) | 
| 13 |  | -  if (isProductionBuild) { | 
| 14 |  | -    nuxt.hook('vite:serverCreated', async (server) => { | 
| 15 |  | -      const sirv = await import('sirv').then(r => r.default || r) | 
| 16 |  | -      server.middlewares.use( | 
| 17 |  | -        DEVTOOLS_UI_ROUTE, | 
| 18 |  | -        sirv(clientPath, { dev: true, single: true }), | 
| 19 |  | -      ) | 
| 20 |  | -    }) | 
| 21 |  | -  } | 
| 22 |  | -  // In local development, start a separate Nuxt Server and proxy to serve the client | 
| 23 |  | -  else { | 
| 24 |  | -    nuxt.hook('vite:extendConfig', (config) => { | 
| 25 |  | -      config.server = config.server || {} | 
| 26 |  | -      config.server.proxy = config.server.proxy || {} | 
| 27 |  | -      config.server.proxy[DEVTOOLS_UI_ROUTE] = { | 
| 28 |  | -        target: `http://localhost:${DEVTOOLS_UI_LOCAL_PORT}${DEVTOOLS_UI_ROUTE}`, | 
| 29 |  | -        changeOrigin: true, | 
| 30 |  | -        followRedirects: true, | 
| 31 |  | -        rewrite: path => path.replace(DEVTOOLS_UI_ROUTE, ''), | 
| 32 |  | -      } | 
| 33 |  | -    }) | 
| 34 |  | -  } | 
|  | 12 | +// Serve production-built client (used when package is published) | 
|  | 13 | +// if (isProductionBuild) { | 
|  | 14 | +//   nuxt.hook('vite:serverCreated', async (server) => { | 
|  | 15 | +//     const sirv = await import('sirv').then(r => r.default || r) | 
|  | 16 | +//     server.middlewares.use( | 
|  | 17 | +//       DEVTOOLS_UI_ROUTE, | 
|  | 18 | +//       sirv(clientPath, { dev: true, single: true }), | 
|  | 19 | +//     ) | 
|  | 20 | +//   }) | 
|  | 21 | +// } | 
|  | 22 | +// In local development, start a separate Nuxt Server and proxy to serve the client | 
|  | 23 | +// else { | 
|  | 24 | +//   nuxt.hook('vite:extendConfig', (config) => { | 
|  | 25 | +//     config.server = config.server || {} | 
|  | 26 | +//     config.server.proxy = config.server.proxy || {} | 
|  | 27 | +//     config.server.proxy[DEVTOOLS_UI_ROUTE] = { | 
|  | 28 | +//       target: `http://localhost:${DEVTOOLS_UI_LOCAL_PORT}${DEVTOOLS_UI_ROUTE}`, | 
|  | 29 | +//       changeOrigin: true, | 
|  | 30 | +//       followRedirects: true, | 
|  | 31 | +//       rewrite: path => path.replace(DEVTOOLS_UI_ROUTE, ''), | 
|  | 32 | +//     } | 
|  | 33 | +//   }) | 
|  | 34 | +// } | 
| 35 | 35 | 
 | 
| 36 |  | -  nuxt.hook('devtools:customTabs', (tabs) => { | 
| 37 |  | -    tabs.push({ | 
| 38 |  | -      // unique identifier | 
| 39 |  | -      name: 'codemirror-nuxt-devtools', | 
| 40 |  | -      // title to display in the tab | 
| 41 |  | -      title: 'CodeMirror DevTools', | 
| 42 |  | -      // any icon from Iconify, or a URL to an image | 
| 43 |  | -      icon: 'i-carbon-code', | 
| 44 |  | -      // iframe view | 
| 45 |  | -      view: { | 
| 46 |  | -        type: 'iframe', | 
| 47 |  | -        src: DEVTOOLS_UI_ROUTE, | 
| 48 |  | -      }, | 
| 49 |  | -    }) | 
| 50 |  | -  }) | 
| 51 |  | -} | 
|  | 36 | +// nuxt.hook('devtools:customTabs', (tabs) => { | 
|  | 37 | +//   tabs.push({ | 
|  | 38 | +//     // unique identifier | 
|  | 39 | +//     name: 'codemirror-nuxt-devtools', | 
|  | 40 | +//     // title to display in the tab | 
|  | 41 | +//     title: 'CodeMirror DevTools', | 
|  | 42 | +//     // any icon from Iconify, or a URL to an image | 
|  | 43 | +//     icon: 'i-carbon-code', | 
|  | 44 | +//     // iframe view | 
|  | 45 | +//     view: { | 
|  | 46 | +//       type: 'iframe', | 
|  | 47 | +//       src: DEVTOOLS_UI_ROUTE, | 
|  | 48 | +//     }, | 
|  | 49 | +//   }) | 
|  | 50 | +// }) | 
|  | 51 | +// } | 
0 commit comments