vike 0.4.229-commit-5da80bf → 0.4.229-commit-e27d672
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/client/shared/preparePageContextForPublicUsageClientShared.js +0 -1
- package/dist/cjs/node/runtime/renderPage.js +1 -3
- package/dist/cjs/shared/createPageContextShared.js +1 -3
- package/dist/cjs/shared/getProxyForPublicUsage.js +9 -60
- package/dist/cjs/shared/preparePageContextForPublicUsage.js +3 -3
- package/dist/cjs/shared/utils.js +0 -1
- package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/client/shared/preparePageContextForPublicUsageClientShared.d.ts +3 -1
- package/dist/esm/client/shared/preparePageContextForPublicUsageClientShared.js +0 -1
- package/dist/esm/node/runtime/renderPage.js +1 -3
- package/dist/esm/shared/createPageContextShared.js +1 -3
- package/dist/esm/shared/getProxyForPublicUsage.d.ts +3 -11
- package/dist/esm/shared/getProxyForPublicUsage.js +10 -61
- package/dist/esm/shared/preparePageContextForPublicUsage.d.ts +3 -2
- package/dist/esm/shared/preparePageContextForPublicUsage.js +4 -4
- package/dist/esm/shared/utils.d.ts +0 -1
- package/dist/esm/shared/utils.js +0 -1
- package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.js +1 -1
- package/package.json +1 -1
|
@@ -34,7 +34,6 @@ function supportVueReactiviy(pageContext) {
|
|
|
34
34
|
// Remove propery descriptor getters because they break Vue's reactivity.
|
|
35
35
|
// E.g. resolve the `pageContext.urlPathname` getter.
|
|
36
36
|
function resolveGetters(pageContext) {
|
|
37
|
-
return;
|
|
38
37
|
Object.entries(pageContext).forEach(([key, val]) => {
|
|
39
38
|
delete pageContext[key];
|
|
40
39
|
pageContext[key] = val;
|
|
@@ -24,7 +24,6 @@ const error_page_js_1 = require("../../shared/error-page.js");
|
|
|
24
24
|
const handleErrorWithoutErrorPage_js_1 = require("./renderPage/handleErrorWithoutErrorPage.js");
|
|
25
25
|
const loadPageConfigsLazyServerSide_js_1 = require("./renderPage/loadPageConfigsLazyServerSide.js");
|
|
26
26
|
const resolveRedirects_js_1 = require("./renderPage/resolveRedirects.js");
|
|
27
|
-
const getProxyForPublicUsage_js_1 = require("../../shared/getProxyForPublicUsage.js");
|
|
28
27
|
const globalObject = (0, utils_js_1.getGlobalObject)('runtime/renderPage.ts', {
|
|
29
28
|
httpRequestsCount: 0
|
|
30
29
|
});
|
|
@@ -489,6 +488,5 @@ function getPageContextInvalidVikeConfig(err, pageContextInit, httpRequestId) {
|
|
|
489
488
|
function forkPageContext(pageContextBegin) {
|
|
490
489
|
const pageContext = {};
|
|
491
490
|
(0, utils_js_1.objectAssign)(pageContext, pageContextBegin, true);
|
|
492
|
-
|
|
493
|
-
return pageContextWithProxy;
|
|
491
|
+
return pageContext;
|
|
494
492
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createPageContextShared = createPageContextShared;
|
|
4
4
|
exports.createPageContextObject = createPageContextObject;
|
|
5
|
-
const getProxyForPublicUsage_js_1 = require("./getProxyForPublicUsage.js");
|
|
6
5
|
const execHook_js_1 = require("./hooks/execHook.js");
|
|
7
6
|
const preparePageContextForPublicUsage_js_1 = require("./preparePageContextForPublicUsage.js");
|
|
8
7
|
const utils_js_1 = require("./utils.js");
|
|
@@ -17,6 +16,5 @@ function createPageContextObject() {
|
|
|
17
16
|
isPageContext: true
|
|
18
17
|
};
|
|
19
18
|
(0, utils_js_1.changeEnumerable)(pageContext, '_isOriginalObject', false);
|
|
20
|
-
|
|
21
|
-
return pageContextWithProxy;
|
|
19
|
+
return pageContext;
|
|
22
20
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getProxyForPublicUsage = getProxyForPublicUsage;
|
|
4
|
-
exports.getProxyForPublicUsageFlat = getProxyForPublicUsageFlat;
|
|
5
|
-
exports.getProxyForMutationTracking = getProxyForMutationTracking;
|
|
6
4
|
// We use a proxy instead of property getters.
|
|
7
5
|
// - The issue with property getters is that they can't be `writable: true` but we do want the user to be able to modify the value of internal properties.
|
|
8
6
|
// ```console
|
|
@@ -12,76 +10,27 @@ exports.getProxyForMutationTracking = getProxyForMutationTracking;
|
|
|
12
10
|
// Show warning when user is accessing internal `_` properties.
|
|
13
11
|
const NOT_SERIALIZABLE_js_1 = require("./NOT_SERIALIZABLE.js");
|
|
14
12
|
const utils_js_1 = require("./utils.js");
|
|
15
|
-
function getProxyForPublicUsage(obj, objName, skipOnInternalProp) {
|
|
13
|
+
function getProxyForPublicUsage(obj, objName, skipOnInternalProp, fallback) {
|
|
16
14
|
return new Proxy(obj, {
|
|
17
|
-
get: getTrapGet(obj, objName, skipOnInternalProp)
|
|
15
|
+
get: getTrapGet(obj, objName, skipOnInternalProp, fallback)
|
|
18
16
|
});
|
|
19
17
|
}
|
|
20
|
-
function
|
|
21
|
-
(0, utils_js_1.assert)(obj._isOriginalObject);
|
|
22
|
-
(0, utils_js_1.assert)(obj._proxyTarget);
|
|
23
|
-
obj._proxyTargetPublic ?? (obj._proxyTargetPublic = {});
|
|
24
|
-
const target = obj._proxyTargetPublic;
|
|
25
|
-
obj._userMods ?? (obj._userMods = {});
|
|
26
|
-
const objUserMods = obj._userMods;
|
|
27
|
-
const update = () => {
|
|
28
|
-
(0, utils_js_1.assert)(obj._proxyTarget);
|
|
29
|
-
(0, utils_js_1.objectReplace)(target, obj._proxyTarget);
|
|
30
|
-
(0, utils_js_1.objectAssign)(target, objUserMods);
|
|
31
|
-
};
|
|
32
|
-
obj._onChange = () => {
|
|
33
|
-
update();
|
|
34
|
-
};
|
|
35
|
-
update();
|
|
36
|
-
return new Proxy(target, {
|
|
37
|
-
// get: getTrapGet(target, objName, skipOnInternalProp),
|
|
38
|
-
set(_, prop, val) {
|
|
39
|
-
const ret = Reflect.set(objUserMods, prop, val);
|
|
40
|
-
update();
|
|
41
|
-
return ret;
|
|
42
|
-
},
|
|
43
|
-
defineProperty(_, ...args) {
|
|
44
|
-
const ret = Reflect.defineProperty(objUserMods, ...args);
|
|
45
|
-
update();
|
|
46
|
-
return ret;
|
|
47
|
-
},
|
|
48
|
-
deleteProperty(_, ...args) {
|
|
49
|
-
const ret = Reflect.deleteProperty(objUserMods, ...args);
|
|
50
|
-
update();
|
|
51
|
-
return ret;
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
function getTrapGet(obj, objName, skipOnInternalProp) {
|
|
18
|
+
function getTrapGet(obj, objName, skipOnInternalProp, fallback) {
|
|
56
19
|
return function (_, prop) {
|
|
57
20
|
const propStr = String(prop);
|
|
58
21
|
if (!skipOnInternalProp)
|
|
59
22
|
onInternalProp(propStr, objName);
|
|
23
|
+
if (fallback) {
|
|
24
|
+
// Rudimentary flat pageContext implementation https://github.com/vikejs/vike/issues/1268
|
|
25
|
+
// Failed full-fledged implementation: https://github.com/vikejs/vike/pull/2458
|
|
26
|
+
if (!(prop in obj) && prop in fallback)
|
|
27
|
+
return fallback[prop];
|
|
28
|
+
}
|
|
60
29
|
const val = obj[prop];
|
|
61
30
|
onNotSerializable(propStr, val, objName);
|
|
62
31
|
return val;
|
|
63
32
|
};
|
|
64
33
|
}
|
|
65
|
-
function getProxyForMutationTracking(obj) {
|
|
66
|
-
(0, utils_js_1.objectAssign)(obj, { _proxyTarget: obj });
|
|
67
|
-
return new Proxy(obj, {
|
|
68
|
-
set(...args) {
|
|
69
|
-
const ret = Reflect.set(...args);
|
|
70
|
-
obj._onChange?.();
|
|
71
|
-
return ret;
|
|
72
|
-
},
|
|
73
|
-
defineProperty(...args) {
|
|
74
|
-
const ret = Reflect.defineProperty(...args);
|
|
75
|
-
obj._onChange?.();
|
|
76
|
-
return ret;
|
|
77
|
-
},
|
|
78
|
-
deleteProperty(...args) {
|
|
79
|
-
const ret = Reflect.deleteProperty(...args);
|
|
80
|
-
obj._onChange?.();
|
|
81
|
-
return ret;
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
34
|
function onNotSerializable(propStr, val, objName) {
|
|
86
35
|
if (val !== NOT_SERIALIZABLE_js_1.NOT_SERIALIZABLE)
|
|
87
36
|
return;
|
|
@@ -7,6 +7,7 @@ const addIs404ToPageProps_js_1 = require("./addIs404ToPageProps.js");
|
|
|
7
7
|
const prepareGlobalContextForPublicUsage_js_1 = require("./prepareGlobalContextForPublicUsage.js");
|
|
8
8
|
const getProxyForPublicUsage_js_1 = require("./getProxyForPublicUsage.js");
|
|
9
9
|
function preparePageContextForPublicUsage(pageContext) {
|
|
10
|
+
(0, utils_js_1.assert)(!pageContext.globalContext); // pageContext.globalContext should only be available to users — Vike itself should use pageContext._globalContext instead
|
|
10
11
|
(0, utils_js_1.assert)(pageContext._isOriginalObject); // ensure we preserve the original object reference
|
|
11
12
|
const globalContextPublic = (0, prepareGlobalContextForPublicUsage_js_1.prepareGlobalContextForPublicUsage)(pageContext._globalContext);
|
|
12
13
|
(0, utils_js_1.objectAssign)(pageContext, {
|
|
@@ -28,15 +29,14 @@ function preparePageContextForPublicUsage(pageContext) {
|
|
|
28
29
|
}
|
|
29
30
|
// For a more readable `console.log(pageContext)` output
|
|
30
31
|
sortPageContext(pageContext);
|
|
31
|
-
const pageContextPublic = (0, getProxyForPublicUsage_js_1.
|
|
32
|
+
const pageContextPublic = (0, getProxyForPublicUsage_js_1.getProxyForPublicUsage)(pageContext, 'pageContext',
|
|
32
33
|
// We must skip it in the client-side because of the reactivity mechanism of UI frameworks like Solid.
|
|
33
34
|
// - TODO/now: double check whether that's true
|
|
34
|
-
true);
|
|
35
|
+
true, pageContext.globalContext);
|
|
35
36
|
return pageContextPublic;
|
|
36
37
|
}
|
|
37
38
|
// Sort `pageContext` keys alphabetically, in order to make reading the `console.log(pageContext)` output easier
|
|
38
39
|
function sortPageContext(pageContext) {
|
|
39
|
-
return;
|
|
40
40
|
let descriptors = Object.getOwnPropertyDescriptors(pageContext);
|
|
41
41
|
for (const key of Object.keys(pageContext))
|
|
42
42
|
delete pageContext[key];
|
package/dist/cjs/shared/utils.js
CHANGED
|
@@ -44,4 +44,3 @@ __exportStar(require("../utils/objectDefineProperty.js"), exports);
|
|
|
44
44
|
__exportStar(require("../utils/isScriptFile.js"), exports);
|
|
45
45
|
__exportStar(require("../utils/objectFilter.js"), exports);
|
|
46
46
|
__exportStar(require("../utils/getPropAccessNotation.js"), exports);
|
|
47
|
-
__exportStar(require("../utils/objectReplace.js"), exports);
|
|
@@ -8,4 +8,6 @@ type PageContextForPublicUsageClientShared = PageContextPrepareMinimum & PageCon
|
|
|
8
8
|
declare function preparePageContextForPublicUsageClientShared<PageContext extends PageContextForPublicUsageClientShared>(pageContext: PageContext): PageContext & {
|
|
9
9
|
Page: unknown;
|
|
10
10
|
};
|
|
11
|
-
declare function preparePageContextForPublicUsageClientMinimal<PageContext extends PageContextPrepareMinimum>(pageContext: PageContext):
|
|
11
|
+
declare function preparePageContextForPublicUsageClientMinimal<PageContext extends PageContextPrepareMinimum>(pageContext: PageContext): PageContext & {
|
|
12
|
+
globalContext: import("../../shared/prepareGlobalContextForPublicUsage.js").GlobalContextPrepareMinimum;
|
|
13
|
+
};
|
|
@@ -32,7 +32,6 @@ function supportVueReactiviy(pageContext) {
|
|
|
32
32
|
// Remove propery descriptor getters because they break Vue's reactivity.
|
|
33
33
|
// E.g. resolve the `pageContext.urlPathname` getter.
|
|
34
34
|
function resolveGetters(pageContext) {
|
|
35
|
-
return;
|
|
36
35
|
Object.entries(pageContext).forEach(([key, val]) => {
|
|
37
36
|
delete pageContext[key];
|
|
38
37
|
pageContext[key] = val;
|
|
@@ -19,7 +19,6 @@ import { getErrorPageId } from '../../shared/error-page.js';
|
|
|
19
19
|
import { handleErrorWithoutErrorPage } from './renderPage/handleErrorWithoutErrorPage.js';
|
|
20
20
|
import { loadPageConfigsLazyServerSide } from './renderPage/loadPageConfigsLazyServerSide.js';
|
|
21
21
|
import { resolveRedirects } from './renderPage/resolveRedirects.js';
|
|
22
|
-
import { getProxyForMutationTracking } from '../../shared/getProxyForPublicUsage.js';
|
|
23
22
|
const globalObject = getGlobalObject('runtime/renderPage.ts', {
|
|
24
23
|
httpRequestsCount: 0
|
|
25
24
|
});
|
|
@@ -484,6 +483,5 @@ function getPageContextInvalidVikeConfig(err, pageContextInit, httpRequestId) {
|
|
|
484
483
|
function forkPageContext(pageContextBegin) {
|
|
485
484
|
const pageContext = {};
|
|
486
485
|
objectAssign(pageContext, pageContextBegin, true);
|
|
487
|
-
|
|
488
|
-
return pageContextWithProxy;
|
|
486
|
+
return pageContext;
|
|
489
487
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { createPageContextShared };
|
|
2
2
|
export { createPageContextObject };
|
|
3
|
-
import { getProxyForMutationTracking } from './getProxyForPublicUsage.js';
|
|
4
3
|
import { execHookGlobal } from './hooks/execHook.js';
|
|
5
4
|
import { preparePageContextForPublicUsage } from './preparePageContextForPublicUsage.js';
|
|
6
5
|
import { changeEnumerable, objectAssign } from './utils.js';
|
|
@@ -15,6 +14,5 @@ function createPageContextObject() {
|
|
|
15
14
|
isPageContext: true
|
|
16
15
|
};
|
|
17
16
|
changeEnumerable(pageContext, '_isOriginalObject', false);
|
|
18
|
-
|
|
19
|
-
return pageContextWithProxy;
|
|
17
|
+
return pageContext;
|
|
20
18
|
}
|
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
export { getProxyForPublicUsage };
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
_onChange?: () => void;
|
|
6
|
-
_proxyTarget?: any;
|
|
7
|
-
_userMods?: any;
|
|
8
|
-
_proxyTargetPublic?: any;
|
|
9
|
-
};
|
|
10
|
-
declare function getProxyForPublicUsage<Obj extends Target>(obj: Obj, objName: string, skipOnInternalProp?: true): Obj;
|
|
11
|
-
declare function getProxyForPublicUsageFlat<Obj extends Target>(obj: Obj, objName: string, skipOnInternalProp?: true): Obj;
|
|
12
|
-
declare function getProxyForMutationTracking<Obj extends Target>(obj: Obj): Obj;
|
|
2
|
+
type Target = Record<string, unknown>;
|
|
3
|
+
type Fallback = Record<string | symbol, unknown>;
|
|
4
|
+
declare function getProxyForPublicUsage<Obj extends Target>(obj: Obj, objName: string, skipOnInternalProp?: true, fallback?: Fallback): Obj;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
export { getProxyForPublicUsage };
|
|
2
|
-
export { getProxyForPublicUsageFlat };
|
|
3
|
-
export { getProxyForMutationTracking };
|
|
4
2
|
// We use a proxy instead of property getters.
|
|
5
3
|
// - The issue with property getters is that they can't be `writable: true` but we do want the user to be able to modify the value of internal properties.
|
|
6
4
|
// ```console
|
|
@@ -9,77 +7,28 @@ export { getProxyForMutationTracking };
|
|
|
9
7
|
// - Previous implementation using property getters: https://github.com/vikejs/vike/blob/main/vike/utils/makePublicCopy.ts
|
|
10
8
|
// Show warning when user is accessing internal `_` properties.
|
|
11
9
|
import { NOT_SERIALIZABLE } from './NOT_SERIALIZABLE.js';
|
|
12
|
-
import { assert, assertUsage, assertWarning, getPropAccessNotation, isBrowser
|
|
13
|
-
function getProxyForPublicUsage(obj, objName, skipOnInternalProp) {
|
|
10
|
+
import { assert, assertUsage, assertWarning, getPropAccessNotation, isBrowser } from './utils.js';
|
|
11
|
+
function getProxyForPublicUsage(obj, objName, skipOnInternalProp, fallback) {
|
|
14
12
|
return new Proxy(obj, {
|
|
15
|
-
get: getTrapGet(obj, objName, skipOnInternalProp)
|
|
13
|
+
get: getTrapGet(obj, objName, skipOnInternalProp, fallback)
|
|
16
14
|
});
|
|
17
15
|
}
|
|
18
|
-
function
|
|
19
|
-
assert(obj._isOriginalObject);
|
|
20
|
-
assert(obj._proxyTarget);
|
|
21
|
-
obj._proxyTargetPublic ?? (obj._proxyTargetPublic = {});
|
|
22
|
-
const target = obj._proxyTargetPublic;
|
|
23
|
-
obj._userMods ?? (obj._userMods = {});
|
|
24
|
-
const objUserMods = obj._userMods;
|
|
25
|
-
const update = () => {
|
|
26
|
-
assert(obj._proxyTarget);
|
|
27
|
-
objectReplace(target, obj._proxyTarget);
|
|
28
|
-
objectAssign(target, objUserMods);
|
|
29
|
-
};
|
|
30
|
-
obj._onChange = () => {
|
|
31
|
-
update();
|
|
32
|
-
};
|
|
33
|
-
update();
|
|
34
|
-
return new Proxy(target, {
|
|
35
|
-
// get: getTrapGet(target, objName, skipOnInternalProp),
|
|
36
|
-
set(_, prop, val) {
|
|
37
|
-
const ret = Reflect.set(objUserMods, prop, val);
|
|
38
|
-
update();
|
|
39
|
-
return ret;
|
|
40
|
-
},
|
|
41
|
-
defineProperty(_, ...args) {
|
|
42
|
-
const ret = Reflect.defineProperty(objUserMods, ...args);
|
|
43
|
-
update();
|
|
44
|
-
return ret;
|
|
45
|
-
},
|
|
46
|
-
deleteProperty(_, ...args) {
|
|
47
|
-
const ret = Reflect.deleteProperty(objUserMods, ...args);
|
|
48
|
-
update();
|
|
49
|
-
return ret;
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
function getTrapGet(obj, objName, skipOnInternalProp) {
|
|
16
|
+
function getTrapGet(obj, objName, skipOnInternalProp, fallback) {
|
|
54
17
|
return function (_, prop) {
|
|
55
18
|
const propStr = String(prop);
|
|
56
19
|
if (!skipOnInternalProp)
|
|
57
20
|
onInternalProp(propStr, objName);
|
|
21
|
+
if (fallback) {
|
|
22
|
+
// Rudimentary flat pageContext implementation https://github.com/vikejs/vike/issues/1268
|
|
23
|
+
// Failed full-fledged implementation: https://github.com/vikejs/vike/pull/2458
|
|
24
|
+
if (!(prop in obj) && prop in fallback)
|
|
25
|
+
return fallback[prop];
|
|
26
|
+
}
|
|
58
27
|
const val = obj[prop];
|
|
59
28
|
onNotSerializable(propStr, val, objName);
|
|
60
29
|
return val;
|
|
61
30
|
};
|
|
62
31
|
}
|
|
63
|
-
function getProxyForMutationTracking(obj) {
|
|
64
|
-
objectAssign(obj, { _proxyTarget: obj });
|
|
65
|
-
return new Proxy(obj, {
|
|
66
|
-
set(...args) {
|
|
67
|
-
const ret = Reflect.set(...args);
|
|
68
|
-
obj._onChange?.();
|
|
69
|
-
return ret;
|
|
70
|
-
},
|
|
71
|
-
defineProperty(...args) {
|
|
72
|
-
const ret = Reflect.defineProperty(...args);
|
|
73
|
-
obj._onChange?.();
|
|
74
|
-
return ret;
|
|
75
|
-
},
|
|
76
|
-
deleteProperty(...args) {
|
|
77
|
-
const ret = Reflect.deleteProperty(...args);
|
|
78
|
-
obj._onChange?.();
|
|
79
|
-
return ret;
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
32
|
function onNotSerializable(propStr, val, objName) {
|
|
84
33
|
if (val !== NOT_SERIALIZABLE)
|
|
85
34
|
return;
|
|
@@ -6,7 +6,8 @@ type PageContextPrepareMinimum = {
|
|
|
6
6
|
_isOriginalObject: true;
|
|
7
7
|
isPageContext: true;
|
|
8
8
|
_globalContext: GlobalContextPrepareMinimum;
|
|
9
|
-
globalContext?: never;
|
|
10
9
|
};
|
|
11
|
-
declare function preparePageContextForPublicUsage(pageContext:
|
|
10
|
+
declare function preparePageContextForPublicUsage<PageContext extends PageContextPrepareMinimum>(pageContext: PageContext): PageContext & {
|
|
11
|
+
globalContext: GlobalContextPrepareMinimum;
|
|
12
|
+
};
|
|
12
13
|
declare function assertPropertyGetters(pageContext: Record<string, unknown>): void;
|
|
@@ -3,8 +3,9 @@ export { assertPropertyGetters };
|
|
|
3
3
|
import { assert, assertWarning, compareString, isPropertyGetter, objectAssign } from './utils.js';
|
|
4
4
|
import { addIs404ToPageProps } from './addIs404ToPageProps.js';
|
|
5
5
|
import { prepareGlobalContextForPublicUsage } from './prepareGlobalContextForPublicUsage.js';
|
|
6
|
-
import {
|
|
6
|
+
import { getProxyForPublicUsage } from './getProxyForPublicUsage.js';
|
|
7
7
|
function preparePageContextForPublicUsage(pageContext) {
|
|
8
|
+
assert(!pageContext.globalContext); // pageContext.globalContext should only be available to users — Vike itself should use pageContext._globalContext instead
|
|
8
9
|
assert(pageContext._isOriginalObject); // ensure we preserve the original object reference
|
|
9
10
|
const globalContextPublic = prepareGlobalContextForPublicUsage(pageContext._globalContext);
|
|
10
11
|
objectAssign(pageContext, {
|
|
@@ -26,15 +27,14 @@ function preparePageContextForPublicUsage(pageContext) {
|
|
|
26
27
|
}
|
|
27
28
|
// For a more readable `console.log(pageContext)` output
|
|
28
29
|
sortPageContext(pageContext);
|
|
29
|
-
const pageContextPublic =
|
|
30
|
+
const pageContextPublic = getProxyForPublicUsage(pageContext, 'pageContext',
|
|
30
31
|
// We must skip it in the client-side because of the reactivity mechanism of UI frameworks like Solid.
|
|
31
32
|
// - TODO/now: double check whether that's true
|
|
32
|
-
true);
|
|
33
|
+
true, pageContext.globalContext);
|
|
33
34
|
return pageContextPublic;
|
|
34
35
|
}
|
|
35
36
|
// Sort `pageContext` keys alphabetically, in order to make reading the `console.log(pageContext)` output easier
|
|
36
37
|
function sortPageContext(pageContext) {
|
|
37
|
-
return;
|
|
38
38
|
let descriptors = Object.getOwnPropertyDescriptors(pageContext);
|
|
39
39
|
for (const key of Object.keys(pageContext))
|
|
40
40
|
delete pageContext[key];
|
package/dist/esm/shared/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PROJECT_VERSION: "0.4.229-commit-
|
|
1
|
+
export declare const PROJECT_VERSION: "0.4.229-commit-e27d672";
|
|
@@ -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-e27d672';
|