-
-
Notifications
You must be signed in to change notification settings - Fork 349
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
74 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,12 @@ | ||
import type { Config } from 'vike/types' | ||
import vikeReact from 'vike-react/config' | ||
|
||
export default { | ||
title: 'Big Playground', | ||
extends: [vikeReact], | ||
meta: { | ||
Head: { | ||
env: { server: true }, | ||
cumulative: true | ||
}, | ||
/* | ||
For supporting nested configs, is the following the only thing missing? | ||
```diff | ||
// /pages/some-page/+config.js | ||
export { | ||
- ['document.title']: 'Some Title' | ||
+ document: { | ||
+ title: 'Some Title' | ||
+ } | ||
} | ||
``` | ||
Work-in-progress: https://github.com/vikejs/vike/tree/brillout/feat/nested-configs | ||
*/ | ||
['document.title']: { | ||
env: { server: true, client: true } | ||
frontmatter: { | ||
env: { server: true } | ||
} | ||
} | ||
} satisfies Config | ||
|
||
declare global { | ||
namespace Vike { | ||
interface Config { | ||
['document.title']?: string | ||
frontmatter?: { | ||
title: string | ||
} | ||
Head?: () => JSX.Element | ||
} | ||
interface ConfigResolved { | ||
Head: (() => JSX.Element)[] | ||
} | ||
interface PageContext { | ||
Page?: any | ||
pageProps?: Record<string, unknown> | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import type { Config } from 'vike/types' | ||
|
||
export default { | ||
Page: 'import:./Page.jsx', | ||
['document.title']: 'Some title set by nested config' | ||
// Test: use import string instead of +Page file. | ||
// @ts-ignore I ain't sure whether import strings should be part of the official type. Probably so. | ||
Page: 'import:./Page.jsx' | ||
} satisfies Config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import type { Config } from 'vike/types' | ||
|
||
export default { | ||
// Instead of +route.js the route can be defined over +config.ts > export default { route } | ||
// Test: Route String defined over `+config.js > export default { route }` instead of `+route.js` | ||
route: '/markdown' | ||
} satisfies Config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import type { PageContext } from 'vike/types' | ||
|
||
export default function (pageContext: PageContext): string { | ||
const title = pageContext.config.frontmatter!.title | ||
return title | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
declare global { | ||
namespace Vike { | ||
interface Config { | ||
frontmatter?: { | ||
title: string | ||
} | ||
} | ||
} | ||
} | ||
|
||
export {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export default () => { | ||
const timestamp = new Date().getTime() | ||
return { timestamp } | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
Miscellaneous tests: | ||
- Import path strings such as `import:./onRenderClient.jsx`. (See `/renderer/+config.ts`.) | ||
- Side exports: being able to define a config as a "side export" in a `.md` file, such as frontmatter data. (See `export { frontmatter }` in `/pages/markdown-page/+Page.md`.) | ||
- Route String defined over `+config.js > export default { route }` instead of `+route.js`. (See `/pages/markdown-page/+config.ts`.) | ||
- ... | ||
Big playground for E2E testing a *lot* of things. | ||
|
||
Most tests should (eventually) live here. |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters