Skip to content

Commit 448193b

Browse files
what we have w/ symbol mapper
1 parent 9527b38 commit 448193b

File tree

5 files changed

+15
-14
lines changed

5 files changed

+15
-14
lines changed

apps/node-demo/astro.config.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { defineConfig } from "astro/config";
22

33
import node from "@astrojs/node";
4-
import react from "@astrojs/react";
54
import qwik from "@qwikdev/astro";
65

76
// https://astro.build/config
@@ -11,5 +10,5 @@ export default defineConfig({
1110
mode: "standalone"
1211
}),
1312

14-
integrations: [qwik({ include: "**/qwik/*" }), react({ include: "**/react/*" })]
13+
integrations: [qwik({ include: "**/qwik/*" })]
1514
});

apps/node-demo/src/pages/index.astro

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
---
2-
import { ViewTransitions } from "astro:transitions";
32
import { Counter } from "@components/qwik/counter";
43
import { SayHi } from "@components/qwik/say-hi";
54
---
@@ -11,7 +10,6 @@ import { SayHi } from "@components/qwik/say-hi";
1110
<meta name="viewport" content="width=device-width" />
1211
<meta name="generator" content={Astro.generator} />
1312
<title>Astro</title>
14-
<ViewTransitions />
1513
</head>
1614
<body>
1715
<div style={{ height: '1000px' }}>

libs/qwikdev-astro/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
"main": "./src/index.ts",
2626
"exports": {
2727
".": "./src/index.ts",
28-
"./package.json": "./package.json"
28+
"./package.json": "./package.json",
29+
"./server": "./server.ts"
2930
},
3031
"files": ["src", "src/index.ts", "server.ts", "env.d.ts"],
3132
"keywords": [

libs/qwikdev-astro/server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
PrefetchServiceWorker,
77
jsx
88
} from "@builder.io/qwik";
9-
import { symbolMapper, type QwikManifest } from '@builder.io/qwik/optimizer';
109
import { isDev } from "@builder.io/qwik/build";
1110
import { getQwikLoaderScript, renderToString } from "@builder.io/qwik/server";
1211
import { manifest } from "@qwik-client-manifest";
@@ -99,6 +98,7 @@ export async function renderToStaticMarkup(
9998

10099
const base = (props["q:base"] || process.env.Q_BASE) as string;
101100

101+
102102
// TODO: `jsx` must correctly be imported.
103103
// Currently the vite loads `core.mjs` and `core.prod.mjs` at the same time and this causes issues.
104104
// WORKAROUND: ensure that `npm postinstall` is run to patch the `@builder.io/qwik/package.json` file.
@@ -107,7 +107,7 @@ export async function renderToStaticMarkup(
107107
containerTagName: "div",
108108
containerAttributes: { style: "display: contents" },
109109
...(isDev
110-
? { manifest: {} as QwikManifest, symbolMapper }
110+
? { manifest: {} as QwikManifest, symbolMapper: globalThis._mymapper }
111111
: { manifest }),
112112
qwikLoader: { include: "never" }
113113
});

libs/qwikdev-astro/src/index.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ import { z } from "astro/zod";
1212
import ts from "typescript";
1313

1414
import { qwikVite } from "@builder.io/qwik/optimizer";
15-
import { createResolver, defineIntegration } from "astro-integration-kit";
15+
import { defineIntegration } from "astro-integration-kit";
1616
import { watchIntegrationPlugin } from "astro-integration-kit/plugins";
17+
import { symbolMapper, type QwikManifest } from '@builder.io/qwik/optimizer';
1718

1819
import { type InlineConfig, build, createFilter } from "vite";
1920
import tsconfigPaths from "vite-tsconfig-paths";
@@ -47,7 +48,6 @@ export default defineIntegration({
4748

4849
const tempDir = join(`tmp-${hash()}`);
4950
const filter = createFilter(options.include, options.exclude);
50-
const { resolve } = createResolver(import.meta.url);
5151

5252
return {
5353
"astro:config:setup": async ({
@@ -56,10 +56,9 @@ export default defineIntegration({
5656
config,
5757
command,
5858
injectScript,
59-
watchIntegration
6059
}) => {
61-
// Integration HMR
62-
watchIntegration(resolve());
60+
// // Integration HMR
61+
// watchIntegration(resolve());
6362

6463
// Because Astro uses the same port for both dev and preview, we need to unregister the SW in order to avoid a stale SW in dev mode.
6564
if (command === "dev") {
@@ -80,12 +79,14 @@ export default defineIntegration({
8079
astroConfig.srcDir.pathname
8180
);
8281

82+
83+
8384
entrypoints = getQwikEntrypoints(srcDir, filter);
8485

8586
if ((await entrypoints).length !== 0) {
8687
addRenderer({
8788
name: "@qwikdev/astro",
88-
serverEntrypoint: resolve("../server.ts")
89+
serverEntrypoint: "@qwikdev/astro/server"
8990
});
9091

9192
// Update the global dist directory
@@ -107,8 +108,10 @@ export default defineIntegration({
107108
},
108109

109110
plugins: [
111+
{name:"grabSymbolMapper", configResolved() { globalThis._mymapper = symbolMapper }},
110112
qwikVite({
111113
/* user passed include & exclude config (to use multiple JSX frameworks) */
114+
debug: true,
112115
fileFilter: (id: string, hook: string) => {
113116
if (hook === "transform" && !filter(id)) {
114117
return false;
@@ -127,7 +130,7 @@ export default defineIntegration({
127130
input: await entrypoints
128131
},
129132
ssr: {
130-
input: resolve("../server.ts")
133+
input: "@qwikdev/astro/server"
131134
}
132135
}),
133136
tsconfigPaths(),

0 commit comments

Comments
 (0)