rwsdk 0.3.5 → 0.3.6
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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const resolveSSRValue: <Value>(clientReference: Value) => Promise<Value>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ssrGetModuleExport } from "rwsdk/__ssr_bridge";
|
|
2
|
+
export const resolveSSRValue = (clientReference) => {
|
|
3
|
+
const id = clientReference.__rwsdk_clientReferenceId;
|
|
4
|
+
if (!id) {
|
|
5
|
+
throw new Error("RWSDK: Client reference is not a client reference");
|
|
6
|
+
}
|
|
7
|
+
return ssrGetModuleExport(id);
|
|
8
|
+
};
|
|
@@ -13,6 +13,7 @@ export function registerClientReference(id, exportName, value) {
|
|
|
13
13
|
? value
|
|
14
14
|
: () => null;
|
|
15
15
|
const reference = baseRegisterClientReference({}, id, exportName);
|
|
16
|
+
reference.__rwsdk_clientReferenceId = `${id}#${exportName}`;
|
|
16
17
|
const finalDescriptors = Object.getOwnPropertyDescriptors(reference);
|
|
17
18
|
const idDescriptor = finalDescriptors.$$id;
|
|
18
19
|
if (idDescriptor && idDescriptor.hasOwnProperty("value")) {
|