@valbuild/next 0.83.0 → 0.84.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.
Files changed (33) hide show
  1. package/client/dist/valbuild-next-client.cjs.dev.js +26 -2
  2. package/client/dist/valbuild-next-client.cjs.prod.js +26 -2
  3. package/client/dist/valbuild-next-client.esm.js +26 -2
  4. package/dist/{ValNextProvider-5f8b7338.esm.js → ValNextProvider-25f1f5c9.esm.js} +2 -2
  5. package/dist/ValNextProvider-a618d775.cjs.js +7 -0
  6. package/dist/{ValNextProvider-9ff1bb92.cjs.prod.js → ValNextProvider-a618d775.cjs.prod.js} +2 -2
  7. package/dist/{ValNextProvider-99b4552f.cjs.dev.js → ValNextProvider-c7952bdc.cjs.dev.js} +2 -2
  8. package/dist/{ValOverlayContext-a2fdbce0.esm.js → ValOverlayContext-6635a4d7.esm.js} +2 -50
  9. package/dist/ValOverlayContext-942f1294.cjs.js +7 -0
  10. package/dist/{ValOverlayContext-811e9be9.cjs.prod.js → ValOverlayContext-942f1294.cjs.prod.js} +3 -51
  11. package/dist/{ValOverlayContext-55dae3ea.cjs.dev.js → ValOverlayContext-c82a4507.cjs.dev.js} +3 -51
  12. package/dist/createForOfIteratorHelper-0445603c.cjs.dev.js +54 -0
  13. package/dist/createForOfIteratorHelper-5758a730.esm.js +52 -0
  14. package/dist/createForOfIteratorHelper-d4afcad8.cjs.prod.js +54 -0
  15. package/dist/declarations/src/client/initValClient.d.ts +4 -1
  16. package/dist/declarations/src/external_exempt_from_val_quickjs.d.ts +1 -0
  17. package/dist/declarations/src/initVal.d.ts +3 -1
  18. package/dist/declarations/src/rsc/initValRsc.d.ts +11 -1
  19. package/dist/initValRouteFromVal-12bdc5f5.cjs.dev.js +116 -0
  20. package/dist/initValRouteFromVal-b9806908.cjs.prod.js +116 -0
  21. package/dist/initValRouteFromVal-d84b3563.esm.js +114 -0
  22. package/dist/typeof-16428c61.cjs.prod.js +13 -0
  23. package/dist/typeof-a1531d8f.esm.js +11 -0
  24. package/dist/typeof-b568f48f.cjs.dev.js +13 -0
  25. package/dist/valbuild-next.cjs.dev.js +6 -13
  26. package/dist/valbuild-next.cjs.prod.js +6 -13
  27. package/dist/valbuild-next.esm.js +5 -12
  28. package/package.json +6 -6
  29. package/rsc/dist/valbuild-next-rsc.cjs.dev.js +119 -36
  30. package/rsc/dist/valbuild-next-rsc.cjs.prod.js +119 -36
  31. package/rsc/dist/valbuild-next-rsc.esm.js +119 -36
  32. package/dist/ValNextProvider-9ff1bb92.cjs.js +0 -7
  33. package/dist/ValOverlayContext-811e9be9.cjs.js +0 -7
@@ -10,6 +10,11 @@ var core = require('@valbuild/core');
10
10
  var internal = require('@valbuild/shared/internal');
11
11
  var server = require('@valbuild/server');
12
12
  var version = require('../../dist/version-82faa1d0.cjs.dev.js');
13
+ var initValRouteFromVal = require('../../dist/initValRouteFromVal-12bdc5f5.cjs.dev.js');
14
+ require('../../dist/createForOfIteratorHelper-0445603c.cjs.dev.js');
15
+ require('../../dist/unsupportedIterableToArray-c8ab77c9.cjs.dev.js');
16
+ require('../../dist/slicedToArray-44036a76.cjs.dev.js');
17
+ require('../../dist/typeof-b568f48f.cjs.dev.js');
13
18
 
