@jxsuite/parser 4.0.1 → 4.1.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.
@@ -18643,16 +18643,43 @@ function color2(d) {
18643
18643
  }
18644
18644
 
18645
18645
  // ../../node_modules/unist-util-visit/node_modules/unist-util-visit-parents/lib/index.js
18646
- function visitParents2(tree, test, visitor, reverse) {
18646
+ function visitParents2(tree, testOrEnterOrVisitors, enterOrVisitorsOrReverse, reverse) {
18647
+ if (!tree || typeof tree !== "object") {
18648
+ throw new Error("Unexpected value `" + tree + "` for `tree`, expected node");
18649
+ }
18650
+ let preorder = true;
18647
18651
  let check;
18648
- if (typeof test === "function" && typeof visitor !== "function") {
18649
- reverse = visitor;
18650
- visitor = test;
18652
+ let visitors;
18653
+ let enter;
18654
+ let exit;
18655
+ if (typeof enterOrVisitorsOrReverse === "function" || enterOrVisitorsOrReverse && typeof enterOrVisitorsOrReverse === "object") {
18656
+ check = testOrEnterOrVisitors;
18657
+ visitors = enterOrVisitorsOrReverse;
18658
+ if (reverse)
18659
+ preorder = false;
18651
18660
  } else {
18652
- check = test;
18661
+ visitors = testOrEnterOrVisitors;
18662
+ if (enterOrVisitorsOrReverse)
18663
+ preorder = false;
18664
+ }
18665
+ if (typeof visitors === "function") {
18666
+ enter = visitors;
18667
+ } else if (visitors && typeof visitors === "object") {
18668
+ if (visitors.enter === null || visitors.enter === undefined) {} else if (typeof visitors.enter === "function") {
18669
+ enter = visitors.enter;
18670
+ } else {
18671
+ throw new Error("Unexpected value `" + visitors.enter + "` for `visitors.enter`, expected optional visitor");
18672
+ }
18673
+ if (typeof visitors.exit === "function") {
18674
+ exit = visitors.exit;
18675
+ } else {
18676
+ throw new Error("Unexpected value `" + visitors.exit + "` for `visitors.exit`, expected visitor (pass a visitor directly if you only want an enter visitor)");
18677
+ }
18678
+ } else {
18679
+ throw new Error("Unexpected value `" + visitors + "` for `enter` or `visitors`, expected visitor or object with visitors");
18653
18680
  }
18654
18681
  const is = convert(check);
18655
- const step = reverse ? -1 : 1;
18682
+ const step = preorder ? 1 : -1;
18656
18683
  factory(tree, undefined, [])();
18657
18684
  function factory(node, index, parents) {
18658
18685
  const value = node && typeof node === "object" ? node : {};
@@ -18664,12 +18691,10 @@ function visitParents2(tree, test, visitor, reverse) {
18664
18691
  }
18665
18692
  return visit;
18666
18693
  function visit() {
18694
+ const matches = !check || is(node, index, parents[parents.length - 1] || undefined);
18667
18695
  let result = empty2;
18668
- let subresult;
18669
- let offset;
18670
- let grandparents;
18671
- if (!test || is(node, index, parents[parents.length - 1] || undefined)) {
18672
- result = toResult2(visitor(node, parents));
18696
+ if (enter && matches) {
18697
+ result = toResult2(enter(node, parents, index));
18673
18698
  if (result[0] === EXIT2) {
18674
18699
  return result;
18675
18700
  }
@@ -18677,11 +18702,11 @@ function visitParents2(tree, test, visitor, reverse) {
18677
18702
  if ("children" in node && node.children) {
18678
18703
  const nodeAsParent = node;
18679
18704
  if (nodeAsParent.children && result[0] !== SKIP2) {
18680
- offset = (reverse ? nodeAsParent.children.length : -1) + step;
18681
- grandparents = parents.concat(nodeAsParent);
18705
+ let offset = (preorder ? -1 : nodeAsParent.children.length) + step;
18706
+ const grandparents = [...parents, nodeAsParent];
18682
18707
  while (offset > -1 && offset < nodeAsParent.children.length) {
18683
18708
  const child = nodeAsParent.children[offset];
18684
- subresult = factory(child, offset, grandparents)();
18709
+ const subresult = factory(child, offset, grandparents)();
18685
18710
  if (subresult[0] === EXIT2) {
18686
18711
  return subresult;
18687
18712
  }
@@ -18689,6 +18714,15 @@ function visitParents2(tree, test, visitor, reverse) {
18689
18714
  }
18690
18715
  }
18691
18716
  }
18717
+ if (exit && matches) {
18718
+ const exitResult = toResult2(exit(node, parents, index));
18719
+ if (exitResult[0] === SKIP2) {
18720
+ throw new Error("Unexpected value `" + exitResult[0] + "` from `exit`, expected `CONTINUE`, `EXIT`, index, or nothing");
18721
+ }
18722
+ if (exitResult[0] === EXIT2 || typeof exitResult[1] === "number") {
18723
+ return exitResult;
18724
+ }
18725
+ }
18692
18726
  return result;
18693
18727
  }
18694
18728
  }
@@ -18714,24 +18748,36 @@ var init_unist_util_visit_parents2 = __esm(() => {
18714
18748
  });
18715
18749
 
18716
18750
  // ../../node_modules/unist-util-visit/lib/index.js
18717
- function visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) {
18751
+ function visit(tree, testOrEnterOrVisitors, enterOrVisitorsOrReverse, maybeReverse) {
18752
+ let check;
18753
+ let visitors;
18718
18754
  let reverse;
18719
- let test;
18720
- let visitor;
18721
- if (typeof testOrVisitor === "function" && typeof visitorOrReverse !== "function") {
18722
- test = undefined;
18723
- visitor = testOrVisitor;
18724
- reverse = visitorOrReverse;
18725
- } else {
18726
- test = testOrVisitor;
18727
- visitor = visitorOrReverse;
18755
+ if (typeof enterOrVisitorsOrReverse === "function" || enterOrVisitorsOrReverse && typeof enterOrVisitorsOrReverse === "object") {
18756
+ check = testOrEnterOrVisitors;
18757
+ visitors = enterOrVisitorsOrReverse;
18728
18758
  reverse = maybeReverse;
18759
+ } else {
18760
+ visitors = testOrEnterOrVisitors;
18761
+ reverse = enterOrVisitorsOrReverse;
18729
18762
  }
18730
- visitParents2(tree, test, overload, reverse);
18731
- function overload(node, parents) {
18732
- const parent = parents[parents.length - 1];
18733
- const index = parent ? parent.children.indexOf(node) : undefined;
18734
- return visitor(node, index, parent);
18763
+ if (typeof visitors === "function") {
18764
+ visitParents2(tree, check, wrap2(visitors), reverse);
18765
+ } else {
18766
+ visitParents2(tree, check, wrapVisitors(visitors), reverse);
18767
+ }
18768
+ }
18769
+ function wrapVisitors(visitors) {
18770
+ if (!visitors || typeof visitors !== "object")
18771
+ return visitors;
18772
+ return {
18773
+ enter: typeof visitors.enter === "function" ? wrap2(visitors.enter) : visitors.enter,
18774
+ exit: typeof visitors.exit === "function" ? wrap2(visitors.exit) : visitors.exit
18775
+ };
18776
+ }
18777
+ function wrap2(visitor) {
18778
+ return overload;
18779
+ function overload(node, parents, index) {
18780
+ return visitor(node, index, parents[parents.length - 1]);
18735
18781
  }
18736
18782
  }
18737
18783
  var init_lib16 = __esm(() => {
package/dist/markdown.js CHANGED
@@ -18500,16 +18500,43 @@ function color2(d) {
18500
18500
  }
18501
18501
 
18502
18502
  // ../../node_modules/unist-util-visit/node_modules/unist-util-visit-parents/lib/index.js
18503
- function visitParents2(tree, test, visitor, reverse) {
18503
+ function visitParents2(tree, testOrEnterOrVisitors, enterOrVisitorsOrReverse, reverse) {
18504
+ if (!tree || typeof tree !== "object") {
18505
+ throw new Error("Unexpected value `" + tree + "` for `tree`, expected node");
18506
+ }
18507
+ let preorder = true;
18504
18508
  let check;
18505
- if (typeof test === "function" && typeof visitor !== "function") {
18506
- reverse = visitor;
18507
- visitor = test;
18509
+ let visitors;
18510
+ let enter;
18511
+ let exit;
18512
+ if (typeof enterOrVisitorsOrReverse === "function" || enterOrVisitorsOrReverse && typeof enterOrVisitorsOrReverse === "object") {
18513
+ check = testOrEnterOrVisitors;
18514
+ visitors = enterOrVisitorsOrReverse;
18515
+ if (reverse)
18516
+ preorder = false;
18508
18517
  } else {
18509
- check = test;
18518
+ visitors = testOrEnterOrVisitors;
18519
+ if (enterOrVisitorsOrReverse)
18520
+ preorder = false;
18521
+ }
18522
+ if (typeof visitors === "function") {
18523
+ enter = visitors;
18524
+ } else if (visitors && typeof visitors === "object") {
18525
+ if (visitors.enter === null || visitors.enter === undefined) {} else if (typeof visitors.enter === "function") {
18526
+ enter = visitors.enter;
18527
+ } else {
18528
+ throw new Error("Unexpected value `" + visitors.enter + "` for `visitors.enter`, expected optional visitor");
18529
+ }
18530
+ if (typeof visitors.exit === "function") {
18531
+ exit = visitors.exit;
18532
+ } else {
18533
+ throw new Error("Unexpected value `" + visitors.exit + "` for `visitors.exit`, expected visitor (pass a visitor directly if you only want an enter visitor)");
18534
+ }
18535
+ } else {
18536
+ throw new Error("Unexpected value `" + visitors + "` for `enter` or `visitors`, expected visitor or object with visitors");
18510
18537
  }
18511
18538
  const is = convert(check);
18512
- const step = reverse ? -1 : 1;
18539
+ const step = preorder ? 1 : -1;
18513
18540
  factory(tree, undefined, [])();
18514
18541
  function factory(node, index, parents) {
18515
18542
  const value = node && typeof node === "object" ? node : {};
@@ -18521,12 +18548,10 @@ function visitParents2(tree, test, visitor, reverse) {
18521
18548
  }
18522
18549
  return visit;
18523
18550
  function visit() {
18551
+ const matches = !check || is(node, index, parents[parents.length - 1] || undefined);
18524
18552
  let result = empty2;
18525
- let subresult;
18526
- let offset;
18527
- let grandparents;
18528
- if (!test || is(node, index, parents[parents.length - 1] || undefined)) {
18529
- result = toResult2(visitor(node, parents));
18553
+ if (enter && matches) {
18554
+ result = toResult2(enter(node, parents, index));
18530
18555
  if (result[0] === EXIT2) {
18531
18556
  return result;
18532
18557
  }
@@ -18534,11 +18559,11 @@ function visitParents2(tree, test, visitor, reverse) {
18534
18559
  if ("children" in node && node.children) {
18535
18560
  const nodeAsParent = node;
18536
18561
  if (nodeAsParent.children && result[0] !== SKIP2) {
18537
- offset = (reverse ? nodeAsParent.children.length : -1) + step;
18538
- grandparents = parents.concat(nodeAsParent);
18562
+ let offset = (preorder ? -1 : nodeAsParent.children.length) + step;
18563
+ const grandparents = [...parents, nodeAsParent];
18539
18564
  while (offset > -1 && offset < nodeAsParent.children.length) {
18540
18565
  const child = nodeAsParent.children[offset];
18541
- subresult = factory(child, offset, grandparents)();
18566
+ const subresult = factory(child, offset, grandparents)();
18542
18567
  if (subresult[0] === EXIT2) {
18543
18568
  return subresult;
18544
18569
  }
@@ -18546,6 +18571,15 @@ function visitParents2(tree, test, visitor, reverse) {
18546
18571
  }
18547
18572
  }
18548
18573
  }
18574
+ if (exit && matches) {
18575
+ const exitResult = toResult2(exit(node, parents, index));
18576
+ if (exitResult[0] === SKIP2) {
18577
+ throw new Error("Unexpected value `" + exitResult[0] + "` from `exit`, expected `CONTINUE`, `EXIT`, index, or nothing");
18578
+ }
18579
+ if (exitResult[0] === EXIT2 || typeof exitResult[1] === "number") {
18580
+ return exitResult;
18581
+ }
18582
+ }
18549
18583
  return result;
18550
18584
  }
18551
18585
  }
@@ -18571,24 +18605,36 @@ var init_unist_util_visit_parents2 = __esm(() => {
18571
18605
  });
18572
18606
 
18573
18607
  // ../../node_modules/unist-util-visit/lib/index.js
18574
- function visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) {
18608
+ function visit(tree, testOrEnterOrVisitors, enterOrVisitorsOrReverse, maybeReverse) {
18609
+ let check;
18610
+ let visitors;
18575
18611
  let reverse;
18576
- let test;
18577
- let visitor;
18578
- if (typeof testOrVisitor === "function" && typeof visitorOrReverse !== "function") {
18579
- test = undefined;
18580
- visitor = testOrVisitor;
18581
- reverse = visitorOrReverse;
18582
- } else {
18583
- test = testOrVisitor;
18584
- visitor = visitorOrReverse;
18612
+ if (typeof enterOrVisitorsOrReverse === "function" || enterOrVisitorsOrReverse && typeof enterOrVisitorsOrReverse === "object") {
18613
+ check = testOrEnterOrVisitors;
18614
+ visitors = enterOrVisitorsOrReverse;
18585
18615
  reverse = maybeReverse;
18616
+ } else {
18617
+ visitors = testOrEnterOrVisitors;
18618
+ reverse = enterOrVisitorsOrReverse;
18586
18619
  }
18587
- visitParents2(tree, test, overload, reverse);
18588
- function overload(node, parents) {
18589
- const parent = parents[parents.length - 1];
18590
- const index = parent ? parent.children.indexOf(node) : undefined;
18591
- return visitor(node, index, parent);
18620
+ if (typeof visitors === "function") {
18621
+ visitParents2(tree, check, wrap2(visitors), reverse);
18622
+ } else {
18623
+ visitParents2(tree, check, wrapVisitors(visitors), reverse);
18624
+ }
18625
+ }
18626
+ function wrapVisitors(visitors) {
18627
+ if (!visitors || typeof visitors !== "object")
18628
+ return visitors;
18629
+ return {
18630
+ enter: typeof visitors.enter === "function" ? wrap2(visitors.enter) : visitors.enter,
18631
+ exit: typeof visitors.exit === "function" ? wrap2(visitors.exit) : visitors.exit
18632
+ };
18633
+ }
18634
+ function wrap2(visitor) {
18635
+ return overload;
18636
+ function overload(node, parents, index) {
18637
+ return visitor(node, index, parents[parents.length - 1]);
18592
18638
  }
18593
18639
  }
18594
18640
  var init_lib16 = __esm(() => {
@@ -46385,6 +46431,7 @@ var CAPTURING_REGEX_SOURCE, RegexSource = class {
46385
46431
  constructor(fn) {
46386
46432
  this.fn = fn;
46387
46433
  }
46434
+ fn;
46388
46435
  cache = /* @__PURE__ */ new Map;
46389
46436
  get(key) {
46390
46437
  if (this.cache.has(key)) {
@@ -46400,6 +46447,9 @@ var CAPTURING_REGEX_SOURCE, RegexSource = class {
46400
46447
  this._defaults = _defaults;
46401
46448
  this._root = _root;
46402
46449
  }
46450
+ _colorMap;
46451
+ _defaults;
46452
+ _root;
46403
46453
  static createFromRawTheme(source, colorMap) {
46404
46454
  return this.createFromParsedTheme(parseTheme(source), colorMap);
46405
46455
  }
@@ -46430,6 +46480,8 @@ var CAPTURING_REGEX_SOURCE, RegexSource = class {
46430
46480
  this.parent = parent;
46431
46481
  this.scopeName = scopeName;
46432
46482
  }
46483
+ parent;
46484
+ scopeName;
46433
46485
  static push(path, scopeNames) {
46434
46486
  for (const name of scopeNames) {
46435
46487
  path = new _ScopeStack(path, name);
@@ -46483,6 +46535,9 @@ var CAPTURING_REGEX_SOURCE, RegexSource = class {
46483
46535
  this.foregroundId = foregroundId;
46484
46536
  this.backgroundId = backgroundId;
46485
46537
  }
46538
+ fontStyle;
46539
+ foregroundId;
46540
+ backgroundId;
46486
46541
  }, ParsedThemeRule = class {
46487
46542
  constructor(scope, parentScopes, index, fontStyle, foreground, background) {
46488
46543
  this.scope = scope;
@@ -46492,6 +46547,12 @@ var CAPTURING_REGEX_SOURCE, RegexSource = class {
46492
46547
  this.foreground = foreground;
46493
46548
  this.background = background;
46494
46549
  }
46550
+ scope;
46551
+ parentScopes;
46552
+ index;
46553
+ fontStyle;
46554
+ foreground;
46555
+ background;
46495
46556
  }, FontStyle, ColorMap = class {
46496
46557
  _isFrozen;
46497
46558
  _lastColorId;
@@ -46576,6 +46637,8 @@ var CAPTURING_REGEX_SOURCE, RegexSource = class {
46576
46637
  this._children = _children;
46577
46638
  this._rulesWithParentScopes = rulesWithParentScopes;
46578
46639
  }
46640
+ _mainRule;
46641
+ _children;
46579
46642
  _rulesWithParentScopes;
46580
46643
  static _cmpBySpecificity(a, b) {
46581
46644
  if (a.scopeDepth !== b.scopeDepth) {
@@ -46736,6 +46799,7 @@ var CAPTURING_REGEX_SOURCE, RegexSource = class {
46736
46799
  constructor(scopeName) {
46737
46800
  this.scopeName = scopeName;
46738
46801
  }
46802
+ scopeName;
46739
46803
  toKey() {
46740
46804
  return this.scopeName;
46741
46805
  }
@@ -46744,6 +46808,8 @@ var CAPTURING_REGEX_SOURCE, RegexSource = class {
46744
46808
  this.scopeName = scopeName;
46745
46809
  this.ruleName = ruleName;
46746
46810
  }
46811
+ scopeName;
46812
+ ruleName;
46747
46813
  toKey() {
46748
46814
  return `${this.scopeName}#${this.ruleName}`;
46749
46815
  }
@@ -46769,6 +46835,8 @@ var CAPTURING_REGEX_SOURCE, RegexSource = class {
46769
46835
  this.seenFullScopeRequests.add(this.initialScopeName);
46770
46836
  this.Q = [new TopLevelRuleReference(this.initialScopeName)];
46771
46837
  }
46838
+ repo;
46839
+ initialScopeName;
46772
46840
  seenFullScopeRequests = /* @__PURE__ */ new Set;
46773
46841
  seenPartialScopeRequests = /* @__PURE__ */ new Set;
46774
46842
  Q;
@@ -46806,19 +46874,23 @@ var CAPTURING_REGEX_SOURCE, RegexSource = class {
46806
46874
  constructor(ruleName) {
46807
46875
  this.ruleName = ruleName;
46808
46876
  }
46877
+ ruleName;
46809
46878
  kind = 2;
46810
46879
  }, TopLevelReference = class {
46811
46880
  constructor(scopeName) {
46812
46881
  this.scopeName = scopeName;
46813
46882
  }
46883
+ scopeName;
46814
46884
  kind = 3;
46815
46885
  }, TopLevelRepositoryReference = class {
46816
46886
  constructor(scopeName, ruleName) {
46817
46887
  this.scopeName = scopeName;
46818
46888
  this.ruleName = ruleName;
46819
46889
  }
46890
+ scopeName;
46891
+ ruleName;
46820
46892
  kind = 4;
46821
- }, HAS_BACK_REFERENCES, BACK_REFERENCING_END, ruleIdSymbol, endRuleId = -1, whileRuleId = -2, Rule = class {
46893
+ }, HAS_BACK_REFERENCES, BACK_REFERENCING_END, endRuleId = -1, whileRuleId = -2, Rule = class {
46822
46894
  $location;
46823
46895
  id;
46824
46896
  _nameIsCapturing;
@@ -47213,6 +47285,8 @@ var CAPTURING_REGEX_SOURCE, RegexSource = class {
47213
47285
  this.rules = rules;
47214
47286
  this.scanner = onigLib.createOnigScanner(regExps);
47215
47287
  }
47288
+ regExps;
47289
+ rules;
47216
47290
  scanner;
47217
47291
  dispose() {
47218
47292
  if (typeof this.scanner.dispose === "function") {
@@ -47242,6 +47316,8 @@ var CAPTURING_REGEX_SOURCE, RegexSource = class {
47242
47316
  this.languageId = languageId;
47243
47317
  this.tokenType = tokenType;
47244
47318
  }
47319
+ languageId;
47320
+ tokenType;
47245
47321
  }, BasicScopeAttributesProvider, ScopeMatcher = class {
47246
47322
  values;
47247
47323
  scopesRegExp;
@@ -47272,6 +47348,8 @@ var CAPTURING_REGEX_SOURCE, RegexSource = class {
47272
47348
  this.stack = stack;
47273
47349
  this.stoppedEarly = stoppedEarly;
47274
47350
  }
47351
+ stack;
47352
+ stoppedEarly;
47275
47353
  }, LocalStackElement = class {
47276
47354
  scopes;
47277
47355
  endPos;
@@ -47305,6 +47383,9 @@ var CAPTURING_REGEX_SOURCE, RegexSource = class {
47305
47383
  }
47306
47384
  }
47307
47385
  }
47386
+ _rootScopeName;
47387
+ balancedBracketSelectors;
47388
+ _onigLib;
47308
47389
  _rootId;
47309
47390
  _lastRuleId;
47310
47391
  _ruleId2desc;
@@ -47457,6 +47538,9 @@ var CAPTURING_REGEX_SOURCE, RegexSource = class {
47457
47538
  this.scopePath = scopePath;
47458
47539
  this.tokenAttributes = tokenAttributes;
47459
47540
  }
47541
+ parent;
47542
+ scopePath;
47543
+ tokenAttributes;
47460
47544
  static fromExtension(namesScopeList, contentNameScopesList) {
47461
47545
  let current = namesScopeList;
47462
47546
  let scopeNames = namesScopeList?.scopePath ?? null;
@@ -47595,6 +47679,7 @@ var CAPTURING_REGEX_SOURCE, RegexSource = class {
47595
47679
  this._binaryTokens = [];
47596
47680
  this._lastTokenEndIndex = 0;
47597
47681
  }
47682
+ balancedBracketSelectors;
47598
47683
  _emitBinaryTokens;
47599
47684
  _lineText;
47600
47685
  _tokens;
@@ -47677,6 +47762,7 @@ var CAPTURING_REGEX_SOURCE, RegexSource = class {
47677
47762
  this._onigLib = _onigLib;
47678
47763
  this._theme = theme;
47679
47764
  }
47765
+ _onigLib;
47680
47766
  _grammars = /* @__PURE__ */ new Map;
47681
47767
  _rawGrammars = /* @__PURE__ */ new Map;
47682
47768
  _injectionGrammars = /* @__PURE__ */ new Map;
@@ -47790,7 +47876,6 @@ var init_dist5 = __esm(() => {
47790
47876
  emptyParentScopes = Object.freeze([]);
47791
47877
  HAS_BACK_REFERENCES = /\\(\d+)/;
47792
47878
  BACK_REFERENCING_END = /\\(\d+)/g;
47793
- ruleIdSymbol = Symbol("RuleId");
47794
47879
  CaptureRule = class extends Rule {
47795
47880
  retokenizeCapturedWithRuleId;
47796
47881
  constructor($location, id, name, contentName, retokenizeCapturedWithRuleId) {
@@ -48085,6 +48170,12 @@ var init_dist5 = __esm(() => {
48085
48170
  this._enterPos = enterPos;
48086
48171
  this._anchorPos = anchorPos;
48087
48172
  }
48173
+ parent;
48174
+ ruleId;
48175
+ beginRuleCapturedEOL;
48176
+ endRule;
48177
+ nameScopesList;
48178
+ contentNameScopesList;
48088
48179
  _stackElementBrand = undefined;
48089
48180
  static NULL = new _StateStackImpl(null, 0, 0, 0, false, null, null, null);
48090
48181
  _enterPos;
@@ -54091,31 +54182,31 @@ var init_caddyfile = __esm(() => {
54091
54182
  ],
54092
54183
  repository: {
54093
54184
  comment: {
54094
- match: "(?:^|(?<=\\s))#.*$",
54185
+ match: String.raw`(?:^|(?<=\s))#.*$`,
54095
54186
  name: "comment.line.number-sign.caddyfile"
54096
54187
  },
54097
54188
  constant: {
54098
- match: "\\b(?:on|off|true|false|h1|h2|h2c|h3)\\b",
54189
+ match: String.raw`\b(?:on|off|true|false|h1|h2|h2c|h3)\b`,
54099
54190
  name: "constant.language.caddyfile"
54100
54191
  },
54101
54192
  directive: {
54102
- match: "^\\s*([A-Za-z_][\\w]*)(?=\\s|$)",
54193
+ match: String.raw`^\s*([A-Za-z_][\w]*)(?=\s|$)`,
54103
54194
  captures: { "1": { name: "entity.name.function.directive.caddyfile" } }
54104
54195
  },
54105
54196
  duration: {
54106
- match: "\\b\\d+(?:\\.\\d+)?(?:ns|us|ms|s|m|h|d)\\b",
54197
+ match: String.raw`\b\d+(?:\.\d+)?(?:ns|us|ms|s|m|h|d)\b`,
54107
54198
  name: "constant.numeric.duration.caddyfile"
54108
54199
  },
54109
54200
  matcher: {
54110
- match: "(?<![\\w])@[\\w-]+",
54201
+ match: String.raw`(?<![\w])@[\w-]+`,
54111
54202
  name: "entity.name.tag.matcher.caddyfile"
54112
54203
  },
54113
54204
  number: {
54114
- match: "\\b\\d+(?:\\.\\d+)?\\b",
54205
+ match: String.raw`\b\d+(?:\.\d+)?\b`,
54115
54206
  name: "constant.numeric.caddyfile"
54116
54207
  },
54117
54208
  placeholder: {
54118
- match: "\\{[$%]?[\\w.>/:-]+\\}",
54209
+ match: String.raw`\{[$%]?[\w.>/:-]+\}`,
54119
54210
  name: "constant.other.placeholder.caddyfile"
54120
54211
  },
54121
54212
  punctuation: {
@@ -54123,7 +54214,7 @@ var init_caddyfile = __esm(() => {
54123
54214
  name: "punctuation.section.block.caddyfile"
54124
54215
  },
54125
54216
  "site-address": {
54126
- match: "^(?=\\S)(?:[^\\s{#,]*[.:*/][^\\s{#,]*)(?:\\s*,\\s*[^\\s{#,]+)*(?=\\s*\\{\\s*$)",
54217
+ match: String.raw`^(?=\S)(?:[^\s{#,]*[.:*/][^\s{#,]*)(?:\s*,\s*[^\s{#,]+)*(?=\s*\{\s*$)`,
54127
54218
  name: "entity.name.type.address.caddyfile"
54128
54219
  },
54129
54220
  string: {
@@ -54132,7 +54223,7 @@ var init_caddyfile = __esm(() => {
54132
54223
  begin: '"',
54133
54224
  end: '"',
54134
54225
  name: "string.quoted.double.caddyfile",
54135
- patterns: [{ match: "\\\\.", name: "constant.character.escape.caddyfile" }]
54226
+ patterns: [{ match: String.raw`\\.`, name: "constant.character.escape.caddyfile" }]
54136
54227
  },
54137
54228
  { begin: "`", end: "`", name: "string.quoted.other.caddyfile" }
54138
54229
  ]
package/dist/serialize.js CHANGED
@@ -9716,16 +9716,43 @@ function color(d) {
9716
9716
  }
9717
9717
 
9718
9718
  // ../../node_modules/unist-util-visit/node_modules/unist-util-visit-parents/lib/index.js
9719
- function visitParents(tree, test, visitor, reverse) {
9719
+ function visitParents(tree, testOrEnterOrVisitors, enterOrVisitorsOrReverse, reverse) {
9720
+ if (!tree || typeof tree !== "object") {
9721
+ throw new Error("Unexpected value `" + tree + "` for `tree`, expected node");
9722
+ }
9723
+ let preorder = true;
9720
9724
  let check;
9721
- if (typeof test === "function" && typeof visitor !== "function") {
9722
- reverse = visitor;
9723
- visitor = test;
9725
+ let visitors;
9726
+ let enter;
9727
+ let exit;
9728
+ if (typeof enterOrVisitorsOrReverse === "function" || enterOrVisitorsOrReverse && typeof enterOrVisitorsOrReverse === "object") {
9729
+ check = testOrEnterOrVisitors;
9730
+ visitors = enterOrVisitorsOrReverse;
9731
+ if (reverse)
9732
+ preorder = false;
9724
9733
  } else {
9725
- check = test;
9734
+ visitors = testOrEnterOrVisitors;
9735
+ if (enterOrVisitorsOrReverse)
9736
+ preorder = false;
9737
+ }
9738
+ if (typeof visitors === "function") {
9739
+ enter = visitors;
9740
+ } else if (visitors && typeof visitors === "object") {
9741
+ if (visitors.enter === null || visitors.enter === undefined) {} else if (typeof visitors.enter === "function") {
9742
+ enter = visitors.enter;
9743
+ } else {
9744
+ throw new Error("Unexpected value `" + visitors.enter + "` for `visitors.enter`, expected optional visitor");
9745
+ }
9746
+ if (typeof visitors.exit === "function") {
9747
+ exit = visitors.exit;
9748
+ } else {
9749
+ throw new Error("Unexpected value `" + visitors.exit + "` for `visitors.exit`, expected visitor (pass a visitor directly if you only want an enter visitor)");
9750
+ }
9751
+ } else {
9752
+ throw new Error("Unexpected value `" + visitors + "` for `enter` or `visitors`, expected visitor or object with visitors");
9726
9753
  }
9727
9754
  const is = convert(check);
9728
- const step = reverse ? -1 : 1;
9755
+ const step = preorder ? 1 : -1;
9729
9756
  factory(tree, undefined, [])();
9730
9757
  function factory(node, index, parents) {
9731
9758
  const value = node && typeof node === "object" ? node : {};
@@ -9737,12 +9764,10 @@ function visitParents(tree, test, visitor, reverse) {
9737
9764
  }
9738
9765
  return visit;
9739
9766
  function visit() {
9767
+ const matches = !check || is(node, index, parents[parents.length - 1] || undefined);
9740
9768
  let result = empty;
9741
- let subresult;
9742
- let offset;
9743
- let grandparents;
9744
- if (!test || is(node, index, parents[parents.length - 1] || undefined)) {
9745
- result = toResult(visitor(node, parents));
9769
+ if (enter && matches) {
9770
+ result = toResult(enter(node, parents, index));
9746
9771
  if (result[0] === EXIT) {
9747
9772
  return result;
9748
9773
  }
@@ -9750,11 +9775,11 @@ function visitParents(tree, test, visitor, reverse) {
9750
9775
  if ("children" in node && node.children) {
9751
9776
  const nodeAsParent = node;
9752
9777
  if (nodeAsParent.children && result[0] !== SKIP) {
9753
- offset = (reverse ? nodeAsParent.children.length : -1) + step;
9754
- grandparents = parents.concat(nodeAsParent);
9778
+ let offset = (preorder ? -1 : nodeAsParent.children.length) + step;
9779
+ const grandparents = [...parents, nodeAsParent];
9755
9780
  while (offset > -1 && offset < nodeAsParent.children.length) {
9756
9781
  const child = nodeAsParent.children[offset];
9757
- subresult = factory(child, offset, grandparents)();
9782
+ const subresult = factory(child, offset, grandparents)();
9758
9783
  if (subresult[0] === EXIT) {
9759
9784
  return subresult;
9760
9785
  }
@@ -9762,6 +9787,15 @@ function visitParents(tree, test, visitor, reverse) {
9762
9787
  }
9763
9788
  }
9764
9789
  }
9790
+ if (exit && matches) {
9791
+ const exitResult = toResult(exit(node, parents, index));
9792
+ if (exitResult[0] === SKIP) {
9793
+ throw new Error("Unexpected value `" + exitResult[0] + "` from `exit`, expected `CONTINUE`, `EXIT`, index, or nothing");
9794
+ }
9795
+ if (exitResult[0] === EXIT || typeof exitResult[1] === "number") {
9796
+ return exitResult;
9797
+ }
9798
+ }
9765
9799
  return result;
9766
9800
  }
9767
9801
  }
@@ -9787,24 +9821,36 @@ var init_unist_util_visit_parents = __esm(() => {
9787
9821
  });
9788
9822
 
9789
9823
  // ../../node_modules/unist-util-visit/lib/index.js
9790
- function visit(tree, testOrVisitor, visitorOrReverse, maybeReverse) {
9824
+ function visit(tree, testOrEnterOrVisitors, enterOrVisitorsOrReverse, maybeReverse) {
9825
+ let check;
9826
+ let visitors;
9791
9827
  let reverse;
9792
- let test;
9793
- let visitor;
9794
- if (typeof testOrVisitor === "function" && typeof visitorOrReverse !== "function") {
9795
- test = undefined;
9796
- visitor = testOrVisitor;
9797
- reverse = visitorOrReverse;
9798
- } else {
9799
- test = testOrVisitor;
9800
- visitor = visitorOrReverse;
9828
+ if (typeof enterOrVisitorsOrReverse === "function" || enterOrVisitorsOrReverse && typeof enterOrVisitorsOrReverse === "object") {
9829
+ check = testOrEnterOrVisitors;
9830
+ visitors = enterOrVisitorsOrReverse;
9801
9831
  reverse = maybeReverse;
9832
+ } else {
9833
+ visitors = testOrEnterOrVisitors;
9834
+ reverse = enterOrVisitorsOrReverse;
9802
9835
  }
9803
- visitParents(tree, test, overload, reverse);
9804
- function overload(node, parents) {
9805
- const parent = parents[parents.length - 1];
9806
- const index = parent ? parent.children.indexOf(node) : undefined;
9807
- return visitor(node, index, parent);
9836
+ if (typeof visitors === "function") {
9837
+ visitParents(tree, check, wrap2(visitors), reverse);
9838
+ } else {
9839
+ visitParents(tree, check, wrapVisitors(visitors), reverse);
9840
+ }
9841
+ }
9842
+ function wrapVisitors(visitors) {
9843
+ if (!visitors || typeof visitors !== "object")
9844
+ return visitors;
9845
+ return {
9846
+ enter: typeof visitors.enter === "function" ? wrap2(visitors.enter) : visitors.enter,
9847
+ exit: typeof visitors.exit === "function" ? wrap2(visitors.exit) : visitors.exit
9848
+ };
9849
+ }
9850
+ function wrap2(visitor) {
9851
+ return overload;
9852
+ function overload(node, parents, index) {
9853
+ return visitor(node, index, parents[parents.length - 1]);
9808
9854
  }
9809
9855
  }
9810
9856
  var init_lib9 = __esm(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jxsuite/parser",
3
- "version": "4.0.1",
3
+ "version": "4.1.1",
4
4
  "description": "Jx markdown parser and external class integration",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -48,8 +48,8 @@
48
48
  "upgrade": "bun update --latest && bun install"
49
49
  },
50
50
  "dependencies": {
51
- "@jxsuite/markup": "^1.0.0",
52
- "@jxsuite/schema": "^4.0.0",
51
+ "@jxsuite/markup": "^1.0.1",
52
+ "@jxsuite/schema": "^4.1.0",
53
53
  "@shikijs/langs": "^4.5.0",
54
54
  "@shikijs/themes": "^4.5.0",
55
55
  "glob": "^13.0.6",
@@ -62,12 +62,12 @@
62
62
  "remark-stringify": "^11.0.0",
63
63
  "shiki": "^4.5.0",
64
64
  "unified": "^11.0.5",
65
- "unist-util-visit": "^5.1.0",
65
+ "unist-util-visit": "^5.2.0",
66
66
  "yaml": "^2.9.1"
67
67
  },
68
68
  "devDependencies": {
69
- "@happy-dom/global-registrator": "^21.0.3",
70
- "@jxsuite/runtime": "^5.1.0",
69
+ "@happy-dom/global-registrator": "^21.0.4",
70
+ "@jxsuite/runtime": "^6.0.0",
71
71
  "@jxsuite/test-support": "^0.0.0",
72
72
  "@types/mdast": "^4.0.4",
73
73
  "ajv": "^8.20.0"
@@ -32,33 +32,33 @@ export const caddyfile: LanguageRegistration = {
32
32
  ],
33
33
  repository: {
34
34
  comment: {
35
- match: "(?:^|(?<=\\s))#.*$",
35
+ match: String.raw`(?:^|(?<=\s))#.*$`,
36
36
  name: "comment.line.number-sign.caddyfile",
37
37
  },
38
38
  constant: {
39
- match: "\\b(?:on|off|true|false|h1|h2|h2c|h3)\\b",
39
+ match: String.raw`\b(?:on|off|true|false|h1|h2|h2c|h3)\b`,
40
40
  name: "constant.language.caddyfile",
41
41
  },
42
42
  directive: {
43
43
  /* The first word of a line is a directive or subdirective. A word that carries a dot or a
44
44
  colon straight after it (`example.com`, `http://…`) is a site address, not a directive. */
45
- match: "^\\s*([A-Za-z_][\\w]*)(?=\\s|$)",
45
+ match: String.raw`^\s*([A-Za-z_][\w]*)(?=\s|$)`,
46
46
  captures: { "1": { name: "entity.name.function.directive.caddyfile" } },
47
47
  },
48
48
  duration: {
49
- match: "\\b\\d+(?:\\.\\d+)?(?:ns|us|ms|s|m|h|d)\\b",
49
+ match: String.raw`\b\d+(?:\.\d+)?(?:ns|us|ms|s|m|h|d)\b`,
50
50
  name: "constant.numeric.duration.caddyfile",
51
51
  },
52
52
  matcher: {
53
- match: "(?<![\\w])@[\\w-]+",
53
+ match: String.raw`(?<![\w])@[\w-]+`,
54
54
  name: "entity.name.tag.matcher.caddyfile",
55
55
  },
56
56
  number: {
57
- match: "\\b\\d+(?:\\.\\d+)?\\b",
57
+ match: String.raw`\b\d+(?:\.\d+)?\b`,
58
58
  name: "constant.numeric.caddyfile",
59
59
  },
60
60
  placeholder: {
61
- match: "\\{[$%]?[\\w.>/:-]+\\}",
61
+ match: String.raw`\{[$%]?[\w.>/:-]+\}`,
62
62
  name: "constant.other.placeholder.caddyfile",
63
63
  },
64
64
  punctuation: {
@@ -67,7 +67,7 @@ export const caddyfile: LanguageRegistration = {
67
67
  },
68
68
  "site-address": {
69
69
  // A column-0 line that opens a block and names a host, a port or a wildcard.
70
- match: "^(?=\\S)(?:[^\\s{#,]*[.:*/][^\\s{#,]*)(?:\\s*,\\s*[^\\s{#,]+)*(?=\\s*\\{\\s*$)",
70
+ match: String.raw`^(?=\S)(?:[^\s{#,]*[.:*/][^\s{#,]*)(?:\s*,\s*[^\s{#,]+)*(?=\s*\{\s*$)`,
71
71
  name: "entity.name.type.address.caddyfile",
72
72
  },
73
73
  string: {
@@ -76,7 +76,7 @@ export const caddyfile: LanguageRegistration = {
76
76
  begin: '"',
77
77
  end: '"',
78
78
  name: "string.quoted.double.caddyfile",
79
- patterns: [{ match: "\\\\.", name: "constant.character.escape.caddyfile" }],
79
+ patterns: [{ match: String.raw`\\.`, name: "constant.character.escape.caddyfile" }],
80
80
  },
81
81
  { begin: "`", end: "`", name: "string.quoted.other.caddyfile" },
82
82
  ],