Skip to content

Commit 194a409

Browse files
authored
Merge branch 'QwikDev:main' into main
2 parents 2cc2ab4 + 44db08e commit 194a409

File tree

14 files changed

+106
-169
lines changed

14 files changed

+106
-169
lines changed

.changeset/seven-numbers-move.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'@qwik.dev/devtools': patch
3+
'@devtools/kit': patch
4+
'@devtools/plugin': patch
5+
'@devtools/ui': patch
6+
---
7+
8+
FEAT: new devtool version

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ export default defineConfig({
3434
tsconfigPaths(),
3535
qwikDevtools(), // 👈 Add the plugin here
3636
],
37+
ssr: {
38+
noExternal: ['@qwik.dev/devtools']; // 👈 Add the plugin here
39+
}
3740
});
3841
```
3942

@@ -63,4 +66,3 @@ Join our vibrant community:
6366
- [⭐️ Qwik GitHub](https://github.com/QwikDev/qwik)
6467
- [🐦 @QwikDev](https://twitter.com/QwikDev)
6568
- [⚡️ Vite](https://vitejs.dev/)
66-

packages/devtools/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ export default defineConfig({
3434
tsconfigPaths(),
3535
qwikDevtools(), // 👈 Add the plugin here
3636
],
37+
ssr: {
38+
noExternal: ['@qwik.dev/devtools']; // 👈 Add the plugin here
39+
}
3740
});
3841
```
3942