14
19
  stega.SET_RSC(true);
15
20
  var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies) {
@@ -175,6 +180,44 @@ function getHost(headers) {
175
180
  // }
176
181
  // }
177
182
 
183
+ var initFetchValRouteStega = function initFetchValRouteStega(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies) {
184
+ return /*#__PURE__*/function () {
185
+ var _ref2 = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee2(selector, params) {
186
+ var fetchVal, resolvedParams, path, schema, val, route;
187
+ return asyncToGenerator._regeneratorRuntime().wrap(function _callee2$(_context2) {
188
+ while (1) switch (_context2.prev = _context2.next) {
189
+ case 0:
190
+ fetchVal = initFetchValStega(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies);
191
+ _context2.next = 3;
192
+ return Promise.resolve(params);
193
+ case 3:
194
+ resolvedParams = _context2.sent;
195
+ path = selector && core.Internal.getValPath(selector);
196
+ schema = selector && core.Internal.getSchema(selector);
197
+ _context2.t0 = selector;
198
+ if (!_context2.t0) {
199
+ _context2.next = 11;
200
+ break;
201
+ }
202
+ _context2.next = 10;
203
+ return fetchVal(selector);
204
+ case 10:
205
+ _context2.t0 = _context2.sent;
206
+ case 11:
207
+ val = _context2.t0;
208
+ route = initValRouteFromVal.initValRouteFromVal(resolvedParams, "fetchValRoute", path, schema, val);
209
+ return _context2.abrupt("return", route);
210
+ case 14:
211
+ case "end":
212
+ return _context2.stop();
213
+ }
214
+ }, _callee2);
215
+ }));
216
+ return function (_x, _x2) {
217
+ return _ref2.apply(this, arguments);
218
+ };
219
+ }();
220
+ };
178
221
  var valApiEndpoints = "/api/val";
179
222
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
180
223
  function initValRsc(config, valModules, rscNextConfig) {
@@ -193,22 +236,6 @@ function initValRsc(config, valModules, rscNextConfig) {
193
236
  }
194
237
  }, config), config, {
195
238
  isEnabled: function isEnabled() {
196
- return asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee2() {
197
- return asyncToGenerator._regeneratorRuntime().wrap(function _callee2$(_context2) {
198
- while (1) switch (_context2.prev = _context2.next) {
199
- case 0:
200
- _context2.next = 2;
201
- return rscNextConfig.draftMode();
202
- case 2:
203
- return _context2.abrupt("return", _context2.sent.isEnabled);
204
- case 3:
205
- case "end":
206
- return _context2.stop();
207
- }
208
- }, _callee2);
209
- }))();
210
- },
211
- onEnable: function onEnable() {
212
239
  return asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee3() {
213
240
  return asyncToGenerator._regeneratorRuntime().wrap(function _callee3$(_context3) {
214
241
  while (1) switch (_context3.prev = _context3.next) {
@@ -216,7 +243,7 @@ function initValRsc(config, valModules, rscNextConfig) {
216
243
  _context3.next = 2;
217
244
  return rscNextConfig.draftMode();
218
245
  case 2:
219
- _context3.sent.enable();
246
+ return _context3.abrupt("return", _context3.sent.isEnabled);
220
247
  case 3:
221
248
  case "end":
222
249
  return _context3.stop();
@@ -224,7 +251,7 @@ function initValRsc(config, valModules, rscNextConfig) {
224
251
  }, _callee3);
225
252
  }))();
226
253
  },
227
- onDisable: function onDisable() {
254
+ onEnable: function onEnable() {
228
255
  return asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee4() {
229
256
  return asyncToGenerator._regeneratorRuntime().wrap(function _callee4$(_context4) {
230
257
  while (1) switch (_context4.prev = _context4.next) {
@@ -232,39 +259,42 @@ function initValRsc(config, valModules, rscNextConfig) {
232
259
  _context4.next = 2;
233
260
  return rscNextConfig.draftMode();
234
261
  case 2:
235
- _context4.sent.disable();
262
+ _context4.sent.enable();
236
263
  case 3:
237
264
  case "end":
238
265
  return _context4.stop();
239
266
  }
240
267
  }, _callee4);
241
268
  }))();
269
+ },
270
+ onDisable: function onDisable() {
271
+ return asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee5() {
272
+ return asyncToGenerator._regeneratorRuntime().wrap(function _callee5$(_context5) {
273
+ while (1) switch (_context5.prev = _context5.next) {
274
+ case 0:
275
+ _context5.next = 2;
276
+ return rscNextConfig.draftMode();
277
+ case 2:
278
+ _context5.sent.disable();
279
+ case 3:
280
+ case "end":
281
+ return _context5.stop();
282
+ }
283
+ }, _callee5);
284
+ }))();
242
285
  }
