Skip to content

Commit 5fe1349

Browse files
authored
Merge branch 'QwikDev:main' into main
2 parents 816b6c9 + 532d978 commit 5fe1349

47 files changed

Lines changed: 3284 additions & 1126 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/hungry-stingrays-attack.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<!--
2+
The Qwik Team and Community appreciate all PRs. Thank you for your effort! Not all PRs can be merged, but those that meet the following criteria will be prioritized:
3+
4+
a) Core fixes, and
5+
6+
b) Framework functionality achievable only by the core.
7+
8+
If this PR can be done as a 3rd-Party Community Add-On, we encourage that for quicker adoption.
9+
10+
If you believe your functionality is valuable to the entire Qwik Community, discuss it in the Qwik Discord channels for potential inclusion in the core.
11+
12+
First of all, make sure your PR title is descriptive and matches our commit title guidelines.
13+
14+
Also make sure your PR follows all the guidelines in the [CONTRIBUTING.md](./CONTRIBUTING.md) document.
15+
16+
-->
17+
18+
# What is it?
19+
20+
<!-- pick one and remove the others -->
21+
22+
- Feature / enhancement
23+
- Bug
24+
- Docs / tests / types / typos
25+
- Infra
26+
27+
# Description
28+
29+
<!--
30+
* Include a summary of the motivation and context for this PR
31+
* Is it related to any opened issues? (please add them here)
32+
-->
33+
34+
# Checklist
35+
36+
<!--
37+
* delete the items that are not relevant, so it's easy to tell if the PR is ready to be merged
38+
* add items that are relevant and need to be done before merging
39+
-->
40+
41+
- [ ] My code follows the [developer guidelines of this project](https://github.com/QwikDev/devtools/blob/main/CONTRIBUTING.md)
42+
- [ ] I performed a self-review of my own code
43+
- [ ] I added a changeset with `pnpm change`
44+
- [ ] I added new tests to cover the fix / functionality

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"license": "MIT",
44
"description": "Qwik devtools monorepo",
55
"scripts": {
6-
"dev": "pnpm --filter plugin build && MODE=dev pnpm --parallel dev",
76
"playground": "MODE=dev DEBUG=qwik:devtools:* pnpm --filter playground dev",
87
"build": "tsx scripts/build-devtools.ts",
98
"change": "changeset",

packages/devtools/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# @qwik.dev/devtools
22

3+
## 0.2.2
4+
5+
### Patch Changes
6+
7+
- 64805a3: CHORE: add debug log and format
8+
- 394278e: feat: add performance tab
9+
310
## 0.2.1
411

512
### Patch Changes

packages/devtools/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@qwik.dev/devtools",
3-
"version": "0.2.1",
3+
"version": "0.2.2",
44
"license": "MIT",
55
"main": "./dist/plugin/index.mjs",
66
"description": "Qwik devtools package",
@@ -24,8 +24,8 @@
2424
"README.md"
2525
],
2626
"peerDependencies": {
27-
"@qwik.dev/core": "2.0.0-beta.11",
28-
"@qwik.dev/router": "2.0.0-beta.11",
27+
"@qwik.dev/core": "2.0.0-beta.15",
28+
"@qwik.dev/router": "2.0.0-beta.15",
2929
"vite": "7.1.3",
3030
"@tailwindcss/postcss": "^4.1.14",
3131
"@tailwindcss/vite": "^4.1.14",

packages/kit/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"@typescript-eslint/parser": "7.16.1",
3232
"cpy-cli": "^5.0.0",
3333
"eslint": "8.57.0",
34-
"eslint-plugin-qwik": "2.0.0-beta.11",
34+
"eslint-plugin-qwik": "2.0.0-beta.15",
3535
"np": "^8.0.4",
3636
"prettier": "3.3.3",
3737
"typescript": "5.4.5",

packages/kit/src/context.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,37 @@ import {
99
} from './globals';
1010
import { ServerRpc, ClientRpc } from './types';
1111

12+
type GlobalTarget = Record<string, unknown>;
13+
const t = target as unknown as GlobalTarget;
14+
1215
export function getViteClientContext(): ViteClientContext {
13-
return target[CLIENT_CTX];
16+
return t[CLIENT_CTX] as ViteClientContext;
1417
}
1518

1619
export function setViteClientContext(ctx: ViteClientContext) {
17-
target[CLIENT_CTX] = ctx;
20+
t[CLIENT_CTX] = ctx;
1821
}
1922

2023
export function getViteServerContext() {
21-
return target[SERVER_CTX];
24+
return t[SERVER_CTX] as ViteServerContext;
2225
}
2326

2427
export function setViteServerContext(ctx: ViteServerContext) {
25-
target[SERVER_CTX] = ctx;
28+
t[SERVER_CTX] = ctx;
2629
}
2730

2831
export function getViteServerRpc() {
29-
return target[SERVER_RPC];
32+
return t[SERVER_RPC] as ServerRpc;
3033
}
3134

3235
export function setViteServerRpc(rpc: ServerRpc) {
33-
target[SERVER_RPC] = rpc;
36+
t[SERVER_RPC] = rpc;
3437
}
3538

3639
export function getViteClientRpc() {
37-
return target[CLIENT_RPC];
40+
return t[CLIENT_RPC] as ClientRpc;
3841
}
3942

4043
export function setViteClientRpc(rpc: ClientRpc) {
41-
target[CLIENT_RPC] = rpc;
44+
t[CLIENT_RPC] = rpc;
4245
}

packages/kit/src/globals.ts

Lines changed: 67 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ViteDevServer } from 'vite';
2-
import { ClientRpc, ServerRpc } from './types';
2+
import { ClientRpc, ParsedStructure, ServerRpc } from './types';
33

44
interface EventEmitter {
55
on: (name: string, handler: (data: any) => void) => void;
@@ -14,9 +14,71 @@ export const SERVER_CTX = '__qwik_server_ctx__';
1414
export const SERVER_RPC = '__qwik_server_rpc__';
1515
export const CLIENT_RPC = '__qwik_client_rpc__';
1616

17+
// Devtools global state types
18+
export type QwikPerfPhaseRemembered = 'ssr' | 'csr';
19+
20+
export interface QwikPerfErrorRemembered {
21+
name: string;
22+
message: string;
23+
}
24+
25+
export interface QwikPerfEntryRemembered {
26+
id: number;
27+
component: string;
28+
phase: QwikPerfPhaseRemembered;
29+
duration: number;
30+
start: number;
31+
end: number;
32+
error?: QwikPerfErrorRemembered;
33+
/**
34+
* Present for wrapped `_component_` render-function modules; helps de-dupe.
35+
*/
36+
viteId?: string;
37+
/**
38+
* Present for wrapped `_component_` render-function modules.
39+
*/
40+
renderCount?: number;
41+
}
42+
43+
export interface QwikPerfStoreRemembered {
44+
ssr: QwikPerfEntryRemembered[];
45+
csr: QwikPerfEntryRemembered[];
46+
47+
}
48+
49+
export interface DevtoolsRenderStats {
50+
/**
51+
* In-memory performance store written by devtools instrumentation.
52+
* (Populated at runtime; optional in types.)
53+
*/
54+
perf?: QwikPerfStoreRemembered;
55+
}
56+
export interface ComponentDevtoolsState {
57+
hooks: ParsedStructure[];
58+
stats: DevtoolsRenderStats;
59+
}
60+
61+
62+
declare global {
63+
interface Window {
64+
QWIK_DEVTOOLS_GLOBAL_STATE?: Record<string, ComponentDevtoolsState>;
65+
/**
66+
* Performance store (CSR + injected SSR snapshot).
67+
* Written by `@devtools/plugin` instrumentation.
68+
*/
69+
__QWIK_PERF__?: QwikPerfStoreRemembered;
70+
}
71+
}
72+
1773
declare global {
18-
var __qwik_client_ctx__: ViteClientContext;
19-
var __qwik_server_ctx__: ViteServerContext;
20-
var __qwik_server_rpc__: ServerRpc;
21-
var __qwik_client_rpc__: ClientRpc;
74+
// SSR collector lives on `process` (preferred) or `globalThis` via dynamic properties.
75+
// We type the `process` case here to avoid `any` in plugin code.
76+
namespace NodeJS {
77+
interface Process {
78+
__QWIK_SSR_PERF__?: QwikPerfEntryRemembered[];
79+
__QWIK_SSR_PERF_SET__?: Set<string>;
80+
__QWIK_SSR_PERF_ID__?: number;
81+
__QWIK_SSR_PERF_INDEX__?: Record<string, number>;
82+
}
83+
}
2284
}

packages/kit/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ export * from './client';
22
export * from './server';
33
export * from './context';
44
export * from './types';
5-
export * from './constants';
5+
export * from './constants';
6+
export * from './globals';

packages/playgrounds/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"build.preview": "vite build --ssr src/entry.preview.tsx",
1818
"build.types": "tsc --incremental --noEmit",
1919
"deploy": "echo 'Run \"npm run qwik add\" to install a server adapter'",
20-
"dev": "MODE=dev vite --mode ssr",
20+
"dev": "MODE=dev vite --mode ssr --port 5174",
2121
"dev.debug": "node --inspect-brk ./node_modules/vite/bin/vite.js --mode ssr --force",
2222
"fmt": "prettier --write .",
2323
"fmt.check": "prettier --check .",
@@ -29,14 +29,14 @@
2929
"devDependencies": {
3030
"@devtools/plugin": "workspace:*",
3131
"@devtools/ui": "workspace:*",
32-
"@qwik.dev/core": "2.0.0-beta.11",
33-
"@qwik.dev/router": "2.0.0-beta.11",
32+
"@qwik.dev/core": "2.0.0-beta.15",
33+
"@qwik.dev/router": "2.0.0-beta.15",
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.11",
39+
"eslint-plugin-qwik": "2.0.0-beta.15",
4040
"prettier": "3.3.3",
4141
"typescript": "5.4.5",
4242
"vite": "7.1.3",

0 commit comments

Comments
 (0)