Skip to content

Commit 79c4255

Browse files
authored
feat: image performance dev tools (#4424)
1 parent d476867 commit 79c4255

File tree

15 files changed

+628
-68
lines changed

15 files changed

+628
-68
lines changed

.github/workflows/ci.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jobs:
7575
- name: Setup Node
7676
uses: actions/setup-node@v3
7777
with:
78-
node-version: 16.x
78+
node-version: 18.x
7979
cache: 'pnpm'
8080
registry-url: https://registry.npmjs.org/
8181

@@ -142,7 +142,7 @@ jobs:
142142
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
143143
uses: actions/setup-node@v3
144144
with:
145-
node-version: 16.x
145+
node-version: 18.x
146146
cache: 'pnpm'
147147
registry-url: https://registry.npmjs.org/
148148

@@ -236,7 +236,7 @@ jobs:
236236
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
237237
uses: actions/setup-node@v3
238238
with:
239-
node-version: 16.x
239+
node-version: 18.x
240240
cache: 'pnpm'
241241
registry-url: https://registry.npmjs.org/
242242

@@ -324,7 +324,7 @@ jobs:
324324
if: ${{ needs.changes.outputs.fullbuild == 'true' }}
325325
uses: actions/setup-node@v3
326326
with:
327-
node-version: 16.x
327+
node-version: 18.x
328328
cache: 'pnpm'
329329
registry-url: https://registry.npmjs.org/
330330

@@ -408,7 +408,7 @@ jobs:
408408
- name: Setup Node
409409
uses: actions/setup-node@v3
410410
with:
411-
node-version: 16.x
411+
node-version: 18.x
412412
cache: 'pnpm'
413413
registry-url: https://registry.npmjs.org/
414414

@@ -469,10 +469,10 @@ jobs:
469469
settings:
470470
- host: ubuntu-latest
471471
browser: chromium
472-
node: 16.x
472+
node: 18.x
473473
- host: macos-latest
474474
browser: webkit
475-
node: 16.x
475+
node: 18.x
476476

477477
runs-on: ${{ matrix.settings.host }}
478478

@@ -544,7 +544,7 @@ jobs:
544544
- name: Setup Node
545545
uses: actions/setup-node@v3
546546
with:
547-
node-version: 16.x
547+
node-version: 18.x
548548
cache: 'pnpm'
549549
registry-url: https://registry.npmjs.org/
550550

@@ -634,7 +634,7 @@ jobs:
634634
- name: Setup Node
635635
uses: actions/setup-node@v3
636636
with:
637-
node-version: 16.x
637+
node-version: 18.x
638638
cache: 'pnpm'
639639
registry-url: https://registry.npmjs.org/
640640

.node-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
18

package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
"url": "https://twitter.com/manucorporat"
131131
}
132132
],
133-
"packageManager": "pnpm@8.3.1",
133+
"packageManager": "pnpm@8.6.1",
134134
"engines": {
135135
"node": ">=16.8.0 <18.0.0 || >=18.11",
136136
"npm": "please-use-pnpm",
@@ -142,5 +142,8 @@
142142
"path": "./node_modules/cz-conventional-changelog"
143143
}
144144
},
145-
"type": "module"
145+
"type": "module",
146+
"dependencies": {
147+
"esbuild-plugin-raw": "^0.1.7"
148+
}
146149
}

packages/docs/.node-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
16
1+
18

packages/docs/package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,12 @@
5959
"bugs": {
6060
"url": "https://github.com/BuilderIO/qwik"
6161
},
62+
"packageManager": "pnpm@8.6.1",
6263
"engines": {
63-
"node": ">=16"
64+
"node": ">=18.11",
65+
"npm": "please-use-pnpm",
66+
"yarn": "please-use-pnpm",
67+
"pnpm": ">=8.0.0"
6468
},
6569
"license": "MIT",
6670
"private": true,

packages/qwik/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@
143143
],
144144
"devDependencies": {
145145
"@builder.io/qwik-dom": "workspace:*",
146+
"image-size": "^1.0.2",
146147
"kleur": "4.1.5"
147148
},
148149
"contributors": [

packages/qwik/src/core/render/dom/render-dom.ts

+22-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { type InvokeContext, newInvokeContext, invoke } from '../../use/use-core
33
import { EMPTY_ARRAY, EMPTY_OBJ } from '../../util/flyweight';
44
import { logWarn } from '../../util/log';
55
import { isNotNullable, isPromise, promiseAll, then } from '../../util/promises';
6-
import { qDev, seal } from '../../util/qdev';
6+
import { qDev, qInspector, seal } from '../../util/qdev';
77
import { isArray, isFunction, isObject, isString, type ValueOrPromise } from '../../util/types';
88
import { domToVnode, smartUpdateChildren } from './visitor';
99
import { SkipRender } from '../jsx/utils.public';
@@ -69,6 +69,7 @@ export class ProcessedJSXNodeImpl implements ProcessedJSXNode {
6969
$text$: string = '';
7070
$signal$: Signal<any> | null = null;
7171
$id$: string;
72+
$dev$: DevJSX | undefined;
7273

7374
constructor(
7475
public $type$: string,
@@ -79,6 +80,9 @@ export class ProcessedJSXNodeImpl implements ProcessedJSXNode {
7980
public $key$: string | null
8081
) {
8182
this.$id$ = $type$ + ($key$ ? ':' + $key$ : '');
83+
if (qDev && qInspector) {
84+
this.$dev$ = undefined;
85+
}
8286
seal(this);
8387
}
8488
}
@@ -108,17 +112,32 @@ export const processNode = (
108112
if (result !== undefined) {
109113
convertedChildren = isArray(result) ? result : [result];
110114
}
111-
return new ProcessedJSXNodeImpl(
115+
const vnode = new ProcessedJSXNodeImpl(
112116
textType,
113117
props,
114118
immutableProps,
115119
convertedChildren,
116120
flags,
117121
key
118122
);
123+
if (qDev && qInspector) {
124+
vnode.$dev$ = node.dev;
125+
}
126+
return vnode;
119127
});
120128
} else {
121-
return new ProcessedJSXNodeImpl(textType, props, immutableProps, convertedChildren, flags, key);
129+
const vnode = new ProcessedJSXNodeImpl(
130+
textType,
131+
props,
132+
immutableProps,
133+
convertedChildren,
134+
flags,
135+
key
136+
);
137+
if (qDev && qInspector) {
138+
vnode.$dev$ = node.dev;
139+
}
140+
return vnode;
122141
}
123142
};
124143

packages/qwik/src/core/render/dom/visitor.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ const createElm = (
691691
directSetAttribute(
692692
elm,
693693
'data-qwik-inspector',
694-
`${encodeURIComponent(dev.fileName)}:${dev.lineNumber}:${dev.columnNumber}`
694+
`${dev.fileName}:${dev.lineNumber}:${dev.columnNumber}`
695695
);
696696
}
697697
}

0 commit comments

Comments
 (0)