@valbuild/next 0.65.0 → 0.65.1
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/declarations/src/rsc/initValRsc.d.ts +4 -2
- package/package.json +1 -1
- package/rsc/dist/valbuild-next-rsc.cjs.dev.js +196 -126
- package/rsc/dist/valbuild-next-rsc.cjs.prod.js +196 -126
- package/rsc/dist/valbuild-next-rsc.esm.js +197 -127
- package/server/dist/valbuild-next-server.cjs.dev.js +15 -6
- package/server/dist/valbuild-next-server.cjs.prod.js +15 -6
- package/server/dist/valbuild-next-server.esm.js +15 -6
|
@@ -2,12 +2,14 @@ import { type StegaOfSource } from "@valbuild/react/stega";
|
|
|
2
2
|
import { SelectorSource, SelectorOf, GenericSelector, ValConfig, ValModules } from "@valbuild/core";
|
|
3
3
|
import { cookies, draftMode, headers } from "next/headers";
|
|
4
4
|
import { ValServer } from "@valbuild/server";
|
|
5
|
-
declare const initFetchValStega: (config: ValConfig, valApiEndpoints: string, valServerPromise: Promise<ValServer>, isEnabled: () => boolean
|
|
5
|
+
declare const initFetchValStega: (config: ValConfig, valApiEndpoints: string, valServerPromise: Promise<ValServer>, isEnabled: () => Promise<boolean>, getHeaders: () => Promise<{
|
|
6
|
+
get(name: string): string | null;
|
|
7
|
+
}>, getCookies: () => Promise<{
|
|
6
8
|
get(name: string): {
|
|
7
9
|
name: string;
|
|
8
10
|
value: string;
|
|
9
11
|
} | undefined;
|
|
10
|
-
}) => <T extends SelectorSource>(selector: T) => SelectorOf<T> extends GenericSelector<infer S> ?
|
|
12
|
+
}>) => <T extends SelectorSource>(selector: T) => Promise<SelectorOf<T> extends GenericSelector<infer S> ? StegaOfSource<S> : never>;
|
|
11
13
|
type ValNextRscConfig = {
|
|
12
14
|
draftMode: typeof draftMode;
|
|
13
15
|
headers: typeof headers;
|
package/package.json
CHANGED
|
@@ -14,129 +14,157 @@ var version = require('../../dist/version-82faa1d0.cjs.dev.js');
|
|
|
14
14
|
stega.SET_RSC(true);
|
|
15
15
|
var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies) {
|
|
16
16
|
return function (selector) {
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
17
|
+
var exec = /*#__PURE__*/function () {
|
|
18
|
+
var _ref = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee() {
|
|
19
|
+
var enabled, headers, cookies, host, _cookies, _cookies3, valServer, patchesRes, allPatches, treeRes, modules;
|
|
20
|
+
return asyncToGenerator._regeneratorRuntime().wrap(function _callee$(_context) {
|
|
21
|
+
while (1) switch (_context.prev = _context.next) {
|
|
22
|
+
case 0:
|
|
23
|
+
enabled = false;
|
|
24
|
+
_context.prev = 1;
|
|
25
|
+
_context.next = 4;
|
|
26
|
+
return isEnabled();
|
|
27
|
+
case 4:
|
|
28
|
+
enabled = _context.sent;
|
|
29
|
+
_context.next = 10;
|
|
30
|
+
break;
|
|
31
|
+
case 7:
|
|
32
|
+
_context.prev = 7;
|
|
33
|
+
_context.t0 = _context["catch"](1);
|
|
34
|
+
console.error("Val: could not check if Val is enabled! This might be due to an error to check draftMode. fetchVal can only be used server-side. Use useVal on clients.", _context.t0);
|
|
35
|
+
case 10:
|
|
36
|
+
if (!enabled) {
|
|
37
|
+
_context.next = 58;
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
stega.SET_AUTO_TAG_JSX_ENABLED(true);
|
|
41
|
+
_context.prev = 12;
|
|
42
|
+
_context.next = 15;
|
|
43
|
+
return getHeaders();
|
|
44
|
+
case 15:
|
|
45
|
+
headers = _context.sent;
|
|
46
|
+
if (!(typeof headers.get !== "function")) {
|
|
47
|
+
_context.next = 18;
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
throw new Error("Invalid headers");
|
|
51
|
+
case 18:
|
|
52
|
+
_context.next = 24;
|
|
53
|
+
break;
|
|
54
|
+
case 20:
|
|
55
|
+
_context.prev = 20;
|
|
56
|
+
_context.t1 = _context["catch"](12);
|
|
57
|
+
console.error("Val: could not read headers! fetchVal can only be used server-side. Use useVal on clients.", _context.t1);
|
|
58
|
+
headers = null;
|
|
59
|
+
case 24:
|
|
60
|
+
_context.prev = 24;
|
|
61
|
+
_context.next = 27;
|
|
62
|
+
return getCookies();
|
|
63
|
+
case 27:
|
|
64
|
+
cookies = _context.sent;
|
|
65
|
+
_context.next = 34;
|
|
66
|
+
break;
|
|
67
|
+
case 30:
|
|
68
|
+
_context.prev = 30;
|
|
69
|
+
_context.t2 = _context["catch"](24);
|
|
70
|
+
console.error("Val: could not read cookies! fetchVal can only be used server-side. Use useVal on clients.", _context.t2);
|
|
71
|
+
cookies = null;
|
|
72
|
+
case 34:
|
|
73
|
+
host = headers && getHost(headers);
|
|
74
|
+
if (!(host && cookies)) {
|
|
75
|
+
_context.next = 58;
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
_context.next = 38;
|
|
79
|
+
return valServerPromise;
|
|
80
|
+
case 38:
|
|
81
|
+
valServer = _context.sent;
|
|
82
|
+
_context.next = 41;
|
|
83
|
+
return valServer["/patches/~"]["GET"]({
|
|
84
|
+
query: {
|
|
85
|
+
omit_patch: true,
|
|
86
|
+
author: undefined,
|
|
87
|
+
patch_id: undefined,
|
|
88
|
+
module_file_path: undefined
|
|
89
|
+
},
|
|
90
|
+
cookies: objectSpread2._defineProperty({}, internal.VAL_SESSION_COOKIE, (_cookies = cookies) === null || _cookies === void 0 || (_cookies = _cookies.get(internal.VAL_SESSION_COOKIE)) === null || _cookies === void 0 ? void 0 : _cookies.value)
|
|
91
|
+
});
|
|
92
|
+
case 41:
|
|
93
|
+
patchesRes = _context.sent;
|
|
94
|
+
if (!(patchesRes.status !== 200)) {
|
|
95
|
+
_context.next = 44;
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
throw Error(JSON.stringify(patchesRes.json, null, 2));
|
|
99
|
+
case 44:
|
|
100
|
+
allPatches = Object.keys(patchesRes.json.patches);
|
|
101
|
+
_context.next = 47;
|
|
102
|
+
return valServer["/sources"]["PUT"]({
|
|
103
|
+
path: "/",
|
|
104
|
+
query: {
|
|
105
|
+
validate_sources: true,
|
|
106
|
+
validate_all: false,
|
|
107
|
+
validate_binary_files: false
|
|
108
|
+
},
|
|
109
|
+
body: {
|
|
110
|
+
patchIds: allPatches
|
|
111
|
+
},
|
|
112
|
+
cookies: objectSpread2._defineProperty({}, internal.VAL_SESSION_COOKIE, (_cookies3 = cookies) === null || _cookies3 === void 0 || (_cookies3 = _cookies3.get(internal.VAL_SESSION_COOKIE)) === null || _cookies3 === void 0 ? void 0 : _cookies3.value)
|
|
113
|
+
});
|
|
114
|
+
case 47:
|
|
115
|
+
treeRes = _context.sent;
|
|
116
|
+
if (!(treeRes.status === 200)) {
|
|
117
|
+
_context.next = 53;
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
modules = treeRes.json.modules;
|
|
121
|
+
return _context.abrupt("return", stega.stegaEncode(selector, {
|
|
122
|
+
disabled: !enabled,
|
|
123
|
+
getModule: function getModule(path) {
|
|
124
|
+
var module = modules[path];
|
|
125
|
+
if (module) {
|
|
126
|
+
return module.source;
|
|
105
127
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
case 21:
|
|
113
|
-
case "end":
|
|
114
|
-
return _context.stop();
|
|
128
|
+
}
|
|
129
|
+
}));
|
|
130
|
+
case 53:
|
|
131
|
+
if (!(treeRes.status === 401)) {
|
|
132
|
+
_context.next = 57;
|
|
133
|
+
break;
|
|
115
134
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
135
|
+
console.warn("Val: authentication error: ", treeRes.json.message);
|
|
136
|
+
_context.next = 58;
|
|
137
|
+
break;
|
|
138
|
+
case 57:
|
|
139
|
+
throw Error(JSON.stringify(treeRes.json, null, 2));
|
|
140
|
+
case 58:
|
|
141
|
+
return _context.abrupt("return", stega.stegaEncode(selector, {
|
|
142
|
+
disabled: !enabled
|
|
143
|
+
}));
|
|
144
|
+
case 59:
|
|
145
|
+
case "end":
|
|
146
|
+
return _context.stop();
|
|
147
|
+
}
|
|
148
|
+
}, _callee, null, [[1, 7], [12, 20], [24, 30]]);
|
|
149
|
+
}));
|
|
150
|
+
return function exec() {
|
|
151
|
+
return _ref.apply(this, arguments);
|
|
152
|
+
};
|
|
153
|
+
}();
|
|
154
|
+
return exec()["catch"](function (err) {
|
|
155
|
+
console.error("Val: failed to fetch ", err);
|
|
156
|
+
return stega.stegaEncode(selector, {});
|
|
129
157
|
});
|
|
130
158
|
};
|
|
131
159
|
};
|
|
132
160
|
function getHost(headers) {
|
|
133
161
|
var _headers$get;
|
|
134
162
|
// TODO: does NextJs have a way to determine this?
|
|
135
|
-
var host = headers.get("host");
|
|
163
|
+
var host = headers === null || headers === void 0 ? void 0 : headers.get("host");
|
|
136
164
|
var proto = "https";
|
|
137
|
-
if (headers.get("x-forwarded-proto") === "http") {
|
|
165
|
+
if ((headers === null || headers === void 0 ? void 0 : headers.get("x-forwarded-proto")) === "http") {
|
|
138
166
|
proto = "http";
|
|
139
|
-
} else if ((_headers$get = headers.get("referer")) !== null && _headers$get !== void 0 && _headers$get.startsWith("http://")) {
|
|
167
|
+
} else if (headers !== null && headers !== void 0 && (_headers$get = headers.get("referer")) !== null && _headers$get !== void 0 && _headers$get.startsWith("http://")) {
|
|
140
168
|
proto = "http";
|
|
141
169
|
} else if (host !== null && host !== void 0 && host.startsWith("localhost")) {
|
|
142
170
|
proto = "http";
|
|
@@ -192,8 +220,11 @@ function initValRsc(config, valModules, rscNextConfig) {
|
|
|
192
220
|
return asyncToGenerator._regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
193
221
|
while (1) switch (_context2.prev = _context2.next) {
|
|
194
222
|
case 0:
|
|
195
|
-
|
|
196
|
-
|
|
223
|
+
_context2.next = 2;
|
|
224
|
+
return rscNextConfig.draftMode();
|
|
225
|
+
case 2:
|
|
226
|
+
return _context2.abrupt("return", _context2.sent.isEnabled);
|
|
227
|
+
case 3:
|
|
197
228
|
case "end":
|
|
198
229
|
return _context2.stop();
|
|
199
230
|
}
|
|
@@ -205,8 +236,11 @@ function initValRsc(config, valModules, rscNextConfig) {
|
|
|
205
236
|
return asyncToGenerator._regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
206
237
|
while (1) switch (_context3.prev = _context3.next) {
|
|
207
238
|
case 0:
|
|
208
|
-
|
|
209
|
-
|
|
239
|
+
_context3.next = 2;
|
|
240
|
+
return rscNextConfig.draftMode();
|
|
241
|
+
case 2:
|
|
242
|
+
_context3.sent.enable();
|
|
243
|
+
case 3:
|
|
210
244
|
case "end":
|
|
211
245
|
return _context3.stop();
|
|
212
246
|
}
|
|
@@ -218,8 +252,11 @@ function initValRsc(config, valModules, rscNextConfig) {
|
|
|
218
252
|
return asyncToGenerator._regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
219
253
|
while (1) switch (_context4.prev = _context4.next) {
|
|
220
254
|
case 0:
|
|
221
|
-
|
|
222
|
-
|
|
255
|
+
_context4.next = 2;
|
|
256
|
+
return rscNextConfig.draftMode();
|
|
257
|
+
case 2:
|
|
258
|
+
_context4.sent.disable();
|
|
259
|
+
case 3:
|
|
223
260
|
case "end":
|
|
224
261
|
return _context4.stop();
|
|
225
262
|
}
|
|
@@ -230,13 +267,46 @@ function initValRsc(config, valModules, rscNextConfig) {
|
|
|
230
267
|
return {
|
|
231
268
|
fetchValStega: initFetchValStega(config, valApiEndpoints,
|
|
232
269
|
// TODO: get from config
|
|
233
|
-
valServerPromise, function () {
|
|
234
|
-
return
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
270
|
+
valServerPromise, /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee5() {
|
|
271
|
+
return asyncToGenerator._regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
272
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
273
|
+
case 0:
|
|
274
|
+
_context5.next = 2;
|
|
275
|
+
return rscNextConfig.draftMode();
|
|
276
|
+
case 2:
|
|
277
|
+
return _context5.abrupt("return", _context5.sent.isEnabled);
|
|
278
|
+
case 3:
|
|
279
|
+
case "end":
|
|
280
|
+
return _context5.stop();
|
|
281
|
+
}
|
|
282
|
+
}, _callee5);
|
|
283
|
+
})), /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee6() {
|
|
284
|
+
return asyncToGenerator._regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
285
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
286
|
+
case 0:
|
|
287
|
+
_context6.next = 2;
|
|
288
|
+
return rscNextConfig.headers();
|
|
289
|
+
case 2:
|
|
290
|
+
return _context6.abrupt("return", _context6.sent);
|
|
291
|
+
case 3:
|
|
292
|
+
case "end":
|
|
293
|
+
return _context6.stop();
|
|
294
|
+
}
|
|
295
|
+
}, _callee6);
|
|
296
|
+
})), /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee7() {
|
|
297
|
+
return asyncToGenerator._regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
298
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
299
|
+
case 0:
|
|
300
|
+
_context7.next = 2;
|
|
301
|
+
return rscNextConfig.cookies();
|
|
302
|
+
case 2:
|
|
303
|
+
return _context7.abrupt("return", _context7.sent);
|
|
304
|
+
case 3:
|
|
305
|
+
case "end":
|
|
306
|
+
return _context7.stop();
|
|
307
|
+
}
|
|
308
|
+
}, _callee7);
|
|
309
|
+
})))
|
|
240
310
|
};
|
|
241
311
|
}
|
|
242
312
|
|
|
@@ -14,129 +14,157 @@ var version = require('../../dist/version-a9a6a619.cjs.prod.js');
|
|
|
14
14
|
stega.SET_RSC(true);
|
|
15
15
|
var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies) {
|
|
16
16
|
return function (selector) {
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
17
|
+
var exec = /*#__PURE__*/function () {
|
|
18
|
+
var _ref = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee() {
|
|
19
|
+
var enabled, headers, cookies, host, _cookies, _cookies3, valServer, patchesRes, allPatches, treeRes, modules;
|
|
20
|
+
return asyncToGenerator._regeneratorRuntime().wrap(function _callee$(_context) {
|
|
21
|
+
while (1) switch (_context.prev = _context.next) {
|
|
22
|
+
case 0:
|
|
23
|
+
enabled = false;
|
|
24
|
+
_context.prev = 1;
|
|
25
|
+
_context.next = 4;
|
|
26
|
+
return isEnabled();
|
|
27
|
+
case 4:
|
|
28
|
+
enabled = _context.sent;
|
|
29
|
+
_context.next = 10;
|
|
30
|
+
break;
|
|
31
|
+
case 7:
|
|
32
|
+
_context.prev = 7;
|
|
33
|
+
_context.t0 = _context["catch"](1);
|
|
34
|
+
console.error("Val: could not check if Val is enabled! This might be due to an error to check draftMode. fetchVal can only be used server-side. Use useVal on clients.", _context.t0);
|
|
35
|
+
case 10:
|
|
36
|
+
if (!enabled) {
|
|
37
|
+
_context.next = 58;
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
stega.SET_AUTO_TAG_JSX_ENABLED(true);
|
|
41
|
+
_context.prev = 12;
|
|
42
|
+
_context.next = 15;
|
|
43
|
+
return getHeaders();
|
|
44
|
+
case 15:
|
|
45
|
+
headers = _context.sent;
|
|
46
|
+
if (!(typeof headers.get !== "function")) {
|
|
47
|
+
_context.next = 18;
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
throw new Error("Invalid headers");
|
|
51
|
+
case 18:
|
|
52
|
+
_context.next = 24;
|
|
53
|
+
break;
|
|
54
|
+
case 20:
|
|
55
|
+
_context.prev = 20;
|
|
56
|
+
_context.t1 = _context["catch"](12);
|
|
57
|
+
console.error("Val: could not read headers! fetchVal can only be used server-side. Use useVal on clients.", _context.t1);
|
|
58
|
+
headers = null;
|
|
59
|
+
case 24:
|
|
60
|
+
_context.prev = 24;
|
|
61
|
+
_context.next = 27;
|
|
62
|
+
return getCookies();
|
|
63
|
+
case 27:
|
|
64
|
+
cookies = _context.sent;
|
|
65
|
+
_context.next = 34;
|
|
66
|
+
break;
|
|
67
|
+
case 30:
|
|
68
|
+
_context.prev = 30;
|
|
69
|
+
_context.t2 = _context["catch"](24);
|
|
70
|
+
console.error("Val: could not read cookies! fetchVal can only be used server-side. Use useVal on clients.", _context.t2);
|
|
71
|
+
cookies = null;
|
|
72
|
+
case 34:
|
|
73
|
+
host = headers && getHost(headers);
|
|
74
|
+
if (!(host && cookies)) {
|
|
75
|
+
_context.next = 58;
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
_context.next = 38;
|
|
79
|
+
return valServerPromise;
|
|
80
|
+
case 38:
|
|
81
|
+
valServer = _context.sent;
|
|
82
|
+
_context.next = 41;
|
|
83
|
+
return valServer["/patches/~"]["GET"]({
|
|
84
|
+
query: {
|
|
85
|
+
omit_patch: true,
|
|
86
|
+
author: undefined,
|
|
87
|
+
patch_id: undefined,
|
|
88
|
+
module_file_path: undefined
|
|
89
|
+
},
|
|
90
|
+
cookies: objectSpread2._defineProperty({}, internal.VAL_SESSION_COOKIE, (_cookies = cookies) === null || _cookies === void 0 || (_cookies = _cookies.get(internal.VAL_SESSION_COOKIE)) === null || _cookies === void 0 ? void 0 : _cookies.value)
|
|
91
|
+
});
|
|
92
|
+
case 41:
|
|
93
|
+
patchesRes = _context.sent;
|
|
94
|
+
if (!(patchesRes.status !== 200)) {
|
|
95
|
+
_context.next = 44;
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
throw Error(JSON.stringify(patchesRes.json, null, 2));
|
|
99
|
+
case 44:
|
|
100
|
+
allPatches = Object.keys(patchesRes.json.patches);
|
|
101
|
+
_context.next = 47;
|
|
102
|
+
return valServer["/sources"]["PUT"]({
|
|
103
|
+
path: "/",
|
|
104
|
+
query: {
|
|
105
|
+
validate_sources: true,
|
|
106
|
+
validate_all: false,
|
|
107
|
+
validate_binary_files: false
|
|
108
|
+
},
|
|
109
|
+
body: {
|
|
110
|
+
patchIds: allPatches
|
|
111
|
+
},
|
|
112
|
+
cookies: objectSpread2._defineProperty({}, internal.VAL_SESSION_COOKIE, (_cookies3 = cookies) === null || _cookies3 === void 0 || (_cookies3 = _cookies3.get(internal.VAL_SESSION_COOKIE)) === null || _cookies3 === void 0 ? void 0 : _cookies3.value)
|
|
113
|
+
});
|
|
114
|
+
case 47:
|
|
115
|
+
treeRes = _context.sent;
|
|
116
|
+
if (!(treeRes.status === 200)) {
|
|
117
|
+
_context.next = 53;
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
modules = treeRes.json.modules;
|
|
121
|
+
return _context.abrupt("return", stega.stegaEncode(selector, {
|
|
122
|
+
disabled: !enabled,
|
|
123
|
+
getModule: function getModule(path) {
|
|
124
|
+
var module = modules[path];
|
|
125
|
+
if (module) {
|
|
126
|
+
return module.source;
|
|
105
127
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
case 21:
|
|
113
|
-
case "end":
|
|
114
|
-
return _context.stop();
|
|
128
|
+
}
|
|
129
|
+
}));
|
|
130
|
+
case 53:
|
|
131
|
+
if (!(treeRes.status === 401)) {
|
|
132
|
+
_context.next = 57;
|
|
133
|
+
break;
|
|
115
134
|
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
135
|
+
console.warn("Val: authentication error: ", treeRes.json.message);
|
|
136
|
+
_context.next = 58;
|
|
137
|
+
break;
|
|
138
|
+
case 57:
|
|
139
|
+
throw Error(JSON.stringify(treeRes.json, null, 2));
|
|
140
|
+
case 58:
|
|
141
|
+
return _context.abrupt("return", stega.stegaEncode(selector, {
|
|
142
|
+
disabled: !enabled
|
|
143
|
+
}));
|
|
144
|
+
case 59:
|
|
145
|
+
case "end":
|
|
146
|
+
return _context.stop();
|
|
147
|
+
}
|
|
148
|
+
}, _callee, null, [[1, 7], [12, 20], [24, 30]]);
|
|
149
|
+
}));
|
|
150
|
+
return function exec() {
|
|
151
|
+
return _ref.apply(this, arguments);
|
|
152
|
+
};
|
|
153
|
+
}();
|
|
154
|
+
return exec()["catch"](function (err) {
|
|
155
|
+
console.error("Val: failed to fetch ", err);
|
|
156
|
+
return stega.stegaEncode(selector, {});
|
|
129
157
|
});
|
|
130
158
|
};
|
|
131
159
|
};
|
|
132
160
|
function getHost(headers) {
|
|
133
161
|
var _headers$get;
|
|
134
162
|
// TODO: does NextJs have a way to determine this?
|
|
135
|
-
var host = headers.get("host");
|
|
163
|
+
var host = headers === null || headers === void 0 ? void 0 : headers.get("host");
|
|
136
164
|
var proto = "https";
|
|
137
|
-
if (headers.get("x-forwarded-proto") === "http") {
|
|
165
|
+
if ((headers === null || headers === void 0 ? void 0 : headers.get("x-forwarded-proto")) === "http") {
|
|
138
166
|
proto = "http";
|
|
139
|
-
} else if ((_headers$get = headers.get("referer")) !== null && _headers$get !== void 0 && _headers$get.startsWith("http://")) {
|
|
167
|
+
} else if (headers !== null && headers !== void 0 && (_headers$get = headers.get("referer")) !== null && _headers$get !== void 0 && _headers$get.startsWith("http://")) {
|
|
140
168
|
proto = "http";
|
|
141
169
|
} else if (host !== null && host !== void 0 && host.startsWith("localhost")) {
|
|
142
170
|
proto = "http";
|
|
@@ -192,8 +220,11 @@ function initValRsc(config, valModules, rscNextConfig) {
|
|
|
192
220
|
return asyncToGenerator._regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
193
221
|
while (1) switch (_context2.prev = _context2.next) {
|
|
194
222
|
case 0:
|
|
195
|
-
|
|
196
|
-
|
|
223
|
+
_context2.next = 2;
|
|
224
|
+
return rscNextConfig.draftMode();
|
|
225
|
+
case 2:
|
|
226
|
+
return _context2.abrupt("return", _context2.sent.isEnabled);
|
|
227
|
+
case 3:
|
|
197
228
|
case "end":
|
|
198
229
|
return _context2.stop();
|
|
199
230
|
}
|
|
@@ -205,8 +236,11 @@ function initValRsc(config, valModules, rscNextConfig) {
|
|
|
205
236
|
return asyncToGenerator._regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
206
237
|
while (1) switch (_context3.prev = _context3.next) {
|
|
207
238
|
case 0:
|
|
208
|
-
|
|
209
|
-
|
|
239
|
+
_context3.next = 2;
|
|
240
|
+
return rscNextConfig.draftMode();
|
|
241
|
+
case 2:
|
|
242
|
+
_context3.sent.enable();
|
|
243
|
+
case 3:
|
|
210
244
|
case "end":
|
|
211
245
|
return _context3.stop();
|
|
212
246
|
}
|
|
@@ -218,8 +252,11 @@ function initValRsc(config, valModules, rscNextConfig) {
|
|
|
218
252
|
return asyncToGenerator._regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
219
253
|
while (1) switch (_context4.prev = _context4.next) {
|
|
220
254
|
case 0:
|
|
221
|
-
|
|
222
|
-
|
|
255
|
+
_context4.next = 2;
|
|
256
|
+
return rscNextConfig.draftMode();
|
|
257
|
+
case 2:
|
|
258
|
+
_context4.sent.disable();
|
|
259
|
+
case 3:
|
|
223
260
|
case "end":
|
|
224
261
|
return _context4.stop();
|
|
225
262
|
}
|
|
@@ -230,13 +267,46 @@ function initValRsc(config, valModules, rscNextConfig) {
|
|
|
230
267
|
return {
|
|
231
268
|
fetchValStega: initFetchValStega(config, valApiEndpoints,
|
|
232
269
|
// TODO: get from config
|
|
233
|
-
valServerPromise, function () {
|
|
234
|
-
return
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
270
|
+
valServerPromise, /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee5() {
|
|
271
|
+
return asyncToGenerator._regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
272
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
273
|
+
case 0:
|
|
274
|
+
_context5.next = 2;
|
|
275
|
+
return rscNextConfig.draftMode();
|
|
276
|
+
case 2:
|
|
277
|
+
return _context5.abrupt("return", _context5.sent.isEnabled);
|
|
278
|
+
case 3:
|
|
279
|
+
case "end":
|
|
280
|
+
return _context5.stop();
|
|
281
|
+
}
|
|
282
|
+
}, _callee5);
|
|
283
|
+
})), /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee6() {
|
|
284
|
+
return asyncToGenerator._regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
285
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
286
|
+
case 0:
|
|
287
|
+
_context6.next = 2;
|
|
288
|
+
return rscNextConfig.headers();
|
|
289
|
+
case 2:
|
|
290
|
+
return _context6.abrupt("return", _context6.sent);
|
|
291
|
+
case 3:
|
|
292
|
+
case "end":
|
|
293
|
+
return _context6.stop();
|
|
294
|
+
}
|
|
295
|
+
}, _callee6);
|
|
296
|
+
})), /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee7() {
|
|
297
|
+
return asyncToGenerator._regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
298
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
299
|
+
case 0:
|
|
300
|
+
_context7.next = 2;
|
|
301
|
+
return rscNextConfig.cookies();
|
|
302
|
+
case 2:
|
|
303
|
+
return _context7.abrupt("return", _context7.sent);
|
|
304
|
+
case 3:
|
|
305
|
+
case "end":
|
|
306
|
+
return _context7.stop();
|
|
307
|
+
}
|
|
308
|
+
}, _callee7);
|
|
309
|
+
})))
|
|
240
310
|
};
|
|
241
311
|
}
|
|
242
312
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import 'server-only';
|
|
2
2
|
import { _ as _objectSpread2, a as _defineProperty } from '../../dist/objectSpread2-c1340c1c.esm.js';
|
|
3
3
|
import { _ as _asyncToGenerator, a as _regeneratorRuntime } from '../../dist/asyncToGenerator-5f8c02f3.esm.js';
|
|
4
|
-
import { SET_RSC,
|
|
4
|
+
import { SET_RSC, stegaEncode, SET_AUTO_TAG_JSX_ENABLED } from '@valbuild/react/stega';
|
|
5
5
|
import { Internal } from '@valbuild/core';
|
|
6
6
|
import { VAL_SESSION_COOKIE } from '@valbuild/shared/internal';
|
|
7
7
|
import { createValServer } from '@valbuild/server';
|
|
@@ -10,129 +10,157 @@ import { V as VERSION } from '../../dist/version-98ec5c7a.esm.js';
|
|
|
10
10
|
SET_RSC(true);
|
|
11
11
|
var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies) {
|
|
12
12
|
return function (selector) {
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
13
|
+
var exec = /*#__PURE__*/function () {
|
|
14
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
15
|
+
var enabled, headers, cookies, host, _cookies, _cookies3, valServer, patchesRes, allPatches, treeRes, modules;
|
|
16
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
17
|
+
while (1) switch (_context.prev = _context.next) {
|
|
18
|
+
case 0:
|
|
19
|
+
enabled = false;
|
|
20
|
+
_context.prev = 1;
|
|
21
|
+
_context.next = 4;
|
|
22
|
+
return isEnabled();
|
|
23
|
+
case 4:
|
|
24
|
+
enabled = _context.sent;
|
|
25
|
+
_context.next = 10;
|
|
26
|
+
break;
|
|
27
|
+
case 7:
|
|
28
|
+
_context.prev = 7;
|
|
29
|
+
_context.t0 = _context["catch"](1);
|
|
30
|
+
console.error("Val: could not check if Val is enabled! This might be due to an error to check draftMode. fetchVal can only be used server-side. Use useVal on clients.", _context.t0);
|
|
31
|
+
case 10:
|
|
32
|
+
if (!enabled) {
|
|
33
|
+
_context.next = 58;
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
SET_AUTO_TAG_JSX_ENABLED(true);
|
|
37
|
+
_context.prev = 12;
|
|
38
|
+
_context.next = 15;
|
|
39
|
+
return getHeaders();
|
|
40
|
+
case 15:
|
|
41
|
+
headers = _context.sent;
|
|
42
|
+
if (!(typeof headers.get !== "function")) {
|
|
43
|
+
_context.next = 18;
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
throw new Error("Invalid headers");
|
|
47
|
+
case 18:
|
|
48
|
+
_context.next = 24;
|
|
49
|
+
break;
|
|
50
|
+
case 20:
|
|
51
|
+
_context.prev = 20;
|
|
52
|
+
_context.t1 = _context["catch"](12);
|
|
53
|
+
console.error("Val: could not read headers! fetchVal can only be used server-side. Use useVal on clients.", _context.t1);
|
|
54
|
+
headers = null;
|
|
55
|
+
case 24:
|
|
56
|
+
_context.prev = 24;
|
|
57
|
+
_context.next = 27;
|
|
58
|
+
return getCookies();
|
|
59
|
+
case 27:
|
|
60
|
+
cookies = _context.sent;
|
|
61
|
+
_context.next = 34;
|
|
62
|
+
break;
|
|
63
|
+
case 30:
|
|
64
|
+
_context.prev = 30;
|
|
65
|
+
_context.t2 = _context["catch"](24);
|
|
66
|
+
console.error("Val: could not read cookies! fetchVal can only be used server-side. Use useVal on clients.", _context.t2);
|
|
67
|
+
cookies = null;
|
|
68
|
+
case 34:
|
|
69
|
+
host = headers && getHost(headers);
|
|
70
|
+
if (!(host && cookies)) {
|
|
71
|
+
_context.next = 58;
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
_context.next = 38;
|
|
75
|
+
return valServerPromise;
|
|
76
|
+
case 38:
|
|
77
|
+
valServer = _context.sent;
|
|
78
|
+
_context.next = 41;
|
|
79
|
+
return valServer["/patches/~"]["GET"]({
|
|
80
|
+
query: {
|
|
81
|
+
omit_patch: true,
|
|
82
|
+
author: undefined,
|
|
83
|
+
patch_id: undefined,
|
|
84
|
+
module_file_path: undefined
|
|
85
|
+
},
|
|
86
|
+
cookies: _defineProperty({}, VAL_SESSION_COOKIE, (_cookies = cookies) === null || _cookies === void 0 || (_cookies = _cookies.get(VAL_SESSION_COOKIE)) === null || _cookies === void 0 ? void 0 : _cookies.value)
|
|
87
|
+
});
|
|
88
|
+
case 41:
|
|
89
|
+
patchesRes = _context.sent;
|
|
90
|
+
if (!(patchesRes.status !== 200)) {
|
|
91
|
+
_context.next = 44;
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
throw Error(JSON.stringify(patchesRes.json, null, 2));
|
|
95
|
+
case 44:
|
|
96
|
+
allPatches = Object.keys(patchesRes.json.patches);
|
|
97
|
+
_context.next = 47;
|
|
98
|
+
return valServer["/sources"]["PUT"]({
|
|
99
|
+
path: "/",
|
|
100
|
+
query: {
|
|
101
|
+
validate_sources: true,
|
|
102
|
+
validate_all: false,
|
|
103
|
+
validate_binary_files: false
|
|
104
|
+
},
|
|
105
|
+
body: {
|
|
106
|
+
patchIds: allPatches
|
|
107
|
+
},
|
|
108
|
+
cookies: _defineProperty({}, VAL_SESSION_COOKIE, (_cookies3 = cookies) === null || _cookies3 === void 0 || (_cookies3 = _cookies3.get(VAL_SESSION_COOKIE)) === null || _cookies3 === void 0 ? void 0 : _cookies3.value)
|
|
109
|
+
});
|
|
110
|
+
case 47:
|
|
111
|
+
treeRes = _context.sent;
|
|
112
|
+
if (!(treeRes.status === 200)) {
|
|
113
|
+
_context.next = 53;
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
modules = treeRes.json.modules;
|
|
117
|
+
return _context.abrupt("return", stegaEncode(selector, {
|
|
118
|
+
disabled: !enabled,
|
|
119
|
+
getModule: function getModule(path) {
|
|
120
|
+
var module = modules[path];
|
|
121
|
+
if (module) {
|
|
122
|
+
return module.source;
|
|
101
123
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
case 21:
|
|
109
|
-
case "end":
|
|
110
|
-
return _context.stop();
|
|
124
|
+
}
|
|
125
|
+
}));
|
|
126
|
+
case 53:
|
|
127
|
+
if (!(treeRes.status === 401)) {
|
|
128
|
+
_context.next = 57;
|
|
129
|
+
break;
|
|
111
130
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
131
|
+
console.warn("Val: authentication error: ", treeRes.json.message);
|
|
132
|
+
_context.next = 58;
|
|
133
|
+
break;
|
|
134
|
+
case 57:
|
|
135
|
+
throw Error(JSON.stringify(treeRes.json, null, 2));
|
|
136
|
+
case 58:
|
|
137
|
+
return _context.abrupt("return", stegaEncode(selector, {
|
|
138
|
+
disabled: !enabled
|
|
139
|
+
}));
|
|
140
|
+
case 59:
|
|
141
|
+
case "end":
|
|
142
|
+
return _context.stop();
|
|
143
|
+
}
|
|
144
|
+
}, _callee, null, [[1, 7], [12, 20], [24, 30]]);
|
|
145
|
+
}));
|
|
146
|
+
return function exec() {
|
|
147
|
+
return _ref.apply(this, arguments);
|
|
148
|
+
};
|
|
149
|
+
}();
|
|
150
|
+
return exec()["catch"](function (err) {
|
|
151
|
+
console.error("Val: failed to fetch ", err);
|
|
152
|
+
return stegaEncode(selector, {});
|
|
125
153
|
});
|
|
126
154
|
};
|
|
127
155
|
};
|
|
128
156
|
function getHost(headers) {
|
|
129
157
|
var _headers$get;
|
|
130
158
|
// TODO: does NextJs have a way to determine this?
|
|
131
|
-
var host = headers.get("host");
|
|
159
|
+
var host = headers === null || headers === void 0 ? void 0 : headers.get("host");
|
|
132
160
|
var proto = "https";
|
|
133
|
-
if (headers.get("x-forwarded-proto") === "http") {
|
|
161
|
+
if ((headers === null || headers === void 0 ? void 0 : headers.get("x-forwarded-proto")) === "http") {
|
|
134
162
|
proto = "http";
|
|
135
|
-
} else if ((_headers$get = headers.get("referer")) !== null && _headers$get !== void 0 && _headers$get.startsWith("http://")) {
|
|
163
|
+
} else if (headers !== null && headers !== void 0 && (_headers$get = headers.get("referer")) !== null && _headers$get !== void 0 && _headers$get.startsWith("http://")) {
|
|
136
164
|
proto = "http";
|
|
137
165
|
} else if (host !== null && host !== void 0 && host.startsWith("localhost")) {
|
|
138
166
|
proto = "http";
|
|
@@ -188,8 +216,11 @@ function initValRsc(config, valModules, rscNextConfig) {
|
|
|
188
216
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
189
217
|
while (1) switch (_context2.prev = _context2.next) {
|
|
190
218
|
case 0:
|
|
191
|
-
|
|
192
|
-
|
|
219
|
+
_context2.next = 2;
|
|
220
|
+
return rscNextConfig.draftMode();
|
|
221
|
+
case 2:
|
|
222
|
+
return _context2.abrupt("return", _context2.sent.isEnabled);
|
|
223
|
+
case 3:
|
|
193
224
|
case "end":
|
|
194
225
|
return _context2.stop();
|
|
195
226
|
}
|
|
@@ -201,8 +232,11 @@ function initValRsc(config, valModules, rscNextConfig) {
|
|
|
201
232
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
202
233
|
while (1) switch (_context3.prev = _context3.next) {
|
|
203
234
|
case 0:
|
|
204
|
-
|
|
205
|
-
|
|
235
|
+
_context3.next = 2;
|
|
236
|
+
return rscNextConfig.draftMode();
|
|
237
|
+
case 2:
|
|
238
|
+
_context3.sent.enable();
|
|
239
|
+
case 3:
|
|
206
240
|
case "end":
|
|
207
241
|
return _context3.stop();
|
|
208
242
|
}
|
|
@@ -214,8 +248,11 @@ function initValRsc(config, valModules, rscNextConfig) {
|
|
|
214
248
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
215
249
|
while (1) switch (_context4.prev = _context4.next) {
|
|
216
250
|
case 0:
|
|
217
|
-
|
|
218
|
-
|
|
251
|
+
_context4.next = 2;
|
|
252
|
+
return rscNextConfig.draftMode();
|
|
253
|
+
case 2:
|
|
254
|
+
_context4.sent.disable();
|
|
255
|
+
case 3:
|
|
219
256
|
case "end":
|
|
220
257
|
return _context4.stop();
|
|
221
258
|
}
|
|
@@ -226,13 +263,46 @@ function initValRsc(config, valModules, rscNextConfig) {
|
|
|
226
263
|
return {
|
|
227
264
|
fetchValStega: initFetchValStega(config, valApiEndpoints,
|
|
228
265
|
// TODO: get from config
|
|
229
|
-
valServerPromise, function () {
|
|
230
|
-
return
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
266
|
+
valServerPromise, /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
267
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
268
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
269
|
+
case 0:
|
|
270
|
+
_context5.next = 2;
|
|
271
|
+
return rscNextConfig.draftMode();
|
|
272
|
+
case 2:
|
|
273
|
+
return _context5.abrupt("return", _context5.sent.isEnabled);
|
|
274
|
+
case 3:
|
|
275
|
+
case "end":
|
|
276
|
+
return _context5.stop();
|
|
277
|
+
}
|
|
278
|
+
}, _callee5);
|
|
279
|
+
})), /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
280
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
281
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
282
|
+
case 0:
|
|
283
|
+
_context6.next = 2;
|
|
284
|
+
return rscNextConfig.headers();
|
|
285
|
+
case 2:
|
|
286
|
+
return _context6.abrupt("return", _context6.sent);
|
|
287
|
+
case 3:
|
|
288
|
+
case "end":
|
|
289
|
+
return _context6.stop();
|
|
290
|
+
}
|
|
291
|
+
}, _callee6);
|
|
292
|
+
})), /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
293
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
294
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
295
|
+
case 0:
|
|
296
|
+
_context7.next = 2;
|
|
297
|
+
return rscNextConfig.cookies();
|
|
298
|
+
case 2:
|
|
299
|
+
return _context7.abrupt("return", _context7.sent);
|
|
300
|
+
case 3:
|
|
301
|
+
case "end":
|
|
302
|
+
return _context7.stop();
|
|
303
|
+
}
|
|
304
|
+
}, _callee7);
|
|
305
|
+
})))
|
|
236
306
|
};
|
|
237
307
|
}
|
|
238
308
|
|
|
@@ -33,8 +33,11 @@ var initValNextAppRouter = function initValNextAppRouter(valModules, config, nex
|
|
|
33
33
|
return asyncToGenerator._regeneratorRuntime().wrap(function _callee$(_context) {
|
|
34
34
|
while (1) switch (_context.prev = _context.next) {
|
|
35
35
|
case 0:
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
_context.next = 2;
|
|
37
|
+
return nextConfig.draftMode();
|
|
38
|
+
case 2:
|
|
39
|
+
return _context.abrupt("return", _context.sent.isEnabled);
|
|
40
|
+
case 3:
|
|
38
41
|
case "end":
|
|
39
42
|
return _context.stop();
|
|
40
43
|
}
|
|
@@ -46,8 +49,11 @@ var initValNextAppRouter = function initValNextAppRouter(valModules, config, nex
|
|
|
46
49
|
return asyncToGenerator._regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
47
50
|
while (1) switch (_context2.prev = _context2.next) {
|
|
48
51
|
case 0:
|
|
49
|
-
|
|
50
|
-
|
|
52
|
+
_context2.next = 2;
|
|
53
|
+
return nextConfig.draftMode();
|
|
54
|
+
case 2:
|
|
55
|
+
_context2.sent.enable();
|
|
56
|
+
case 3:
|
|
51
57
|
case "end":
|
|
52
58
|
return _context2.stop();
|
|
53
59
|
}
|
|
@@ -59,8 +65,11 @@ var initValNextAppRouter = function initValNextAppRouter(valModules, config, nex
|
|
|
59
65
|
return asyncToGenerator._regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
60
66
|
while (1) switch (_context3.prev = _context3.next) {
|
|
61
67
|
case 0:
|
|
62
|
-
|
|
63
|
-
|
|
68
|
+
_context3.next = 2;
|
|
69
|
+
return nextConfig.draftMode();
|
|
70
|
+
case 2:
|
|
71
|
+
_context3.sent.disable();
|
|
72
|
+
case 3:
|
|
64
73
|
case "end":
|
|
65
74
|
return _context3.stop();
|
|
66
75
|
}
|
|
@@ -33,8 +33,11 @@ var initValNextAppRouter = function initValNextAppRouter(valModules, config, nex
|
|
|
33
33
|
return asyncToGenerator._regeneratorRuntime().wrap(function _callee$(_context) {
|
|
34
34
|
while (1) switch (_context.prev = _context.next) {
|
|
35
35
|
case 0:
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
_context.next = 2;
|
|
37
|
+
return nextConfig.draftMode();
|
|
38
|
+
case 2:
|
|
39
|
+
return _context.abrupt("return", _context.sent.isEnabled);
|
|
40
|
+
case 3:
|
|
38
41
|
case "end":
|
|
39
42
|
return _context.stop();
|
|
40
43
|
}
|
|
@@ -46,8 +49,11 @@ var initValNextAppRouter = function initValNextAppRouter(valModules, config, nex
|
|
|
46
49
|
return asyncToGenerator._regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
47
50
|
while (1) switch (_context2.prev = _context2.next) {
|
|
48
51
|
case 0:
|
|
49
|
-
|
|
50
|
-
|
|
52
|
+
_context2.next = 2;
|
|
53
|
+
return nextConfig.draftMode();
|
|
54
|
+
case 2:
|
|
55
|
+
_context2.sent.enable();
|
|
56
|
+
case 3:
|
|
51
57
|
case "end":
|
|
52
58
|
return _context2.stop();
|
|
53
59
|
}
|
|
@@ -59,8 +65,11 @@ var initValNextAppRouter = function initValNextAppRouter(valModules, config, nex
|
|
|
59
65
|
return asyncToGenerator._regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
60
66
|
while (1) switch (_context3.prev = _context3.next) {
|
|
61
67
|
case 0:
|
|
62
|
-
|
|
63
|
-
|
|
68
|
+
_context3.next = 2;
|
|
69
|
+
return nextConfig.draftMode();
|
|
70
|
+
case 2:
|
|
71
|
+
_context3.sent.disable();
|
|
72
|
+
case 3:
|
|
64
73
|
case "end":
|
|
65
74
|
return _context3.stop();
|
|
66
75
|
}
|
|
@@ -29,8 +29,11 @@ var initValNextAppRouter = function initValNextAppRouter(valModules, config, nex
|
|
|
29
29
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
30
30
|
while (1) switch (_context.prev = _context.next) {
|
|
31
31
|
case 0:
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
_context.next = 2;
|
|
33
|
+
return nextConfig.draftMode();
|
|
34
|
+
case 2:
|
|
35
|
+
return _context.abrupt("return", _context.sent.isEnabled);
|
|
36
|
+
case 3:
|
|
34
37
|
case "end":
|
|
35
38
|
return _context.stop();
|
|
36
39
|
}
|
|
@@ -42,8 +45,11 @@ var initValNextAppRouter = function initValNextAppRouter(valModules, config, nex
|
|
|
42
45
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
43
46
|
while (1) switch (_context2.prev = _context2.next) {
|
|
44
47
|
case 0:
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
_context2.next = 2;
|
|
49
|
+
return nextConfig.draftMode();
|
|
50
|
+
case 2:
|
|
51
|
+
_context2.sent.enable();
|
|
52
|
+
case 3:
|
|
47
53
|
case "end":
|
|
48
54
|
return _context2.stop();
|
|
49
55
|
}
|
|
@@ -55,8 +61,11 @@ var initValNextAppRouter = function initValNextAppRouter(valModules, config, nex
|
|
|
55
61
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
56
62
|
while (1) switch (_context3.prev = _context3.next) {
|
|
57
63
|
case 0:
|
|
58
|
-
|
|
59
|
-
|
|
64
|
+
_context3.next = 2;
|
|
65
|
+
return nextConfig.draftMode();
|
|
66
|
+
case 2:
|
|
67
|
+
_context3.sent.disable();
|
|
68
|
+
case 3:
|
|
60
69
|
case "end":
|
|
61
70
|
return _context3.stop();
|
|
62
71
|
}
|