243
286
  });
244
287
  return {
245
288
  fetchValStega: initFetchValStega(config, valApiEndpoints,
246
289
  // TODO: get from config
247
- valServerPromise, /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee5() {
248
- return asyncToGenerator._regeneratorRuntime().wrap(function _callee5$(_context5) {
249
- while (1) switch (_context5.prev = _context5.next) {
250
- case 0:
251
- _context5.next = 2;
252
- return rscNextConfig.draftMode();
253
- case 2:
254
- return _context5.abrupt("return", _context5.sent.isEnabled);
255
- case 3:
256
- case "end":
257
- return _context5.stop();
258
- }
259
- }, _callee5);
260
- })), /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee6() {
290
+ valServerPromise, /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee6() {
261
291
  return asyncToGenerator._regeneratorRuntime().wrap(function _callee6$(_context6) {
262
292
  while (1) switch (_context6.prev = _context6.next) {
263
293
  case 0:
264
294
  _context6.next = 2;
265
- return rscNextConfig.headers();
295
+ return rscNextConfig.draftMode();
266
296
  case 2:
267
- return _context6.abrupt("return", _context6.sent);
297
+ return _context6.abrupt("return", _context6.sent.isEnabled);
268
298
  case 3:
269
299
  case "end":
270
300
  return _context6.stop();
@@ -275,7 +305,7 @@ function initValRsc(config, valModules, rscNextConfig) {
275
305
  while (1) switch (_context7.prev = _context7.next) {
276
306
  case 0:
277
307
  _context7.next = 2;
278
- return rscNextConfig.cookies();
308
+ return rscNextConfig.headers();
279
309
  case 2:
280
310
  return _context7.abrupt("return", _context7.sent);
281
311
  case 3:
@@ -283,6 +313,59 @@ function initValRsc(config, valModules, rscNextConfig) {
283
313
  return _context7.stop();
284
314
  }
285
315
  }, _callee7);
316
+ })), /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee8() {
317
+ return asyncToGenerator._regeneratorRuntime().wrap(function _callee8$(_context8) {
318
+ while (1) switch (_context8.prev = _context8.next) {
319
+ case 0:
320
+ _context8.next = 2;
321
+ return rscNextConfig.cookies();
322
+ case 2:
323
+ return _context8.abrupt("return", _context8.sent);
324
+ case 3:
325
+ case "end":
326
+ return _context8.stop();
327
+ }
328
+ }, _callee8);
329
+ }))),
330
+ fetchValRouteStega: initFetchValRouteStega(config, valApiEndpoints, valServerPromise, /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee9() {
331
+ return asyncToGenerator._regeneratorRuntime().wrap(function _callee9$(_context9) {
332
+ while (1) switch (_context9.prev = _context9.next) {
333
+ case 0:
334
+ _context9.next = 2;
335
+ return rscNextConfig.draftMode();
336
+ case 2:
337
+ return _context9.abrupt("return", _context9.sent.isEnabled);
338
+ case 3:
339
+ case "end":
340
+ return _context9.stop();
341
+ }
342
+ }, _callee9);
343
+ })), /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee10() {
344
+ return asyncToGenerator._regeneratorRuntime().wrap(function _callee10$(_context10) {
345
+ while (1) switch (_context10.prev = _context10.next) {
346
+ case 0:
347
+ _context10.next = 2;
348
+ return rscNextConfig.headers();
349
+ case 2:
350
+ return _context10.abrupt("return", _context10.sent);
351
+ case 3:
352
+ case "end":
353
+ return _context10.stop();
354
+ }
355
+ }, _callee10);
356
+ })), /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee11() {
357
+ return asyncToGenerator._regeneratorRuntime().wrap(function _callee11$(_context11) {
358
+ while (1) switch (_context11.prev = _context11.next) {
359
+ case 0:
360
+ _context11.next = 2;
361
+ return rscNextConfig.cookies();
362
+ case 2:
363
+ return _context11.abrupt("return", _context11.sent);
364
+ case 3:
365
+ case "end":
366
+ return _context11.stop();
367
+ }
368
+ }, _callee11);
286
369
  })))
