@valbuild/next 0.60.27 → 0.62.0

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 (28) hide show
  1. package/client/dist/valbuild-next-client.cjs.dev.js +2 -2
  2. package/client/dist/valbuild-next-client.cjs.prod.js +2 -2
  3. package/client/dist/valbuild-next-client.esm.js +2 -2
  4. package/dist/{ValContext-a73be368.cjs.dev.js → ValContext-8eb2ec77.cjs.dev.js} +13 -13
  5. package/dist/ValContext-df4a9ae7.cjs.js +7 -0
  6. package/dist/{ValContext-37ea12ae.cjs.prod.js → ValContext-df4a9ae7.cjs.prod.js} +13 -13
  7. package/dist/{ValContext-e5293493.esm.js → ValContext-ea0b967a.esm.js} +13 -13
  8. package/dist/ValNextProvider-06d5c71e.cjs.js +7 -0
  9. package/dist/{ValNextProvider-676d6cb8.cjs.prod.js → ValNextProvider-06d5c71e.cjs.prod.js} +4 -4
  10. package/dist/{ValNextProvider-23099a43.esm.js → ValNextProvider-259bf24d.esm.js} +4 -4
  11. package/dist/{ValNextProvider-ef4fdca6.cjs.dev.js → ValNextProvider-3df6c619.cjs.dev.js} +4 -4
  12. package/dist/asyncToGenerator-0859ab5c.esm.js +334 -0
  13. package/dist/asyncToGenerator-3551d940.cjs.prod.js +337 -0
  14. package/dist/asyncToGenerator-ba66657c.cjs.dev.js +337 -0
  15. package/dist/declarations/src/external_exempt_from_val_quickjs.d.ts +4 -2
  16. package/dist/declarations/src/server/initValServer.d.ts +5 -3
  17. package/dist/valbuild-next.cjs.dev.js +5 -1
  18. package/dist/valbuild-next.cjs.prod.js +5 -1
  19. package/dist/valbuild-next.esm.js +2 -2
  20. package/package.json +5 -5
  21. package/rsc/dist/valbuild-next-rsc.cjs.dev.js +75 -76
  22. package/rsc/dist/valbuild-next-rsc.cjs.prod.js +75 -76
  23. package/rsc/dist/valbuild-next-rsc.esm.js +77 -78
  24. package/server/dist/valbuild-next-server.cjs.dev.js +12 -344
  25. package/server/dist/valbuild-next-server.cjs.prod.js +12 -344
  26. package/server/dist/valbuild-next-server.esm.js +6 -338
  27. package/dist/ValContext-37ea12ae.cjs.js +0 -7
  28. package/dist/ValNextProvider-676d6cb8.cjs.js +0 -7
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  require('server-only');
6
6
  var slicedToArray = require('../../dist/slicedToArray-1d91551a.cjs.prod.js');
7
+ var asyncToGenerator = require('../../dist/asyncToGenerator-3551d940.cjs.prod.js');
7
8
  var objectSpread2 = require('../../dist/objectSpread2-24e737a6.cjs.prod.js');
8
9
  var core = require('@valbuild/core');
9
10
  var server = require('@valbuild/server');
@@ -11,340 +12,7 @@ var server$1 = require('next/server');
11
12
  var version = require('../../dist/version-a9a6a619.cjs.prod.js');
12
13
  require('../../dist/unsupportedIterableToArray-afbea1dd.cjs.prod.js');
13
14
 
