vike-react 0.2.0 → 0.2.1

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/README.md CHANGED
@@ -5,7 +5,8 @@
5
5
 
6
6
  # `vike-react`
7
7
 
8
- React integration for [Vike](https://github.com/brillout/vite-plugin-ssr/issues/736).
8
+ React integration for [Vike](https://github.com/brillout/vite-plugin-ssr/issues/736) (using the
9
+ [V1 design](https://vite-plugin-ssr.com/migration/v1-design)).
9
10
 
10
11
  > For integrations with Vue and Solid, see the other [`vike-*` packages](https://vite-plugin-ssr.com/vike-packages).
11
12
 
@@ -35,6 +35,8 @@ import type { Component } from './types';
35
35
  declare global {
36
36
  namespace VikePackages {
37
37
  interface ConfigVikeReact {
38
+ /** The page's root React component */
39
+ Page?: Component;
38
40
  /** React element rendered and appended into <head></head> */
39
41
  Head?: Component;
40
42
  /** A component, usually common to several pages, that wraps the root component `Page` */
@@ -1,10 +1,43 @@
1
1
  export { PageContextProvider };
2
2
  export { usePageContext };
3
3
  import React from 'react';
4
- import { PageContext } from './types';
4
+ import type { PageContext } from 'vite-plugin-ssr/types';
5
5
  declare function PageContextProvider({ pageContext, children }: {
6
6
  pageContext: PageContext;
7
7
  children: React.ReactNode;
8
8
  }): JSX.Element;
9
9
  /** Access the pageContext from any React component */
10
- declare function usePageContext(): PageContext;
10
+ declare function usePageContext(): (Partial<{
11
+ Page: unknown;
12
+ routeParams: Record<string, string>;
13
+ config: import("vite-plugin-ssr/dist/esm/shared/page-configs/Config/PageContextConfig.js").PageContextConfig;
14
+ configEntries: import("vite-plugin-ssr/dist/esm/shared/getPageFiles/getExports.js").ConfigEntries;
15
+ exports: Record<string, unknown>;
16
+ exportsAll: import("vite-plugin-ssr/dist/esm/shared/getPageFiles/getExports.js").ExportsAll;
17
+ urlOriginal: string;
18
+ is404: boolean | null;
19
+ isClientSideNavigation: boolean;
20
+ abortReason?: unknown;
21
+ abortStatusCode?: undefined;
22
+ errorWhileRendering?: unknown;
23
+ url: string;
24
+ pageExports: Record<string, unknown>;
25
+ }> & Pick<{
26
+ Page: unknown;
27
+ routeParams: Record<string, string>;
28
+ config: import("vite-plugin-ssr/dist/esm/shared/page-configs/Config/PageContextConfig.js").PageContextConfig;
29
+ configEntries: import("vite-plugin-ssr/dist/esm/shared/getPageFiles/getExports.js").ConfigEntries;
30
+ exports: Record<string, unknown>;
31
+ exportsAll: import("vite-plugin-ssr/dist/esm/shared/getPageFiles/getExports.js").ExportsAll;
32
+ urlOriginal: string;
33
+ is404: boolean | null;
34
+ isClientSideNavigation: boolean;
35
+ abortReason?: unknown;
36
+ abortStatusCode?: undefined;
37
+ errorWhileRendering?: unknown;
38
+ url: string;
39
+ pageExports: Record<string, unknown>;
40
+ }, "Page" | "pageExports" | "config" | "configEntries" | "exports" | "exportsAll" | "abortReason"> & {
41
+ isHydration: boolean;
42
+ isBackwardNavigation: boolean | null;
43
+ } & import("vite-plugin-ssr/dist/esm/shared/addUrlComputedProps.js").PageContextUrlComputedPropsClient & Vike.PageContext) | import("vite-plugin-ssr/dist/esm/shared/types.js").PageContextServer;
@@ -1,3 +1,3 @@
1
1
  export { getPageElement };
2
- import type { PageContext } from './types';
2
+ import type { PageContext } from 'vite-plugin-ssr/types';
3
3
  declare function getPageElement(pageContext: PageContext): JSX.Element;
@@ -1,3 +1,3 @@
1
1
  export default onRenderClient;
2
- import type { PageContextClient } from './types';
2
+ import type { PageContextClient } from 'vite-plugin-ssr/types';
3
3
  declare function onRenderClient(pageContext: PageContextClient): Promise<void>;
@@ -1,5 +1,5 @@
1
1
  export default onRenderHtml;
2
- import type { PageContextServer } from './types';
3
- declare function onRenderHtml(pageContext: PageContextServer): Promise<{
2
+ import type { PageContext } from 'vite-plugin-ssr/types';
3
+ declare function onRenderHtml(pageContext: PageContext): Promise<{
4
4
  documentHtml: import("vite-plugin-ssr/dist/esm/node/runtime/html/renderHtml.js").TemplateWrapped;
5
5
  }>;
@@ -1,18 +1,11 @@
1
- export type { PageContextServer };
2
- export type { PageContextClient };
3
- export type { PageContext };
4
- export type { PageProps };
5
- export type { Page };
6
1
  export type { Component };
7
- import type { PageContextBuiltInServer, PageContextBuiltInClientWithClientRouting as PageContextBuiltInClient } from 'vite-plugin-ssr/types';
8
2
  import type { ReactElement } from 'react';
9
3
  type Component = (props: any) => ReactElement;
10
- type Page = (pageProps: PageProps) => ReactElement;
11
- type PageProps = Record<string, unknown>;
12
- export type PageContextCommon = {
13
- Page: Page;
14
- pageProps?: PageProps;
15
- };
16
- type PageContextServer = PageContextBuiltInServer<Page> & PageContextCommon;
17
- type PageContextClient = PageContextBuiltInClient<Page> & PageContextCommon;
18
- type PageContext = PageContextClient | PageContextServer;
4
+ declare global {
5
+ namespace Vike {
6
+ interface PageContext {
7
+ Page: Component;
8
+ pageProps: Record<string, unknown>;
9
+ }
10
+ }
11
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vike-react",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "main": "./dist/renderer/+config.js",
6
6
  "types": "./dist/renderer/+config.d.ts",
@@ -14,22 +14,24 @@
14
14
  "scripts": {
15
15
  "dev": "tsc --watch",
16
16
  "build": "rm -rf dist/ && tsc",
17
- "release": "release-me patch"
17
+ "release": "release-me patch",
18
+ "release:commit": "release-me commit"
18
19
  },
19
20
  "peerDependencies": {
20
21
  "react": "18.x.x",
21
22
  "react-dom": "18.x.x",
22
23
  "vite": "^4.3.8",
23
- "vite-plugin-ssr": "^0.4.141"
24
+ "vite-plugin-ssr": "^0.4.142"
24
25
  },
25
26
  "devDependencies": {
26
- "@brillout/release-me": "^0.1.3",
27
+ "@brillout/release-me": "^0.1.7",
27
28
  "@types/node": "^18.15.3",
28
29
  "@types/react": "^18.0.8",
29
30
  "@types/react-dom": "^18.0.3",
30
31
  "react": "^18.0.0",
31
32
  "react-dom": "^18.0.0",
32
- "typescript": "^5.0.2"
33
+ "typescript": "^5.0.2",
34
+ "vite-plugin-ssr": "^0.4.142"
33
35
  },
34
36
  "typesVersions": {
35
37
  "*": {