@valbuild/next 0.135.0 → 0.136.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/CHANGELOG.md +53 -0
- package/dist/declarations/src/rsc/initValRsc.d.ts +52 -6
- package/dist/valbuild-next.cjs.dev.js +1 -1
- package/dist/valbuild-next.cjs.prod.js +1 -1
- package/dist/valbuild-next.esm.js +1 -1
- package/dist/{version-58fd6989.cjs.prod.js → version-52797e16.cjs.prod.js} +1 -1
- package/dist/{version-12fffb44.esm.js → version-b626279e.esm.js} +1 -1
- package/dist/{version-77226c0a.cjs.dev.js → version-f31c6541.cjs.dev.js} +1 -1
- package/package.json +8 -8
- package/rsc/dist/valbuild-next-rsc.cjs.dev.js +374 -254
- package/rsc/dist/valbuild-next-rsc.cjs.prod.js +374 -254
- package/rsc/dist/valbuild-next-rsc.esm.js +375 -255
- package/server/dist/valbuild-next-server.cjs.dev.js +1 -1
- package/server/dist/valbuild-next-server.cjs.prod.js +1 -1
- package/server/dist/valbuild-next-server.esm.js +1 -1
|
@@ -4,122 +4,251 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
require('server-only');
|
|
6
6
|
var routeFromVal = require('../../dist/routeFromVal-e0995830.cjs.prod.js');
|
|
7
|
+
var defineProperty = require('../../dist/defineProperty-8951f469.cjs.prod.js');
|
|
7
8
|
var objectSpread2 = require('../../dist/objectSpread2-13f847a9.cjs.prod.js');
|
|
8
9
|
var asyncToGenerator = require('../../dist/asyncToGenerator-8e5c36c8.cjs.prod.js');
|
|
9
|
-
var defineProperty = require('../../dist/defineProperty-8951f469.cjs.prod.js');
|
|
10
10
|
var stega = require('@valbuild/react/stega');
|
|
11
11
|
var core = require('@valbuild/core');
|
|
12
|
+
var React = require('react');
|
|
12
13
|
var internal = require('@valbuild/shared/internal');
|
|
13
14
|
var server = require('@valbuild/server');
|
|
14
|
-
var version = require('../../dist/version-
|
|
15
|
+
var version = require('../../dist/version-52797e16.cjs.prod.js');
|
|
15
16
|
require('../../dist/createForOfIteratorHelper-d4afcad8.cjs.prod.js');
|
|
16
17
|
require('../../dist/unsupportedIterableToArray-0d2087a2.cjs.prod.js');
|
|
17
18
|
require('../../dist/slicedToArray-ce613de6.cjs.prod.js');
|
|
18
19
|
require('@valbuild/shared/client');
|
|
19
20
|
|
|
20
21
|
stega.SET_RSC(true);
|
|
21
|
-
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The `modules` map every `fetchVal` in one render shares.
|
|
25
|
+
*
|
|
26
|
+
* Derived from the route's own response type rather than restated, so it cannot
|
|
27
|
+
* drift from what `/sources/~` actually returns.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The slice of `ValServer` the draft-sources reader uses.
|
|
32
|
+
*
|
|
33
|
+
* Narrower than `ValServer` for the same reason `JsonEntryValServer` below is:
|
|
34
|
+
* it says what the dependency IS, and it lets a test drive the reader with a
|
|
35
|
+
* one-route fake instead of casting a partial object to the whole server type.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/** What the route readers need: the tree, plus the single-entry route. */
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Where the reader gets its per-request memo box.
|
|
42
|
+
*
|
|
43
|
+
* Injected rather than reached for, so that "this reader needs a request to
|
|
44
|
+
* scope its cache to" is part of its contract and a test can supply a scope it
|
|
45
|
+
* controls — in jest, React's non-`react-server` build makes `cache` a
|
|
46
|
+
* pass-through, so the real wiring memoises nothing there.
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* A per-request memo box, from React's request memoisation.
|
|
51
|
+
*
|
|
52
|
+
* `cache()` is what makes this safe: in an RSC render React hands back the SAME
|
|
53
|
+
* object for the length of one request and a fresh one for the next. Outside
|
|
54
|
+
* that — a route handler, a test, the non-`react-server` build of React —
|
|
55
|
+
* `cache` is a pass-through, so every call gets its own object, the memo misses,
|
|
56
|
+
* and the reader does exactly what it did before. Ineffective, never shared.
|
|
57
|
+
* See `memoizePerRequest`. `fetchVal` is an RSC API (`SET_RSC(true)` above, and
|
|
58
|
+
* its own error messages say so), so the effective case is the normal one.
|
|
59
|
+
*
|
|
60
|
+
* Built PER `initValRsc` rather than once for the module, because the box is
|
|
61
|
+
* only as specific as the `cache()` it came from: two Val servers in one
|
|
62
|
+
* process sharing one would answer each other's reads within a request, and
|
|
63
|
+
* they hold different content.
|
|
64
|
+
*/
|
|
65
|
+
function createReactCacheScope() {
|
|
66
|
+
var getBox = React.cache(function () {
|
|
67
|
+
return {};
|
|
68
|
+
});
|
|
69
|
+
return /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee() {
|
|
70
|
+
return asyncToGenerator._regenerator().w(function (_context) {
|
|
71
|
+
while (1) switch (_context.n) {
|
|
72
|
+
case 0:
|
|
73
|
+
return _context.a(2, getBox());
|
|
74
|
+
}
|
|
75
|
+
}, _callee);
|
|
76
|
+
}));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* ONE read of the whole module tree, for the session in `sessionCookie`.
|
|
81
|
+
*
|
|
82
|
+
* `path` stays `"/"` on purpose, and the measurement is why. `/sources/~`
|
|
83
|
+
* evaluates, previews and validates EVERY module and only THEN filters the
|
|
84
|
+
* response by `req.path` (the two TODOs in `ValServer.ts` say so), so narrowing
|
|
85
|
+
* the path shrinks the answer and changes the work not at all: on a 60-module
|
|
86
|
+
* project, `path: "/"` took 53.6ms and a single-module path 53.5ms. And this is
|
|
87
|
+
* an in-process call rather than a round trip, so the object it builds is never
|
|
88
|
+
* serialised or sent anywhere — the bytes it saves are not bytes anyone pays
|
|
89
|
+
* for. Narrowing would also give each caller a different answer to cache, which
|
|
90
|
+
* is what would cost the saving that IS real (2.7x on the same project).
|
|
91
|
+
*
|
|
92
|
+
* `draftRead.perf.test.ts` prints both numbers; re-run it before believing
|
|
93
|
+
* anything different.
|
|
94
|
+
*
|
|
95
|
+
* Returns `null` when the session is not one the server accepts; the caller
|
|
96
|
+
* then renders published content, which is what it did before.
|
|
97
|
+
*/
|
|
98
|
+
function loadDraftSources(_x, _x2) {
|
|
99
|
+
return _loadDraftSources.apply(this, arguments);
|
|
100
|
+
}
|
|
101
|
+
function _loadDraftSources() {
|
|
102
|
+
_loadDraftSources = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee18(valServerPromise, sessionCookie) {
|
|
103
|
+
var valServer, treeRes;
|
|
104
|
+
return asyncToGenerator._regenerator().w(function (_context18) {
|
|
105
|
+
while (1) switch (_context18.n) {
|
|
106
|
+
case 0:
|
|
107
|
+
_context18.n = 1;
|
|
108
|
+
return valServerPromise;
|
|
109
|
+
case 1:
|
|
110
|
+
valServer = _context18.v;
|
|
111
|
+
_context18.n = 2;
|
|
112
|
+
return valServer["/sources/~"]["PUT"]({
|
|
113
|
+
path: "/",
|
|
114
|
+
query: {
|
|
115
|
+
validate_sources: true,
|
|
116
|
+
validate_binary_files: false,
|
|
117
|
+
exclude_patches: false,
|
|
118
|
+
// RSC pre-render uses the legacy "server applies patches" path.
|
|
119
|
+
apply_patches: undefined,
|
|
120
|
+
/*
|
|
121
|
+
* The caller's own staged work, and nobody else's.
|
|
122
|
+
*
|
|
123
|
+
* A draft render cannot name its group ids — it has no client
|
|
124
|
+
* state — so it asks for "mine" and the server resolves them from
|
|
125
|
+
* the session. Without this a preview shows base + every pending
|
|
126
|
+
* patch on the branch, so one person's half-finished edit appears
|
|
127
|
+
* in another person's draft.
|
|
128
|
+
*
|
|
129
|
+
* `patch_id` stays `undefined`: naming an explicit list is for a
|
|
130
|
+
* caller that already knows what it wants, and it would override
|
|
131
|
+
* the resolution rather than intersect with it.
|
|
132
|
+
*/
|
|
133
|
+
patch_id: undefined,
|
|
134
|
+
own_patch_groups_only: true
|
|
135
|
+
},
|
|
136
|
+
cookies: defineProperty._defineProperty({}, internal.VAL_SESSION_COOKIE, sessionCookie)
|
|
137
|
+
});
|
|
138
|
+
case 2:
|
|
139
|
+
treeRes = _context18.v;
|
|
140
|
+
if (!(treeRes.status === 200)) {
|
|
141
|
+
_context18.n = 3;
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
return _context18.a(2, treeRes.json.modules);
|
|
145
|
+
case 3:
|
|
146
|
+
if (!(treeRes.status === 401)) {
|
|
147
|
+
_context18.n = 4;
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
console.warn("Val: authentication error: ", treeRes.json.message);
|
|
151
|
+
return _context18.a(2, null);
|
|
152
|
+
case 4:
|
|
153
|
+
throw Error(JSON.stringify(treeRes.json, null, 2));
|
|
154
|
+
case 5:
|
|
155
|
+
return _context18.a(2);
|
|
156
|
+
}
|
|
157
|
+
}, _callee18);
|
|
158
|
+
}));
|
|
159
|
+
return _loadDraftSources.apply(this, arguments);
|
|
160
|
+
}
|
|
161
|
+
var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies, getDraftSourcesScope) {
|
|
22
162
|
return function (selector) {
|
|
23
163
|
var exec = /*#__PURE__*/function () {
|
|
24
|
-
var
|
|
25
|
-
var enabled, headers, cookies, host, _cookies,
|
|
26
|
-
return asyncToGenerator._regenerator().w(function (
|
|
27
|
-
while (1) switch (
|
|
164
|
+
var _ref2 = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee2() {
|
|
165
|
+
var enabled, headers, cookies, host, _cookies, sessionCookie, modules, _t, _t2, _t3, _t4;
|
|
166
|
+
return asyncToGenerator._regenerator().w(function (_context2) {
|
|
167
|
+
while (1) switch (_context2.p = _context2.n) {
|
|
28
168
|
case 0:
|
|
29
169
|
enabled = false;
|
|
30
|
-
|
|
31
|
-
|
|
170
|
+
_context2.p = 1;
|
|
171
|
+
_context2.n = 2;
|
|
32
172
|
return isEnabled();
|
|
33
173
|
case 2:
|
|
34
|
-
enabled =
|
|
35
|
-
|
|
174
|
+
enabled = _context2.v;
|
|
175
|
+
_context2.n = 4;
|
|
36
176
|
break;
|
|
37
177
|
case 3:
|
|
38
|
-
|
|
39
|
-
_t =
|
|
178
|
+
_context2.p = 3;
|
|
179
|
+
_t = _context2.v;
|
|
40
180
|
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.", _t);
|
|
41
181
|
case 4:
|
|
42
182
|
if (!enabled) {
|
|
43
|
-
|
|
183
|
+
_context2.n = 15;
|
|
44
184
|
break;
|
|
45
185
|
}
|
|
46
186
|
stega.SET_AUTO_TAG_JSX_ENABLED(true);
|
|
47
|
-
|
|
48
|
-
|
|
187
|
+
_context2.p = 5;
|
|
188
|
+
_context2.n = 6;
|
|
49
189
|
return getHeaders();
|
|
50
190
|
case 6:
|
|
51
|
-
headers =
|
|
191
|
+
headers = _context2.v;
|
|
52
192
|
if (!(typeof headers.get !== "function")) {
|
|
53
|
-
|
|
193
|
+
_context2.n = 7;
|
|
54
194
|
break;
|
|
55
195
|
}
|
|
56
196
|
throw new Error("Invalid headers");
|
|
57
197
|
case 7:
|
|
58
|
-
|
|
198
|
+
_context2.n = 9;
|
|
59
199
|
break;
|
|
60
200
|
case 8:
|
|
61
|
-
|
|
62
|
-
_t2 =
|
|
201
|
+
_context2.p = 8;
|
|
202
|
+
_t2 = _context2.v;
|
|
63
203
|
console.error("Val: could not read headers! fetchVal can only be used server-side. Use useVal on clients.", _t2);
|
|
64
204
|
headers = null;
|
|
65
205
|
case 9:
|
|
66
|
-
|
|
67
|
-
|
|
206
|
+
_context2.p = 9;
|
|
207
|
+
_context2.n = 10;
|
|
68
208
|
return getCookies();
|
|
69
209
|
case 10:
|
|
70
|
-
cookies =
|
|
71
|
-
|
|
210
|
+
cookies = _context2.v;
|
|
211
|
+
_context2.n = 12;
|
|
72
212
|
break;
|
|
73
213
|
case 11:
|
|
74
|
-
|
|
75
|
-
_t3 =
|
|
214
|
+
_context2.p = 11;
|
|
215
|
+
_t3 = _context2.v;
|
|
76
216
|
console.error("Val: could not read cookies! fetchVal can only be used server-side. Use useVal on clients.", _t3);
|
|
77
217
|
cookies = null;
|
|
78
218
|
case 12:
|
|
79
219
|
host = headers && getHost(headers);
|
|
80
220
|
if (!(host && cookies)) {
|
|
81
|
-
|
|
221
|
+
_context2.n = 15;
|
|
82
222
|
break;
|
|
83
223
|
}
|
|
84
|
-
|
|
85
|
-
|
|
224
|
+
sessionCookie = (_cookies = cookies) === null || _cookies === void 0 || (_cookies = _cookies.get(internal.VAL_SESSION_COOKIE)) === null || _cookies === void 0 ? void 0 : _cookies.value;
|
|
225
|
+
/*
|
|
226
|
+
* Once per request, however many times the page reads.
|
|
227
|
+
*
|
|
228
|
+
* Every `fetchVal` in one render asks the same question — same query,
|
|
229
|
+
* same session — so the second and third answer were identical and
|
|
230
|
+
* cost the same as the first. `fetchValRouteUrl` made that worse by
|
|
231
|
+
* calling `fetchVal` again on top of the caller's own.
|
|
232
|
+
*
|
|
233
|
+
* The key is the session, so a box that somehow outlived its request
|
|
234
|
+
* misses rather than serving another author's draft. See
|
|
235
|
+
* `memoizePerRequest`.
|
|
236
|
+
*/
|
|
237
|
+
_t4 = internal.memoizePerRequest;
|
|
238
|
+
_context2.n = 13;
|
|
239
|
+
return getDraftSourcesScope();
|
|
86
240
|
case 13:
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
path: "/",
|
|
91
|
-
query: {
|
|
92
|
-
validate_sources: true,
|
|
93
|
-
validate_binary_files: false,
|
|
94
|
-
exclude_patches: false,
|
|
95
|
-
// RSC pre-render uses the legacy "server applies patches" path.
|
|
96
|
-
apply_patches: undefined,
|
|
97
|
-
/*
|
|
98
|
-
* The caller's own staged work, and nobody else's.
|
|
99
|
-
*
|
|
100
|
-
* A draft render cannot name its group ids — it has no client
|
|
101
|
-
* state — so it asks for "mine" and the server resolves them from
|
|
102
|
-
* the session. Without this a preview shows base + every pending
|
|
103
|
-
* patch on the branch, so one person's half-finished edit appears
|
|
104
|
-
* in another person's draft.
|
|
105
|
-
*
|
|
106
|
-
* `patch_id` stays `undefined`: naming an explicit list is for a
|
|
107
|
-
* caller that already knows what it wants, and it would override
|
|
108
|
-
* the resolution rather than intersect with it.
|
|
109
|
-
*/
|
|
110
|
-
patch_id: undefined,
|
|
111
|
-
own_patch_groups_only: true
|
|
112
|
-
},
|
|
113
|
-
cookies: defineProperty._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)
|
|
241
|
+
_context2.n = 14;
|
|
242
|
+
return _t4(_context2.v, sessionCookie !== null && sessionCookie !== void 0 ? sessionCookie : "", function () {
|
|
243
|
+
return loadDraftSources(valServerPromise, sessionCookie);
|
|
114
244
|
});
|
|
115
245
|
case 14:
|
|
116
|
-
|
|
117
|
-
if (!
|
|
118
|
-
|
|
246
|
+
modules = _context2.v;
|
|
247
|
+
if (!modules) {
|
|
248
|
+
_context2.n = 15;
|
|
119
249
|
break;
|
|
120
250
|
}
|
|
121
|
-
|
|
122
|
-
return _context.a(2, stega.stegaEncode(selector, {
|
|
251
|
+
return _context2.a(2, stega.stegaEncode(selector, {
|
|
123
252
|
disabled: !enabled,
|
|
124
253
|
getModule: function getModule(path) {
|
|
125
254
|
var module = modules[path];
|
|
@@ -129,24 +258,14 @@ var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valS
|
|
|
129
258
|
}
|
|
130
259
|
}));
|
|
131
260
|
case 15:
|
|
132
|
-
|
|
133
|
-
_context.n = 16;
|
|
134
|
-
break;
|
|
135
|
-
}
|
|
136
|
-
console.warn("Val: authentication error: ", treeRes.json.message);
|
|
137
|
-
_context.n = 17;
|
|
138
|
-
break;
|
|
139
|
-
case 16:
|
|
140
|
-
throw Error(JSON.stringify(treeRes.json, null, 2));
|
|
141
|
-
case 17:
|
|
142
|
-
return _context.a(2, stega.stegaEncode(selector, {
|
|
261
|
+
return _context2.a(2, stega.stegaEncode(selector, {
|
|
143
262
|
disabled: !enabled
|
|
144
263
|
}));
|
|
145
264
|
}
|
|
146
|
-
},
|
|
265
|
+
}, _callee2, null, [[9, 11], [5, 8], [1, 3]]);
|
|
147
266
|
}));
|
|
148
267
|
return function exec() {
|
|
149
|
-
return
|
|
268
|
+
return _ref2.apply(this, arguments);
|
|
150
269
|
};
|
|
151
270
|
}();
|
|
152
271
|
return exec()["catch"](function (err) {
|
|
@@ -196,17 +315,17 @@ function getHost(headers) {
|
|
|
196
315
|
// }
|
|
197
316
|
// }
|
|
198
317
|
|
|
199
|
-
var initFetchValRouteStega = function initFetchValRouteStega(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies) {
|
|
318
|
+
var initFetchValRouteStega = function initFetchValRouteStega(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies, getDraftSourcesScope) {
|
|
200
319
|
return /*#__PURE__*/function () {
|
|
201
|
-
var
|
|
202
|
-
var resolvedParams, valModule, path, schema, source, url, enabled, draft, content, fetchVal, val, route,
|
|
203
|
-
return asyncToGenerator._regenerator().w(function (
|
|
204
|
-
while (1) switch (
|
|
320
|
+
var _ref3 = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee3(selector, params) {
|
|
321
|
+
var resolvedParams, valModule, path, schema, source, url, enabled, draft, content, fetchVal, val, route, _t6;
|
|
322
|
+
return asyncToGenerator._regenerator().w(function (_context3) {
|
|
323
|
+
while (1) switch (_context3.p = _context3.n) {
|
|
205
324
|
case 0:
|
|
206
|
-
|
|
325
|
+
_context3.n = 1;
|
|
207
326
|
return Promise.resolve(params);
|
|
208
327
|
case 1:
|
|
209
|
-
resolvedParams =
|
|
328
|
+
resolvedParams = _context3.v;
|
|
210
329
|
// A view is a pointer: everything below reads a path, a schema and a source
|
|
211
330
|
// off this, and a pointer has none of them. See `resolveViewedModule`.
|
|
212
331
|
valModule = core.Internal.resolveViewedModule(selector);
|
|
@@ -215,78 +334,78 @@ var initFetchValRouteStega = function initFetchValRouteStega(config, valApiEndpo
|
|
|
215
334
|
// entry's backing `*.val.json`, instead of eagerly resolving the whole
|
|
216
335
|
// record via `fetchVal`.
|
|
217
336
|
if (!routeFromVal.isJsonValuesRecordSchema(schema)) {
|
|
218
|
-
|
|
337
|
+
_context3.n = 11;
|
|
219
338
|
break;
|
|
220
339
|
}
|
|
221
340
|
source = valModule && core.Internal.getSource(valModule);
|
|
222
341
|
url = routeFromVal.getValRouteUrlFromVal(resolvedParams, "fetchValRoute", path, schema, source);
|
|
223
342
|
if (url) {
|
|
224
|
-
|
|
343
|
+
_context3.n = 2;
|
|
225
344
|
break;
|
|
226
345
|
}
|
|
227
|
-
return
|
|
346
|
+
return _context3.a(2, null);
|
|
228
347
|
case 2:
|
|
229
348
|
enabled = false;
|
|
230
|
-
|
|
231
|
-
|
|
349
|
+
_context3.p = 3;
|
|
350
|
+
_context3.n = 4;
|
|
232
351
|
return isEnabled();
|
|
233
352
|
case 4:
|
|
234
|
-
enabled =
|
|
235
|
-
|
|
353
|
+
enabled = _context3.v;
|
|
354
|
+
_context3.n = 6;
|
|
236
355
|
break;
|
|
237
356
|
case 5:
|
|
238
|
-
|
|
239
|
-
|
|
357
|
+
_context3.p = 5;
|
|
358
|
+
_context3.v;
|
|
240
359
|
case 6:
|
|
241
360
|
draft = {
|
|
242
361
|
status: "unavailable"
|
|
243
362
|
};
|
|
244
363
|
if (!(enabled && path)) {
|
|
245
|
-
|
|
364
|
+
_context3.n = 8;
|
|
246
365
|
break;
|
|
247
366
|
}
|
|
248
367
|
stega.SET_AUTO_TAG_JSX_ENABLED(true);
|
|
249
|
-
|
|
368
|
+
_context3.n = 7;
|
|
250
369
|
return loadDraftJsonEntry(valServerPromise, getCookies, path, url);
|
|
251
370
|
case 7:
|
|
252
|
-
draft =
|
|
371
|
+
draft = _context3.v;
|
|
253
372
|
case 8:
|
|
254
|
-
|
|
373
|
+
_context3.n = 9;
|
|
255
374
|
return resolveDraftOrCommittedEntry(draft, function () {
|
|
256
375
|
return loadJsonEntryContent(source, url);
|
|
257
376
|
});
|
|
258
377
|
case 9:
|
|
259
|
-
content =
|
|
378
|
+
content = _context3.v;
|
|
260
379
|
if (!(content === undefined)) {
|
|
261
|
-
|
|
380
|
+
_context3.n = 10;
|
|
262
381
|
break;
|
|
263
382
|
}
|
|
264
|
-
return
|
|
383
|
+
return _context3.a(2, null);
|
|
265
384
|
case 10:
|
|
266
|
-
return
|
|
385
|
+
return _context3.a(2, stega.stegaEncode(content, {
|
|
267
386
|
disabled: !enabled,
|
|
268
387
|
root: routeFromVal.getJsonEntryStegaRoot(valModule, url)
|
|
269
388
|
}));
|
|
270
389
|
case 11:
|
|
271
|
-
fetchVal = initFetchValStega(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies);
|
|
272
|
-
|
|
273
|
-
if (!
|
|
274
|
-
|
|
390
|
+
fetchVal = initFetchValStega(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies, getDraftSourcesScope);
|
|
391
|
+
_t6 = valModule;
|
|
392
|
+
if (!_t6) {
|
|
393
|
+
_context3.n = 13;
|
|
275
394
|
break;
|
|
276
395
|
}
|
|
277
|
-
|
|
396
|
+
_context3.n = 12;
|
|
278
397
|
return fetchVal(valModule);
|
|
279
398
|
case 12:
|
|
280
|
-
|
|
399
|
+
_t6 = _context3.v;
|
|
281
400
|
case 13:
|
|
282
|
-
val =
|
|
401
|
+
val = _t6;
|
|
283
402
|
route = routeFromVal.initValRouteFromVal(resolvedParams, "fetchValRoute", path, schema, val);
|
|
284
|
-
return
|
|
403
|
+
return _context3.a(2, route);
|
|
285
404
|
}
|
|
286
|
-
},
|
|
405
|
+
}, _callee3, null, [[3, 5]]);
|
|
287
406
|
}));
|
|
288
|
-
return function (
|
|
289
|
-
return
|
|
407
|
+
return function (_x3, _x4) {
|
|
408
|
+
return _ref3.apply(this, arguments);
|
|
290
409
|
};
|
|
291
410
|
}();
|
|
292
411
|
};
|
|
@@ -296,7 +415,7 @@ var initFetchValRouteStega = function initFetchValRouteStega(config, valApiEndpo
|
|
|
296
415
|
* source markers (one dynamic import). Returns `undefined` when the key is
|
|
297
416
|
* missing or its marker has no runtime thunk (transport marker / draft entry).
|
|
298
417
|
*/
|
|
299
|
-
function loadJsonEntryContent(
|
|
418
|
+
function loadJsonEntryContent(_x5, _x6) {
|
|
300
419
|
return _loadJsonEntryContent.apply(this, arguments);
|
|
301
420
|
}
|
|
302
421
|
/**
|
|
@@ -321,37 +440,37 @@ function loadJsonEntryContent(_x3, _x4) {
|
|
|
321
440
|
* to the whole server type.
|
|
322
441
|
*/
|
|
323
442
|
function _loadJsonEntryContent() {
|
|
324
|
-
_loadJsonEntryContent = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function
|
|
443
|
+
_loadJsonEntryContent = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee19(source, key) {
|
|
325
444
|
var marker, thunk;
|
|
326
|
-
return asyncToGenerator._regenerator().w(function (
|
|
327
|
-
while (1) switch (
|
|
445
|
+
return asyncToGenerator._regenerator().w(function (_context19) {
|
|
446
|
+
while (1) switch (_context19.n) {
|
|
328
447
|
case 0:
|
|
329
448
|
if (!(!source || routeFromVal._typeof(source) !== "object")) {
|
|
330
|
-
|
|
449
|
+
_context19.n = 1;
|
|
331
450
|
break;
|
|
332
451
|
}
|
|
333
|
-
return
|
|
452
|
+
return _context19.a(2, undefined);
|
|
334
453
|
case 1:
|
|
335
454
|
marker = source[key];
|
|
336
455
|
if (core.Internal.isJson(marker)) {
|
|
337
|
-
|
|
456
|
+
_context19.n = 2;
|
|
338
457
|
break;
|
|
339
458
|
}
|
|
340
|
-
return
|
|
459
|
+
return _context19.a(2, undefined);
|
|
341
460
|
case 2:
|
|
342
461
|
thunk = core.Internal.getJsonImport(marker);
|
|
343
462
|
if (thunk) {
|
|
344
|
-
|
|
463
|
+
_context19.n = 3;
|
|
345
464
|
break;
|
|
346
465
|
}
|
|
347
|
-
return
|
|
466
|
+
return _context19.a(2, undefined);
|
|
348
467
|
case 3:
|
|
349
|
-
|
|
468
|
+
_context19.n = 4;
|
|
350
469
|
return thunk();
|
|
351
470
|
case 4:
|
|
352
|
-
return
|
|
471
|
+
return _context19.a(2, _context19.v["default"]);
|
|
353
472
|
}
|
|
354
|
-
},
|
|
473
|
+
}, _callee19);
|
|
355
474
|
}));
|
|
356
475
|
return _loadJsonEntryContent.apply(this, arguments);
|
|
357
476
|
}
|
|
@@ -364,33 +483,33 @@ function _loadJsonEntryContent() {
|
|
|
364
483
|
* ask). Returning `undefined` means "render nothing"; both callers turn that into
|
|
365
484
|
* a null/undefined result.
|
|
366
485
|
*/
|
|
367
|
-
function resolveDraftOrCommittedEntry(
|
|
486
|
+
function resolveDraftOrCommittedEntry(_x7, _x8) {
|
|
368
487
|
return _resolveDraftOrCommittedEntry.apply(this, arguments);
|
|
369
488
|
}
|
|
370
489
|
function _resolveDraftOrCommittedEntry() {
|
|
371
|
-
_resolveDraftOrCommittedEntry = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function
|
|
372
|
-
return asyncToGenerator._regenerator().w(function (
|
|
373
|
-
while (1) switch (
|
|
490
|
+
_resolveDraftOrCommittedEntry = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee20(draft, loadCommitted) {
|
|
491
|
+
return asyncToGenerator._regenerator().w(function (_context20) {
|
|
492
|
+
while (1) switch (_context20.n) {
|
|
374
493
|
case 0:
|
|
375
494
|
if (!(draft.status === "content")) {
|
|
376
|
-
|
|
495
|
+
_context20.n = 1;
|
|
377
496
|
break;
|
|
378
497
|
}
|
|
379
|
-
return
|
|
498
|
+
return _context20.a(2, draft.content);
|
|
380
499
|
case 1:
|
|
381
500
|
if (!(draft.status === "absent")) {
|
|
382
|
-
|
|
501
|
+
_context20.n = 2;
|
|
383
502
|
break;
|
|
384
503
|
}
|
|
385
|
-
return
|
|
504
|
+
return _context20.a(2, undefined);
|
|
386
505
|
case 2:
|
|
387
|
-
return
|
|
506
|
+
return _context20.a(2, loadCommitted());
|
|
388
507
|
}
|
|
389
|
-
},
|
|
508
|
+
}, _callee20);
|
|
390
509
|
}));
|
|
391
510
|
return _resolveDraftOrCommittedEntry.apply(this, arguments);
|
|
392
511
|
}
|
|
393
|
-
function loadDraftJsonEntry(
|
|
512
|
+
function loadDraftJsonEntry(_x9, _x0, _x1, _x10) {
|
|
394
513
|
return _loadDraftJsonEntry.apply(this, arguments);
|
|
395
514
|
}
|
|
396
515
|
/**
|
|
@@ -405,31 +524,31 @@ function loadDraftJsonEntry(_x7, _x8, _x9, _x0) {
|
|
|
405
524
|
* the draft read yields nothing.
|
|
406
525
|
*/
|
|
407
526
|
function _loadDraftJsonEntry() {
|
|
408
|
-
_loadDraftJsonEntry = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function
|
|
527
|
+
_loadDraftJsonEntry = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee21(valServerPromise, getCookies, moduleFilePath, key) {
|
|
409
528
|
var _cookies3;
|
|
410
529
|
var cookies, valServer, res;
|
|
411
|
-
return asyncToGenerator._regenerator().w(function (
|
|
412
|
-
while (1) switch (
|
|
530
|
+
return asyncToGenerator._regenerator().w(function (_context21) {
|
|
531
|
+
while (1) switch (_context21.p = _context21.n) {
|
|
413
532
|
case 0:
|
|
414
|
-
|
|
415
|
-
|
|
533
|
+
_context21.p = 0;
|
|
534
|
+
_context21.n = 1;
|
|
416
535
|
return getCookies();
|
|
417
536
|
case 1:
|
|
418
|
-
cookies =
|
|
419
|
-
|
|
537
|
+
cookies = _context21.v;
|
|
538
|
+
_context21.n = 3;
|
|
420
539
|
break;
|
|
421
540
|
case 2:
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
return
|
|
541
|
+
_context21.p = 2;
|
|
542
|
+
_context21.v;
|
|
543
|
+
return _context21.a(2, {
|
|
425
544
|
status: "unavailable"
|
|
426
545
|
});
|
|
427
546
|
case 3:
|
|
428
|
-
|
|
547
|
+
_context21.n = 4;
|
|
429
548
|
return valServerPromise;
|
|
430
549
|
case 4:
|
|
431
|
-
valServer =
|
|
432
|
-
|
|
550
|
+
valServer = _context21.v;
|
|
551
|
+
_context21.n = 5;
|
|
433
552
|
return valServer["/json"]["GET"]({
|
|
434
553
|
query: {
|
|
435
554
|
path: moduleFilePath,
|
|
@@ -452,60 +571,60 @@ function _loadDraftJsonEntry() {
|
|
|
452
571
|
cookies: defineProperty._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)
|
|
453
572
|
});
|
|
454
573
|
case 5:
|
|
455
|
-
res =
|
|
574
|
+
res = _context21.v;
|
|
456
575
|
if (!(res.status === 200 && "content" in res.json)) {
|
|
457
|
-
|
|
576
|
+
_context21.n = 6;
|
|
458
577
|
break;
|
|
459
578
|
}
|
|
460
|
-
return
|
|
579
|
+
return _context21.a(2, {
|
|
461
580
|
status: "content",
|
|
462
581
|
content: res.json.content
|
|
463
582
|
});
|
|
464
583
|
case 6:
|
|
465
584
|
if (!(res.status === 401)) {
|
|
466
|
-
|
|
585
|
+
_context21.n = 7;
|
|
467
586
|
break;
|
|
468
587
|
}
|
|
469
588
|
console.warn("Val: authentication error: ", res.json.message);
|
|
470
|
-
return
|
|
589
|
+
return _context21.a(2, {
|
|
471
590
|
status: "unavailable"
|
|
472
591
|
});
|
|
473
592
|
case 7:
|
|
474
593
|
if (!(res.status === 404)) {
|
|
475
|
-
|
|
594
|
+
_context21.n = 8;
|
|
476
595
|
break;
|
|
477
596
|
}
|
|
478
|
-
return
|
|
597
|
+
return _context21.a(2, {
|
|
479
598
|
status: "absent"
|
|
480
599
|
});
|
|
481
600
|
case 8:
|
|
482
601
|
console.error("Val: could not load draft JSON entry: ", "message" in res.json ? res.json.message : "status ".concat(res.status));
|
|
483
|
-
return
|
|
602
|
+
return _context21.a(2, {
|
|
484
603
|
status: "unavailable"
|
|
485
604
|
});
|
|
486
605
|
}
|
|
487
|
-
},
|
|
606
|
+
}, _callee21, null, [[0, 2]]);
|
|
488
607
|
}));
|
|
489
608
|
return _loadDraftJsonEntry.apply(this, arguments);
|
|
490
609
|
}
|
|
491
610
|
var initFetchValKeyStega = function initFetchValKeyStega(valServerPromise, isEnabled, getCookies) {
|
|
492
611
|
return /*#__PURE__*/function () {
|
|
493
|
-
var
|
|
612
|
+
var _ref4 = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee4(selector, key) {
|
|
494
613
|
var enabled, valModule, source, moduleFilePath, draft, content;
|
|
495
|
-
return asyncToGenerator._regenerator().w(function (
|
|
496
|
-
while (1) switch (
|
|
614
|
+
return asyncToGenerator._regenerator().w(function (_context4) {
|
|
615
|
+
while (1) switch (_context4.p = _context4.n) {
|
|
497
616
|
case 0:
|
|
498
617
|
enabled = false;
|
|
499
|
-
|
|
500
|
-
|
|
618
|
+
_context4.p = 1;
|
|
619
|
+
_context4.n = 2;
|
|
501
620
|
return isEnabled();
|
|
502
621
|
case 2:
|
|
503
|
-
enabled =
|
|
504
|
-
|
|
622
|
+
enabled = _context4.v;
|
|
623
|
+
_context4.n = 4;
|
|
505
624
|
break;
|
|
506
625
|
case 3:
|
|
507
|
-
|
|
508
|
-
|
|
626
|
+
_context4.p = 3;
|
|
627
|
+
_context4.v;
|
|
509
628
|
case 4:
|
|
510
629
|
// A view is a pointer: everything below reads a path and a source off this,
|
|
511
630
|
// and a pointer has neither. See `resolveViewedModule`.
|
|
@@ -516,84 +635,84 @@ var initFetchValKeyStega = function initFetchValKeyStega(valServerPromise, isEna
|
|
|
516
635
|
status: "unavailable"
|
|
517
636
|
};
|
|
518
637
|
if (!(enabled && moduleFilePath)) {
|
|
519
|
-
|
|
638
|
+
_context4.n = 6;
|
|
520
639
|
break;
|
|
521
640
|
}
|
|
522
641
|
stega.SET_AUTO_TAG_JSX_ENABLED(true);
|
|
523
|
-
|
|
642
|
+
_context4.n = 5;
|
|
524
643
|
return loadDraftJsonEntry(valServerPromise, getCookies, moduleFilePath, key);
|
|
525
644
|
case 5:
|
|
526
|
-
draft =
|
|
645
|
+
draft = _context4.v;
|
|
527
646
|
case 6:
|
|
528
|
-
|
|
647
|
+
_context4.n = 7;
|
|
529
648
|
return resolveDraftOrCommittedEntry(draft, function () {
|
|
530
649
|
return loadJsonEntryContent(source, key);
|
|
531
650
|
});
|
|
532
651
|
case 7:
|
|
533
|
-
content =
|
|
652
|
+
content = _context4.v;
|
|
534
653
|
if (!(content === undefined)) {
|
|
535
|
-
|
|
654
|
+
_context4.n = 8;
|
|
536
655
|
break;
|
|
537
656
|
}
|
|
538
|
-
return
|
|
657
|
+
return _context4.a(2, undefined);
|
|
539
658
|
case 8:
|
|
540
|
-
return
|
|
659
|
+
return _context4.a(2, stega.stegaEncode(content, {
|
|
541
660
|
disabled: !enabled,
|
|
542
661
|
root: routeFromVal.getJsonEntryStegaRoot(valModule, key)
|
|
543
662
|
}));
|
|
544
663
|
}
|
|
545
|
-
},
|
|
664
|
+
}, _callee4, null, [[1, 3]]);
|
|
546
665
|
}));
|
|
547
|
-
return function (
|
|
548
|
-
return
|
|
666
|
+
return function (_x11, _x12) {
|
|
667
|
+
return _ref4.apply(this, arguments);
|
|
549
668
|
};
|
|
550
669
|
}();
|
|
551
670
|
};
|
|
552
|
-
var initFetchValRouteUrl = function initFetchValRouteUrl(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies) {
|
|
671
|
+
var initFetchValRouteUrl = function initFetchValRouteUrl(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies, getDraftSourcesScope) {
|
|
553
672
|
return /*#__PURE__*/function () {
|
|
554
|
-
var
|
|
555
|
-
var fetchVal, resolvedParams, valModule, path, schema, val, route,
|
|
556
|
-
return asyncToGenerator._regenerator().w(function (
|
|
557
|
-
while (1) switch (
|
|
673
|
+
var _ref5 = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee5(selector, params) {
|
|
674
|
+
var fetchVal, resolvedParams, valModule, path, schema, val, route, _t8, _t9;
|
|
675
|
+
return asyncToGenerator._regenerator().w(function (_context5) {
|
|
676
|
+
while (1) switch (_context5.n) {
|
|
558
677
|
case 0:
|
|
559
|
-
fetchVal = initFetchValStega(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies);
|
|
678
|
+
fetchVal = initFetchValStega(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies, getDraftSourcesScope);
|
|
560
679
|
if (!(params === undefined)) {
|
|
561
|
-
|
|
680
|
+
_context5.n = 1;
|
|
562
681
|
break;
|
|
563
682
|
}
|
|
564
|
-
|
|
565
|
-
|
|
683
|
+
_t8 = undefined;
|
|
684
|
+
_context5.n = 3;
|
|
566
685
|
break;
|
|
567
686
|
case 1:
|
|
568
|
-
|
|
687
|
+
_context5.n = 2;
|
|
569
688
|
return Promise.resolve(params);
|
|
570
689
|
case 2:
|
|
571
|
-
|
|
690
|
+
_t8 = _context5.v;
|
|
572
691
|
case 3:
|
|
573
|
-
resolvedParams =
|
|
692
|
+
resolvedParams = _t8;
|
|
574
693
|
// A view is a pointer: everything below reads a path, a schema and a source
|
|
575
694
|
// off this, and a pointer has none of them. See `resolveViewedModule`.
|
|
576
695
|
valModule = core.Internal.resolveViewedModule(selector);
|
|
577
696
|
path = valModule && core.Internal.getValPath(valModule);
|
|
578
697
|
schema = valModule && core.Internal.getSchema(valModule);
|
|
579
|
-
|
|
580
|
-
if (!
|
|
581
|
-
|
|
698
|
+
_t9 = valModule;
|
|
699
|
+
if (!_t9) {
|
|
700
|
+
_context5.n = 5;
|
|
582
701
|
break;
|
|
583
702
|
}
|
|
584
|
-
|
|
703
|
+
_context5.n = 4;
|
|
585
704
|
return fetchVal(valModule);
|
|
586
705
|
case 4:
|
|
587
|
-
|
|
706
|
+
_t9 = _context5.v;
|
|
588
707
|
case 5:
|
|
589
|
-
val =
|
|
708
|
+
val = _t9;
|
|
590
709
|
route = routeFromVal.getValRouteUrlFromVal(resolvedParams, "fetchValRouteUrl", path, schema, val);
|
|
591
|
-
return
|
|
710
|
+
return _context5.a(2, route);
|
|
592
711
|
}
|
|
593
|
-
},
|
|
712
|
+
}, _callee5);
|
|
594
713
|
}));
|
|
595
|
-
return function (
|
|
596
|
-
return
|
|
714
|
+
return function (_x13, _x14) {
|
|
715
|
+
return _ref5.apply(this, arguments);
|
|
597
716
|
};
|
|
598
717
|
}();
|
|
599
718
|
};
|
|
@@ -607,6 +726,7 @@ function initValRsc(config, valModules, rscNextConfig) {
|
|
|
607
726
|
if (!nextVersion) {
|
|
608
727
|
throw new Error("Could not get @valbuild/next package version");
|
|
609
728
|
}
|
|
729
|
+
var draftSourcesScope = createReactCacheScope();
|
|
610
730
|
var valServerPromise = server.createValServer(valModules, "/api/val", objectSpread2._objectSpread2({
|
|
611
731
|
versions: {
|
|
612
732
|
next: nextVersion,
|
|
@@ -614,19 +734,6 @@ function initValRsc(config, valModules, rscNextConfig) {
|
|
|
614
734
|
}
|
|
615
735
|
}, config), config, {
|
|
616
736
|
isEnabled: function isEnabled() {
|
|
617
|
-
return asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee5() {
|
|
618
|
-
return asyncToGenerator._regenerator().w(function (_context5) {
|
|
619
|
-
while (1) switch (_context5.n) {
|
|
620
|
-
case 0:
|
|
621
|
-
_context5.n = 1;
|
|
622
|
-
return rscNextConfig.draftMode();
|
|
623
|
-
case 1:
|
|
624
|
-
return _context5.a(2, _context5.v.isEnabled);
|
|
625
|
-
}
|
|
626
|
-
}, _callee5);
|
|
627
|
-
}))();
|
|
628
|
-
},
|
|
629
|
-
onEnable: function onEnable() {
|
|
630
737
|
return asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee6() {
|
|
631
738
|
return asyncToGenerator._regenerator().w(function (_context6) {
|
|
632
739
|
while (1) switch (_context6.n) {
|
|
@@ -634,14 +741,12 @@ function initValRsc(config, valModules, rscNextConfig) {
|
|
|
634
741
|
_context6.n = 1;
|
|
635
742
|
return rscNextConfig.draftMode();
|
|
636
743
|
case 1:
|
|
637
|
-
_context6.v.
|
|
638
|
-
case 2:
|
|
639
|
-
return _context6.a(2);
|
|
744
|
+
return _context6.a(2, _context6.v.isEnabled);
|
|
640
745
|
}
|
|
641
746
|
}, _callee6);
|
|
642
747
|
}))();
|
|
643
748
|
},
|
|
644
|
-
|
|
749
|
+
onEnable: function onEnable() {
|
|
645
750
|
return asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee7() {
|
|
646
751
|
return asyncToGenerator._regenerator().w(function (_context7) {
|
|
647
752
|
while (1) switch (_context7.n) {
|
|
@@ -649,35 +754,40 @@ function initValRsc(config, valModules, rscNextConfig) {
|
|
|
649
754
|
_context7.n = 1;
|
|
650
755
|
return rscNextConfig.draftMode();
|
|
651
756
|
case 1:
|
|
652
|
-
_context7.v.
|
|
757
|
+
_context7.v.enable();
|
|
653
758
|
case 2:
|
|
654
759
|
return _context7.a(2);
|
|
655
760
|
}
|
|
656
761
|
}, _callee7);
|
|
657
762
|
}))();
|
|
763
|
+
},
|
|
764
|
+
onDisable: function onDisable() {
|
|
765
|
+
return asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee8() {
|
|
766
|
+
return asyncToGenerator._regenerator().w(function (_context8) {
|
|
767
|
+
while (1) switch (_context8.n) {
|
|
768
|
+
case 0:
|
|
769
|
+
_context8.n = 1;
|
|
770
|
+
return rscNextConfig.draftMode();
|
|
771
|
+
case 1:
|
|
772
|
+
_context8.v.disable();
|
|
773
|
+
case 2:
|
|
774
|
+
return _context8.a(2);
|
|
775
|
+
}
|
|
776
|
+
}, _callee8);
|
|
777
|
+
}))();
|
|
658
778
|
}
|
|
659
779
|
});
|
|
660
780
|
return {
|
|
661
781
|
fetchValStega: initFetchValStega(config, valApiEndpoints,
|
|
662
782
|
// TODO: get from config
|
|
663
|
-
valServerPromise, /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function
|
|
664
|
-
return asyncToGenerator._regenerator().w(function (_context8) {
|
|
665
|
-
while (1) switch (_context8.n) {
|
|
666
|
-
case 0:
|
|
667
|
-
_context8.n = 1;
|
|
668
|
-
return rscNextConfig.draftMode();
|
|
669
|
-
case 1:
|
|
670
|
-
return _context8.a(2, _context8.v.isEnabled);
|
|
671
|
-
}
|
|
672
|
-
}, _callee8);
|
|
673
|
-
})), /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee9() {
|
|
783
|
+
valServerPromise, /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee9() {
|
|
674
784
|
return asyncToGenerator._regenerator().w(function (_context9) {
|
|
675
785
|
while (1) switch (_context9.n) {
|
|
676
786
|
case 0:
|
|
677
787
|
_context9.n = 1;
|
|
678
|
-
return rscNextConfig.
|
|
788
|
+
return rscNextConfig.draftMode();
|
|
679
789
|
case 1:
|
|
680
|
-
return _context9.a(2, _context9.v);
|
|
790
|
+
return _context9.a(2, _context9.v.isEnabled);
|
|
681
791
|
}
|
|
682
792
|
}, _callee9);
|
|
683
793
|
})), /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee0() {
|
|
@@ -685,51 +795,51 @@ function initValRsc(config, valModules, rscNextConfig) {
|
|
|
685
795
|
while (1) switch (_context0.n) {
|
|
686
796
|
case 0:
|
|
687
797
|
_context0.n = 1;
|
|
688
|
-
return rscNextConfig.
|
|
798
|
+
return rscNextConfig.headers();
|
|
689
799
|
case 1:
|
|
690
800
|
return _context0.a(2, _context0.v);
|
|
691
801
|
}
|
|
692
802
|
}, _callee0);
|
|
693
|
-
})))
|
|
694
|
-
fetchValKeyStega: initFetchValKeyStega(valServerPromise, /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee1() {
|
|
803
|
+
})), /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee1() {
|
|
695
804
|
return asyncToGenerator._regenerator().w(function (_context1) {
|
|
696
805
|
while (1) switch (_context1.n) {
|
|
697
806
|
case 0:
|
|
698
807
|
_context1.n = 1;
|
|
699
|
-
return rscNextConfig.
|
|
808
|
+
return rscNextConfig.cookies();
|
|
700
809
|
case 1:
|
|
701
|
-
return _context1.a(2, _context1.v
|
|
810
|
+
return _context1.a(2, _context1.v);
|
|
702
811
|
}
|
|
703
812
|
}, _callee1);
|
|
704
|
-
})),
|
|
813
|
+
})), draftSourcesScope),
|
|
814
|
+
fetchValKeyStega: initFetchValKeyStega(valServerPromise, /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee10() {
|
|
705
815
|
return asyncToGenerator._regenerator().w(function (_context10) {
|
|
706
816
|
while (1) switch (_context10.n) {
|
|
707
817
|
case 0:
|
|
708
818
|
_context10.n = 1;
|
|
709
|
-
return rscNextConfig.
|
|
819
|
+
return rscNextConfig.draftMode();
|
|
710
820
|
case 1:
|
|
711
|
-
return _context10.a(2, _context10.v);
|
|
821
|
+
return _context10.a(2, _context10.v.isEnabled);
|
|
712
822
|
}
|
|
713
823
|
}, _callee10);
|
|
714
|
-
})))
|
|
715
|
-
fetchValRouteStega: initFetchValRouteStega(config, valApiEndpoints, valServerPromise, /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee11() {
|
|
824
|
+
})), /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee11() {
|
|
716
825
|
return asyncToGenerator._regenerator().w(function (_context11) {
|
|
717
826
|
while (1) switch (_context11.n) {
|
|
718
827
|
case 0:
|
|
719
828
|
_context11.n = 1;
|
|
720
|
-
return rscNextConfig.
|
|
829
|
+
return rscNextConfig.cookies();
|
|
721
830
|
case 1:
|
|
722
|
-
return _context11.a(2, _context11.v
|
|
831
|
+
return _context11.a(2, _context11.v);
|
|
723
832
|
}
|
|
724
833
|
}, _callee11);
|
|
725
|
-
})),
|
|
834
|
+
}))),
|
|
835
|
+
fetchValRouteStega: initFetchValRouteStega(config, valApiEndpoints, valServerPromise, /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee12() {
|
|
726
836
|
return asyncToGenerator._regenerator().w(function (_context12) {
|
|
727
837
|
while (1) switch (_context12.n) {
|
|
728
838
|
case 0:
|
|
729
839
|
_context12.n = 1;
|
|
730
|
-
return rscNextConfig.
|
|
840
|
+
return rscNextConfig.draftMode();
|
|
731
841
|
case 1:
|
|
732
|
-
return _context12.a(2, _context12.v);
|
|
842
|
+
return _context12.a(2, _context12.v.isEnabled);
|
|
733
843
|
}
|
|
734
844
|
}, _callee12);
|
|
735
845
|
})), /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee13() {
|
|
@@ -737,30 +847,30 @@ function initValRsc(config, valModules, rscNextConfig) {
|
|
|
737
847
|
while (1) switch (_context13.n) {
|
|
738
848
|
case 0:
|
|
739
849
|
_context13.n = 1;
|
|
740
|
-
return rscNextConfig.
|
|
850
|
+
return rscNextConfig.headers();
|
|
741
851
|
case 1:
|
|
742
852
|
return _context13.a(2, _context13.v);
|
|
743
853
|
}
|
|
744
854
|
}, _callee13);
|
|
745
|
-
})))
|
|
746
|
-
fetchValRouteUrl: initFetchValRouteUrl(config, valApiEndpoints, valServerPromise, /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee14() {
|
|
855
|
+
})), /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee14() {
|
|
747
856
|
return asyncToGenerator._regenerator().w(function (_context14) {
|
|
748
857
|
while (1) switch (_context14.n) {
|
|
749
858
|
case 0:
|
|
750
859
|
_context14.n = 1;
|
|
751
|
-
return rscNextConfig.
|
|
860
|
+
return rscNextConfig.cookies();
|
|
752
861
|
case 1:
|
|
753
|
-
return _context14.a(2, _context14.v
|
|
862
|
+
return _context14.a(2, _context14.v);
|
|
754
863
|
}
|
|
755
864
|
}, _callee14);
|
|
756
|
-
})),
|
|
865
|
+
})), draftSourcesScope),
|
|
866
|
+
fetchValRouteUrl: initFetchValRouteUrl(config, valApiEndpoints, valServerPromise, /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee15() {
|
|
757
867
|
return asyncToGenerator._regenerator().w(function (_context15) {
|
|
758
868
|
while (1) switch (_context15.n) {
|
|
759
869
|
case 0:
|
|
760
870
|
_context15.n = 1;
|
|
761
|
-
return rscNextConfig.
|
|
871
|
+
return rscNextConfig.draftMode();
|
|
762
872
|
case 1:
|
|
763
|
-
return _context15.a(2, _context15.v);
|
|
873
|
+
return _context15.a(2, _context15.v.isEnabled);
|
|
764
874
|
}
|
|
765
875
|
}, _callee15);
|
|
766
876
|
})), /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee16() {
|
|
@@ -768,12 +878,22 @@ function initValRsc(config, valModules, rscNextConfig) {
|
|
|
768
878
|
while (1) switch (_context16.n) {
|
|
769
879
|
case 0:
|
|
770
880
|
_context16.n = 1;
|
|
771
|
-
return rscNextConfig.
|
|
881
|
+
return rscNextConfig.headers();
|
|
772
882
|
case 1:
|
|
773
883
|
return _context16.a(2, _context16.v);
|
|
774
884
|
}
|
|
775
885
|
}, _callee16);
|
|
776
|
-
})))
|
|
886
|
+
})), /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee17() {
|
|
887
|
+
return asyncToGenerator._regenerator().w(function (_context17) {
|
|
888
|
+
while (1) switch (_context17.n) {
|
|
889
|
+
case 0:
|
|
890
|
+
_context17.n = 1;
|
|
891
|
+
return rscNextConfig.cookies();
|
|
892
|
+
case 1:
|
|
893
|
+
return _context17.a(2, _context17.v);
|
|
894
|
+
}
|
|
895
|
+
}, _callee17);
|
|
896
|
+
})), draftSourcesScope)
|
|
777
897
|
};
|
|
778
898
|
}
|
|
779
899
|
|