Skip to content

Support Qwik V2 #235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion apps/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
"astro": "astro"
},
"dependencies": {
"@builder.io/qwik": "^1.12.0",
"@qwikdev/astro": "workspace:*",
"astro": "5.1.1"
},
"devDependencies": {
"@qwik.dev/core": "2.0.0-alpha.8"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't all the dependencies be devDeps?

}
}
2 changes: 1 addition & 1 deletion apps/demo/src/components/qwik/counter.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Slot, component$, useSignal } from "@builder.io/qwik";
import { Slot, component$, useSignal } from "@qwik.dev/core";

export const Counter = component$<{ initial: number }>((props) => {
const counter = useSignal(props.initial);
Expand Down
2 changes: 1 addition & 1 deletion apps/demo/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
},

"jsx": "react-jsx",
"jsxImportSource": "@builder.io/qwik"
"jsxImportSource": "@qwik.dev/core"
}
}
74 changes: 74 additions & 0 deletions apps/deno-demo/deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion apps/deno-demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@
"@astrojs/check": "^0.9.4",
"@astrojs/deno": "^5.0.1",
"@astrojs/react": "^4.1.2",
"@builder.io/qwik": "^1.12.0",
"@qwikdev/astro": "workspace:*",
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"astro": "^5.1.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"typescript": "^5.7.2"
},
"devDependencies": {
"@qwik.dev/core": "2.0.0-alpha.8"
}
}
2 changes: 1 addition & 1 deletion apps/deno-demo/src/components/qwik/counter.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Slot, component$, useSignal } from "@builder.io/qwik";
import { Slot, component$, useSignal } from "@qwik.dev/core";

