@valbuild/react 0.63.5 → 0.65.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 (58) hide show
  1. package/dist/declarations/src/jsx-namespace.d.ts +4 -4
  2. package/dist/declarations/src/stega/index.d.ts +2 -0
  3. package/dist/{slicedToArray-129629e4.cjs.dev.js → slicedToArray-09243dae.cjs.prod.js} +5 -5
  4. package/dist/{slicedToArray-a79154e9.esm.js → slicedToArray-5391d3c0.esm.js} +5 -5
  5. package/dist/{slicedToArray-7a63acfd.worker.esm.js → slicedToArray-9ebce1ca.browser.esm.js} +5 -5
  6. package/dist/{slicedToArray-386a8ae8.cjs.prod.js → slicedToArray-b5020f32.cjs.dev.js} +5 -5
  7. package/dist/{slicedToArray-6b2002fa.browser.esm.js → slicedToArray-bbda5dad.worker.esm.js} +5 -5
  8. package/dist/toConsumableArray-1969d309.cjs.dev.js +21 -0
  9. package/dist/toConsumableArray-299fbd28.worker.esm.js +19 -0
  10. package/dist/toConsumableArray-5ba6766a.browser.esm.js +19 -0
  11. package/dist/toConsumableArray-9f3cfc47.esm.js +19 -0
  12. package/dist/toConsumableArray-b772a825.cjs.prod.js +21 -0
  13. package/dist/unsupportedIterableToArray-0ac4ac41.browser.esm.js +15 -0
  14. package/dist/unsupportedIterableToArray-10eaf95e.worker.esm.js +15 -0
  15. package/dist/unsupportedIterableToArray-1aadf9fb.cjs.prod.js +18 -0
  16. package/dist/unsupportedIterableToArray-20a9209f.cjs.dev.js +18 -0
  17. package/dist/unsupportedIterableToArray-f57eb659.esm.js +15 -0
  18. package/dist/valbuild-react.cjs.d.ts +3 -3
  19. package/internal/dist/valbuild-react-internal.browser.esm.js +2 -2
  20. package/internal/dist/valbuild-react-internal.cjs.d.ts +2 -2
  21. package/internal/dist/valbuild-react-internal.cjs.dev.js +2 -2
  22. package/internal/dist/valbuild-react-internal.cjs.prod.js +2 -2
  23. package/internal/dist/valbuild-react-internal.esm.js +2 -2
  24. package/internal/dist/valbuild-react-internal.worker.esm.js +2 -2
  25. package/jsx-dev-runtime/dist/valbuild-react-jsx-dev-runtime.browser.esm.js +2 -2
  26. package/jsx-dev-runtime/dist/valbuild-react-jsx-dev-runtime.cjs.d.ts +2 -2
  27. package/jsx-dev-runtime/dist/valbuild-react-jsx-dev-runtime.cjs.dev.js +2 -2
  28. package/jsx-dev-runtime/dist/valbuild-react-jsx-dev-runtime.cjs.prod.js +2 -2
  29. package/jsx-dev-runtime/dist/valbuild-react-jsx-dev-runtime.esm.js +2 -2
  30. package/jsx-dev-runtime/dist/valbuild-react-jsx-dev-runtime.worker.esm.js +2 -2
  31. package/jsx-runtime/dist/valbuild-react-jsx-runtime.browser.esm.js +2 -2
  32. package/jsx-runtime/dist/valbuild-react-jsx-runtime.cjs.d.ts +2 -2
  33. package/jsx-runtime/dist/valbuild-react-jsx-runtime.cjs.dev.js +2 -2
  34. package/jsx-runtime/dist/valbuild-react-jsx-runtime.cjs.prod.js +2 -2
  35. package/jsx-runtime/dist/valbuild-react-jsx-runtime.esm.js +2 -2
  36. package/jsx-runtime/dist/valbuild-react-jsx-runtime.worker.esm.js +2 -2
  37. package/package.json +4 -4
  38. package/stega/dist/valbuild-react-stega.browser.esm.js +50 -38
  39. package/stega/dist/valbuild-react-stega.cjs.d.ts +2 -2
  40. package/stega/dist/valbuild-react-stega.cjs.dev.js +51 -37
  41. package/stega/dist/valbuild-react-stega.cjs.prod.js +51 -37
  42. package/stega/dist/valbuild-react-stega.esm.js +50 -38
  43. package/stega/dist/valbuild-react-stega.worker.esm.js +50 -38
  44. package/dist/toConsumableArray-0a75a603.worker.esm.js +0 -19
  45. package/dist/toConsumableArray-0ccd58b7.esm.js +0 -19
  46. package/dist/toConsumableArray-5a71fbb3.browser.esm.js +0 -19
  47. package/dist/toConsumableArray-b2d28ffa.cjs.dev.js +0 -21
  48. package/dist/toConsumableArray-b5e3b83f.cjs.prod.js +0 -21
  49. package/dist/unsupportedIterableToArray-42309462.cjs.prod.js +0 -19
  50. package/dist/unsupportedIterableToArray-50359a05.worker.esm.js +0 -16
  51. package/dist/unsupportedIterableToArray-7c30dadf.esm.js +0 -16
  52. package/dist/unsupportedIterableToArray-ac28611a.cjs.dev.js +0 -19
  53. package/dist/unsupportedIterableToArray-cce3cb41.browser.esm.js +0 -16
  54. package/dist/valbuild-react.cjs.d.ts.map +0 -1
  55. package/internal/dist/valbuild-react-internal.cjs.d.ts.map +0 -1
  56. package/jsx-dev-runtime/dist/valbuild-react-jsx-dev-runtime.cjs.d.ts.map +0 -1
  57. package/jsx-runtime/dist/valbuild-react-jsx-runtime.cjs.d.ts.map +0 -1
  58. package/stega/dist/valbuild-react-stega.cjs.d.ts.map +0 -1
