Skip to content

Commit f83d82d

Browse files
maiieulthejacksheltoncwoolumgithub-actions[bot]
authored
move to SSG adapter (#941)
* allow people to pass handlers to modal close * moving to the static adapter * Preview (#940) * chore(website): bump to qwik 1.7.3 + entry files output (#926) * Revert-new-sw (#927) * Revert "change to new sw impl" This reverts commit 3081504. * chore(website): charSet -> charset in root.tsx * Remove-import-meta-glob-eager-true (#928) * chore(website): remove import.meta.glob eager true * chore(website): comment out vite config trick to se chunk names * chore(pkg.pr.new): remove 0.0.9 flag (#921) * chore(qwik-themes): move code internally + signal implementation (#922) * chore(qwik-themes): move code internally under _state folder * chore(themes): linting * fix(themes): use signals instead of stores * chore(themes provider): useVisibleTask to useOnWindow * chore(themes): move to qwik-ui/themes * Tooltip Beta (#934) * feat(tooltip): implement tooltip to beta phase * fix(tooltip): small tweaks to the tooltip state * fix: remove animations form tooltip docs and fix placement example * feat(tooltip): implement onOpenChange$ * chore: fix changeset type * test: update placement test to remove loop * fix: remove breaking examples and tooltip route * fix: checkbox tests preventing us from opening pw * refactor: deprecate popover hover prop in favor of tooltip * latest --------- Co-authored-by: Christopher Woolum <[email protected]> * fix: comment out bundle issue when changing user pref (#935) * chore(website): disable qwikVite linter to speed up preview and builds (#936) * Inline comp docs (#931) * allow people to pass handlers to modal close * docs: improve contributor guide * docs: mention inline components * add utils changeset (#937) * Version Packages (#917) Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> * chore(/themes): turn visible task to strategy:document-idle (#938) * chore(/themes): turn visible task to strategy:document-idle * fix(themes): add timeout to themeSig assignment to localstorage * fix(themes): augment timeout to themeSig assignment to localstorage * fix(website): remove js execution on load by assigning themes sig on click (#939) * feat: static adapter * use improved shiki node version now that we're on static --------- Co-authored-by: Maïeul <[email protected]> Co-authored-by: Christopher Woolum <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: maiieul <[email protected]> * fix(website): click on copy code --------- Co-authored-by: jack shelton <[email protected]> Co-authored-by: Jack Shelton <[email protected]> Co-authored-by: Christopher Woolum <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent ca70496 commit f83d82d

File tree

6 files changed

+49
-46
lines changed

6 files changed

+49
-46
lines changed

apps/website/README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ Inside your project, you'll see the following directory structure:
3535
Use the `pnpm qwik add` command to add additional integrations. Some examples of integrations include: Cloudflare, Netlify or Express server, and the [Static Site Generator (SSG)](https://qwik.builder.io/qwikcity/static-site-generation/static-site-config/).
3636

3737
```shell
38-
pnpm qwik add # or `yarn qwik add`
38+
pnpm qwik add # or `pnpm qwik add`
3939
```
4040

4141
## Development
4242

4343
Development mode uses [Vite's development server](https://vitejs.dev/). During development, the `dev` command will server-side render (SSR) the output.
4444

4545
```shell
46-
npm start # or `yarn start`
46+
npm start # or `pnpm start`
4747
```
4848

4949
> Note: during dev mode, Vite may request a significant number of `.js` files. This does not represent a Qwik production build.
@@ -53,13 +53,19 @@ npm start # or `yarn start`
5353
The preview command will create a production build of the client modules, a production build of `src/entry.preview.tsx`, and run a local server. The preview server is only for convenience to locally preview a production build, and it should not be used as a production server.
5454

5555
```shell
56-
pnpm preview # or `yarn preview`
56+
pnpm preview # or `pnpm preview`
5757
```
5858

5959
## Production
6060

6161
The production build will generate client and server modules by running both client and server build commands. Additionally, the build command will use Typescript to run a type check on the source code.
6262

6363
```shell
64-
pnpm build # or `yarn build`
64+
pnpm build # or `pnpm build`
65+
```
66+
67+
## Static Site Generator (Node.js)
68+
69+
```shell
70+
pnpm build.server
6571
```

apps/website/adapters/cloudflare-pages/vite.config.ts

Lines changed: 0 additions & 22 deletions
This file was deleted.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { staticAdapter } from '@builder.io/qwik-city/adapters/static/vite';
2+
import { extendConfig } from '@builder.io/qwik-city/vite';
3+
import baseConfig from '../../vite.config';
4+
5+
export default extendConfig(baseConfig, () => {
6+
return {
7+
build: {
8+
ssr: true,
9+
rollupOptions: {
10+
input: ['@qwik-city-plan'],
11+
},
12+
},
13+
plugins: [
14+
staticAdapter({
15+
origin: 'https://qwikui.com',
16+
}),
17+
],
18+
};
19+
});

apps/website/project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"mode": "production"
4848
},
4949
"production": {
50-
"configFile": "apps/website/adapters/cloudflare-pages/vite.config.ts"
50+
"configFile": "apps/website/adapters/static/vite.config.ts"
5151
}
5252
},
5353
"dependsOn": []

apps/website/src/components/highlight/highlight.tsx

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,12 @@
1-
import { ClassList, PropsOf, component$, useSignal, useTask$ } from '@builder.io/qwik';
1+
import { ClassList, PropsOf, component$, useSignal, useTask$, $ } from '@builder.io/qwik';
22
import { CodeCopy } from '../code-copy/code-copy';
33
import { cn } from '@qwik-ui/utils';
4-
import poimandres from 'shiki/themes/poimandres.mjs';
5-
import html from 'shiki/langs/html.mjs';
6-
import css from 'shiki/langs/css.mjs';
7-
import tsx from 'shiki/langs/tsx.mjs';
8-
import { createHighlighterCore, BundledLanguage } from 'shiki/index.mjs';
9-
10-
// Create a single highlighter instance
11-
const highlighterPromise = createHighlighterCore({
12-
themes: [poimandres],
13-
langs: [html, css, tsx],
14-
loadWasm: import('shiki/wasm'),
15-
});
4+
import { codeToHtml } from 'shiki';
165

176
export type HighlightProps = PropsOf<'div'> & {
187
code: string;
198
copyCodeClass?: ClassList;
20-
language?: BundledLanguage;
9+
language?: 'tsx' | 'html' | 'css';
2110
splitCommentStart?: string;
2211
splitCommentEnd?: string;
2312
};
@@ -33,26 +22,32 @@ export const Highlight = component$(
3322
}: HighlightProps) => {
3423
const codeSig = useSignal('');
3524

36-
useTask$(async ({ track }) => {
37-
track(() => code);
25+
const addShiki$ = $(async () => {
3826
let modifiedCode: string = code;
3927

4028
let partsOfCode = modifiedCode.split(splitCommentStart);
29+
4130
if (partsOfCode.length > 1) {
4231
modifiedCode = partsOfCode[1];
4332
}
4433

4534
partsOfCode = modifiedCode.split(splitCommentEnd);
35+
4636
if (partsOfCode.length > 1) {
4737
modifiedCode = partsOfCode[0];
4838
}
4939

50-
const highlighter = await highlighterPromise;
51-
const str = highlighter.codeToHtml(modifiedCode, {
40+
const str = await codeToHtml(modifiedCode, {
5241
lang: language,
5342
theme: 'poimandres',
5443
});
55-
codeSig.value = str;
44+
45+
codeSig.value = str.toString();
46+
});
47+
48+
useTask$(async ({ track }) => {
49+
track(() => code);
50+
await addShiki$();
5651
});
5752

5853
return (

apps/website/vite.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,5 +105,10 @@ export default defineConfig(async () => {
105105
'Cache-Control': 'public, max-age=600',
106106
},
107107
},
108+
optimizeDeps: {
109+
// Put problematic deps that break bundling here, mostly those with binaries.
110+
// For example ['better-sqlite3'] if you use that in server functions.
111+
exclude: ['shiki'],
112+
},
108113
};
109114
});

0 commit comments

Comments
 (0)