@ts-for-gir/cli 4.0.0-beta.41 → 4.0.0-beta.42
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/bin/ts-for-gir +2092 -113
- package/package.json +10 -10
package/bin/ts-for-gir
CHANGED
|
@@ -3353,7 +3353,7 @@ var require_lodash = __commonJS({
|
|
|
3353
3353
|
}
|
|
3354
3354
|
return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
|
|
3355
3355
|
});
|
|
3356
|
-
function
|
|
3356
|
+
function join16(array, separator) {
|
|
3357
3357
|
return array == null ? "" : nativeJoin.call(array, separator);
|
|
3358
3358
|
}
|
|
3359
3359
|
function last(array) {
|
|
@@ -4178,7 +4178,7 @@ var require_lodash = __commonJS({
|
|
|
4178
4178
|
customizer = typeof customizer == "function" ? customizer : undefined2;
|
|
4179
4179
|
return baseIsMatch(object, source, getMatchData(source), customizer);
|
|
4180
4180
|
}
|
|
4181
|
-
function
|
|
4181
|
+
function isNaN2(value) {
|
|
4182
4182
|
return isNumber(value) && value != +value;
|
|
4183
4183
|
}
|
|
4184
4184
|
function isNative(value) {
|
|
@@ -5255,7 +5255,7 @@ var require_lodash = __commonJS({
|
|
|
5255
5255
|
lodash2.isMap = isMap;
|
|
5256
5256
|
lodash2.isMatch = isMatch;
|
|
5257
5257
|
lodash2.isMatchWith = isMatchWith;
|
|
5258
|
-
lodash2.isNaN =
|
|
5258
|
+
lodash2.isNaN = isNaN2;
|
|
5259
5259
|
lodash2.isNative = isNative;
|
|
5260
5260
|
lodash2.isNil = isNil;
|
|
5261
5261
|
lodash2.isNull = isNull;
|
|
@@ -5272,7 +5272,7 @@ var require_lodash = __commonJS({
|
|
|
5272
5272
|
lodash2.isUndefined = isUndefined;
|
|
5273
5273
|
lodash2.isWeakMap = isWeakMap;
|
|
5274
5274
|
lodash2.isWeakSet = isWeakSet;
|
|
5275
|
-
lodash2.join =
|
|
5275
|
+
lodash2.join = join16;
|
|
5276
5276
|
lodash2.kebabCase = kebabCase;
|
|
5277
5277
|
lodash2.last = last;
|
|
5278
5278
|
lodash2.lastIndexOf = lastIndexOf;
|
|
@@ -5529,6 +5529,1737 @@ var require_lodash = __commonJS({
|
|
|
5529
5529
|
}
|
|
5530
5530
|
});
|
|
5531
5531
|
|
|
5532
|
+
// ../../.yarn/cache/lunr-npm-2.3.9-fa3aa9c2d6-f2f6db34c0.zip/node_modules/lunr/lunr.js
|
|
5533
|
+
var require_lunr = __commonJS({
|
|
5534
|
+
"../../.yarn/cache/lunr-npm-2.3.9-fa3aa9c2d6-f2f6db34c0.zip/node_modules/lunr/lunr.js"(exports2, module) {
|
|
5535
|
+
(function() {
|
|
5536
|
+
var lunr2 = function(config) {
|
|
5537
|
+
var builder7 = new lunr2.Builder();
|
|
5538
|
+
builder7.pipeline.add(
|
|
5539
|
+
lunr2.trimmer,
|
|
5540
|
+
lunr2.stopWordFilter,
|
|
5541
|
+
lunr2.stemmer
|
|
5542
|
+
);
|
|
5543
|
+
builder7.searchPipeline.add(
|
|
5544
|
+
lunr2.stemmer
|
|
5545
|
+
);
|
|
5546
|
+
config.call(builder7, builder7);
|
|
5547
|
+
return builder7.build();
|
|
5548
|
+
};
|
|
5549
|
+
lunr2.version = "2.3.9";
|
|
5550
|
+
lunr2.utils = {};
|
|
5551
|
+
lunr2.utils.warn = /* @__PURE__ */ (function(global2) {
|
|
5552
|
+
return function(message) {
|
|
5553
|
+
if (global2.console && console.warn) {
|
|
5554
|
+
console.warn(message);
|
|
5555
|
+
}
|
|
5556
|
+
};
|
|
5557
|
+
})(this);
|
|
5558
|
+
lunr2.utils.asString = function(obj) {
|
|
5559
|
+
if (obj === void 0 || obj === null) {
|
|
5560
|
+
return "";
|
|
5561
|
+
} else {
|
|
5562
|
+
return obj.toString();
|
|
5563
|
+
}
|
|
5564
|
+
};
|
|
5565
|
+
lunr2.utils.clone = function(obj) {
|
|
5566
|
+
if (obj === null || obj === void 0) {
|
|
5567
|
+
return obj;
|
|
5568
|
+
}
|
|
5569
|
+
var clone2 = /* @__PURE__ */ Object.create(null), keys = Object.keys(obj);
|
|
5570
|
+
for (var i = 0; i < keys.length; i++) {
|
|
5571
|
+
var key = keys[i], val = obj[key];
|
|
5572
|
+
if (Array.isArray(val)) {
|
|
5573
|
+
clone2[key] = val.slice();
|
|
5574
|
+
continue;
|
|
5575
|
+
}
|
|
5576
|
+
if (typeof val === "string" || typeof val === "number" || typeof val === "boolean") {
|
|
5577
|
+
clone2[key] = val;
|
|
5578
|
+
continue;
|
|
5579
|
+
}
|
|
5580
|
+
throw new TypeError("clone is not deep and does not support nested objects");
|
|
5581
|
+
}
|
|
5582
|
+
return clone2;
|
|
5583
|
+
};
|
|
5584
|
+
lunr2.FieldRef = function(docRef, fieldName, stringValue) {
|
|
5585
|
+
this.docRef = docRef;
|
|
5586
|
+
this.fieldName = fieldName;
|
|
5587
|
+
this._stringValue = stringValue;
|
|
5588
|
+
};
|
|
5589
|
+
lunr2.FieldRef.joiner = "/";
|
|
5590
|
+
lunr2.FieldRef.fromString = function(s) {
|
|
5591
|
+
var n = s.indexOf(lunr2.FieldRef.joiner);
|
|
5592
|
+
if (n === -1) {
|
|
5593
|
+
throw "malformed field ref string";
|
|
5594
|
+
}
|
|
5595
|
+
var fieldRef = s.slice(0, n), docRef = s.slice(n + 1);
|
|
5596
|
+
return new lunr2.FieldRef(docRef, fieldRef, s);
|
|
5597
|
+
};
|
|
5598
|
+
lunr2.FieldRef.prototype.toString = function() {
|
|
5599
|
+
if (this._stringValue == void 0) {
|
|
5600
|
+
this._stringValue = this.fieldName + lunr2.FieldRef.joiner + this.docRef;
|
|
5601
|
+
}
|
|
5602
|
+
return this._stringValue;
|
|
5603
|
+
};
|
|
5604
|
+
lunr2.Set = function(elements) {
|
|
5605
|
+
this.elements = /* @__PURE__ */ Object.create(null);
|
|
5606
|
+
if (elements) {
|
|
5607
|
+
this.length = elements.length;
|
|
5608
|
+
for (var i = 0; i < this.length; i++) {
|
|
5609
|
+
this.elements[elements[i]] = true;
|
|
5610
|
+
}
|
|
5611
|
+
} else {
|
|
5612
|
+
this.length = 0;
|
|
5613
|
+
}
|
|
5614
|
+
};
|
|
5615
|
+
lunr2.Set.complete = {
|
|
5616
|
+
intersect: function(other) {
|
|
5617
|
+
return other;
|
|
5618
|
+
},
|
|
5619
|
+
union: function() {
|
|
5620
|
+
return this;
|
|
5621
|
+
},
|
|
5622
|
+
contains: function() {
|
|
5623
|
+
return true;
|
|
5624
|
+
}
|
|
5625
|
+
};
|
|
5626
|
+
lunr2.Set.empty = {
|
|
5627
|
+
intersect: function() {
|
|
5628
|
+
return this;
|
|
5629
|
+
},
|
|
5630
|
+
union: function(other) {
|
|
5631
|
+
return other;
|
|
5632
|
+
},
|
|
5633
|
+
contains: function() {
|
|
5634
|
+
return false;
|
|
5635
|
+
}
|
|
5636
|
+
};
|
|
5637
|
+
lunr2.Set.prototype.contains = function(object) {
|
|
5638
|
+
return !!this.elements[object];
|
|
5639
|
+
};
|
|
5640
|
+
lunr2.Set.prototype.intersect = function(other) {
|
|
5641
|
+
var a, b, elements, intersection = [];
|
|
5642
|
+
if (other === lunr2.Set.complete) {
|
|
5643
|
+
return this;
|
|
5644
|
+
}
|
|
5645
|
+
if (other === lunr2.Set.empty) {
|
|
5646
|
+
return other;
|
|
5647
|
+
}
|
|
5648
|
+
if (this.length < other.length) {
|
|
5649
|
+
a = this;
|
|
5650
|
+
b = other;
|
|
5651
|
+
} else {
|
|
5652
|
+
a = other;
|
|
5653
|
+
b = this;
|
|
5654
|
+
}
|
|
5655
|
+
elements = Object.keys(a.elements);
|
|
5656
|
+
for (var i = 0; i < elements.length; i++) {
|
|
5657
|
+
var element = elements[i];
|
|
5658
|
+
if (element in b.elements) {
|
|
5659
|
+
intersection.push(element);
|
|
5660
|
+
}
|
|
5661
|
+
}
|
|
5662
|
+
return new lunr2.Set(intersection);
|
|
5663
|
+
};
|
|
5664
|
+
lunr2.Set.prototype.union = function(other) {
|
|
5665
|
+
if (other === lunr2.Set.complete) {
|
|
5666
|
+
return lunr2.Set.complete;
|
|
5667
|
+
}
|
|
5668
|
+
if (other === lunr2.Set.empty) {
|
|
5669
|
+
return this;
|
|
5670
|
+
}
|
|
5671
|
+
return new lunr2.Set(Object.keys(this.elements).concat(Object.keys(other.elements)));
|
|
5672
|
+
};
|
|
5673
|
+
lunr2.idf = function(posting, documentCount) {
|
|
5674
|
+
var documentsWithTerm = 0;
|
|
5675
|
+
for (var fieldName in posting) {
|
|
5676
|
+
if (fieldName == "_index") continue;
|
|
5677
|
+
documentsWithTerm += Object.keys(posting[fieldName]).length;
|
|
5678
|
+
}
|
|
5679
|
+
var x = (documentCount - documentsWithTerm + 0.5) / (documentsWithTerm + 0.5);
|
|
5680
|
+
return Math.log(1 + Math.abs(x));
|
|
5681
|
+
};
|
|
5682
|
+
lunr2.Token = function(str, metadata) {
|
|
5683
|
+
this.str = str || "";
|
|
5684
|
+
this.metadata = metadata || {};
|
|
5685
|
+
};
|
|
5686
|
+
lunr2.Token.prototype.toString = function() {
|
|
5687
|
+
return this.str;
|
|
5688
|
+
};
|
|
5689
|
+
lunr2.Token.prototype.update = function(fn) {
|
|
5690
|
+
this.str = fn(this.str, this.metadata);
|
|
5691
|
+
return this;
|
|
5692
|
+
};
|
|
5693
|
+
lunr2.Token.prototype.clone = function(fn) {
|
|
5694
|
+
fn = fn || function(s) {
|
|
5695
|
+
return s;
|
|
5696
|
+
};
|
|
5697
|
+
return new lunr2.Token(fn(this.str, this.metadata), this.metadata);
|
|
5698
|
+
};
|
|
5699
|
+
lunr2.tokenizer = function(obj, metadata) {
|
|
5700
|
+
if (obj == null || obj == void 0) {
|
|
5701
|
+
return [];
|
|
5702
|
+
}
|
|
5703
|
+
if (Array.isArray(obj)) {
|
|
5704
|
+
return obj.map(function(t) {
|
|
5705
|
+
return new lunr2.Token(
|
|
5706
|
+
lunr2.utils.asString(t).toLowerCase(),
|
|
5707
|
+
lunr2.utils.clone(metadata)
|
|
5708
|
+
);
|
|
5709
|
+
});
|
|
5710
|
+
}
|
|
5711
|
+
var str = obj.toString().toLowerCase(), len = str.length, tokens = [];
|
|
5712
|
+
for (var sliceEnd = 0, sliceStart = 0; sliceEnd <= len; sliceEnd++) {
|
|
5713
|
+
var char = str.charAt(sliceEnd), sliceLength = sliceEnd - sliceStart;
|
|
5714
|
+
if (char.match(lunr2.tokenizer.separator) || sliceEnd == len) {
|
|
5715
|
+
if (sliceLength > 0) {
|
|
5716
|
+
var tokenMetadata = lunr2.utils.clone(metadata) || {};
|
|
5717
|
+
tokenMetadata["position"] = [sliceStart, sliceLength];
|
|
5718
|
+
tokenMetadata["index"] = tokens.length;
|
|
5719
|
+
tokens.push(
|
|
5720
|
+
new lunr2.Token(
|
|
5721
|
+
str.slice(sliceStart, sliceEnd),
|
|
5722
|
+
tokenMetadata
|
|
5723
|
+
)
|
|
5724
|
+
);
|
|
5725
|
+
}
|
|
5726
|
+
sliceStart = sliceEnd + 1;
|
|
5727
|
+
}
|
|
5728
|
+
}
|
|
5729
|
+
return tokens;
|
|
5730
|
+
};
|
|
5731
|
+
lunr2.tokenizer.separator = /[\s\-]+/;
|
|
5732
|
+
lunr2.Pipeline = function() {
|
|
5733
|
+
this._stack = [];
|
|
5734
|
+
};
|
|
5735
|
+
lunr2.Pipeline.registeredFunctions = /* @__PURE__ */ Object.create(null);
|
|
5736
|
+
lunr2.Pipeline.registerFunction = function(fn, label) {
|
|
5737
|
+
if (label in this.registeredFunctions) {
|
|
5738
|
+
lunr2.utils.warn("Overwriting existing registered function: " + label);
|
|
5739
|
+
}
|
|
5740
|
+
fn.label = label;
|
|
5741
|
+
lunr2.Pipeline.registeredFunctions[fn.label] = fn;
|
|
5742
|
+
};
|
|
5743
|
+
lunr2.Pipeline.warnIfFunctionNotRegistered = function(fn) {
|
|
5744
|
+
var isRegistered = fn.label && fn.label in this.registeredFunctions;
|
|
5745
|
+
if (!isRegistered) {
|
|
5746
|
+
lunr2.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n", fn);
|
|
5747
|
+
}
|
|
5748
|
+
};
|
|
5749
|
+
lunr2.Pipeline.load = function(serialised) {
|
|
5750
|
+
var pipeline = new lunr2.Pipeline();
|
|
5751
|
+
serialised.forEach(function(fnName) {
|
|
5752
|
+
var fn = lunr2.Pipeline.registeredFunctions[fnName];
|
|
5753
|
+
if (fn) {
|
|
5754
|
+
pipeline.add(fn);
|
|
5755
|
+
} else {
|
|
5756
|
+
throw new Error("Cannot load unregistered function: " + fnName);
|
|
5757
|
+
}
|
|
5758
|
+
});
|
|
5759
|
+
return pipeline;
|
|
5760
|
+
};
|
|
5761
|
+
lunr2.Pipeline.prototype.add = function() {
|
|
5762
|
+
var fns = Array.prototype.slice.call(arguments);
|
|
5763
|
+
fns.forEach(function(fn) {
|
|
5764
|
+
lunr2.Pipeline.warnIfFunctionNotRegistered(fn);
|
|
5765
|
+
this._stack.push(fn);
|
|
5766
|
+
}, this);
|
|
5767
|
+
};
|
|
5768
|
+
lunr2.Pipeline.prototype.after = function(existingFn, newFn) {
|
|
5769
|
+
lunr2.Pipeline.warnIfFunctionNotRegistered(newFn);
|
|
5770
|
+
var pos = this._stack.indexOf(existingFn);
|
|
5771
|
+
if (pos == -1) {
|
|
5772
|
+
throw new Error("Cannot find existingFn");
|
|
5773
|
+
}
|
|
5774
|
+
pos = pos + 1;
|
|
5775
|
+
this._stack.splice(pos, 0, newFn);
|
|
5776
|
+
};
|
|
5777
|
+
lunr2.Pipeline.prototype.before = function(existingFn, newFn) {
|
|
5778
|
+
lunr2.Pipeline.warnIfFunctionNotRegistered(newFn);
|
|
5779
|
+
var pos = this._stack.indexOf(existingFn);
|
|
5780
|
+
if (pos == -1) {
|
|
5781
|
+
throw new Error("Cannot find existingFn");
|
|
5782
|
+
}
|
|
5783
|
+
this._stack.splice(pos, 0, newFn);
|
|
5784
|
+
};
|
|
5785
|
+
lunr2.Pipeline.prototype.remove = function(fn) {
|
|
5786
|
+
var pos = this._stack.indexOf(fn);
|
|
5787
|
+
if (pos == -1) {
|
|
5788
|
+
return;
|
|
5789
|
+
}
|
|
5790
|
+
this._stack.splice(pos, 1);
|
|
5791
|
+
};
|
|
5792
|
+
lunr2.Pipeline.prototype.run = function(tokens) {
|
|
5793
|
+
var stackLength = this._stack.length;
|
|
5794
|
+
for (var i = 0; i < stackLength; i++) {
|
|
5795
|
+
var fn = this._stack[i];
|
|
5796
|
+
var memo = [];
|
|
5797
|
+
for (var j = 0; j < tokens.length; j++) {
|
|
5798
|
+
var result = fn(tokens[j], j, tokens);
|
|
5799
|
+
if (result === null || result === void 0 || result === "") continue;
|
|
5800
|
+
if (Array.isArray(result)) {
|
|
5801
|
+
for (var k = 0; k < result.length; k++) {
|
|
5802
|
+
memo.push(result[k]);
|
|
5803
|
+
}
|
|
5804
|
+
} else {
|
|
5805
|
+
memo.push(result);
|
|
5806
|
+
}
|
|
5807
|
+
}
|
|
5808
|
+
tokens = memo;
|
|
5809
|
+
}
|
|
5810
|
+
return tokens;
|
|
5811
|
+
};
|
|
5812
|
+
lunr2.Pipeline.prototype.runString = function(str, metadata) {
|
|
5813
|
+
var token = new lunr2.Token(str, metadata);
|
|
5814
|
+
return this.run([token]).map(function(t) {
|
|
5815
|
+
return t.toString();
|
|
5816
|
+
});
|
|
5817
|
+
};
|
|
5818
|
+
lunr2.Pipeline.prototype.reset = function() {
|
|
5819
|
+
this._stack = [];
|
|
5820
|
+
};
|
|
5821
|
+
lunr2.Pipeline.prototype.toJSON = function() {
|
|
5822
|
+
return this._stack.map(function(fn) {
|
|
5823
|
+
lunr2.Pipeline.warnIfFunctionNotRegistered(fn);
|
|
5824
|
+
return fn.label;
|
|
5825
|
+
});
|
|
5826
|
+
};
|
|
5827
|
+
lunr2.Vector = function(elements) {
|
|
5828
|
+
this._magnitude = 0;
|
|
5829
|
+
this.elements = elements || [];
|
|
5830
|
+
};
|
|
5831
|
+
lunr2.Vector.prototype.positionForIndex = function(index) {
|
|
5832
|
+
if (this.elements.length == 0) {
|
|
5833
|
+
return 0;
|
|
5834
|
+
}
|
|
5835
|
+
var start = 0, end = this.elements.length / 2, sliceLength = end - start, pivotPoint = Math.floor(sliceLength / 2), pivotIndex = this.elements[pivotPoint * 2];
|
|
5836
|
+
while (sliceLength > 1) {
|
|
5837
|
+
if (pivotIndex < index) {
|
|
5838
|
+
start = pivotPoint;
|
|
5839
|
+
}
|
|
5840
|
+
if (pivotIndex > index) {
|
|
5841
|
+
end = pivotPoint;
|
|
5842
|
+
}
|
|
5843
|
+
if (pivotIndex == index) {
|
|
5844
|
+
break;
|
|
5845
|
+
}
|
|
5846
|
+
sliceLength = end - start;
|
|
5847
|
+
pivotPoint = start + Math.floor(sliceLength / 2);
|
|
5848
|
+
pivotIndex = this.elements[pivotPoint * 2];
|
|
5849
|
+
}
|
|
5850
|
+
if (pivotIndex == index) {
|
|
5851
|
+
return pivotPoint * 2;
|
|
5852
|
+
}
|
|
5853
|
+
if (pivotIndex > index) {
|
|
5854
|
+
return pivotPoint * 2;
|
|
5855
|
+
}
|
|
5856
|
+
if (pivotIndex < index) {
|
|
5857
|
+
return (pivotPoint + 1) * 2;
|
|
5858
|
+
}
|
|
5859
|
+
};
|
|
5860
|
+
lunr2.Vector.prototype.insert = function(insertIdx, val) {
|
|
5861
|
+
this.upsert(insertIdx, val, function() {
|
|
5862
|
+
throw "duplicate index";
|
|
5863
|
+
});
|
|
5864
|
+
};
|
|
5865
|
+
lunr2.Vector.prototype.upsert = function(insertIdx, val, fn) {
|
|
5866
|
+
this._magnitude = 0;
|
|
5867
|
+
var position = this.positionForIndex(insertIdx);
|
|
5868
|
+
if (this.elements[position] == insertIdx) {
|
|
5869
|
+
this.elements[position + 1] = fn(this.elements[position + 1], val);
|
|
5870
|
+
} else {
|
|
5871
|
+
this.elements.splice(position, 0, insertIdx, val);
|
|
5872
|
+
}
|
|
5873
|
+
};
|
|
5874
|
+
lunr2.Vector.prototype.magnitude = function() {
|
|
5875
|
+
if (this._magnitude) return this._magnitude;
|
|
5876
|
+
var sumOfSquares = 0, elementsLength = this.elements.length;
|
|
5877
|
+
for (var i = 1; i < elementsLength; i += 2) {
|
|
5878
|
+
var val = this.elements[i];
|
|
5879
|
+
sumOfSquares += val * val;
|
|
5880
|
+
}
|
|
5881
|
+
return this._magnitude = Math.sqrt(sumOfSquares);
|
|
5882
|
+
};
|
|
5883
|
+
lunr2.Vector.prototype.dot = function(otherVector) {
|
|
5884
|
+
var dotProduct = 0, a = this.elements, b = otherVector.elements, aLen = a.length, bLen = b.length, aVal = 0, bVal = 0, i = 0, j = 0;
|
|
5885
|
+
while (i < aLen && j < bLen) {
|
|
5886
|
+
aVal = a[i], bVal = b[j];
|
|
5887
|
+
if (aVal < bVal) {
|
|
5888
|
+
i += 2;
|
|
5889
|
+
} else if (aVal > bVal) {
|
|
5890
|
+
j += 2;
|
|
5891
|
+
} else if (aVal == bVal) {
|
|
5892
|
+
dotProduct += a[i + 1] * b[j + 1];
|
|
5893
|
+
i += 2;
|
|
5894
|
+
j += 2;
|
|
5895
|
+
}
|
|
5896
|
+
}
|
|
5897
|
+
return dotProduct;
|
|
5898
|
+
};
|
|
5899
|
+
lunr2.Vector.prototype.similarity = function(otherVector) {
|
|
5900
|
+
return this.dot(otherVector) / this.magnitude() || 0;
|
|
5901
|
+
};
|
|
5902
|
+
lunr2.Vector.prototype.toArray = function() {
|
|
5903
|
+
var output = new Array(this.elements.length / 2);
|
|
5904
|
+
for (var i = 1, j = 0; i < this.elements.length; i += 2, j++) {
|
|
5905
|
+
output[j] = this.elements[i];
|
|
5906
|
+
}
|
|
5907
|
+
return output;
|
|
5908
|
+
};
|
|
5909
|
+
lunr2.Vector.prototype.toJSON = function() {
|
|
5910
|
+
return this.elements;
|
|
5911
|
+
};
|
|
5912
|
+
lunr2.stemmer = (function() {
|
|
5913
|
+
var step2list = {
|
|
5914
|
+
"ational": "ate",
|
|
5915
|
+
"tional": "tion",
|
|
5916
|
+
"enci": "ence",
|
|
5917
|
+
"anci": "ance",
|
|
5918
|
+
"izer": "ize",
|
|
5919
|
+
"bli": "ble",
|
|
5920
|
+
"alli": "al",
|
|
5921
|
+
"entli": "ent",
|
|
5922
|
+
"eli": "e",
|
|
5923
|
+
"ousli": "ous",
|
|
5924
|
+
"ization": "ize",
|
|
5925
|
+
"ation": "ate",
|
|
5926
|
+
"ator": "ate",
|
|
5927
|
+
"alism": "al",
|
|
5928
|
+
"iveness": "ive",
|
|
5929
|
+
"fulness": "ful",
|
|
5930
|
+
"ousness": "ous",
|
|
5931
|
+
"aliti": "al",
|
|
5932
|
+
"iviti": "ive",
|
|
5933
|
+
"biliti": "ble",
|
|
5934
|
+
"logi": "log"
|
|
5935
|
+
}, step3list = {
|
|
5936
|
+
"icate": "ic",
|
|
5937
|
+
"ative": "",
|
|
5938
|
+
"alize": "al",
|
|
5939
|
+
"iciti": "ic",
|
|
5940
|
+
"ical": "ic",
|
|
5941
|
+
"ful": "",
|
|
5942
|
+
"ness": ""
|
|
5943
|
+
}, c = "[^aeiou]", v = "[aeiouy]", C = c + "[^aeiouy]*", V = v + "[aeiou]*", mgr0 = "^(" + C + ")?" + V + C, meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$", mgr1 = "^(" + C + ")?" + V + C + V + C, s_v = "^(" + C + ")?" + v;
|
|
5944
|
+
var re_mgr0 = new RegExp(mgr0);
|
|
5945
|
+
var re_mgr1 = new RegExp(mgr1);
|
|
5946
|
+
var re_meq1 = new RegExp(meq1);
|
|
5947
|
+
var re_s_v = new RegExp(s_v);
|
|
5948
|
+
var re_1a = /^(.+?)(ss|i)es$/;
|
|
5949
|
+
var re2_1a = /^(.+?)([^s])s$/;
|
|
5950
|
+
var re_1b = /^(.+?)eed$/;
|
|
5951
|
+
var re2_1b = /^(.+?)(ed|ing)$/;
|
|
5952
|
+
var re_1b_2 = /.$/;
|
|
5953
|
+
var re2_1b_2 = /(at|bl|iz)$/;
|
|
5954
|
+
var re3_1b_2 = new RegExp("([^aeiouylsz])\\1$");
|
|
5955
|
+
var re4_1b_2 = new RegExp("^" + C + v + "[^aeiouwxy]$");
|
|
5956
|
+
var re_1c = /^(.+?[^aeiou])y$/;
|
|
5957
|
+
var re_2 = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/;
|
|
5958
|
+
var re_3 = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/;
|
|
5959
|
+
var re_4 = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/;
|
|
5960
|
+
var re2_4 = /^(.+?)(s|t)(ion)$/;
|
|
5961
|
+
var re_5 = /^(.+?)e$/;
|
|
5962
|
+
var re_5_1 = /ll$/;
|
|
5963
|
+
var re3_5 = new RegExp("^" + C + v + "[^aeiouwxy]$");
|
|
5964
|
+
var porterStemmer = function porterStemmer2(w) {
|
|
5965
|
+
var stem, suffix, firstch, re, re2, re3, re4;
|
|
5966
|
+
if (w.length < 3) {
|
|
5967
|
+
return w;
|
|
5968
|
+
}
|
|
5969
|
+
firstch = w.substr(0, 1);
|
|
5970
|
+
if (firstch == "y") {
|
|
5971
|
+
w = firstch.toUpperCase() + w.substr(1);
|
|
5972
|
+
}
|
|
5973
|
+
re = re_1a;
|
|
5974
|
+
re2 = re2_1a;
|
|
5975
|
+
if (re.test(w)) {
|
|
5976
|
+
w = w.replace(re, "$1$2");
|
|
5977
|
+
} else if (re2.test(w)) {
|
|
5978
|
+
w = w.replace(re2, "$1$2");
|
|
5979
|
+
}
|
|
5980
|
+
re = re_1b;
|
|
5981
|
+
re2 = re2_1b;
|
|
5982
|
+
if (re.test(w)) {
|
|
5983
|
+
var fp = re.exec(w);
|
|
5984
|
+
re = re_mgr0;
|
|
5985
|
+
if (re.test(fp[1])) {
|
|
5986
|
+
re = re_1b_2;
|
|
5987
|
+
w = w.replace(re, "");
|
|
5988
|
+
}
|
|
5989
|
+
} else if (re2.test(w)) {
|
|
5990
|
+
var fp = re2.exec(w);
|
|
5991
|
+
stem = fp[1];
|
|
5992
|
+
re2 = re_s_v;
|
|
5993
|
+
if (re2.test(stem)) {
|
|
5994
|
+
w = stem;
|
|
5995
|
+
re2 = re2_1b_2;
|
|
5996
|
+
re3 = re3_1b_2;
|
|
5997
|
+
re4 = re4_1b_2;
|
|
5998
|
+
if (re2.test(w)) {
|
|
5999
|
+
w = w + "e";
|
|
6000
|
+
} else if (re3.test(w)) {
|
|
6001
|
+
re = re_1b_2;
|
|
6002
|
+
w = w.replace(re, "");
|
|
6003
|
+
} else if (re4.test(w)) {
|
|
6004
|
+
w = w + "e";
|
|
6005
|
+
}
|
|
6006
|
+
}
|
|
6007
|
+
}
|
|
6008
|
+
re = re_1c;
|
|
6009
|
+
if (re.test(w)) {
|
|
6010
|
+
var fp = re.exec(w);
|
|
6011
|
+
stem = fp[1];
|
|
6012
|
+
w = stem + "i";
|
|
6013
|
+
}
|
|
6014
|
+
re = re_2;
|
|
6015
|
+
if (re.test(w)) {
|
|
6016
|
+
var fp = re.exec(w);
|
|
6017
|
+
stem = fp[1];
|
|
6018
|
+
suffix = fp[2];
|
|
6019
|
+
re = re_mgr0;
|
|
6020
|
+
if (re.test(stem)) {
|
|
6021
|
+
w = stem + step2list[suffix];
|
|
6022
|
+
}
|
|
6023
|
+
}
|
|
6024
|
+
re = re_3;
|
|
6025
|
+
if (re.test(w)) {
|
|
6026
|
+
var fp = re.exec(w);
|
|
6027
|
+
stem = fp[1];
|
|
6028
|
+
suffix = fp[2];
|
|
6029
|
+
re = re_mgr0;
|
|
6030
|
+
if (re.test(stem)) {
|
|
6031
|
+
w = stem + step3list[suffix];
|
|
6032
|
+
}
|
|
6033
|
+
}
|
|
6034
|
+
re = re_4;
|
|
6035
|
+
re2 = re2_4;
|
|
6036
|
+
if (re.test(w)) {
|
|
6037
|
+
var fp = re.exec(w);
|
|
6038
|
+
stem = fp[1];
|
|
6039
|
+
re = re_mgr1;
|
|
6040
|
+
if (re.test(stem)) {
|
|
6041
|
+
w = stem;
|
|
6042
|
+
}
|
|
6043
|
+
} else if (re2.test(w)) {
|
|
6044
|
+
var fp = re2.exec(w);
|
|
6045
|
+
stem = fp[1] + fp[2];
|
|
6046
|
+
re2 = re_mgr1;
|
|
6047
|
+
if (re2.test(stem)) {
|
|
6048
|
+
w = stem;
|
|
6049
|
+
}
|
|
6050
|
+
}
|
|
6051
|
+
re = re_5;
|
|
6052
|
+
if (re.test(w)) {
|
|
6053
|
+
var fp = re.exec(w);
|
|
6054
|
+
stem = fp[1];
|
|
6055
|
+
re = re_mgr1;
|
|
6056
|
+
re2 = re_meq1;
|
|
6057
|
+
re3 = re3_5;
|
|
6058
|
+
if (re.test(stem) || re2.test(stem) && !re3.test(stem)) {
|
|
6059
|
+
w = stem;
|
|
6060
|
+
}
|
|
6061
|
+
}
|
|
6062
|
+
re = re_5_1;
|
|
6063
|
+
re2 = re_mgr1;
|
|
6064
|
+
if (re.test(w) && re2.test(w)) {
|
|
6065
|
+
re = re_1b_2;
|
|
6066
|
+
w = w.replace(re, "");
|
|
6067
|
+
}
|
|
6068
|
+
if (firstch == "y") {
|
|
6069
|
+
w = firstch.toLowerCase() + w.substr(1);
|
|
6070
|
+
}
|
|
6071
|
+
return w;
|
|
6072
|
+
};
|
|
6073
|
+
return function(token) {
|
|
6074
|
+
return token.update(porterStemmer);
|
|
6075
|
+
};
|
|
6076
|
+
})();
|
|
6077
|
+
lunr2.Pipeline.registerFunction(lunr2.stemmer, "stemmer");
|
|
6078
|
+
lunr2.generateStopWordFilter = function(stopWords) {
|
|
6079
|
+
var words = stopWords.reduce(function(memo, stopWord) {
|
|
6080
|
+
memo[stopWord] = stopWord;
|
|
6081
|
+
return memo;
|
|
6082
|
+
}, {});
|
|
6083
|
+
return function(token) {
|
|
6084
|
+
if (token && words[token.toString()] !== token.toString()) return token;
|
|
6085
|
+
};
|
|
6086
|
+
};
|
|
6087
|
+
lunr2.stopWordFilter = lunr2.generateStopWordFilter([
|
|
6088
|
+
"a",
|
|
6089
|
+
"able",
|
|
6090
|
+
"about",
|
|
6091
|
+
"across",
|
|
6092
|
+
"after",
|
|
6093
|
+
"all",
|
|
6094
|
+
"almost",
|
|
6095
|
+
"also",
|
|
6096
|
+
"am",
|
|
6097
|
+
"among",
|
|
6098
|
+
"an",
|
|
6099
|
+
"and",
|
|
6100
|
+
"any",
|
|
6101
|
+
"are",
|
|
6102
|
+
"as",
|
|
6103
|
+
"at",
|
|
6104
|
+
"be",
|
|
6105
|
+
"because",
|
|
6106
|
+
"been",
|
|
6107
|
+
"but",
|
|
6108
|
+
"by",
|
|
6109
|
+
"can",
|
|
6110
|
+
"cannot",
|
|
6111
|
+
"could",
|
|
6112
|
+
"dear",
|
|
6113
|
+
"did",
|
|
6114
|
+
"do",
|
|
6115
|
+
"does",
|
|
6116
|
+
"either",
|
|
6117
|
+
"else",
|
|
6118
|
+
"ever",
|
|
6119
|
+
"every",
|
|
6120
|
+
"for",
|
|
6121
|
+
"from",
|
|
6122
|
+
"get",
|
|
6123
|
+
"got",
|
|
6124
|
+
"had",
|
|
6125
|
+
"has",
|
|
6126
|
+
"have",
|
|
6127
|
+
"he",
|
|
6128
|
+
"her",
|
|
6129
|
+
"hers",
|
|
6130
|
+
"him",
|
|
6131
|
+
"his",
|
|
6132
|
+
"how",
|
|
6133
|
+
"however",
|
|
6134
|
+
"i",
|
|
6135
|
+
"if",
|
|
6136
|
+
"in",
|
|
6137
|
+
"into",
|
|
6138
|
+
"is",
|
|
6139
|
+
"it",
|
|
6140
|
+
"its",
|
|
6141
|
+
"just",
|
|
6142
|
+
"least",
|
|
6143
|
+
"let",
|
|
6144
|
+
"like",
|
|
6145
|
+
"likely",
|
|
6146
|
+
"may",
|
|
6147
|
+
"me",
|
|
6148
|
+
"might",
|
|
6149
|
+
"most",
|
|
6150
|
+
"must",
|
|
6151
|
+
"my",
|
|
6152
|
+
"neither",
|
|
6153
|
+
"no",
|
|
6154
|
+
"nor",
|
|
6155
|
+
"not",
|
|
6156
|
+
"of",
|
|
6157
|
+
"off",
|
|
6158
|
+
"often",
|
|
6159
|
+
"on",
|
|
6160
|
+
"only",
|
|
6161
|
+
"or",
|
|
6162
|
+
"other",
|
|
6163
|
+
"our",
|
|
6164
|
+
"own",
|
|
6165
|
+
"rather",
|
|
6166
|
+
"said",
|
|
6167
|
+
"say",
|
|
6168
|
+
"says",
|
|
6169
|
+
"she",
|
|
6170
|
+
"should",
|
|
6171
|
+
"since",
|
|
6172
|
+
"so",
|
|
6173
|
+
"some",
|
|
6174
|
+
"than",
|
|
6175
|
+
"that",
|
|
6176
|
+
"the",
|
|
6177
|
+
"their",
|
|
6178
|
+
"them",
|
|
6179
|
+
"then",
|
|
6180
|
+
"there",
|
|
6181
|
+
"these",
|
|
6182
|
+
"they",
|
|
6183
|
+
"this",
|
|
6184
|
+
"tis",
|
|
6185
|
+
"to",
|
|
6186
|
+
"too",
|
|
6187
|
+
"twas",
|
|
6188
|
+
"us",
|
|
6189
|
+
"wants",
|
|
6190
|
+
"was",
|
|
6191
|
+
"we",
|
|
6192
|
+
"were",
|
|
6193
|
+
"what",
|
|
6194
|
+
"when",
|
|
6195
|
+
"where",
|
|
6196
|
+
"which",
|
|
6197
|
+
"while",
|
|
6198
|
+
"who",
|
|
6199
|
+
"whom",
|
|
6200
|
+
"why",
|
|
6201
|
+
"will",
|
|
6202
|
+
"with",
|
|
6203
|
+
"would",
|
|
6204
|
+
"yet",
|
|
6205
|
+
"you",
|
|
6206
|
+
"your"
|
|
6207
|
+
]);
|
|
6208
|
+
lunr2.Pipeline.registerFunction(lunr2.stopWordFilter, "stopWordFilter");
|
|
6209
|
+
lunr2.trimmer = function(token) {
|
|
6210
|
+
return token.update(function(s) {
|
|
6211
|
+
return s.replace(/^\W+/, "").replace(/\W+$/, "");
|
|
6212
|
+
});
|
|
6213
|
+
};
|
|
6214
|
+
lunr2.Pipeline.registerFunction(lunr2.trimmer, "trimmer");
|
|
6215
|
+
lunr2.TokenSet = function() {
|
|
6216
|
+
this.final = false;
|
|
6217
|
+
this.edges = {};
|
|
6218
|
+
this.id = lunr2.TokenSet._nextId;
|
|
6219
|
+
lunr2.TokenSet._nextId += 1;
|
|
6220
|
+
};
|
|
6221
|
+
lunr2.TokenSet._nextId = 1;
|
|
6222
|
+
lunr2.TokenSet.fromArray = function(arr) {
|
|
6223
|
+
var builder7 = new lunr2.TokenSet.Builder();
|
|
6224
|
+
for (var i = 0, len = arr.length; i < len; i++) {
|
|
6225
|
+
builder7.insert(arr[i]);
|
|
6226
|
+
}
|
|
6227
|
+
builder7.finish();
|
|
6228
|
+
return builder7.root;
|
|
6229
|
+
};
|
|
6230
|
+
lunr2.TokenSet.fromClause = function(clause) {
|
|
6231
|
+
if ("editDistance" in clause) {
|
|
6232
|
+
return lunr2.TokenSet.fromFuzzyString(clause.term, clause.editDistance);
|
|
6233
|
+
} else {
|
|
6234
|
+
return lunr2.TokenSet.fromString(clause.term);
|
|
6235
|
+
}
|
|
6236
|
+
};
|
|
6237
|
+
lunr2.TokenSet.fromFuzzyString = function(str, editDistance) {
|
|
6238
|
+
var root = new lunr2.TokenSet();
|
|
6239
|
+
var stack = [{
|
|
6240
|
+
node: root,
|
|
6241
|
+
editsRemaining: editDistance,
|
|
6242
|
+
str
|
|
6243
|
+
}];
|
|
6244
|
+
while (stack.length) {
|
|
6245
|
+
var frame = stack.pop();
|
|
6246
|
+
if (frame.str.length > 0) {
|
|
6247
|
+
var char = frame.str.charAt(0), noEditNode;
|
|
6248
|
+
if (char in frame.node.edges) {
|
|
6249
|
+
noEditNode = frame.node.edges[char];
|
|
6250
|
+
} else {
|
|
6251
|
+
noEditNode = new lunr2.TokenSet();
|
|
6252
|
+
frame.node.edges[char] = noEditNode;
|
|
6253
|
+
}
|
|
6254
|
+
if (frame.str.length == 1) {
|
|
6255
|
+
noEditNode.final = true;
|
|
6256
|
+
}
|
|
6257
|
+
stack.push({
|
|
6258
|
+
node: noEditNode,
|
|
6259
|
+
editsRemaining: frame.editsRemaining,
|
|
6260
|
+
str: frame.str.slice(1)
|
|
6261
|
+
});
|
|
6262
|
+
}
|
|
6263
|
+
if (frame.editsRemaining == 0) {
|
|
6264
|
+
continue;
|
|
6265
|
+
}
|
|
6266
|
+
if ("*" in frame.node.edges) {
|
|
6267
|
+
var insertionNode = frame.node.edges["*"];
|
|
6268
|
+
} else {
|
|
6269
|
+
var insertionNode = new lunr2.TokenSet();
|
|
6270
|
+
frame.node.edges["*"] = insertionNode;
|
|
6271
|
+
}
|
|
6272
|
+
if (frame.str.length == 0) {
|
|
6273
|
+
insertionNode.final = true;
|
|
6274
|
+
}
|
|
6275
|
+
stack.push({
|
|
6276
|
+
node: insertionNode,
|
|
6277
|
+
editsRemaining: frame.editsRemaining - 1,
|
|
6278
|
+
str: frame.str
|
|
6279
|
+
});
|
|
6280
|
+
if (frame.str.length > 1) {
|
|
6281
|
+
stack.push({
|
|
6282
|
+
node: frame.node,
|
|
6283
|
+
editsRemaining: frame.editsRemaining - 1,
|
|
6284
|
+
str: frame.str.slice(1)
|
|
6285
|
+
});
|
|
6286
|
+
}
|
|
6287
|
+
if (frame.str.length == 1) {
|
|
6288
|
+
frame.node.final = true;
|
|
6289
|
+
}
|
|
6290
|
+
if (frame.str.length >= 1) {
|
|
6291
|
+
if ("*" in frame.node.edges) {
|
|
6292
|
+
var substitutionNode = frame.node.edges["*"];
|
|
6293
|
+
} else {
|
|
6294
|
+
var substitutionNode = new lunr2.TokenSet();
|
|
6295
|
+
frame.node.edges["*"] = substitutionNode;
|
|
6296
|
+
}
|
|
6297
|
+
if (frame.str.length == 1) {
|
|
6298
|
+
substitutionNode.final = true;
|
|
6299
|
+
}
|
|
6300
|
+
stack.push({
|
|
6301
|
+
node: substitutionNode,
|
|
6302
|
+
editsRemaining: frame.editsRemaining - 1,
|
|
6303
|
+
str: frame.str.slice(1)
|
|
6304
|
+
});
|
|
6305
|
+
}
|
|
6306
|
+
if (frame.str.length > 1) {
|
|
6307
|
+
var charA = frame.str.charAt(0), charB = frame.str.charAt(1), transposeNode;
|
|
6308
|
+
if (charB in frame.node.edges) {
|
|
6309
|
+
transposeNode = frame.node.edges[charB];
|
|
6310
|
+
} else {
|
|
6311
|
+
transposeNode = new lunr2.TokenSet();
|
|
6312
|
+
frame.node.edges[charB] = transposeNode;
|
|
6313
|
+
}
|
|
6314
|
+
if (frame.str.length == 1) {
|
|
6315
|
+
transposeNode.final = true;
|
|
6316
|
+
}
|
|
6317
|
+
stack.push({
|
|
6318
|
+
node: transposeNode,
|
|
6319
|
+
editsRemaining: frame.editsRemaining - 1,
|
|
6320
|
+
str: charA + frame.str.slice(2)
|
|
6321
|
+
});
|
|
6322
|
+
}
|
|
6323
|
+
}
|
|
6324
|
+
return root;
|
|
6325
|
+
};
|
|
6326
|
+
lunr2.TokenSet.fromString = function(str) {
|
|
6327
|
+
var node = new lunr2.TokenSet(), root = node;
|
|
6328
|
+
for (var i = 0, len = str.length; i < len; i++) {
|
|
6329
|
+
var char = str[i], final = i == len - 1;
|
|
6330
|
+
if (char == "*") {
|
|
6331
|
+
node.edges[char] = node;
|
|
6332
|
+
node.final = final;
|
|
6333
|
+
} else {
|
|
6334
|
+
var next = new lunr2.TokenSet();
|
|
6335
|
+
next.final = final;
|
|
6336
|
+
node.edges[char] = next;
|
|
6337
|
+
node = next;
|
|
6338
|
+
}
|
|
6339
|
+
}
|
|
6340
|
+
return root;
|
|
6341
|
+
};
|
|
6342
|
+
lunr2.TokenSet.prototype.toArray = function() {
|
|
6343
|
+
var words = [];
|
|
6344
|
+
var stack = [{
|
|
6345
|
+
prefix: "",
|
|
6346
|
+
node: this
|
|
6347
|
+
}];
|
|
6348
|
+
while (stack.length) {
|
|
6349
|
+
var frame = stack.pop(), edges = Object.keys(frame.node.edges), len = edges.length;
|
|
6350
|
+
if (frame.node.final) {
|
|
6351
|
+
frame.prefix.charAt(0);
|
|
6352
|
+
words.push(frame.prefix);
|
|
6353
|
+
}
|
|
6354
|
+
for (var i = 0; i < len; i++) {
|
|
6355
|
+
var edge = edges[i];
|
|
6356
|
+
stack.push({
|
|
6357
|
+
prefix: frame.prefix.concat(edge),
|
|
6358
|
+
node: frame.node.edges[edge]
|
|
6359
|
+
});
|
|
6360
|
+
}
|
|
6361
|
+
}
|
|
6362
|
+
return words;
|
|
6363
|
+
};
|
|
6364
|
+
lunr2.TokenSet.prototype.toString = function() {
|
|
6365
|
+
if (this._str) {
|
|
6366
|
+
return this._str;
|
|
6367
|
+
}
|
|
6368
|
+
var str = this.final ? "1" : "0", labels = Object.keys(this.edges).sort(), len = labels.length;
|
|
6369
|
+
for (var i = 0; i < len; i++) {
|
|
6370
|
+
var label = labels[i], node = this.edges[label];
|
|
6371
|
+
str = str + label + node.id;
|
|
6372
|
+
}
|
|
6373
|
+
return str;
|
|
6374
|
+
};
|
|
6375
|
+
lunr2.TokenSet.prototype.intersect = function(b) {
|
|
6376
|
+
var output = new lunr2.TokenSet(), frame = void 0;
|
|
6377
|
+
var stack = [{
|
|
6378
|
+
qNode: b,
|
|
6379
|
+
output,
|
|
6380
|
+
node: this
|
|
6381
|
+
}];
|
|
6382
|
+
while (stack.length) {
|
|
6383
|
+
frame = stack.pop();
|
|
6384
|
+
var qEdges = Object.keys(frame.qNode.edges), qLen = qEdges.length, nEdges = Object.keys(frame.node.edges), nLen = nEdges.length;
|
|
6385
|
+
for (var q = 0; q < qLen; q++) {
|
|
6386
|
+
var qEdge = qEdges[q];
|
|
6387
|
+
for (var n = 0; n < nLen; n++) {
|
|
6388
|
+
var nEdge = nEdges[n];
|
|
6389
|
+
if (nEdge == qEdge || qEdge == "*") {
|
|
6390
|
+
var node = frame.node.edges[nEdge], qNode = frame.qNode.edges[qEdge], final = node.final && qNode.final, next = void 0;
|
|
6391
|
+
if (nEdge in frame.output.edges) {
|
|
6392
|
+
next = frame.output.edges[nEdge];
|
|
6393
|
+
next.final = next.final || final;
|
|
6394
|
+
} else {
|
|
6395
|
+
next = new lunr2.TokenSet();
|
|
6396
|
+
next.final = final;
|
|
6397
|
+
frame.output.edges[nEdge] = next;
|
|
6398
|
+
}
|
|
6399
|
+
stack.push({
|
|
6400
|
+
qNode,
|
|
6401
|
+
output: next,
|
|
6402
|
+
node
|
|
6403
|
+
});
|
|
6404
|
+
}
|
|
6405
|
+
}
|
|
6406
|
+
}
|
|
6407
|
+
}
|
|
6408
|
+
return output;
|
|
6409
|
+
};
|
|
6410
|
+
lunr2.TokenSet.Builder = function() {
|
|
6411
|
+
this.previousWord = "";
|
|
6412
|
+
this.root = new lunr2.TokenSet();
|
|
6413
|
+
this.uncheckedNodes = [];
|
|
6414
|
+
this.minimizedNodes = {};
|
|
6415
|
+
};
|
|
6416
|
+
lunr2.TokenSet.Builder.prototype.insert = function(word) {
|
|
6417
|
+
var node, commonPrefix = 0;
|
|
6418
|
+
if (word < this.previousWord) {
|
|
6419
|
+
throw new Error("Out of order word insertion");
|
|
6420
|
+
}
|
|
6421
|
+
for (var i = 0; i < word.length && i < this.previousWord.length; i++) {
|
|
6422
|
+
if (word[i] != this.previousWord[i]) break;
|
|
6423
|
+
commonPrefix++;
|
|
6424
|
+
}
|
|
6425
|
+
this.minimize(commonPrefix);
|
|
6426
|
+
if (this.uncheckedNodes.length == 0) {
|
|
6427
|
+
node = this.root;
|
|
6428
|
+
} else {
|
|
6429
|
+
node = this.uncheckedNodes[this.uncheckedNodes.length - 1].child;
|
|
6430
|
+
}
|
|
6431
|
+
for (var i = commonPrefix; i < word.length; i++) {
|
|
6432
|
+
var nextNode = new lunr2.TokenSet(), char = word[i];
|
|
6433
|
+
node.edges[char] = nextNode;
|
|
6434
|
+
this.uncheckedNodes.push({
|
|
6435
|
+
parent: node,
|
|
6436
|
+
char,
|
|
6437
|
+
child: nextNode
|
|
6438
|
+
});
|
|
6439
|
+
node = nextNode;
|
|
6440
|
+
}
|
|
6441
|
+
node.final = true;
|
|
6442
|
+
this.previousWord = word;
|
|
6443
|
+
};
|
|
6444
|
+
lunr2.TokenSet.Builder.prototype.finish = function() {
|
|
6445
|
+
this.minimize(0);
|
|
6446
|
+
};
|
|
6447
|
+
lunr2.TokenSet.Builder.prototype.minimize = function(downTo) {
|
|
6448
|
+
for (var i = this.uncheckedNodes.length - 1; i >= downTo; i--) {
|
|
6449
|
+
var node = this.uncheckedNodes[i], childKey = node.child.toString();
|
|
6450
|
+
if (childKey in this.minimizedNodes) {
|
|
6451
|
+
node.parent.edges[node.char] = this.minimizedNodes[childKey];
|
|
6452
|
+
} else {
|
|
6453
|
+
node.child._str = childKey;
|
|
6454
|
+
this.minimizedNodes[childKey] = node.child;
|
|
6455
|
+
}
|
|
6456
|
+
this.uncheckedNodes.pop();
|
|
6457
|
+
}
|
|
6458
|
+
};
|
|
6459
|
+
lunr2.Index = function(attrs) {
|
|
6460
|
+
this.invertedIndex = attrs.invertedIndex;
|
|
6461
|
+
this.fieldVectors = attrs.fieldVectors;
|
|
6462
|
+
this.tokenSet = attrs.tokenSet;
|
|
6463
|
+
this.fields = attrs.fields;
|
|
6464
|
+
this.pipeline = attrs.pipeline;
|
|
6465
|
+
};
|
|
6466
|
+
lunr2.Index.prototype.search = function(queryString) {
|
|
6467
|
+
return this.query(function(query) {
|
|
6468
|
+
var parser2 = new lunr2.QueryParser(queryString, query);
|
|
6469
|
+
parser2.parse();
|
|
6470
|
+
});
|
|
6471
|
+
};
|
|
6472
|
+
lunr2.Index.prototype.query = function(fn) {
|
|
6473
|
+
var query = new lunr2.Query(this.fields), matchingFields = /* @__PURE__ */ Object.create(null), queryVectors = /* @__PURE__ */ Object.create(null), termFieldCache = /* @__PURE__ */ Object.create(null), requiredMatches = /* @__PURE__ */ Object.create(null), prohibitedMatches = /* @__PURE__ */ Object.create(null);
|
|
6474
|
+
for (var i = 0; i < this.fields.length; i++) {
|
|
6475
|
+
queryVectors[this.fields[i]] = new lunr2.Vector();
|
|
6476
|
+
}
|
|
6477
|
+
fn.call(query, query);
|
|
6478
|
+
for (var i = 0; i < query.clauses.length; i++) {
|
|
6479
|
+
var clause = query.clauses[i], terms = null, clauseMatches = lunr2.Set.empty;
|
|
6480
|
+
if (clause.usePipeline) {
|
|
6481
|
+
terms = this.pipeline.runString(clause.term, {
|
|
6482
|
+
fields: clause.fields
|
|
6483
|
+
});
|
|
6484
|
+
} else {
|
|
6485
|
+
terms = [clause.term];
|
|
6486
|
+
}
|
|
6487
|
+
for (var m = 0; m < terms.length; m++) {
|
|
6488
|
+
var term = terms[m];
|
|
6489
|
+
clause.term = term;
|
|
6490
|
+
var termTokenSet = lunr2.TokenSet.fromClause(clause), expandedTerms = this.tokenSet.intersect(termTokenSet).toArray();
|
|
6491
|
+
if (expandedTerms.length === 0 && clause.presence === lunr2.Query.presence.REQUIRED) {
|
|
6492
|
+
for (var k = 0; k < clause.fields.length; k++) {
|
|
6493
|
+
var field = clause.fields[k];
|
|
6494
|
+
requiredMatches[field] = lunr2.Set.empty;
|
|
6495
|
+
}
|
|
6496
|
+
break;
|
|
6497
|
+
}
|
|
6498
|
+
for (var j = 0; j < expandedTerms.length; j++) {
|
|
6499
|
+
var expandedTerm = expandedTerms[j], posting = this.invertedIndex[expandedTerm], termIndex = posting._index;
|
|
6500
|
+
for (var k = 0; k < clause.fields.length; k++) {
|
|
6501
|
+
var field = clause.fields[k], fieldPosting = posting[field], matchingDocumentRefs = Object.keys(fieldPosting), termField = expandedTerm + "/" + field, matchingDocumentsSet = new lunr2.Set(matchingDocumentRefs);
|
|
6502
|
+
if (clause.presence == lunr2.Query.presence.REQUIRED) {
|
|
6503
|
+
clauseMatches = clauseMatches.union(matchingDocumentsSet);
|
|
6504
|
+
if (requiredMatches[field] === void 0) {
|
|
6505
|
+
requiredMatches[field] = lunr2.Set.complete;
|
|
6506
|
+
}
|
|
6507
|
+
}
|
|
6508
|
+
if (clause.presence == lunr2.Query.presence.PROHIBITED) {
|
|
6509
|
+
if (prohibitedMatches[field] === void 0) {
|
|
6510
|
+
prohibitedMatches[field] = lunr2.Set.empty;
|
|
6511
|
+
}
|
|
6512
|
+
prohibitedMatches[field] = prohibitedMatches[field].union(matchingDocumentsSet);
|
|
6513
|
+
continue;
|
|
6514
|
+
}
|
|
6515
|
+
queryVectors[field].upsert(termIndex, clause.boost, function(a, b) {
|
|
6516
|
+
return a + b;
|
|
6517
|
+
});
|
|
6518
|
+
if (termFieldCache[termField]) {
|
|
6519
|
+
continue;
|
|
6520
|
+
}
|
|
6521
|
+
for (var l = 0; l < matchingDocumentRefs.length; l++) {
|
|
6522
|
+
var matchingDocumentRef = matchingDocumentRefs[l], matchingFieldRef = new lunr2.FieldRef(matchingDocumentRef, field), metadata = fieldPosting[matchingDocumentRef], fieldMatch;
|
|
6523
|
+
if ((fieldMatch = matchingFields[matchingFieldRef]) === void 0) {
|
|
6524
|
+
matchingFields[matchingFieldRef] = new lunr2.MatchData(expandedTerm, field, metadata);
|
|
6525
|
+
} else {
|
|
6526
|
+
fieldMatch.add(expandedTerm, field, metadata);
|
|
6527
|
+
}
|
|
6528
|
+
}
|
|
6529
|
+
termFieldCache[termField] = true;
|
|
6530
|
+
}
|
|
6531
|
+
}
|
|
6532
|
+
}
|
|
6533
|
+
if (clause.presence === lunr2.Query.presence.REQUIRED) {
|
|
6534
|
+
for (var k = 0; k < clause.fields.length; k++) {
|
|
6535
|
+
var field = clause.fields[k];
|
|
6536
|
+
requiredMatches[field] = requiredMatches[field].intersect(clauseMatches);
|
|
6537
|
+
}
|
|
6538
|
+
}
|
|
6539
|
+
}
|
|
6540
|
+
var allRequiredMatches = lunr2.Set.complete, allProhibitedMatches = lunr2.Set.empty;
|
|
6541
|
+
for (var i = 0; i < this.fields.length; i++) {
|
|
6542
|
+
var field = this.fields[i];
|
|
6543
|
+
if (requiredMatches[field]) {
|
|
6544
|
+
allRequiredMatches = allRequiredMatches.intersect(requiredMatches[field]);
|
|
6545
|
+
}
|
|
6546
|
+
if (prohibitedMatches[field]) {
|
|
6547
|
+
allProhibitedMatches = allProhibitedMatches.union(prohibitedMatches[field]);
|
|
6548
|
+
}
|
|
6549
|
+
}
|
|
6550
|
+
var matchingFieldRefs = Object.keys(matchingFields), results = [], matches = /* @__PURE__ */ Object.create(null);
|
|
6551
|
+
if (query.isNegated()) {
|
|
6552
|
+
matchingFieldRefs = Object.keys(this.fieldVectors);
|
|
6553
|
+
for (var i = 0; i < matchingFieldRefs.length; i++) {
|
|
6554
|
+
var matchingFieldRef = matchingFieldRefs[i];
|
|
6555
|
+
var fieldRef = lunr2.FieldRef.fromString(matchingFieldRef);
|
|
6556
|
+
matchingFields[matchingFieldRef] = new lunr2.MatchData();
|
|
6557
|
+
}
|
|
6558
|
+
}
|
|
6559
|
+
for (var i = 0; i < matchingFieldRefs.length; i++) {
|
|
6560
|
+
var fieldRef = lunr2.FieldRef.fromString(matchingFieldRefs[i]), docRef = fieldRef.docRef;
|
|
6561
|
+
if (!allRequiredMatches.contains(docRef)) {
|
|
6562
|
+
continue;
|
|
6563
|
+
}
|
|
6564
|
+
if (allProhibitedMatches.contains(docRef)) {
|
|
6565
|
+
continue;
|
|
6566
|
+
}
|
|
6567
|
+
var fieldVector = this.fieldVectors[fieldRef], score = queryVectors[fieldRef.fieldName].similarity(fieldVector), docMatch;
|
|
6568
|
+
if ((docMatch = matches[docRef]) !== void 0) {
|
|
6569
|
+
docMatch.score += score;
|
|
6570
|
+
docMatch.matchData.combine(matchingFields[fieldRef]);
|
|
6571
|
+
} else {
|
|
6572
|
+
var match = {
|
|
6573
|
+
ref: docRef,
|
|
6574
|
+
score,
|
|
6575
|
+
matchData: matchingFields[fieldRef]
|
|
6576
|
+
};
|
|
6577
|
+
matches[docRef] = match;
|
|
6578
|
+
results.push(match);
|
|
6579
|
+
}
|
|
6580
|
+
}
|
|
6581
|
+
return results.sort(function(a, b) {
|
|
6582
|
+
return b.score - a.score;
|
|
6583
|
+
});
|
|
6584
|
+
};
|
|
6585
|
+
lunr2.Index.prototype.toJSON = function() {
|
|
6586
|
+
var invertedIndex = Object.keys(this.invertedIndex).sort().map(function(term) {
|
|
6587
|
+
return [term, this.invertedIndex[term]];
|
|
6588
|
+
}, this);
|
|
6589
|
+
var fieldVectors = Object.keys(this.fieldVectors).map(function(ref) {
|
|
6590
|
+
return [ref, this.fieldVectors[ref].toJSON()];
|
|
6591
|
+
}, this);
|
|
6592
|
+
return {
|
|
6593
|
+
version: lunr2.version,
|
|
6594
|
+
fields: this.fields,
|
|
6595
|
+
fieldVectors,
|
|
6596
|
+
invertedIndex,
|
|
6597
|
+
pipeline: this.pipeline.toJSON()
|
|
6598
|
+
};
|
|
6599
|
+
};
|
|
6600
|
+
lunr2.Index.load = function(serializedIndex) {
|
|
6601
|
+
var attrs = {}, fieldVectors = {}, serializedVectors = serializedIndex.fieldVectors, invertedIndex = /* @__PURE__ */ Object.create(null), serializedInvertedIndex = serializedIndex.invertedIndex, tokenSetBuilder = new lunr2.TokenSet.Builder(), pipeline = lunr2.Pipeline.load(serializedIndex.pipeline);
|
|
6602
|
+
if (serializedIndex.version != lunr2.version) {
|
|
6603
|
+
lunr2.utils.warn("Version mismatch when loading serialised index. Current version of lunr '" + lunr2.version + "' does not match serialized index '" + serializedIndex.version + "'");
|
|
6604
|
+
}
|
|
6605
|
+
for (var i = 0; i < serializedVectors.length; i++) {
|
|
6606
|
+
var tuple = serializedVectors[i], ref = tuple[0], elements = tuple[1];
|
|
6607
|
+
fieldVectors[ref] = new lunr2.Vector(elements);
|
|
6608
|
+
}
|
|
6609
|
+
for (var i = 0; i < serializedInvertedIndex.length; i++) {
|
|
6610
|
+
var tuple = serializedInvertedIndex[i], term = tuple[0], posting = tuple[1];
|
|
6611
|
+
tokenSetBuilder.insert(term);
|
|
6612
|
+
invertedIndex[term] = posting;
|
|
6613
|
+
}
|
|
6614
|
+
tokenSetBuilder.finish();
|
|
6615
|
+
attrs.fields = serializedIndex.fields;
|
|
6616
|
+
attrs.fieldVectors = fieldVectors;
|
|
6617
|
+
attrs.invertedIndex = invertedIndex;
|
|
6618
|
+
attrs.tokenSet = tokenSetBuilder.root;
|
|
6619
|
+
attrs.pipeline = pipeline;
|
|
6620
|
+
return new lunr2.Index(attrs);
|
|
6621
|
+
};
|
|
6622
|
+
lunr2.Builder = function() {
|
|
6623
|
+
this._ref = "id";
|
|
6624
|
+
this._fields = /* @__PURE__ */ Object.create(null);
|
|
6625
|
+
this._documents = /* @__PURE__ */ Object.create(null);
|
|
6626
|
+
this.invertedIndex = /* @__PURE__ */ Object.create(null);
|
|
6627
|
+
this.fieldTermFrequencies = {};
|
|
6628
|
+
this.fieldLengths = {};
|
|
6629
|
+
this.tokenizer = lunr2.tokenizer;
|
|
6630
|
+
this.pipeline = new lunr2.Pipeline();
|
|
6631
|
+
this.searchPipeline = new lunr2.Pipeline();
|
|
6632
|
+
this.documentCount = 0;
|
|
6633
|
+
this._b = 0.75;
|
|
6634
|
+
this._k1 = 1.2;
|
|
6635
|
+
this.termIndex = 0;
|
|
6636
|
+
this.metadataWhitelist = [];
|
|
6637
|
+
};
|
|
6638
|
+
lunr2.Builder.prototype.ref = function(ref) {
|
|
6639
|
+
this._ref = ref;
|
|
6640
|
+
};
|
|
6641
|
+
lunr2.Builder.prototype.field = function(fieldName, attributes) {
|
|
6642
|
+
if (/\//.test(fieldName)) {
|
|
6643
|
+
throw new RangeError("Field '" + fieldName + "' contains illegal character '/'");
|
|
6644
|
+
}
|
|
6645
|
+
this._fields[fieldName] = attributes || {};
|
|
6646
|
+
};
|
|
6647
|
+
lunr2.Builder.prototype.b = function(number) {
|
|
6648
|
+
if (number < 0) {
|
|
6649
|
+
this._b = 0;
|
|
6650
|
+
} else if (number > 1) {
|
|
6651
|
+
this._b = 1;
|
|
6652
|
+
} else {
|
|
6653
|
+
this._b = number;
|
|
6654
|
+
}
|
|
6655
|
+
};
|
|
6656
|
+
lunr2.Builder.prototype.k1 = function(number) {
|
|
6657
|
+
this._k1 = number;
|
|
6658
|
+
};
|
|
6659
|
+
lunr2.Builder.prototype.add = function(doc2, attributes) {
|
|
6660
|
+
var docRef = doc2[this._ref], fields = Object.keys(this._fields);
|
|
6661
|
+
this._documents[docRef] = attributes || {};
|
|
6662
|
+
this.documentCount += 1;
|
|
6663
|
+
for (var i = 0; i < fields.length; i++) {
|
|
6664
|
+
var fieldName = fields[i], extractor = this._fields[fieldName].extractor, field = extractor ? extractor(doc2) : doc2[fieldName], tokens = this.tokenizer(field, {
|
|
6665
|
+
fields: [fieldName]
|
|
6666
|
+
}), terms = this.pipeline.run(tokens), fieldRef = new lunr2.FieldRef(docRef, fieldName), fieldTerms = /* @__PURE__ */ Object.create(null);
|
|
6667
|
+
this.fieldTermFrequencies[fieldRef] = fieldTerms;
|
|
6668
|
+
this.fieldLengths[fieldRef] = 0;
|
|
6669
|
+
this.fieldLengths[fieldRef] += terms.length;
|
|
6670
|
+
for (var j = 0; j < terms.length; j++) {
|
|
6671
|
+
var term = terms[j];
|
|
6672
|
+
if (fieldTerms[term] == void 0) {
|
|
6673
|
+
fieldTerms[term] = 0;
|
|
6674
|
+
}
|
|
6675
|
+
fieldTerms[term] += 1;
|
|
6676
|
+
if (this.invertedIndex[term] == void 0) {
|
|
6677
|
+
var posting = /* @__PURE__ */ Object.create(null);
|
|
6678
|
+
posting["_index"] = this.termIndex;
|
|
6679
|
+
this.termIndex += 1;
|
|
6680
|
+
for (var k = 0; k < fields.length; k++) {
|
|
6681
|
+
posting[fields[k]] = /* @__PURE__ */ Object.create(null);
|
|
6682
|
+
}
|
|
6683
|
+
this.invertedIndex[term] = posting;
|
|
6684
|
+
}
|
|
6685
|
+
if (this.invertedIndex[term][fieldName][docRef] == void 0) {
|
|
6686
|
+
this.invertedIndex[term][fieldName][docRef] = /* @__PURE__ */ Object.create(null);
|
|
6687
|
+
}
|
|
6688
|
+
for (var l = 0; l < this.metadataWhitelist.length; l++) {
|
|
6689
|
+
var metadataKey = this.metadataWhitelist[l], metadata = term.metadata[metadataKey];
|
|
6690
|
+
if (this.invertedIndex[term][fieldName][docRef][metadataKey] == void 0) {
|
|
6691
|
+
this.invertedIndex[term][fieldName][docRef][metadataKey] = [];
|
|
6692
|
+
}
|
|
6693
|
+
this.invertedIndex[term][fieldName][docRef][metadataKey].push(metadata);
|
|
6694
|
+
}
|
|
6695
|
+
}
|
|
6696
|
+
}
|
|
6697
|
+
};
|
|
6698
|
+
lunr2.Builder.prototype.calculateAverageFieldLengths = function() {
|
|
6699
|
+
var fieldRefs = Object.keys(this.fieldLengths), numberOfFields = fieldRefs.length, accumulator = {}, documentsWithField = {};
|
|
6700
|
+
for (var i = 0; i < numberOfFields; i++) {
|
|
6701
|
+
var fieldRef = lunr2.FieldRef.fromString(fieldRefs[i]), field = fieldRef.fieldName;
|
|
6702
|
+
documentsWithField[field] || (documentsWithField[field] = 0);
|
|
6703
|
+
documentsWithField[field] += 1;
|
|
6704
|
+
accumulator[field] || (accumulator[field] = 0);
|
|
6705
|
+
accumulator[field] += this.fieldLengths[fieldRef];
|
|
6706
|
+
}
|
|
6707
|
+
var fields = Object.keys(this._fields);
|
|
6708
|
+
for (var i = 0; i < fields.length; i++) {
|
|
6709
|
+
var fieldName = fields[i];
|
|
6710
|
+
accumulator[fieldName] = accumulator[fieldName] / documentsWithField[fieldName];
|
|
6711
|
+
}
|
|
6712
|
+
this.averageFieldLength = accumulator;
|
|
6713
|
+
};
|
|
6714
|
+
lunr2.Builder.prototype.createFieldVectors = function() {
|
|
6715
|
+
var fieldVectors = {}, fieldRefs = Object.keys(this.fieldTermFrequencies), fieldRefsLength = fieldRefs.length, termIdfCache = /* @__PURE__ */ Object.create(null);
|
|
6716
|
+
for (var i = 0; i < fieldRefsLength; i++) {
|
|
6717
|
+
var fieldRef = lunr2.FieldRef.fromString(fieldRefs[i]), fieldName = fieldRef.fieldName, fieldLength = this.fieldLengths[fieldRef], fieldVector = new lunr2.Vector(), termFrequencies = this.fieldTermFrequencies[fieldRef], terms = Object.keys(termFrequencies), termsLength = terms.length;
|
|
6718
|
+
var fieldBoost = this._fields[fieldName].boost || 1, docBoost = this._documents[fieldRef.docRef].boost || 1;
|
|
6719
|
+
for (var j = 0; j < termsLength; j++) {
|
|
6720
|
+
var term = terms[j], tf = termFrequencies[term], termIndex = this.invertedIndex[term]._index, idf, score, scoreWithPrecision;
|
|
6721
|
+
if (termIdfCache[term] === void 0) {
|
|
6722
|
+
idf = lunr2.idf(this.invertedIndex[term], this.documentCount);
|
|
6723
|
+
termIdfCache[term] = idf;
|
|
6724
|
+
} else {
|
|
6725
|
+
idf = termIdfCache[term];
|
|
6726
|
+
}
|
|
6727
|
+
score = idf * ((this._k1 + 1) * tf) / (this._k1 * (1 - this._b + this._b * (fieldLength / this.averageFieldLength[fieldName])) + tf);
|
|
6728
|
+
score *= fieldBoost;
|
|
6729
|
+
score *= docBoost;
|
|
6730
|
+
scoreWithPrecision = Math.round(score * 1e3) / 1e3;
|
|
6731
|
+
fieldVector.insert(termIndex, scoreWithPrecision);
|
|
6732
|
+
}
|
|
6733
|
+
fieldVectors[fieldRef] = fieldVector;
|
|
6734
|
+
}
|
|
6735
|
+
this.fieldVectors = fieldVectors;
|
|
6736
|
+
};
|
|
6737
|
+
lunr2.Builder.prototype.createTokenSet = function() {
|
|
6738
|
+
this.tokenSet = lunr2.TokenSet.fromArray(
|
|
6739
|
+
Object.keys(this.invertedIndex).sort()
|
|
6740
|
+
);
|
|
6741
|
+
};
|
|
6742
|
+
lunr2.Builder.prototype.build = function() {
|
|
6743
|
+
this.calculateAverageFieldLengths();
|
|
6744
|
+
this.createFieldVectors();
|
|
6745
|
+
this.createTokenSet();
|
|
6746
|
+
return new lunr2.Index({
|
|
6747
|
+
invertedIndex: this.invertedIndex,
|
|
6748
|
+
fieldVectors: this.fieldVectors,
|
|
6749
|
+
tokenSet: this.tokenSet,
|
|
6750
|
+
fields: Object.keys(this._fields),
|
|
6751
|
+
pipeline: this.searchPipeline
|
|
6752
|
+
});
|
|
6753
|
+
};
|
|
6754
|
+
lunr2.Builder.prototype.use = function(fn) {
|
|
6755
|
+
var args = Array.prototype.slice.call(arguments, 1);
|
|
6756
|
+
args.unshift(this);
|
|
6757
|
+
fn.apply(this, args);
|
|
6758
|
+
};
|
|
6759
|
+
lunr2.MatchData = function(term, field, metadata) {
|
|
6760
|
+
var clonedMetadata = /* @__PURE__ */ Object.create(null), metadataKeys = Object.keys(metadata || {});
|
|
6761
|
+
for (var i = 0; i < metadataKeys.length; i++) {
|
|
6762
|
+
var key = metadataKeys[i];
|
|
6763
|
+
clonedMetadata[key] = metadata[key].slice();
|
|
6764
|
+
}
|
|
6765
|
+
this.metadata = /* @__PURE__ */ Object.create(null);
|
|
6766
|
+
if (term !== void 0) {
|
|
6767
|
+
this.metadata[term] = /* @__PURE__ */ Object.create(null);
|
|
6768
|
+
this.metadata[term][field] = clonedMetadata;
|
|
6769
|
+
}
|
|
6770
|
+
};
|
|
6771
|
+
lunr2.MatchData.prototype.combine = function(otherMatchData) {
|
|
6772
|
+
var terms = Object.keys(otherMatchData.metadata);
|
|
6773
|
+
for (var i = 0; i < terms.length; i++) {
|
|
6774
|
+
var term = terms[i], fields = Object.keys(otherMatchData.metadata[term]);
|
|
6775
|
+
if (this.metadata[term] == void 0) {
|
|
6776
|
+
this.metadata[term] = /* @__PURE__ */ Object.create(null);
|
|
6777
|
+
}
|
|
6778
|
+
for (var j = 0; j < fields.length; j++) {
|
|
6779
|
+
var field = fields[j], keys = Object.keys(otherMatchData.metadata[term][field]);
|
|
6780
|
+
if (this.metadata[term][field] == void 0) {
|
|
6781
|
+
this.metadata[term][field] = /* @__PURE__ */ Object.create(null);
|
|
6782
|
+
}
|
|
6783
|
+
for (var k = 0; k < keys.length; k++) {
|
|
6784
|
+
var key = keys[k];
|
|
6785
|
+
if (this.metadata[term][field][key] == void 0) {
|
|
6786
|
+
this.metadata[term][field][key] = otherMatchData.metadata[term][field][key];
|
|
6787
|
+
} else {
|
|
6788
|
+
this.metadata[term][field][key] = this.metadata[term][field][key].concat(otherMatchData.metadata[term][field][key]);
|
|
6789
|
+
}
|
|
6790
|
+
}
|
|
6791
|
+
}
|
|
6792
|
+
}
|
|
6793
|
+
};
|
|
6794
|
+
lunr2.MatchData.prototype.add = function(term, field, metadata) {
|
|
6795
|
+
if (!(term in this.metadata)) {
|
|
6796
|
+
this.metadata[term] = /* @__PURE__ */ Object.create(null);
|
|
6797
|
+
this.metadata[term][field] = metadata;
|
|
6798
|
+
return;
|
|
6799
|
+
}
|
|
6800
|
+
if (!(field in this.metadata[term])) {
|
|
6801
|
+
this.metadata[term][field] = metadata;
|
|
6802
|
+
return;
|
|
6803
|
+
}
|
|
6804
|
+
var metadataKeys = Object.keys(metadata);
|
|
6805
|
+
for (var i = 0; i < metadataKeys.length; i++) {
|
|
6806
|
+
var key = metadataKeys[i];
|
|
6807
|
+
if (key in this.metadata[term][field]) {
|
|
6808
|
+
this.metadata[term][field][key] = this.metadata[term][field][key].concat(metadata[key]);
|
|
6809
|
+
} else {
|
|
6810
|
+
this.metadata[term][field][key] = metadata[key];
|
|
6811
|
+
}
|
|
6812
|
+
}
|
|
6813
|
+
};
|
|
6814
|
+
lunr2.Query = function(allFields) {
|
|
6815
|
+
this.clauses = [];
|
|
6816
|
+
this.allFields = allFields;
|
|
6817
|
+
};
|
|
6818
|
+
lunr2.Query.wildcard = new String("*");
|
|
6819
|
+
lunr2.Query.wildcard.NONE = 0;
|
|
6820
|
+
lunr2.Query.wildcard.LEADING = 1;
|
|
6821
|
+
lunr2.Query.wildcard.TRAILING = 2;
|
|
6822
|
+
lunr2.Query.presence = {
|
|
6823
|
+
/**
|
|
6824
|
+
* Term's presence in a document is optional, this is the default value.
|
|
6825
|
+
*/
|
|
6826
|
+
OPTIONAL: 1,
|
|
6827
|
+
/**
|
|
6828
|
+
* Term's presence in a document is required, documents that do not contain
|
|
6829
|
+
* this term will not be returned.
|
|
6830
|
+
*/
|
|
6831
|
+
REQUIRED: 2,
|
|
6832
|
+
/**
|
|
6833
|
+
* Term's presence in a document is prohibited, documents that do contain
|
|
6834
|
+
* this term will not be returned.
|
|
6835
|
+
*/
|
|
6836
|
+
PROHIBITED: 3
|
|
6837
|
+
};
|
|
6838
|
+
lunr2.Query.prototype.clause = function(clause) {
|
|
6839
|
+
if (!("fields" in clause)) {
|
|
6840
|
+
clause.fields = this.allFields;
|
|
6841
|
+
}
|
|
6842
|
+
if (!("boost" in clause)) {
|
|
6843
|
+
clause.boost = 1;
|
|
6844
|
+
}
|
|
6845
|
+
if (!("usePipeline" in clause)) {
|
|
6846
|
+
clause.usePipeline = true;
|
|
6847
|
+
}
|
|
6848
|
+
if (!("wildcard" in clause)) {
|
|
6849
|
+
clause.wildcard = lunr2.Query.wildcard.NONE;
|
|
6850
|
+
}
|
|
6851
|
+
if (clause.wildcard & lunr2.Query.wildcard.LEADING && clause.term.charAt(0) != lunr2.Query.wildcard) {
|
|
6852
|
+
clause.term = "*" + clause.term;
|
|
6853
|
+
}
|
|
6854
|
+
if (clause.wildcard & lunr2.Query.wildcard.TRAILING && clause.term.slice(-1) != lunr2.Query.wildcard) {
|
|
6855
|
+
clause.term = "" + clause.term + "*";
|
|
6856
|
+
}
|
|
6857
|
+
if (!("presence" in clause)) {
|
|
6858
|
+
clause.presence = lunr2.Query.presence.OPTIONAL;
|
|
6859
|
+
}
|
|
6860
|
+
this.clauses.push(clause);
|
|
6861
|
+
return this;
|
|
6862
|
+
};
|
|
6863
|
+
lunr2.Query.prototype.isNegated = function() {
|
|
6864
|
+
for (var i = 0; i < this.clauses.length; i++) {
|
|
6865
|
+
if (this.clauses[i].presence != lunr2.Query.presence.PROHIBITED) {
|
|
6866
|
+
return false;
|
|
6867
|
+
}
|
|
6868
|
+
}
|
|
6869
|
+
return true;
|
|
6870
|
+
};
|
|
6871
|
+
lunr2.Query.prototype.term = function(term, options2) {
|
|
6872
|
+
if (Array.isArray(term)) {
|
|
6873
|
+
term.forEach(function(t) {
|
|
6874
|
+
this.term(t, lunr2.utils.clone(options2));
|
|
6875
|
+
}, this);
|
|
6876
|
+
return this;
|
|
6877
|
+
}
|
|
6878
|
+
var clause = options2 || {};
|
|
6879
|
+
clause.term = term.toString();
|
|
6880
|
+
this.clause(clause);
|
|
6881
|
+
return this;
|
|
6882
|
+
};
|
|
6883
|
+
lunr2.QueryParseError = function(message, start, end) {
|
|
6884
|
+
this.name = "QueryParseError";
|
|
6885
|
+
this.message = message;
|
|
6886
|
+
this.start = start;
|
|
6887
|
+
this.end = end;
|
|
6888
|
+
};
|
|
6889
|
+
lunr2.QueryParseError.prototype = new Error();
|
|
6890
|
+
lunr2.QueryLexer = function(str) {
|
|
6891
|
+
this.lexemes = [];
|
|
6892
|
+
this.str = str;
|
|
6893
|
+
this.length = str.length;
|
|
6894
|
+
this.pos = 0;
|
|
6895
|
+
this.start = 0;
|
|
6896
|
+
this.escapeCharPositions = [];
|
|
6897
|
+
};
|
|
6898
|
+
lunr2.QueryLexer.prototype.run = function() {
|
|
6899
|
+
var state = lunr2.QueryLexer.lexText;
|
|
6900
|
+
while (state) {
|
|
6901
|
+
state = state(this);
|
|
6902
|
+
}
|
|
6903
|
+
};
|
|
6904
|
+
lunr2.QueryLexer.prototype.sliceString = function() {
|
|
6905
|
+
var subSlices = [], sliceStart = this.start, sliceEnd = this.pos;
|
|
6906
|
+
for (var i = 0; i < this.escapeCharPositions.length; i++) {
|
|
6907
|
+
sliceEnd = this.escapeCharPositions[i];
|
|
6908
|
+
subSlices.push(this.str.slice(sliceStart, sliceEnd));
|
|
6909
|
+
sliceStart = sliceEnd + 1;
|
|
6910
|
+
}
|
|
6911
|
+
subSlices.push(this.str.slice(sliceStart, this.pos));
|
|
6912
|
+
this.escapeCharPositions.length = 0;
|
|
6913
|
+
return subSlices.join("");
|
|
6914
|
+
};
|
|
6915
|
+
lunr2.QueryLexer.prototype.emit = function(type) {
|
|
6916
|
+
this.lexemes.push({
|
|
6917
|
+
type,
|
|
6918
|
+
str: this.sliceString(),
|
|
6919
|
+
start: this.start,
|
|
6920
|
+
end: this.pos
|
|
6921
|
+
});
|
|
6922
|
+
this.start = this.pos;
|
|
6923
|
+
};
|
|
6924
|
+
lunr2.QueryLexer.prototype.escapeCharacter = function() {
|
|
6925
|
+
this.escapeCharPositions.push(this.pos - 1);
|
|
6926
|
+
this.pos += 1;
|
|
6927
|
+
};
|
|
6928
|
+
lunr2.QueryLexer.prototype.next = function() {
|
|
6929
|
+
if (this.pos >= this.length) {
|
|
6930
|
+
return lunr2.QueryLexer.EOS;
|
|
6931
|
+
}
|
|
6932
|
+
var char = this.str.charAt(this.pos);
|
|
6933
|
+
this.pos += 1;
|
|
6934
|
+
return char;
|
|
6935
|
+
};
|
|
6936
|
+
lunr2.QueryLexer.prototype.width = function() {
|
|
6937
|
+
return this.pos - this.start;
|
|
6938
|
+
};
|
|
6939
|
+
lunr2.QueryLexer.prototype.ignore = function() {
|
|
6940
|
+
if (this.start == this.pos) {
|
|
6941
|
+
this.pos += 1;
|
|
6942
|
+
}
|
|
6943
|
+
this.start = this.pos;
|
|
6944
|
+
};
|
|
6945
|
+
lunr2.QueryLexer.prototype.backup = function() {
|
|
6946
|
+
this.pos -= 1;
|
|
6947
|
+
};
|
|
6948
|
+
lunr2.QueryLexer.prototype.acceptDigitRun = function() {
|
|
6949
|
+
var char, charCode;
|
|
6950
|
+
do {
|
|
6951
|
+
char = this.next();
|
|
6952
|
+
charCode = char.charCodeAt(0);
|
|
6953
|
+
} while (charCode > 47 && charCode < 58);
|
|
6954
|
+
if (char != lunr2.QueryLexer.EOS) {
|
|
6955
|
+
this.backup();
|
|
6956
|
+
}
|
|
6957
|
+
};
|
|
6958
|
+
lunr2.QueryLexer.prototype.more = function() {
|
|
6959
|
+
return this.pos < this.length;
|
|
6960
|
+
};
|
|
6961
|
+
lunr2.QueryLexer.EOS = "EOS";
|
|
6962
|
+
lunr2.QueryLexer.FIELD = "FIELD";
|
|
6963
|
+
lunr2.QueryLexer.TERM = "TERM";
|
|
6964
|
+
lunr2.QueryLexer.EDIT_DISTANCE = "EDIT_DISTANCE";
|
|
6965
|
+
lunr2.QueryLexer.BOOST = "BOOST";
|
|
6966
|
+
lunr2.QueryLexer.PRESENCE = "PRESENCE";
|
|
6967
|
+
lunr2.QueryLexer.lexField = function(lexer) {
|
|
6968
|
+
lexer.backup();
|
|
6969
|
+
lexer.emit(lunr2.QueryLexer.FIELD);
|
|
6970
|
+
lexer.ignore();
|
|
6971
|
+
return lunr2.QueryLexer.lexText;
|
|
6972
|
+
};
|
|
6973
|
+
lunr2.QueryLexer.lexTerm = function(lexer) {
|
|
6974
|
+
if (lexer.width() > 1) {
|
|
6975
|
+
lexer.backup();
|
|
6976
|
+
lexer.emit(lunr2.QueryLexer.TERM);
|
|
6977
|
+
}
|
|
6978
|
+
lexer.ignore();
|
|
6979
|
+
if (lexer.more()) {
|
|
6980
|
+
return lunr2.QueryLexer.lexText;
|
|
6981
|
+
}
|
|
6982
|
+
};
|
|
6983
|
+
lunr2.QueryLexer.lexEditDistance = function(lexer) {
|
|
6984
|
+
lexer.ignore();
|
|
6985
|
+
lexer.acceptDigitRun();
|
|
6986
|
+
lexer.emit(lunr2.QueryLexer.EDIT_DISTANCE);
|
|
6987
|
+
return lunr2.QueryLexer.lexText;
|
|
6988
|
+
};
|
|
6989
|
+
lunr2.QueryLexer.lexBoost = function(lexer) {
|
|
6990
|
+
lexer.ignore();
|
|
6991
|
+
lexer.acceptDigitRun();
|
|
6992
|
+
lexer.emit(lunr2.QueryLexer.BOOST);
|
|
6993
|
+
return lunr2.QueryLexer.lexText;
|
|
6994
|
+
};
|
|
6995
|
+
lunr2.QueryLexer.lexEOS = function(lexer) {
|
|
6996
|
+
if (lexer.width() > 0) {
|
|
6997
|
+
lexer.emit(lunr2.QueryLexer.TERM);
|
|
6998
|
+
}
|
|
6999
|
+
};
|
|
7000
|
+
lunr2.QueryLexer.termSeparator = lunr2.tokenizer.separator;
|
|
7001
|
+
lunr2.QueryLexer.lexText = function(lexer) {
|
|
7002
|
+
while (true) {
|
|
7003
|
+
var char = lexer.next();
|
|
7004
|
+
if (char == lunr2.QueryLexer.EOS) {
|
|
7005
|
+
return lunr2.QueryLexer.lexEOS;
|
|
7006
|
+
}
|
|
7007
|
+
if (char.charCodeAt(0) == 92) {
|
|
7008
|
+
lexer.escapeCharacter();
|
|
7009
|
+
continue;
|
|
7010
|
+
}
|
|
7011
|
+
if (char == ":") {
|
|
7012
|
+
return lunr2.QueryLexer.lexField;
|
|
7013
|
+
}
|
|
7014
|
+
if (char == "~") {
|
|
7015
|
+
lexer.backup();
|
|
7016
|
+
if (lexer.width() > 0) {
|
|
7017
|
+
lexer.emit(lunr2.QueryLexer.TERM);
|
|
7018
|
+
}
|
|
7019
|
+
return lunr2.QueryLexer.lexEditDistance;
|
|
7020
|
+
}
|
|
7021
|
+
if (char == "^") {
|
|
7022
|
+
lexer.backup();
|
|
7023
|
+
if (lexer.width() > 0) {
|
|
7024
|
+
lexer.emit(lunr2.QueryLexer.TERM);
|
|
7025
|
+
}
|
|
7026
|
+
return lunr2.QueryLexer.lexBoost;
|
|
7027
|
+
}
|
|
7028
|
+
if (char == "+" && lexer.width() === 1) {
|
|
7029
|
+
lexer.emit(lunr2.QueryLexer.PRESENCE);
|
|
7030
|
+
return lunr2.QueryLexer.lexText;
|
|
7031
|
+
}
|
|
7032
|
+
if (char == "-" && lexer.width() === 1) {
|
|
7033
|
+
lexer.emit(lunr2.QueryLexer.PRESENCE);
|
|
7034
|
+
return lunr2.QueryLexer.lexText;
|
|
7035
|
+
}
|
|
7036
|
+
if (char.match(lunr2.QueryLexer.termSeparator)) {
|
|
7037
|
+
return lunr2.QueryLexer.lexTerm;
|
|
7038
|
+
}
|
|
7039
|
+
}
|
|
7040
|
+
};
|
|
7041
|
+
lunr2.QueryParser = function(str, query) {
|
|
7042
|
+
this.lexer = new lunr2.QueryLexer(str);
|
|
7043
|
+
this.query = query;
|
|
7044
|
+
this.currentClause = {};
|
|
7045
|
+
this.lexemeIdx = 0;
|
|
7046
|
+
};
|
|
7047
|
+
lunr2.QueryParser.prototype.parse = function() {
|
|
7048
|
+
this.lexer.run();
|
|
7049
|
+
this.lexemes = this.lexer.lexemes;
|
|
7050
|
+
var state = lunr2.QueryParser.parseClause;
|
|
7051
|
+
while (state) {
|
|
7052
|
+
state = state(this);
|
|
7053
|
+
}
|
|
7054
|
+
return this.query;
|
|
7055
|
+
};
|
|
7056
|
+
lunr2.QueryParser.prototype.peekLexeme = function() {
|
|
7057
|
+
return this.lexemes[this.lexemeIdx];
|
|
7058
|
+
};
|
|
7059
|
+
lunr2.QueryParser.prototype.consumeLexeme = function() {
|
|
7060
|
+
var lexeme = this.peekLexeme();
|
|
7061
|
+
this.lexemeIdx += 1;
|
|
7062
|
+
return lexeme;
|
|
7063
|
+
};
|
|
7064
|
+
lunr2.QueryParser.prototype.nextClause = function() {
|
|
7065
|
+
var completedClause = this.currentClause;
|
|
7066
|
+
this.query.clause(completedClause);
|
|
7067
|
+
this.currentClause = {};
|
|
7068
|
+
};
|
|
7069
|
+
lunr2.QueryParser.parseClause = function(parser2) {
|
|
7070
|
+
var lexeme = parser2.peekLexeme();
|
|
7071
|
+
if (lexeme == void 0) {
|
|
7072
|
+
return;
|
|
7073
|
+
}
|
|
7074
|
+
switch (lexeme.type) {
|
|
7075
|
+
case lunr2.QueryLexer.PRESENCE:
|
|
7076
|
+
return lunr2.QueryParser.parsePresence;
|
|
7077
|
+
case lunr2.QueryLexer.FIELD:
|
|
7078
|
+
return lunr2.QueryParser.parseField;
|
|
7079
|
+
case lunr2.QueryLexer.TERM:
|
|
7080
|
+
return lunr2.QueryParser.parseTerm;
|
|
7081
|
+
default:
|
|
7082
|
+
var errorMessage = "expected either a field or a term, found " + lexeme.type;
|
|
7083
|
+
if (lexeme.str.length >= 1) {
|
|
7084
|
+
errorMessage += " with value '" + lexeme.str + "'";
|
|
7085
|
+
}
|
|
7086
|
+
throw new lunr2.QueryParseError(errorMessage, lexeme.start, lexeme.end);
|
|
7087
|
+
}
|
|
7088
|
+
};
|
|
7089
|
+
lunr2.QueryParser.parsePresence = function(parser2) {
|
|
7090
|
+
var lexeme = parser2.consumeLexeme();
|
|
7091
|
+
if (lexeme == void 0) {
|
|
7092
|
+
return;
|
|
7093
|
+
}
|
|
7094
|
+
switch (lexeme.str) {
|
|
7095
|
+
case "-":
|
|
7096
|
+
parser2.currentClause.presence = lunr2.Query.presence.PROHIBITED;
|
|
7097
|
+
break;
|
|
7098
|
+
case "+":
|
|
7099
|
+
parser2.currentClause.presence = lunr2.Query.presence.REQUIRED;
|
|
7100
|
+
break;
|
|
7101
|
+
default:
|
|
7102
|
+
var errorMessage = "unrecognised presence operator'" + lexeme.str + "'";
|
|
7103
|
+
throw new lunr2.QueryParseError(errorMessage, lexeme.start, lexeme.end);
|
|
7104
|
+
}
|
|
7105
|
+
var nextLexeme = parser2.peekLexeme();
|
|
7106
|
+
if (nextLexeme == void 0) {
|
|
7107
|
+
var errorMessage = "expecting term or field, found nothing";
|
|
7108
|
+
throw new lunr2.QueryParseError(errorMessage, lexeme.start, lexeme.end);
|
|
7109
|
+
}
|
|
7110
|
+
switch (nextLexeme.type) {
|
|
7111
|
+
case lunr2.QueryLexer.FIELD:
|
|
7112
|
+
return lunr2.QueryParser.parseField;
|
|
7113
|
+
case lunr2.QueryLexer.TERM:
|
|
7114
|
+
return lunr2.QueryParser.parseTerm;
|
|
7115
|
+
default:
|
|
7116
|
+
var errorMessage = "expecting term or field, found '" + nextLexeme.type + "'";
|
|
7117
|
+
throw new lunr2.QueryParseError(errorMessage, nextLexeme.start, nextLexeme.end);
|
|
7118
|
+
}
|
|
7119
|
+
};
|
|
7120
|
+
lunr2.QueryParser.parseField = function(parser2) {
|
|
7121
|
+
var lexeme = parser2.consumeLexeme();
|
|
7122
|
+
if (lexeme == void 0) {
|
|
7123
|
+
return;
|
|
7124
|
+
}
|
|
7125
|
+
if (parser2.query.allFields.indexOf(lexeme.str) == -1) {
|
|
7126
|
+
var possibleFields = parser2.query.allFields.map(function(f) {
|
|
7127
|
+
return "'" + f + "'";
|
|
7128
|
+
}).join(", "), errorMessage = "unrecognised field '" + lexeme.str + "', possible fields: " + possibleFields;
|
|
7129
|
+
throw new lunr2.QueryParseError(errorMessage, lexeme.start, lexeme.end);
|
|
7130
|
+
}
|
|
7131
|
+
parser2.currentClause.fields = [lexeme.str];
|
|
7132
|
+
var nextLexeme = parser2.peekLexeme();
|
|
7133
|
+
if (nextLexeme == void 0) {
|
|
7134
|
+
var errorMessage = "expecting term, found nothing";
|
|
7135
|
+
throw new lunr2.QueryParseError(errorMessage, lexeme.start, lexeme.end);
|
|
7136
|
+
}
|
|
7137
|
+
switch (nextLexeme.type) {
|
|
7138
|
+
case lunr2.QueryLexer.TERM:
|
|
7139
|
+
return lunr2.QueryParser.parseTerm;
|
|
7140
|
+
default:
|
|
7141
|
+
var errorMessage = "expecting term, found '" + nextLexeme.type + "'";
|
|
7142
|
+
throw new lunr2.QueryParseError(errorMessage, nextLexeme.start, nextLexeme.end);
|
|
7143
|
+
}
|
|
7144
|
+
};
|
|
7145
|
+
lunr2.QueryParser.parseTerm = function(parser2) {
|
|
7146
|
+
var lexeme = parser2.consumeLexeme();
|
|
7147
|
+
if (lexeme == void 0) {
|
|
7148
|
+
return;
|
|
7149
|
+
}
|
|
7150
|
+
parser2.currentClause.term = lexeme.str.toLowerCase();
|
|
7151
|
+
if (lexeme.str.indexOf("*") != -1) {
|
|
7152
|
+
parser2.currentClause.usePipeline = false;
|
|
7153
|
+
}
|
|
7154
|
+
var nextLexeme = parser2.peekLexeme();
|
|
7155
|
+
if (nextLexeme == void 0) {
|
|
7156
|
+
parser2.nextClause();
|
|
7157
|
+
return;
|
|
7158
|
+
}
|
|
7159
|
+
switch (nextLexeme.type) {
|
|
7160
|
+
case lunr2.QueryLexer.TERM:
|
|
7161
|
+
parser2.nextClause();
|
|
7162
|
+
return lunr2.QueryParser.parseTerm;
|
|
7163
|
+
case lunr2.QueryLexer.FIELD:
|
|
7164
|
+
parser2.nextClause();
|
|
7165
|
+
return lunr2.QueryParser.parseField;
|
|
7166
|
+
case lunr2.QueryLexer.EDIT_DISTANCE:
|
|
7167
|
+
return lunr2.QueryParser.parseEditDistance;
|
|
7168
|
+
case lunr2.QueryLexer.BOOST:
|
|
7169
|
+
return lunr2.QueryParser.parseBoost;
|
|
7170
|
+
case lunr2.QueryLexer.PRESENCE:
|
|
7171
|
+
parser2.nextClause();
|
|
7172
|
+
return lunr2.QueryParser.parsePresence;
|
|
7173
|
+
default:
|
|
7174
|
+
var errorMessage = "Unexpected lexeme type '" + nextLexeme.type + "'";
|
|
7175
|
+
throw new lunr2.QueryParseError(errorMessage, nextLexeme.start, nextLexeme.end);
|
|
7176
|
+
}
|
|
7177
|
+
};
|
|
7178
|
+
lunr2.QueryParser.parseEditDistance = function(parser2) {
|
|
7179
|
+
var lexeme = parser2.consumeLexeme();
|
|
7180
|
+
if (lexeme == void 0) {
|
|
7181
|
+
return;
|
|
7182
|
+
}
|
|
7183
|
+
var editDistance = parseInt(lexeme.str, 10);
|
|
7184
|
+
if (isNaN(editDistance)) {
|
|
7185
|
+
var errorMessage = "edit distance must be numeric";
|
|
7186
|
+
throw new lunr2.QueryParseError(errorMessage, lexeme.start, lexeme.end);
|
|
7187
|
+
}
|
|
7188
|
+
parser2.currentClause.editDistance = editDistance;
|
|
7189
|
+
var nextLexeme = parser2.peekLexeme();
|
|
7190
|
+
if (nextLexeme == void 0) {
|
|
7191
|
+
parser2.nextClause();
|
|
7192
|
+
return;
|
|
7193
|
+
}
|
|
7194
|
+
switch (nextLexeme.type) {
|
|
7195
|
+
case lunr2.QueryLexer.TERM:
|
|
7196
|
+
parser2.nextClause();
|
|
7197
|
+
return lunr2.QueryParser.parseTerm;
|
|
7198
|
+
case lunr2.QueryLexer.FIELD:
|
|
7199
|
+
parser2.nextClause();
|
|
7200
|
+
return lunr2.QueryParser.parseField;
|
|
7201
|
+
case lunr2.QueryLexer.EDIT_DISTANCE:
|
|
7202
|
+
return lunr2.QueryParser.parseEditDistance;
|
|
7203
|
+
case lunr2.QueryLexer.BOOST:
|
|
7204
|
+
return lunr2.QueryParser.parseBoost;
|
|
7205
|
+
case lunr2.QueryLexer.PRESENCE:
|
|
7206
|
+
parser2.nextClause();
|
|
7207
|
+
return lunr2.QueryParser.parsePresence;
|
|
7208
|
+
default:
|
|
7209
|
+
var errorMessage = "Unexpected lexeme type '" + nextLexeme.type + "'";
|
|
7210
|
+
throw new lunr2.QueryParseError(errorMessage, nextLexeme.start, nextLexeme.end);
|
|
7211
|
+
}
|
|
7212
|
+
};
|
|
7213
|
+
lunr2.QueryParser.parseBoost = function(parser2) {
|
|
7214
|
+
var lexeme = parser2.consumeLexeme();
|
|
7215
|
+
if (lexeme == void 0) {
|
|
7216
|
+
return;
|
|
7217
|
+
}
|
|
7218
|
+
var boost = parseInt(lexeme.str, 10);
|
|
7219
|
+
if (isNaN(boost)) {
|
|
7220
|
+
var errorMessage = "boost must be numeric";
|
|
7221
|
+
throw new lunr2.QueryParseError(errorMessage, lexeme.start, lexeme.end);
|
|
7222
|
+
}
|
|
7223
|
+
parser2.currentClause.boost = boost;
|
|
7224
|
+
var nextLexeme = parser2.peekLexeme();
|
|
7225
|
+
if (nextLexeme == void 0) {
|
|
7226
|
+
parser2.nextClause();
|
|
7227
|
+
return;
|
|
7228
|
+
}
|
|
7229
|
+
switch (nextLexeme.type) {
|
|
7230
|
+
case lunr2.QueryLexer.TERM:
|
|
7231
|
+
parser2.nextClause();
|
|
7232
|
+
return lunr2.QueryParser.parseTerm;
|
|
7233
|
+
case lunr2.QueryLexer.FIELD:
|
|
7234
|
+
parser2.nextClause();
|
|
7235
|
+
return lunr2.QueryParser.parseField;
|
|
7236
|
+
case lunr2.QueryLexer.EDIT_DISTANCE:
|
|
7237
|
+
return lunr2.QueryParser.parseEditDistance;
|
|
7238
|
+
case lunr2.QueryLexer.BOOST:
|
|
7239
|
+
return lunr2.QueryParser.parseBoost;
|
|
7240
|
+
case lunr2.QueryLexer.PRESENCE:
|
|
7241
|
+
parser2.nextClause();
|
|
7242
|
+
return lunr2.QueryParser.parsePresence;
|
|
7243
|
+
default:
|
|
7244
|
+
var errorMessage = "Unexpected lexeme type '" + nextLexeme.type + "'";
|
|
7245
|
+
throw new lunr2.QueryParseError(errorMessage, nextLexeme.start, nextLexeme.end);
|
|
7246
|
+
}
|
|
7247
|
+
};
|
|
7248
|
+
(function(root, factory) {
|
|
7249
|
+
if (typeof define === "function" && define.amd) {
|
|
7250
|
+
define(factory);
|
|
7251
|
+
} else if (typeof exports2 === "object") {
|
|
7252
|
+
module.exports = factory();
|
|
7253
|
+
} else {
|
|
7254
|
+
root.lunr = factory();
|
|
7255
|
+
}
|
|
7256
|
+
})(this, function() {
|
|
7257
|
+
return lunr2;
|
|
7258
|
+
});
|
|
7259
|
+
})();
|
|
7260
|
+
}
|
|
7261
|
+
});
|
|
7262
|
+
|
|
5532
7263
|
// ../reporter/src/console-reporter.ts
|
|
5533
7264
|
import { writeFile } from "node:fs/promises";
|
|
5534
7265
|
import { blue, gray, green, red, yellow, yellowBright } from "colorette";
|
|
@@ -5537,29 +7268,17 @@ import { blue, gray, green, red, yellow, yellowBright } from "colorette";
|
|
|
5537
7268
|
import { readFileSync } from "node:fs";
|
|
5538
7269
|
import { dirname, join } from "node:path";
|
|
5539
7270
|
import { fileURLToPath } from "node:url";
|
|
5540
|
-
function
|
|
5541
|
-
|
|
5542
|
-
|
|
5543
|
-
|
|
5544
|
-
|
|
5545
|
-
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
}
|
|
5550
|
-
}
|
|
5551
|
-
function readPackage() {
|
|
5552
|
-
try {
|
|
5553
|
-
const packagePath = resolvePackageJson();
|
|
5554
|
-
const content = readFileSync(packagePath, "utf-8");
|
|
5555
|
-
return JSON.parse(content);
|
|
5556
|
-
} catch (error) {
|
|
5557
|
-
const message = error instanceof Error ? error.message : "Unknown error";
|
|
5558
|
-
throw new Error(`Failed to read package.json: ${message}`);
|
|
5559
|
-
}
|
|
7271
|
+
function getPackageVersion() {
|
|
7272
|
+
if (true) {
|
|
7273
|
+
return "4.0.0-beta.42";
|
|
7274
|
+
}
|
|
7275
|
+
const currentModulePath = fileURLToPath(import.meta.url);
|
|
7276
|
+
const currentDir = dirname(currentModulePath);
|
|
7277
|
+
const packageJsonPath = join(currentDir, "..", "package.json");
|
|
7278
|
+
const content = readFileSync(packageJsonPath, "utf-8");
|
|
7279
|
+
return JSON.parse(content).version;
|
|
5560
7280
|
}
|
|
5561
|
-
var
|
|
5562
|
-
var PACKAGE_VERSION = PACKAGE.version;
|
|
7281
|
+
var PACKAGE_VERSION = getPackageVersion();
|
|
5563
7282
|
|
|
5564
7283
|
// ../reporter/src/types/problem.ts
|
|
5565
7284
|
var ProblemCategory = /* @__PURE__ */ ((ProblemCategory2) => {
|
|
@@ -6445,32 +8164,20 @@ import { readFileSync as readFileSync2 } from "node:fs";
|
|
|
6445
8164
|
import { dirname as dirname2, join as join2 } from "node:path";
|
|
6446
8165
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
6447
8166
|
var NEW_LINE_REG_EXP = /[\n\r]+/g;
|
|
6448
|
-
function
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
|
|
6454
|
-
|
|
6455
|
-
|
|
6456
|
-
|
|
6457
|
-
}
|
|
6458
|
-
}
|
|
6459
|
-
function readPackageSync() {
|
|
6460
|
-
try {
|
|
6461
|
-
const packagePath = resolvePackageJson2();
|
|
6462
|
-
const content = readFileSync2(packagePath, "utf-8");
|
|
6463
|
-
return JSON.parse(content);
|
|
6464
|
-
} catch (error) {
|
|
6465
|
-
const message = error instanceof Error ? error.message : "Unknown error";
|
|
6466
|
-
throw new Error(`Failed to read package.json: ${message}`);
|
|
6467
|
-
}
|
|
8167
|
+
function getPackageVersion2() {
|
|
8168
|
+
if (true) {
|
|
8169
|
+
return "4.0.0-beta.42";
|
|
8170
|
+
}
|
|
8171
|
+
const currentModulePath = fileURLToPath2(import.meta.url);
|
|
8172
|
+
const currentDir = dirname2(currentModulePath);
|
|
8173
|
+
const packageJsonPath = join2(currentDir, "..", "package.json");
|
|
8174
|
+
const content = readFileSync2(packageJsonPath, "utf-8");
|
|
8175
|
+
return JSON.parse(content).version;
|
|
6468
8176
|
}
|
|
6469
|
-
var PACKAGE2 = readPackageSync();
|
|
6470
8177
|
var APP_NAME = "ts-for-gir";
|
|
6471
8178
|
var APP_USAGE = "TypeScript type definition generator for GObject introspection GIR files";
|
|
6472
8179
|
var APP_SOURCE = "https://github.com/gjsify/ts-for-gir";
|
|
6473
|
-
var APP_VERSION =
|
|
8180
|
+
var APP_VERSION = getPackageVersion2();
|
|
6474
8181
|
var PACKAGE_DESC = (packageName, libraryVersion) => {
|
|
6475
8182
|
if (libraryVersion) {
|
|
6476
8183
|
return `GJS TypeScript type definitions for ${packageName}, generated from library version ${libraryVersion.toString()}`;
|
|
@@ -6491,7 +8198,7 @@ __export(parser_exports, {
|
|
|
6491
8198
|
parseGir: () => parseGir
|
|
6492
8199
|
});
|
|
6493
8200
|
|
|
6494
|
-
// ../../.yarn/cache/fast-xml-parser-npm-5.5.
|
|
8201
|
+
// ../../.yarn/cache/fast-xml-parser-npm-5.5.8-4d571da1cb-888f9a5d34.zip/node_modules/fast-xml-parser/src/util.js
|
|
6495
8202
|
var nameStartChar = ":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
|
|
6496
8203
|
var nameChar = nameStartChar + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
|
|
6497
8204
|
var nameRegexp = "[" + nameStartChar + "][" + nameChar + "]*";
|
|
@@ -6532,7 +8239,7 @@ var DANGEROUS_PROPERTY_NAMES = [
|
|
|
6532
8239
|
];
|
|
6533
8240
|
var criticalProperties = ["__proto__", "constructor", "prototype"];
|
|
6534
8241
|
|
|
6535
|
-
// ../../.yarn/cache/fast-xml-parser-npm-5.5.
|
|
8242
|
+
// ../../.yarn/cache/fast-xml-parser-npm-5.5.8-4d571da1cb-888f9a5d34.zip/node_modules/fast-xml-parser/src/validator.js
|
|
6536
8243
|
var defaultOptions = {
|
|
6537
8244
|
allowBooleanAttributes: false,
|
|
6538
8245
|
//A tag can have attributes without any value
|
|
@@ -6838,7 +8545,7 @@ function getPositionFromMatch(match) {
|
|
|
6838
8545
|
return match.startIndex + match[1].length;
|
|
6839
8546
|
}
|
|
6840
8547
|
|
|
6841
|
-
// ../../.yarn/cache/fast-xml-parser-npm-5.5.
|
|
8548
|
+
// ../../.yarn/cache/fast-xml-parser-npm-5.5.8-4d571da1cb-888f9a5d34.zip/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js
|
|
6842
8549
|
var defaultOnDangerousProperty = (name) => {
|
|
6843
8550
|
if (DANGEROUS_PROPERTY_NAMES.includes(name)) {
|
|
6844
8551
|
return "__" + name;
|
|
@@ -6968,7 +8675,7 @@ var buildOptions = function(options2) {
|
|
|
6968
8675
|
return built;
|
|
6969
8676
|
};
|
|
6970
8677
|
|
|
6971
|
-
// ../../.yarn/cache/fast-xml-parser-npm-5.5.
|
|
8678
|
+
// ../../.yarn/cache/fast-xml-parser-npm-5.5.8-4d571da1cb-888f9a5d34.zip/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js
|
|
6972
8679
|
var METADATA_SYMBOL;
|
|
6973
8680
|
if (typeof Symbol !== "function") {
|
|
6974
8681
|
METADATA_SYMBOL = "@@xmlMetadata";
|
|
@@ -7002,7 +8709,7 @@ var XmlNode = class {
|
|
|
7002
8709
|
}
|
|
7003
8710
|
};
|
|
7004
8711
|
|
|
7005
|
-
// ../../.yarn/cache/fast-xml-parser-npm-5.5.
|
|
8712
|
+
// ../../.yarn/cache/fast-xml-parser-npm-5.5.8-4d571da1cb-888f9a5d34.zip/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js
|
|
7006
8713
|
var DocTypeReader = class {
|
|
7007
8714
|
constructor(options2) {
|
|
7008
8715
|
this.suppressValidationErr = !options2;
|
|
@@ -7403,7 +9110,7 @@ function handleInfinity(str, num, options2) {
|
|
|
7403
9110
|
}
|
|
7404
9111
|
}
|
|
7405
9112
|
|
|
7406
|
-
// ../../.yarn/cache/fast-xml-parser-npm-5.5.
|
|
9113
|
+
// ../../.yarn/cache/fast-xml-parser-npm-5.5.8-4d571da1cb-888f9a5d34.zip/node_modules/fast-xml-parser/src/ignoreAttributes.js
|
|
7407
9114
|
function getIgnoreAttributesFn(ignoreAttributes) {
|
|
7408
9115
|
if (typeof ignoreAttributes === "function") {
|
|
7409
9116
|
return ignoreAttributes;
|
|
@@ -7423,7 +9130,7 @@ function getIgnoreAttributesFn(ignoreAttributes) {
|
|
|
7423
9130
|
return () => false;
|
|
7424
9131
|
}
|
|
7425
9132
|
|
|
7426
|
-
// ../../.yarn/cache/path-expression-matcher-npm-1.
|
|
9133
|
+
// ../../.yarn/cache/path-expression-matcher-npm-1.2.0-0a1470212e-eab23babd9.zip/node_modules/path-expression-matcher/src/Expression.js
|
|
7427
9134
|
var Expression = class {
|
|
7428
9135
|
/**
|
|
7429
9136
|
* Create a new Expression
|
|
@@ -7585,7 +9292,8 @@ var Expression = class {
|
|
|
7585
9292
|
}
|
|
7586
9293
|
};
|
|
7587
9294
|
|
|
7588
|
-
// ../../.yarn/cache/path-expression-matcher-npm-1.
|
|
9295
|
+
// ../../.yarn/cache/path-expression-matcher-npm-1.2.0-0a1470212e-eab23babd9.zip/node_modules/path-expression-matcher/src/Matcher.js
|
|
9296
|
+
var MUTATING_METHODS = /* @__PURE__ */ new Set(["push", "pop", "reset", "updateCurrent", "restore"]);
|
|
7589
9297
|
var Matcher = class {
|
|
7590
9298
|
/**
|
|
7591
9299
|
* Create a new Matcher
|
|
@@ -7894,9 +9602,69 @@ var Matcher = class {
|
|
|
7894
9602
|
this.path = snapshot.path.map((node) => ({ ...node }));
|
|
7895
9603
|
this.siblingStacks = snapshot.siblingStacks.map((map2) => new Map(map2));
|
|
7896
9604
|
}
|
|
9605
|
+
/**
|
|
9606
|
+
* Return a read-only view of this matcher.
|
|
9607
|
+
*
|
|
9608
|
+
* The returned object exposes all query/inspection methods but throws a
|
|
9609
|
+
* TypeError if any state-mutating method is called (`push`, `pop`, `reset`,
|
|
9610
|
+
* `updateCurrent`, `restore`). Property reads (e.g. `.path`, `.separator`)
|
|
9611
|
+
* are allowed but the returned arrays/objects are frozen so callers cannot
|
|
9612
|
+
* mutate internal state through them either.
|
|
9613
|
+
*
|
|
9614
|
+
* @returns {ReadOnlyMatcher} A proxy that forwards read operations and blocks writes.
|
|
9615
|
+
*
|
|
9616
|
+
* @example
|
|
9617
|
+
* const matcher = new Matcher();
|
|
9618
|
+
* matcher.push("root", {});
|
|
9619
|
+
*
|
|
9620
|
+
* const ro = matcher.readOnly();
|
|
9621
|
+
* ro.matches(expr); // ✓ works
|
|
9622
|
+
* ro.getCurrentTag(); // ✓ works
|
|
9623
|
+
* ro.push("child", {}); // ✗ throws TypeError
|
|
9624
|
+
* ro.reset(); // ✗ throws TypeError
|
|
9625
|
+
*/
|
|
9626
|
+
readOnly() {
|
|
9627
|
+
const self2 = this;
|
|
9628
|
+
return new Proxy(self2, {
|
|
9629
|
+
get(target, prop, receiver) {
|
|
9630
|
+
if (MUTATING_METHODS.has(prop)) {
|
|
9631
|
+
return () => {
|
|
9632
|
+
throw new TypeError(
|
|
9633
|
+
`Cannot call '${prop}' on a read-only Matcher. Obtain a writable instance to mutate state.`
|
|
9634
|
+
);
|
|
9635
|
+
};
|
|
9636
|
+
}
|
|
9637
|
+
const value = Reflect.get(target, prop, receiver);
|
|
9638
|
+
if (prop === "path" || prop === "siblingStacks") {
|
|
9639
|
+
return Object.freeze(
|
|
9640
|
+
Array.isArray(value) ? value.map(
|
|
9641
|
+
(item) => item instanceof Map ? Object.freeze(new Map(item)) : Object.freeze({ ...item })
|
|
9642
|
+
// freeze a copy of each node
|
|
9643
|
+
) : value
|
|
9644
|
+
);
|
|
9645
|
+
}
|
|
9646
|
+
if (typeof value === "function") {
|
|
9647
|
+
return value.bind(target);
|
|
9648
|
+
}
|
|
9649
|
+
return value;
|
|
9650
|
+
},
|
|
9651
|
+
// Prevent any property assignment on the read-only view
|
|
9652
|
+
set(_target, prop) {
|
|
9653
|
+
throw new TypeError(
|
|
9654
|
+
`Cannot set property '${String(prop)}' on a read-only Matcher.`
|
|
9655
|
+
);
|
|
9656
|
+
},
|
|
9657
|
+
// Prevent property deletion
|
|
9658
|
+
deleteProperty(_target, prop) {
|
|
9659
|
+
throw new TypeError(
|
|
9660
|
+
`Cannot delete property '${String(prop)}' from a read-only Matcher.`
|
|
9661
|
+
);
|
|
9662
|
+
}
|
|
9663
|
+
});
|
|
9664
|
+
}
|
|
7897
9665
|
};
|
|
7898
9666
|
|
|
7899
|
-
// ../../.yarn/cache/fast-xml-parser-npm-5.5.
|
|
9667
|
+
// ../../.yarn/cache/fast-xml-parser-npm-5.5.8-4d571da1cb-888f9a5d34.zip/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js
|
|
7900
9668
|
function extractRawAttributes(prefixedAttrs, options2) {
|
|
7901
9669
|
if (!prefixedAttrs) return {};
|
|
7902
9670
|
const attrs = options2.attributesGroupName ? prefixedAttrs[options2.attributesGroupName] : prefixedAttrs;
|
|
@@ -7967,6 +9735,7 @@ var OrderedObjParser = class {
|
|
|
7967
9735
|
this.entityExpansionCount = 0;
|
|
7968
9736
|
this.currentExpandedLength = 0;
|
|
7969
9737
|
this.matcher = new Matcher();
|
|
9738
|
+
this.readonlyMatcher = this.matcher.readOnly();
|
|
7970
9739
|
this.isCurrentNodeStopNode = false;
|
|
7971
9740
|
if (this.options.stopNodes && this.options.stopNodes.length > 0) {
|
|
7972
9741
|
this.stopNodeExpressions = [];
|
|
@@ -8046,7 +9815,7 @@ function buildAttributesMap(attrStr, jPath, tagName) {
|
|
|
8046
9815
|
if (this.options.trimValues) {
|
|
8047
9816
|
parsedVal = parsedVal.trim();
|
|
8048
9817
|
}
|
|
8049
|
-
parsedVal = this.replaceEntitiesValue(parsedVal, tagName,
|
|
9818
|
+
parsedVal = this.replaceEntitiesValue(parsedVal, tagName, this.readonlyMatcher);
|
|
8050
9819
|
rawAttrsForMatcher[attrName] = parsedVal;
|
|
8051
9820
|
}
|
|
8052
9821
|
}
|
|
@@ -8055,7 +9824,7 @@ function buildAttributesMap(attrStr, jPath, tagName) {
|
|
|
8055
9824
|
}
|
|
8056
9825
|
for (let i = 0; i < len; i++) {
|
|
8057
9826
|
const attrName = this.resolveNameSpace(matches[i][1]);
|
|
8058
|
-
const jPathStr = this.options.jPath ? jPath.toString() :
|
|
9827
|
+
const jPathStr = this.options.jPath ? jPath.toString() : this.readonlyMatcher;
|
|
8059
9828
|
if (this.ignoreAttributesFn(attrName, jPathStr)) {
|
|
8060
9829
|
continue;
|
|
8061
9830
|
}
|
|
@@ -8070,8 +9839,8 @@ function buildAttributesMap(attrStr, jPath, tagName) {
|
|
|
8070
9839
|
if (this.options.trimValues) {
|
|
8071
9840
|
oldVal = oldVal.trim();
|
|
8072
9841
|
}
|
|
8073
|
-
oldVal = this.replaceEntitiesValue(oldVal, tagName,
|
|
8074
|
-
const jPathOrMatcher = this.options.jPath ? jPath.toString() :
|
|
9842
|
+
oldVal = this.replaceEntitiesValue(oldVal, tagName, this.readonlyMatcher);
|
|
9843
|
+
const jPathOrMatcher = this.options.jPath ? jPath.toString() : this.readonlyMatcher;
|
|
8075
9844
|
const newVal = this.options.attributeValueProcessor(attrName, oldVal, jPathOrMatcher);
|
|
8076
9845
|
if (newVal === null || newVal === void 0) {
|
|
8077
9846
|
attrs[aName] = oldVal;
|
|
@@ -8123,7 +9892,7 @@ var parseXml = function(xmlData) {
|
|
|
8123
9892
|
}
|
|
8124
9893
|
tagName = transformTagName(this.options.transformTagName, tagName, "", this.options).tagName;
|
|
8125
9894
|
if (currentNode) {
|
|
8126
|
-
textData = this.saveTextToParentTag(textData, currentNode, this.
|
|
9895
|
+
textData = this.saveTextToParentTag(textData, currentNode, this.readonlyMatcher);
|
|
8127
9896
|
}
|
|
8128
9897
|
const lastTagName = this.matcher.getCurrentTag();
|
|
8129
9898
|
if (tagName && this.options.unpairedTags.indexOf(tagName) !== -1) {
|
|
@@ -8141,7 +9910,7 @@ var parseXml = function(xmlData) {
|
|
|
8141
9910
|
} else if (xmlData[i + 1] === "?") {
|
|
8142
9911
|
let tagData = readTagExp(xmlData, i, false, "?>");
|
|
8143
9912
|
if (!tagData) throw new Error("Pi Tag is not closed.");
|
|
8144
|
-
textData = this.saveTextToParentTag(textData, currentNode, this.
|
|
9913
|
+
textData = this.saveTextToParentTag(textData, currentNode, this.readonlyMatcher);
|
|
8145
9914
|
if (this.options.ignoreDeclaration && tagData.tagName === "?xml" || this.options.ignorePiTags) {
|
|
8146
9915
|
} else {
|
|
8147
9916
|
const childNode = new XmlNode(tagData.tagName);
|
|
@@ -8149,14 +9918,14 @@ var parseXml = function(xmlData) {
|
|
|
8149
9918
|
if (tagData.tagName !== tagData.tagExp && tagData.attrExpPresent) {
|
|
8150
9919
|
childNode[":@"] = this.buildAttributesMap(tagData.tagExp, this.matcher, tagData.tagName);
|
|
8151
9920
|
}
|
|
8152
|
-
this.addChild(currentNode, childNode, this.
|
|
9921
|
+
this.addChild(currentNode, childNode, this.readonlyMatcher, i);
|
|
8153
9922
|
}
|
|
8154
9923
|
i = tagData.closeIndex + 1;
|
|
8155
9924
|
} else if (xmlData.substr(i + 1, 3) === "!--") {
|
|
8156
9925
|
const endIndex = findClosingIndex(xmlData, "-->", i + 4, "Comment is not closed.");
|
|
8157
9926
|
if (this.options.commentPropName) {
|
|
8158
9927
|
const comment = xmlData.substring(i + 4, endIndex - 2);
|
|
8159
|
-
textData = this.saveTextToParentTag(textData, currentNode, this.
|
|
9928
|
+
textData = this.saveTextToParentTag(textData, currentNode, this.readonlyMatcher);
|
|
8160
9929
|
currentNode.add(this.options.commentPropName, [{ [this.options.textNodeName]: comment }]);
|
|
8161
9930
|
}
|
|
8162
9931
|
i = endIndex;
|
|
@@ -8167,8 +9936,8 @@ var parseXml = function(xmlData) {
|
|
|
8167
9936
|
} else if (xmlData.substr(i + 1, 2) === "![") {
|
|
8168
9937
|
const closeIndex = findClosingIndex(xmlData, "]]>", i, "CDATA is not closed.") - 2;
|
|
8169
9938
|
const tagExp = xmlData.substring(i + 9, closeIndex);
|
|
8170
|
-
textData = this.saveTextToParentTag(textData, currentNode, this.
|
|
8171
|
-
let val = this.parseTextData(tagExp, currentNode.tagname, this.
|
|
9939
|
+
textData = this.saveTextToParentTag(textData, currentNode, this.readonlyMatcher);
|
|
9940
|
+
let val = this.parseTextData(tagExp, currentNode.tagname, this.readonlyMatcher, true, false, true, true);
|
|
8172
9941
|
if (val == void 0) val = "";
|
|
8173
9942
|
if (this.options.cdataPropName) {
|
|
8174
9943
|
currentNode.add(this.options.cdataPropName, [{ [this.options.textNodeName]: tagExp }]);
|
|
@@ -8193,7 +9962,7 @@ var parseXml = function(xmlData) {
|
|
|
8193
9962
|
}
|
|
8194
9963
|
if (currentNode && textData) {
|
|
8195
9964
|
if (currentNode.tagname !== "!xml") {
|
|
8196
|
-
textData = this.saveTextToParentTag(textData, currentNode, this.
|
|
9965
|
+
textData = this.saveTextToParentTag(textData, currentNode, this.readonlyMatcher, false);
|
|
8197
9966
|
}
|
|
8198
9967
|
}
|
|
8199
9968
|
const lastTag = currentNode;
|
|
@@ -8248,7 +10017,7 @@ var parseXml = function(xmlData) {
|
|
|
8248
10017
|
childNode.add(this.options.textNodeName, tagContent);
|
|
8249
10018
|
this.matcher.pop();
|
|
8250
10019
|
this.isCurrentNodeStopNode = false;
|
|
8251
|
-
this.addChild(currentNode, childNode, this.
|
|
10020
|
+
this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
|
|
8252
10021
|
} else {
|
|
8253
10022
|
if (isSelfClosing) {
|
|
8254
10023
|
({ tagName, tagExp } = transformTagName(this.options.transformTagName, tagName, tagExp, this.options));
|
|
@@ -8256,7 +10025,7 @@ var parseXml = function(xmlData) {
|
|
|
8256
10025
|
if (prefixedAttrs) {
|
|
8257
10026
|
childNode[":@"] = prefixedAttrs;
|
|
8258
10027
|
}
|
|
8259
|
-
this.addChild(currentNode, childNode, this.
|
|
10028
|
+
this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
|
|
8260
10029
|
this.matcher.pop();
|
|
8261
10030
|
this.isCurrentNodeStopNode = false;
|
|
8262
10031
|
} else if (this.options.unpairedTags.indexOf(tagName) !== -1) {
|
|
@@ -8264,7 +10033,7 @@ var parseXml = function(xmlData) {
|
|
|
8264
10033
|
if (prefixedAttrs) {
|
|
8265
10034
|
childNode[":@"] = prefixedAttrs;
|
|
8266
10035
|
}
|
|
8267
|
-
this.addChild(currentNode, childNode, this.
|
|
10036
|
+
this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
|
|
8268
10037
|
this.matcher.pop();
|
|
8269
10038
|
this.isCurrentNodeStopNode = false;
|
|
8270
10039
|
i = result.closeIndex;
|
|
@@ -8278,7 +10047,7 @@ var parseXml = function(xmlData) {
|
|
|
8278
10047
|
if (prefixedAttrs) {
|
|
8279
10048
|
childNode[":@"] = prefixedAttrs;
|
|
8280
10049
|
}
|
|
8281
|
-
this.addChild(currentNode, childNode, this.
|
|
10050
|
+
this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
|
|
8282
10051
|
currentNode = childNode;
|
|
8283
10052
|
}
|
|
8284
10053
|
textData = "";
|
|
@@ -8548,7 +10317,7 @@ function sanitizeName(name, options2) {
|
|
|
8548
10317
|
return name;
|
|
8549
10318
|
}
|
|
8550
10319
|
|
|
8551
|
-
// ../../.yarn/cache/fast-xml-parser-npm-5.5.
|
|
10320
|
+
// ../../.yarn/cache/fast-xml-parser-npm-5.5.8-4d571da1cb-888f9a5d34.zip/node_modules/fast-xml-parser/src/xmlparser/node2json.js
|
|
8552
10321
|
var METADATA_SYMBOL2 = XmlNode.getMetaDataSymbol();
|
|
8553
10322
|
function stripAttributePrefix(attrs, prefix) {
|
|
8554
10323
|
if (!attrs || typeof attrs !== "object") return {};
|
|
@@ -8564,10 +10333,10 @@ function stripAttributePrefix(attrs, prefix) {
|
|
|
8564
10333
|
}
|
|
8565
10334
|
return rawAttrs;
|
|
8566
10335
|
}
|
|
8567
|
-
function prettify(node, options2, matcher) {
|
|
8568
|
-
return compress(node, options2, matcher);
|
|
10336
|
+
function prettify(node, options2, matcher, readonlyMatcher) {
|
|
10337
|
+
return compress(node, options2, matcher, readonlyMatcher);
|
|
8569
10338
|
}
|
|
8570
|
-
function compress(arr, options2, matcher) {
|
|
10339
|
+
function compress(arr, options2, matcher, readonlyMatcher) {
|
|
8571
10340
|
let text;
|
|
8572
10341
|
const compressedObj = {};
|
|
8573
10342
|
for (let i = 0; i < arr.length; i++) {
|
|
@@ -8586,10 +10355,10 @@ function compress(arr, options2, matcher) {
|
|
|
8586
10355
|
} else if (property === void 0) {
|
|
8587
10356
|
continue;
|
|
8588
10357
|
} else if (tagObj[property]) {
|
|
8589
|
-
let val = compress(tagObj[property], options2, matcher);
|
|
10358
|
+
let val = compress(tagObj[property], options2, matcher, readonlyMatcher);
|
|
8590
10359
|
const isLeaf = isLeafTag(val, options2);
|
|
8591
10360
|
if (tagObj[":@"]) {
|
|
8592
|
-
assignAttributes(val, tagObj[":@"],
|
|
10361
|
+
assignAttributes(val, tagObj[":@"], readonlyMatcher, options2);
|
|
8593
10362
|
} else if (Object.keys(val).length === 1 && val[options2.textNodeName] !== void 0 && !options2.alwaysCreateTextNode) {
|
|
8594
10363
|
val = val[options2.textNodeName];
|
|
8595
10364
|
} else if (Object.keys(val).length === 0) {
|
|
@@ -8605,7 +10374,7 @@ function compress(arr, options2, matcher) {
|
|
|
8605
10374
|
}
|
|
8606
10375
|
compressedObj[property].push(val);
|
|
8607
10376
|
} else {
|
|
8608
|
-
const jPathOrMatcher = options2.jPath ?
|
|
10377
|
+
const jPathOrMatcher = options2.jPath ? readonlyMatcher.toString() : readonlyMatcher;
|
|
8609
10378
|
if (options2.isArray(property, jPathOrMatcher, isLeaf)) {
|
|
8610
10379
|
compressedObj[property] = [val];
|
|
8611
10380
|
} else {
|
|
@@ -8629,14 +10398,14 @@ function propName(obj) {
|
|
|
8629
10398
|
if (key !== ":@") return key;
|
|
8630
10399
|
}
|
|
8631
10400
|
}
|
|
8632
|
-
function assignAttributes(obj, attrMap,
|
|
10401
|
+
function assignAttributes(obj, attrMap, readonlyMatcher, options2) {
|
|
8633
10402
|
if (attrMap) {
|
|
8634
10403
|
const keys = Object.keys(attrMap);
|
|
8635
10404
|
const len = keys.length;
|
|
8636
10405
|
for (let i = 0; i < len; i++) {
|
|
8637
10406
|
const atrrName = keys[i];
|
|
8638
10407
|
const rawAttrName = atrrName.startsWith(options2.attributeNamePrefix) ? atrrName.substring(options2.attributeNamePrefix.length) : atrrName;
|
|
8639
|
-
const jPathOrMatcher = options2.jPath ?
|
|
10408
|
+
const jPathOrMatcher = options2.jPath ? readonlyMatcher.toString() + "." + rawAttrName : readonlyMatcher;
|
|
8640
10409
|
if (options2.isArray(atrrName, jPathOrMatcher, true, true)) {
|
|
8641
10410
|
obj[atrrName] = [attrMap[atrrName]];
|
|
8642
10411
|
} else {
|
|
@@ -8657,7 +10426,7 @@ function isLeafTag(obj, options2) {
|
|
|
8657
10426
|
return false;
|
|
8658
10427
|
}
|
|
8659
10428
|
|
|
8660
|
-
// ../../.yarn/cache/fast-xml-parser-npm-5.5.
|
|
10429
|
+
// ../../.yarn/cache/fast-xml-parser-npm-5.5.8-4d571da1cb-888f9a5d34.zip/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js
|
|
8661
10430
|
var XMLParser = class {
|
|
8662
10431
|
constructor(options2) {
|
|
8663
10432
|
this.externalEntities = {};
|
|
@@ -8685,7 +10454,7 @@ var XMLParser = class {
|
|
|
8685
10454
|
orderedObjParser.addExternalEntities(this.externalEntities);
|
|
8686
10455
|
const orderedResult = orderedObjParser.parseXml(xmlData);
|
|
8687
10456
|
if (this.options.preserveOrder || orderedResult === void 0) return orderedResult;
|
|
8688
|
-
else return prettify(orderedResult, this.options, orderedObjParser.matcher);
|
|
10457
|
+
else return prettify(orderedResult, this.options, orderedObjParser.matcher, orderedObjParser.readonlyMatcher);
|
|
8689
10458
|
}
|
|
8690
10459
|
/**
|
|
8691
10460
|
* Add Entity which is not by default supported by this library
|
|
@@ -18857,7 +20626,7 @@ var copy = {
|
|
|
18857
20626
|
|
|
18858
20627
|
// ../generator-html-doc/src/html-doc-generator.ts
|
|
18859
20628
|
import { mkdir as mkdir4 } from "node:fs/promises";
|
|
18860
|
-
import { join as
|
|
20629
|
+
import { join as join15 } from "node:path";
|
|
18861
20630
|
|
|
18862
20631
|
// ../generator-json/src/gir-metadata-deserializer.ts
|
|
18863
20632
|
import { DeclarationReflection } from "typedoc";
|
|
@@ -21477,6 +23246,7 @@ import {
|
|
|
21477
23246
|
Application,
|
|
21478
23247
|
Converter,
|
|
21479
23248
|
normalizePath,
|
|
23249
|
+
ReferenceReflection,
|
|
21480
23250
|
ReflectionCategory,
|
|
21481
23251
|
Serializer,
|
|
21482
23252
|
TSConfigReader
|
|
@@ -21805,7 +23575,7 @@ var TypeDocPipeline = class {
|
|
|
21805
23575
|
* converts each package separately, then merges them into one ProjectReflection.
|
|
21806
23576
|
*/
|
|
21807
23577
|
async createCombinedTypeDocApp() {
|
|
21808
|
-
|
|
23578
|
+
const result = await this.bootstrapAndConvert(
|
|
21809
23579
|
{
|
|
21810
23580
|
entryPoints: [join10(this.tempDir, "*")],
|
|
21811
23581
|
entryPointStrategy: "packages",
|
|
@@ -21819,6 +23589,8 @@ var TypeDocPipeline = class {
|
|
|
21819
23589
|
},
|
|
21820
23590
|
[new TSConfigReader()]
|
|
21821
23591
|
);
|
|
23592
|
+
this.fixExportImportReferences(result.project);
|
|
23593
|
+
return result;
|
|
21822
23594
|
}
|
|
21823
23595
|
/**
|
|
21824
23596
|
* Bootstrap a TypeDoc Application using the "merge" entry point strategy.
|
|
@@ -21837,7 +23609,9 @@ var TypeDocPipeline = class {
|
|
|
21837
23609
|
[]
|
|
21838
23610
|
);
|
|
21839
23611
|
app.deserializer.addDeserializer(new GirMetadataDeserializer());
|
|
21840
|
-
|
|
23612
|
+
const result = await this.convertApp(app, "merged documentation");
|
|
23613
|
+
this.fixExportImportReferences(result.project);
|
|
23614
|
+
return result;
|
|
21841
23615
|
}
|
|
21842
23616
|
async cleanup() {
|
|
21843
23617
|
if (this.tempDir) {
|
|
@@ -22027,6 +23801,56 @@ var TypeDocPipeline = class {
|
|
|
22027
23801
|
const dotIdx = name.indexOf(".");
|
|
22028
23802
|
return dotIdx > 0 ? name.slice(0, dotIdx) : name;
|
|
22029
23803
|
}
|
|
23804
|
+
/**
|
|
23805
|
+
* Fix ReferenceReflection targets broken by TypeDoc's handling of
|
|
23806
|
+
* `export import X = Y.Z` statements.
|
|
23807
|
+
*
|
|
23808
|
+
* TypeDoc may resolve all such re-exports within a namespace to the same
|
|
23809
|
+
* target reflection (e.g. every Cairo enum points to Status). This method
|
|
23810
|
+
* detects the mismatch and corrects each reference's internal target ID.
|
|
23811
|
+
*/
|
|
23812
|
+
fixExportImportReferences(project) {
|
|
23813
|
+
const refsByTargetId = /* @__PURE__ */ new Map();
|
|
23814
|
+
for (const r of Object.values(project.reflections)) {
|
|
23815
|
+
if (!(r instanceof ReferenceReflection)) continue;
|
|
23816
|
+
const target = r.tryGetTargetReflectionDeep();
|
|
23817
|
+
if (!target) continue;
|
|
23818
|
+
let list2 = refsByTargetId.get(target.id);
|
|
23819
|
+
if (!list2) {
|
|
23820
|
+
list2 = [];
|
|
23821
|
+
refsByTargetId.set(target.id, list2);
|
|
23822
|
+
}
|
|
23823
|
+
list2.push(r);
|
|
23824
|
+
}
|
|
23825
|
+
const brokenTargetIds = /* @__PURE__ */ new Set();
|
|
23826
|
+
for (const [targetId, refs] of refsByTargetId) {
|
|
23827
|
+
const distinctNames = new Set(refs.map((r) => r.name));
|
|
23828
|
+
if (distinctNames.size > 1) {
|
|
23829
|
+
brokenTargetIds.add(targetId);
|
|
23830
|
+
}
|
|
23831
|
+
}
|
|
23832
|
+
if (brokenTargetIds.size === 0) return;
|
|
23833
|
+
const nonRefByName = /* @__PURE__ */ new Map();
|
|
23834
|
+
for (const refl of Object.values(project.reflections)) {
|
|
23835
|
+
if (refl.isReference()) continue;
|
|
23836
|
+
let list2 = nonRefByName.get(refl.name);
|
|
23837
|
+
if (!list2) {
|
|
23838
|
+
list2 = [];
|
|
23839
|
+
nonRefByName.set(refl.name, list2);
|
|
23840
|
+
}
|
|
23841
|
+
list2.push({ id: refl.id, kind: refl.kind });
|
|
23842
|
+
}
|
|
23843
|
+
for (const r of Object.values(project.reflections)) {
|
|
23844
|
+
if (!(r instanceof ReferenceReflection)) continue;
|
|
23845
|
+
const target = r.tryGetTargetReflectionDeep();
|
|
23846
|
+
if (!target || target.name === r.name) continue;
|
|
23847
|
+
if (!brokenTargetIds.has(target.id)) continue;
|
|
23848
|
+
const candidates = nonRefByName.get(r.name);
|
|
23849
|
+
if (!candidates?.length) continue;
|
|
23850
|
+
const correctTarget = candidates.find((c) => c.kind === target.kind) ?? candidates[0];
|
|
23851
|
+
r._target = correctTarget.id;
|
|
23852
|
+
}
|
|
23853
|
+
}
|
|
22030
23854
|
/** Register GIR metadata serializer and namespace-level metadata on a TypeDoc app. */
|
|
22031
23855
|
registerGirMetadata(app, module) {
|
|
22032
23856
|
const index = buildGirLookupIndex(module);
|
|
@@ -22186,8 +24010,8 @@ var JsonDefinitionGenerator = class _JsonDefinitionGenerator {
|
|
|
22186
24010
|
};
|
|
22187
24011
|
|
|
22188
24012
|
// ../typedoc-theme/src/theme.ts
|
|
22189
|
-
import { copyFileSync, writeFileSync as
|
|
22190
|
-
import { dirname as dirname8, join as
|
|
24013
|
+
import { copyFileSync, writeFileSync as writeFileSync3 } from "node:fs";
|
|
24014
|
+
import { dirname as dirname8, join as join14 } from "node:path";
|
|
22191
24015
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
22192
24016
|
import { DefaultTheme, RendererEvent } from "typedoc";
|
|
22193
24017
|
|
|
@@ -22307,7 +24131,7 @@ function getGirNamespaceMetadata(reflection) {
|
|
|
22307
24131
|
const mod = findOwningModule(reflection) ?? reflection;
|
|
22308
24132
|
return mod.girNamespaceMetadata;
|
|
22309
24133
|
}
|
|
22310
|
-
var COMPANION_OWNER_KINDS = ReflectionKind.Class | ReflectionKind.Interface;
|
|
24134
|
+
var COMPANION_OWNER_KINDS = ReflectionKind.Class | ReflectionKind.Interface | ReflectionKind.Enum;
|
|
22311
24135
|
function findCompanionNamespace(refl) {
|
|
22312
24136
|
if (!refl.kindOf(COMPANION_OWNER_KINDS)) return void 0;
|
|
22313
24137
|
const parent = refl.parent;
|
|
@@ -22458,6 +24282,99 @@ var giDocgenHeader = (context, props) => {
|
|
|
22458
24282
|
|
|
22459
24283
|
// ../typedoc-theme/src/partials/layout.ts
|
|
22460
24284
|
import { JSX as JSX3 } from "typedoc";
|
|
24285
|
+
|
|
24286
|
+
// ../typedoc-theme/src/search-splitter.ts
|
|
24287
|
+
var import_lunr = __toESM(require_lunr(), 1);
|
|
24288
|
+
import { readFileSync as readFileSync5, writeFileSync as writeFileSync2 } from "node:fs";
|
|
24289
|
+
import { join as join12 } from "node:path";
|
|
24290
|
+
import { deflateSync, inflateSync } from "node:zlib";
|
|
24291
|
+
var KIND_MODULE = 2;
|
|
24292
|
+
function sanitizeModuleName(name) {
|
|
24293
|
+
return name.toLowerCase().replace(/[/\\]/g, "_");
|
|
24294
|
+
}
|
|
24295
|
+
function getModuleName(row, moduleNames) {
|
|
24296
|
+
if (row.kind === KIND_MODULE) return row.name;
|
|
24297
|
+
if (!row.parent) return void 0;
|
|
24298
|
+
for (const mod of moduleNames) {
|
|
24299
|
+
if (row.parent === mod || row.parent.startsWith(`${mod}.`)) {
|
|
24300
|
+
return mod;
|
|
24301
|
+
}
|
|
24302
|
+
}
|
|
24303
|
+
return void 0;
|
|
24304
|
+
}
|
|
24305
|
+
function buildChunk(rows) {
|
|
24306
|
+
const builder7 = new import_lunr.default.Builder();
|
|
24307
|
+
builder7.pipeline.add(import_lunr.default.trimmer);
|
|
24308
|
+
builder7.ref("id");
|
|
24309
|
+
builder7.field("name", { boost: 10 });
|
|
24310
|
+
for (let i = 0; i < rows.length; i++) {
|
|
24311
|
+
builder7.add({ id: i, name: rows[i].name });
|
|
24312
|
+
}
|
|
24313
|
+
const index = builder7.build();
|
|
24314
|
+
const data = { rows, index };
|
|
24315
|
+
const compressed = deflateSync(Buffer.from(JSON.stringify(data)));
|
|
24316
|
+
return compressed.toString("base64");
|
|
24317
|
+
}
|
|
24318
|
+
function readSearchData(assetsDir) {
|
|
24319
|
+
const raw = readFileSync5(join12(assetsDir, "search.js"), "utf-8");
|
|
24320
|
+
const match = raw.match(/window\.searchData\s*=\s*"([^"]+)"/);
|
|
24321
|
+
if (!match?.[1]) {
|
|
24322
|
+
throw new Error("Could not extract searchData from search.js");
|
|
24323
|
+
}
|
|
24324
|
+
const decoded = Buffer.from(match[1], "base64");
|
|
24325
|
+
const decompressed = inflateSync(decoded);
|
|
24326
|
+
return JSON.parse(decompressed.toString("utf-8"));
|
|
24327
|
+
}
|
|
24328
|
+
async function splitSearchIndex(outputDir) {
|
|
24329
|
+
const assetsDir = join12(outputDir, "assets");
|
|
24330
|
+
let searchData;
|
|
24331
|
+
try {
|
|
24332
|
+
searchData = readSearchData(assetsDir);
|
|
24333
|
+
} catch {
|
|
24334
|
+
return;
|
|
24335
|
+
}
|
|
24336
|
+
const { rows } = searchData;
|
|
24337
|
+
const moduleNames = /* @__PURE__ */ new Set();
|
|
24338
|
+
for (const row of rows) {
|
|
24339
|
+
if (row.kind === KIND_MODULE) {
|
|
24340
|
+
moduleNames.add(row.name);
|
|
24341
|
+
}
|
|
24342
|
+
}
|
|
24343
|
+
const moduleMap = /* @__PURE__ */ new Map();
|
|
24344
|
+
const moduleEntries = [];
|
|
24345
|
+
for (const row of rows) {
|
|
24346
|
+
if (row.kind === KIND_MODULE) {
|
|
24347
|
+
moduleEntries.push(row);
|
|
24348
|
+
}
|
|
24349
|
+
const mod = getModuleName(row, moduleNames);
|
|
24350
|
+
if (!mod) continue;
|
|
24351
|
+
let bucket = moduleMap.get(mod);
|
|
24352
|
+
if (!bucket) {
|
|
24353
|
+
bucket = [];
|
|
24354
|
+
moduleMap.set(mod, bucket);
|
|
24355
|
+
}
|
|
24356
|
+
bucket.push(row);
|
|
24357
|
+
}
|
|
24358
|
+
for (const [moduleName, moduleRows] of moduleMap) {
|
|
24359
|
+
const chunk = buildChunk(moduleRows);
|
|
24360
|
+
const filename = `search-${sanitizeModuleName(moduleName)}.js`;
|
|
24361
|
+
writeFileSync2(join12(assetsDir, filename), `window.searchData = "${chunk}";`);
|
|
24362
|
+
}
|
|
24363
|
+
const modulesChunk = buildChunk(moduleEntries);
|
|
24364
|
+
writeFileSync2(join12(assetsDir, "search-modules.js"), `window.searchData = "${modulesChunk}";`);
|
|
24365
|
+
writeFileSync2(join12(assetsDir, "search.js"), "window.searchData = null;");
|
|
24366
|
+
const totalChunks = moduleMap.size + 1;
|
|
24367
|
+
console.log(`[search-splitter] Split ${rows.length} entries into ${totalChunks} chunks (${moduleMap.size} modules)`);
|
|
24368
|
+
}
|
|
24369
|
+
|
|
24370
|
+
// ../typedoc-theme/src/partials/layout.ts
|
|
24371
|
+
function getSearchScript(props) {
|
|
24372
|
+
const owningModule = findOwningModule(props.model);
|
|
24373
|
+
if (owningModule) {
|
|
24374
|
+
return `assets/search-${sanitizeModuleName(owningModule.name)}.js`;
|
|
24375
|
+
}
|
|
24376
|
+
return "assets/search-modules.js";
|
|
24377
|
+
}
|
|
22461
24378
|
var giDocgenLayout = (context, template, props) => JSX3.createElement(
|
|
22462
24379
|
"html",
|
|
22463
24380
|
{ class: "default", lang: context.options.getValue("lang"), "data-base": context.relativeURL("./") },
|
|
@@ -22508,7 +24425,7 @@ var giDocgenLayout = (context, template, props) => JSX3.createElement(
|
|
|
22508
24425
|
}),
|
|
22509
24426
|
JSX3.createElement("script", {
|
|
22510
24427
|
async: true,
|
|
22511
|
-
src: context.relativeURL(
|
|
24428
|
+
src: context.relativeURL(getSearchScript(props), true),
|
|
22512
24429
|
id: "tsd-search-script"
|
|
22513
24430
|
}),
|
|
22514
24431
|
JSX3.createElement("script", {
|
|
@@ -22566,7 +24483,7 @@ var giDocgenLayout = (context, template, props) => JSX3.createElement(
|
|
|
22566
24483
|
// ../typedoc-theme/src/partials/module-reflection.ts
|
|
22567
24484
|
import {
|
|
22568
24485
|
JSX as JSX4,
|
|
22569
|
-
ReferenceReflection,
|
|
24486
|
+
ReferenceReflection as ReferenceReflection2,
|
|
22570
24487
|
ReflectionKind as ReflectionKind3
|
|
22571
24488
|
} from "typedoc";
|
|
22572
24489
|
function isNoneSection(section) {
|
|
@@ -22669,11 +24586,12 @@ function giDocgenModuleReflection(context, mod) {
|
|
|
22669
24586
|
if (mod.isDeclaration() && isCompanionNamespace(mod)) {
|
|
22670
24587
|
const parent = mod.parent;
|
|
22671
24588
|
const siblings = parent && "children" in parent ? parent.children : void 0;
|
|
22672
|
-
const
|
|
22673
|
-
(child) => child !== mod && child.kindOf(ReflectionKind3.Class) && child.name === mod.name
|
|
24589
|
+
const companionOwner = siblings?.find(
|
|
24590
|
+
(child) => child !== mod && child.kindOf(ReflectionKind3.Class | ReflectionKind3.Interface | ReflectionKind3.Enum) && child.name === mod.name
|
|
22674
24591
|
);
|
|
22675
|
-
if (
|
|
22676
|
-
const
|
|
24592
|
+
if (companionOwner) {
|
|
24593
|
+
const ownerUrl = context.urlTo(companionOwner);
|
|
24594
|
+
const kindName = companionOwner.kindOf(ReflectionKind3.Enum) ? "enum" : companionOwner.kindOf(ReflectionKind3.Interface) ? "interface" : "class";
|
|
22677
24595
|
return JSX4.createElement(
|
|
22678
24596
|
JSX4.Fragment,
|
|
22679
24597
|
null,
|
|
@@ -22681,13 +24599,13 @@ function giDocgenModuleReflection(context, mod) {
|
|
|
22681
24599
|
"p",
|
|
22682
24600
|
null,
|
|
22683
24601
|
"This namespace is a companion to the ",
|
|
22684
|
-
JSX4.createElement("a", { href:
|
|
22685
|
-
|
|
24602
|
+
JSX4.createElement("a", { href: ownerUrl }, companionOwner.name),
|
|
24603
|
+
` ${kindName}. See the ${kindName} page for full documentation.`
|
|
22686
24604
|
),
|
|
22687
24605
|
JSX4.createElement(
|
|
22688
24606
|
"script",
|
|
22689
24607
|
null,
|
|
22690
|
-
JSX4.createElement(JSX4.Raw, { html: `window.location.replace("${
|
|
24608
|
+
JSX4.createElement(JSX4.Raw, { html: `window.location.replace("${ownerUrl}");` })
|
|
22691
24609
|
)
|
|
22692
24610
|
);
|
|
22693
24611
|
}
|
|
@@ -22797,12 +24715,12 @@ function giDocgenModuleMemberSummary(context, member) {
|
|
|
22797
24715
|
context.page.pageHeadings.push({
|
|
22798
24716
|
link: `#${id}`,
|
|
22799
24717
|
text: getDisplayName(member),
|
|
22800
|
-
kind: member instanceof
|
|
24718
|
+
kind: member instanceof ReferenceReflection2 ? member.getTargetReflectionDeep().kind : member.kind,
|
|
22801
24719
|
classes: context.getReflectionClasses(member),
|
|
22802
24720
|
icon: context.theme.getReflectionIcon(member)
|
|
22803
24721
|
});
|
|
22804
24722
|
let name;
|
|
22805
|
-
if (member instanceof
|
|
24723
|
+
if (member instanceof ReferenceReflection2) {
|
|
22806
24724
|
const target = member.getTargetReflectionDeep();
|
|
22807
24725
|
name = JSX4.createElement(
|
|
22808
24726
|
"span",
|
|
@@ -22965,12 +24883,18 @@ import { JSX as JSX7 } from "typedoc";
|
|
|
22965
24883
|
var giDocgenPageSidebar = (context, props) => JSX7.createElement(JSX7.Fragment, null, context.pageNavigation(props));
|
|
22966
24884
|
|
|
22967
24885
|
// ../typedoc-theme/src/partials/sidebar.ts
|
|
22968
|
-
import { readFileSync as
|
|
22969
|
-
import { dirname as dirname7, join as
|
|
24886
|
+
import { readFileSync as readFileSync6 } from "node:fs";
|
|
24887
|
+
import { dirname as dirname7, join as join13 } from "node:path";
|
|
22970
24888
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
22971
24889
|
import { i18n, JSX as JSX8, ReflectionKind as ReflectionKind4 } from "typedoc";
|
|
22972
|
-
|
|
22973
|
-
|
|
24890
|
+
function getTsForGirVersion() {
|
|
24891
|
+
if (true) {
|
|
24892
|
+
return "4.0.0-beta.42";
|
|
24893
|
+
}
|
|
24894
|
+
const __dirname3 = dirname7(fileURLToPath4(import.meta.url));
|
|
24895
|
+
return JSON.parse(readFileSync6(join13(__dirname3, "..", "..", "package.json"), "utf8")).version;
|
|
24896
|
+
}
|
|
24897
|
+
var TSFOR_GIR_VERSION = getTsForGirVersion();
|
|
22974
24898
|
function giDocgenModuleInfo(context, mod, nsMeta) {
|
|
22975
24899
|
const depElements = nsMeta.dependencies.map((dep) => {
|
|
22976
24900
|
const depPackageName = `${dep.namespace}-${dep.version}`;
|
|
@@ -23401,7 +25325,7 @@ var GiDocgenThemeRenderContext = class extends DefaultThemeRenderContext {
|
|
|
23401
25325
|
};
|
|
23402
25326
|
|
|
23403
25327
|
// ../typedoc-theme/src/theme.ts
|
|
23404
|
-
var
|
|
25328
|
+
var __dirname2 = dirname8(fileURLToPath5(import.meta.url));
|
|
23405
25329
|
var FAVICON_FILES = [
|
|
23406
25330
|
"favicon.ico",
|
|
23407
25331
|
"favicon-96x96.png",
|
|
@@ -23424,13 +25348,13 @@ var GiDocgenTheme = class extends DefaultTheme {
|
|
|
23424
25348
|
constructor(renderer) {
|
|
23425
25349
|
super(renderer);
|
|
23426
25350
|
this.owner.on(RendererEvent.END, (event) => {
|
|
23427
|
-
const assetsDir =
|
|
23428
|
-
copyFileSync(
|
|
23429
|
-
copyFileSync(
|
|
23430
|
-
copyFileSync(
|
|
23431
|
-
const faviconDir =
|
|
25351
|
+
const assetsDir = join14(event.outputDirectory, "assets");
|
|
25352
|
+
copyFileSync(join14(__dirname2, "static", "style.css"), join14(assetsDir, "gi-docgen.css"));
|
|
25353
|
+
copyFileSync(join14(__dirname2, "static", "gi-docgen-inherited.js"), join14(assetsDir, "gi-docgen-inherited.js"));
|
|
25354
|
+
copyFileSync(join14(__dirname2, "static", "logo_x4.png"), join14(assetsDir, "logo_x4.png"));
|
|
25355
|
+
const faviconDir = join14(__dirname2, "static", "favicon");
|
|
23432
25356
|
for (const file of FAVICON_FILES) {
|
|
23433
|
-
copyFileSync(
|
|
25357
|
+
copyFileSync(join14(faviconDir, file), join14(assetsDir, file));
|
|
23434
25358
|
}
|
|
23435
25359
|
const projectName = event.project.name || "TS for GIR";
|
|
23436
25360
|
const manifest = {
|
|
@@ -23444,12 +25368,15 @@ var GiDocgenTheme = class extends DefaultTheme {
|
|
|
23444
25368
|
background_color: "#1e1e1e",
|
|
23445
25369
|
display: "standalone"
|
|
23446
25370
|
};
|
|
23447
|
-
|
|
25371
|
+
writeFileSync3(join14(assetsDir, "site.webmanifest"), JSON.stringify(manifest, null, 2));
|
|
23448
25372
|
});
|
|
23449
25373
|
}
|
|
23450
25374
|
getNavigation(project) {
|
|
23451
25375
|
return buildShallowNavigation(super.getNavigation(project));
|
|
23452
25376
|
}
|
|
25377
|
+
async postRender(event) {
|
|
25378
|
+
await splitSearchIndex(event.outputDirectory);
|
|
25379
|
+
}
|
|
23453
25380
|
};
|
|
23454
25381
|
|
|
23455
25382
|
// ../typedoc-theme/src/index.ts
|
|
@@ -23495,7 +25422,7 @@ var HtmlDocGenerator = class _HtmlDocGenerator {
|
|
|
23495
25422
|
} else {
|
|
23496
25423
|
for (const module of this.pipeline.modules) {
|
|
23497
25424
|
const result = await this.pipeline.createTypeDocApp(module);
|
|
23498
|
-
await this.generateDocsWithTheme(result,
|
|
25425
|
+
await this.generateDocsWithTheme(result, join15(outdir, module.packageName));
|
|
23499
25426
|
}
|
|
23500
25427
|
}
|
|
23501
25428
|
this.log.success(`HTML documentation generated for ${this.pipeline.modules.length} modules in ${outdir}`);
|
|
@@ -23848,4 +25775,56 @@ lodash/lodash.js:
|
|
|
23848
25775
|
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
23849
25776
|
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
23850
25777
|
*)
|
|
25778
|
+
|
|
25779
|
+
lunr/lunr.js:
|
|
25780
|
+
(**
|
|
25781
|
+
* lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 2.3.9
|
|
25782
|
+
* Copyright (C) 2020 Oliver Nightingale
|
|
25783
|
+
* @license MIT
|
|
25784
|
+
*)
|
|
25785
|
+
(*!
|
|
25786
|
+
* lunr.utils
|
|
25787
|
+
* Copyright (C) 2020 Oliver Nightingale
|
|
25788
|
+
*)
|
|
25789
|
+
(*!
|
|
25790
|
+
* lunr.Set
|
|
25791
|
+
* Copyright (C) 2020 Oliver Nightingale
|
|
25792
|
+
*)
|
|
25793
|
+
(*!
|
|
25794
|
+
* lunr.tokenizer
|
|
25795
|
+
* Copyright (C) 2020 Oliver Nightingale
|
|
25796
|
+
*)
|
|
25797
|
+
(*!
|
|
25798
|
+
* lunr.Pipeline
|
|
25799
|
+
* Copyright (C) 2020 Oliver Nightingale
|
|
25800
|
+
*)
|
|
25801
|
+
(*!
|
|
25802
|
+
* lunr.Vector
|
|
25803
|
+
* Copyright (C) 2020 Oliver Nightingale
|
|
25804
|
+
*)
|
|
25805
|
+
(*!
|
|
25806
|
+
* lunr.stemmer
|
|
25807
|
+
* Copyright (C) 2020 Oliver Nightingale
|
|
25808
|
+
* Includes code from - http://tartarus.org/~martin/PorterStemmer/js.txt
|
|
25809
|
+
*)
|
|
25810
|
+
(*!
|
|
25811
|
+
* lunr.stopWordFilter
|
|
25812
|
+
* Copyright (C) 2020 Oliver Nightingale
|
|
25813
|
+
*)
|
|
25814
|
+
(*!
|
|
25815
|
+
* lunr.trimmer
|
|
25816
|
+
* Copyright (C) 2020 Oliver Nightingale
|
|
25817
|
+
*)
|
|
25818
|
+
(*!
|
|
25819
|
+
* lunr.TokenSet
|
|
25820
|
+
* Copyright (C) 2020 Oliver Nightingale
|
|
25821
|
+
*)
|
|
25822
|
+
(*!
|
|
25823
|
+
* lunr.Index
|
|
25824
|
+
* Copyright (C) 2020 Oliver Nightingale
|
|
25825
|
+
*)
|
|
25826
|
+
(*!
|
|
25827
|
+
* lunr.Builder
|
|
25828
|
+
* Copyright (C) 2020 Oliver Nightingale
|
|
25829
|
+
*)
|
|
23851
25830
|
*/
|