create-vike
Advanced tools
Comparing version 0.0.341 to 0.0.342
@@ -33,3 +33,3 @@ { | ||
"typescript": "^5.3.3", | ||
"vike": "^0.4.176", | ||
"vike": "^0.4.177", | ||
"vite": "^5.0.10" | ||
@@ -36,0 +36,0 @@ }, |
@@ -24,3 +24,3 @@ { | ||
"sirv": "^2.0.3", | ||
"vike": "^0.4.176", | ||
"vike": "^0.4.177", | ||
"vite": "^5.0.10" | ||
@@ -27,0 +27,0 @@ }, |
@@ -5,3 +5,3 @@ // https://vike.dev/onRenderClient | ||
import ReactDOM from 'react-dom/client' | ||
import { PageLayout } from './PageLayout' | ||
import { Layout } from './Layout' | ||
import { getPageTitle } from './getPageTitle' | ||
@@ -21,5 +21,5 @@ | ||
const page = ( | ||
<PageLayout pageContext={pageContext}> | ||
<Layout pageContext={pageContext}> | ||
<Page /> | ||
</PageLayout> | ||
</Layout> | ||
) | ||
@@ -26,0 +26,0 @@ if (pageContext.isHydration) { |
@@ -5,3 +5,3 @@ // https://vike.dev/onRenderHtml | ||
import ReactDOMServer from 'react-dom/server' | ||
import { PageLayout } from './PageLayout' | ||
import { Layout } from './Layout' | ||
import { escapeInject, dangerouslySkipEscape } from 'vike/server' | ||
@@ -20,5 +20,5 @@ import logoUrl from './logo.svg' | ||
const pageHtml = ReactDOMServer.renderToString( | ||
<PageLayout pageContext={pageContext}> | ||
<Layout pageContext={pageContext}> | ||
<Page /> | ||
</PageLayout> | ||
</Layout> | ||
) | ||
@@ -25,0 +25,0 @@ |
@@ -24,3 +24,3 @@ { | ||
"typescript": "^5.3.3", | ||
"vike": "^0.4.176", | ||
"vike": "^0.4.177", | ||
"vite": "^5.0.10", | ||
@@ -27,0 +27,0 @@ "vue": "^3.3.10", |
// https://vike.dev/onRenderClient | ||
export { onRenderClient } | ||
import { createApp } from './app' | ||
import { createVueApp } from './createVueApp' | ||
import { getPageTitle } from './getPageTitle' | ||
import type { OnRenderClientAsync } from 'vike/types' | ||
let app: ReturnType<typeof createApp> | ||
let app: ReturnType<typeof createVueApp> | ||
const onRenderClient: OnRenderClientAsync = async (pageContext): ReturnType<OnRenderClientAsync> => { | ||
@@ -15,3 +15,3 @@ // This onRenderClient() hook only supports SSR, see https://vike.dev/render-modes for how to modify onRenderClient() | ||
if (!app) { | ||
app = createApp(pageContext) | ||
app = createVueApp(pageContext) | ||
app.mount('#app') | ||
@@ -18,0 +18,0 @@ } else { |
@@ -7,3 +7,3 @@ // https://vike.dev/onRenderHtml | ||
import { escapeInject, dangerouslySkipEscape } from 'vike/server' | ||
import { createApp } from './app' | ||
import { createVueApp } from './createVueApp' | ||
import logoUrl from './logo.svg' | ||
@@ -18,3 +18,3 @@ import type { OnRenderHtmlAsync } from 'vike/types' | ||
const app = createApp(pageContext) | ||
const app = createVueApp(pageContext) | ||
@@ -21,0 +21,0 @@ const appHtml = await renderToString(app) |
@@ -6,15 +6,15 @@ // https://vike.dev/useData | ||
import { inject } from 'vue' | ||
import type { App } from 'vue' | ||
import type { App, InjectionKey, Ref } from 'vue' | ||
const key = Symbol() | ||
const key: InjectionKey<Ref<unknown>> = Symbol() | ||
/** https://vike.dev/useData */ | ||
function useData<Data>(): Data { | ||
function useData<Data>(): Ref<Data> { | ||
const data = inject(key) | ||
if (!data) throw new Error('setData() not called') | ||
return data as any | ||
return data as Ref<Data> | ||
} | ||
function setData(app: App, data: unknown): void { | ||
function setData(app: App, data: Ref<unknown>): void { | ||
app.provide(key, data) | ||
} |
@@ -6,9 +6,9 @@ // https://vike.dev/usePageContext | ||
import { inject } from 'vue' | ||
import type { App, InjectionKey } from 'vue' | ||
import type { App, InjectionKey, Ref } from 'vue' | ||
import type { PageContext } from 'vike/types' | ||
const key: InjectionKey<PageContext> = Symbol() | ||
const key: InjectionKey<Ref<PageContext>> = Symbol() | ||
/** https://vike.dev/usePageContext */ | ||
function usePageContext(): PageContext { | ||
function usePageContext(): Ref<PageContext> { | ||
const pageContext = inject(key) | ||
@@ -19,4 +19,4 @@ if (!pageContext) throw new Error('setPageContext() not called in parent') | ||
function setPageContext(app: App, pageContext: PageContext): void { | ||
function setPageContext(app: App, pageContext: Ref<PageContext>): void { | ||
app.provide(key, pageContext) | ||
} |
@@ -8,5 +8,1 @@ // Same as Object.assign() but with type inference | ||
} | ||
export function isObject(value: unknown): value is Record<string, unknown> { | ||
return typeof value === 'object' && value !== null | ||
} |
@@ -18,3 +18,3 @@ { | ||
"sirv": "^2.0.3", | ||
"vike": "^0.4.176", | ||
"vike": "^0.4.177", | ||
"vite": "^5.0.10", | ||
@@ -21,0 +21,0 @@ "vue": "^3.3.10" |
// https://vike.dev/onRenderClient | ||
export { onRenderClient } | ||
import { createApp } from './app' | ||
import { createVueApp } from './createVueApp' | ||
import { getPageTitle } from './getPageTitle' | ||
@@ -14,3 +14,3 @@ | ||
if (!app) { | ||
app = createApp(pageContext) | ||
app = createVueApp(pageContext) | ||
app.mount('#app') | ||
@@ -17,0 +17,0 @@ } else { |
@@ -6,3 +6,3 @@ // https://vike.dev/onRenderHtml | ||
import { escapeInject, dangerouslySkipEscape } from 'vike/server' | ||
import { createApp } from './app' | ||
import { createVueApp } from './createVueApp' | ||
import logoUrl from './logo.svg' | ||
@@ -16,3 +16,3 @@ import { getPageTitle } from './getPageTitle' | ||
const app = createApp(pageContext) | ||
const app = createVueApp(pageContext) | ||
@@ -19,0 +19,0 @@ const appHtml = await renderToString(app) |
{ | ||
"name": "create-vike", | ||
"version": "0.0.341", | ||
"version": "0.0.342", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "bin": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
110647
155
2298