@valbuild/react 0.64.0 → 0.65.2

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 (57) hide show
  1. package/dist/declarations/src/stega/index.d.ts +2 -0
  2. package/dist/{slicedToArray-129629e4.cjs.dev.js → slicedToArray-09243dae.cjs.prod.js} +5 -5
  3. package/dist/{slicedToArray-a79154e9.esm.js → slicedToArray-5391d3c0.esm.js} +5 -5
  4. package/dist/{slicedToArray-7a63acfd.worker.esm.js → slicedToArray-9ebce1ca.browser.esm.js} +5 -5
  5. package/dist/{slicedToArray-386a8ae8.cjs.prod.js → slicedToArray-b5020f32.cjs.dev.js} +5 -5
  6. package/dist/{slicedToArray-6b2002fa.browser.esm.js → slicedToArray-bbda5dad.worker.esm.js} +5 -5
  7. package/dist/toConsumableArray-1969d309.cjs.dev.js +21 -0
  8. package/dist/toConsumableArray-299fbd28.worker.esm.js +19 -0
  9. package/dist/toConsumableArray-5ba6766a.browser.esm.js +19 -0
  10. package/dist/toConsumableArray-9f3cfc47.esm.js +19 -0
  11. package/dist/toConsumableArray-b772a825.cjs.prod.js +21 -0
  12. package/dist/unsupportedIterableToArray-0ac4ac41.browser.esm.js +15 -0
  13. package/dist/unsupportedIterableToArray-10eaf95e.worker.esm.js +15 -0
  14. package/dist/unsupportedIterableToArray-1aadf9fb.cjs.prod.js +18 -0
  15. package/dist/unsupportedIterableToArray-20a9209f.cjs.dev.js +18 -0
  16. package/dist/unsupportedIterableToArray-f57eb659.esm.js +15 -0
  17. package/dist/valbuild-react.cjs.d.ts +3 -3
  18. package/internal/dist/valbuild-react-internal.browser.esm.js +2 -2
  19. package/internal/dist/valbuild-react-internal.cjs.d.ts +2 -2
  20. package/internal/dist/valbuild-react-internal.cjs.dev.js +2 -2
  21. package/internal/dist/valbuild-react-internal.cjs.prod.js +2 -2
  22. package/internal/dist/valbuild-react-internal.esm.js +2 -2
  23. package/internal/dist/valbuild-react-internal.worker.esm.js +2 -2
  24. package/jsx-dev-runtime/dist/valbuild-react-jsx-dev-runtime.browser.esm.js +2 -2
  25. package/jsx-dev-runtime/dist/valbuild-react-jsx-dev-runtime.cjs.d.ts +2 -2
  26. package/jsx-dev-runtime/dist/valbuild-react-jsx-dev-runtime.cjs.dev.js +2 -2
  27. package/jsx-dev-runtime/dist/valbuild-react-jsx-dev-runtime.cjs.prod.js +2 -2
  28. package/jsx-dev-runtime/dist/valbuild-react-jsx-dev-runtime.esm.js +2 -2
  29. package/jsx-dev-runtime/dist/valbuild-react-jsx-dev-runtime.worker.esm.js +2 -2
  30. package/jsx-runtime/dist/valbuild-react-jsx-runtime.browser.esm.js +2 -2
  31. package/jsx-runtime/dist/valbuild-react-jsx-runtime.cjs.d.ts +2 -2
  32. package/jsx-runtime/dist/valbuild-react-jsx-runtime.cjs.dev.js +2 -2
  33. package/jsx-runtime/dist/valbuild-react-jsx-runtime.cjs.prod.js +2 -2
  34. package/jsx-runtime/dist/valbuild-react-jsx-runtime.esm.js +2 -2
  35. package/jsx-runtime/dist/valbuild-react-jsx-runtime.worker.esm.js +2 -2
  36. package/package.json +4 -4
  37. package/stega/dist/valbuild-react-stega.browser.esm.js +44 -38
  38. package/stega/dist/valbuild-react-stega.cjs.d.ts +2 -2
  39. package/stega/dist/valbuild-react-stega.cjs.dev.js +45 -37
  40. package/stega/dist/valbuild-react-stega.cjs.prod.js +45 -37
  41. package/stega/dist/valbuild-react-stega.esm.js +44 -38
  42. package/stega/dist/valbuild-react-stega.worker.esm.js +44 -38
  43. package/dist/toConsumableArray-0a75a603.worker.esm.js +0 -19
  44. package/dist/toConsumableArray-0ccd58b7.esm.js +0 -19
  45. package/dist/toConsumableArray-5a71fbb3.browser.esm.js +0 -19
  46. package/dist/toConsumableArray-b2d28ffa.cjs.dev.js +0 -21
  47. package/dist/toConsumableArray-b5e3b83f.cjs.prod.js +0 -21
  48. package/dist/unsupportedIterableToArray-42309462.cjs.prod.js +0 -19
  49. package/dist/unsupportedIterableToArray-50359a05.worker.esm.js +0 -16
  50. package/dist/unsupportedIterableToArray-7c30dadf.esm.js +0 -16
  51. package/dist/unsupportedIterableToArray-ac28611a.cjs.dev.js +0 -19
  52. package/dist/unsupportedIterableToArray-cce3cb41.browser.esm.js +0 -16
  53. package/dist/valbuild-react.cjs.d.ts.map +0 -1
  54. package/internal/dist/valbuild-react-internal.cjs.d.ts.map +0 -1
  55. package/jsx-dev-runtime/dist/valbuild-react-jsx-dev-runtime.cjs.d.ts.map +0 -1
  56. package/jsx-runtime/dist/valbuild-react-jsx-runtime.cjs.d.ts.map +0 -1
  57. 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) {
@@ -213,6 +216,7 @@ function stegaEncode(input, opts) {
213
216
  if (sourceOrSelector && _typeof(sourceOrSelector) === "object" && recOpts.schema.key && typeof recOpts.schema.key === "string") {
214
217
  var _key = sourceOrSelector[recOpts.schema.key];
215
218
  if (_key) {
219
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
216
220
  var schema = recOpts.schema.items.find(function (s) {
217
221
  if (isObjectSchema(s) && s.items && s.items[recOpts.schema.key]) {
218
222
  var keySchema = s.items[recOpts.schema.key];
@@ -273,11 +277,6 @@ function stegaEncode(input, opts) {
273
277
  if (sourceOrSelector[VAL_EXTENSION] === "file" && typeof sourceOrSelector[FILE_REF_PROP] === "string") {
274
278
  var fileSelector = Internal.convertFileSource(sourceOrSelector);
275
279
  var url = fileSelector.url;
276
- if (opts.disabled) {
277
- url = fileSelector.url;
278
- } else {
279
- url = "/api/val/files/public" + fileSelector.url;
280
- }
281
280
  return _objectSpread2(_objectSpread2({}, fileSelector), {}, {
282
281
  url: rec(url, recOpts)
283
282
  });
@@ -413,6 +412,7 @@ function getModuleIds(input) {
413
412
  }
414
413
 
415
414
  // NOTE: the exports of this file needs to be kept in sync with ValQuickJSRuntime
415
+ var isRSC = false;
416
416
  var autoTagJSXEnabled = false;
417
417
  function IS_AUTO_TAG_JSX_ENABLED() {
418
418
  return autoTagJSXEnabled;
@@ -420,5 +420,11 @@ function IS_AUTO_TAG_JSX_ENABLED() {
420
420
  function SET_AUTO_TAG_JSX_ENABLED(enabled) {
421
421
  autoTagJSXEnabled = enabled;
422
422
  }
423
+ function IS_RSC() {
424
+ return isRSC;
425
+ }
426
+ function SET_RSC(enabled) {
427
+ isRSC = enabled;
428
+ }
423
429
 
424
- 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) {
@@ -223,6 +226,7 @@ function stegaEncode(input, opts) {
223
226
  if (sourceOrSelector && slicedToArray._typeof(sourceOrSelector) === "object" && recOpts.schema.key && typeof recOpts.schema.key === "string") {
224
227
  var _key = sourceOrSelector[recOpts.schema.key];
225
228
  if (_key) {
229
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
226
230
  var schema = recOpts.schema.items.find(function (s) {
227
231
  if (isObjectSchema(s) && s.items && s.items[recOpts.schema.key]) {
228
232
  var keySchema = s.items[recOpts.schema.key];
@@ -283,11 +287,6 @@ function stegaEncode(input, opts) {
283
287
  if (sourceOrSelector[core.VAL_EXTENSION] === "file" && typeof sourceOrSelector[core.FILE_REF_PROP] === "string") {
284
288
  var fileSelector = core.Internal.convertFileSource(sourceOrSelector);
285
289
  var url = fileSelector.url;
286
- if (opts.disabled) {
287
- url = fileSelector.url;
288
- } else {
289
- url = "/api/val/files/public" + fileSelector.url;
290
- }
291
290
  return _objectSpread2(_objectSpread2({}, fileSelector), {}, {
292
291
  url: rec(url, recOpts)
293
292
  });
@@ -423,6 +422,7 @@ function getModuleIds(input) {
423
422
  }
424
423
 
425
424
  // NOTE: the exports of this file needs to be kept in sync with ValQuickJSRuntime
425
+ var isRSC = false;
426
426
  var autoTagJSXEnabled = false;
427
427
  function IS_AUTO_TAG_JSX_ENABLED() {
428
428
  return autoTagJSXEnabled;
@@ -430,9 +430,17 @@ function IS_AUTO_TAG_JSX_ENABLED() {
430
430
  function SET_AUTO_TAG_JSX_ENABLED(enabled) {
431
431
  autoTagJSXEnabled = enabled;
432
432
  }
433
+ function IS_RSC() {
434
+ return isRSC;
435
+ }
436
+ function SET_RSC(enabled) {
437
+ isRSC = enabled;
438
+ }
433
439
 
434
440
  exports.IS_AUTO_TAG_JSX_ENABLED = IS_AUTO_TAG_JSX_ENABLED;
441
+ exports.IS_RSC = IS_RSC;
435
442
  exports.SET_AUTO_TAG_JSX_ENABLED = SET_AUTO_TAG_JSX_ENABLED;
443
+ exports.SET_RSC = SET_RSC;
436
444
  exports.autoTagJSX = autoTagJSX;
437
445
  exports.getModuleIds = getModuleIds;
438
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) {
@@ -223,6 +226,7 @@ function stegaEncode(input, opts) {
223
226
  if (sourceOrSelector && slicedToArray._typeof(sourceOrSelector) === "object" && recOpts.schema.key && typeof recOpts.schema.key === "string") {
224
227
  var _key = sourceOrSelector[recOpts.schema.key];
225
228
  if (_key) {
229
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
226
230
  var schema = recOpts.schema.items.find(function (s) {
227
231
  if (isObjectSchema(s) && s.items && s.items[recOpts.schema.key]) {
228
232
  var keySchema = s.items[recOpts.schema.key];
@@ -283,11 +287,6 @@ function stegaEncode(input, opts) {
283
287
  if (sourceOrSelector[core.VAL_EXTENSION] === "file" && typeof sourceOrSelector[core.FILE_REF_PROP] === "string") {
284
288
  var fileSelector = core.Internal.convertFileSource(sourceOrSelector);
285
289
  var url = fileSelector.url;
286
- if (opts.disabled) {
287
- url = fileSelector.url;
288
- } else {
289
- url = "/api/val/files/public" + fileSelector.url;
290
- }
291
290
  return _objectSpread2(_objectSpread2({}, fileSelector), {}, {
292
291
  url: rec(url, recOpts)
293
292
  });
@@ -423,6 +422,7 @@ function getModuleIds(input) {
423
422
  }
424
423
 
425
424
  // NOTE: the exports of this file needs to be kept in sync with ValQuickJSRuntime
425
+ var isRSC = false;
426
426
  var autoTagJSXEnabled = false;
427
427
  function IS_AUTO_TAG_JSX_ENABLED() {
428
428
  return autoTagJSXEnabled;
@@ -430,9 +430,17 @@ function IS_AUTO_TAG_JSX_ENABLED() {
430
430
  function SET_AUTO_TAG_JSX_ENABLED(enabled) {
431
431
  autoTagJSXEnabled = enabled;
432
432
  }
433
+ function IS_RSC() {
434
+ return isRSC;
435
+ }
436
+ function SET_RSC(enabled) {
437
+ isRSC = enabled;
438
+ }
433
439
 
434
440
  exports.IS_AUTO_TAG_JSX_ENABLED = IS_AUTO_TAG_JSX_ENABLED;
441
+ exports.IS_RSC = IS_RSC;
435
442
  exports.SET_AUTO_TAG_JSX_ENABLED = SET_AUTO_TAG_JSX_ENABLED;
443
+ exports.SET_RSC = SET_RSC;
436
444
  exports.autoTagJSX = autoTagJSX;
437
445
  exports.getModuleIds = getModuleIds;
438
446
  exports.stegaClean = stegaClean;
@@ -1,11 +1,11 @@
1
- import { a as _typeof, _ as _slicedToArray } from '../../dist/slicedToArray-a79154e9.esm.js';
1
+ import { a as _typeof, _ as _slicedToArray } from '../../dist/slicedToArray-5391d3c0.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-0ccd58b7.esm.js';
6
+ import { _ as _toConsumableArray } from '../../dist/toConsumableArray-9f3cfc47.esm.js';
7
7
  import { Internal, VAL_EXTENSION, FILE_REF_PROP } from '@valbuild/core';
8
- import '../../dist/unsupportedIterableToArray-7c30dadf.esm.js';
8
+ import '../../dist/unsupportedIterableToArray-f57eb659.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) {
@@ -213,6 +216,7 @@ function stegaEncode(input, opts) {
213
216
  if (sourceOrSelector && _typeof(sourceOrSelector) === "object" && recOpts.schema.key && typeof recOpts.schema.key === "string") {
214
217
  var _key = sourceOrSelector[recOpts.schema.key];
215
218
  if (_key) {
219
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
216
220
  var schema = recOpts.schema.items.find(function (s) {
217
221
  if (isObjectSchema(s) && s.items && s.items[recOpts.schema.key]) {
218
222
  var keySchema = s.items[recOpts.schema.key];
@@ -273,11 +277,6 @@ function stegaEncode(input, opts) {
273
277
  if (sourceOrSelector[VAL_EXTENSION] === "file" && typeof sourceOrSelector[FILE_REF_PROP] === "string") {
274
278
  var fileSelector = Internal.convertFileSource(sourceOrSelector);
275
279
  var url = fileSelector.url;
276
- if (opts.disabled) {
277
- url = fileSelector.url;
278
- } else {
279
- url = "/api/val/files/public" + fileSelector.url;
280
- }
281
280
  return _objectSpread2(_objectSpread2({}, fileSelector), {}, {
282
281
  url: rec(url, recOpts)
283
282
  });
@@ -413,6 +412,7 @@ function getModuleIds(input) {
413
412
  }
414
413
 
415
414
  // NOTE: the exports of this file needs to be kept in sync with ValQuickJSRuntime
415
+ var isRSC = false;
416
416
  var autoTagJSXEnabled = false;
417
417
  function IS_AUTO_TAG_JSX_ENABLED() {
418
418
  return autoTagJSXEnabled;
@@ -420,5 +420,11 @@ function IS_AUTO_TAG_JSX_ENABLED() {
420
420
  function SET_AUTO_TAG_JSX_ENABLED(enabled) {
421
421
  autoTagJSXEnabled = enabled;
422
422
  }
423
+ function IS_RSC() {
424
+ return isRSC;
425
+ }
426
+ function SET_RSC(enabled) {
427
+ isRSC = enabled;
428
+ }
423
429
 
424
- 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 };