@@ -1,11 +1,11 @@
1
- import { a as _typeof, _ as _slicedToArray } from '../../dist/slicedToArray-6b2002fa.browser.esm.js';
1
+ import { a as _typeof, _ as _slicedToArray } from '../../dist/slicedToArray-9ebce1ca.browser.esm.js';
2
2
  import ReactJSXRuntime__default from 'react/jsx-runtime';
3
3
  import jsxRuntimeDev__default from 'react/jsx-dev-runtime';
4
4
  import React from 'react';
5
5
  import { vercelStegaDecode, VERCEL_STEGA_REGEX, vercelStegaSplit, vercelStegaCombine } from '@vercel/stega';
6
- import { _ as _toConsumableArray } from '../../dist/toConsumableArray-5a71fbb3.browser.esm.js';
6
+ import { _ as _toConsumableArray } from '../../dist/toConsumableArray-5ba6766a.browser.esm.js';
7
7
  import { Internal, VAL_EXTENSION, FILE_REF_PROP } from '@valbuild/core';
8
- import '../../dist/unsupportedIterableToArray-cce3cb41.browser.esm.js';
8
+ import '../../dist/unsupportedIterableToArray-0ac4ac41.browser.esm.js';
9
9
 
10
10
  function stegaDecodeString(encodedString) {
11
11
  if (!encodedString || typeof encodedString !== "string") return;
@@ -17,18 +17,15 @@ function stegaDecodeString(encodedString) {
17
17
  }
18
18
  }
19
19
 
20
- // import { IS_AUTO_TAG_JSX_ENABLED } from ".";
21
-
22
20
  var isIntrinsicElement = function isIntrinsicElement(type) {
23
21
  // TODO: think this is not correct, but good enough for now?
24
22
  return typeof type === "string";
25
23
  };
26
24
  var addValPathIfFound = function addValPathIfFound(type, props) {
27
25
  // TODO: increases performance. Unsure about the implications right now - seems to work. Remember to look at RSC and client (and pages/?).
28
- // if (!IS_AUTO_TAG_JSX_ENABLED()) {
29
- // return;
30
- // }
31
-
26
+ if (!IS_AUTO_TAG_JSX_ENABLED()) {
27
+ return;
28
+ }
32
29
  var valSources = new Set();
33
30
 
34
31
  // skip auto-tagging fragments since we can't add attributes to them
@@ -65,6 +62,15 @@ var addValPathIfFound = function addValPathIfFound(type, props) {
65
62
  } else {
66
63
  console.error("Val: Could not auto tag. Reason: unexpected types found while cleaning and / or adding val path data props.");
67
64
  }
65
+ } else {
66
+ if (key === "href") {
67
+ // This is a hack to make sure href values in Next Link components are cleaned (seems to be a React Server Component issue?)
68
+ var _cleanValue = vercelStegaSplit(value).cleaned;
69
+ if (typeof key === "string" && !Array.isArray(container)) {
70
+ container[key] = _cleanValue;
71
+ valSources.add(valPath);
72
+ }
73
+ }
68
74
  }
69
75
  }
70
76
  }
@@ -99,6 +105,9 @@ var addValPathIfFound = function addValPathIfFound(type, props) {
99
105
  }
100
106
  if (valSources.size > 0 && !props["data-val-path"]) {
101
107
  props["data-val-path"] = Array.from(valSources).join(",");
108
+ if (IS_RSC()) {
109
+ props["data-val-rsc"] = "true";
110
+ }
102
111
  }