287
370
  };
288
371
  }
@@ -10,6 +10,11 @@ var core = require('@valbuild/core');
10
10
  var internal = require('@valbuild/shared/internal');
11
11
  var server = require('@valbuild/server');
12
12
  var version = require('../../dist/version-a9a6a619.cjs.prod.js');
13
+ var initValRouteFromVal = require('../../dist/initValRouteFromVal-b9806908.cjs.prod.js');
14
+ require('../../dist/createForOfIteratorHelper-d4afcad8.cjs.prod.js');
15
+ require('../../dist/unsupportedIterableToArray-0d2087a2.cjs.prod.js');
16
+ require('../../dist/slicedToArray-ce613de6.cjs.prod.js');
17
+ require('../../dist/typeof-16428c61.cjs.prod.js');
13
18
 
14
19
  stega.SET_RSC(true);
15
20
  var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies) {
@@ -175,6 +180,44 @@ function getHost(headers) {
175
180
  // }
176
181
  // }
177
182
 
183
+ var initFetchValRouteStega = function initFetchValRouteStega(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies) {
184
+ return /*#__PURE__*/function () {
185
+ var _ref2 = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee2(selector, params) {
186
+ var fetchVal, resolvedParams, path, schema, val, route;
187
+ return asyncToGenerator._regeneratorRuntime().wrap(function _callee2$(_context2) {
188
+ while (1) switch (_context2.prev = _context2.next) {
189
+ case 0:
190
+ fetchVal = initFetchValStega(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies);
191
+ _context2.next = 3;
192
+ return Promise.resolve(params);
193
+ case 3:
194
+ resolvedParams = _context2.sent;
195
+ path = selector && core.Internal.getValPath(selector);
196
+ schema = selector && core.Internal.getSchema(selector);
197
+ _context2.t0 = selector;
198
+ if (!_context2.t0) {
199
+ _context2.next = 11;
200
+ break;
201
+ }
202
+ _context2.next = 10;
203
+ return fetchVal(selector);
204
+ case 10:
205
+ _context2.t0 = _context2.sent;
206
+ case 11:
207
+ val = _context2.t0;
208
+ route = initValRouteFromVal.initValRouteFromVal(resolvedParams, "fetchValRoute", path, schema, val);
209
+ return _context2.abrupt("return", route);
210
+ case 14:
211
+ case "end":
212
+ return _context2.stop();
213
+ }
214
+ }, _callee2);
215
+ }));
216
+ return function (_x, _x2) {
217
+ return _ref2.apply(this, arguments);
218
+ };
219
+ }();
220
+ };
178
221
  var valApiEndpoints = "/api/val";
