@hexclave/sc 1.0.3 → 1.0.5
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hexclave/sc",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"repository": "https://github.com/hexclave/hexclave",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./force-react-server": {
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"files": [
|
|
37
37
|
"README.md",
|
|
38
38
|
"dist",
|
|
39
|
+
"src",
|
|
39
40
|
"CHANGELOG.md",
|
|
40
41
|
"LICENSE"
|
|
41
42
|
],
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as def from "./index.default";
|
|
2
|
+
import * as reactServer from "./index.react-server";
|
|
3
|
+
|
|
4
|
+
export declare const cookies: typeof reactServer.cookies | typeof def.cookies;
|
|
5
|
+
export declare const headers: typeof reactServer.headers | typeof def.headers;
|
|
6
|
+
export declare const isReactServer: boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const isReactServer = true;
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
// In Next.js 15, the `next/headers` module returns async functions.
|
|
5
|
+
// Since we support both Next.js 14 and 15, we return a union of the two.
|
|
6
|
+
// TODO: Remove this once we drop support for Next.js 14, and replace it with `export { cookies, headers } from 'next/headers';`
|
|
7
|
+
// https://nextjs.org/blog/next-15#async-request-apis-breaking-change
|
|
8
|
+
import { cookies as nextCookies, headers as nextHeaders } from './next-static-analysis-workaround';
|
|
9
|
+
export const cookies = nextCookies as typeof nextCookies | ((...args: Parameters<typeof nextCookies>) => Promise<ReturnType<typeof nextCookies>>);
|
|
10
|
+
export const headers = nextHeaders as typeof nextHeaders | ((...args: Parameters<typeof nextHeaders>) => Promise<ReturnType<typeof nextHeaders>>);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Next statically analyzes the imports and ensures that the `next/headers` module is never imported on a client bundle.
|
|
2
|
+
//
|
|
3
|
+
// We know what we're doing though. We ensure at runtime that we never use the module unless we're on the server, so the
|
|
4
|
+
// static analysis is wrong.
|
|
5
|
+
//
|
|
6
|
+
// Fortunately, as a hack, we can get around it by importing them using the `export from` syntax, which the static
|
|
7
|
+
// analyzer does not detect, but Webpack is fine with it.
|
|
8
|
+
//
|
|
9
|
+
// So, we can use the export syntax here, and then import them normally in the main file.
|
|
10
|
+
|
|
11
|
+
export * from 'next/headers';
|