@valbuild/core 0.91.4 → 0.92.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.
@@ -335,6 +335,7 @@ var FILE_REF_SUBTYPE_TAG = "_tag"; // TODO: used earlier by c.rt.image, when we
335
335
 
336
336
  var initFile = function initFile(config) {
337
337
  var _config$files$directo, _config$files;
338
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
338
339
  (_config$files$directo = config === null || config === void 0 || (_config$files = config.files) === null || _config$files === void 0 ? void 0 : _config$files.directory) !== null && _config$files$directo !== void 0 ? _config$files$directo : "/public/val";
339
340
  function file(ref, metadata) {
340
341
  return _defineProperty(_defineProperty(_defineProperty({}, FILE_REF_PROP, ref), VAL_EXTENSION, "file"), "metadata", metadata);
@@ -1929,6 +1930,151 @@ var image = function image(options) {
1929
1930
  return new ImageSchema(options);
1930
1931
  };
1931
1932
 
1933
+ var RouteSchema = /*#__PURE__*/function (_Schema) {
1934
+ function RouteSchema(options) {
1935
+ var _this;
1936
+ var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1937
+ var customValidateFunctions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
1938
+ _classCallCheck(this, RouteSchema);
1939
+ _this = _callSuper(this, RouteSchema);
1940
+ _this.options = options;
1941
+ _this.opt = opt;
1942
+ _this.customValidateFunctions = customValidateFunctions;
1943
+ return _this;
1944
+ }
1945
+
1946
+ /**
1947
+ * Specify a pattern for which routes are allowed.
1948
+ *
1949
+ * Semantics:
1950
+ * - If only include is set: route must match include pattern
1951
+ * - If only exclude is set: route must NOT match exclude pattern
1952
+ * - If both are set: route must match include AND must NOT match exclude
1953
+ *
1954
+ * @example
1955
+ * s.route().include(/^\/(home|about|contact)$/) // Only these specific routes
1956
+ * s.route().include(/^\/api\//).exclude(/^\/api\/internal\//) // API routes except internal
1957
+ */
1958
+ _inherits(RouteSchema, _Schema);
1959
+ return _createClass(RouteSchema, [{
1960
+ key: "include",
1961
+ value: function include(pattern) {
1962
+ return new RouteSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
1963
+ include: pattern
1964
+ }), this.opt, this.customValidateFunctions);
1965
+ }
1966
+
1967
+ /**
1968
+ * Specify a pattern for which routes should be excluded.
1969
+ *
1970
+ * Semantics:
1971
+ * - If only include is set: route must match include pattern
1972
+ * - If only exclude is set: route must NOT match exclude pattern
1973
+ * - If both are set: route must match include AND must NOT match exclude
1974
+ *
1975
+ * @example
1976
+ * s.route().exclude(/^\/admin/) // Exclude all admin routes
1977
+ * s.route().include(/^\/api\//).exclude(/^\/api\/internal\//) // API routes except internal
1978
+ */
1979
+ }, {
1980
+ key: "exclude",
1981
+ value: function exclude(pattern) {
1982
+ return new RouteSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
1983
+ exclude: pattern
1984
+ }), this.opt, this.customValidateFunctions);
1985
+ }
1986
+ }, {
1987
+ key: "validate",
1988
+ value: function validate(validationFunction) {
1989
+ return new RouteSchema(this.options, this.opt, this.customValidateFunctions.concat(validationFunction));
1990
+ }
1991
+ }, {
1992
+ key: "executeValidate",
1993
+ value: function executeValidate(path, src) {
1994
+ var _this$options, _this$options2;
1995
+ var customValidationErrors = this.executeCustomValidateFunctions(src, this.customValidateFunctions, {
1996
+ path: path
1997
+ });
1998
+ if (this.opt && (src === null || src === undefined)) {
1999
+ return customValidationErrors.length > 0 ? _defineProperty({}, path, customValidationErrors) : false;
2000
+ }
2001
+ if (typeof src !== "string") {
2002
+ return _defineProperty({}, path, [{
2003
+ message: "Expected 'string', got '".concat(_typeof(src), "'"),
2004
+ value: src
2005
+ }]);
2006
+ }
2007
+ return _defineProperty({}, path, [].concat(_toConsumableArray(customValidationErrors), [{
2008
+ fixes: ["router:check-route"],
2009
+ message: "Did not validate route (router). This error (router:check-route) should typically be processed by Val internally. Seeing this error most likely means you have a Val version mismatch.",
2010
+ value: {
2011
+ route: src,
2012
+ sourcePath: path,
2013
+ include: (_this$options = this.options) === null || _this$options === void 0 ? void 0 : _this$options.include,
2014
+ exclude: (_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.exclude
2015
+ }
2016
+ }]));
2017
+ }
2018
+ }, {
2019
+ key: "executeAssert",
2020
+ value: function executeAssert(path, src) {
2021
+ if (this.opt && src === null) {
2022
+ return {
2023
+ success: true,
2024
+ data: src
2025
+ };
2026
+ }
2027
+ if (typeof src === "string") {
2028
+ return {
2029
+ success: true,
2030
+ data: src
2031
+ };
2032
+ }
2033
+ return {
2034
+ success: false,
2035
+ errors: _defineProperty({}, path, [{
2036
+ message: "Expected 'string', got '".concat(_typeof(src), "'"),
2037
+ typeError: true
2038
+ }])
2039
+ };
2040
+ }
2041
+ }, {
2042
+ key: "nullable",
2043
+ value: function nullable() {
2044
+ return new RouteSchema(this.options, true, this.customValidateFunctions);
2045
+ }
2046
+ }, {
2047
+ key: "executeSerialize",
2048
+ value: function executeSerialize() {
2049
+ var _this$options3, _this$options4, _this$customValidateF, _this$customValidateF2;
2050
+ return {
2051
+ type: "route",
2052
+ options: {
2053
+ include: ((_this$options3 = this.options) === null || _this$options3 === void 0 ? void 0 : _this$options3.include) && {
2054
+ source: this.options.include.source,
2055
+ flags: this.options.include.flags
2056
+ },
2057
+ exclude: ((_this$options4 = this.options) === null || _this$options4 === void 0 ? void 0 : _this$options4.exclude) && {
2058
+ source: this.options.exclude.source,
2059
+ flags: this.options.exclude.flags
2060
+ },
2061
+ customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0
2062
+ },
2063
+ opt: this.opt,
2064
+ customValidate: this.customValidateFunctions && ((_this$customValidateF2 = this.customValidateFunctions) === null || _this$customValidateF2 === void 0 ? void 0 : _this$customValidateF2.length) > 0
2065
+ };
2066
+ }
2067
+ }, {
2068
+ key: "executeRender",
2069
+ value: function executeRender() {
2070
+ return {};
2071
+ }
2072
+ }]);
2073
+ }(Schema);
2074
+ var route = function route(options) {
2075
+ return new RouteSchema(options);
2076
+ };
2077
+
1932
2078
  var RichTextSchema = /*#__PURE__*/function (_Schema) {
1933
2079
  function RichTextSchema(options) {
1934
2080
  var _this;
@@ -2012,156 +2158,221 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
2012
2158
  var _iterator = _createForOfIteratorHelper(nodes),
2013
2159
  _step;
2014
2160
  try {
2015
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
2016
- var _this2$options$block, _this2$options$block2, _this2$options$block3, _this2$options$block4, _this2$options$block5, _this2$options$block6, _this2$options$block7, _this2$options$block8, _this2$options$block9, _this2$options$block0, _this2$options$inline;
2017
- var node = _step.value;
2018
- var path = unsafeCreateSourcePath(rootPath, nodes.indexOf(node));
2019
- if (typeof node === "string") {
2020
- length += node.length;
2021
- continue;
2022
- }
2023
- if (_typeof(node) !== "object") {
2024
- return _defineProperty({}, path, [{
2025
- message: "Expected nodes of type 'object' or 'string', got '".concat(_typeof(node), "'"),
2026
- typeError: true
2027
- }]);
2028
- }
2029
- if (node === null) {
2030
- return _defineProperty({}, path, [{
2031
- message: "Expected nodes of type 'object' or 'string', got 'null'",
2032
- typeError: true
2033
- }]);
2034
- }
2035
- if (!("tag" in node)) {
2036
- return _defineProperty({}, path, [{
2037
- message: "Expected node to either have 'tag' or be of type 'string'",
2038
- typeError: true
2039
- }]);
2040
- }
2041
- if (typeof node.tag !== "string") {
2042
- return _defineProperty({}, path, [{
2043
- message: "Expected 'string', got '".concat(_typeof(node.tag), "'"),
2044
- typeError: true
2045
- }]);
2046
- }
2047
- if (node.tag === "h1" && !((_this2$options$block = _this2.options.block) !== null && _this2$options$block !== void 0 && _this2$options$block.h1)) {
2048
- addError(path, "'h' block is not valid", false);
2049
- }
2050
- if (node.tag === "h2" && !((_this2$options$block2 = _this2.options.block) !== null && _this2$options$block2 !== void 0 && _this2$options$block2.h2)) {
2051
- addError(path, "'h2' block is not valid", false);
2052
- }
2053
- if (node.tag === "h3" && !((_this2$options$block3 = _this2.options.block) !== null && _this2$options$block3 !== void 0 && _this2$options$block3.h3)) {
2054
- addError(path, "'h3' block is not valid", false);
2055
- }
2056
- if (node.tag === "h4" && !((_this2$options$block4 = _this2.options.block) !== null && _this2$options$block4 !== void 0 && _this2$options$block4.h4)) {
2057
- addError(path, "'h4' block is not valid", false);
2058
- }
2059
- if (node.tag === "h5" && !((_this2$options$block5 = _this2.options.block) !== null && _this2$options$block5 !== void 0 && _this2$options$block5.h5)) {
2060
- addError(path, "'h5' block is not valid", false);
2061
- }
2062
- if (node.tag === "h6" && !((_this2$options$block6 = _this2.options.block) !== null && _this2$options$block6 !== void 0 && _this2$options$block6.h6)) {
2063
- addError(path, "'h6' block is not valid", false);
2064
- }
2065
- if (node.tag === "ol" && !((_this2$options$block7 = _this2.options.block) !== null && _this2$options$block7 !== void 0 && _this2$options$block7.ol)) {
2066
- addError(path, "'ol' block is not valid", false);
2067
- }
2068
- if (node.tag === "ul" && !((_this2$options$block8 = _this2.options.block) !== null && _this2$options$block8 !== void 0 && _this2$options$block8.ul)) {
2069
- addError(path, "'ul' block is not valid", false);
2070
- }
2071
- if (node.tag === "li" && !((_this2$options$block9 = _this2.options.block) !== null && _this2$options$block9 !== void 0 && _this2$options$block9.ul) && !((_this2$options$block0 = _this2.options.block) !== null && _this2$options$block0 !== void 0 && _this2$options$block0.ol)) {
2072
- addError(path, "'li' tag is invalid since neither 'ul' nor 'ol' block is not valid", false);
2073
- }
2074
- if (node.tag === "a" && !((_this2$options$inline = _this2.options.inline) !== null && _this2$options$inline !== void 0 && _this2$options$inline.a)) {
2075
- addError(path, "'a' inline is not valid", false);
2076
- }
2077
- if (node.tag === "img") {
2078
- var _this2$options$inline2, _this2$options$inline3;
2079
- if (!((_this2$options$inline2 = _this2.options.inline) !== null && _this2$options$inline2 !== void 0 && _this2$options$inline2.img)) {
2080
- addError(path, "'img' inline is not valid", false);
2081
- } else if ((_this2$options$inline3 = _this2.options.inline) !== null && _this2$options$inline3 !== void 0 && _this2$options$inline3.img) {
2082
- var _this2$options$inline4, _this2$options$inline5;
2083
- if (!("src" in node)) {
2084
- return _defineProperty({}, path, [{
2085
- message: "Expected 'src' in 'img'",
2161
+ var _loop = function _loop() {
2162
+ var _this2$options$block, _this2$options$block2, _this2$options$block3, _this2$options$block4, _this2$options$block5, _this2$options$block6, _this2$options$block7, _this2$options$block8, _this2$options$block9, _this2$options$block0;
2163
+ var node = _step.value;
2164
+ var path = unsafeCreateSourcePath(rootPath, nodes.indexOf(node));
2165
+ if (typeof node === "string") {
2166
+ length += node.length;
2167
+ return 0; // continue
2168
+ }
2169
+ if (_typeof(node) !== "object") {
2170
+ return {
2171
+ v: _defineProperty({}, path, [{
2172
+ message: "Expected nodes of type 'object' or 'string', got '".concat(_typeof(node), "'"),
2086
2173
  typeError: true
2087
- }]);
2088
- }
2089
- var srcPath = unsafeCreateSourcePath(path, "src");
2090
- var imageValidationErrors = _typeof((_this2$options$inline4 = _this2.options.inline) === null || _this2$options$inline4 === void 0 ? void 0 : _this2$options$inline4.img) === "object" ? (_this2$options$inline5 = _this2.options.inline) === null || _this2$options$inline5 === void 0 ? void 0 : _this2$options$inline5.img["executeValidate"](srcPath, node.src) : new ImageSchema({}, false, false)["executeValidate"](srcPath, node.src);
2091
- if (imageValidationErrors) {
2092
- for (var validationErrorPathS in imageValidationErrors) {
2093
- var _current$validationEr;
2094
- var validationErrorPath = validationErrorPathS;
2095
- if (!current[validationErrorPath]) {
2096
- current[validationErrorPath] = [];
2174
+ }])
2175
+ };
2176
+ }
2177
+ if (node === null) {
2178
+ return {
2179
+ v: _defineProperty({}, path, [{
2180
+ message: "Expected nodes of type 'object' or 'string', got 'null'",
2181
+ typeError: true
2182
+ }])
2183
+ };
2184
+ }
2185
+ if (!("tag" in node)) {
2186
+ return {
2187
+ v: _defineProperty({}, path, [{
2188
+ message: "Expected node to either have 'tag' or be of type 'string'",
2189
+ typeError: true
2190
+ }])
2191
+ };
2192
+ }
2193
+ if (typeof node.tag !== "string") {
2194
+ return {
2195
+ v: _defineProperty({}, path, [{
2196
+ message: "Expected 'string', got '".concat(_typeof(node.tag), "'"),
2197
+ typeError: true
2198
+ }])
2199
+ };
2200
+ }
2201
+ if (node.tag === "h1" && !((_this2$options$block = _this2.options.block) !== null && _this2$options$block !== void 0 && _this2$options$block.h1)) {
2202
+ addError(path, "'h' block is not valid", false);
2203
+ }
2204
+ if (node.tag === "h2" && !((_this2$options$block2 = _this2.options.block) !== null && _this2$options$block2 !== void 0 && _this2$options$block2.h2)) {
2205
+ addError(path, "'h2' block is not valid", false);
2206
+ }
2207
+ if (node.tag === "h3" && !((_this2$options$block3 = _this2.options.block) !== null && _this2$options$block3 !== void 0 && _this2$options$block3.h3)) {
2208
+ addError(path, "'h3' block is not valid", false);
2209
+ }
2210
+ if (node.tag === "h4" && !((_this2$options$block4 = _this2.options.block) !== null && _this2$options$block4 !== void 0 && _this2$options$block4.h4)) {
2211
+ addError(path, "'h4' block is not valid", false);
2212
+ }
2213
+ if (node.tag === "h5" && !((_this2$options$block5 = _this2.options.block) !== null && _this2$options$block5 !== void 0 && _this2$options$block5.h5)) {
2214
+ addError(path, "'h5' block is not valid", false);
2215
+ }
2216
+ if (node.tag === "h6" && !((_this2$options$block6 = _this2.options.block) !== null && _this2$options$block6 !== void 0 && _this2$options$block6.h6)) {
2217
+ addError(path, "'h6' block is not valid", false);
2218
+ }
2219
+ if (node.tag === "ol" && !((_this2$options$block7 = _this2.options.block) !== null && _this2$options$block7 !== void 0 && _this2$options$block7.ol)) {
2220
+ addError(path, "'ol' block is not valid", false);
2221
+ }
2222
+ if (node.tag === "ul" && !((_this2$options$block8 = _this2.options.block) !== null && _this2$options$block8 !== void 0 && _this2$options$block8.ul)) {
2223
+ addError(path, "'ul' block is not valid", false);
2224
+ }
2225
+ if (node.tag === "li" && !((_this2$options$block9 = _this2.options.block) !== null && _this2$options$block9 !== void 0 && _this2$options$block9.ul) && !((_this2$options$block0 = _this2.options.block) !== null && _this2$options$block0 !== void 0 && _this2$options$block0.ol)) {
2226
+ addError(path, "'li' tag is invalid since neither 'ul' nor 'ol' block is not valid", false);
2227
+ }
2228
+ if (node.tag === "a") {
2229
+ var _this2$options$inline, _this2$options$inline2;
2230
+ if (!((_this2$options$inline = _this2.options.inline) !== null && _this2$options$inline !== void 0 && _this2$options$inline.a)) {
2231
+ addError(path, "'a' inline is not valid", false);
2232
+ } else if ((_this2$options$inline2 = _this2.options.inline) !== null && _this2$options$inline2 !== void 0 && _this2$options$inline2.a) {
2233
+ var _this2$options$inline3;
2234
+ if (!("href" in node)) {
2235
+ return {
2236
+ v: _defineProperty({}, path, [{
2237
+ message: "Expected 'href' in 'a'",
2238
+ typeError: true
2239
+ }])
2240
+ };
2241
+ }
2242
+ var hrefPath = unsafeCreateSourcePath(path, "href");
2243
+ var hrefSchema = typeof ((_this2$options$inline3 = _this2.options.inline) === null || _this2$options$inline3 === void 0 ? void 0 : _this2$options$inline3.a) === "boolean" ? new RouteSchema() : _this2.options.inline.a;
2244
+ var executeValidate = function executeValidate() {
2245
+ if (hrefSchema instanceof RouteSchema) {
2246
+ return hrefSchema["executeValidate"](hrefPath, node.href);
2247
+ } else if (hrefSchema instanceof StringSchema) {
2248
+ return hrefSchema["executeValidate"](hrefPath, node.href);
2249
+ } else {
2250
+ var exhaustiveCheck = hrefSchema;
2251
+ console.error("Exhaustive check failed in RichText (anchor href validation)", exhaustiveCheck);
2252
+ return false;
2253
+ }
2254
+ };
2255
+ var hrefValidationErrors = executeValidate();
2256
+ if (hrefValidationErrors) {
2257
+ for (var validationErrorPathS in hrefValidationErrors) {
2258
+ var _current$validationEr;
2259
+ var validationErrorPath = validationErrorPathS;
2260
+ if (!current[validationErrorPath]) {
2261
+ current[validationErrorPath] = [];
2262
+ }
2263
+ (_current$validationEr = current[validationErrorPath]).push.apply(_current$validationEr, _toConsumableArray(hrefValidationErrors[validationErrorPath]));
2097
2264
  }
2098
- (_current$validationEr = current[validationErrorPath]).push.apply(_current$validationEr, _toConsumableArray(imageValidationErrors[validationErrorPath]));
2099
2265
  }
2100
2266
  }
2101
2267
  }
2102
- }
2103
- if ("styles" in node && node.tag !== "span") {
2104
- return _defineProperty({}, path, [{
2105
- message: "Cannot have styles on '".concat(node.tag, "'. This is only allowed on 'span'"),
2106
- typeError: true
2107
- }]);
2108
- }
2109
- if ("styles" in node) {
2110
- if (!Array.isArray(node.styles)) {
2111
- return _defineProperty({}, path, [{
2112
- message: "Expected 'array', got '".concat(_typeof(node.styles), "'"),
2113
- typeError: true
2114
- }]);
2268
+ if (node.tag === "img") {
2269
+ var _this2$options$inline4, _this2$options$inline5;
2270
+ if (!((_this2$options$inline4 = _this2.options.inline) !== null && _this2$options$inline4 !== void 0 && _this2$options$inline4.img)) {
2271
+ addError(path, "'img' inline is not valid", false);
2272
+ } else if ((_this2$options$inline5 = _this2.options.inline) !== null && _this2$options$inline5 !== void 0 && _this2$options$inline5.img) {
2273
+ var _this2$options$inline6, _this2$options$inline7;
2274
+ if (!("src" in node)) {
2275
+ return {
2276
+ v: _defineProperty({}, path, [{
2277
+ message: "Expected 'src' in 'img'",
2278
+ typeError: true
2279
+ }])
2280
+ };
2281
+ }
2282
+ var srcPath = unsafeCreateSourcePath(path, "src");
2283
+ var imageValidationErrors = _typeof((_this2$options$inline6 = _this2.options.inline) === null || _this2$options$inline6 === void 0 ? void 0 : _this2$options$inline6.img) === "object" ? (_this2$options$inline7 = _this2.options.inline) === null || _this2$options$inline7 === void 0 ? void 0 : _this2$options$inline7.img["executeValidate"](srcPath, node.src) : new ImageSchema({}, false, false)["executeValidate"](srcPath, node.src);
2284
+ if (imageValidationErrors) {
2285
+ for (var _validationErrorPathS in imageValidationErrors) {
2286
+ var _current$_validationE;
2287
+ var _validationErrorPath = _validationErrorPathS;
2288
+ if (!current[_validationErrorPath]) {
2289
+ current[_validationErrorPath] = [];
2290
+ }
2291
+ (_current$_validationE = current[_validationErrorPath]).push.apply(_current$_validationE, _toConsumableArray(imageValidationErrors[_validationErrorPath]));
2292
+ }
2293
+ }
2294
+ }
2115
2295
  }
2116
- var stylesPath = unsafeCreateSourcePath(path, "styles");
2117
- for (var i = 0; i < node.styles.length; i++) {
2118
- var _this2$options$style, _this2$options$style2, _this2$options$style3;
2119
- var style = node.styles[i];
2120
- var currentStylePath = unsafeCreateSourcePath(stylesPath, i);
2121
- if (typeof style !== "string") {
2122
- return _defineProperty({}, currentStylePath, [{
2123
- message: "Expected 'string', got '".concat(_typeof(style), "'"),
2296
+ if ("styles" in node && node.tag !== "span") {
2297
+ return {
2298
+ v: _defineProperty({}, path, [{
2299
+ message: "Cannot have styles on '".concat(node.tag, "'. This is only allowed on 'span'"),
2124
2300
  typeError: true
2125
- }]);
2126
- }
2127
- if (style === "bold" && !((_this2$options$style = _this2.options.style) !== null && _this2$options$style !== void 0 && _this2$options$style.bold)) {
2128
- addError(currentStylePath, "Style 'bold' is not valid", false);
2129
- }
2130
- if (style === "italic" && !((_this2$options$style2 = _this2.options.style) !== null && _this2$options$style2 !== void 0 && _this2$options$style2.italic)) {
2131
- addError(currentStylePath, "Style 'italic' is not valid", false);
2301
+ }])
2302
+ };
2303
+ }
2304
+ if ("styles" in node) {
2305
+ if (!Array.isArray(node.styles)) {
2306
+ return {
2307
+ v: _defineProperty({}, path, [{
2308
+ message: "Expected 'array', got '".concat(_typeof(node.styles), "'"),
2309
+ typeError: true
2310
+ }])
2311
+ };
2132
2312
  }
2133
- if (style === "lineThrough" && !((_this2$options$style3 = _this2.options.style) !== null && _this2$options$style3 !== void 0 && _this2$options$style3.lineThrough)) {
2134
- addError(currentStylePath, "Style 'lineThrough' is not valid", false);
2313
+ var stylesPath = unsafeCreateSourcePath(path, "styles");
2314
+ for (var i = 0; i < node.styles.length; i++) {
2315
+ var _this2$options$style, _this2$options$style2, _this2$options$style3;
2316
+ var style = node.styles[i];
2317
+ var currentStylePath = unsafeCreateSourcePath(stylesPath, i);
2318
+ if (typeof style !== "string") {
2319
+ return {
2320
+ v: _defineProperty({}, currentStylePath, [{
2321
+ message: "Expected 'string', got '".concat(_typeof(style), "'"),
2322
+ typeError: true
2323
+ }])
2324
+ };
2325
+ }
2326
+ if (style === "bold" && !((_this2$options$style = _this2.options.style) !== null && _this2$options$style !== void 0 && _this2$options$style.bold)) {
2327
+ addError(currentStylePath, "Style 'bold' is not valid", false);
2328
+ }
2329
+ if (style === "italic" && !((_this2$options$style2 = _this2.options.style) !== null && _this2$options$style2 !== void 0 && _this2$options$style2.italic)) {
2330
+ addError(currentStylePath, "Style 'italic' is not valid", false);
2331
+ }
2332
+ if (style === "lineThrough" && !((_this2$options$style3 = _this2.options.style) !== null && _this2$options$style3 !== void 0 && _this2$options$style3.lineThrough)) {
2333
+ addError(currentStylePath, "Style 'lineThrough' is not valid", false);
2334
+ }
2135
2335
  }
2136
2336
  }
2137
- }
2138
- if ("children" in node) {
2139
- if (!Array.isArray(node.children)) {
2140
- return _defineProperty({}, path, [{
2141
- message: "Expected 'array', got '".concat(_typeof(node.children), "'"),
2142
- typeError: true
2143
- }]);
2144
- }
2145
- var children = node.children;
2146
- for (var _i = 0; _i < children.length; _i++) {
2147
- var child = children[_i];
2148
- if (_typeof(child) === "object") {
2149
- var childPath = unsafeCreateSourcePath(path, "children");
2150
- var res = _recurse(childPath, [child], current);
2151
- if (res) {
2152
- return res;
2337
+ if ("children" in node) {
2338
+ if (!Array.isArray(node.children)) {
2339
+ return {
2340
+ v: _defineProperty({}, path, [{
2341
+ message: "Expected 'array', got '".concat(_typeof(node.children), "'"),
2342
+ typeError: true
2343
+ }])
2344
+ };
2345
+ }
2346
+ var children = node.children;
2347
+ for (var _i = 0; _i < children.length; _i++) {
2348
+ var child = children[_i];
2349
+ if (_typeof(child) === "object") {
2350
+ var childPath = unsafeCreateSourcePath(path, "children");
2351
+ var res = _recurse(childPath, [child], current);
2352
+ if (res) {
2353
+ return {
2354
+ v: res
2355
+ };
2356
+ }
2357
+ } else if (typeof child === "string") {
2358
+ length += child.length;
2359
+ continue;
2360
+ } else {
2361
+ return {
2362
+ v: _defineProperty({}, path, [{
2363
+ message: "Expected 'object' or 'string', got '".concat(_typeof(child), "'"),
2364
+ typeError: true
2365
+ }])
2366
+ };
2153
2367
  }
2154
- } else if (typeof child === "string") {
2155
- length += child.length;
2156
- continue;
2157
- } else {
2158
- return _defineProperty({}, path, [{
2159
- message: "Expected 'object' or 'string', got '".concat(_typeof(child), "'"),
2160
- typeError: true
2161
- }]);
2162
2368
  }
2163
2369
  }
2164
- }
2370
+ },
2371
+ _ret;
2372
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
2373
+ _ret = _loop();
2374
+ if (_ret === 0) continue;
2375
+ if (_ret) return _ret.v;
2165
2376
  }
2166
2377
  } catch (err) {
2167
2378
  _iterator.e(err);
@@ -2360,14 +2571,28 @@ var RichTextSchema = /*#__PURE__*/function (_Schema) {
2360
2571
  }, {
2361
2572
  key: "executeSerialize",
2362
2573
  value: function executeSerialize() {
2363
- var _this$customValidateF;
2574
+ var _this3 = this,
2575
+ _this$customValidateF;
2576
+ var serializeAnchorSchema = function serializeAnchorSchema() {
2577
+ var _this3$options$inline, _this3$options$inline3;
2578
+ if (((_this3$options$inline = _this3.options.inline) === null || _this3$options$inline === void 0 ? void 0 : _this3$options$inline.a) instanceof RouteSchema) {
2579
+ var _this3$options$inline2;
2580
+ return (_this3$options$inline2 = _this3.options.inline) === null || _this3$options$inline2 === void 0 ? void 0 : _this3$options$inline2.a["executeSerialize"]();
2581
+ } else if (((_this3$options$inline3 = _this3.options.inline) === null || _this3$options$inline3 === void 0 ? void 0 : _this3$options$inline3.a) instanceof StringSchema) {
2582
+ var _this3$options$inline4;
2583
+ return (_this3$options$inline4 = _this3.options.inline) === null || _this3$options$inline4 === void 0 ? void 0 : _this3$options$inline4.a["executeSerialize"]();
2584
+ } else {
2585
+ var _this3$options$inline5;
2586
+ return (_this3$options$inline5 = _this3.options.inline) === null || _this3$options$inline5 === void 0 ? void 0 : _this3$options$inline5.a;
2587
+ }
2588
+ };
2364
2589
  var serializedOptions = {
2365
2590
  maxLength: this.options.maxLength,
2366
2591
  minLength: this.options.minLength,
2367
2592
  style: this.options.style,
2368
2593
  block: this.options.block,
2369
2594
  inline: this.options.inline && {
2370
- a: this.options.inline.a,
2595
+ a: serializeAnchorSchema(),
2371
2596
  img: this.options.inline.img && _typeof(this.options.inline.img) === "object" ? this.options.inline.img["executeSerialize"]() : this.options.inline.img
2372
2597
  }
2373
2598
  };
@@ -2686,14 +2911,10 @@ function record(keyOrSchema, schema) {
2686
2911
  }
2687
2912
  }
2688
2913
 
2689
- function define(
2690
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2691
- id,
2914
+ function define(id,
2692
2915
  // TODO: `/${string}`
2693
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2694
- schema,
2695
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2696
- source) {
2916
+
2917
+ schema, source) {
2697
2918
  return _defineProperty(_defineProperty(_defineProperty({}, GetSource, source), GetSchema, schema), Path, id);
2698
2919
  }
2699
2920
  function getSource(valModule) {
@@ -2738,8 +2959,6 @@ function isUnionSchema(schema
2738
2959
  ) {
2739
2960
  return schema instanceof UnionSchema || _typeof(schema) === "object" && "type" in schema && schema.type === "union";
2740
2961
  }
2741
-
2742
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
2743
2962
  function isRichTextSchema(schema) {
2744
2963
  return schema instanceof RichTextSchema || _typeof(schema) === "object" && "type" in schema && schema.type === "richtext";
2745
2964
  }
@@ -2866,6 +3085,10 @@ function resolvePath(path, valModule, schema) {
2866
3085
  var _resolvedSchema$optio, _resolvedSchema$optio2;
2867
3086
  resolvedSchema = resolvedSchema instanceof RichTextSchema ? (_resolvedSchema$optio = resolvedSchema["options"]) !== null && _resolvedSchema$optio !== void 0 && (_resolvedSchema$optio = _resolvedSchema$optio.inline) !== null && _resolvedSchema$optio !== void 0 && _resolvedSchema$optio.img && typeof ((_resolvedSchema$optio2 = resolvedSchema["options"]) === null || _resolvedSchema$optio2 === void 0 || (_resolvedSchema$optio2 = _resolvedSchema$optio2.inline) === null || _resolvedSchema$optio2 === void 0 ? void 0 : _resolvedSchema$optio2.img) !== "boolean" ? resolvedSchema["options"].inline.img : resolvedSchema : resolvedSchema;
2868
3087
  }
3088
+ if ("href" in resolvedSource && "tag" in resolvedSource && resolvedSource.tag === "a" && parts.length === 0) {
3089
+ var _resolvedSchema$optio3, _resolvedSchema$optio4;
3090
+ resolvedSchema = resolvedSchema instanceof RichTextSchema ? (_resolvedSchema$optio3 = resolvedSchema["options"]) !== null && _resolvedSchema$optio3 !== void 0 && (_resolvedSchema$optio3 = _resolvedSchema$optio3.inline) !== null && _resolvedSchema$optio3 !== void 0 && _resolvedSchema$optio3.a && typeof ((_resolvedSchema$optio4 = resolvedSchema["options"]) === null || _resolvedSchema$optio4 === void 0 || (_resolvedSchema$optio4 = _resolvedSchema$optio4.inline) === null || _resolvedSchema$optio4 === void 0 ? void 0 : _resolvedSchema$optio4.a) !== "boolean" ? resolvedSchema["options"].inline.a : resolvedSchema : resolvedSchema;
3091
+ }
2869
3092
  resolvedSource = resolvedSource[part];
2870
3093
  } else {
2871
3094
  throw Error("Invalid path: ".concat(part, " resolved to an unexpected schema ").concat(JSON.stringify(resolvedSchema)));
@@ -2938,6 +3161,16 @@ function safeResolvePath(path, valModule, schema) {
2938
3161
  }
2939
3162
  };
2940
3163
  }
3164
+ if (resolvedSource[part] === undefined) {
3165
+ return {
3166
+ v: {
3167
+ status: "source-undefined",
3168
+ path: origParts.slice(0, origParts.length - parts.length - 1).map(function (p) {
3169
+ return JSON.stringify(p);
3170
+ }).join(".") // TODO: create a function generate path from parts (not sure if this always works)
3171
+ }
3172
+ };
3173
+ }
2941
3174
  resolvedSource = resolvedSource[part];
2942
3175
  resolvedSchema = resolvedSchema instanceof ArraySchema ? (_resolvedSchema3 = resolvedSchema) === null || _resolvedSchema3 === void 0 ? void 0 : _resolvedSchema3["item"] : resolvedSchema.item;
2943
3176
  } else if (isRecordSchema(resolvedSchema)) {
@@ -2968,11 +3201,13 @@ function safeResolvePath(path, valModule, schema) {
2968
3201
  }
2969
3202
  };
2970
3203
  }
2971
- if (!resolvedSource[part]) {
3204
+ if (resolvedSource[part] === undefined) {
2972
3205
  return {
2973
3206
  v: {
2974
- status: "error",
2975
- message: "Invalid path: record source did not have key ".concat(part, " from path: ").concat(path)
3207
+ status: "source-undefined",
3208
+ path: origParts.slice(0, origParts.length - parts.length - 1).map(function (p) {
3209
+ return JSON.stringify(p);
3210
+ }).join(".") // TODO: create a function generate path from parts (not sure if this always works)
2976
3211
  }
2977
3212
  };
2978
3213
  }
@@ -3083,8 +3318,12 @@ function safeResolvePath(path, valModule, schema) {
3083
3318
  resolvedSource = resolvedSource[part];
3084
3319
  } else if (isRichTextSchema(resolvedSchema)) {
3085
3320
  if ("src" in resolvedSource && "tag" in resolvedSource && resolvedSource.tag === "img" && parts.length === 0) {
3086
- var _resolvedSchema$optio3, _resolvedSchema$optio4;
3087
- resolvedSchema = resolvedSchema instanceof RichTextSchema ? (_resolvedSchema$optio3 = resolvedSchema["options"]) !== null && _resolvedSchema$optio3 !== void 0 && (_resolvedSchema$optio3 = _resolvedSchema$optio3.inline) !== null && _resolvedSchema$optio3 !== void 0 && _resolvedSchema$optio3.img && typeof ((_resolvedSchema$optio4 = resolvedSchema["options"]) === null || _resolvedSchema$optio4 === void 0 || (_resolvedSchema$optio4 = _resolvedSchema$optio4.inline) === null || _resolvedSchema$optio4 === void 0 ? void 0 : _resolvedSchema$optio4.img) !== "boolean" ? resolvedSchema["options"].inline.img : resolvedSchema : resolvedSchema;
3321
+ var _resolvedSchema$optio5, _resolvedSchema$optio6;
3322
+ resolvedSchema = resolvedSchema instanceof RichTextSchema ? (_resolvedSchema$optio5 = resolvedSchema["options"]) !== null && _resolvedSchema$optio5 !== void 0 && (_resolvedSchema$optio5 = _resolvedSchema$optio5.inline) !== null && _resolvedSchema$optio5 !== void 0 && _resolvedSchema$optio5.img && typeof ((_resolvedSchema$optio6 = resolvedSchema["options"]) === null || _resolvedSchema$optio6 === void 0 || (_resolvedSchema$optio6 = _resolvedSchema$optio6.inline) === null || _resolvedSchema$optio6 === void 0 ? void 0 : _resolvedSchema$optio6.img) !== "boolean" ? resolvedSchema["options"].inline.img : resolvedSchema : resolvedSchema;
3323
+ }
3324
+ if ("href" in resolvedSource && "tag" in resolvedSource && resolvedSource.tag === "a" && parts.length === 0) {
3325
+ var _resolvedSchema$optio7, _resolvedSchema$optio8;
3326
+ resolvedSchema = resolvedSchema instanceof RichTextSchema ? (_resolvedSchema$optio7 = resolvedSchema["options"]) !== null && _resolvedSchema$optio7 !== void 0 && (_resolvedSchema$optio7 = _resolvedSchema$optio7.inline) !== null && _resolvedSchema$optio7 !== void 0 && _resolvedSchema$optio7.a && typeof ((_resolvedSchema$optio8 = resolvedSchema["options"]) === null || _resolvedSchema$optio8 === void 0 || (_resolvedSchema$optio8 = _resolvedSchema$optio8.inline) === null || _resolvedSchema$optio8 === void 0 ? void 0 : _resolvedSchema$optio8.a) !== "boolean" ? resolvedSchema["options"].inline.a : resolvedSchema : resolvedSchema;
3088
3327
  }
3089
3328
  resolvedSource = resolvedSource[part];
3090
3329
  } else {
@@ -3754,151 +3993,6 @@ var date = function date(options) {
3754
3993
  return new DateSchema(options);
3755
3994
  };
3756
3995
 
3757
- var RouteSchema = /*#__PURE__*/function (_Schema) {
3758
- function RouteSchema(options) {
3759
- var _this;
3760
- var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
3761
- var customValidateFunctions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
3762
- _classCallCheck(this, RouteSchema);
3763
- _this = _callSuper(this, RouteSchema);
3764
- _this.options = options;
3765
- _this.opt = opt;
3766
- _this.customValidateFunctions = customValidateFunctions;
3767
- return _this;
3768
- }
3769
-
3770
- /**
3771
- * Specify a pattern for which routes are allowed.
3772
- *
3773
- * Semantics:
3774
- * - If only include is set: route must match include pattern
3775
- * - If only exclude is set: route must NOT match exclude pattern
3776
- * - If both are set: route must match include AND must NOT match exclude
3777
- *
3778
- * @example
3779
- * s.route().include(/^\/(home|about|contact)$/) // Only these specific routes
3780
- * s.route().include(/^\/api\//).exclude(/^\/api\/internal\//) // API routes except internal
3781
- */
3782
- _inherits(RouteSchema, _Schema);
3783
- return _createClass(RouteSchema, [{
3784
- key: "include",
3785
- value: function include(pattern) {
3786
- return new RouteSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
3787
- include: pattern
3788
- }), this.opt, this.customValidateFunctions);
3789
- }
3790
-
3791
- /**
3792
- * Specify a pattern for which routes should be excluded.
3793
- *
3794
- * Semantics:
3795
- * - If only include is set: route must match include pattern
3796
- * - If only exclude is set: route must NOT match exclude pattern
3797
- * - If both are set: route must match include AND must NOT match exclude
3798
- *
3799
- * @example
3800
- * s.route().exclude(/^\/admin/) // Exclude all admin routes
3801
- * s.route().include(/^\/api\//).exclude(/^\/api\/internal\//) // API routes except internal
3802
- */
3803
- }, {
3804
- key: "exclude",
3805
- value: function exclude(pattern) {
3806
- return new RouteSchema(_objectSpread2(_objectSpread2({}, this.options), {}, {
3807
- exclude: pattern
3808
- }), this.opt, this.customValidateFunctions);
3809
- }
3810
- }, {
3811
- key: "validate",
3812
- value: function validate(validationFunction) {
3813
- return new RouteSchema(this.options, this.opt, this.customValidateFunctions.concat(validationFunction));
3814
- }
3815
- }, {
3816
- key: "executeValidate",
3817
- value: function executeValidate(path, src) {
3818
- var _this$options, _this$options2;
3819
- var customValidationErrors = this.executeCustomValidateFunctions(src, this.customValidateFunctions, {
3820
- path: path
3821
- });
3822
- if (this.opt && (src === null || src === undefined)) {
3823
- return customValidationErrors.length > 0 ? _defineProperty({}, path, customValidationErrors) : false;
3824
- }
3825
- if (typeof src !== "string") {
3826
- return _defineProperty({}, path, [{
3827
- message: "Expected 'string', got '".concat(_typeof(src), "'"),
3828
- value: src
3829
- }]);
3830
- }
3831
- return _defineProperty({}, path, [].concat(_toConsumableArray(customValidationErrors), [{
3832
- fixes: ["router:check-route"],
3833
- message: "Did not validate route (router). This error (router:check-route) should typically be processed by Val internally. Seeing this error most likely means you have a Val version mismatch.",
3834
- value: {
3835
- route: src,
3836
- sourcePath: path,
3837
- include: (_this$options = this.options) === null || _this$options === void 0 ? void 0 : _this$options.include,
3838
- exclude: (_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.exclude
3839
- }
3840
- }]));
3841
- }
3842
- }, {
3843
- key: "executeAssert",
3844
- value: function executeAssert(path, src) {
3845
- if (this.opt && src === null) {
3846
- return {
3847
- success: true,
3848
- data: src
3849
- };
3850
- }
3851
- if (typeof src === "string") {
3852
- return {
3853
- success: true,
3854
- data: src
3855
- };
3856
- }
3857
- return {
3858
- success: false,
3859
- errors: _defineProperty({}, path, [{
3860
- message: "Expected 'string', got '".concat(_typeof(src), "'"),
3861
- typeError: true
3862
- }])
3863
- };
3864
- }
3865
- }, {
3866
- key: "nullable",
3867
- value: function nullable() {
3868
- return new RouteSchema(this.options, true, this.customValidateFunctions);
3869
- }
3870
- }, {
3871
- key: "executeSerialize",
3872
- value: function executeSerialize() {
3873
- var _this$options3, _this$options4, _this$customValidateF, _this$customValidateF2;
3874
- return {
3875
- type: "route",
3876
- options: {
3877
- include: ((_this$options3 = this.options) === null || _this$options3 === void 0 ? void 0 : _this$options3.include) && {
3878
- source: this.options.include.source,
3879
- flags: this.options.include.flags
3880
- },
3881
- exclude: ((_this$options4 = this.options) === null || _this$options4 === void 0 ? void 0 : _this$options4.exclude) && {
3882
- source: this.options.exclude.source,
3883
- flags: this.options.exclude.flags
3884
- },
3885
- customValidate: this.customValidateFunctions && ((_this$customValidateF = this.customValidateFunctions) === null || _this$customValidateF === void 0 ? void 0 : _this$customValidateF.length) > 0
3886
- },
3887
- opt: this.opt,
3888
- customValidate: this.customValidateFunctions && ((_this$customValidateF2 = this.customValidateFunctions) === null || _this$customValidateF2 === void 0 ? void 0 : _this$customValidateF2.length) > 0
3889
- };
3890
- }
3891
- }, {
3892
- key: "executeRender",
3893
- value: function executeRender() {
3894
- return {};
3895
- }
3896
- }]);
3897
- }(Schema);
3898
- var route = function route(options) {
3899
- return new RouteSchema(options);
3900
- };
3901
-
3902
3996
  function router(router, item) {
3903
3997
  var keySchema = string();
3904
3998
  var recordSchema = new RecordSchema(item, false, [], router, keySchema);
@@ -3942,6 +4036,7 @@ function initSchema() {
3942
4036
 
3943
4037
  var initImage = function initImage(config) {
3944
4038
  var _config$files$directo, _config$files;
4039
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
3945
4040
  (_config$files$directo = config === null || config === void 0 || (_config$files = config.files) === null || _config$files === void 0 ? void 0 : _config$files.directory) !== null && _config$files$directo !== void 0 ? _config$files$directo : "/public/val";
3946
4041
 
3947
4042
  /**
@@ -4013,7 +4108,6 @@ function createRemoteRef(remoteHost, _ref2) {
4013
4108
  return "".concat(remoteHost, "/file/p/").concat(publicProjectId, "/b/").concat(bucket, "/v/").concat(coreVersion, "/h/").concat(validationHash, "/f/").concat(fileHash, "/p/").concat(filePath);
4014
4109
  }
4015
4110
 
4016
- /* eslint-disable @typescript-eslint/ban-types */
4017
4111
  // import { i18n, I18n } from "./source/future/i18n";
4018
4112
  // import { remote } from "./source/future/remote";
4019
4113
 
@@ -4046,7 +4140,7 @@ var initVal = function initVal(config) {
4046
4140
  // }
4047
4141
  return {
4048
4142
  val: {
4049
- getPath: getValPath
4143
+ unstable_getPath: getValPath
4050
4144
  },
4051
4145
  c: {
4052
4146
  define: define,
@@ -5371,12 +5465,12 @@ function deserializeSchema(serialized) {
5371
5465
  serialized.opt);
5372
5466
  case "richtext":
5373
5467
  {
5374
- var _serialized$options3, _serialized$options4;
5468
+ var _serialized$options3, _serialized$options4, _serialized$options5, _serialized$options6, _serialized$options7, _serialized$options8, _serialized$options9;
5375
5469
  var deserializedOptions = _objectSpread2(_objectSpread2({}, serialized.options || {}), {}, {
5376
- inline: _typeof((_serialized$options3 = serialized.options) === null || _serialized$options3 === void 0 || (_serialized$options3 = _serialized$options3.inline) === null || _serialized$options3 === void 0 ? void 0 : _serialized$options3.img) === "object" ? {
5377
- a: serialized.options.inline.a,
5378
- img: deserializeSchema(serialized.options.inline.img)
5379
- } : (_serialized$options4 = serialized.options) === null || _serialized$options4 === void 0 ? void 0 : _serialized$options4.inline
5470
+ inline: _typeof((_serialized$options3 = serialized.options) === null || _serialized$options3 === void 0 || (_serialized$options3 = _serialized$options3.inline) === null || _serialized$options3 === void 0 ? void 0 : _serialized$options3.img) === "object" || _typeof((_serialized$options4 = serialized.options) === null || _serialized$options4 === void 0 || (_serialized$options4 = _serialized$options4.inline) === null || _serialized$options4 === void 0 ? void 0 : _serialized$options4.a) === "object" ? {
5471
+ a: _typeof((_serialized$options5 = serialized.options) === null || _serialized$options5 === void 0 || (_serialized$options5 = _serialized$options5.inline) === null || _serialized$options5 === void 0 ? void 0 : _serialized$options5.a) === "object" ? deserializeSchema(serialized.options.inline.a) : (_serialized$options6 = serialized.options) === null || _serialized$options6 === void 0 || (_serialized$options6 = _serialized$options6.inline) === null || _serialized$options6 === void 0 ? void 0 : _serialized$options6.a,
5472
+ img: _typeof((_serialized$options7 = serialized.options) === null || _serialized$options7 === void 0 || (_serialized$options7 = _serialized$options7.inline) === null || _serialized$options7 === void 0 ? void 0 : _serialized$options7.img) === "object" ? deserializeSchema(serialized.options.inline.img) : (_serialized$options8 = serialized.options) === null || _serialized$options8 === void 0 || (_serialized$options8 = _serialized$options8.inline) === null || _serialized$options8 === void 0 ? void 0 : _serialized$options8.img
5473
+ } : (_serialized$options9 = serialized.options) === null || _serialized$options9 === void 0 ? void 0 : _serialized$options9.inline
5380
5474
  });
5381
5475
  return new RichTextSchema(deserializedOptions, serialized.opt);
5382
5476
  }
@@ -5411,6 +5505,35 @@ function deserializeSchema(serialized) {
5411
5505
  }
5412
5506
  }
5413
5507
 
5508
+ var externalUrlPage = {
5509
+ getRouterId: function getRouterId() {
5510
+ return "external-url-router";
5511
+ },
5512
+ validate: function validate(_moduleFilePath, urlPaths) {
5513
+ var errors = [];
5514
+ var _iterator = _createForOfIteratorHelper(urlPaths),
5515
+ _step;
5516
+ try {
5517
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
5518
+ var urlPath = _step.value;
5519
+ if (!(urlPath.startsWith("https://") || urlPath.startsWith("http://"))) {
5520
+ errors.push({
5521
+ error: {
5522
+ message: "URL path \"".concat(urlPath, "\" does not start with \"https://\" or \"http://\""),
5523
+ expectedPath: null,
5524
+ urlPath: urlPath
5525
+ }
5526
+ });
5527
+ }
5528
+ }
5529
+ } catch (err) {
5530
+ _iterator.e(err);
5531
+ } finally {
5532
+ _iterator.f();
5533
+ }
5534
+ return [];
5535
+ }
5536
+ };
5414
5537
  // Helper function to validate a URL path against a route pattern
5415
5538
  function validateUrlAgainstPattern(urlPath, routePattern) {
5416
5539
  // Remove leading slash and split URL path
@@ -5525,11 +5648,11 @@ var nextAppRouter = {
5525
5648
  validate: function validate(moduleFilePath, urlPaths) {
5526
5649
  var routePattern = parseNextJsRoutePattern(moduleFilePath);
5527
5650
  var errors = [];
5528
- var _iterator = _createForOfIteratorHelper(urlPaths),
5529
- _step;
5651
+ var _iterator2 = _createForOfIteratorHelper(urlPaths),
5652
+ _step2;
5530
5653
  try {
5531
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
5532
- var urlPath = _step.value;
5654
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
5655
+ var urlPath = _step2.value;
5533
5656
  var validation = validateUrlAgainstPattern(urlPath, routePattern);
5534
5657
  if (!validation.isValid) {
5535
5658
  errors.push({
@@ -5542,9 +5665,9 @@ var nextAppRouter = {
5542
5665
  }
5543
5666
  }
5544
5667
  } catch (err) {
5545
- _iterator.e(err);
5668
+ _iterator2.e(err);
5546
5669
  } finally {
5547
- _iterator.f();
5670
+ _iterator2.f();
5548
5671
  }
5549
5672
  return errors;
5550
5673
  }
@@ -5606,7 +5729,7 @@ var Internal = {
5606
5729
  VERSION: {
5607
5730
  core: function () {
5608
5731
  try {
5609
- // eslint-disable-next-line @typescript-eslint/no-var-requires
5732
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
5610
5733
  return require("../package.json").version;
5611
5734
  } catch (_unused) {
5612
5735
  return null;
@@ -5623,6 +5746,7 @@ var Internal = {
5623
5746
  splitModuleFilePathAndModulePath: splitModuleFilePathAndModulePath,
5624
5747
  joinModuleFilePathAndModulePath: joinModuleFilePathAndModulePath,
5625
5748
  nextAppRouter: nextAppRouter,
5749
+ externalUrlPage: externalUrlPage,
5626
5750
  remote: {
5627
5751
  createRemoteRef: createRemoteRef,
5628
5752
  getValidationBasis: getValidationBasis,
@@ -5695,7 +5819,7 @@ var Internal = {
5695
5819
  function tryJsonParse(str) {
5696
5820
  try {
5697
5821
  return JSON.parse(str);
5698
- } catch (err) {
5822
+ } catch (_unused2) {
5699
5823
  return str;
5700
5824
  }
5701
5825
  }