179
222
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
180
223
  function initValRsc(config, valModules, rscNextConfig) {
@@ -193,22 +236,6 @@ function initValRsc(config, valModules, rscNextConfig) {
193
236
  }
194
237
  }, config), config, {
195
238
  isEnabled: function isEnabled() {
196
- return asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee2() {
197
- return asyncToGenerator._regeneratorRuntime().wrap(function _callee2$(_context2) {
198
- while (1) switch (_context2.prev = _context2.next) {
199
- case 0:
200
- _context2.next = 2;
201
- return rscNextConfig.draftMode();
202
- case 2:
203
- return _context2.abrupt("return", _context2.sent.isEnabled);
204
- case 3:
205
- case "end":
206
- return _context2.stop();
207
- }
208
- }, _callee2);
209
- }))();
210
- },
211
- onEnable: function onEnable() {
212
239
  return asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee3() {
213
240
  return asyncToGenerator._regeneratorRuntime().wrap(function _callee3$(_context3) {
214
241
  while (1) switch (_context3.prev = _context3.next) {
@@ -216,7 +243,7 @@ function initValRsc(config, valModules, rscNextConfig) {
216
243
  _context3.next = 2;
217
244
  return rscNextConfig.draftMode();
218
245
  case 2:
219
- _context3.sent.enable();
246
+ return _context3.abrupt("return", _context3.sent.isEnabled);
220
247
  case 3:
221
248
  case "end":
222
249
  return _context3.stop();
@@ -224,7 +251,7 @@ function initValRsc(config, valModules, rscNextConfig) {
224
251
  }, _callee3);
225
252
  }))();
226
253
  },
227
- onDisable: function onDisable() {
254
+ onEnable: function onEnable() {
228
255
  return asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee4() {
229
256
  return asyncToGenerator._regeneratorRuntime().wrap(function _callee4$(_context4) {
230
257
  while (1) switch (_context4.prev = _context4.next) {
@@ -232,39 +259,42 @@ function initValRsc(config, valModules, rscNextConfig) {
232
259
  _context4.next = 2;
233
260
  return rscNextConfig.draftMode();
234
261
  case 2:
235
- _context4.sent.disable();
262
+ _context4.sent.enable();
236
263
  case 3:
237
264
  case "end":
238
265
  return _context4.stop();
239
266
  }
240
267
  }, _callee4);
241
268
  }))();
269
+ },
270
+ onDisable: function onDisable() {
271
+ return asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee5() {
272
+ return asyncToGenerator._regeneratorRuntime().wrap(function _callee5$(_context5) {
273
+ while (1) switch (_context5.prev = _context5.next) {
274
+ case 0:
275
+ _context5.next = 2;
276
+ return rscNextConfig.draftMode();
277
+ case 2:
278
+ _context5.sent.disable();
279
+ case 3:
280
+ case "end":
281
+ return _context5.stop();
282
+ }
283
+ }, _callee5);
284
+ }))();
242
285
  }
243
286
  });
