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