vike 0.4.229-commit-c3526d6 → 0.4.229-commit-847f1b6
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/dist/cjs/shared/getProxyForPublicUsage.js +3 -4
- package/dist/cjs/shared/hooks/execHook.js +10 -7
- package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/shared/getProxyForPublicUsage.js +3 -4
- package/dist/esm/shared/hooks/execHook.d.ts +1 -1
- package/dist/esm/shared/hooks/execHook.js +10 -7
- package/dist/esm/shared/preparePageContextForPublicUsage.d.ts +0 -3
- package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.js +1 -1
- package/package.json +1 -1
|
@@ -19,14 +19,13 @@ function getTrapGet(obj, objName, skipOnInternalProp, fallback) {
|
|
|
19
19
|
return function (_, prop) {
|
|
20
20
|
const propStr = String(prop);
|
|
21
21
|
if (prop === '_isProxyObject')
|
|
22
|
-
return
|
|
22
|
+
return true;
|
|
23
23
|
if (!skipOnInternalProp)
|
|
24
24
|
onInternalProp(propStr, objName);
|
|
25
|
-
if (fallback) {
|
|
25
|
+
if (fallback && !(prop in obj)) {
|
|
26
26
|
// Rudimentary flat pageContext implementation https://github.com/vikejs/vike/issues/1268
|
|
27
27
|
// Failed full-fledged implementation: https://github.com/vikejs/vike/pull/2458
|
|
28
|
-
|
|
29
|
-
return fallback(prop);
|
|
28
|
+
return fallback(prop);
|
|
30
29
|
}
|
|
31
30
|
const val = obj[prop];
|
|
32
31
|
onNotSerializable(propStr, val, objName);
|
|
@@ -115,7 +115,7 @@ function execHookAsync(hookFnCaller, hook, pageContextForPublicUsage) {
|
|
|
115
115
|
}, timeoutErr);
|
|
116
116
|
(async () => {
|
|
117
117
|
try {
|
|
118
|
-
|
|
118
|
+
providePageContextInternal(pageContextForPublicUsage);
|
|
119
119
|
const ret = await hookFnCaller();
|
|
120
120
|
resolve(ret);
|
|
121
121
|
}
|
|
@@ -130,7 +130,7 @@ function execHookAsync(hookFnCaller, hook, pageContextForPublicUsage) {
|
|
|
130
130
|
}
|
|
131
131
|
function execHookSync(hook, pageContext, preparePageContextForPublicUsage) {
|
|
132
132
|
const pageContextForPublicUsage = preparePageContextForPublicUsage(pageContext);
|
|
133
|
-
|
|
133
|
+
providePageContextInternal(pageContextForPublicUsage);
|
|
134
134
|
const hookReturn = hook.hookFn(pageContextForPublicUsage);
|
|
135
135
|
return { hookReturn };
|
|
136
136
|
}
|
|
@@ -145,8 +145,11 @@ function isNotDisabled(timeout) {
|
|
|
145
145
|
function getPageContext() {
|
|
146
146
|
const { pageContext } = globalObject;
|
|
147
147
|
if (!pageContext)
|
|
148
|
-
return
|
|
149
|
-
const pageContextForPublicUsage =
|
|
148
|
+
return null;
|
|
149
|
+
const pageContextForPublicUsage = pageContext._isProxyObject
|
|
150
|
+
? // providePageContext() is called on the user-land (e.g. it's called by `vike-{react,vue,solid}`) thus it's already a proxy
|
|
151
|
+
pageContext
|
|
152
|
+
: (0, preparePageContextForPublicUsage_js_1.preparePageContextForPublicUsage)(pageContext);
|
|
150
153
|
return pageContextForPublicUsage;
|
|
151
154
|
}
|
|
152
155
|
/**
|
|
@@ -155,9 +158,9 @@ function getPageContext() {
|
|
|
155
158
|
* https://vike.dev/getPageContext
|
|
156
159
|
*/
|
|
157
160
|
function providePageContext(pageContext) {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
+
providePageContextInternal(pageContext);
|
|
162
|
+
}
|
|
163
|
+
function providePageContextInternal(pageContext) {
|
|
161
164
|
globalObject.pageContext = pageContext;
|
|
162
165
|
// Promise.resolve() is quicker than process.nextTick() and setImmediate()
|
|
163
166
|
// https://stackoverflow.com/questions/67949576/process-nexttick-before-promise-resolve-then
|
|
@@ -17,14 +17,13 @@ function getTrapGet(obj, objName, skipOnInternalProp, fallback) {
|
|
|
17
17
|
return function (_, prop) {
|
|
18
18
|
const propStr = String(prop);
|
|
19
19
|
if (prop === '_isProxyObject')
|
|
20
|
-
return
|
|
20
|
+
return true;
|
|
21
21
|
if (!skipOnInternalProp)
|
|
22
22
|
onInternalProp(propStr, objName);
|
|
23
|
-
if (fallback) {
|
|
23
|
+
if (fallback && !(prop in obj)) {
|
|
24
24
|
// Rudimentary flat pageContext implementation https://github.com/vikejs/vike/issues/1268
|
|
25
25
|
// Failed full-fledged implementation: https://github.com/vikejs/vike/pull/2458
|
|
26
|
-
|
|
27
|
-
return fallback(prop);
|
|
26
|
+
return fallback(prop);
|
|
28
27
|
}
|
|
29
28
|
const val = obj[prop];
|
|
30
29
|
onNotSerializable(propStr, val, objName);
|
|
@@ -60,4 +60,4 @@ declare function getPageContext<PageContext = PageContextClient | PageContextSer
|
|
|
60
60
|
*
|
|
61
61
|
* https://vike.dev/getPageContext
|
|
62
62
|
*/
|
|
63
|
-
declare function providePageContext(pageContext: null |
|
|
63
|
+
declare function providePageContext(pageContext: null | PageContextClient | PageContextServer): void;
|
|
@@ -113,7 +113,7 @@ function execHookAsync(hookFnCaller, hook, pageContextForPublicUsage) {
|
|
|
113
113
|
}, timeoutErr);
|
|
114
114
|
(async () => {
|
|
115
115
|
try {
|
|
116
|
-
|
|
116
|
+
providePageContextInternal(pageContextForPublicUsage);
|
|
117
117
|
const ret = await hookFnCaller();
|
|
118
118
|
resolve(ret);
|
|
119
119
|
}
|
|
@@ -128,7 +128,7 @@ function execHookAsync(hookFnCaller, hook, pageContextForPublicUsage) {
|
|
|
128
128
|
}
|
|
129
129
|
function execHookSync(hook, pageContext, preparePageContextForPublicUsage) {
|
|
130
130
|
const pageContextForPublicUsage = preparePageContextForPublicUsage(pageContext);
|
|
131
|
-
|
|
131
|
+
providePageContextInternal(pageContextForPublicUsage);
|
|
132
132
|
const hookReturn = hook.hookFn(pageContextForPublicUsage);
|
|
133
133
|
return { hookReturn };
|
|
134
134
|
}
|
|
@@ -143,8 +143,11 @@ function isNotDisabled(timeout) {
|
|
|
143
143
|
function getPageContext() {
|
|
144
144
|
const { pageContext } = globalObject;
|
|
145
145
|
if (!pageContext)
|
|
146
|
-
return
|
|
147
|
-
const pageContextForPublicUsage =
|
|
146
|
+
return null;
|
|
147
|
+
const pageContextForPublicUsage = pageContext._isProxyObject
|
|
148
|
+
? // providePageContext() is called on the user-land (e.g. it's called by `vike-{react,vue,solid}`) thus it's already a proxy
|
|
149
|
+
pageContext
|
|
150
|
+
: preparePageContextForPublicUsage(pageContext);
|
|
148
151
|
return pageContextForPublicUsage;
|
|
149
152
|
}
|
|
150
153
|
/**
|
|
@@ -153,9 +156,9 @@ function getPageContext() {
|
|
|
153
156
|
* https://vike.dev/getPageContext
|
|
154
157
|
*/
|
|
155
158
|
function providePageContext(pageContext) {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
+
providePageContextInternal(pageContext);
|
|
160
|
+
}
|
|
161
|
+
function providePageContextInternal(pageContext) {
|
|
159
162
|
globalObject.pageContext = pageContext;
|
|
160
163
|
// Promise.resolve() is quicker than process.nextTick() and setImmediate()
|
|
161
164
|
// https://stackoverflow.com/questions/67949576/process-nexttick-before-promise-resolve-then
|
|
@@ -6,9 +6,6 @@ type PageContextPrepareMinimum = {
|
|
|
6
6
|
_isOriginalObject: true;
|
|
7
7
|
isPageContext: true;
|
|
8
8
|
_globalContext: GlobalContextPrepareMinimum;
|
|
9
|
-
_isProxyObject?: {
|
|
10
|
-
target: PageContextPrepareMinimum;
|
|
11
|
-
};
|
|
12
9
|
};
|
|
13
10
|
declare function preparePageContextForPublicUsage<PageContext extends PageContextPrepareMinimum>(pageContext: PageContext): PageContext;
|
|
14
11
|
declare function assertPropertyGetters(pageContext: Record<string, unknown>): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PROJECT_VERSION: "0.4.229-commit-
|
|
1
|
+
export declare const PROJECT_VERSION: "0.4.229-commit-847f1b6";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Automatically updated by @brillout/release-me
|
|
2
|
-
export const PROJECT_VERSION = '0.4.229-commit-
|
|
2
|
+
export const PROJECT_VERSION = '0.4.229-commit-847f1b6';
|