244
287
  return {
245
288
  fetchValStega: initFetchValStega(config, valApiEndpoints,
246
289
  // TODO: get from config
247
- valServerPromise, /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee5() {
248
- return asyncToGenerator._regeneratorRuntime().wrap(function _callee5$(_context5) {
249
- while (1) switch (_context5.prev = _context5.next) {
250
- case 0:
251
- _context5.next = 2;
252
- return rscNextConfig.draftMode();
253
- case 2:
254
- return _context5.abrupt("return", _context5.sent.isEnabled);
255
- case 3:
256
- case "end":
257
- return _context5.stop();
258
- }
259
- }, _callee5);
260
- })), /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee6() {
290
+ valServerPromise, /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee6() {
261
291
  return asyncToGenerator._regeneratorRuntime().wrap(function _callee6$(_context6) {
262
292
  while (1) switch (_context6.prev = _context6.next) {
263
293
  case 0:
264
294
  _context6.next = 2;
265
- return rscNextConfig.headers();
295
+ return rscNextConfig.draftMode();
266
296
  case 2:
267
- return _context6.abrupt("return", _context6.sent);
297
+ return _context6.abrupt("return", _context6.sent.isEnabled);
268
298
  case 3:
269
299
  case "end":
270
300
  return _context6.stop();
@@ -275,7 +305,7 @@ function initValRsc(config, valModules, rscNextConfig) {
275
305
  while (1) switch (_context7.prev = _context7.next) {
276
306
  case 0:
277
307
  _context7.next = 2;
278
- return rscNextConfig.cookies();
308
+ return rscNextConfig.headers();
279
309
  case 2:
280
310
  return _context7.abrupt("return", _context7.sent);
281
311
  case 3:
@@ -283,6 +313,59 @@ function initValRsc(config, valModules, rscNextConfig) {
283
313
  return _context7.stop();
284
314
  }
285
315
  }, _callee7);
316
+ })), /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee8() {
317
+ return asyncToGenerator._regeneratorRuntime().wrap(function _callee8$(_context8) {
318
+ while (1) switch (_context8.prev = _context8.next) {
319
+ case 0:
320
+ _context8.next = 2;
321
+ return rscNextConfig.cookies();
322
+ case 2:
323
+ return _context8.abrupt("return", _context8.sent);
324
+ case 3:
325
+ case "end":
326
+ return _context8.stop();
327
+ }
328
+ }, _callee8);
329
+ }))),
330
+ fetchValRouteStega: initFetchValRouteStega(config, valApiEndpoints, valServerPromise, /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee9() {
331
+ return asyncToGenerator._regeneratorRuntime().wrap(function _callee9$(_context9) {
332
+ while (1) switch (_context9.prev = _context9.next) {
333
+ case 0:
334
+ _context9.next = 2;
335
+ return rscNextConfig.draftMode();
336
+ case 2:
337
+ return _context9.abrupt("return", _context9.sent.isEnabled);
338
+ case 3:
339
+ case "end":
340
+ return _context9.stop();
341
+ }
342
+ }, _callee9);
343
+ })), /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee10() {
344
+ return asyncToGenerator._regeneratorRuntime().wrap(function _callee10$(_context10) {
345
+ while (1) switch (_context10.prev = _context10.next) {
346
+ case 0:
347
+ _context10.next = 2;
348
+ return rscNextConfig.headers();
349
+ case 2:
350
+ return _context10.abrupt("return", _context10.sent);
351
+ case 3:
352
+ case "end":
353
+ return _context10.stop();
354
+ }
355
+ }, _callee10);
356
+ })), /*#__PURE__*/asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee11() {
357
+ return asyncToGenerator._regeneratorRuntime().wrap(function _callee11$(_context11) {
358
+ while (1) switch (_context11.prev = _context11.next) {
359
+ case 0:
360
+ _context11.next = 2;
361
+ return rscNextConfig.cookies();
362
+ case 2:
363
+ return _context11.abrupt("return", _context11.sent);
364
+ case 3:
365
+ case "end":
366
+ return _context11.stop();
367
+ }
368
+ }, _callee11);
286
369
  })))
287
370
  };
288
371
  }
@@ -6,6 +6,11 @@ import { Internal } from '@valbuild/core';
6
6
  import { VAL_SESSION_COOKIE } from '@valbuild/shared/internal';
7
7
  import { createValServer } from '@valbuild/server';
8
8
  import { V as VERSION } from '../../dist/version-98ec5c7a.esm.js';
9
+ import { i as initValRouteFromVal } from '../../dist/initValRouteFromVal-d84b3563.esm.js';
10
+ import '../../dist/createForOfIteratorHelper-5758a730.esm.js';
11
+ import '../../dist/unsupportedIterableToArray-5baabfdc.esm.js';
12
+ import '../../dist/slicedToArray-aa291011.esm.js';
13
+ import '../../dist/typeof-a1531d8f.esm.js';
9
14
 
10
15
  SET_RSC(true);
