Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# vite-plus preview build registry bridge (auto-added by vp)
registry=https://registry-bridge.viteplus.dev/
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ Docs are local at `node_modules/vite-plus/docs` or online at https://viteplus.de
- [ ] Run `vp install` after pulling remote changes and before getting started.
- [ ] Run `vp check` and `vp test` to format, lint, type check and test changes.
- [ ] Check if there are `vite.config.ts` tasks or `package.json` scripts necessary for validation, run via `vp run <script>`.
- [ ] If setup, runtime, or package-manager behavior looks wrong, run `vp env doctor` and include its output when asking for help.

<!--VITE PLUS END-->
8 changes: 4 additions & 4 deletions examples/svelte-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"private": true,
"type": "module",
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"dev": "vp dev",
"build": "vp build",
"preview": "vp preview",
"prepare": "svelte-kit sync || echo ''",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
Expand All @@ -19,6 +19,6 @@
"svelte-check": "^4.4.6",
"typescript": "^6.0.2",
"unplugin-turbo-console": "workspace:*",
"vite": "^8.0.7"
"vite": "catalog:"
}
}
2 changes: 1 addition & 1 deletion examples/svelte-kit/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { sveltekit } from '@sveltejs/kit/vite'
import { defineConfig } from 'vite'
import { defineConfig } from 'vite-plus'
import TurboConsole from 'unplugin-turbo-console/vite'

export default defineConfig({
Expand Down
3 changes: 3 additions & 0 deletions examples/vite-vue3/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ export default defineConfig({
'@': fileURLToPath(new URL('./src', import.meta.url)),
},
},
server: {
host: true,
},
})
18 changes: 5 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "unplugin-turbo-console",
"version": "2.3.2",
"version": "2.3.3",
"description": "Improve the Developer Experience of console",
"keywords": [
"rollup",
Expand Down Expand Up @@ -178,14 +178,15 @@
"@nuxt/schema": "^4.4.4",
"@oxc-project/types": "^0.129.0",
"@types/node": "^25.6.0",
"@vitest/ui": "^4.1.5",
"@vitest/ui": "catalog:",
"bumpp": "^11.0.1",
"rollup": "^4.60.2",
"tsx": "^4.21.0",
"typescript": "^6.0.3",
"vite": "^8.0.10",
"vite": "catalog:",
"vite-plugin-inspect": "catalog:",
"vite-plus": "catalog:",
"vitest": "catalog:",
"vue": "^3.5.33",
"webpack": "^5.106.2"
},
Expand Down Expand Up @@ -232,14 +233,5 @@
"engines": {
"node": ">=20"
},
"packageManager": "pnpm@10.33.3",
"pnpm": {
"onlyBuiltDependencies": [
"@sveltejs/kit",
"esbuild",
"sharp",
"vue-demi",
"svelte-preprocess"
]
}
"packageManager": "pnpm@10.33.3"
}
21,610 changes: 10,356 additions & 11,254 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

12 changes: 9 additions & 3 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ packages:
- client
catalog:
nuxt: ^4.4.4
vite: npm:@voidzero-dev/vite-plus-core@latest
vite: npm:@voidzero-dev/vite-plus-core@0.0.0-commit.9855245a469b178066c25a5d45c971c130565d89
vite-plugin-inspect: ^11.3.3
vite-plus: ^0.1.20
vitest: npm:@voidzero-dev/vite-plus-test@latest
vite-plus: 0.0.0-commit.9855245a469b178066c25a5d45c971c130565d89
vitest: 4.1.10
'@vitest/ui': 4.1.10

ignoreWorkspaceRootCheck: true
overrides:
vitest: 'catalog:'
vite: 'catalog:'
peerDependencyRules:
allowAny:
- vite
Expand All @@ -22,3 +24,7 @@ peerDependencyRules:
shamefullyHoist: true
onlyBuiltDependencies:
- esbuild
- '@sveltejs/kit'
- sharp
- vue-demi
- svelte-preprocess
11 changes: 7 additions & 4 deletions src/core/utils/virtualModules.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
export function initVirtualModulesGenerator(host: string, port: number, isProd: boolean) {
export function initVirtualModulesGenerator(port: number, isProd: boolean) {
if (isProd) return ''

return /* js */ `
;(() => {
if (globalThis.window) {
const socket = new WebSocket('ws://${host}:${port}/ws/passLogs')
const runtimeHost = globalThis.window.location.hostname
const socket = new WebSocket('ws://' + runtimeHost + ':${port}/ws/passLogs')
globalThis.window.UNPLUGIN_TURBO_CONSOLE_CLIENT_SOCKET = socket
socket.addEventListener('message', (event) => {
try {
Expand All @@ -21,19 +22,21 @@ export function initVirtualModulesGenerator(host: string, port: number, isProd:
`
}

export function viteDevToolsVirtualModuleGenerator(host: string, port: number, isProd: boolean) {
export function viteDevToolsVirtualModuleGenerator(port: number, isProd: boolean) {
if (isProd) return ''

return /* js */ `
import { addCustomTab } from '@vue/devtools-api'

const runtimeHost = globalThis.window.location.hostname

addCustomTab({
name: 'unplugin-turbo-console-inspector',
title: 'Console Inspector',
icon: 'baseline-terminal',
view: {
type: 'iframe',
src: 'http://${host}:${port}/inspector',
src: 'http://' + runtimeHost + ':${port}/inspector',
},
category: 'advanced',
})
Expand Down
7 changes: 1 addition & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,11 @@ export const unpluginFactory: UnpluginFactory<Options | undefined> = (rawOptions
id = id.slice(1)

if (id === VirtualModules.Init) {
return initVirtualModulesGenerator(
options.server.host!,
options.server.port!,
env.NODE_ENV === 'production',
)
return initVirtualModulesGenerator(options.server.port!, env.NODE_ENV === 'production')
} else if (id === VirtualModules.ThemeDetect) {
return themeDetectVirtualModule(env.NODE_ENV === 'production')
} else if (id === VirtualModules.VueDevTools) {
return viteDevToolsVirtualModuleGenerator(
options.server.host!,
options.server.port!,
env.NODE_ENV === 'production',
)
Expand Down
Loading