103
112
  }
104
113
  };
@@ -124,15 +133,15 @@ function autoTagJSX() {
124
133
  * include both, so one of them will be set with `undefined` values.
125
134
  */
126
135
  React.createElement = WrapJsx(React.createElement);
127
- JsxDev.jsx && ( /* */JsxDev.jsx = WrapJsx(JsxDev.jsx));
128
- JsxPro.jsx && ( /* */JsxPro.jsx = WrapJsx(JsxPro.jsx));
129
- JsxDev.jsxs && ( /* */JsxDev.jsxs = WrapJsx(JsxDev.jsxs));
130
- JsxPro.jsxs && ( /* */JsxPro.jsxs = WrapJsx(JsxPro.jsxs));
131
- JsxDev.jsxDEV && ( /**/JsxDev.jsxDEV = WrapJsx(JsxDev.jsxDEV));
132
- JsxPro.jsxDEV && ( /**/JsxPro.jsxDEV = WrapJsx(JsxPro.jsxDEV));
136
+ JsxDev.jsx && (/* */JsxDev.jsx = WrapJsx(JsxDev.jsx));
137
+ JsxPro.jsx && (/* */JsxPro.jsx = WrapJsx(JsxPro.jsx));
138
+ JsxDev.jsxs && (/* */JsxDev.jsxs = WrapJsx(JsxDev.jsxs));
139
+ JsxPro.jsxs && (/* */JsxPro.jsxs = WrapJsx(JsxPro.jsxs));
140
+ JsxDev.jsxDEV && (/**/JsxDev.jsxDEV = WrapJsx(JsxDev.jsxDEV));
141
+ JsxPro.jsxDEV && (/**/JsxPro.jsxDEV = WrapJsx(JsxPro.jsxDEV));
133
142
  }
134
143
 