@@ -63,4 +66,3 @@ Join our vibrant community:
6366
- [⭐️ Qwik GitHub](https://github.com/QwikDev/qwik)
6467
- [🐦 @QwikDev](https://twitter.com/QwikDev)
6568
- [⚡️ Vite](https://vitejs.dev/)
66-

packages/devtools/package.json

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"name": "@qwik.dev/devtools",
3-
"version": "0.1.1",
3+
"version": "0.1.2",
44
"license": "MIT",
55
"main": "./dist/plugin/index.mjs",
66
"description": "Qwik devtools package",
77
"qwik": "./dist/ui/index.qwik.mjs",
88
"exports": {
99
".": {
10-
"import": "./dist/plugin/index.mjs",
10+
"import": "./dist/plugin/index.js",
1111
"types": "./dist/plugin/index.d.ts"
1212
},
1313
"./ui": {
@@ -21,24 +21,26 @@
2121
"README.md"
2222
],
2323
"peerDependencies": {
24-
"vite": "7.1.3",
25-
"@qwik.dev/core": "2.0.0-beta.8",
26-
"@qwik.dev/router": "2.0.0-beta.8"
24+
"@qwik.dev/core": "2.0.0-beta.9",
25+
"@qwik.dev/router": "2.0.0-beta.9",
26+
"vite": "7.1.3"
2727
},
2828
"dependencies": {
29+
"@qwikest/icons": "^0.0.13",
2930
"birpc": "^0.2.19",
30-
"superjson": "^2.2.2",
3131
"dree": "^5.1.5",
32-
"@qwikest/icons": "^0.0.13",
33-
"vite-hot-client": "^0.2.4"
32+
"oxc-parser": "^0.82.1",
33+
"superjson": "^2.2.2",
34+
"vite-hot-client": "^0.2.4",
35+
"vite-plugin-inspect":"^11.0.0"
3436
},
37+
"type": "module",
3538
"devDependencies": {
3639
"tsx": "^4.19.2",
3740
"@types/node": "^22.10.5",
3841
"@changesets/cli": "^2.27.11",
3942
"@changesets/get-github-info": "^0.6.0",
40-
"@changesets/types": "^6.0.0",
41-
"vite-plugin-inspect":"^11.0.0"
43+
"@changesets/types": "^6.0.0"
4244
},
4345
"private": false,
4446
"keywords": [

packages/kit/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"@typescript-eslint/parser": "7.16.1",
3333
"cpy-cli": "^5.0.0",
3434
"eslint": "8.57.0",
35-
"eslint-plugin-qwik": "2.0.0-beta.8",
35+
"eslint-plugin-qwik": "2.0.0-beta.9",
3636
"np": "^8.0.4",
3737
"prettier": "3.3.3",
3838
"typescript": "5.4.5",

packages/playgrounds/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@
2929
"devDependencies": {
3030
"@devtools/plugin": "workspace:*",
3131
"@devtools/ui": "workspace:*",
32-
"@qwik.dev/core": "2.0.0-beta.8",
33-
"@qwik.dev/router": "2.0.0-beta.8",
32+
"@qwik.dev/core": "2.0.0-beta.9",
33+
"@qwik.dev/router": "2.0.0-beta.9",
3434
"@types/eslint": "8.56.10",
3535
"@types/node": "20.14.11",
3636
"@typescript-eslint/eslint-plugin": "7.16.1",
3737
"@typescript-eslint/parser": "7.16.1",
3838
"eslint": "8.57.0",
39-
"eslint-plugin-qwik": "2.0.0-beta.8",
39+
"eslint-plugin-qwik": "2.0.0-beta.9",
4040
"prettier": "3.3.3",
4141
"typescript": "5.4.5",
4242
"vite": "7.1.3",

packages/plugin/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"devDependencies": {
2626
"@babel/types": "^7.26.7",
2727
"@devtools/kit": "workspace:*",
28+
"@qwik.dev/core": "2.0.0-beta.9",
2829
"@types/eslint": "8.56.10",
2930
"@types/node": "20.14.11",
3031
"@typescript-eslint/eslint-plugin": "7.16.1",

packages/plugin/src/index.ts

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import { ResolvedConfig, type Plugin } from 'vite';
22
import { getServerFunctions } from './rpc';
33
import { createServerRpc, setViteServerContext, VIRTUAL_QWIK_DEVTOOLS_KEY, INNER_USE_HOOK } from '@devtools/kit';
4-
import _traverse from '@babel/traverse';
5-
import _generate from '@babel/generator';
64
import VueInspector from 'vite-plugin-inspect'
75
import useCollectHooksSource from './utils/useCollectHooks'
86
import { parseQwikCode } from './parse/parse';
@@ -15,13 +13,28 @@ export function qwikDevtools(): Plugin[] {
1513
name: 'vite-plugin-qwik-devtools',
1614
apply: 'serve',
1715
resolveId(id) {
18-
if (id === VIRTUAL_QWIK_DEVTOOLS_KEY) {
19-
return id;
16+
// Normalize to a stable, absolute-like id so Qwik can generate runtime chunks
17+
const clean = id.split('?')[0].split('#')[0];
18+
if (
19+
clean === VIRTUAL_QWIK_DEVTOOLS_KEY ||
20+
clean === `/${VIRTUAL_QWIK_DEVTOOLS_KEY}` ||
21+
clean === `\u0000${VIRTUAL_QWIK_DEVTOOLS_KEY}` ||
22+
clean === `/@id/${VIRTUAL_QWIK_DEVTOOLS_KEY}`
23+
) {
24+
return `/${VIRTUAL_QWIK_DEVTOOLS_KEY}`;
2025
}
2126
},
2227
load(id) {
23-
if (id === VIRTUAL_QWIK_DEVTOOLS_KEY) {
24-
return useCollectHooksSource;
28+
if (
29+
id === `/${VIRTUAL_QWIK_DEVTOOLS_KEY}` ||
30+
id === VIRTUAL_QWIK_DEVTOOLS_KEY ||
31+
id === `\u0000${VIRTUAL_QWIK_DEVTOOLS_KEY}` ||
32+
id === `/@id/${VIRTUAL_QWIK_DEVTOOLS_KEY}`
33+
) {
34+
return {
35+
code: useCollectHooksSource,
36+
map: null,
37+
};
2538
}
2639
},
2740
configResolved(viteConfig) {
@@ -49,14 +62,11 @@ export function qwikDevtools(): Plugin[] {
4962
code = `import { QwikDevtools } from '${importPath}';\n${code}`;
5063
}
5164

52-
// Find the closing body tag and inject the QwikDevtools component before it
65+
// Find the closing body tag and append QwikDevtools at the end of body
5366
const match = code.match(/<body[^>]*>([\s\S]*?)<\/body>/);
5467
if (match) {
5568
const bodyContent = match[1];
56-
const newBodyContent = bodyContent.replace(
57-
/{!isDev && <ServiceWorkerRegister \/>}/,
58-
`{!isDev && <ServiceWorkerRegister />}\n {isDev && <QwikDevtools />}`,
59-
);
69+
const newBodyContent = `${bodyContent}\n <QwikDevtools />`;
6070
code = code.replace(bodyContent, newBodyContent);
6171
}
6272

packages/plugin/src/utils/useCollectHooks.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ export const useCollectHooks = (src) => {
33
const hooksList = useSignal([])
44
useVisibleTask$(({ track }) => {
55
const newdata = track(() => hooksList.value);
6-
76
if(!window.QWIK_DEVTOOLS_GLOBAL_STATE) {
87
window.QWIK_DEVTOOLS_GLOBAL_STATE = {}
9-
window.QWIK_DEVTOOLS_GLOBAL_STATE[src] = []
8+
window.QWIK_DEVTOOLS_GLOBAL_STATE[src] = newdata || []
109
}else {
1110
window.QWIK_DEVTOOLS_GLOBAL_STATE[src] = newdata
1211
}

packages/plugin/tsdown.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ import { defineConfig } from 'tsdown'
33
export default defineConfig({
44
entry: ['src/index.ts'],
55
clean: true,
6+
target: 'esnext',
67
format: ['esm'],
7-
external: ['vite','vite-plugin-inspect'],
8+
external: ['vite','vite-plugin-inspect', '@qwik.dev/core'],
89
dts: true,
910
shims: true,
1011
tsconfig: './tsconfig.json',

0 commit comments

Comments
 (0)