@next-core/brick-utils 2.41.2 → 2.42.1

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.
package/dist/index.esm.js CHANGED
@@ -21634,7 +21634,9 @@ function matchPath(pathname, options) {
21634
21634
  path: p,
21635
21635
  exact = false,
21636
21636
  strict = false,
21637
- sensitive = true
21637
+ sensitive = true,
21638
+ checkIf,
21639
+ getContext
21638
21640
  } = options;
21639
21641
  var paths = Array.isArray(p) ? p : [p];
21640
21642
  return paths.reduce((matched, path) => {
@@ -21664,7 +21666,7 @@ function matchPath(pathname, options) {
21664
21666
  }
21665
21667
 
21666
21668
  var initialParams = {};
21667
- return {
21669
+ var result = {
21668
21670
  path,
21669
21671
  // the path used to match
21670
21672
  url: path === "/" && url === "" ? "/" : url,
@@ -21676,6 +21678,12 @@ function matchPath(pathname, options) {
21676
21678
  return memo;
21677
21679
  }, initialParams)
21678
21680
  };
21681
+
21682
+ if (checkIf && !checkIf(getContext(result))) {
21683
+ return null;
21684
+ }
21685
+
21686
+ return result;
21679
21687
  }, null);
21680
21688
  }
21681
21689
  function toPath(path, pathParams) {
@@ -22816,7 +22824,7 @@ function isSnippetNode(node) {
22816
22824
 
22817
22825
  var jsonFieldsInRoute = ["menu", "providers", "segues", "defineResolves", "redirect", "analyticsData"]; // Fields stored as yaml string will be parsed when build & push.
22818
22826
 
22819
- var yamlFieldsInRoute = ["permissionsPreCheck"];
22827
+ var yamlFieldsInRoute = ["permissionsPreCheck", "if"];
22820
22828
  var jsonFieldsInBrick = ["properties", "events", "lifeCycle", "params", "if", "transform"]; // Fields stored as yaml string will be parsed when build & push.
22821
22829
 
22822
22830
  var yamlFieldsInBrick = ["permissionsPreCheck", "transformFrom"]; // Fields started with `_` will be removed by default.