create-vike 0.0.306 → 0.0.308
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.testRun.ts +4 -5
- package/boilerplate-react/package.json +1 -1
- package/boilerplate-react/server/index.js +1 -1
- package/boilerplate-react/vite.config.js +2 -2
- package/boilerplate-react-ts/.eslintrc.cjs +2 -1
- package/boilerplate-react-ts/package.json +1 -1
- package/boilerplate-react-ts/renderer/types.ts +22 -24
- package/boilerplate-react-ts/server/index.ts +1 -1
- package/boilerplate-react-ts/vite.config.ts +2 -2
- package/boilerplate-vue/package.json +1 -1
- package/boilerplate-vue/server/index.js +1 -1
- package/boilerplate-vue/vite.config.js +2 -2
- package/boilerplate-vue-ts/package.json +1 -1
- package/boilerplate-vue-ts/renderer/types.ts +25 -26
- package/boilerplate-vue-ts/server/index.ts +1 -1
- package/boilerplate-vue-ts/vite.config.ts +2 -2
- package/package.json +1 -1
package/.testRun.ts
CHANGED
|
@@ -27,10 +27,11 @@ function testRun(
|
|
|
27
27
|
isSPA?: true
|
|
28
28
|
}
|
|
29
29
|
) {
|
|
30
|
-
run(cmd)
|
|
31
|
-
|
|
32
30
|
const isProd = cmd === 'npm run prod' || cmd === 'npm run preview'
|
|
33
31
|
const isDev = !isProd
|
|
32
|
+
const testHMR = isDev && (uiFramewok === 'react' || uiFramewok === 'vue')
|
|
33
|
+
|
|
34
|
+
run(cmd, { isFlaky: testHMR })
|
|
34
35
|
|
|
35
36
|
test('page content is rendered to HTML', async () => {
|
|
36
37
|
const html = await fetchHtml('/')
|
|
@@ -56,7 +57,7 @@ function testRun(
|
|
|
56
57
|
})
|
|
57
58
|
})
|
|
58
59
|
|
|
59
|
-
if (
|
|
60
|
+
if (testHMR) {
|
|
60
61
|
test('HMR', async () => {
|
|
61
62
|
const file = (() => {
|
|
62
63
|
if (uiFramewok === 'vue') {
|
|
@@ -73,13 +74,11 @@ function testRun(
|
|
|
73
74
|
})()
|
|
74
75
|
expect(await page.textContent('button')).toBe('Counter 1')
|
|
75
76
|
expect(await page.textContent('h1')).toBe('Welcome')
|
|
76
|
-
await sleep(2 * 1000) // timeout can probably be decreased
|
|
77
77
|
editFile(file, (s) => s.replace('Welcome', 'Welcome !'))
|
|
78
78
|
await autoRetry(async () => {
|
|
79
79
|
expect(await page.textContent('h1')).toBe('Welcome !')
|
|
80
80
|
})
|
|
81
81
|
expect(await page.textContent('button')).toBe('Counter 1')
|
|
82
|
-
await sleep(300)
|
|
83
82
|
editFileRevert()
|
|
84
83
|
await autoRetry(async () => {
|
|
85
84
|
expect(await page.textContent('h1')).toBe('Welcome')
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
// - See vavite + Vike examples at https://github.com/cyco130/vavite/tree/main/examples
|
|
10
10
|
// - vite-node (https://github.com/antfu/vite-node)
|
|
11
11
|
// - HatTip (https://github.com/hattipjs/hattip)
|
|
12
|
-
// - You can use Bati (https://batijs.github.io/) to scaffold a
|
|
12
|
+
// - You can use Bati (https://batijs.github.io/) to scaffold a Vike + HatTip app. Note that Bati generates apps that use the V1 design (https://vike.dev/migration/v1-design) and Vike packages (https://vike.dev/vike-packages)
|
|
13
13
|
|
|
14
14
|
import express from 'express'
|
|
15
15
|
import compression from 'compression'
|
|
@@ -1,35 +1,33 @@
|
|
|
1
|
-
export type {
|
|
2
|
-
|
|
3
|
-
export type { PageContext }
|
|
4
|
-
export type { PageProps }
|
|
5
|
-
|
|
6
|
-
import type {
|
|
7
|
-
PageContextBuiltInServer,
|
|
1
|
+
export type {
|
|
2
|
+
PageContextServer,
|
|
8
3
|
/*
|
|
9
4
|
// When using Client Routing https://vike.dev/clientRouting
|
|
10
|
-
|
|
5
|
+
PageContextClient,
|
|
6
|
+
PageContext,
|
|
11
7
|
/*/
|
|
12
8
|
// When using Server Routing
|
|
13
|
-
|
|
9
|
+
PageContextClientWithServerRouting as PageContextClient,
|
|
10
|
+
PageContextWithServerRouting as PageContext
|
|
14
11
|
//*/
|
|
15
12
|
} from 'vike/types'
|
|
13
|
+
export type { PageProps }
|
|
16
14
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
15
|
+
// https://vike.dev/pageContext#typescript
|
|
16
|
+
declare global {
|
|
17
|
+
namespace Vike {
|
|
18
|
+
interface PageContext {
|
|
19
|
+
Page: Page
|
|
20
|
+
pageProps?: PageProps
|
|
21
|
+
urlPathname: string
|
|
22
|
+
exports: {
|
|
23
|
+
documentProps?: {
|
|
24
|
+
title?: string
|
|
25
|
+
description?: string
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
type
|
|
33
|
-
type
|
|
34
|
-
|
|
35
|
-
type PageContext = PageContextClient | PageContextServer
|
|
32
|
+
type Page = (pageProps: PageProps) => React.ReactElement
|
|
33
|
+
type PageProps = Record<string, unknown>
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
// - See vavite + Vike examples at https://github.com/cyco130/vavite/tree/main/examples
|
|
10
10
|
// - vite-node (https://github.com/antfu/vite-node)
|
|
11
11
|
// - HatTip (https://github.com/hattipjs/hattip)
|
|
12
|
-
// - You can use Bati (https://batijs.github.io/) to scaffold a
|
|
12
|
+
// - You can use Bati (https://batijs.github.io/) to scaffold a Vike + HatTip app. Note that Bati generates apps that use the V1 design (https://vike.dev/migration/v1-design) and Vike packages (https://vike.dev/vike-packages)
|
|
13
13
|
|
|
14
14
|
import express from 'express'
|
|
15
15
|
import compression from 'compression'
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import react from '@vitejs/plugin-react'
|
|
2
|
-
import
|
|
2
|
+
import vike from 'vike/plugin'
|
|
3
3
|
import { UserConfig } from 'vite'
|
|
4
4
|
|
|
5
5
|
const config: UserConfig = {
|
|
6
|
-
plugins: [react(),
|
|
6
|
+
plugins: [react(), vike()]
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export default config
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
// - See vavite + Vike examples at https://github.com/cyco130/vavite/tree/main/examples
|
|
10
10
|
// - vite-node (https://github.com/antfu/vite-node)
|
|
11
11
|
// - HatTip (https://github.com/hattipjs/hattip)
|
|
12
|
-
// - You can use Bati (https://batijs.github.io/) to scaffold a
|
|
12
|
+
// - You can use Bati (https://batijs.github.io/) to scaffold a Vike + HatTip app. Note that Bati generates apps that use the V1 design (https://vike.dev/migration/v1-design) and Vike packages (https://vike.dev/vike-packages)
|
|
13
13
|
|
|
14
14
|
import express from 'express'
|
|
15
15
|
import compression from 'compression'
|
|
@@ -1,38 +1,37 @@
|
|
|
1
|
-
export type {
|
|
2
|
-
|
|
3
|
-
export type { PageContext }
|
|
4
|
-
export type { PageProps }
|
|
5
|
-
export type { Component }
|
|
6
|
-
|
|
7
|
-
import type {
|
|
8
|
-
PageContextBuiltInServer,
|
|
1
|
+
export type {
|
|
2
|
+
PageContextServer,
|
|
9
3
|
/*
|
|
10
4
|
// When using Client Routing https://vike.dev/clientRouting
|
|
11
|
-
|
|
5
|
+
PageContextClient,
|
|
6
|
+
PageContext,
|
|
12
7
|
/*/
|
|
13
8
|
// When using Server Routing
|
|
14
|
-
|
|
9
|
+
PageContextClientWithServerRouting as PageContextClient,
|
|
10
|
+
PageContextWithServerRouting as PageContext
|
|
15
11
|
//*/
|
|
16
12
|
} from 'vike/types'
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
type Component = ComponentPublicInstance // https://stackoverflow.com/questions/63985658/how-to-type-vue-instance-out-of-definecomponent-in-vue-3/63986086#63986086
|
|
20
|
-
type Page = Component
|
|
21
|
-
type PageProps = {}
|
|
13
|
+
export type { PageProps }
|
|
14
|
+
export type { Component }
|
|
22
15
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
16
|
+
// https://vike.dev/pageContext#typescript
|
|
17
|
+
declare global {
|
|
18
|
+
namespace Vike {
|
|
19
|
+
interface PageContext {
|
|
20
|
+
Page: Page
|
|
21
|
+
pageProps?: PageProps
|
|
22
|
+
urlPathname: string
|
|
23
|
+
exports: {
|
|
24
|
+
documentProps?: {
|
|
25
|
+
title?: string
|
|
26
|
+
description?: string
|
|
27
|
+
}
|
|
28
|
+
}
|
|
31
29
|
}
|
|
32
30
|
}
|
|
33
31
|
}
|
|
34
32
|
|
|
35
|
-
type
|
|
36
|
-
type PageContextClient = PageContextBuiltInClient<Page> & PageContextCustom
|
|
33
|
+
import type { ComponentPublicInstance } from 'vue'
|
|
37
34
|
|
|
38
|
-
type
|
|
35
|
+
type Component = ComponentPublicInstance // https://stackoverflow.com/questions/63985658/how-to-type-vue-instance-out-of-definecomponent-in-vue-3/63986086#63986086
|
|
36
|
+
type Page = Component
|
|
37
|
+
type PageProps = {}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
// - See vavite + Vike examples at https://github.com/cyco130/vavite/tree/main/examples
|
|
10
10
|
// - vite-node (https://github.com/antfu/vite-node)
|
|
11
11
|
// - HatTip (https://github.com/hattipjs/hattip)
|
|
12
|
-
// - You can use Bati (https://batijs.github.io/) to scaffold a
|
|
12
|
+
// - You can use Bati (https://batijs.github.io/) to scaffold a Vike + HatTip app. Note that Bati generates apps that use the V1 design (https://vike.dev/migration/v1-design) and Vike packages (https://vike.dev/vike-packages)
|
|
13
13
|
|
|
14
14
|
import express from 'express'
|
|
15
15
|
import compression from 'compression'
|