11
16
  var initFetchValStega = function initFetchValStega(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies) {
@@ -171,6 +176,44 @@ function getHost(headers) {
171
176
  // }
172
177
  // }
173
178
 
179
+ var initFetchValRouteStega = function initFetchValRouteStega(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies) {
180
+ return /*#__PURE__*/function () {
181
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(selector, params) {
182
+ var fetchVal, resolvedParams, path, schema, val, route;
183
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
184
+ while (1) switch (_context2.prev = _context2.next) {
185
+ case 0:
186
+ fetchVal = initFetchValStega(config, valApiEndpoints, valServerPromise, isEnabled, getHeaders, getCookies);
187
+ _context2.next = 3;
188
+ return Promise.resolve(params);
189
+ case 3:
190
+ resolvedParams = _context2.sent;
191
+ path = selector && Internal.getValPath(selector);
192
+ schema = selector && Internal.getSchema(selector);
193
+ _context2.t0 = selector;
194
+ if (!_context2.t0) {
195
+ _context2.next = 11;
196
+ break;
197
+ }
198
+ _context2.next = 10;
199
+ return fetchVal(selector);
200
+ case 10:
201
+ _context2.t0 = _context2.sent;
202
+ case 11:
203
+ val = _context2.t0;
204
+ route = initValRouteFromVal(resolvedParams, "fetchValRoute", path, schema, val);
205
+ return _context2.abrupt("return", route);
206
+ case 14:
207
+ case "end":
208
+ return _context2.stop();
209
+ }
210
+ }, _callee2);
211
+ }));
212
+ return function (_x, _x2) {
213
+ return _ref2.apply(this, arguments);
214
+ };
215
+ }();
216
+ };
174
217
  var valApiEndpoints = "/api/val";
175
218
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
176
219
  function initValRsc(config, valModules, rscNextConfig) {
@@ -189,22 +232,6 @@ function initValRsc(config, valModules, rscNextConfig) {
189
232
  }
190
233
  }, config), config, {
191
234
  isEnabled: function isEnabled() {
192
- return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
193
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
194
- while (1) switch (_context2.prev = _context2.next) {
195
- case 0:
196
- _context2.next = 2;
197
- return rscNextConfig.draftMode();
198
- case 2:
199
- return _context2.abrupt("return", _context2.sent.isEnabled);
200
- case 3:
201
- case "end":
202
- return _context2.stop();
203
- }
204
- }, _callee2);
205
- }))();
206
- },
207
- onEnable: function onEnable() {
208
235
  return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
209
236
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
210
237
  while (1) switch (_context3.prev = _context3.next) {
@@ -212,7 +239,7 @@ function initValRsc(config, valModules, rscNextConfig) {
212
239
  _context3.next = 2;
213
240
  return rscNextConfig.draftMode();
214
241
  case 2:
215
- _context3.sent.enable();
242
+ return _context3.abrupt("return", _context3.sent.isEnabled);
216
243
  case 3:
217
244
  case "end":
218
245
  return _context3.stop();
@@ -220,7 +247,7 @@ function initValRsc(config, valModules, rscNextConfig) {
220
247
  }, _callee3);
221
248
  }))();
222
249
  },
223
- onDisable: function onDisable() {
250
+ onEnable: function onEnable() {
224
251
  return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
225
252
  return _regeneratorRuntime().wrap(function _callee4$(_context4) {
226
253
  while (1) switch (_context4.prev = _context4.next) {
@@ -228,39 +255,42 @@ function initValRsc(config, valModules, rscNextConfig) {
228
255
  _context4.next = 2;
229
256
  return rscNextConfig.draftMode();
230
257
  case 2:
231
- _context4.sent.disable();
258
+ _context4.sent.enable();
232
259
  case 3:
233
260
  case "end":
234
261
  return _context4.stop();
235
262
  }
236
263
  }, _callee4);
237
264
  }))();
265
+ },
266
+ onDisable: function onDisable() {
267
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
268
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
269
+ while (1) switch (_context5.prev = _context5.next) {
270
+ case 0:
271
+ _context5.next = 2;
272
+ return rscNextConfig.draftMode();
273
+ case 2:
274
+ _context5.sent.disable();
275
+ case 3:
276
+ case "end":
277
+ return _context5.stop();
278
+ }
279
+ }, _callee5);
280
+ }))();
238
281
  }
