File tree Expand file tree Collapse file tree 5 files changed +55
-4
lines changed Expand file tree Collapse file tree 5 files changed +55
-4
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' @qwik.dev/devtools ' : patch
3+ ---
4+
5+ fix: update type definitions and improve theme script import in devtools
Original file line number Diff line number Diff line change 1313 "./ui" : {
1414 "import" : " ./dist/ui/index.qwik.mjs" ,
1515 "require" : " ./dist/ui/index.qwik.cjs" ,
16- "types" : " ./dist/ui/lib-types/index.d.ts"
16+ "types" : " ./dist/ui/lib-types/ui/src/ index.d.ts"
1717 }
1818 },
1919 "files" : [
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import VueInspector from 'vite-plugin-inspect'
55import useCollectHooksSource from './utils/useCollectHooks'
66import { parseQwikCode } from './parse/parse' ;
77import { startPreloading } from './npm/index' ;
8+ import updateConf from './utils/updateConf' ;
89
910
1011export function qwikDevtools ( ) : Plugin [ ] {
@@ -41,7 +42,7 @@ export function qwikDevtools(): Plugin[] {
4142 } ,
4243 configResolved ( viteConfig ) {
4344 _config = viteConfig ;
44-
45+ updateConf ( _config ) ;
4546 // Start preloading as early as possible, right after config is resolved
4647 if ( ! preloadStarted ) {
4748 preloadStarted = true ;
Original file line number Diff line number Diff line change 1+ import { ResolvedConfig } from "vite" ;
2+
3+ function updateConf ( conf : ResolvedConfig ) {
4+ const pkg = '@qwik.dev/devtools' ;
5+
6+ // Ensure ssr exists
7+ // Some environments may have optional ssr in typed config
8+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
9+ // @ts -ignore
10+ conf . ssr = conf . ssr ?? ( { } as typeof conf . ssr ) ;
11+
12+ const current = conf . ssr ?. noExternal as unknown ;
13+
14+ // If noExternal is not set (undefined/false), initialize as array
15+ if ( ! current ) {
16+ conf . ssr . noExternal = [ pkg ] ;
17+ return conf ;
18+ }
19+
20+ // If already true (do not externalize anything), nothing to do
21+ if ( current === true ) {
22+ return conf ;
23+ }
24+
25+ // If it's an array of entries, append if missing
26+ if ( Array . isArray ( current ) ) {
27+ if ( ! current . includes ( pkg ) ) {
28+ current . push ( pkg ) ;
29+ }
30+ return conf ;
31+ }
32+
33+ // If it's a string, convert to array and append
34+ if ( typeof current === 'string' ) {
35+ conf . ssr . noExternal = current === pkg ? [ pkg ] : [ current , pkg ] ;
36+ return conf ;
37+ }
38+
39+ // For other shapes (e.g., RegExp), preserve and extend via array wrapper
40+ // This keeps existing behavior while ensuring our package is included
41+ conf . ssr . noExternal = [ current as never , pkg ] as unknown as typeof conf . ssr . noExternal ;
42+ return conf ;
43+ }
44+
45+ export default updateConf ;
Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ import { DevtoolsPanel } from './components/DevtoolsPanel/DevtoolsPanel';
3939import { Packages } from './features/Packages/Packages' ;
4040import { Inspect } from './features/inspect/Inspect' ;
4141import { ThemeToggle } from './components/ThemeToggle/ThemeToggle' ;
42- import { ThemeScript } from './components/ThemeToggle/theme-script' ;
42+ import { ThemeScript as QwikThemeScript } from './components/ThemeToggle/theme-script' ;
4343import { CodeBreack } from './features/CodeBreack/CodeBreack' ;
4444function getClientRpcFunctions ( ) {
4545 return {
@@ -124,7 +124,7 @@ export const QwikDevtools = component$(() => {
124124
125125 return (
126126 < >
127- < ThemeScript />
127+ < QwikThemeScript />
128128 < DevtoolsContainer >
129129 < DevtoolsButton state = { state } />
130130
You can’t perform that action at this time.
0 commit comments