Skip to content

Commit a6efe7c

Browse files
authored
Merge pull request #7584 from QwikDev/v2-fixes
fix(v2): repl and some small fixes
2 parents 15e20a6 + b982f2a commit a6efe7c

File tree

105 files changed

+2949
-2544
lines changed

Some content is hidden

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

105 files changed

+2949
-2544
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,8 @@ jobs:
272272

273273
- name: Install Rust toolchain
274274
uses: actions-rust-lang/setup-rust-toolchain@v1
275+
with:
276+
components: clippy,rustfmt
275277

276278
- uses: pnpm/action-setup@v4
277279
- name: Setup Node

.vscode/launch.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,18 @@
4040
"program": "${workspaceFolder}/packages/docs/node_modules/vite/bin/vite.js",
4141
"args": ["build", "-c", "adapters/cloudflare-pages/vite.config.mts"]
4242
},
43+
{
44+
"type": "node",
45+
"name": "preloader-test build.client",
46+
"request": "launch",
47+
"runtimeExecutable": "pnpm",
48+
"runtimeArgs": [
49+
"run",
50+
"build.client"
51+
],
52+
"skipFiles": ["<node_internals>/**"],
53+
"cwd": "${workspaceFolder}/starters/apps/preloader-test"
54+
},
4355
{
4456
"type": "node",
4557
"name": "e2e.test",

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
"cross-spawn": "7.0.3",
111111
"csstype": "3.1.3",
112112
"dotenv": "16.4.5",
113-
"esbuild": "0.24.0",
113+
"esbuild": "0.25.4",
114114
"eslint": "9.25.1",
115115
"eslint-plugin-import": "2.29.1",
116116
"eslint-plugin-no-only-tests": "3.3.0",
@@ -227,10 +227,10 @@
227227
"test.e2e.chromium.debug": "PWDEBUG=1 playwright test starters --browser=chromium --config starters/playwright.config.ts",
228228
"test.e2e.cli": "pnpm --filter qwik-cli-e2e e2e",
229229
"test.e2e.firefox": "playwright test starters --browser=firefox --config starters/playwright.config.ts",
230-
"test.e2e.router": "playwright test starters/e2e/qwikrouter --browser=chromium --config starters/playwright.config.ts",
231-
"test.e2e.run": "tsm scripts/e2e-cli.ts",
232230
"test.e2e.integrations.chromium": "playwright test e2e/adapters-e2e/tests --project=chromium --config e2e/adapters-e2e/playwright.config.ts",
233231
"test.e2e.integrations.webkit": "playwright test e2e/adapters-e2e/tests --project=webkit --config e2e/adapters-e2e/playwright.config.ts",
232+
"test.e2e.router": "playwright test starters/e2e/qwikrouter --browser=chromium --config starters/playwright.config.ts",
233+
"test.e2e.run": "tsm scripts/e2e-cli.ts",
234234
"test.e2e.webkit": "playwright test starters --browser=webkit --config starters/playwright.config.ts",
235235
"test.rust": "make test",
236236
"test.rust.bench": "make benchmark",

packages/create-qwik/src/helpers/logAppCreated.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ export function logAppCreated(pkgManager: string, result: CreateAppResult, ranIn
4040
if (!ranInstall) {
4141
outString.push(` ${pkgManager} install`);
4242
}
43-
outString.push(` ${pkgManager} start`);
43+
if (pkgManager === 'deno') {
44+
outString.push(` deno task start`);
45+
} else {
46+
outString.push(` ${pkgManager} start`);
47+
}
4448
outString.push(``);
4549

4650
note(outString.join('\n'), 'Result');

packages/docs/package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88
"@algolia/autocomplete-core": "1.7.4",
99
"@algolia/client-search": "4.14.3",
1010
"@builder.io/partytown": "0.10.2",
11-
"@builder.io/qwik": "../qwik",
12-
"@builder.io/qwik-city": "../qwik-router",
13-
"@builder.io/sdk-qwik": "0.14.31",
1411
"@emotion/react": "11.13.0",
1512
"@emotion/styled": "11.13.0",
1613
"@modular-forms/qwik": "0.23.1",

packages/docs/src/components/sidebar/sidebar.tsx

Lines changed: 20 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,11 @@
1-
import {
2-
component$,
3-
sync$,
4-
useComputed$,
5-
useContext,
6-
useOnDocument,
7-
useStyles$,
8-
} from '@qwik.dev/core';
9-
import { type ContentMenu, server$, useContent, useLocation } from '@qwik.dev/router';
1+
import { component$, sync$, useContext, useOnDocument, useStyles$ } from '@qwik.dev/core';
2+
import { routeLoader$, useContent, useLocation, type ContentMenu } from '@qwik.dev/router';
103
import { GlobalStore } from '../../context';
114
import { CloseIcon } from '../svgs/close-icon';
125
import styles from './sidebar.css?inline';
136

14-
let markdownItems: MarkdownItems | undefined;
15-
let markdownItemsPromise: Promise<MarkdownItems> | undefined;
16-
export const getMarkdownItems = server$(() => {
17-
if (markdownItems) {
18-
return markdownItems;
19-
}
20-
21-
markdownItemsPromise ||= Promise.all(
7+
export const useMarkdownItems = routeLoader$(async () => {
8+
const rawData = await Promise.all(
229
Object.entries(import.meta.glob<{ frontmatter?: MDX }>('../../routes/**/*.{md,mdx}')).map(
2310
async ([k, v]) => {
2411
return [
@@ -33,22 +20,20 @@ export const getMarkdownItems = server$(() => {
3320
] as const;
3421
}
3522
)
36-
).then((rawData) => {
37-
markdownItems = {};
38-
rawData.map(([k, v]) => {
39-
if (v.frontmatter?.updated_at) {
40-
markdownItems![k] = {
41-
title: v.frontmatter.title,
42-
contributors: v.frontmatter.contributors,
43-
created_at: v.frontmatter.created_at,
44-
updated_at: v.frontmatter.updated_at,
45-
};
46-
}
47-
});
48-
49-
return markdownItems;
23+
);
24+
const markdownItems: MarkdownItems = {};
25+
rawData.map(([k, v]) => {
26+
if (v.frontmatter?.updated_at) {
27+
markdownItems[k] = {
28+
title: v.frontmatter.title,
29+
contributors: v.frontmatter.contributors,
30+
created_at: v.frontmatter.created_at,
31+
updated_at: v.frontmatter.updated_at,
32+
};
33+
}
5034
});
51-
return markdownItemsPromise;
35+
36+
return markdownItems;
5237
});
5338

5439
type MarkdownItems = Record<string, MDX>;
@@ -79,7 +64,7 @@ export const SideBar = component$((props: { allOpen?: boolean }) => {
7964
const globalStore = useContext(GlobalStore);
8065
const { menu } = useContent();
8166
const { url } = useLocation();
82-
const markdownItems = useComputed$(() => getMarkdownItems());
67+
const markdownItems = useMarkdownItems();
8368
const allOpen = url.pathname.startsWith('/qwikrouter/') || props.allOpen;
8469

8570
useOnDocument(
@@ -93,7 +78,7 @@ export const SideBar = component$((props: { allOpen?: boolean }) => {
9378
el.scrollTop = savedScroll;
9479
el.style.visibility = 'visible';
9580
}
96-
} catch {
81+
} catch (err) {
9782
//
9883
}
9984
})
@@ -118,7 +103,7 @@ export const SideBar = component$((props: { allOpen?: boolean }) => {
118103
try {
119104
const scrollTop = document.getElementById('qwik-sidebar')!.scrollTop;
120105
sessionStorage.setItem('qwik-sidebar', String(scrollTop));
121-
} catch {
106+
} catch (err) {
122107
//
123108
}
124109
})}

packages/docs/src/components/svgs/bluesky-logo.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
import { component$ } from '@qwik.dev/core';
2+
13
interface Props {
24
width: number;
35
height: number;
46
}
57

6-
export const BlueskyLogo = ({ width, height }: Props) => (
8+
export const BlueskyLogo = component$(({ width, height }: Props) => (
79
<svg
810
xmlns="http://www.w3.org/2000/svg"
911
width={width}
@@ -17,4 +19,4 @@ export const BlueskyLogo = ({ width, height }: Props) => (
1719
d="M13.873 3.805C21.21 9.332 29.103 20.537 32 26.55v15.882c0-.338-.13.044-.41.867-1.512 4.456-7.418 21.847-20.923 7.944-7.111-7.32-3.819-14.64 9.125-16.85-7.405 1.264-15.73-.825-18.014-9.015C1.12 23.022 0 8.51 0 6.55 0-3.268 8.579-.182 13.873 3.805zm36.254 0C42.79 9.332 34.897 20.537 32 26.55v15.882c0-.338.13.044.41.867 1.512 4.456 7.418 21.847 20.923 7.944 7.111-7.32 3.819-14.64-9.125-16.85 7.405 1.264 15.73-.825 18.014-9.015C62.88 23.022 64 8.51 64 6.55c0-9.818-8.578-6.732-13.873-2.745z"
1820
/>
1921
</svg>
20-
);
22+
));

packages/docs/src/components/svgs/discord-logo.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import type { PropsOf } from '@qwik.dev/core';
2+
import { component$ } from '@qwik.dev/core';
23

34
type DiscordLogoProps = {
45
width: number;
56
height: number;
67
} & PropsOf<'svg'>;
78

8-
export const DiscordLogo = ({ width, height }: DiscordLogoProps) => (
9+
export const DiscordLogo = component$(({ width, height }: DiscordLogoProps) => (
910
<svg
1011
xmlns="http://www.w3.org/2000/svg"
1112
width={width}
@@ -18,4 +19,4 @@ export const DiscordLogo = ({ width, height }: DiscordLogoProps) => (
1819
<path d="M464 66.52A50 50 0 00414.12 17L97.64 16A49.65 49.65 0 0048 65.52V392c0 27.3 22.28 48 49.64 48H368l-13-44 109 100zM324.65 329.81s-8.72-10.39-16-19.32C340.39 301.55 352.5 282 352.5 282a139 139 0 01-27.85 14.25 173.31 173.31 0 01-35.11 10.39 170.05 170.05 0 01-62.72-.24 184.45 184.45 0 01-35.59-10.4 141.46 141.46 0 01-17.68-8.21c-.73-.48-1.45-.72-2.18-1.21-.49-.24-.73-.48-1-.48-4.36-2.42-6.78-4.11-6.78-4.11s11.62 19.09 42.38 28.26c-7.27 9.18-16.23 19.81-16.23 19.81-53.51-1.69-73.85-36.47-73.85-36.47 0-77.06 34.87-139.62 34.87-139.62 34.87-25.85 67.8-25.12 67.8-25.12l2.42 2.9c-43.59 12.32-63.44 31.4-63.44 31.4s5.32-2.9 14.28-6.77c25.91-11.35 46.5-14.25 55-15.21a24 24 0 014.12-.49 205.62 205.62 0 0148.91-.48 201.62 201.62 0 0172.89 22.95s-19.13-18.15-60.3-30.45l3.39-3.86s33.17-.73 67.81 25.16c0 0 34.87 62.56 34.87 139.62 0-.28-20.35 34.5-73.86 36.19z" />
1920
<path d="M212.05 218c-13.8 0-24.7 11.84-24.7 26.57s11.14 26.57 24.7 26.57c13.8 0 24.7-11.83 24.7-26.57.25-14.76-10.9-26.57-24.7-26.57zM300.43 218c-13.8 0-24.7 11.84-24.7 26.57s11.14 26.57 24.7 26.57c13.81 0 24.7-11.83 24.7-26.57S314 218 300.43 218z" />
2021
</svg>
21-
);
22+
));

packages/docs/src/components/svgs/github-logo.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
import { component$ } from '@qwik.dev/core';
2+
13
interface GithubLogoProps {
24
width: number;
35
height: number;
46
}
57

6-
export const GithubLogo = ({ width, height }: GithubLogoProps) => (
8+
export const GithubLogo = component$(({ width, height }: GithubLogoProps) => (
79
<svg
810
viewBox="0 0 16 16"
911
width={width}
@@ -14,4 +16,4 @@ export const GithubLogo = ({ width, height }: GithubLogoProps) => (
1416
>
1517
<path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z" />
1618
</svg>
17-
);
19+
));

packages/docs/src/components/svgs/twitter-logo.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
import { component$ } from '@qwik.dev/core';
2+
13
interface TwitterLogoProps {
24
width: number;
35
height: number;
46
}
57

6-
export const TwitterLogo = ({ width, height }: TwitterLogoProps) => (
8+
export const TwitterLogo = component$(({ width, height }: TwitterLogoProps) => (
79
<svg
810
xmlns="http://www.w3.org/2000/svg"
911
width={width}
@@ -15,4 +17,4 @@ export const TwitterLogo = ({ width, height }: TwitterLogoProps) => (
1517
>
1618
<path d="M389.2 48h70.6L305.6 224.2 487 464H345L233.7 318.6 106.5 464H35.8L200.7 275.5 26.8 48H172.4L272.9 180.9 389.2 48zM364.4 421.8h39.1L151.1 88h-42L364.4 421.8z" />
1719
</svg>
18-
);
20+
));

packages/docs/src/repl/bundled.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import qPublicDts from '../../node_modules/@qwik.dev/core/public.d.ts?raw-source
1616
import qCoreInternalDts from '../../node_modules/@qwik.dev/core/dist/core-internal.d.ts?raw-source';
1717
import qCoreMinMjs from '../../node_modules/@qwik.dev/core/dist/core.min.mjs?raw-source';
1818
import qPreloaderMjs from '../../node_modules/@qwik.dev/core/dist/preloader.mjs?raw-source';
19+
import qHandlersMjs from '../../node_modules/@qwik.dev/core/handlers.mjs?raw-source';
1920
import qCoreMjs from '../../node_modules/@qwik.dev/core/dist/core.mjs?raw-source';
2021
import qOptimizerCjs from '../../node_modules/@qwik.dev/core/dist/optimizer.cjs?raw-source';
2122
import qServerCjs from '../../node_modules/@qwik.dev/core/dist/server.cjs?raw-source';
@@ -65,6 +66,7 @@ export const bundled: PkgUrls = {
6566
'/dist/server.cjs': qServerCjs,
6667
'/dist/server.d.ts': qServerDts,
6768
'/dist/preloader.mjs': qPreloaderMjs,
69+
'/handlers.mjs': qHandlersMjs,
6870
'/bindings/qwik.wasm.cjs': qWasmCjs,
6971
'/bindings/qwik_wasm_bg.wasm': qWasmBinUrl,
7072
},

packages/docs/src/repl/repl-output-symbols.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,17 @@ export const ReplOutputSymbols = component$(({ outputs }: ReplOutputSymbolsProps
4141
.map((o, i) => (
4242
<div class="file-item" data-symbol-item={i} key={o.path}>
4343
<div class="file-info">
44-
<span>{o.segment?.canonicalFilename}</span>
44+
<span>{o.segment!.canonicalFilename}</span>
45+
{o.segment!.paramNames && (
46+
<div>
47+
Params: <code>{o.segment!.paramNames.join(', ')}</code>
48+
</div>
49+
)}
50+
{o.segment!.captureNames && (
51+
<div>
52+
Captures: <code>{o.segment!.captureNames.join(', ')}</code>
53+
</div>
54+
)}
4555
</div>
4656
<div class="file-text">
4757
<CodeBlock

packages/docs/src/repl/repl-output-update.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { ReplResult, ReplStore } from './types';
22

33
// TODO fix useStore to recursively notify subscribers
4-
const deepUpdate = (prev: any, next: any) => {
4+
const deepUpdate = (prev: any, next: any, matcher?: (a: any, b: any) => boolean) => {
55
for (const key in next) {
66
if (prev[key] && typeof next[key] === 'object' && typeof prev[key] === 'object') {
77
deepUpdate(prev[key], next[key]);
@@ -13,13 +13,7 @@ const deepUpdate = (prev: any, next: any) => {
1313
}
1414
if (Array.isArray(prev)) {
1515
for (const item of prev) {
16-
// can't use Object as a matcher
17-
// because it will be a different object
18-
// so we need to use the path or code
19-
20-
if (
21-
next.some((nextItem: any) => (nextItem.path || nextItem.code) === (item.path || item.code))
22-
) {
16+
if (!next.some((nextItem: any) => (matcher ? matcher(nextItem, item) : nextItem === item))) {
2317
prev.splice(prev.indexOf(item), 1);
2418
}
2519
}
@@ -32,6 +26,8 @@ const deepUpdate = (prev: any, next: any) => {
3226
}
3327
};
3428

29+
const matchByPath = (a: any, b: any) => a.path === b.path;
30+
3531
export const updateReplOutput = async (store: ReplStore, result: ReplResult) => {
3632
deepUpdate(store.diagnostics, result.diagnostics);
3733

@@ -40,9 +36,9 @@ export const updateReplOutput = async (store: ReplStore, result: ReplResult) =>
4036
store.html = result.html;
4137
}
4238

43-
deepUpdate(store.transformedModules, result.transformedModules);
44-
deepUpdate(store.clientBundles, result.clientBundles);
45-
deepUpdate(store.ssrModules, result.ssrModules);
39+
deepUpdate(store.transformedModules, result.transformedModules, matchByPath);
40+
deepUpdate(store.clientBundles, result.clientBundles, matchByPath);
41+
deepUpdate(store.ssrModules, result.ssrModules, matchByPath);
4642
if (
4743
result.events.length !== store.events.length ||
4844
result.events.some((ev, i) => ev?.start !== store.events[i]?.start)

packages/docs/src/repl/repl.css

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@
230230
.output-modules .file-tree {
231231
padding: 0 15px 15px 15px;
232232
grid-area: repl-file-tree;
233-
overflow-y: auto;
233+
overflow: auto;
234234
}
235235

236236
.output-modules .file-tree-header {
@@ -242,8 +242,6 @@
242242
display: block;
243243
margin: 4px 0px 2px 9px;
244244
white-space: nowrap;
245-
text-overflow: ellipsis;
246-
overflow: hidden;
247245
}
248246

249247
.output-modules .file-tree-items a:hover,
@@ -270,8 +268,7 @@
270268
margin-bottom: 15px;
271269
background-color: rgb(33 104 170 / 15%);
272270
padding: 5px 10px;
273-
overflow: hidden;
274-
text-overflow: ellipsis;
271+
word-break: break-word;
275272
}
276273

277274
.output-modules .file-size {

packages/docs/src/repl/worker/repl-dependencies.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const depResponse = async (pkgName: string, pkgPath: string) => {
1010
if (pkgName === QWIK_PKG_NAME) {
1111
const version = dep.version;
1212
const [M, m, p] = version.split('-')[0].split('.').map(Number);
13-
if (!pkgPath.startsWith('/bindings')) {
13+
if (!pkgPath.startsWith('/bindings') && !pkgPath.startsWith('/handlers.mjs')) {
1414
if (M > 1 || (M == 1 && (m > 7 || (m == 7 && p >= 2)))) {
1515
pkgPath = `/dist${pkgPath}`;
1616
}

0 commit comments

Comments
 (0)