135
- function toPrimitive(t, r) {
144
+ function _toPrimitive(t, r) {
136
145
  if ("object" != typeof t || !t) return t;
137
146
  var e = t[Symbol.toPrimitive];
138
147
  if (void 0 !== e) {
@@ -143,24 +152,18 @@ function toPrimitive(t, r) {
143
152
  return ("string" === r ? String : Number)(t);
144
153
  }
145
154
 
146
- function toPropertyKey(t) {
147
- var i = toPrimitive(t, "string");
148
- return "symbol" == typeof i ? i : String(i);
155
+ function _toPropertyKey(t) {
156
+ var i = _toPrimitive(t, "string");
157
+ return "symbol" == typeof i ? i : i + "";
149
158
  }
150
159
 
151
- function _defineProperty(obj, key, value) {
152
- key = toPropertyKey(key);
153
- if (key in obj) {
154
- Object.defineProperty(obj, key, {
155
- value: value,
156
- enumerable: true,
157
- configurable: true,
158
- writable: true
159
- });
160
- } else {
161
- obj[key] = value;
162
- }
163
- return obj;
160
+ function _defineProperty(e, r, t) {
161
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
162
+ value: t,
163
+ enumerable: !0,
164
+ configurable: !0,
165
+ writable: !0
166
+ }) : e[r] = t, e;
164
167
  }
165
168
 
166
169
  function ownKeys(e, r) {
@@ -206,10 +209,14 @@ function stegaEncode(input, opts) {
206
209
  if (recOpts !== null && recOpts !== void 0 && recOpts.schema && isLiteralSchema(recOpts === null || recOpts === void 0 ? void 0 : recOpts.schema)) {
207
210
  return sourceOrSelector;
208
211
  }
212
+ if (recOpts !== null && recOpts !== void 0 && recOpts.schema && isDateSchema(recOpts === null || recOpts === void 0 ? void 0 : recOpts.schema)) {
213
+ return sourceOrSelector;
214
+ }
209
215
  if (recOpts !== null && recOpts !== void 0 && recOpts.schema && isUnionSchema(recOpts === null || recOpts === void 0 ? void 0 : recOpts.schema)) {
210
216
  if (sourceOrSelector && _typeof(sourceOrSelector) === "object" && recOpts.schema.key && typeof recOpts.schema.key === "string") {
211
217
  var _key = sourceOrSelector[recOpts.schema.key];
212
218
  if (_key) {
219
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
213
220
  var schema = recOpts.schema.items.find(function (s) {
214
221
  if (isObjectSchema(s) && s.items && s.items[recOpts.schema.key]) {
215
222
  var keySchema = s.items[recOpts.schema.key];
@@ -270,11 +277,6 @@ function stegaEncode(input, opts) {
270
277
  if (sourceOrSelector[VAL_EXTENSION] === "file" && typeof sourceOrSelector[FILE_REF_PROP] === "string") {
271
278
  var fileSelector = Internal.convertFileSource(sourceOrSelector);
272
279
  var url = fileSelector.url;
273
- if (opts.disabled) {
274
- url = fileSelector.url;
275
- } else {
276
- url = "/api/val/files/public" + fileSelector.url;
277
- }
278
280
  return _objectSpread2(_objectSpread2({}, fileSelector), {}, {
279
281
  url: rec(url, recOpts)
280
282
  });
@@ -337,6 +339,9 @@ function isRecordSchema(schema) {
337
339
  function isLiteralSchema(schema) {
338
340
  return (schema === null || schema === void 0 ? void 0 : schema.type) === "literal";
339
341
  }
342
+ function isDateSchema(schema) {
343
+ return (schema === null || schema === void 0 ? void 0 : schema.type) === "date";
344
+ }
340
345
  function unknownSchema(schema) {
341
346
  console.debug("Found unknown schema", schema);
342
347
  return schema;
@@ -407,6 +412,7 @@ function getModuleIds(input) {
407
412
  }
408
413
 
409
414
  // NOTE: the exports of this file needs to be kept in sync with ValQuickJSRuntime
415
+ var isRSC = false;
410
416
  var autoTagJSXEnabled = false;
411
417
  function IS_AUTO_TAG_JSX_ENABLED() {
412
418
  return autoTagJSXEnabled;
@@ -414,5 +420,11 @@ function IS_AUTO_TAG_JSX_ENABLED() {
414
420
  function SET_AUTO_TAG_JSX_ENABLED(enabled) {
415
421
  autoTagJSXEnabled = enabled;
416
422
  }
423
+ function IS_RSC() {
424
+ return isRSC;
425
+ }
426
+ function SET_RSC(enabled) {
427
+ isRSC = enabled;
428
+ }
417
429
 
418
- export { IS_AUTO_TAG_JSX_ENABLED, SET_AUTO_TAG_JSX_ENABLED, autoTagJSX, getModuleIds, stegaClean, stegaDecodeString, stegaEncode };
430
+ export { IS_AUTO_TAG_JSX_ENABLED, IS_RSC, SET_AUTO_TAG_JSX_ENABLED, SET_RSC, autoTagJSX, getModuleIds, stegaClean, stegaDecodeString, stegaEncode };
@@ -1,2 +1,2 @@
1
- export * from "../../dist/declarations/src/stega/index";
2
- //# sourceMappingURL=valbuild-react-stega.cjs.d.ts.map
1
+ export * from "../../dist/declarations/src/stega/index.js";
2
+ //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmFsYnVpbGQtcmVhY3Qtc3RlZ2EuY2pzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9kaXN0L2RlY2xhcmF0aW9ucy9zcmMvc3RlZ2EvaW5kZXguZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSJ9
@@ -2,14 +2,14 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var slicedToArray = require('../../dist/slicedToArray-129629e4.cjs.dev.js');
5
+ var slicedToArray = require('../../dist/slicedToArray-b5020f32.cjs.dev.js');
6
6
  var ReactJSXRuntime = require('react/jsx-runtime');
7
7
  var jsxRuntimeDev = require('react/jsx-dev-runtime');
8
8
  var React = require('react');
9
9
  var stega = require('@vercel/stega');
10
- var toConsumableArray = require('../../dist/toConsumableArray-b2d28ffa.cjs.dev.js');
10
+ var toConsumableArray = require('../../dist/toConsumableArray-1969d309.cjs.dev.js');
11
11
  var core = require('@valbuild/core');
12
- require('../../dist/unsupportedIterableToArray-ac28611a.cjs.dev.js');
12
+ require('../../dist/unsupportedIterableToArray-20a9209f.cjs.dev.js');
13
13
 
14
14
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
15
15
 
@@ -27,18 +27,15 @@ function stegaDecodeString(encodedString) {
27
27
  }
28
28
  }
29
29
 
30
- // import { IS_AUTO_TAG_JSX_ENABLED } from ".";
31
-
32
30
  var isIntrinsicElement = function isIntrinsicElement(type) {
33
31
  // TODO: think this is not correct, but good enough for now?
34
32
  return typeof type === "string";
35
33
  };
36
34
  var addValPathIfFound = function addValPathIfFound(type, props) {
37
35
  // TODO: increases performance. Unsure about the implications right now - seems to work. Remember to look at RSC and client (and pages/?).
38
- // if (!IS_AUTO_TAG_JSX_ENABLED()) {
39
- // return;
40
- // }
41
-
36
+ if (!IS_AUTO_TAG_JSX_ENABLED()) {
37
+ return;
38
+ }
42
39
  var valSources = new Set();
43
40
 
44
41
  // skip auto-tagging fragments since we can't add attributes to them
@@ -75,6 +72,15 @@ var addValPathIfFound = function addValPathIfFound(type, props) {
75
72
  } else {
76
73
  console.error("Val: Could not auto tag. Reason: unexpected types found while cleaning and / or adding val path data props.");
77
74
  }
75
+ } else {
76
+ if (key === "href") {
77
+ // This is a hack to make sure href values in Next Link components are cleaned (seems to be a React Server Component issue?)
78
+ var _cleanValue = stega.vercelStegaSplit(value).cleaned;
79
+ if (typeof key === "string" && !Array.isArray(container)) {
80
+ container[key] = _cleanValue;
81
+ valSources.add(valPath);
82
+ }
83
+ }
78
84
  }
79
85
  }
80
86
  }
@@ -109,6 +115,9 @@ var addValPathIfFound = function addValPathIfFound(type, props) {
109
115
  }
110
116
  if (valSources.size > 0 && !props["data-val-path"]) {
111
117
  props["data-val-path"] = Array.from(valSources).join(",");
118
+ if (IS_RSC()) {
119
+ props["data-val-rsc"] = "true";
120
+ }
112
121
  }
113
122
  }
114
123
  };
@@ -134,15 +143,15 @@ function autoTagJSX() {
134
143
  * include both, so one of them will be set with `undefined` values.
135
144
  */
136
145
  React__default["default"].createElement = WrapJsx(React__default["default"].createElement);
137
- JsxDev.jsx && ( /* */JsxDev.jsx = WrapJsx(JsxDev.jsx));
138
- JsxPro.jsx && ( /* */JsxPro.jsx = WrapJsx(JsxPro.jsx));
139
- JsxDev.jsxs && ( /* */JsxDev.jsxs = WrapJsx(JsxDev.jsxs));
140
- JsxPro.jsxs && ( /* */JsxPro.jsxs = WrapJsx(JsxPro.jsxs));
141
- JsxDev.jsxDEV && ( /**/JsxDev.jsxDEV = WrapJsx(JsxDev.jsxDEV));
142
- JsxPro.jsxDEV && ( /**/JsxPro.jsxDEV = WrapJsx(JsxPro.jsxDEV));
146
+ JsxDev.jsx && (/* */JsxDev.jsx = WrapJsx(JsxDev.jsx));
147
+ JsxPro.jsx && (/* */JsxPro.jsx = WrapJsx(JsxPro.jsx));
148
+ JsxDev.jsxs && (/* */JsxDev.jsxs = WrapJsx(JsxDev.jsxs));
149
+ JsxPro.jsxs && (/* */JsxPro.jsxs = WrapJsx(JsxPro.jsxs));
150
+ JsxDev.jsxDEV && (/**/JsxDev.jsxDEV = WrapJsx(JsxDev.jsxDEV));
151
+ JsxPro.jsxDEV && (/**/JsxPro.jsxDEV = WrapJsx(JsxPro.jsxDEV));
143
152
  }
144
153
 
145
- function toPrimitive(t, r) {
154
+ function _toPrimitive(t, r) {
146
155
  if ("object" != typeof t || !t) return t;
147
156
  var e = t[Symbol.toPrimitive];
148
157
  if (void 0 !== e) {
@@ -153,24 +162,18 @@ function toPrimitive(t, r) {
153
162
  return ("string" === r ? String : Number)(t);
154
163
  }
155
164
 
156
- function toPropertyKey(t) {
157
- var i = toPrimitive(t, "string");
158
- return "symbol" == typeof i ? i : String(i);
165
+ function _toPropertyKey(t) {
166
+ var i = _toPrimitive(t, "string");
167
+ return "symbol" == typeof i ? i : i + "";
159
168
  }
160
169
 
161
- function _defineProperty(obj, key, value) {
162
- key = toPropertyKey(key);
163
- if (key in obj) {
164
- Object.defineProperty(obj, key, {
165
- value: value,
166
- enumerable: true,
167
- configurable: true,
168
- writable: true
169
- });
170
- } else {
171
- obj[key] = value;
172
- }
173
- return obj;
170
+ function _defineProperty(e, r, t) {
171
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
172
+ value: t,
173
+ enumerable: !0,
174
+ configurable: !0,
175
+ writable: !0
176
+ }) : e[r] = t, e;
174
177
  }
175
178
 
176
179
  function ownKeys(e, r) {
@@ -216,10 +219,14 @@ function stegaEncode(input, opts) {
216
219
  if (recOpts !== null && recOpts !== void 0 && recOpts.schema && isLiteralSchema(recOpts === null || recOpts === void 0 ? void 0 : recOpts.schema)) {
217
220
  return sourceOrSelector;
218
221
  }
222
+ if (recOpts !== null && recOpts !== void 0 && recOpts.schema && isDateSchema(recOpts === null || recOpts === void 0 ? void 0 : recOpts.schema)) {
223
+ return sourceOrSelector;
224
+ }
219
225
  if (recOpts !== null && recOpts !== void 0 && recOpts.schema && isUnionSchema(recOpts === null || recOpts === void 0 ? void 0 : recOpts.schema)) {
220
226
  if (sourceOrSelector && slicedToArray._typeof(sourceOrSelector) === "object" && recOpts.schema.key && typeof recOpts.schema.key === "string") {
221
227
  var _key = sourceOrSelector[recOpts.schema.key];
222
228
  if (_key) {
229
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
223
230
  var schema = recOpts.schema.items.find(function (s) {
224
231
  if (isObjectSchema(s) && s.items && s.items[recOpts.schema.key]) {
225
232
  var keySchema = s.items[recOpts.schema.key];
@@ -280,11 +287,6 @@ function stegaEncode(input, opts) {
280
287
  if (sourceOrSelector[core.VAL_EXTENSION] === "file" && typeof sourceOrSelector[core.FILE_REF_PROP] === "string") {
281
288
  var fileSelector = core.Internal.convertFileSource(sourceOrSelector);
282
289
  var url = fileSelector.url;
283
- if (opts.disabled) {
284
- url = fileSelector.url;
285
- } else {
286
- url = "/api/val/files/public" + fileSelector.url;
287
- }
288
290
  return _objectSpread2(_objectSpread2({}, fileSelector), {}, {
289
291
  url: rec(url, recOpts)
290
292
  });
@@ -347,6 +349,9 @@ function isRecordSchema(schema) {
347
349
  function isLiteralSchema(schema) {
348
350
  return (schema === null || schema === void 0 ? void 0 : schema.type) === "literal";
349
351
  }
352
+ function isDateSchema(schema) {
353
+ return (schema === null || schema === void 0 ? void 0 : schema.type) === "date";
354
+ }
350
355
  function unknownSchema(schema) {
351
356
  console.debug("Found unknown schema", schema);
352
357
  return schema;
@@ -417,6 +422,7 @@ function getModuleIds(input) {
417
422
  }
418
423
 
419
424
  // NOTE: the exports of this file needs to be kept in sync with ValQuickJSRuntime
425
+ var isRSC = false;
420
426
  var autoTagJSXEnabled = false;
421
427
  function IS_AUTO_TAG_JSX_ENABLED() {
422
428
  return autoTagJSXEnabled;
@@ -424,9 +430,17 @@ function IS_AUTO_TAG_JSX_ENABLED() {
424
430
  function SET_AUTO_TAG_JSX_ENABLED(enabled) {
425
431
  autoTagJSXEnabled = enabled;
426
432
  }
433
+ function IS_RSC() {
434
+ return isRSC;
435
+ }
436
+ function SET_RSC(enabled) {
437
+ isRSC = enabled;
438
+ }
427
439
 
428
440
  exports.IS_AUTO_TAG_JSX_ENABLED = IS_AUTO_TAG_JSX_ENABLED;
441
+ exports.IS_RSC = IS_RSC;
429
442
  exports.SET_AUTO_TAG_JSX_ENABLED = SET_AUTO_TAG_JSX_ENABLED;
443
+ exports.SET_RSC = SET_RSC;
430
444
  exports.autoTagJSX = autoTagJSX;
431
445
  exports.getModuleIds = getModuleIds;
432
446
  exports.stegaClean = stegaClean;
@@ -2,14 +2,14 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var slicedToArray = require('../../dist/slicedToArray-386a8ae8.cjs.prod.js');
5
+ var slicedToArray = require('../../dist/slicedToArray-09243dae.cjs.prod.js');
6
6
  var ReactJSXRuntime = require('react/jsx-runtime');
7
7
  var jsxRuntimeDev = require('react/jsx-dev-runtime');
8
8
  var React = require('react');
9
9
  var stega = require('@vercel/stega');
10
- var toConsumableArray = require('../../dist/toConsumableArray-b5e3b83f.cjs.prod.js');
10
+ var toConsumableArray = require('../../dist/toConsumableArray-b772a825.cjs.prod.js');
11
11
  var core = require('@valbuild/core');
12
- require('../../dist/unsupportedIterableToArray-42309462.cjs.prod.js');
12
+ require('../../dist/unsupportedIterableToArray-1aadf9fb.cjs.prod.js');
13
13
 
14
14
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
15
15
 
@@ -27,18 +27,15 @@ function stegaDecodeString(encodedString) {
27
27
  }
28
28
  }
29
29
 
30
- // import { IS_AUTO_TAG_JSX_ENABLED } from ".";
31
-
32
30
  var isIntrinsicElement = function isIntrinsicElement(type) {
33
31
  // TODO: think this is not correct, but good enough for now?
34
32
  return typeof type === "string";
35
33
  };
36
34
  var addValPathIfFound = function addValPathIfFound(type, props) {
37
35
  // TODO: increases performance. Unsure about the implications right now - seems to work. Remember to look at RSC and client (and pages/?).
38
- // if (!IS_AUTO_TAG_JSX_ENABLED()) {
39
- // return;
40
- // }
41
-
36
+ if (!IS_AUTO_TAG_JSX_ENABLED()) {
37
+ return;
38
+ }
42
39
  var valSources = new Set();
43
40
 
44
41
  // skip auto-tagging fragments since we can't add attributes to them
@@ -75,6 +72,15 @@ var addValPathIfFound = function addValPathIfFound(type, props) {
75
72
  } else {
76
73
  console.error("Val: Could not auto tag. Reason: unexpected types found while cleaning and / or adding val path data props.");
77
74
  }
75
+ } else {
76
+ if (key === "href") {
77
+ // This is a hack to make sure href values in Next Link components are cleaned (seems to be a React Server Component issue?)
78
+ var _cleanValue = stega.vercelStegaSplit(value).cleaned;
79
+ if (typeof key === "string" && !Array.isArray(container)) {
80
+ container[key] = _cleanValue;
81
+ valSources.add(valPath);
82
+ }
83
+ }
78
84
  }
79
85
  }
80
86
  }
@@ -109,6 +115,9 @@ var addValPathIfFound = function addValPathIfFound(type, props) {
109
115
  }
110
116
  if (valSources.size > 0 && !props["data-val-path"]) {
111
117
  props["data-val-path"] = Array.from(valSources).join(",");
118
+ if (IS_RSC()) {
119
+ props["data-val-rsc"] = "true";
120
+ }
112
121
  }
113
122
  }
114
123
  };
@@ -134,15 +143,15 @@ function autoTagJSX() {
134
143
  * include both, so one of them will be set with `undefined` values.
135
144
  */
136
145
  React__default["default"].createElement = WrapJsx(React__default["default"].createElement);
137
- JsxDev.jsx && ( /* */JsxDev.jsx = WrapJsx(JsxDev.jsx));
138
- JsxPro.jsx && ( /* */JsxPro.jsx = WrapJsx(JsxPro.jsx));
139
- JsxDev.jsxs && ( /* */JsxDev.jsxs = WrapJsx(JsxDev.jsxs));
140
- JsxPro.jsxs && ( /* */JsxPro.jsxs = WrapJsx(JsxPro.jsxs));
141
- JsxDev.jsxDEV && ( /**/JsxDev.jsxDEV = WrapJsx(JsxDev.jsxDEV));
142
- JsxPro.jsxDEV && ( /**/JsxPro.jsxDEV = WrapJsx(JsxPro.jsxDEV));
146
+ JsxDev.jsx && (/* */JsxDev.jsx = WrapJsx(JsxDev.jsx));
147
+ JsxPro.jsx && (/* */JsxPro.jsx = WrapJsx(JsxPro.jsx));
148
+ JsxDev.jsxs && (/* */JsxDev.jsxs = WrapJsx(JsxDev.jsxs));
149
+ JsxPro.jsxs && (/* */JsxPro.jsxs = WrapJsx(JsxPro.jsxs));
150
+ JsxDev.jsxDEV && (/**/JsxDev.jsxDEV = WrapJsx(JsxDev.jsxDEV));
151
+ JsxPro.jsxDEV && (/**/JsxPro.jsxDEV = WrapJsx(JsxPro.jsxDEV));
143
152
  }
144
153
 
145
- function toPrimitive(t, r) {
154
+ function _toPrimitive(t, r) {
146
155
  if ("object" != typeof t || !t) return t;
147
156
  var e = t[Symbol.toPrimitive];
148
157
  if (void 0 !== e) {
@@ -153,24 +162,18 @@ function toPrimitive(t, r) {
153
162
  return ("string" === r ? String : Number)(t);
154
163
  }
155
164
 
156
- function toPropertyKey(t) {
157
- var i = toPrimitive(t, "string");
158
- return "symbol" == typeof i ? i : String(i);
165
+ function _toPropertyKey(t) {
166
+ var i = _toPrimitive(t, "string");
167
+ return "symbol" == typeof i ? i : i + "";
159
168
  }
160
169
 
161
- function _defineProperty(obj, key, value) {
162
- key = toPropertyKey(key);
163
- if (key in obj) {
164
- Object.defineProperty(obj, key, {
165
- value: value,
166
- enumerable: true,
167
- configurable: true,
168
- writable: true
169
- });
170
- } else {
171
- obj[key] = value;
172
- }
173
- return obj;
170
+ function _defineProperty(e, r, t) {
171
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
172
+ value: t,
173
+ enumerable: !0,
174
+ configurable: !0,
175
+ writable: !0
176
+ }) : e[r] = t, e;
174
177
  }
175
178
 
176
179
  function ownKeys(e, r) {
@@ -216,10 +219,14 @@ function stegaEncode(input, opts) {
216
219
  if (recOpts !== null && recOpts !== void 0 && recOpts.schema && isLiteralSchema(recOpts === null || recOpts === void 0 ? void 0 : recOpts.schema)) {
217
220
  return sourceOrSelector;
218
221
  }
222
+ if (recOpts !== null && recOpts !== void 0 && recOpts.schema && isDateSchema(recOpts === null || recOpts === void 0 ? void 0 : recOpts.schema)) {
223
+ return sourceOrSelector;
224
+ }
219
225
  if (recOpts !== null && recOpts !== void 0 && recOpts.schema && isUnionSchema(recOpts === null || recOpts === void 0 ? void 0 : recOpts.schema)) {
220
226
  if (sourceOrSelector && slicedToArray._typeof(sourceOrSelector) === "object" && recOpts.schema.key && typeof recOpts.schema.key === "string") {
221
227
  var _key = sourceOrSelector[recOpts.schema.key];
222
228
  if (_key) {
229
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
223
230
  var schema = recOpts.schema.items.find(function (s) {
224
231
  if (isObjectSchema(s) && s.items && s.items[recOpts.schema.key]) {
225
232
  var keySchema = s.items[recOpts.schema.key];
@@ -280,11 +287,6 @@ function stegaEncode(input, opts) {
280
287
  if (sourceOrSelector[core.VAL_EXTENSION] === "file" && typeof sourceOrSelector[core.FILE_REF_PROP] === "string") {
281
288
  var fileSelector = core.Internal.convertFileSource(sourceOrSelector);
282
289
  var url = fileSelector.url;
283
- if (opts.disabled) {
284
- url = fileSelector.url;
285
- } else {
286
- url = "/api/val/files/public" + fileSelector.url;
287
- }
288
290
  return _objectSpread2(_objectSpread2({}, fileSelector), {}, {
289
291
  url: rec(url, recOpts)
290
292
  });
@@ -347,6 +349,9 @@ function isRecordSchema(schema) {
347
349
  function isLiteralSchema(schema) {
348
350
  return (schema === null || schema === void 0 ? void 0 : schema.type) === "literal";
349
351
  }
352
+ function isDateSchema(schema) {
353
+ return (schema === null || schema === void 0 ? void 0 : schema.type) === "date";
354
+ }
350
355
  function unknownSchema(schema) {
351
356
  console.debug("Found unknown schema", schema);
352
357
  return schema;
@@ -417,6 +422,7 @@ function getModuleIds(input) {
417
422
  }
418
423
 
419
424
  // NOTE: the exports of this file needs to be kept in sync with ValQuickJSRuntime
425
+ var isRSC = false;
420
426
  var autoTagJSXEnabled = false;
421
427
  function IS_AUTO_TAG_JSX_ENABLED() {
422
428
  return autoTagJSXEnabled;
@@ -424,9 +430,17 @@ function IS_AUTO_TAG_JSX_ENABLED() {
424
430
  function SET_AUTO_TAG_JSX_ENABLED(enabled) {
425
431
  autoTagJSXEnabled = enabled;
426
432
  }
433
+ function IS_RSC() {
434
+ return isRSC;
435
+ }
436
+ function SET_RSC(enabled) {
437
+ isRSC = enabled;
438
+ }
427
439
 
428
440
  exports.IS_AUTO_TAG_JSX_ENABLED = IS_AUTO_TAG_JSX_ENABLED;
441
+ exports.IS_RSC = IS_RSC;
429
442
  exports.SET_AUTO_TAG_JSX_ENABLED = SET_AUTO_TAG_JSX_ENABLED;
443
+ exports.SET_RSC = SET_RSC;
430
444
  exports.autoTagJSX = autoTagJSX;
431
445
  exports.getModuleIds = getModuleIds;
432
446
  exports.stegaClean = stegaClean;