export const Counter = component$<{ initial: number }>((props) => {
const counter = useSignal(props.initial);
Expand Down
2 changes: 1 addition & 1 deletion apps/deno-demo/src/components/qwik/say-hi.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Slot, component$, sync$ } from "@builder.io/qwik";
import { Slot, component$, sync$ } from "@qwik.dev/core";

export const SayHi = component$(() => {
return (
Expand Down
2 changes: 1 addition & 1 deletion apps/deno-demo/src/components/qwik/test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { component$ } from "@builder.io/qwik";
import { component$ } from "@qwik.dev/core";

export const Test = component$(() => {
return <div>test</div>;
Expand Down
2 changes: 1 addition & 1 deletion apps/deno-demo/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
},

"jsx": "react-jsx",
"jsxImportSource": "@builder.io/qwik"
"jsxImportSource": "@qwik.dev/core"
}
}
4 changes: 3 additions & 1 deletion apps/node-demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
"dependencies": {
"@astrojs/node": "9.0.0",
"@astrojs/react": "4.1.2",
"@builder.io/qwik": "^1.12.0",
"@qwikdev/astro": "workspace:*",
"@types/react": "^18.3.18",
"@types/react-dom": "^18.3.5",
"astro": "5.1.1",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@qwik.dev/core": "2.0.0-alpha.8"
}
}
2 changes: 1 addition & 1 deletion apps/node-demo/src/components/qwik/counter.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Slot, component$, useSignal } from "@builder.io/qwik";
import { Slot, component$, useSignal } from "@qwik.dev/core";

export const Counter = component$<{ initial: number }>((props) => {
const counter = useSignal(props.initial);
Expand Down
2 changes: 1 addition & 1 deletion apps/node-demo/src/components/qwik/say-hi.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Slot, component$, sync$ } from "@builder.io/qwik";
import { Slot, component$, sync$ } from "@qwik.dev/core";

export const SayHi = component$(() => {
return (
Expand Down
2 changes: 1 addition & 1 deletion apps/node-demo/src/components/qwik/test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { component$ } from "@builder.io/qwik";
import { component$ } from "@qwik.dev/core";

export const Test = component$(() => {
return <div>test</div>;
Expand Down
2 changes: 1 addition & 1 deletion apps/node-demo/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
},

"jsx": "react-jsx",
"jsxImportSource": "@builder.io/qwik"
"jsxImportSource": "@qwik.dev/core"
}
}
6 changes: 3 additions & 3 deletions apps/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
},
"dependencies": {
"@astrojs/check": "^0.9.4",
"@builder.io/qwik": "^1.12",
"@fontsource-variable/unbounded": "^5.1.1",
"@iconify-json/lucide": "^1.2.23",
"@qwikdev/astro": "^0.7",
"@qwikdev/astro": "workspace:*",
"astro": "^5.1",
"astro-icon": "^1.1.4",
"sharp": "^0.33.5"
},
"devDependencies": {
"@biomejs/biome": "^1.7.0"
"@biomejs/biome": "^1.7.0",
"@qwik.dev/core": "2.0.0-alpha.8"
}
}
2 changes: 1 addition & 1 deletion apps/website/src/components/home/background/background.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { component$, useStylesScoped$ } from "@builder.io/qwik";
import { component$, useStylesScoped$ } from "@qwik.dev/core";
import styles from "./background.css?inline";

export const Background = component$(() => {
Expand Down
2 changes: 1 addition & 1 deletion apps/website/src/components/home/bar-chart/bar-chart.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { component$, useStylesScoped$ } from "@builder.io/qwik";
import { component$, useStylesScoped$ } from "@qwik.dev/core";
import styles from "./bar-chart.css?inline";

interface BarChartProps {
Expand Down
2 changes: 1 addition & 1 deletion apps/website/src/components/home/cli-copy/cli-copy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
useSignal,
useStyles$,
useTask$
} from "@builder.io/qwik";
} from "@qwik.dev/core";
import styles from "./cli-copy.css?inline";

export const CLICopy = component$((props: PropsOf<"button">) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
useOnDocument,
useSignal,
useStylesScoped$
} from "@builder.io/qwik";
} from "@qwik.dev/core";
import { JSChunk } from "../js-chunk/js-chunk";

export const JSChunkAnimator = component$(() => {
Expand Down
2 changes: 1 addition & 1 deletion apps/website/src/components/home/js-chunk/js-chunk.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { component$, useStylesScoped$ } from "@builder.io/qwik";
import { component$, useStylesScoped$ } from "@qwik.dev/core";

export const JSChunk = component$(() => {
useStylesScoped$(
Expand Down
2 changes: 1 addition & 1 deletion apps/website/src/components/home/logo-hover/logo-hover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
useSignal,
useStyles$,
useVisibleTask$
} from "@builder.io/qwik";
} from "@qwik.dev/core";
import { AstroIcon } from "@icons/astro";
import { QwikIcon } from "@icons/qwik";
import styles from "./logo-hover.css?inline";
Expand Down
2 changes: 1 addition & 1 deletion apps/website/src/components/home/spotlight/spotlight.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { $, Slot, component$, useSignal, useStyles$ } from "@builder.io/qwik";
import { $, Slot, component$, useSignal, useStyles$ } from "@qwik.dev/core";
import styles from "./spotlight.css?inline";

export const Spotlight = component$(() => {
Expand Down
2 changes: 1 addition & 1 deletion apps/website/src/components/home/squiggle/squiggle.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type PropsOf, component$, useStylesScoped$ } from "@builder.io/qwik";
import { type PropsOf, component$, useStylesScoped$ } from "@qwik.dev/core";
import styles from "./squiggle.css?inline";

export const Squiggle = component$((props: PropsOf<"svg">) => {
Expand Down
2 changes: 1 addition & 1 deletion apps/website/src/icons/astro.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type PropsOf, component$ } from "@builder.io/qwik";
import { type PropsOf, component$ } from "@qwik.dev/core";

export const AstroIcon = component$((props: PropsOf<"svg">) => {
return (
Expand Down
2 changes: 1 addition & 1 deletion apps/website/src/icons/qwik.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type PropsOf, component$ } from "@builder.io/qwik";
import { type PropsOf, component$ } from "@qwik.dev/core";

export const QwikIcon = component$((props: PropsOf<"svg">) => {
return (
Expand Down
2 changes: 1 addition & 1 deletion apps/website/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
},

"jsx": "react-jsx",
"jsxImportSource": "@builder.io/qwik"
"jsxImportSource": "@qwik.dev/core"
}
}
7 changes: 4 additions & 3 deletions libs/qwikdev-astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,12 @@
"astro-integration-kit": "^0.18.0"
},
"devDependencies": {
"@builder.io/qwik": "^1.12.0",
"@qwik.dev/core": "2.0.0-alpha.8",
"astro": "^5.1.1",
"vite": "^5.4.11"
"vite": "^5.4.11",
"ts-morph": "latest"
},
"peerDependencies": {
"@builder.io/qwik": ">=1.9.0"
"@qwik.dev/core": ">=2.0.0-alpha.8"
}
}
12 changes: 6 additions & 6 deletions libs/qwikdev-astro/server.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { type JSXNode, jsx } from "@builder.io/qwik";
import { isDev } from "@builder.io/qwik/build";
import type { QwikManifest } from "@builder.io/qwik/optimizer";
import { type JSXNode, type JSXOutput, jsx } from "@qwik.dev/core";
import { isDev } from "@qwik.dev/core/build";
import type { QwikManifest } from "@qwik.dev/core/optimizer";
import {
type RenderToStreamOptions,
getQwikLoaderScript,
renderToStream
} from "@builder.io/qwik/server";
} from "@qwik.dev/core/server";
import type { SSRResult } from "astro";

const isQwikLoaderAddedMap = new WeakMap<SSRResult, boolean>();
Expand Down Expand Up @@ -103,7 +103,7 @@ export async function renderToStaticMarkup(
include: false
},
stream: {
write: (chunk) => {
write: (chunk: string) => {
html += chunk;
}
}
Expand Down Expand Up @@ -180,7 +180,7 @@ export async function renderToStaticMarkup(
renderToStreamOpts.containerAttributes!["q-astro-marker"] = "first";
}

await renderToStream(qwikComponentJSX, renderToStreamOpts);
await renderToStream(qwikComponentJSX as JSXOutput, renderToStreamOpts);

// we only want to add the preloader script if the container is the last one
if (isDev && devUrls.size > 0) {
Expand Down
9 changes: 5 additions & 4 deletions libs/qwikdev-astro/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import fs from "node:fs";
import { join } from "node:path";
import { qwikVite, symbolMapper } from "@builder.io/qwik/optimizer";
import type {
QwikManifest,
QwikVitePluginOptions,
SymbolMapperFn
} from "@builder.io/qwik/optimizer";
import { qwikVite, symbolMapper } from "@qwik.dev/core/optimizer";
import type { AstroConfig, AstroIntegration } from "astro";
import { createResolver, defineIntegration, watchDirectory } from "astro-integration-kit";
import { z } from "astro/zod";
Expand Down Expand Up @@ -134,9 +134,10 @@ export default defineIntegration({
resolveEntrypoints();
},
async resolveId(id, importer) {
const isFromAstro = importer?.endsWith('.astro') || importer?.endsWith('.mdx');
const isFromTrackedFile = potentialEntries.has(importer ?? '');

const isFromAstro =
importer?.endsWith(".astro") || importer?.endsWith(".mdx");
const isFromTrackedFile = potentialEntries.has(importer ?? "");

if (!isFromAstro && !isFromTrackedFile) {
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion libs/qwikdev-astro/src/root.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Slot, component$ } from "@builder.io/qwik";
import { Slot, component$ } from "@qwik.dev/core";

export default component$(() => {
return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { component$, useSignal } from "@builder.io/qwik";
import { component$, useSignal } from "@qwik.dev/core";

export const Counter = component$(() => {
const count = useSignal(0);
Expand Down
Loading
Loading