14
- function _regeneratorRuntime() {
15
- _regeneratorRuntime = function () {
16
- return e;
17
- };
18
- var t,
19
- e = {},
20
- r = Object.prototype,
21
- n = r.hasOwnProperty,
22
- o = Object.defineProperty || function (t, e, r) {
23
- t[e] = r.value;
24
- },
25
- i = "function" == typeof Symbol ? Symbol : {},
26
- a = i.iterator || "@@iterator",
27
- c = i.asyncIterator || "@@asyncIterator",
28
- u = i.toStringTag || "@@toStringTag";
29
- function define(t, e, r) {
30
- return Object.defineProperty(t, e, {
31
- value: r,
32
- enumerable: !0,
33
- configurable: !0,
34
- writable: !0
35
- }), t[e];
36
- }
37
- try {
38
- define({}, "");
39
- } catch (t) {
40
- define = function (t, e, r) {
41
- return t[e] = r;
42
- };
43
- }
44
- function wrap(t, e, r, n) {
45
- var i = e && e.prototype instanceof Generator ? e : Generator,
46
- a = Object.create(i.prototype),
47
- c = new Context(n || []);
48
- return o(a, "_invoke", {
49
- value: makeInvokeMethod(t, r, c)
50
- }), a;
51
- }
52
- function tryCatch(t, e, r) {
53
- try {
54
- return {
55
- type: "normal",
56
- arg: t.call(e, r)
57
- };
58
- } catch (t) {
59
- return {
60
- type: "throw",
61
- arg: t
62
- };
63
- }
64
- }
65
- e.wrap = wrap;
66
- var h = "suspendedStart",
67
- l = "suspendedYield",
68
- f = "executing",
69
- s = "completed",
70
- y = {};
71
- function Generator() {}
72
- function GeneratorFunction() {}
73
- function GeneratorFunctionPrototype() {}
74
- var p = {};
75
- define(p, a, function () {
76
- return this;
77
- });
78
- var d = Object.getPrototypeOf,
79
- v = d && d(d(values([])));
80
- v && v !== r && n.call(v, a) && (p = v);
81
- var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
82
- function defineIteratorMethods(t) {
83
- ["next", "throw", "return"].forEach(function (e) {
84
- define(t, e, function (t) {
85
- return this._invoke(e, t);
86
- });
87
- });
88
- }
89
- function AsyncIterator(t, e) {
90
- function invoke(r, o, i, a) {
91
- var c = tryCatch(t[r], t, o);
92
- if ("throw" !== c.type) {
93
- var u = c.arg,
94
- h = u.value;
95
- return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
96
- invoke("next", t, i, a);
97
- }, function (t) {
98
- invoke("throw", t, i, a);
99
- }) : e.resolve(h).then(function (t) {
100
- u.value = t, i(u);
101
- }, function (t) {
102
- return invoke("throw", t, i, a);
103
- });
104
- }
105
- a(c.arg);
106
- }
107
- var r;
108
- o(this, "_invoke", {
109
- value: function (t, n) {
110
- function callInvokeWithMethodAndArg() {
111
- return new e(function (e, r) {
112
- invoke(t, n, e, r);
113
- });
114
- }
115
- return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
116
- }
117
- });
118
- }
119
- function makeInvokeMethod(e, r, n) {
120
- var o = h;
121
- return function (i, a) {
122
- if (o === f) throw new Error("Generator is already running");
123
- if (o === s) {
124
- if ("throw" === i) throw a;
125
- return {
126
- value: t,
127
- done: !0
128
- };
129
- }
130
- for (n.method = i, n.arg = a;;) {
131
- var c = n.delegate;
132
- if (c) {
133
- var u = maybeInvokeDelegate(c, n);
134
- if (u) {
135
- if (u === y) continue;
136
- return u;
137
- }
138
- }
139
- if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
140
- if (o === h) throw o = s, n.arg;
141
- n.dispatchException(n.arg);
142
- } else "return" === n.method && n.abrupt("return", n.arg);
143
- o = f;
144
- var p = tryCatch(e, r, n);
145
- if ("normal" === p.type) {
146
- if (o = n.done ? s : l, p.arg === y) continue;
147
- return {
148
- value: p.arg,
149
- done: n.done
150
- };
151
- }
152
- "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
153
- }
154
- };
155
- }
156
- function maybeInvokeDelegate(e, r) {
157
- var n = r.method,
158
- o = e.iterator[n];
159
- if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
160
- var i = tryCatch(o, e.iterator, r.arg);
161
- if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
162
- var a = i.arg;
163
- return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
164
- }
165
- function pushTryEntry(t) {
166
- var e = {
167
- tryLoc: t[0]
168
- };
169
- 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
170
- }
171
- function resetTryEntry(t) {
172
- var e = t.completion || {};
173
- e.type = "normal", delete e.arg, t.completion = e;
174
- }
175
- function Context(t) {
176
- this.tryEntries = [{
177
- tryLoc: "root"
178
- }], t.forEach(pushTryEntry, this), this.reset(!0);
179
- }
180
- function values(e) {
181
- if (e || "" === e) {
182
- var r = e[a];
183
- if (r) return r.call(e);
184
- if ("function" == typeof e.next) return e;
185
- if (!isNaN(e.length)) {
186
- var o = -1,
187
- i = function next() {
188
- for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
189
- return next.value = t, next.done = !0, next;
190
- };
191
- return i.next = i;
192
- }
193
- }
194
- throw new TypeError(typeof e + " is not iterable");
195
- }
196
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
197
- value: GeneratorFunctionPrototype,
198
- configurable: !0
199
- }), o(GeneratorFunctionPrototype, "constructor", {
200
- value: GeneratorFunction,
201
- configurable: !0
202
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
203
- var e = "function" == typeof t && t.constructor;
204
- return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
205
- }, e.mark = function (t) {
206
- return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
207
- }, e.awrap = function (t) {
208
- return {
209
- __await: t
210
- };
211
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
212
- return this;
213
- }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
214
- void 0 === i && (i = Promise);
215
- var a = new AsyncIterator(wrap(t, r, n, o), i);
216
- return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
217
- return t.done ? t.value : a.next();
218
- });
219
- }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
220
- return this;
221
- }), define(g, "toString", function () {
222
- return "[object Generator]";
223
- }), e.keys = function (t) {
224
- var e = Object(t),
225
- r = [];
226
- for (var n in e) r.push(n);
227
- return r.reverse(), function next() {
228
- for (; r.length;) {
229
- var t = r.pop();
230
- if (t in e) return next.value = t, next.done = !1, next;
231
- }
232
- return next.done = !0, next;
233
- };
234
- }, e.values = values, Context.prototype = {
235
- constructor: Context,
236
- reset: function (e) {
237
- if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
238
- },
239
- stop: function () {
240
- this.done = !0;
241
- var t = this.tryEntries[0].completion;
242
- if ("throw" === t.type) throw t.arg;
243
- return this.rval;
244
- },
245
- dispatchException: function (e) {
246
- if (this.done) throw e;
247
- var r = this;
248
- function handle(n, o) {
249
- return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
250
- }
251
- for (var o = this.tryEntries.length - 1; o >= 0; --o) {
252
- var i = this.tryEntries[o],
253
- a = i.completion;
254
- if ("root" === i.tryLoc) return handle("end");
255
- if (i.tryLoc <= this.prev) {
256
- var c = n.call(i, "catchLoc"),
257
- u = n.call(i, "finallyLoc");
258
- if (c && u) {
259
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
260
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
261
- } else if (c) {
262
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
263
- } else {
264
- if (!u) throw new Error("try statement without catch or finally");
265
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
266
- }
267
- }
268
- }
269
- },
270
- abrupt: function (t, e) {
271
- for (var r = this.tryEntries.length - 1; r >= 0; --r) {
272
- var o = this.tryEntries[r];
273
- if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
274
- var i = o;
275
- break;
276
- }
277
- }
278
- i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
279
- var a = i ? i.completion : {};
280
- return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
281
- },
282
- complete: function (t, e) {
283
- if ("throw" === t.type) throw t.arg;
284
- return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
285
- },
286
- finish: function (t) {
287
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
288
- var r = this.tryEntries[e];
289
- if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
290
- }
291
- },
292
- catch: function (t) {
293
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
294
- var r = this.tryEntries[e];
295
- if (r.tryLoc === t) {
296
- var n = r.completion;
297
- if ("throw" === n.type) {
298
- var o = n.arg;
299
- resetTryEntry(r);
300
- }
301
- return o;
302
- }
303
- }
304
- throw new Error("illegal catch attempt");
305
- },
306
- delegateYield: function (e, r, n) {
307
- return this.delegate = {
308
- iterator: values(e),
309
- resultName: r,
310
- nextLoc: n
311
- }, "next" === this.method && (this.arg = t), y;
312
- }
313
- }, e;
314
- }
315
-
316
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
317
- try {
318
- var info = gen[key](arg);
319
- var value = info.value;
320
- } catch (error) {
321
- reject(error);
322
- return;
323
- }
324
- if (info.done) {
325
- resolve(value);
326
- } else {
327
- Promise.resolve(value).then(_next, _throw);
328
- }
329
- }
330
- function _asyncToGenerator(fn) {
331
- return function () {
332
- var self = this,
333
- args = arguments;
334
- return new Promise(function (resolve, reject) {
335
- var gen = fn.apply(self, args);
336
- function _next(value) {
337
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
338
- }
339
- function _throw(err) {
340
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
341
- }
342
- _next(undefined);
343
- });
344
- };
345
- }
346
-
347
- var initValNextAppRouter = function initValNextAppRouter(config, nextConfig) {
15
+ var initValNextAppRouter = function initValNextAppRouter(valModules, config, nextConfig) {
348
16
  var route = "/api/val"; // TODO: get from config
349
17
  var coreVersion = core.Internal.VERSION.core;
350
18
  if (!coreVersion) {
@@ -354,15 +22,15 @@ var initValNextAppRouter = function initValNextAppRouter(config, nextConfig) {
354
22
  if (!nextVersion) {
355
23
  throw new Error("Could not get @valbuild/next package version");
356
24
  }
357
- return server.createValApiRouter(route, server.createValServer(route, objectSpread2._objectSpread2({
25
+ return server.createValApiRouter(route, server.createValServer(valModules, route, objectSpread2._objectSpread2({
358
26
  versions: {
359
27
  next: nextVersion,
360
28
  core: coreVersion
361
29
  }
362
30
  }, config), {
363
31
  isEnabled: function isEnabled() {
364
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
365
- return _regeneratorRuntime().wrap(function _callee$(_context) {
32
+ return asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee() {
33
+ return asyncToGenerator._regeneratorRuntime().wrap(function _callee$(_context) {
366
34
  while (1) switch (_context.prev = _context.next) {
367
35
  case 0:
368
36
  return _context.abrupt("return", nextConfig.draftMode().isEnabled);
@@ -374,8 +42,8 @@ var initValNextAppRouter = function initValNextAppRouter(config, nextConfig) {
374
42
  }))();
375
43
  },
376
44
  onEnable: function onEnable() {
377
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
378
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
45
+ return asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee2() {
46
+ return asyncToGenerator._regeneratorRuntime().wrap(function _callee2$(_context2) {
379
47
  while (1) switch (_context2.prev = _context2.next) {
380
48
  case 0:
381
49
  nextConfig.draftMode().enable();
@@ -387,8 +55,8 @@ var initValNextAppRouter = function initValNextAppRouter(config, nextConfig) {
387
55
  }))();
388
56
  },
389
57
  onDisable: function onDisable() {
390
- return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
391
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
58
+ return asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator._regeneratorRuntime().mark(function _callee3() {
59
+ return asyncToGenerator._regeneratorRuntime().wrap(function _callee3$(_context3) {
392
60
  while (1) switch (_context3.prev = _context3.next) {
393
61
  case 0:
394
62
  nextConfig.draftMode().disable();
@@ -399,7 +67,7 @@ var initValNextAppRouter = function initValNextAppRouter(config, nextConfig) {
399
67
  }, _callee3);
400
68
  }))();
401
69
  }
402
- }), function (valRes) {
70
+ }, nextConfig.formatter), function (valRes) {
403
71
  var headersInit = undefined;
404
72
  var valResHeaders = "headers" in valRes && valRes.headers || {};
405
73
  for (var key in valResHeaders) {
@@ -443,9 +111,9 @@ var initValNextAppRouter = function initValNextAppRouter(config, nextConfig) {
443
111
  });
444
112
  };
445
113
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
446
- function initValServer(config, nextConfig) {
114
+ function initValServer(valModules, config, nextConfig) {
447
115
  return {
448
- valNextAppRouter: initValNextAppRouter(config, nextConfig)
116
+ valNextAppRouter: initValNextAppRouter(valModules, config, nextConfig)
449
117
  };
450
118
  }
451
119