vike-react 0.4.10 → 0.4.11

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.
@@ -6,5 +6,9 @@ declare function PageContextProvider({ pageContext, children }: {
6
6
  pageContext: PageContext;
7
7
  children: React.ReactNode;
8
8
  }): React.JSX.Element;
9
- /** Access the pageContext from any React component */
9
+ /**
10
+ * Access `pageContext` from any React component.
11
+ *
12
+ * https://vike.dev/usePageContext
13
+ */
10
14
  declare function usePageContext(): PageContext;
@@ -2,22 +2,20 @@ export { usePageContext };
2
2
  export { PageContextProvider };
3
3
  import React, { useContext } from 'react';
4
4
  import { getGlobalObject } from '../utils/getGlobalObject.js';
5
- import { assert } from '../utils/assert.js';
6
5
  const globalObject = getGlobalObject('PageContextProvider.ts', {
7
6
  reactContext: React.createContext(undefined)
8
7
  });
9
8
  function PageContextProvider({ pageContext, children }) {
10
- assert(pageContext);
11
9
  const { reactContext } = globalObject;
12
10
  return React.createElement(reactContext.Provider, { value: pageContext }, children);
13
11
  }
14
- /** Access the pageContext from any React component */
12
+ /**
13
+ * Access `pageContext` from any React component.
14
+ *
15
+ * https://vike.dev/usePageContext
16
+ */
15
17
  function usePageContext() {
16
18
  const { reactContext } = globalObject;
17
19
  const pageContext = useContext(reactContext);
18
- /* React throws an error upon wrong hook usage, so I guess a nice error message isn't needed? And I guess we can therefore assume and assert pageContext to have been provided? Let's see if users report back an assert() failure.
19
- if (!pageContext) throw new Error('<PageContextProvider> is needed for being able to use usePageContext()')
20
- */
21
- assert(pageContext);
22
20
  return pageContext;
23
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vike-react",
3
- "version": "0.4.10",
3
+ "version": "0.4.11",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "devDependencies": {
30
30
  "@biomejs/biome": "^1.6.4",
31
- "@brillout/release-me": "^0.3.4",
31
+ "@brillout/release-me": "^0.3.8",
32
32
  "@types/node": "^20.11.17",
33
33
  "@types/react": "^18.2.55",
34
34
  "@types/react-dom": "^18.2.19",
@@ -1 +0,0 @@
1
- export declare function assert(condition: unknown): asserts condition;
@@ -1,5 +0,0 @@
1
- export function assert(condition) {
2
- if (condition)
3
- return;
4
- throw new Error('You stumbled upon a vike-react bug. Go to https://github.com/vikejs/vike-react/issues/new and copy-paste this error. A maintainer will fix the bug (usually under 24 hours).');
5
- }