239
282
  });
240
283
  return {
241
284
  fetchValStega: initFetchValStega(config, valApiEndpoints,
242
285
  // TODO: get from config
243
- valServerPromise, /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
244
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
245
- while (1) switch (_context5.prev = _context5.next) {
246
- case 0:
247
- _context5.next = 2;
248
- return rscNextConfig.draftMode();
249
- case 2:
250
- return _context5.abrupt("return", _context5.sent.isEnabled);
251
- case 3:
252
- case "end":
253
- return _context5.stop();
254
- }
255
- }, _callee5);
256
- })), /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
286
+ valServerPromise, /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
257
287
  return _regeneratorRuntime().wrap(function _callee6$(_context6) {
258
288
  while (1) switch (_context6.prev = _context6.next) {
259
289
  case 0:
260
290
  _context6.next = 2;
261
- return rscNextConfig.headers();
291
+ return rscNextConfig.draftMode();
262
292
  case 2:
263
- return _context6.abrupt("return", _context6.sent);
293
+ return _context6.abrupt("return", _context6.sent.isEnabled);
264
294
  case 3:
265
295
  case "end":
266
296
  return _context6.stop();
@@ -271,7 +301,7 @@ function initValRsc(config, valModules, rscNextConfig) {
271
301
  while (1) switch (_context7.prev = _context7.next) {
272
302
  case 0:
273
303
  _context7.next = 2;
274
- return rscNextConfig.cookies();
304
+ return rscNextConfig.headers();
275
305
  case 2:
276
306
  return _context7.abrupt("return", _context7.sent);
277
307
  case 3:
@@ -279,6 +309,59 @@ function initValRsc(config, valModules, rscNextConfig) {
279
309
  return _context7.stop();
280
310
  }
281
311
  }, _callee7);
312
+ })), /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
313
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
314
+ while (1) switch (_context8.prev = _context8.next) {
315
+ case 0:
316
+ _context8.next = 2;
317
+ return rscNextConfig.cookies();
318
+ case 2:
319
+ return _context8.abrupt("return", _context8.sent);
320
+ case 3:
321
+ case "end":
322
+ return _context8.stop();
323
+ }
324
+ }, _callee8);
325
+ }))),
326
+ fetchValRouteStega: initFetchValRouteStega(config, valApiEndpoints, valServerPromise, /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
327
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
328
+ while (1) switch (_context9.prev = _context9.next) {
329
+ case 0:
330
+ _context9.next = 2;
331
+ return rscNextConfig.draftMode();
332
+ case 2:
333
+ return _context9.abrupt("return", _context9.sent.isEnabled);
334
+ case 3:
335
+ case "end":
336
+ return _context9.stop();
337
+ }
338
+ }, _callee9);
339
+ })), /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
340
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
341
+ while (1) switch (_context10.prev = _context10.next) {
342
+ case 0:
343
+ _context10.next = 2;
344
+ return rscNextConfig.headers();
345
+ case 2:
346
+ return _context10.abrupt("return", _context10.sent);
347
+ case 3:
348
+ case "end":
349
+ return _context10.stop();
350
+ }
351
+ }, _callee10);
352
+ })), /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
353
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
354
+ while (1) switch (_context11.prev = _context11.next) {
355
+ case 0:
356
+ _context11.next = 2;
357
+ return rscNextConfig.cookies();
358
+ case 2:
359
+ return _context11.abrupt("return", _context11.sent);
360
+ case 3:
361
+ case "end":
362
+ return _context11.stop();
363
+ }
364
+ }, _callee11);
282
365
  })))
283
366
  };
284
367
  }
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- if (process.env.NODE_ENV === "production") {
4
- module.exports = require("./ValNextProvider-9ff1bb92.cjs.prod.js");
5
- } else {
6
- module.exports = require("./ValNextProvider-9ff1bb92.cjs.dev.js");
7
- }