@ts-for-gir/cli 4.0.0-rc.3 → 4.0.0-rc.5
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 +2325 -491
- package/dist-templates/types-locally/.ts-for-girrc.js +6 -0
- package/dist-templates/types-locally/README.md +15 -0
- package/dist-templates/types-locally/esbuild.ts +10 -0
- package/dist-templates/types-locally/main.ts +21 -0
- package/dist-templates/types-locally/package.json +18 -0
- package/dist-templates/types-locally/tsconfig.json +17 -0
- package/dist-templates/types-npm/README.md +14 -0
- package/dist-templates/types-npm/esbuild.ts +10 -0
- package/dist-templates/types-npm/main.ts +19 -0
- package/dist-templates/types-npm/package.json +23 -0
- package/dist-templates/types-npm/tsconfig.json +15 -0
- package/dist-templates/types-workspace/.ts-for-girrc.js +12 -0
- package/dist-templates/types-workspace/README.md +26 -0
- package/dist-templates/types-workspace/package.json +22 -0
- package/dist-templates/types-workspace/packages/app/esbuild.ts +10 -0
- package/dist-templates/types-workspace/packages/app/main.ts +19 -0
- package/dist-templates/types-workspace/packages/app/package.json +23 -0
- package/dist-templates/types-workspace/packages/app/tsconfig.json +15 -0
- package/dist-templates/types-workspace/tsconfig.json +11 -0
- package/package.json +21 -18
- package/src/commands/create.ts +214 -0
- package/src/commands/index.ts +1 -0
- package/src/config/config-loader.ts +1 -0
- package/src/config/index.ts +9 -1
- package/src/config/options.ts +27 -0
- package/src/start.ts +2 -1
- package/src/types/command-args.ts +23 -0
package/bin/ts-for-gir
CHANGED
|
@@ -3346,7 +3346,7 @@ var require_lodash = __commonJS({
|
|
|
3346
3346
|
}
|
|
3347
3347
|
return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
|
|
3348
3348
|
});
|
|
3349
|
-
function
|
|
3349
|
+
function join17(array, separator) {
|
|
3350
3350
|
return array == null ? "" : nativeJoin.call(array, separator);
|
|
3351
3351
|
}
|
|
3352
3352
|
function last(array) {
|
|
@@ -4304,7 +4304,7 @@ var require_lodash = __commonJS({
|
|
|
4304
4304
|
copyObject(source, keys(source), object, customizer);
|
|
4305
4305
|
});
|
|
4306
4306
|
var at = flatRest(baseAt);
|
|
4307
|
-
function
|
|
4307
|
+
function create2(prototype, properties) {
|
|
4308
4308
|
var result2 = baseCreate(prototype);
|
|
4309
4309
|
return properties == null ? result2 : baseAssign(result2, properties);
|
|
4310
4310
|
}
|
|
@@ -5056,7 +5056,7 @@ var require_lodash = __commonJS({
|
|
|
5056
5056
|
lodash2.conforms = conforms;
|
|
5057
5057
|
lodash2.constant = constant;
|
|
5058
5058
|
lodash2.countBy = countBy;
|
|
5059
|
-
lodash2.create =
|
|
5059
|
+
lodash2.create = create2;
|
|
5060
5060
|
lodash2.curry = curry;
|
|
5061
5061
|
lodash2.curryRight = curryRight;
|
|
5062
5062
|
lodash2.debounce = debounce;
|
|
@@ -5270,7 +5270,7 @@ var require_lodash = __commonJS({
|
|
|
5270
5270
|
lodash2.isUndefined = isUndefined;
|
|
5271
5271
|
lodash2.isWeakMap = isWeakMap;
|
|
5272
5272
|
lodash2.isWeakSet = isWeakSet;
|
|
5273
|
-
lodash2.join =
|
|
5273
|
+
lodash2.join = join17;
|
|
5274
5274
|
lodash2.kebabCase = kebabCase;
|
|
5275
5275
|
lodash2.last = last;
|
|
5276
5276
|
lodash2.lastIndexOf = lastIndexOf;
|
|
@@ -5532,17 +5532,17 @@ var require_lunr = __commonJS({
|
|
|
5532
5532
|
"../../.yarn/cache/lunr-npm-2.3.9-fa3aa9c2d6-f2f6db34c0.zip/node_modules/lunr/lunr.js"(exports2, module) {
|
|
5533
5533
|
(function() {
|
|
5534
5534
|
var lunr2 = function(config) {
|
|
5535
|
-
var
|
|
5536
|
-
|
|
5535
|
+
var builder8 = new lunr2.Builder();
|
|
5536
|
+
builder8.pipeline.add(
|
|
5537
5537
|
lunr2.trimmer,
|
|
5538
5538
|
lunr2.stopWordFilter,
|
|
5539
5539
|
lunr2.stemmer
|
|
5540
5540
|
);
|
|
5541
|
-
|
|
5541
|
+
builder8.searchPipeline.add(
|
|
5542
5542
|
lunr2.stemmer
|
|
5543
5543
|
);
|
|
5544
|
-
config.call(
|
|
5545
|
-
return
|
|
5544
|
+
config.call(builder8, builder8);
|
|
5545
|
+
return builder8.build();
|
|
5546
5546
|
};
|
|
5547
5547
|
lunr2.version = "2.3.9";
|
|
5548
5548
|
lunr2.utils = {};
|
|
@@ -6218,12 +6218,12 @@ var require_lunr = __commonJS({
|
|
|
6218
6218
|
};
|
|
6219
6219
|
lunr2.TokenSet._nextId = 1;
|
|
6220
6220
|
lunr2.TokenSet.fromArray = function(arr) {
|
|
6221
|
-
var
|
|
6221
|
+
var builder8 = new lunr2.TokenSet.Builder();
|
|
6222
6222
|
for (var i = 0, len = arr.length; i < len; i++) {
|
|
6223
|
-
|
|
6223
|
+
builder8.insert(arr[i]);
|
|
6224
6224
|
}
|
|
6225
|
-
|
|
6226
|
-
return
|
|
6225
|
+
builder8.finish();
|
|
6226
|
+
return builder8.root;
|
|
6227
6227
|
};
|
|
6228
6228
|
lunr2.TokenSet.fromClause = function(clause) {
|
|
6229
6229
|
if ("editDistance" in clause) {
|
|
@@ -7268,7 +7268,7 @@ import { dirname, join } from "node:path";
|
|
|
7268
7268
|
import { fileURLToPath } from "node:url";
|
|
7269
7269
|
function getPackageVersion() {
|
|
7270
7270
|
if (true) {
|
|
7271
|
-
return "4.0.0-rc.
|
|
7271
|
+
return "4.0.0-rc.5";
|
|
7272
7272
|
}
|
|
7273
7273
|
const currentModulePath = fileURLToPath(import.meta.url);
|
|
7274
7274
|
const currentDir = dirname(currentModulePath);
|
|
@@ -7879,10 +7879,10 @@ ${"=".repeat(50)}`);
|
|
|
7879
7879
|
if (statistics.typeStatistics.commonTypeConflicts.length > 0) {
|
|
7880
7880
|
console.log(`
|
|
7881
7881
|
\u2694\uFE0F Type Conflicts:`);
|
|
7882
|
-
statistics.typeStatistics.commonTypeConflicts.forEach(({ conflictType, count, examples:
|
|
7882
|
+
statistics.typeStatistics.commonTypeConflicts.forEach(({ conflictType, count, examples: examples8 }) => {
|
|
7883
7883
|
console.log(` ${yellow(conflictType)}: ${count} conflicts`);
|
|
7884
|
-
if (
|
|
7885
|
-
console.log(` \u2514\u2500 Examples: ${gray(
|
|
7884
|
+
if (examples8.length > 0) {
|
|
7885
|
+
console.log(` \u2514\u2500 Examples: ${gray(examples8.join(", "))}`);
|
|
7886
7886
|
}
|
|
7887
7887
|
});
|
|
7888
7888
|
}
|
|
@@ -8165,7 +8165,7 @@ import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
|
8165
8165
|
var NEW_LINE_REG_EXP = /[\n\r]+/g;
|
|
8166
8166
|
function getPackageVersion2() {
|
|
8167
8167
|
if (true) {
|
|
8168
|
-
return "4.0.0-rc.
|
|
8168
|
+
return "4.0.0-rc.5";
|
|
8169
8169
|
}
|
|
8170
8170
|
const currentModulePath = fileURLToPath2(import.meta.url);
|
|
8171
8171
|
const currentDir = dirname2(currentModulePath);
|
|
@@ -8197,7 +8197,7 @@ __export(parser_exports, {
|
|
|
8197
8197
|
parseGir: () => parseGir
|
|
8198
8198
|
});
|
|
8199
8199
|
|
|
8200
|
-
// ../../.yarn/cache/fast-xml-parser-npm-5.
|
|
8200
|
+
// ../../.yarn/cache/fast-xml-parser-npm-5.7.2-960de42682-7f32d77127.zip/node_modules/fast-xml-parser/src/util.js
|
|
8201
8201
|
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";
|
|
8202
8202
|
var nameChar = nameStartChar + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
|
|
8203
8203
|
var nameRegexp = "[" + nameStartChar + "][" + nameChar + "]*";
|
|
@@ -8238,7 +8238,7 @@ var DANGEROUS_PROPERTY_NAMES = [
|
|
|
8238
8238
|
];
|
|
8239
8239
|
var criticalProperties = ["__proto__", "constructor", "prototype"];
|
|
8240
8240
|
|
|
8241
|
-
// ../../.yarn/cache/fast-xml-parser-npm-5.
|
|
8241
|
+
// ../../.yarn/cache/fast-xml-parser-npm-5.7.2-960de42682-7f32d77127.zip/node_modules/fast-xml-parser/src/validator.js
|
|
8242
8242
|
var defaultOptions = {
|
|
8243
8243
|
allowBooleanAttributes: false,
|
|
8244
8244
|
//A tag can have attributes without any value
|
|
@@ -8544,7 +8544,1476 @@ function getPositionFromMatch(match) {
|
|
|
8544
8544
|
return match.startIndex + match[1].length;
|
|
8545
8545
|
}
|
|
8546
8546
|
|
|
8547
|
-
// ../../.yarn/cache
|
|
8547
|
+
// ../../.yarn/cache/@nodable-entities-npm-2.1.0-6eb9f06ac0-355c55e82a.zip/node_modules/@nodable/entities/src/entities.js
|
|
8548
|
+
var BASIC_LATIN = {
|
|
8549
|
+
amp: "&",
|
|
8550
|
+
AMP: "&",
|
|
8551
|
+
lt: "<",
|
|
8552
|
+
LT: "<",
|
|
8553
|
+
gt: ">",
|
|
8554
|
+
GT: ">",
|
|
8555
|
+
quot: '"',
|
|
8556
|
+
QUOT: '"',
|
|
8557
|
+
apos: "'",
|
|
8558
|
+
lsquo: "\u2018",
|
|
8559
|
+
rsquo: "\u2019",
|
|
8560
|
+
ldquo: "\u201C",
|
|
8561
|
+
rdquo: "\u201D",
|
|
8562
|
+
lsquor: "\u201A",
|
|
8563
|
+
rsquor: "\u2019",
|
|
8564
|
+
ldquor: "\u201E",
|
|
8565
|
+
bdquo: "\u201E",
|
|
8566
|
+
comma: ",",
|
|
8567
|
+
period: ".",
|
|
8568
|
+
colon: ":",
|
|
8569
|
+
semi: ";",
|
|
8570
|
+
excl: "!",
|
|
8571
|
+
quest: "?",
|
|
8572
|
+
num: "#",
|
|
8573
|
+
dollar: "$",
|
|
8574
|
+
percent: "%",
|
|
8575
|
+
amp: "&",
|
|
8576
|
+
ast: "*",
|
|
8577
|
+
commat: "@",
|
|
8578
|
+
lowbar: "_",
|
|
8579
|
+
verbar: "|",
|
|
8580
|
+
vert: "|",
|
|
8581
|
+
sol: "/",
|
|
8582
|
+
bsol: "\\",
|
|
8583
|
+
lbrace: "{",
|
|
8584
|
+
rbrace: "}",
|
|
8585
|
+
lbrack: "[",
|
|
8586
|
+
rbrack: "]",
|
|
8587
|
+
lpar: "(",
|
|
8588
|
+
rpar: ")",
|
|
8589
|
+
nbsp: "\xA0",
|
|
8590
|
+
iexcl: "\xA1",
|
|
8591
|
+
cent: "\xA2",
|
|
8592
|
+
pound: "\xA3",
|
|
8593
|
+
curren: "\xA4",
|
|
8594
|
+
yen: "\xA5",
|
|
8595
|
+
brvbar: "\xA6",
|
|
8596
|
+
sect: "\xA7",
|
|
8597
|
+
uml: "\xA8",
|
|
8598
|
+
copy: "\xA9",
|
|
8599
|
+
COPY: "\xA9",
|
|
8600
|
+
ordf: "\xAA",
|
|
8601
|
+
laquo: "\xAB",
|
|
8602
|
+
not: "\xAC",
|
|
8603
|
+
shy: "\xAD",
|
|
8604
|
+
reg: "\xAE",
|
|
8605
|
+
REG: "\xAE",
|
|
8606
|
+
macr: "\xAF",
|
|
8607
|
+
deg: "\xB0",
|
|
8608
|
+
plusmn: "\xB1",
|
|
8609
|
+
sup2: "\xB2",
|
|
8610
|
+
sup3: "\xB3",
|
|
8611
|
+
acute: "\xB4",
|
|
8612
|
+
micro: "\xB5",
|
|
8613
|
+
para: "\xB6",
|
|
8614
|
+
middot: "\xB7",
|
|
8615
|
+
cedil: "\xB8",
|
|
8616
|
+
sup1: "\xB9",
|
|
8617
|
+
ordm: "\xBA",
|
|
8618
|
+
raquo: "\xBB",
|
|
8619
|
+
frac14: "\xBC",
|
|
8620
|
+
frac12: "\xBD",
|
|
8621
|
+
half: "\xBD",
|
|
8622
|
+
frac34: "\xBE",
|
|
8623
|
+
iquest: "\xBF",
|
|
8624
|
+
times: "\xD7",
|
|
8625
|
+
div: "\xF7",
|
|
8626
|
+
divide: "\xF7"
|
|
8627
|
+
};
|
|
8628
|
+
var LATIN_ACCENTS = {
|
|
8629
|
+
Agrave: "\xC0",
|
|
8630
|
+
agrave: "\xE0",
|
|
8631
|
+
Aacute: "\xC1",
|
|
8632
|
+
aacute: "\xE1",
|
|
8633
|
+
Acirc: "\xC2",
|
|
8634
|
+
acirc: "\xE2",
|
|
8635
|
+
Atilde: "\xC3",
|
|
8636
|
+
atilde: "\xE3",
|
|
8637
|
+
Auml: "\xC4",
|
|
8638
|
+
auml: "\xE4",
|
|
8639
|
+
Aring: "\xC5",
|
|
8640
|
+
aring: "\xE5",
|
|
8641
|
+
AElig: "\xC6",
|
|
8642
|
+
aelig: "\xE6",
|
|
8643
|
+
Ccedil: "\xC7",
|
|
8644
|
+
ccedil: "\xE7",
|
|
8645
|
+
Egrave: "\xC8",
|
|
8646
|
+
egrave: "\xE8",
|
|
8647
|
+
Eacute: "\xC9",
|
|
8648
|
+
eacute: "\xE9",
|
|
8649
|
+
Ecirc: "\xCA",
|
|
8650
|
+
ecirc: "\xEA",
|
|
8651
|
+
Euml: "\xCB",
|
|
8652
|
+
euml: "\xEB",
|
|
8653
|
+
Igrave: "\xCC",
|
|
8654
|
+
igrave: "\xEC",
|
|
8655
|
+
Iacute: "\xCD",
|
|
8656
|
+
iacute: "\xED",
|
|
8657
|
+
Icirc: "\xCE",
|
|
8658
|
+
icirc: "\xEE",
|
|
8659
|
+
Iuml: "\xCF",
|
|
8660
|
+
iuml: "\xEF",
|
|
8661
|
+
ETH: "\xD0",
|
|
8662
|
+
eth: "\xF0",
|
|
8663
|
+
Ntilde: "\xD1",
|
|
8664
|
+
ntilde: "\xF1",
|
|
8665
|
+
Ograve: "\xD2",
|
|
8666
|
+
ograve: "\xF2",
|
|
8667
|
+
Oacute: "\xD3",
|
|
8668
|
+
oacute: "\xF3",
|
|
8669
|
+
Ocirc: "\xD4",
|
|
8670
|
+
ocirc: "\xF4",
|
|
8671
|
+
Otilde: "\xD5",
|
|
8672
|
+
otilde: "\xF5",
|
|
8673
|
+
Ouml: "\xD6",
|
|
8674
|
+
ouml: "\xF6",
|
|
8675
|
+
Oslash: "\xD8",
|
|
8676
|
+
oslash: "\xF8",
|
|
8677
|
+
Ugrave: "\xD9",
|
|
8678
|
+
ugrave: "\xF9",
|
|
8679
|
+
Uacute: "\xDA",
|
|
8680
|
+
uacute: "\xFA",
|
|
8681
|
+
Ucirc: "\xDB",
|
|
8682
|
+
ucirc: "\xFB",
|
|
8683
|
+
Uuml: "\xDC",
|
|
8684
|
+
uuml: "\xFC",
|
|
8685
|
+
Yacute: "\xDD",
|
|
8686
|
+
yacute: "\xFD",
|
|
8687
|
+
THORN: "\xDE",
|
|
8688
|
+
thorn: "\xFE",
|
|
8689
|
+
szlig: "\xDF",
|
|
8690
|
+
yuml: "\xFF",
|
|
8691
|
+
Yuml: "\u0178"
|
|
8692
|
+
};
|
|
8693
|
+
var LATIN_EXTENDED = {
|
|
8694
|
+
Amacr: "\u0100",
|
|
8695
|
+
amacr: "\u0101",
|
|
8696
|
+
Abreve: "\u0102",
|
|
8697
|
+
abreve: "\u0103",
|
|
8698
|
+
Aogon: "\u0104",
|
|
8699
|
+
aogon: "\u0105",
|
|
8700
|
+
Cacute: "\u0106",
|
|
8701
|
+
cacute: "\u0107",
|
|
8702
|
+
Ccirc: "\u0108",
|
|
8703
|
+
ccirc: "\u0109",
|
|
8704
|
+
Cdot: "\u010A",
|
|
8705
|
+
cdot: "\u010B",
|
|
8706
|
+
Ccaron: "\u010C",
|
|
8707
|
+
ccaron: "\u010D",
|
|
8708
|
+
Dcaron: "\u010E",
|
|
8709
|
+
dcaron: "\u010F",
|
|
8710
|
+
Dstrok: "\u0110",
|
|
8711
|
+
dstrok: "\u0111",
|
|
8712
|
+
Emacr: "\u0112",
|
|
8713
|
+
emacr: "\u0113",
|
|
8714
|
+
Ecaron: "\u011A",
|
|
8715
|
+
ecaron: "\u011B",
|
|
8716
|
+
Edot: "\u0116",
|
|
8717
|
+
edot: "\u0117",
|
|
8718
|
+
Eogon: "\u0118",
|
|
8719
|
+
eogon: "\u0119",
|
|
8720
|
+
Gcirc: "\u011C",
|
|
8721
|
+
gcirc: "\u011D",
|
|
8722
|
+
Gbreve: "\u011E",
|
|
8723
|
+
gbreve: "\u011F",
|
|
8724
|
+
Gdot: "\u0120",
|
|
8725
|
+
gdot: "\u0121",
|
|
8726
|
+
Gcedil: "\u0122",
|
|
8727
|
+
Hcirc: "\u0124",
|
|
8728
|
+
hcirc: "\u0125",
|
|
8729
|
+
Hstrok: "\u0126",
|
|
8730
|
+
hstrok: "\u0127",
|
|
8731
|
+
Itilde: "\u0128",
|
|
8732
|
+
itilde: "\u0129",
|
|
8733
|
+
Imacr: "\u012A",
|
|
8734
|
+
imacr: "\u012B",
|
|
8735
|
+
Iogon: "\u012E",
|
|
8736
|
+
iogon: "\u012F",
|
|
8737
|
+
Idot: "\u0130",
|
|
8738
|
+
IJlig: "\u0132",
|
|
8739
|
+
ijlig: "\u0133",
|
|
8740
|
+
Jcirc: "\u0134",
|
|
8741
|
+
jcirc: "\u0135",
|
|
8742
|
+
Kcedil: "\u0136",
|
|
8743
|
+
kcedil: "\u0137",
|
|
8744
|
+
kgreen: "\u0138",
|
|
8745
|
+
Lacute: "\u0139",
|
|
8746
|
+
lacute: "\u013A",
|
|
8747
|
+
Lcedil: "\u013B",
|
|
8748
|
+
lcedil: "\u013C",
|
|
8749
|
+
Lcaron: "\u013D",
|
|
8750
|
+
lcaron: "\u013E",
|
|
8751
|
+
Lmidot: "\u013F",
|
|
8752
|
+
lmidot: "\u0140",
|
|
8753
|
+
Lstrok: "\u0141",
|
|
8754
|
+
lstrok: "\u0142",
|
|
8755
|
+
Nacute: "\u0143",
|
|
8756
|
+
nacute: "\u0144",
|
|
8757
|
+
Ncaron: "\u0147",
|
|
8758
|
+
ncaron: "\u0148",
|
|
8759
|
+
Ncedil: "\u0145",
|
|
8760
|
+
ncedil: "\u0146",
|
|
8761
|
+
ENG: "\u014A",
|
|
8762
|
+
eng: "\u014B",
|
|
8763
|
+
Omacr: "\u014C",
|
|
8764
|
+
omacr: "\u014D",
|
|
8765
|
+
Odblac: "\u0150",
|
|
8766
|
+
odblac: "\u0151",
|
|
8767
|
+
OElig: "\u0152",
|
|
8768
|
+
oelig: "\u0153",
|
|
8769
|
+
Racute: "\u0154",
|
|
8770
|
+
racute: "\u0155",
|
|
8771
|
+
Rcaron: "\u0158",
|
|
8772
|
+
rcaron: "\u0159",
|
|
8773
|
+
Rcedil: "\u0156",
|
|
8774
|
+
rcedil: "\u0157",
|
|
8775
|
+
Sacute: "\u015A",
|
|
8776
|
+
sacute: "\u015B",
|
|
8777
|
+
Scirc: "\u015C",
|
|
8778
|
+
scirc: "\u015D",
|
|
8779
|
+
Scedil: "\u015E",
|
|
8780
|
+
scedil: "\u015F",
|
|
8781
|
+
Scaron: "\u0160",
|
|
8782
|
+
scaron: "\u0161",
|
|
8783
|
+
Tcedil: "\u0162",
|
|
8784
|
+
tcedil: "\u0163",
|
|
8785
|
+
Tcaron: "\u0164",
|
|
8786
|
+
tcaron: "\u0165",
|
|
8787
|
+
Tstrok: "\u0166",
|
|
8788
|
+
tstrok: "\u0167",
|
|
8789
|
+
Utilde: "\u0168",
|
|
8790
|
+
utilde: "\u0169",
|
|
8791
|
+
Umacr: "\u016A",
|
|
8792
|
+
umacr: "\u016B",
|
|
8793
|
+
Ubreve: "\u016C",
|
|
8794
|
+
ubreve: "\u016D",
|
|
8795
|
+
Uring: "\u016E",
|
|
8796
|
+
uring: "\u016F",
|
|
8797
|
+
Udblac: "\u0170",
|
|
8798
|
+
udblac: "\u0171",
|
|
8799
|
+
Uogon: "\u0172",
|
|
8800
|
+
uogon: "\u0173",
|
|
8801
|
+
Wcirc: "\u0174",
|
|
8802
|
+
wcirc: "\u0175",
|
|
8803
|
+
Ycirc: "\u0176",
|
|
8804
|
+
ycirc: "\u0177",
|
|
8805
|
+
Zacute: "\u0179",
|
|
8806
|
+
zacute: "\u017A",
|
|
8807
|
+
Zdot: "\u017B",
|
|
8808
|
+
zdot: "\u017C",
|
|
8809
|
+
Zcaron: "\u017D",
|
|
8810
|
+
zcaron: "\u017E"
|
|
8811
|
+
};
|
|
8812
|
+
var GREEK = {
|
|
8813
|
+
Alpha: "\u0391",
|
|
8814
|
+
alpha: "\u03B1",
|
|
8815
|
+
Beta: "\u0392",
|
|
8816
|
+
beta: "\u03B2",
|
|
8817
|
+
Gamma: "\u0393",
|
|
8818
|
+
gamma: "\u03B3",
|
|
8819
|
+
Delta: "\u0394",
|
|
8820
|
+
delta: "\u03B4",
|
|
8821
|
+
Epsilon: "\u0395",
|
|
8822
|
+
epsilon: "\u03B5",
|
|
8823
|
+
epsiv: "\u03F5",
|
|
8824
|
+
varepsilon: "\u03F5",
|
|
8825
|
+
Zeta: "\u0396",
|
|
8826
|
+
zeta: "\u03B6",
|
|
8827
|
+
Eta: "\u0397",
|
|
8828
|
+
eta: "\u03B7",
|
|
8829
|
+
Theta: "\u0398",
|
|
8830
|
+
theta: "\u03B8",
|
|
8831
|
+
thetasym: "\u03D1",
|
|
8832
|
+
vartheta: "\u03D1",
|
|
8833
|
+
Iota: "\u0399",
|
|
8834
|
+
iota: "\u03B9",
|
|
8835
|
+
Kappa: "\u039A",
|
|
8836
|
+
kappa: "\u03BA",
|
|
8837
|
+
kappav: "\u03F0",
|
|
8838
|
+
varkappa: "\u03F0",
|
|
8839
|
+
Lambda: "\u039B",
|
|
8840
|
+
lambda: "\u03BB",
|
|
8841
|
+
Mu: "\u039C",
|
|
8842
|
+
mu: "\u03BC",
|
|
8843
|
+
Nu: "\u039D",
|
|
8844
|
+
nu: "\u03BD",
|
|
8845
|
+
Xi: "\u039E",
|
|
8846
|
+
xi: "\u03BE",
|
|
8847
|
+
Omicron: "\u039F",
|
|
8848
|
+
omicron: "\u03BF",
|
|
8849
|
+
Pi: "\u03A0",
|
|
8850
|
+
pi: "\u03C0",
|
|
8851
|
+
piv: "\u03D6",
|
|
8852
|
+
varpi: "\u03D6",
|
|
8853
|
+
Rho: "\u03A1",
|
|
8854
|
+
rho: "\u03C1",
|
|
8855
|
+
rhov: "\u03F1",
|
|
8856
|
+
varrho: "\u03F1",
|
|
8857
|
+
Sigma: "\u03A3",
|
|
8858
|
+
sigma: "\u03C3",
|
|
8859
|
+
sigmaf: "\u03C2",
|
|
8860
|
+
sigmav: "\u03C2",
|
|
8861
|
+
varsigma: "\u03C2",
|
|
8862
|
+
Tau: "\u03A4",
|
|
8863
|
+
tau: "\u03C4",
|
|
8864
|
+
Upsilon: "\u03A5",
|
|
8865
|
+
upsilon: "\u03C5",
|
|
8866
|
+
upsi: "\u03C5",
|
|
8867
|
+
Upsi: "\u03D2",
|
|
8868
|
+
upsih: "\u03D2",
|
|
8869
|
+
Phi: "\u03A6",
|
|
8870
|
+
phi: "\u03C6",
|
|
8871
|
+
phiv: "\u03D5",
|
|
8872
|
+
varphi: "\u03D5",
|
|
8873
|
+
Chi: "\u03A7",
|
|
8874
|
+
chi: "\u03C7",
|
|
8875
|
+
Psi: "\u03A8",
|
|
8876
|
+
psi: "\u03C8",
|
|
8877
|
+
Omega: "\u03A9",
|
|
8878
|
+
omega: "\u03C9",
|
|
8879
|
+
ohm: "\u03A9",
|
|
8880
|
+
Gammad: "\u03DC",
|
|
8881
|
+
gammad: "\u03DD",
|
|
8882
|
+
digamma: "\u03DD"
|
|
8883
|
+
};
|
|
8884
|
+
var CYRILLIC = {
|
|
8885
|
+
Afr: "\u{1D504}",
|
|
8886
|
+
afr: "\u{1D51E}",
|
|
8887
|
+
Acy: "\u0410",
|
|
8888
|
+
acy: "\u0430",
|
|
8889
|
+
Bcy: "\u0411",
|
|
8890
|
+
bcy: "\u0431",
|
|
8891
|
+
Vcy: "\u0412",
|
|
8892
|
+
vcy: "\u0432",
|
|
8893
|
+
Gcy: "\u0413",
|
|
8894
|
+
gcy: "\u0433",
|
|
8895
|
+
Dcy: "\u0414",
|
|
8896
|
+
dcy: "\u0434",
|
|
8897
|
+
IEcy: "\u0415",
|
|
8898
|
+
iecy: "\u0435",
|
|
8899
|
+
IOcy: "\u0401",
|
|
8900
|
+
iocy: "\u0451",
|
|
8901
|
+
ZHcy: "\u0416",
|
|
8902
|
+
zhcy: "\u0436",
|
|
8903
|
+
Zcy: "\u0417",
|
|
8904
|
+
zcy: "\u0437",
|
|
8905
|
+
Icy: "\u0418",
|
|
8906
|
+
icy: "\u0438",
|
|
8907
|
+
Jcy: "\u0419",
|
|
8908
|
+
jcy: "\u0439",
|
|
8909
|
+
Kcy: "\u041A",
|
|
8910
|
+
kcy: "\u043A",
|
|
8911
|
+
Lcy: "\u041B",
|
|
8912
|
+
lcy: "\u043B",
|
|
8913
|
+
Mcy: "\u041C",
|
|
8914
|
+
mcy: "\u043C",
|
|
8915
|
+
Ncy: "\u041D",
|
|
8916
|
+
ncy: "\u043D",
|
|
8917
|
+
Ocy: "\u041E",
|
|
8918
|
+
ocy: "\u043E",
|
|
8919
|
+
Pcy: "\u041F",
|
|
8920
|
+
pcy: "\u043F",
|
|
8921
|
+
Rcy: "\u0420",
|
|
8922
|
+
rcy: "\u0440",
|
|
8923
|
+
Scy: "\u0421",
|
|
8924
|
+
scy: "\u0441",
|
|
8925
|
+
Tcy: "\u0422",
|
|
8926
|
+
tcy: "\u0442",
|
|
8927
|
+
Ucy: "\u0423",
|
|
8928
|
+
ucy: "\u0443",
|
|
8929
|
+
Fcy: "\u0424",
|
|
8930
|
+
fcy: "\u0444",
|
|
8931
|
+
KHcy: "\u0425",
|
|
8932
|
+
khcy: "\u0445",
|
|
8933
|
+
TScy: "\u0426",
|
|
8934
|
+
tscy: "\u0446",
|
|
8935
|
+
CHcy: "\u0427",
|
|
8936
|
+
chcy: "\u0447",
|
|
8937
|
+
SHcy: "\u0428",
|
|
8938
|
+
shcy: "\u0448",
|
|
8939
|
+
SHCHcy: "\u0429",
|
|
8940
|
+
shchcy: "\u0449",
|
|
8941
|
+
HARDcy: "\u042A",
|
|
8942
|
+
hardcy: "\u044A",
|
|
8943
|
+
Ycy: "\u042B",
|
|
8944
|
+
ycy: "\u044B",
|
|
8945
|
+
SOFTcy: "\u042C",
|
|
8946
|
+
softcy: "\u044C",
|
|
8947
|
+
Ecy: "\u042D",
|
|
8948
|
+
ecy: "\u044D",
|
|
8949
|
+
YUcy: "\u042E",
|
|
8950
|
+
yucy: "\u044E",
|
|
8951
|
+
YAcy: "\u042F",
|
|
8952
|
+
yacy: "\u044F",
|
|
8953
|
+
DJcy: "\u0402",
|
|
8954
|
+
djcy: "\u0452",
|
|
8955
|
+
GJcy: "\u0403",
|
|
8956
|
+
gjcy: "\u0453",
|
|
8957
|
+
Jukcy: "\u0404",
|
|
8958
|
+
jukcy: "\u0454",
|
|
8959
|
+
DScy: "\u0405",
|
|
8960
|
+
dscy: "\u0455",
|
|
8961
|
+
Iukcy: "\u0406",
|
|
8962
|
+
iukcy: "\u0456",
|
|
8963
|
+
YIcy: "\u0407",
|
|
8964
|
+
yicy: "\u0457",
|
|
8965
|
+
Jsercy: "\u0408",
|
|
8966
|
+
jsercy: "\u0458",
|
|
8967
|
+
LJcy: "\u0409",
|
|
8968
|
+
ljcy: "\u0459",
|
|
8969
|
+
NJcy: "\u040A",
|
|
8970
|
+
njcy: "\u045A",
|
|
8971
|
+
TSHcy: "\u040B",
|
|
8972
|
+
tshcy: "\u045B",
|
|
8973
|
+
KJcy: "\u040C",
|
|
8974
|
+
kjcy: "\u045C",
|
|
8975
|
+
Ubrcy: "\u040E",
|
|
8976
|
+
ubrcy: "\u045E",
|
|
8977
|
+
DZcy: "\u040F",
|
|
8978
|
+
dzcy: "\u045F"
|
|
8979
|
+
};
|
|
8980
|
+
var MATH = {
|
|
8981
|
+
plus: "+",
|
|
8982
|
+
minus: "\u2212",
|
|
8983
|
+
mnplus: "\u2213",
|
|
8984
|
+
mp: "\u2213",
|
|
8985
|
+
pm: "\xB1",
|
|
8986
|
+
times: "\xD7",
|
|
8987
|
+
div: "\xF7",
|
|
8988
|
+
divide: "\xF7",
|
|
8989
|
+
sdot: "\u22C5",
|
|
8990
|
+
star: "\u2606",
|
|
8991
|
+
starf: "\u2605",
|
|
8992
|
+
bigstar: "\u2605",
|
|
8993
|
+
lowast: "\u2217",
|
|
8994
|
+
ast: "*",
|
|
8995
|
+
midast: "*",
|
|
8996
|
+
compfn: "\u2218",
|
|
8997
|
+
smallcircle: "\u2218",
|
|
8998
|
+
bullet: "\u2022",
|
|
8999
|
+
bull: "\u2022",
|
|
9000
|
+
nbsp: "\xA0",
|
|
9001
|
+
hellip: "\u2026",
|
|
9002
|
+
mldr: "\u2026",
|
|
9003
|
+
prime: "\u2032",
|
|
9004
|
+
Prime: "\u2033",
|
|
9005
|
+
tprime: "\u2034",
|
|
9006
|
+
bprime: "\u2035",
|
|
9007
|
+
backprime: "\u2035",
|
|
9008
|
+
minus: "\u2212",
|
|
9009
|
+
minusd: "\u2238",
|
|
9010
|
+
dotminus: "\u2238",
|
|
9011
|
+
plusdo: "\u2214",
|
|
9012
|
+
dotplus: "\u2214",
|
|
9013
|
+
plusmn: "\xB1",
|
|
9014
|
+
minusplus: "\u2213",
|
|
9015
|
+
mnplus: "\u2213",
|
|
9016
|
+
mp: "\u2213",
|
|
9017
|
+
setminus: "\u2216",
|
|
9018
|
+
smallsetminus: "\u2216",
|
|
9019
|
+
Backslash: "\u2216",
|
|
9020
|
+
setmn: "\u2216",
|
|
9021
|
+
ssetmn: "\u2216",
|
|
9022
|
+
lowbar: "_",
|
|
9023
|
+
verbar: "|",
|
|
9024
|
+
vert: "|",
|
|
9025
|
+
VerticalLine: "|",
|
|
9026
|
+
colon: ":",
|
|
9027
|
+
Colon: "\u2237",
|
|
9028
|
+
Proportion: "\u2237",
|
|
9029
|
+
ratio: "\u2236",
|
|
9030
|
+
equals: "=",
|
|
9031
|
+
ne: "\u2260",
|
|
9032
|
+
nequiv: "\u2262",
|
|
9033
|
+
equiv: "\u2261",
|
|
9034
|
+
Congruent: "\u2261",
|
|
9035
|
+
sim: "\u223C",
|
|
9036
|
+
thicksim: "\u223C",
|
|
9037
|
+
thksim: "\u223C",
|
|
9038
|
+
sime: "\u2243",
|
|
9039
|
+
simeq: "\u2243",
|
|
9040
|
+
TildeEqual: "\u2243",
|
|
9041
|
+
asymp: "\u2248",
|
|
9042
|
+
approx: "\u2248",
|
|
9043
|
+
thickapprox: "\u2248",
|
|
9044
|
+
thkap: "\u2248",
|
|
9045
|
+
TildeTilde: "\u2248",
|
|
9046
|
+
ncong: "\u2247",
|
|
9047
|
+
cong: "\u2245",
|
|
9048
|
+
TildeFullEqual: "\u2245",
|
|
9049
|
+
asympeq: "\u224D",
|
|
9050
|
+
CupCap: "\u224D",
|
|
9051
|
+
bump: "\u224E",
|
|
9052
|
+
Bumpeq: "\u224E",
|
|
9053
|
+
HumpDownHump: "\u224E",
|
|
9054
|
+
bumpe: "\u224F",
|
|
9055
|
+
bumpeq: "\u224F",
|
|
9056
|
+
HumpEqual: "\u224F",
|
|
9057
|
+
dotminus: "\u2238",
|
|
9058
|
+
minusd: "\u2238",
|
|
9059
|
+
plusdo: "\u2214",
|
|
9060
|
+
dotplus: "\u2214",
|
|
9061
|
+
le: "\u2264",
|
|
9062
|
+
LessEqual: "\u2264",
|
|
9063
|
+
ge: "\u2265",
|
|
9064
|
+
GreaterEqual: "\u2265",
|
|
9065
|
+
lesseqgtr: "\u22DA",
|
|
9066
|
+
lesseqqgtr: "\u2A8B",
|
|
9067
|
+
greater: ">",
|
|
9068
|
+
less: "<"
|
|
9069
|
+
};
|
|
9070
|
+
var MATH_ADVANCED = {
|
|
9071
|
+
alefsym: "\u2135",
|
|
9072
|
+
aleph: "\u2135",
|
|
9073
|
+
beth: "\u2136",
|
|
9074
|
+
gimel: "\u2137",
|
|
9075
|
+
daleth: "\u2138",
|
|
9076
|
+
forall: "\u2200",
|
|
9077
|
+
ForAll: "\u2200",
|
|
9078
|
+
part: "\u2202",
|
|
9079
|
+
PartialD: "\u2202",
|
|
9080
|
+
exist: "\u2203",
|
|
9081
|
+
Exists: "\u2203",
|
|
9082
|
+
nexist: "\u2204",
|
|
9083
|
+
nexists: "\u2204",
|
|
9084
|
+
empty: "\u2205",
|
|
9085
|
+
emptyset: "\u2205",
|
|
9086
|
+
emptyv: "\u2205",
|
|
9087
|
+
varnothing: "\u2205",
|
|
9088
|
+
nabla: "\u2207",
|
|
9089
|
+
Del: "\u2207",
|
|
9090
|
+
isin: "\u2208",
|
|
9091
|
+
isinv: "\u2208",
|
|
9092
|
+
in: "\u2208",
|
|
9093
|
+
Element: "\u2208",
|
|
9094
|
+
notin: "\u2209",
|
|
9095
|
+
notinva: "\u2209",
|
|
9096
|
+
ni: "\u220B",
|
|
9097
|
+
niv: "\u220B",
|
|
9098
|
+
SuchThat: "\u220B",
|
|
9099
|
+
ReverseElement: "\u220B",
|
|
9100
|
+
notni: "\u220C",
|
|
9101
|
+
notniva: "\u220C",
|
|
9102
|
+
prod: "\u220F",
|
|
9103
|
+
Product: "\u220F",
|
|
9104
|
+
coprod: "\u2210",
|
|
9105
|
+
Coproduct: "\u2210",
|
|
9106
|
+
sum: "\u2211",
|
|
9107
|
+
Sum: "\u2211",
|
|
9108
|
+
minus: "\u2212",
|
|
9109
|
+
mp: "\u2213",
|
|
9110
|
+
plusdo: "\u2214",
|
|
9111
|
+
dotplus: "\u2214",
|
|
9112
|
+
setminus: "\u2216",
|
|
9113
|
+
lowast: "\u2217",
|
|
9114
|
+
radic: "\u221A",
|
|
9115
|
+
Sqrt: "\u221A",
|
|
9116
|
+
prop: "\u221D",
|
|
9117
|
+
propto: "\u221D",
|
|
9118
|
+
Proportional: "\u221D",
|
|
9119
|
+
varpropto: "\u221D",
|
|
9120
|
+
infin: "\u221E",
|
|
9121
|
+
infintie: "\u29DD",
|
|
9122
|
+
ang: "\u2220",
|
|
9123
|
+
angle: "\u2220",
|
|
9124
|
+
angmsd: "\u2221",
|
|
9125
|
+
measuredangle: "\u2221",
|
|
9126
|
+
angsph: "\u2222",
|
|
9127
|
+
mid: "\u2223",
|
|
9128
|
+
VerticalBar: "\u2223",
|
|
9129
|
+
nmid: "\u2224",
|
|
9130
|
+
nsmid: "\u2224",
|
|
9131
|
+
npar: "\u2226",
|
|
9132
|
+
parallel: "\u2225",
|
|
9133
|
+
spar: "\u2225",
|
|
9134
|
+
nparallel: "\u2226",
|
|
9135
|
+
nspar: "\u2226",
|
|
9136
|
+
and: "\u2227",
|
|
9137
|
+
wedge: "\u2227",
|
|
9138
|
+
or: "\u2228",
|
|
9139
|
+
vee: "\u2228",
|
|
9140
|
+
cap: "\u2229",
|
|
9141
|
+
cup: "\u222A",
|
|
9142
|
+
int: "\u222B",
|
|
9143
|
+
Integral: "\u222B",
|
|
9144
|
+
conint: "\u222E",
|
|
9145
|
+
ContourIntegral: "\u222E",
|
|
9146
|
+
Conint: "\u222F",
|
|
9147
|
+
DoubleContourIntegral: "\u222F",
|
|
9148
|
+
Cconint: "\u2230",
|
|
9149
|
+
there4: "\u2234",
|
|
9150
|
+
therefore: "\u2234",
|
|
9151
|
+
Therefore: "\u2234",
|
|
9152
|
+
becaus: "\u2235",
|
|
9153
|
+
because: "\u2235",
|
|
9154
|
+
Because: "\u2235",
|
|
9155
|
+
ratio: "\u2236",
|
|
9156
|
+
Proportion: "\u2237",
|
|
9157
|
+
minusd: "\u2238",
|
|
9158
|
+
dotminus: "\u2238",
|
|
9159
|
+
mDDot: "\u223A",
|
|
9160
|
+
homtht: "\u223B",
|
|
9161
|
+
sim: "\u223C",
|
|
9162
|
+
bsimg: "\u223D",
|
|
9163
|
+
backsim: "\u223D",
|
|
9164
|
+
ac: "\u223E",
|
|
9165
|
+
mstpos: "\u223E",
|
|
9166
|
+
acd: "\u223F",
|
|
9167
|
+
VerticalTilde: "\u2240",
|
|
9168
|
+
wr: "\u2240",
|
|
9169
|
+
wreath: "\u2240",
|
|
9170
|
+
nsime: "\u2244",
|
|
9171
|
+
nsimeq: "\u2244",
|
|
9172
|
+
nsimeq: "\u2244",
|
|
9173
|
+
ncong: "\u2247",
|
|
9174
|
+
simne: "\u2246",
|
|
9175
|
+
ncongdot: "\u2A6D\u0338",
|
|
9176
|
+
ngsim: "\u2275",
|
|
9177
|
+
nsim: "\u2241",
|
|
9178
|
+
napprox: "\u2249",
|
|
9179
|
+
nap: "\u2249",
|
|
9180
|
+
ngeq: "\u2271",
|
|
9181
|
+
nge: "\u2271",
|
|
9182
|
+
nleq: "\u2270",
|
|
9183
|
+
nle: "\u2270",
|
|
9184
|
+
ngtr: "\u226F",
|
|
9185
|
+
ngt: "\u226F",
|
|
9186
|
+
nless: "\u226E",
|
|
9187
|
+
nlt: "\u226E",
|
|
9188
|
+
nprec: "\u2280",
|
|
9189
|
+
npr: "\u2280",
|
|
9190
|
+
nsucc: "\u2281",
|
|
9191
|
+
nsc: "\u2281"
|
|
9192
|
+
};
|
|
9193
|
+
var ARROWS = {
|
|
9194
|
+
larr: "\u2190",
|
|
9195
|
+
leftarrow: "\u2190",
|
|
9196
|
+
LeftArrow: "\u2190",
|
|
9197
|
+
uarr: "\u2191",
|
|
9198
|
+
uparrow: "\u2191",
|
|
9199
|
+
UpArrow: "\u2191",
|
|
9200
|
+
rarr: "\u2192",
|
|
9201
|
+
rightarrow: "\u2192",
|
|
9202
|
+
RightArrow: "\u2192",
|
|
9203
|
+
darr: "\u2193",
|
|
9204
|
+
downarrow: "\u2193",
|
|
9205
|
+
DownArrow: "\u2193",
|
|
9206
|
+
harr: "\u2194",
|
|
9207
|
+
leftrightarrow: "\u2194",
|
|
9208
|
+
LeftRightArrow: "\u2194",
|
|
9209
|
+
varr: "\u2195",
|
|
9210
|
+
updownarrow: "\u2195",
|
|
9211
|
+
UpDownArrow: "\u2195",
|
|
9212
|
+
nwarr: "\u2196",
|
|
9213
|
+
nwarrow: "\u2196",
|
|
9214
|
+
UpperLeftArrow: "\u2196",
|
|
9215
|
+
nearr: "\u2197",
|
|
9216
|
+
nearrow: "\u2197",
|
|
9217
|
+
UpperRightArrow: "\u2197",
|
|
9218
|
+
searr: "\u2198",
|
|
9219
|
+
searrow: "\u2198",
|
|
9220
|
+
LowerRightArrow: "\u2198",
|
|
9221
|
+
swarr: "\u2199",
|
|
9222
|
+
swarrow: "\u2199",
|
|
9223
|
+
LowerLeftArrow: "\u2199",
|
|
9224
|
+
lArr: "\u21D0",
|
|
9225
|
+
Leftarrow: "\u21D0",
|
|
9226
|
+
uArr: "\u21D1",
|
|
9227
|
+
Uparrow: "\u21D1",
|
|
9228
|
+
rArr: "\u21D2",
|
|
9229
|
+
Rightarrow: "\u21D2",
|
|
9230
|
+
dArr: "\u21D3",
|
|
9231
|
+
Downarrow: "\u21D3",
|
|
9232
|
+
hArr: "\u21D4",
|
|
9233
|
+
Leftrightarrow: "\u21D4",
|
|
9234
|
+
iff: "\u21D4",
|
|
9235
|
+
vArr: "\u21D5",
|
|
9236
|
+
Updownarrow: "\u21D5",
|
|
9237
|
+
lAarr: "\u21DA",
|
|
9238
|
+
Lleftarrow: "\u21DA",
|
|
9239
|
+
rAarr: "\u21DB",
|
|
9240
|
+
Rrightarrow: "\u21DB",
|
|
9241
|
+
lrarr: "\u21C6",
|
|
9242
|
+
leftrightarrows: "\u21C6",
|
|
9243
|
+
rlarr: "\u21C4",
|
|
9244
|
+
rightleftarrows: "\u21C4",
|
|
9245
|
+
lrhar: "\u21CB",
|
|
9246
|
+
leftrightharpoons: "\u21CB",
|
|
9247
|
+
ReverseEquilibrium: "\u21CB",
|
|
9248
|
+
rlhar: "\u21CC",
|
|
9249
|
+
rightleftharpoons: "\u21CC",
|
|
9250
|
+
Equilibrium: "\u21CC",
|
|
9251
|
+
udarr: "\u21C5",
|
|
9252
|
+
UpArrowDownArrow: "\u21C5",
|
|
9253
|
+
duarr: "\u21F5",
|
|
9254
|
+
DownArrowUpArrow: "\u21F5",
|
|
9255
|
+
llarr: "\u21C7",
|
|
9256
|
+
leftleftarrows: "\u21C7",
|
|
9257
|
+
rrarr: "\u21C9",
|
|
9258
|
+
rightrightarrows: "\u21C9",
|
|
9259
|
+
ddarr: "\u21CA",
|
|
9260
|
+
downdownarrows: "\u21CA",
|
|
9261
|
+
har: "\u21BD",
|
|
9262
|
+
lhard: "\u21BD",
|
|
9263
|
+
leftharpoondown: "\u21BD",
|
|
9264
|
+
lharu: "\u21BC",
|
|
9265
|
+
leftharpoonup: "\u21BC",
|
|
9266
|
+
rhard: "\u21C1",
|
|
9267
|
+
rightharpoondown: "\u21C1",
|
|
9268
|
+
rharu: "\u21C0",
|
|
9269
|
+
rightharpoonup: "\u21C0",
|
|
9270
|
+
lsh: "\u21B0",
|
|
9271
|
+
Lsh: "\u21B0",
|
|
9272
|
+
rsh: "\u21B1",
|
|
9273
|
+
Rsh: "\u21B1",
|
|
9274
|
+
ldsh: "\u21B2",
|
|
9275
|
+
rdsh: "\u21B3",
|
|
9276
|
+
hookleftarrow: "\u21A9",
|
|
9277
|
+
hookrightarrow: "\u21AA",
|
|
9278
|
+
mapstoleft: "\u21A4",
|
|
9279
|
+
mapstoup: "\u21A5",
|
|
9280
|
+
map: "\u21A6",
|
|
9281
|
+
mapsto: "\u21A6",
|
|
9282
|
+
mapstodown: "\u21A7",
|
|
9283
|
+
crarr: "\u21B5",
|
|
9284
|
+
nwarrow: "\u2196",
|
|
9285
|
+
nearrow: "\u2197",
|
|
9286
|
+
searrow: "\u2198",
|
|
9287
|
+
swarrow: "\u2199",
|
|
9288
|
+
nleftarrow: "\u219A",
|
|
9289
|
+
nleftrightarrow: "\u21AE",
|
|
9290
|
+
nrightarrow: "\u219B",
|
|
9291
|
+
nrarr: "\u219B",
|
|
9292
|
+
larrtl: "\u21A2",
|
|
9293
|
+
rarrtl: "\u21A3",
|
|
9294
|
+
leftarrowtail: "\u21A2",
|
|
9295
|
+
rightarrowtail: "\u21A3",
|
|
9296
|
+
twoheadleftarrow: "\u219E",
|
|
9297
|
+
twoheadrightarrow: "\u21A0",
|
|
9298
|
+
Larr: "\u219E",
|
|
9299
|
+
Rarr: "\u21A0",
|
|
9300
|
+
larrhk: "\u21A9",
|
|
9301
|
+
rarrhk: "\u21AA",
|
|
9302
|
+
larrlp: "\u21AB",
|
|
9303
|
+
looparrowleft: "\u21AB",
|
|
9304
|
+
rarrlp: "\u21AC",
|
|
9305
|
+
looparrowright: "\u21AC",
|
|
9306
|
+
harrw: "\u21AD",
|
|
9307
|
+
leftrightsquigarrow: "\u21AD",
|
|
9308
|
+
nrarrw: "\u219D\u0338",
|
|
9309
|
+
rarrw: "\u219D",
|
|
9310
|
+
rightsquigarrow: "\u219D",
|
|
9311
|
+
larrbfs: "\u291F",
|
|
9312
|
+
rarrbfs: "\u2920",
|
|
9313
|
+
nvHarr: "\u2904",
|
|
9314
|
+
nvlArr: "\u2902",
|
|
9315
|
+
nvrArr: "\u2903",
|
|
9316
|
+
larrfs: "\u291D",
|
|
9317
|
+
rarrfs: "\u291E",
|
|
9318
|
+
Map: "\u2905",
|
|
9319
|
+
larrsim: "\u2973",
|
|
9320
|
+
rarrsim: "\u2974",
|
|
9321
|
+
harrcir: "\u2948",
|
|
9322
|
+
Uarrocir: "\u2949",
|
|
9323
|
+
lurdshar: "\u294A",
|
|
9324
|
+
ldrdhar: "\u2967",
|
|
9325
|
+
ldrushar: "\u294B",
|
|
9326
|
+
rdldhar: "\u2969",
|
|
9327
|
+
lrhard: "\u296D",
|
|
9328
|
+
rlhar: "\u21CC",
|
|
9329
|
+
uharr: "\u21BE",
|
|
9330
|
+
uharl: "\u21BF",
|
|
9331
|
+
dharr: "\u21C2",
|
|
9332
|
+
dharl: "\u21C3",
|
|
9333
|
+
Uarr: "\u219F",
|
|
9334
|
+
Darr: "\u21A1",
|
|
9335
|
+
zigrarr: "\u21DD",
|
|
9336
|
+
nwArr: "\u21D6",
|
|
9337
|
+
neArr: "\u21D7",
|
|
9338
|
+
seArr: "\u21D8",
|
|
9339
|
+
swArr: "\u21D9",
|
|
9340
|
+
nharr: "\u21AE",
|
|
9341
|
+
nhArr: "\u21CE",
|
|
9342
|
+
nlarr: "\u219A",
|
|
9343
|
+
nlArr: "\u21CD",
|
|
9344
|
+
nrarr: "\u219B",
|
|
9345
|
+
nrArr: "\u21CF",
|
|
9346
|
+
larrb: "\u21E4",
|
|
9347
|
+
LeftArrowBar: "\u21E4",
|
|
9348
|
+
rarrb: "\u21E5",
|
|
9349
|
+
RightArrowBar: "\u21E5"
|
|
9350
|
+
};
|
|
9351
|
+
var SHAPES = {
|
|
9352
|
+
square: "\u25A1",
|
|
9353
|
+
Square: "\u25A1",
|
|
9354
|
+
squ: "\u25A1",
|
|
9355
|
+
squf: "\u25AA",
|
|
9356
|
+
squarf: "\u25AA",
|
|
9357
|
+
blacksquar: "\u25AA",
|
|
9358
|
+
blacksquare: "\u25AA",
|
|
9359
|
+
FilledVerySmallSquare: "\u25AA",
|
|
9360
|
+
blk34: "\u2593",
|
|
9361
|
+
blk12: "\u2592",
|
|
9362
|
+
blk14: "\u2591",
|
|
9363
|
+
block: "\u2588",
|
|
9364
|
+
srect: "\u25AD",
|
|
9365
|
+
rect: "\u25AD",
|
|
9366
|
+
sdot: "\u22C5",
|
|
9367
|
+
sdotb: "\u22A1",
|
|
9368
|
+
dotsquare: "\u22A1",
|
|
9369
|
+
triangle: "\u25B5",
|
|
9370
|
+
tri: "\u25B5",
|
|
9371
|
+
trine: "\u25B5",
|
|
9372
|
+
utri: "\u25B5",
|
|
9373
|
+
triangledown: "\u25BF",
|
|
9374
|
+
dtri: "\u25BF",
|
|
9375
|
+
tridown: "\u25BF",
|
|
9376
|
+
triangleleft: "\u25C3",
|
|
9377
|
+
ltri: "\u25C3",
|
|
9378
|
+
triangleright: "\u25B9",
|
|
9379
|
+
rtri: "\u25B9",
|
|
9380
|
+
blacktriangle: "\u25B4",
|
|
9381
|
+
utrif: "\u25B4",
|
|
9382
|
+
blacktriangledown: "\u25BE",
|
|
9383
|
+
dtrif: "\u25BE",
|
|
9384
|
+
blacktriangleleft: "\u25C2",
|
|
9385
|
+
ltrif: "\u25C2",
|
|
9386
|
+
blacktriangleright: "\u25B8",
|
|
9387
|
+
rtrif: "\u25B8",
|
|
9388
|
+
loz: "\u25CA",
|
|
9389
|
+
lozenge: "\u25CA",
|
|
9390
|
+
blacklozenge: "\u29EB",
|
|
9391
|
+
lozf: "\u29EB",
|
|
9392
|
+
bigcirc: "\u25EF",
|
|
9393
|
+
xcirc: "\u25EF",
|
|
9394
|
+
circ: "\u02C6",
|
|
9395
|
+
Circle: "\u25CB",
|
|
9396
|
+
cir: "\u25CB",
|
|
9397
|
+
o: "\u25CB",
|
|
9398
|
+
bullet: "\u2022",
|
|
9399
|
+
bull: "\u2022",
|
|
9400
|
+
hellip: "\u2026",
|
|
9401
|
+
mldr: "\u2026",
|
|
9402
|
+
nldr: "\u2025",
|
|
9403
|
+
boxh: "\u2500",
|
|
9404
|
+
HorizontalLine: "\u2500",
|
|
9405
|
+
boxv: "\u2502",
|
|
9406
|
+
boxdr: "\u250C",
|
|
9407
|
+
boxdl: "\u2510",
|
|
9408
|
+
boxur: "\u2514",
|
|
9409
|
+
boxul: "\u2518",
|
|
9410
|
+
boxvr: "\u251C",
|
|
9411
|
+
boxvl: "\u2524",
|
|
9412
|
+
boxhd: "\u252C",
|
|
9413
|
+
boxhu: "\u2534",
|
|
9414
|
+
boxvh: "\u253C",
|
|
9415
|
+
boxH: "\u2550",
|
|
9416
|
+
boxV: "\u2551",
|
|
9417
|
+
boxdR: "\u2552",
|
|
9418
|
+
boxDr: "\u2553",
|
|
9419
|
+
boxDR: "\u2554",
|
|
9420
|
+
boxDl: "\u2555",
|
|
9421
|
+
boxdL: "\u2556",
|
|
9422
|
+
boxDL: "\u2557",
|
|
9423
|
+
boxuR: "\u2558",
|
|
9424
|
+
boxUr: "\u2559",
|
|
9425
|
+
boxUR: "\u255A",
|
|
9426
|
+
boxUl: "\u255C",
|
|
9427
|
+
boxuL: "\u255B",
|
|
9428
|
+
boxUL: "\u255D",
|
|
9429
|
+
boxvR: "\u255E",
|
|
9430
|
+
boxVr: "\u255F",
|
|
9431
|
+
boxVR: "\u2560",
|
|
9432
|
+
boxVl: "\u2562",
|
|
9433
|
+
boxvL: "\u2561",
|
|
9434
|
+
boxVL: "\u2563",
|
|
9435
|
+
boxHd: "\u2564",
|
|
9436
|
+
boxhD: "\u2565",
|
|
9437
|
+
boxHD: "\u2566",
|
|
9438
|
+
boxHu: "\u2567",
|
|
9439
|
+
boxhU: "\u2568",
|
|
9440
|
+
boxHU: "\u2569",
|
|
9441
|
+
boxvH: "\u256A",
|
|
9442
|
+
boxVh: "\u256B",
|
|
9443
|
+
boxVH: "\u256C"
|
|
9444
|
+
};
|
|
9445
|
+
var PUNCTUATION = {
|
|
9446
|
+
excl: "!",
|
|
9447
|
+
iexcl: "\xA1",
|
|
9448
|
+
brvbar: "\xA6",
|
|
9449
|
+
sect: "\xA7",
|
|
9450
|
+
uml: "\xA8",
|
|
9451
|
+
copy: "\xA9",
|
|
9452
|
+
ordf: "\xAA",
|
|
9453
|
+
laquo: "\xAB",
|
|
9454
|
+
not: "\xAC",
|
|
9455
|
+
shy: "\xAD",
|
|
9456
|
+
reg: "\xAE",
|
|
9457
|
+
macr: "\xAF",
|
|
9458
|
+
deg: "\xB0",
|
|
9459
|
+
plusmn: "\xB1",
|
|
9460
|
+
sup2: "\xB2",
|
|
9461
|
+
sup3: "\xB3",
|
|
9462
|
+
acute: "\xB4",
|
|
9463
|
+
micro: "\xB5",
|
|
9464
|
+
para: "\xB6",
|
|
9465
|
+
middot: "\xB7",
|
|
9466
|
+
cedil: "\xB8",
|
|
9467
|
+
sup1: "\xB9",
|
|
9468
|
+
ordm: "\xBA",
|
|
9469
|
+
raquo: "\xBB",
|
|
9470
|
+
frac14: "\xBC",
|
|
9471
|
+
frac12: "\xBD",
|
|
9472
|
+
frac34: "\xBE",
|
|
9473
|
+
iquest: "\xBF",
|
|
9474
|
+
nbsp: "\xA0",
|
|
9475
|
+
comma: ",",
|
|
9476
|
+
period: ".",
|
|
9477
|
+
colon: ":",
|
|
9478
|
+
semi: ";",
|
|
9479
|
+
vert: "|",
|
|
9480
|
+
Verbar: "\u2016",
|
|
9481
|
+
verbar: "|",
|
|
9482
|
+
dblac: "\u02DD",
|
|
9483
|
+
circ: "\u02C6",
|
|
9484
|
+
caron: "\u02C7",
|
|
9485
|
+
breve: "\u02D8",
|
|
9486
|
+
dot: "\u02D9",
|
|
9487
|
+
ring: "\u02DA",
|
|
9488
|
+
ogon: "\u02DB",
|
|
9489
|
+
tilde: "\u02DC",
|
|
9490
|
+
DiacriticalGrave: "`",
|
|
9491
|
+
DiacriticalAcute: "\xB4",
|
|
9492
|
+
DiacriticalTilde: "\u02DC",
|
|
9493
|
+
DiacriticalDot: "\u02D9",
|
|
9494
|
+
DiacriticalDoubleAcute: "\u02DD",
|
|
9495
|
+
grave: "`",
|
|
9496
|
+
acute: "\xB4"
|
|
9497
|
+
};
|
|
9498
|
+
var CURRENCY = {
|
|
9499
|
+
cent: "\xA2",
|
|
9500
|
+
pound: "\xA3",
|
|
9501
|
+
curren: "\xA4",
|
|
9502
|
+
yen: "\xA5",
|
|
9503
|
+
euro: "\u20AC",
|
|
9504
|
+
dollar: "$",
|
|
9505
|
+
euro: "\u20AC",
|
|
9506
|
+
fnof: "\u0192",
|
|
9507
|
+
inr: "\u20B9",
|
|
9508
|
+
af: "\u060B",
|
|
9509
|
+
birr: "\u1265\u122D",
|
|
9510
|
+
peso: "\u20B1",
|
|
9511
|
+
rub: "\u20BD",
|
|
9512
|
+
won: "\u20A9",
|
|
9513
|
+
yuan: "\xA5",
|
|
9514
|
+
cedil: "\xB8"
|
|
9515
|
+
};
|
|
9516
|
+
var FRACTIONS = {
|
|
9517
|
+
frac12: "\xBD",
|
|
9518
|
+
half: "\xBD",
|
|
9519
|
+
frac13: "\u2153",
|
|
9520
|
+
frac14: "\xBC",
|
|
9521
|
+
frac15: "\u2155",
|
|
9522
|
+
frac16: "\u2159",
|
|
9523
|
+
frac18: "\u215B",
|
|
9524
|
+
frac23: "\u2154",
|
|
9525
|
+
frac25: "\u2156",
|
|
9526
|
+
frac34: "\xBE",
|
|
9527
|
+
frac35: "\u2157",
|
|
9528
|
+
frac38: "\u215C",
|
|
9529
|
+
frac45: "\u2158",
|
|
9530
|
+
frac56: "\u215A",
|
|
9531
|
+
frac58: "\u215D",
|
|
9532
|
+
frac78: "\u215E",
|
|
9533
|
+
frasl: "\u2044"
|
|
9534
|
+
};
|
|
9535
|
+
var MISC_SYMBOLS = {
|
|
9536
|
+
trade: "\u2122",
|
|
9537
|
+
TRADE: "\u2122",
|
|
9538
|
+
telrec: "\u2315",
|
|
9539
|
+
target: "\u2316",
|
|
9540
|
+
ulcorn: "\u231C",
|
|
9541
|
+
ulcorner: "\u231C",
|
|
9542
|
+
urcorn: "\u231D",
|
|
9543
|
+
urcorner: "\u231D",
|
|
9544
|
+
dlcorn: "\u231E",
|
|
9545
|
+
llcorner: "\u231E",
|
|
9546
|
+
drcorn: "\u231F",
|
|
9547
|
+
lrcorner: "\u231F",
|
|
9548
|
+
intercal: "\u22BA",
|
|
9549
|
+
intcal: "\u22BA",
|
|
9550
|
+
oplus: "\u2295",
|
|
9551
|
+
CirclePlus: "\u2295",
|
|
9552
|
+
ominus: "\u2296",
|
|
9553
|
+
CircleMinus: "\u2296",
|
|
9554
|
+
otimes: "\u2297",
|
|
9555
|
+
CircleTimes: "\u2297",
|
|
9556
|
+
osol: "\u2298",
|
|
9557
|
+
odot: "\u2299",
|
|
9558
|
+
CircleDot: "\u2299",
|
|
9559
|
+
oast: "\u229B",
|
|
9560
|
+
circledast: "\u229B",
|
|
9561
|
+
odash: "\u229D",
|
|
9562
|
+
circleddash: "\u229D",
|
|
9563
|
+
ocirc: "\u229A",
|
|
9564
|
+
circledcirc: "\u229A",
|
|
9565
|
+
boxplus: "\u229E",
|
|
9566
|
+
plusb: "\u229E",
|
|
9567
|
+
boxminus: "\u229F",
|
|
9568
|
+
minusb: "\u229F",
|
|
9569
|
+
boxtimes: "\u22A0",
|
|
9570
|
+
timesb: "\u22A0",
|
|
9571
|
+
boxdot: "\u22A1",
|
|
9572
|
+
sdotb: "\u22A1",
|
|
9573
|
+
veebar: "\u22BB",
|
|
9574
|
+
vee: "\u2228",
|
|
9575
|
+
barvee: "\u22BD",
|
|
9576
|
+
and: "\u2227",
|
|
9577
|
+
wedge: "\u2227",
|
|
9578
|
+
Cap: "\u22D2",
|
|
9579
|
+
Cup: "\u22D3",
|
|
9580
|
+
Fork: "\u22D4",
|
|
9581
|
+
pitchfork: "\u22D4",
|
|
9582
|
+
epar: "\u22D5",
|
|
9583
|
+
ltlarr: "\u2976",
|
|
9584
|
+
nvap: "\u224D\u20D2",
|
|
9585
|
+
nvsim: "\u223C\u20D2",
|
|
9586
|
+
nvge: "\u2265\u20D2",
|
|
9587
|
+
nvle: "\u2264\u20D2",
|
|
9588
|
+
nvlt: "<\u20D2",
|
|
9589
|
+
nvgt: ">\u20D2",
|
|
9590
|
+
nvltrie: "\u22B4\u20D2",
|
|
9591
|
+
nvrtrie: "\u22B5\u20D2",
|
|
9592
|
+
Vdash: "\u22A9",
|
|
9593
|
+
dashv: "\u22A3",
|
|
9594
|
+
vDash: "\u22A8",
|
|
9595
|
+
Vdash: "\u22A9",
|
|
9596
|
+
Vvdash: "\u22AA",
|
|
9597
|
+
nvdash: "\u22AC",
|
|
9598
|
+
nvDash: "\u22AD",
|
|
9599
|
+
nVdash: "\u22AE",
|
|
9600
|
+
nVDash: "\u22AF"
|
|
9601
|
+
};
|
|
9602
|
+
var ALL_ENTITIES = {
|
|
9603
|
+
...BASIC_LATIN,
|
|
9604
|
+
...LATIN_ACCENTS,
|
|
9605
|
+
...LATIN_EXTENDED,
|
|
9606
|
+
...GREEK,
|
|
9607
|
+
...CYRILLIC,
|
|
9608
|
+
...MATH,
|
|
9609
|
+
...MATH_ADVANCED,
|
|
9610
|
+
...ARROWS,
|
|
9611
|
+
...SHAPES,
|
|
9612
|
+
...PUNCTUATION,
|
|
9613
|
+
...CURRENCY,
|
|
9614
|
+
...FRACTIONS,
|
|
9615
|
+
...MISC_SYMBOLS
|
|
9616
|
+
};
|
|
9617
|
+
var XML = {
|
|
9618
|
+
amp: "&",
|
|
9619
|
+
apos: "'",
|
|
9620
|
+
gt: ">",
|
|
9621
|
+
lt: "<",
|
|
9622
|
+
quot: '"'
|
|
9623
|
+
};
|
|
9624
|
+
var COMMON_HTML = {
|
|
9625
|
+
nbsp: "\xA0",
|
|
9626
|
+
copy: "\xA9",
|
|
9627
|
+
reg: "\xAE",
|
|
9628
|
+
trade: "\u2122",
|
|
9629
|
+
mdash: "\u2014",
|
|
9630
|
+
ndash: "\u2013",
|
|
9631
|
+
hellip: "\u2026",
|
|
9632
|
+
laquo: "\xAB",
|
|
9633
|
+
raquo: "\xBB",
|
|
9634
|
+
lsquo: "\u2018",
|
|
9635
|
+
rsquo: "\u2019",
|
|
9636
|
+
ldquo: "\u201C",
|
|
9637
|
+
rdquo: "\u201D",
|
|
9638
|
+
bull: "\u2022",
|
|
9639
|
+
para: "\xB6",
|
|
9640
|
+
sect: "\xA7",
|
|
9641
|
+
deg: "\xB0",
|
|
9642
|
+
frac12: "\xBD",
|
|
9643
|
+
frac14: "\xBC",
|
|
9644
|
+
frac34: "\xBE"
|
|
9645
|
+
};
|
|
9646
|
+
|
|
9647
|
+
// ../../.yarn/cache/@nodable-entities-npm-2.1.0-6eb9f06ac0-355c55e82a.zip/node_modules/@nodable/entities/src/EntityDecoder.js
|
|
9648
|
+
var SPECIAL_CHARS = new Set("!?\\\\/[]$%{}^&*()<>|+");
|
|
9649
|
+
function validateEntityName(name) {
|
|
9650
|
+
if (name[0] === "#") {
|
|
9651
|
+
throw new Error(`[EntityReplacer] Invalid character '#' in entity name: "${name}"`);
|
|
9652
|
+
}
|
|
9653
|
+
for (const ch of name) {
|
|
9654
|
+
if (SPECIAL_CHARS.has(ch)) {
|
|
9655
|
+
throw new Error(`[EntityReplacer] Invalid character '${ch}' in entity name: "${name}"`);
|
|
9656
|
+
}
|
|
9657
|
+
}
|
|
9658
|
+
return name;
|
|
9659
|
+
}
|
|
9660
|
+
function mergeEntityMaps(...maps) {
|
|
9661
|
+
const out = /* @__PURE__ */ Object.create(null);
|
|
9662
|
+
for (const map2 of maps) {
|
|
9663
|
+
if (!map2) continue;
|
|
9664
|
+
for (const key of Object.keys(map2)) {
|
|
9665
|
+
const raw = map2[key];
|
|
9666
|
+
if (typeof raw === "string") {
|
|
9667
|
+
out[key] = raw;
|
|
9668
|
+
} else if (raw && typeof raw === "object" && raw.val !== void 0) {
|
|
9669
|
+
const val = raw.val;
|
|
9670
|
+
if (typeof val === "string") {
|
|
9671
|
+
out[key] = val;
|
|
9672
|
+
}
|
|
9673
|
+
}
|
|
9674
|
+
}
|
|
9675
|
+
}
|
|
9676
|
+
return out;
|
|
9677
|
+
}
|
|
9678
|
+
var LIMIT_TIER_EXTERNAL = "external";
|
|
9679
|
+
var LIMIT_TIER_BASE = "base";
|
|
9680
|
+
var LIMIT_TIER_ALL = "all";
|
|
9681
|
+
function parseLimitTiers(raw) {
|
|
9682
|
+
if (!raw || raw === LIMIT_TIER_EXTERNAL) return /* @__PURE__ */ new Set([LIMIT_TIER_EXTERNAL]);
|
|
9683
|
+
if (raw === LIMIT_TIER_ALL) return /* @__PURE__ */ new Set([LIMIT_TIER_ALL]);
|
|
9684
|
+
if (raw === LIMIT_TIER_BASE) return /* @__PURE__ */ new Set([LIMIT_TIER_BASE]);
|
|
9685
|
+
if (Array.isArray(raw)) return new Set(raw);
|
|
9686
|
+
return /* @__PURE__ */ new Set([LIMIT_TIER_EXTERNAL]);
|
|
9687
|
+
}
|
|
9688
|
+
var NCR_LEVEL = Object.freeze({ allow: 0, leave: 1, remove: 2, throw: 3 });
|
|
9689
|
+
var XML10_ALLOWED_C0 = /* @__PURE__ */ new Set([9, 10, 13]);
|
|
9690
|
+
function parseNCRConfig(ncr) {
|
|
9691
|
+
if (!ncr) {
|
|
9692
|
+
return { xmlVersion: 1, onLevel: NCR_LEVEL.allow, nullLevel: NCR_LEVEL.remove };
|
|
9693
|
+
}
|
|
9694
|
+
const xmlVersion = ncr.xmlVersion === 1.1 ? 1.1 : 1;
|
|
9695
|
+
const onLevel = NCR_LEVEL[ncr.onNCR] ?? NCR_LEVEL.allow;
|
|
9696
|
+
const nullLevel = NCR_LEVEL[ncr.nullNCR] ?? NCR_LEVEL.remove;
|
|
9697
|
+
const clampedNull = Math.max(nullLevel, NCR_LEVEL.remove);
|
|
9698
|
+
return { xmlVersion, onLevel, nullLevel: clampedNull };
|
|
9699
|
+
}
|
|
9700
|
+
var EntityDecoder = class {
|
|
9701
|
+
/**
|
|
9702
|
+
* @param {object} [options]
|
|
9703
|
+
* @param {object|null} [options.namedEntities] — extra named entities merged into base map
|
|
9704
|
+
* @param {object} [options.limit] — security limits
|
|
9705
|
+
* @param {number} [options.limit.maxTotalExpansions=0] — 0 = unlimited
|
|
9706
|
+
* @param {number} [options.limit.maxExpandedLength=0] — 0 = unlimited
|
|
9707
|
+
* @param {'external'|'base'|'all'|string[]} [options.limit.applyLimitsTo='external']
|
|
9708
|
+
* Which entity tiers count against the security limits:
|
|
9709
|
+
* - 'external' (default) — only input/runtime + persistent external entities
|
|
9710
|
+
* - 'base' — only DEFAULT_XML_ENTITIES + namedEntities
|
|
9711
|
+
* - 'all' — every entity regardless of tier
|
|
9712
|
+
* - string[] — explicit combination, e.g. ['external', 'base']
|
|
9713
|
+
* @param {((resolved: string, original: string) => string)|null} [options.postCheck=null]
|
|
9714
|
+
* @param {string[]} [options.remove=[]] — entity names (e.g. ['nbsp', '#13']) to delete (replace with empty string)
|
|
9715
|
+
* @param {string[]} [options.leave=[]] — entity names to keep as literal (unchanged in output)
|
|
9716
|
+
* @param {object} [options.ncr] — Numeric Character Reference controls
|
|
9717
|
+
* @param {1.0|1.1} [options.ncr.xmlVersion=1.0]
|
|
9718
|
+
* XML version governing which codepoint ranges are restricted:
|
|
9719
|
+
* - 1.0 — C0 controls U+0001–U+001F (except U+0009/000A/000D) are prohibited
|
|
9720
|
+
* - 1.1 — C0 controls are allowed when written as NCRs; C1 (U+007F–U+009F) decoded as-is
|
|
9721
|
+
* @param {'allow'|'leave'|'remove'|'throw'} [options.ncr.onNCR='allow']
|
|
9722
|
+
* Base action for numeric references. Severity order: allow < leave < remove < throw.
|
|
9723
|
+
* For codepoint ranges that carry a minimum level (surrogates → remove, XML 1.0 C0 → remove),
|
|
9724
|
+
* the effective action is max(onNCR, rangeMinimum).
|
|
9725
|
+
* @param {'remove'|'throw'} [options.ncr.nullNCR='remove']
|
|
9726
|
+
* Action for U+0000 (null). 'allow' and 'leave' are clamped to 'remove' since null is never safe.
|
|
9727
|
+
*/
|
|
9728
|
+
constructor(options2 = {}) {
|
|
9729
|
+
this._limit = options2.limit || {};
|
|
9730
|
+
this._maxTotalExpansions = this._limit.maxTotalExpansions || 0;
|
|
9731
|
+
this._maxExpandedLength = this._limit.maxExpandedLength || 0;
|
|
9732
|
+
this._postCheck = typeof options2.postCheck === "function" ? options2.postCheck : (r) => r;
|
|
9733
|
+
this._limitTiers = parseLimitTiers(this._limit.applyLimitsTo ?? LIMIT_TIER_EXTERNAL);
|
|
9734
|
+
this._numericAllowed = options2.numericAllowed ?? true;
|
|
9735
|
+
this._baseMap = mergeEntityMaps(XML, options2.namedEntities || null);
|
|
9736
|
+
this._externalMap = /* @__PURE__ */ Object.create(null);
|
|
9737
|
+
this._inputMap = /* @__PURE__ */ Object.create(null);
|
|
9738
|
+
this._totalExpansions = 0;
|
|
9739
|
+
this._expandedLength = 0;
|
|
9740
|
+
this._removeSet = new Set(options2.remove && Array.isArray(options2.remove) ? options2.remove : []);
|
|
9741
|
+
this._leaveSet = new Set(options2.leave && Array.isArray(options2.leave) ? options2.leave : []);
|
|
9742
|
+
const ncrCfg = parseNCRConfig(options2.ncr);
|
|
9743
|
+
this._ncrXmlVersion = ncrCfg.xmlVersion;
|
|
9744
|
+
this._ncrOnLevel = ncrCfg.onLevel;
|
|
9745
|
+
this._ncrNullLevel = ncrCfg.nullLevel;
|
|
9746
|
+
}
|
|
9747
|
+
// -------------------------------------------------------------------------
|
|
9748
|
+
// Persistent external entity registration
|
|
9749
|
+
// -------------------------------------------------------------------------
|
|
9750
|
+
/**
|
|
9751
|
+
* Replace the full set of persistent external entities.
|
|
9752
|
+
* All keys are validated — throws on invalid characters.
|
|
9753
|
+
* @param {Record<string, string | { regex?: RegExp, val: string }>} map
|
|
9754
|
+
*/
|
|
9755
|
+
setExternalEntities(map2) {
|
|
9756
|
+
if (map2) {
|
|
9757
|
+
for (const key of Object.keys(map2)) {
|
|
9758
|
+
validateEntityName(key);
|
|
9759
|
+
}
|
|
9760
|
+
}
|
|
9761
|
+
this._externalMap = mergeEntityMaps(map2);
|
|
9762
|
+
}
|
|
9763
|
+
/**
|
|
9764
|
+
* Add a single persistent external entity.
|
|
9765
|
+
* @param {string} key
|
|
9766
|
+
* @param {string} value
|
|
9767
|
+
*/
|
|
9768
|
+
addExternalEntity(key, value) {
|
|
9769
|
+
validateEntityName(key);
|
|
9770
|
+
if (typeof value === "string" && value.indexOf("&") === -1) {
|
|
9771
|
+
this._externalMap[key] = value;
|
|
9772
|
+
}
|
|
9773
|
+
}
|
|
9774
|
+
// -------------------------------------------------------------------------
|
|
9775
|
+
// Input / runtime entity registration (per document)
|
|
9776
|
+
// -------------------------------------------------------------------------
|
|
9777
|
+
/**
|
|
9778
|
+
* Inject DOCTYPE entities for the current document.
|
|
9779
|
+
* Also resets per-document expansion counters.
|
|
9780
|
+
* @param {Record<string, string | { regx?: RegExp, regex?: RegExp, val: string }>} map
|
|
9781
|
+
*/
|
|
9782
|
+
addInputEntities(map2) {
|
|
9783
|
+
this._totalExpansions = 0;
|
|
9784
|
+
this._expandedLength = 0;
|
|
9785
|
+
this._inputMap = mergeEntityMaps(map2);
|
|
9786
|
+
}
|
|
9787
|
+
// -------------------------------------------------------------------------
|
|
9788
|
+
// Per-document reset
|
|
9789
|
+
// -------------------------------------------------------------------------
|
|
9790
|
+
/**
|
|
9791
|
+
* Wipe input/runtime entities and reset counters.
|
|
9792
|
+
* Call this before processing each new document.
|
|
9793
|
+
* @returns {this}
|
|
9794
|
+
*/
|
|
9795
|
+
reset() {
|
|
9796
|
+
this._inputMap = /* @__PURE__ */ Object.create(null);
|
|
9797
|
+
this._totalExpansions = 0;
|
|
9798
|
+
this._expandedLength = 0;
|
|
9799
|
+
return this;
|
|
9800
|
+
}
|
|
9801
|
+
// -------------------------------------------------------------------------
|
|
9802
|
+
// XML version (can be set after construction, e.g. once parser reads <?xml?>)
|
|
9803
|
+
// -------------------------------------------------------------------------
|
|
9804
|
+
/**
|
|
9805
|
+
* Update the XML version used for NCR classification.
|
|
9806
|
+
* Call this as soon as the document's `<?xml version="...">` declaration is parsed.
|
|
9807
|
+
* @param {1.0|1.1|number} version
|
|
9808
|
+
*/
|
|
9809
|
+
setXmlVersion(version) {
|
|
9810
|
+
this._ncrXmlVersion = version === 1.1 ? 1.1 : 1;
|
|
9811
|
+
}
|
|
9812
|
+
// -------------------------------------------------------------------------
|
|
9813
|
+
// Primary API
|
|
9814
|
+
// -------------------------------------------------------------------------
|
|
9815
|
+
/**
|
|
9816
|
+
* Replace all entity references in `str` in a single pass.
|
|
9817
|
+
*
|
|
9818
|
+
* @param {string} str
|
|
9819
|
+
* @returns {string}
|
|
9820
|
+
*/
|
|
9821
|
+
decode(str) {
|
|
9822
|
+
if (typeof str !== "string" || str.length === 0) return str;
|
|
9823
|
+
const original = str;
|
|
9824
|
+
const chunks = [];
|
|
9825
|
+
const len = str.length;
|
|
9826
|
+
let last = 0;
|
|
9827
|
+
let i = 0;
|
|
9828
|
+
const limitExpansions = this._maxTotalExpansions > 0;
|
|
9829
|
+
const limitLength = this._maxExpandedLength > 0;
|
|
9830
|
+
const checkLimits = limitExpansions || limitLength;
|
|
9831
|
+
while (i < len) {
|
|
9832
|
+
if (str.charCodeAt(i) !== 38) {
|
|
9833
|
+
i++;
|
|
9834
|
+
continue;
|
|
9835
|
+
}
|
|
9836
|
+
let j = i + 1;
|
|
9837
|
+
while (j < len && str.charCodeAt(j) !== 59 && j - i <= 32) j++;
|
|
9838
|
+
if (j >= len || str.charCodeAt(j) !== 59) {
|
|
9839
|
+
i++;
|
|
9840
|
+
continue;
|
|
9841
|
+
}
|
|
9842
|
+
const token = str.slice(i + 1, j);
|
|
9843
|
+
if (token.length === 0) {
|
|
9844
|
+
i++;
|
|
9845
|
+
continue;
|
|
9846
|
+
}
|
|
9847
|
+
let replacement;
|
|
9848
|
+
let tier;
|
|
9849
|
+
if (this._removeSet.has(token)) {
|
|
9850
|
+
replacement = "";
|
|
9851
|
+
if (tier === void 0) {
|
|
9852
|
+
tier = LIMIT_TIER_EXTERNAL;
|
|
9853
|
+
}
|
|
9854
|
+
} else if (this._leaveSet.has(token)) {
|
|
9855
|
+
i++;
|
|
9856
|
+
continue;
|
|
9857
|
+
} else if (token.charCodeAt(0) === 35) {
|
|
9858
|
+
const ncrResult = this._resolveNCR(token);
|
|
9859
|
+
if (ncrResult === void 0) {
|
|
9860
|
+
i++;
|
|
9861
|
+
continue;
|
|
9862
|
+
}
|
|
9863
|
+
replacement = ncrResult;
|
|
9864
|
+
tier = LIMIT_TIER_BASE;
|
|
9865
|
+
} else {
|
|
9866
|
+
const resolved = this._resolveName(token);
|
|
9867
|
+
replacement = resolved?.value;
|
|
9868
|
+
tier = resolved?.tier;
|
|
9869
|
+
}
|
|
9870
|
+
if (replacement === void 0) {
|
|
9871
|
+
i++;
|
|
9872
|
+
continue;
|
|
9873
|
+
}
|
|
9874
|
+
if (i > last) chunks.push(str.slice(last, i));
|
|
9875
|
+
chunks.push(replacement);
|
|
9876
|
+
last = j + 1;
|
|
9877
|
+
i = last;
|
|
9878
|
+
if (checkLimits && this._tierCounts(tier)) {
|
|
9879
|
+
if (limitExpansions) {
|
|
9880
|
+
this._totalExpansions++;
|
|
9881
|
+
if (this._totalExpansions > this._maxTotalExpansions) {
|
|
9882
|
+
throw new Error(
|
|
9883
|
+
`[EntityReplacer] Entity expansion count limit exceeded: ${this._totalExpansions} > ${this._maxTotalExpansions}`
|
|
9884
|
+
);
|
|
9885
|
+
}
|
|
9886
|
+
}
|
|
9887
|
+
if (limitLength) {
|
|
9888
|
+
const delta = replacement.length - (token.length + 2);
|
|
9889
|
+
if (delta > 0) {
|
|
9890
|
+
this._expandedLength += delta;
|
|
9891
|
+
if (this._expandedLength > this._maxExpandedLength) {
|
|
9892
|
+
throw new Error(
|
|
9893
|
+
`[EntityReplacer] Expanded content length limit exceeded: ${this._expandedLength} > ${this._maxExpandedLength}`
|
|
9894
|
+
);
|
|
9895
|
+
}
|
|
9896
|
+
}
|
|
9897
|
+
}
|
|
9898
|
+
}
|
|
9899
|
+
}
|
|
9900
|
+
if (last < len) chunks.push(str.slice(last));
|
|
9901
|
+
const result = chunks.length === 0 ? str : chunks.join("");
|
|
9902
|
+
return this._postCheck(result, original);
|
|
9903
|
+
}
|
|
9904
|
+
// -------------------------------------------------------------------------
|
|
9905
|
+
// Private: limit tier check
|
|
9906
|
+
// -------------------------------------------------------------------------
|
|
9907
|
+
/**
|
|
9908
|
+
* Returns true if a resolved entity of the given tier should count
|
|
9909
|
+
* against the expansion/length limits.
|
|
9910
|
+
* @param {string} tier — LIMIT_TIER_EXTERNAL | LIMIT_TIER_BASE
|
|
9911
|
+
* @returns {boolean}
|
|
9912
|
+
*/
|
|
9913
|
+
_tierCounts(tier) {
|
|
9914
|
+
if (this._limitTiers.has(LIMIT_TIER_ALL)) return true;
|
|
9915
|
+
return this._limitTiers.has(tier);
|
|
9916
|
+
}
|
|
9917
|
+
// -------------------------------------------------------------------------
|
|
9918
|
+
// Private: entity resolution
|
|
9919
|
+
// -------------------------------------------------------------------------
|
|
9920
|
+
/**
|
|
9921
|
+
* Resolve a named entity token (without & and ;).
|
|
9922
|
+
* Priority: inputMap > externalMap > baseMap
|
|
9923
|
+
* Returns the resolved value tagged with its limit tier.
|
|
9924
|
+
*
|
|
9925
|
+
* @param {string} name
|
|
9926
|
+
* @returns {{ value: string, tier: string }|undefined}
|
|
9927
|
+
*/
|
|
9928
|
+
_resolveName(name) {
|
|
9929
|
+
if (name in this._inputMap) return { value: this._inputMap[name], tier: LIMIT_TIER_EXTERNAL };
|
|
9930
|
+
if (name in this._externalMap) return { value: this._externalMap[name], tier: LIMIT_TIER_EXTERNAL };
|
|
9931
|
+
if (name in this._baseMap) return { value: this._baseMap[name], tier: LIMIT_TIER_BASE };
|
|
9932
|
+
return void 0;
|
|
9933
|
+
}
|
|
9934
|
+
/**
|
|
9935
|
+
* Classify a codepoint and return the minimum action level that must be applied.
|
|
9936
|
+
* Returns -1 when no minimum is imposed (normal allow path).
|
|
9937
|
+
*
|
|
9938
|
+
* Ranges checked (in priority order):
|
|
9939
|
+
* 1. U+0000 — null, governed by nullNCR (always ≥ remove)
|
|
9940
|
+
* 2. U+D800–U+DFFF — surrogates, always prohibited (min: remove)
|
|
9941
|
+
* 3. U+0001–U+001F \ {0x09,0x0A,0x0D} — XML 1.0 restricted C0 (min: remove)
|
|
9942
|
+
* (skipped in XML 1.1 — C0 controls are allowed when written as NCRs)
|
|
9943
|
+
*
|
|
9944
|
+
* @param {number} cp — codepoint
|
|
9945
|
+
* @returns {number} — minimum NCR_LEVEL value, or -1 for no restriction
|
|
9946
|
+
*/
|
|
9947
|
+
_classifyNCR(cp) {
|
|
9948
|
+
if (cp === 0) return this._ncrNullLevel;
|
|
9949
|
+
if (cp >= 55296 && cp <= 57343) return NCR_LEVEL.remove;
|
|
9950
|
+
if (this._ncrXmlVersion === 1) {
|
|
9951
|
+
if (cp >= 1 && cp <= 31 && !XML10_ALLOWED_C0.has(cp)) return NCR_LEVEL.remove;
|
|
9952
|
+
}
|
|
9953
|
+
return -1;
|
|
9954
|
+
}
|
|
9955
|
+
/**
|
|
9956
|
+
* Execute a resolved NCR action.
|
|
9957
|
+
*
|
|
9958
|
+
* @param {number} action — NCR_LEVEL value
|
|
9959
|
+
* @param {string} token — raw token (e.g. '#38') for error messages
|
|
9960
|
+
* @param {number} cp — codepoint, used only for error messages
|
|
9961
|
+
* @returns {string|undefined}
|
|
9962
|
+
* - decoded character string → 'allow'
|
|
9963
|
+
* - '' → 'remove'
|
|
9964
|
+
* - undefined → 'leave' (caller must skip past '&' only)
|
|
9965
|
+
* - throws Error → 'throw'
|
|
9966
|
+
*/
|
|
9967
|
+
_applyNCRAction(action, token, cp) {
|
|
9968
|
+
switch (action) {
|
|
9969
|
+
case NCR_LEVEL.allow:
|
|
9970
|
+
return String.fromCodePoint(cp);
|
|
9971
|
+
case NCR_LEVEL.remove:
|
|
9972
|
+
return "";
|
|
9973
|
+
case NCR_LEVEL.leave:
|
|
9974
|
+
return void 0;
|
|
9975
|
+
// signal: keep literal
|
|
9976
|
+
case NCR_LEVEL.throw:
|
|
9977
|
+
throw new Error(
|
|
9978
|
+
`[EntityDecoder] Prohibited numeric character reference &${token}; (U+${cp.toString(16).toUpperCase().padStart(4, "0")})`
|
|
9979
|
+
);
|
|
9980
|
+
default:
|
|
9981
|
+
return String.fromCodePoint(cp);
|
|
9982
|
+
}
|
|
9983
|
+
}
|
|
9984
|
+
/**
|
|
9985
|
+
* Full NCR resolution pipeline for a numeric token.
|
|
9986
|
+
*
|
|
9987
|
+
* Steps:
|
|
9988
|
+
* 1. Parse the codepoint (decimal or hex).
|
|
9989
|
+
* 2. Validate the raw codepoint range (NaN, <0, >0x10FFFF).
|
|
9990
|
+
* 3. If numericAllowed is false and no minimum restriction applies → leave as-is.
|
|
9991
|
+
* 4. Classify the codepoint to find the minimum required action level.
|
|
9992
|
+
* 5. Resolve effective action = max(onNCR, minimum).
|
|
9993
|
+
* 6. Apply and return.
|
|
9994
|
+
*
|
|
9995
|
+
* @param {string} token — e.g. '#38', '#x26', '#X26'
|
|
9996
|
+
* @returns {string|undefined}
|
|
9997
|
+
* - string (incl. '') — replacement ('' = remove)
|
|
9998
|
+
* - undefined — leave original &token; as-is
|
|
9999
|
+
*/
|
|
10000
|
+
_resolveNCR(token) {
|
|
10001
|
+
const second = token.charCodeAt(1);
|
|
10002
|
+
let cp;
|
|
10003
|
+
if (second === 120 || second === 88) {
|
|
10004
|
+
cp = parseInt(token.slice(2), 16);
|
|
10005
|
+
} else {
|
|
10006
|
+
cp = parseInt(token.slice(1), 10);
|
|
10007
|
+
}
|
|
10008
|
+
if (Number.isNaN(cp) || cp < 0 || cp > 1114111) return void 0;
|
|
10009
|
+
const minimum = this._classifyNCR(cp);
|
|
10010
|
+
if (!this._numericAllowed && minimum < NCR_LEVEL.remove) return void 0;
|
|
10011
|
+
const effective = minimum === -1 ? this._ncrOnLevel : Math.max(this._ncrOnLevel, minimum);
|
|
10012
|
+
return this._applyNCRAction(effective, token, cp);
|
|
10013
|
+
}
|
|
10014
|
+
};
|
|
10015
|
+
|
|
10016
|
+
// ../../.yarn/cache/fast-xml-parser-npm-5.7.2-960de42682-7f32d77127.zip/node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js
|
|
8548
10017
|
var defaultOnDangerousProperty = (name) => {
|
|
8549
10018
|
if (DANGEROUS_PROPERTY_NAMES.includes(name)) {
|
|
8550
10019
|
return "__" + name;
|
|
@@ -8586,6 +10055,7 @@ var defaultOptions2 = {
|
|
|
8586
10055
|
unpairedTags: [],
|
|
8587
10056
|
processEntities: true,
|
|
8588
10057
|
htmlEntities: false,
|
|
10058
|
+
entityDecoder: null,
|
|
8589
10059
|
ignoreDeclaration: false,
|
|
8590
10060
|
ignorePiTags: false,
|
|
8591
10061
|
transformTagName: false,
|
|
@@ -8617,18 +10087,19 @@ function validatePropertyName(propertyName, optionName) {
|
|
|
8617
10087
|
);
|
|
8618
10088
|
}
|
|
8619
10089
|
}
|
|
8620
|
-
function normalizeProcessEntities(value) {
|
|
10090
|
+
function normalizeProcessEntities(value, htmlEntities) {
|
|
8621
10091
|
if (typeof value === "boolean") {
|
|
8622
10092
|
return {
|
|
8623
10093
|
enabled: value,
|
|
8624
10094
|
// true or false
|
|
8625
10095
|
maxEntitySize: 1e4,
|
|
8626
|
-
maxExpansionDepth:
|
|
8627
|
-
maxTotalExpansions:
|
|
10096
|
+
maxExpansionDepth: 1e4,
|
|
10097
|
+
maxTotalExpansions: Infinity,
|
|
8628
10098
|
maxExpandedLength: 1e5,
|
|
8629
|
-
maxEntityCount:
|
|
10099
|
+
maxEntityCount: 1e3,
|
|
8630
10100
|
allowedTags: null,
|
|
8631
|
-
tagFilter: null
|
|
10101
|
+
tagFilter: null,
|
|
10102
|
+
appliesTo: "all"
|
|
8632
10103
|
};
|
|
8633
10104
|
}
|
|
8634
10105
|
if (typeof value === "object" && value !== null) {
|
|
@@ -8640,7 +10111,8 @@ function normalizeProcessEntities(value) {
|
|
|
8640
10111
|
maxExpandedLength: Math.max(1, value.maxExpandedLength ?? 1e5),
|
|
8641
10112
|
maxEntityCount: Math.max(1, value.maxEntityCount ?? 1e3),
|
|
8642
10113
|
allowedTags: value.allowedTags ?? null,
|
|
8643
|
-
tagFilter: value.tagFilter ?? null
|
|
10114
|
+
tagFilter: value.tagFilter ?? null,
|
|
10115
|
+
appliesTo: value.appliesTo ?? "all"
|
|
8644
10116
|
};
|
|
8645
10117
|
}
|
|
8646
10118
|
return normalizeProcessEntities(true);
|
|
@@ -8662,7 +10134,8 @@ var buildOptions = function(options2) {
|
|
|
8662
10134
|
if (built.onDangerousProperty === null) {
|
|
8663
10135
|
built.onDangerousProperty = defaultOnDangerousProperty;
|
|
8664
10136
|
}
|
|
8665
|
-
built.processEntities = normalizeProcessEntities(built.processEntities);
|
|
10137
|
+
built.processEntities = normalizeProcessEntities(built.processEntities, built.htmlEntities);
|
|
10138
|
+
built.unpairedTagsSet = new Set(built.unpairedTags);
|
|
8666
10139
|
if (built.stopNodes && Array.isArray(built.stopNodes)) {
|
|
8667
10140
|
built.stopNodes = built.stopNodes.map((node) => {
|
|
8668
10141
|
if (typeof node === "string" && node.startsWith("*.")) {
|
|
@@ -8674,7 +10147,7 @@ var buildOptions = function(options2) {
|
|
|
8674
10147
|
return built;
|
|
8675
10148
|
};
|
|
8676
10149
|
|
|
8677
|
-
// ../../.yarn/cache/fast-xml-parser-npm-5.
|
|
10150
|
+
// ../../.yarn/cache/fast-xml-parser-npm-5.7.2-960de42682-7f32d77127.zip/node_modules/fast-xml-parser/src/xmlparser/xmlNode.js
|
|
8678
10151
|
var METADATA_SYMBOL;
|
|
8679
10152
|
if (typeof Symbol !== "function") {
|
|
8680
10153
|
METADATA_SYMBOL = "@@xmlMetadata";
|
|
@@ -8708,7 +10181,7 @@ var XmlNode = class {
|
|
|
8708
10181
|
}
|
|
8709
10182
|
};
|
|
8710
10183
|
|
|
8711
|
-
// ../../.yarn/cache/fast-xml-parser-npm-5.
|
|
10184
|
+
// ../../.yarn/cache/fast-xml-parser-npm-5.7.2-960de42682-7f32d77127.zip/node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js
|
|
8712
10185
|
var DocTypeReader = class {
|
|
8713
10186
|
constructor(options2) {
|
|
8714
10187
|
this.suppressValidationErr = !options2;
|
|
@@ -8734,11 +10207,7 @@ var DocTypeReader = class {
|
|
|
8734
10207
|
`Entity count (${entityCount + 1}) exceeds maximum allowed (${this.options.maxEntityCount})`
|
|
8735
10208
|
);
|
|
8736
10209
|
}
|
|
8737
|
-
|
|
8738
|
-
entities[entityName] = {
|
|
8739
|
-
regx: RegExp(`&${escaped};`, "g"),
|
|
8740
|
-
val
|
|
8741
|
-
};
|
|
10210
|
+
entities[entityName] = val;
|
|
8742
10211
|
entityCount++;
|
|
8743
10212
|
}
|
|
8744
10213
|
} else if (hasBody && hasSeq(xmlData, "!ELEMENT", i)) {
|
|
@@ -8788,7 +10257,7 @@ var DocTypeReader = class {
|
|
|
8788
10257
|
i++;
|
|
8789
10258
|
}
|
|
8790
10259
|
let entityName = xmlData.substring(startIndex, i);
|
|
8791
|
-
|
|
10260
|
+
validateEntityName2(entityName);
|
|
8792
10261
|
i = skipWhitespace(xmlData, i);
|
|
8793
10262
|
if (!this.suppressValidationErr) {
|
|
8794
10263
|
if (xmlData.substring(i, i + 6).toUpperCase() === "SYSTEM") {
|
|
@@ -8814,7 +10283,7 @@ var DocTypeReader = class {
|
|
|
8814
10283
|
i++;
|
|
8815
10284
|
}
|
|
8816
10285
|
let notationName = xmlData.substring(startIndex, i);
|
|
8817
|
-
!this.suppressValidationErr &&
|
|
10286
|
+
!this.suppressValidationErr && validateEntityName2(notationName);
|
|
8818
10287
|
i = skipWhitespace(xmlData, i);
|
|
8819
10288
|
const identifierType = xmlData.substring(i, i + 6).toUpperCase();
|
|
8820
10289
|
if (!this.suppressValidationErr && identifierType !== "SYSTEM" && identifierType !== "PUBLIC") {
|
|
@@ -8896,14 +10365,14 @@ var DocTypeReader = class {
|
|
|
8896
10365
|
i++;
|
|
8897
10366
|
}
|
|
8898
10367
|
let elementName = xmlData.substring(startIndex, i);
|
|
8899
|
-
|
|
10368
|
+
validateEntityName2(elementName);
|
|
8900
10369
|
i = skipWhitespace(xmlData, i);
|
|
8901
10370
|
startIndex = i;
|
|
8902
10371
|
while (i < xmlData.length && !/\s/.test(xmlData[i])) {
|
|
8903
10372
|
i++;
|
|
8904
10373
|
}
|
|
8905
10374
|
let attributeName = xmlData.substring(startIndex, i);
|
|
8906
|
-
if (!
|
|
10375
|
+
if (!validateEntityName2(attributeName)) {
|
|
8907
10376
|
throw new Error(`Invalid attribute name: "${attributeName}"`);
|
|
8908
10377
|
}
|
|
8909
10378
|
i = skipWhitespace(xmlData, i);
|
|
@@ -8924,7 +10393,7 @@ var DocTypeReader = class {
|
|
|
8924
10393
|
}
|
|
8925
10394
|
let notation = xmlData.substring(startIndex2, i);
|
|
8926
10395
|
notation = notation.trim();
|
|
8927
|
-
if (!
|
|
10396
|
+
if (!validateEntityName2(notation)) {
|
|
8928
10397
|
throw new Error(`Invalid notation name: "${notation}"`);
|
|
8929
10398
|
}
|
|
8930
10399
|
allowedNotations.push(notation);
|
|
@@ -8981,14 +10450,14 @@ function hasSeq(data, seq, i) {
|
|
|
8981
10450
|
}
|
|
8982
10451
|
return true;
|
|
8983
10452
|
}
|
|
8984
|
-
function
|
|
10453
|
+
function validateEntityName2(name) {
|
|
8985
10454
|
if (isName(name))
|
|
8986
10455
|
return name;
|
|
8987
10456
|
else
|
|
8988
10457
|
throw new Error(`Invalid entity name ${name}`);
|
|
8989
10458
|
}
|
|
8990
10459
|
|
|
8991
|
-
// ../../.yarn/cache/strnum-npm-2.2.
|
|
10460
|
+
// ../../.yarn/cache/strnum-npm-2.2.3-3aa06fd3c4-fb70206301.zip/node_modules/strnum/strnum.js
|
|
8992
10461
|
var hexRegex = /^[-+]?0x[a-fA-F0-9]+$/;
|
|
8993
10462
|
var numRegex = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/;
|
|
8994
10463
|
var consider = {
|
|
@@ -9110,7 +10579,7 @@ function handleInfinity(str, num, options2) {
|
|
|
9110
10579
|
}
|
|
9111
10580
|
}
|
|
9112
10581
|
|
|
9113
|
-
// ../../.yarn/cache/fast-xml-parser-npm-5.
|
|
10582
|
+
// ../../.yarn/cache/fast-xml-parser-npm-5.7.2-960de42682-7f32d77127.zip/node_modules/fast-xml-parser/src/ignoreAttributes.js
|
|
9114
10583
|
function getIgnoreAttributesFn(ignoreAttributes) {
|
|
9115
10584
|
if (typeof ignoreAttributes === "function") {
|
|
9116
10585
|
return ignoreAttributes;
|
|
@@ -9130,7 +10599,7 @@ function getIgnoreAttributesFn(ignoreAttributes) {
|
|
|
9130
10599
|
return () => false;
|
|
9131
10600
|
}
|
|
9132
10601
|
|
|
9133
|
-
// ../../.yarn/cache/path-expression-matcher-npm-1.
|
|
10602
|
+
// ../../.yarn/cache/path-expression-matcher-npm-1.5.0-73d258a112-28303bb9ee.zip/node_modules/path-expression-matcher/src/Expression.js
|
|
9134
10603
|
var Expression = class {
|
|
9135
10604
|
/**
|
|
9136
10605
|
* Create a new Expression
|
|
@@ -9138,10 +10607,11 @@ var Expression = class {
|
|
|
9138
10607
|
* @param {Object} options - Configuration options
|
|
9139
10608
|
* @param {string} options.separator - Path separator (default: '.')
|
|
9140
10609
|
*/
|
|
9141
|
-
constructor(pattern, options2 = {}) {
|
|
10610
|
+
constructor(pattern, options2 = {}, data) {
|
|
9142
10611
|
this.pattern = pattern;
|
|
9143
10612
|
this.separator = options2.separator || ".";
|
|
9144
10613
|
this.segments = this._parse(pattern);
|
|
10614
|
+
this.data = data;
|
|
9145
10615
|
this._hasDeepWildcard = this.segments.some((seg) => seg.type === "deep-wildcard");
|
|
9146
10616
|
this._hasAttributeCondition = this.segments.some((seg) => seg.attrName !== void 0);
|
|
9147
10617
|
this._hasPositionSelector = this.segments.some((seg) => seg.position !== void 0);
|
|
@@ -9292,30 +10762,302 @@ var Expression = class {
|
|
|
9292
10762
|
}
|
|
9293
10763
|
};
|
|
9294
10764
|
|
|
9295
|
-
// ../../.yarn/cache/path-expression-matcher-npm-1.
|
|
9296
|
-
var
|
|
10765
|
+
// ../../.yarn/cache/path-expression-matcher-npm-1.5.0-73d258a112-28303bb9ee.zip/node_modules/path-expression-matcher/src/ExpressionSet.js
|
|
10766
|
+
var ExpressionSet = class {
|
|
10767
|
+
constructor() {
|
|
10768
|
+
this._byDepthAndTag = /* @__PURE__ */ new Map();
|
|
10769
|
+
this._wildcardByDepth = /* @__PURE__ */ new Map();
|
|
10770
|
+
this._deepWildcards = [];
|
|
10771
|
+
this._patterns = /* @__PURE__ */ new Set();
|
|
10772
|
+
this._sealed = false;
|
|
10773
|
+
}
|
|
10774
|
+
/**
|
|
10775
|
+
* Add an Expression to the set.
|
|
10776
|
+
* Duplicate patterns (same pattern string) are silently ignored.
|
|
10777
|
+
*
|
|
10778
|
+
* @param {import('./Expression.js').default} expression - A pre-constructed Expression instance
|
|
10779
|
+
* @returns {this} for chaining
|
|
10780
|
+
* @throws {TypeError} if called after seal()
|
|
10781
|
+
*
|
|
10782
|
+
* @example
|
|
10783
|
+
* set.add(new Expression('root.users.user'));
|
|
10784
|
+
* set.add(new Expression('..script'));
|
|
10785
|
+
*/
|
|
10786
|
+
add(expression) {
|
|
10787
|
+
if (this._sealed) {
|
|
10788
|
+
throw new TypeError(
|
|
10789
|
+
"ExpressionSet is sealed. Create a new ExpressionSet to add more expressions."
|
|
10790
|
+
);
|
|
10791
|
+
}
|
|
10792
|
+
if (this._patterns.has(expression.pattern)) return this;
|
|
10793
|
+
this._patterns.add(expression.pattern);
|
|
10794
|
+
if (expression.hasDeepWildcard()) {
|
|
10795
|
+
this._deepWildcards.push(expression);
|
|
10796
|
+
return this;
|
|
10797
|
+
}
|
|
10798
|
+
const depth = expression.length;
|
|
10799
|
+
const lastSeg = expression.segments[expression.segments.length - 1];
|
|
10800
|
+
const tag = lastSeg?.tag;
|
|
10801
|
+
if (!tag || tag === "*") {
|
|
10802
|
+
if (!this._wildcardByDepth.has(depth)) this._wildcardByDepth.set(depth, []);
|
|
10803
|
+
this._wildcardByDepth.get(depth).push(expression);
|
|
10804
|
+
} else {
|
|
10805
|
+
const key = `${depth}:${tag}`;
|
|
10806
|
+
if (!this._byDepthAndTag.has(key)) this._byDepthAndTag.set(key, []);
|
|
10807
|
+
this._byDepthAndTag.get(key).push(expression);
|
|
10808
|
+
}
|
|
10809
|
+
return this;
|
|
10810
|
+
}
|
|
10811
|
+
/**
|
|
10812
|
+
* Add multiple expressions at once.
|
|
10813
|
+
*
|
|
10814
|
+
* @param {import('./Expression.js').default[]} expressions - Array of Expression instances
|
|
10815
|
+
* @returns {this} for chaining
|
|
10816
|
+
*
|
|
10817
|
+
* @example
|
|
10818
|
+
* set.addAll([
|
|
10819
|
+
* new Expression('root.users.user'),
|
|
10820
|
+
* new Expression('root.config.setting'),
|
|
10821
|
+
* ]);
|
|
10822
|
+
*/
|
|
10823
|
+
addAll(expressions) {
|
|
10824
|
+
for (const expr of expressions) this.add(expr);
|
|
10825
|
+
return this;
|
|
10826
|
+
}
|
|
10827
|
+
/**
|
|
10828
|
+
* Check whether a pattern string is already present in the set.
|
|
10829
|
+
*
|
|
10830
|
+
* @param {import('./Expression.js').default} expression
|
|
10831
|
+
* @returns {boolean}
|
|
10832
|
+
*/
|
|
10833
|
+
has(expression) {
|
|
10834
|
+
return this._patterns.has(expression.pattern);
|
|
10835
|
+
}
|
|
10836
|
+
/**
|
|
10837
|
+
* Number of expressions in the set.
|
|
10838
|
+
* @type {number}
|
|
10839
|
+
*/
|
|
10840
|
+
get size() {
|
|
10841
|
+
return this._patterns.size;
|
|
10842
|
+
}
|
|
10843
|
+
/**
|
|
10844
|
+
* Seal the set against further modifications.
|
|
10845
|
+
* Useful to prevent accidental mutations after config is built.
|
|
10846
|
+
* Calling add() or addAll() on a sealed set throws a TypeError.
|
|
10847
|
+
*
|
|
10848
|
+
* @returns {this}
|
|
10849
|
+
*/
|
|
10850
|
+
seal() {
|
|
10851
|
+
this._sealed = true;
|
|
10852
|
+
return this;
|
|
10853
|
+
}
|
|
10854
|
+
/**
|
|
10855
|
+
* Whether the set has been sealed.
|
|
10856
|
+
* @type {boolean}
|
|
10857
|
+
*/
|
|
10858
|
+
get isSealed() {
|
|
10859
|
+
return this._sealed;
|
|
10860
|
+
}
|
|
10861
|
+
/**
|
|
10862
|
+
* Test whether the matcher's current path matches any expression in the set.
|
|
10863
|
+
*
|
|
10864
|
+
* Evaluation order (cheapest → most expensive):
|
|
10865
|
+
* 1. Exact depth + tag bucket — O(1) lookup, typically 0–2 expressions
|
|
10866
|
+
* 2. Depth-only wildcard bucket — O(1) lookup, rare
|
|
10867
|
+
* 3. Deep-wildcard list — always checked, but usually small
|
|
10868
|
+
*
|
|
10869
|
+
* @param {import('./Matcher.js').default} matcher - Matcher instance (or readOnly view)
|
|
10870
|
+
* @returns {boolean} true if any expression matches the current path
|
|
10871
|
+
*
|
|
10872
|
+
* @example
|
|
10873
|
+
* if (stopNodes.matchesAny(matcher)) {
|
|
10874
|
+
* // handle stop node
|
|
10875
|
+
* }
|
|
10876
|
+
*/
|
|
10877
|
+
matchesAny(matcher) {
|
|
10878
|
+
return this.findMatch(matcher) !== null;
|
|
10879
|
+
}
|
|
10880
|
+
/**
|
|
10881
|
+
* Find and return the first Expression that matches the matcher's current path.
|
|
10882
|
+
*
|
|
10883
|
+
* Uses the same evaluation order as matchesAny (cheapest → most expensive):
|
|
10884
|
+
* 1. Exact depth + tag bucket
|
|
10885
|
+
* 2. Depth-only wildcard bucket
|
|
10886
|
+
* 3. Deep-wildcard list
|
|
10887
|
+
*
|
|
10888
|
+
* @param {import('./Matcher.js').default} matcher - Matcher instance (or readOnly view)
|
|
10889
|
+
* @returns {import('./Expression.js').default | null} the first matching Expression, or null
|
|
10890
|
+
*
|
|
10891
|
+
* @example
|
|
10892
|
+
* const expr = stopNodes.findMatch(matcher);
|
|
10893
|
+
* if (expr) {
|
|
10894
|
+
* // access expr.config, expr.pattern, etc.
|
|
10895
|
+
* }
|
|
10896
|
+
*/
|
|
10897
|
+
findMatch(matcher) {
|
|
10898
|
+
const depth = matcher.getDepth();
|
|
10899
|
+
const tag = matcher.getCurrentTag();
|
|
10900
|
+
const exactKey = `${depth}:${tag}`;
|
|
10901
|
+
const exactBucket = this._byDepthAndTag.get(exactKey);
|
|
10902
|
+
if (exactBucket) {
|
|
10903
|
+
for (let i = 0; i < exactBucket.length; i++) {
|
|
10904
|
+
if (matcher.matches(exactBucket[i])) return exactBucket[i];
|
|
10905
|
+
}
|
|
10906
|
+
}
|
|
10907
|
+
const wildcardBucket = this._wildcardByDepth.get(depth);
|
|
10908
|
+
if (wildcardBucket) {
|
|
10909
|
+
for (let i = 0; i < wildcardBucket.length; i++) {
|
|
10910
|
+
if (matcher.matches(wildcardBucket[i])) return wildcardBucket[i];
|
|
10911
|
+
}
|
|
10912
|
+
}
|
|
10913
|
+
for (let i = 0; i < this._deepWildcards.length; i++) {
|
|
10914
|
+
if (matcher.matches(this._deepWildcards[i])) return this._deepWildcards[i];
|
|
10915
|
+
}
|
|
10916
|
+
return null;
|
|
10917
|
+
}
|
|
10918
|
+
};
|
|
10919
|
+
|
|
10920
|
+
// ../../.yarn/cache/path-expression-matcher-npm-1.5.0-73d258a112-28303bb9ee.zip/node_modules/path-expression-matcher/src/Matcher.js
|
|
10921
|
+
var MatcherView = class {
|
|
10922
|
+
/**
|
|
10923
|
+
* @param {Matcher} matcher - The parent Matcher instance to read from.
|
|
10924
|
+
*/
|
|
10925
|
+
constructor(matcher) {
|
|
10926
|
+
this._matcher = matcher;
|
|
10927
|
+
}
|
|
10928
|
+
/**
|
|
10929
|
+
* Get the path separator used by the parent matcher.
|
|
10930
|
+
* @returns {string}
|
|
10931
|
+
*/
|
|
10932
|
+
get separator() {
|
|
10933
|
+
return this._matcher.separator;
|
|
10934
|
+
}
|
|
10935
|
+
/**
|
|
10936
|
+
* Get current tag name.
|
|
10937
|
+
* @returns {string|undefined}
|
|
10938
|
+
*/
|
|
10939
|
+
getCurrentTag() {
|
|
10940
|
+
const path = this._matcher.path;
|
|
10941
|
+
return path.length > 0 ? path[path.length - 1].tag : void 0;
|
|
10942
|
+
}
|
|
10943
|
+
/**
|
|
10944
|
+
* Get current namespace.
|
|
10945
|
+
* @returns {string|undefined}
|
|
10946
|
+
*/
|
|
10947
|
+
getCurrentNamespace() {
|
|
10948
|
+
const path = this._matcher.path;
|
|
10949
|
+
return path.length > 0 ? path[path.length - 1].namespace : void 0;
|
|
10950
|
+
}
|
|
10951
|
+
/**
|
|
10952
|
+
* Get current node's attribute value.
|
|
10953
|
+
* @param {string} attrName
|
|
10954
|
+
* @returns {*}
|
|
10955
|
+
*/
|
|
10956
|
+
getAttrValue(attrName) {
|
|
10957
|
+
const path = this._matcher.path;
|
|
10958
|
+
if (path.length === 0) return void 0;
|
|
10959
|
+
return path[path.length - 1].values?.[attrName];
|
|
10960
|
+
}
|
|
10961
|
+
/**
|
|
10962
|
+
* Check if current node has an attribute.
|
|
10963
|
+
* @param {string} attrName
|
|
10964
|
+
* @returns {boolean}
|
|
10965
|
+
*/
|
|
10966
|
+
hasAttr(attrName) {
|
|
10967
|
+
const path = this._matcher.path;
|
|
10968
|
+
if (path.length === 0) return false;
|
|
10969
|
+
const current = path[path.length - 1];
|
|
10970
|
+
return current.values !== void 0 && attrName in current.values;
|
|
10971
|
+
}
|
|
10972
|
+
/**
|
|
10973
|
+
* Get current node's sibling position (child index in parent).
|
|
10974
|
+
* @returns {number}
|
|
10975
|
+
*/
|
|
10976
|
+
getPosition() {
|
|
10977
|
+
const path = this._matcher.path;
|
|
10978
|
+
if (path.length === 0) return -1;
|
|
10979
|
+
return path[path.length - 1].position ?? 0;
|
|
10980
|
+
}
|
|
10981
|
+
/**
|
|
10982
|
+
* Get current node's repeat counter (occurrence count of this tag name).
|
|
10983
|
+
* @returns {number}
|
|
10984
|
+
*/
|
|
10985
|
+
getCounter() {
|
|
10986
|
+
const path = this._matcher.path;
|
|
10987
|
+
if (path.length === 0) return -1;
|
|
10988
|
+
return path[path.length - 1].counter ?? 0;
|
|
10989
|
+
}
|
|
10990
|
+
/**
|
|
10991
|
+
* Get current node's sibling index (alias for getPosition).
|
|
10992
|
+
* @returns {number}
|
|
10993
|
+
* @deprecated Use getPosition() or getCounter() instead
|
|
10994
|
+
*/
|
|
10995
|
+
getIndex() {
|
|
10996
|
+
return this.getPosition();
|
|
10997
|
+
}
|
|
10998
|
+
/**
|
|
10999
|
+
* Get current path depth.
|
|
11000
|
+
* @returns {number}
|
|
11001
|
+
*/
|
|
11002
|
+
getDepth() {
|
|
11003
|
+
return this._matcher.path.length;
|
|
11004
|
+
}
|
|
11005
|
+
/**
|
|
11006
|
+
* Get path as string.
|
|
11007
|
+
* @param {string} [separator] - Optional separator (uses default if not provided)
|
|
11008
|
+
* @param {boolean} [includeNamespace=true]
|
|
11009
|
+
* @returns {string}
|
|
11010
|
+
*/
|
|
11011
|
+
toString(separator, includeNamespace = true) {
|
|
11012
|
+
return this._matcher.toString(separator, includeNamespace);
|
|
11013
|
+
}
|
|
11014
|
+
/**
|
|
11015
|
+
* Get path as array of tag names.
|
|
11016
|
+
* @returns {string[]}
|
|
11017
|
+
*/
|
|
11018
|
+
toArray() {
|
|
11019
|
+
return this._matcher.path.map((n) => n.tag);
|
|
11020
|
+
}
|
|
11021
|
+
/**
|
|
11022
|
+
* Match current path against an Expression.
|
|
11023
|
+
* @param {Expression} expression
|
|
11024
|
+
* @returns {boolean}
|
|
11025
|
+
*/
|
|
11026
|
+
matches(expression) {
|
|
11027
|
+
return this._matcher.matches(expression);
|
|
11028
|
+
}
|
|
11029
|
+
/**
|
|
11030
|
+
* Match any expression in the given set against the current path.
|
|
11031
|
+
* @param {ExpressionSet} exprSet
|
|
11032
|
+
* @returns {boolean}
|
|
11033
|
+
*/
|
|
11034
|
+
matchesAny(exprSet) {
|
|
11035
|
+
return exprSet.matchesAny(this._matcher);
|
|
11036
|
+
}
|
|
11037
|
+
};
|
|
9297
11038
|
var Matcher = class {
|
|
9298
11039
|
/**
|
|
9299
|
-
* Create a new Matcher
|
|
9300
|
-
* @param {Object} options
|
|
9301
|
-
* @param {string} options.separator - Default path separator
|
|
11040
|
+
* Create a new Matcher.
|
|
11041
|
+
* @param {Object} [options={}]
|
|
11042
|
+
* @param {string} [options.separator='.'] - Default path separator
|
|
9302
11043
|
*/
|
|
9303
11044
|
constructor(options2 = {}) {
|
|
9304
11045
|
this.separator = options2.separator || ".";
|
|
9305
11046
|
this.path = [];
|
|
9306
11047
|
this.siblingStacks = [];
|
|
11048
|
+
this._pathStringCache = null;
|
|
11049
|
+
this._view = new MatcherView(this);
|
|
9307
11050
|
}
|
|
9308
11051
|
/**
|
|
9309
|
-
* Push a new tag onto the path
|
|
9310
|
-
* @param {string} tagName
|
|
9311
|
-
* @param {Object} attrValues
|
|
9312
|
-
* @param {string} namespace
|
|
11052
|
+
* Push a new tag onto the path.
|
|
11053
|
+
* @param {string} tagName
|
|
11054
|
+
* @param {Object|null} [attrValues=null]
|
|
11055
|
+
* @param {string|null} [namespace=null]
|
|
9313
11056
|
*/
|
|
9314
11057
|
push(tagName, attrValues = null, namespace = null) {
|
|
9315
11058
|
this._pathStringCache = null;
|
|
9316
11059
|
if (this.path.length > 0) {
|
|
9317
|
-
|
|
9318
|
-
prev.values = void 0;
|
|
11060
|
+
this.path[this.path.length - 1].values = void 0;
|
|
9319
11061
|
}
|
|
9320
11062
|
const currentLevel = this.path.length;
|
|
9321
11063
|
if (!this.siblingStacks[currentLevel]) {
|
|
@@ -9343,13 +11085,11 @@ var Matcher = class {
|
|
|
9343
11085
|
this.path.push(node);
|
|
9344
11086
|
}
|
|
9345
11087
|
/**
|
|
9346
|
-
* Pop the last tag from the path
|
|
11088
|
+
* Pop the last tag from the path.
|
|
9347
11089
|
* @returns {Object|undefined} The popped node
|
|
9348
11090
|
*/
|
|
9349
11091
|
pop() {
|
|
9350
|
-
if (this.path.length === 0)
|
|
9351
|
-
return void 0;
|
|
9352
|
-
}
|
|
11092
|
+
if (this.path.length === 0) return void 0;
|
|
9353
11093
|
this._pathStringCache = null;
|
|
9354
11094
|
const node = this.path.pop();
|
|
9355
11095
|
if (this.siblingStacks.length > this.path.length + 1) {
|
|
@@ -9358,9 +11098,9 @@ var Matcher = class {
|
|
|
9358
11098
|
return node;
|
|
9359
11099
|
}
|
|
9360
11100
|
/**
|
|
9361
|
-
* Update current node's attribute values
|
|
9362
|
-
* Useful when attributes are parsed after push
|
|
9363
|
-
* @param {Object} attrValues
|
|
11101
|
+
* Update current node's attribute values.
|
|
11102
|
+
* Useful when attributes are parsed after push.
|
|
11103
|
+
* @param {Object} attrValues
|
|
9364
11104
|
*/
|
|
9365
11105
|
updateCurrent(attrValues) {
|
|
9366
11106
|
if (this.path.length > 0) {
|
|
@@ -9371,32 +11111,31 @@ var Matcher = class {
|
|
|
9371
11111
|
}
|
|
9372
11112
|
}
|
|
9373
11113
|
/**
|
|
9374
|
-
* Get current tag name
|
|
11114
|
+
* Get current tag name.
|
|
9375
11115
|
* @returns {string|undefined}
|
|
9376
11116
|
*/
|
|
9377
11117
|
getCurrentTag() {
|
|
9378
11118
|
return this.path.length > 0 ? this.path[this.path.length - 1].tag : void 0;
|
|
9379
11119
|
}
|
|
9380
11120
|
/**
|
|
9381
|
-
* Get current namespace
|
|
11121
|
+
* Get current namespace.
|
|
9382
11122
|
* @returns {string|undefined}
|
|
9383
11123
|
*/
|
|
9384
11124
|
getCurrentNamespace() {
|
|
9385
11125
|
return this.path.length > 0 ? this.path[this.path.length - 1].namespace : void 0;
|
|
9386
11126
|
}
|
|
9387
11127
|
/**
|
|
9388
|
-
* Get current node's attribute value
|
|
9389
|
-
* @param {string} attrName
|
|
9390
|
-
* @returns {*}
|
|
11128
|
+
* Get current node's attribute value.
|
|
11129
|
+
* @param {string} attrName
|
|
11130
|
+
* @returns {*}
|
|
9391
11131
|
*/
|
|
9392
11132
|
getAttrValue(attrName) {
|
|
9393
11133
|
if (this.path.length === 0) return void 0;
|
|
9394
|
-
|
|
9395
|
-
return current.values?.[attrName];
|
|
11134
|
+
return this.path[this.path.length - 1].values?.[attrName];
|
|
9396
11135
|
}
|
|
9397
11136
|
/**
|
|
9398
|
-
* Check if current node has an attribute
|
|
9399
|
-
* @param {string} attrName
|
|
11137
|
+
* Check if current node has an attribute.
|
|
11138
|
+
* @param {string} attrName
|
|
9400
11139
|
* @returns {boolean}
|
|
9401
11140
|
*/
|
|
9402
11141
|
hasAttr(attrName) {
|
|
@@ -9405,7 +11144,7 @@ var Matcher = class {
|
|
|
9405
11144
|
return current.values !== void 0 && attrName in current.values;
|
|
9406
11145
|
}
|
|
9407
11146
|
/**
|
|
9408
|
-
* Get current node's sibling position (child index in parent)
|
|
11147
|
+
* Get current node's sibling position (child index in parent).
|
|
9409
11148
|
* @returns {number}
|
|
9410
11149
|
*/
|
|
9411
11150
|
getPosition() {
|
|
@@ -9413,7 +11152,7 @@ var Matcher = class {
|
|
|
9413
11152
|
return this.path[this.path.length - 1].position ?? 0;
|
|
9414
11153
|
}
|
|
9415
11154
|
/**
|
|
9416
|
-
* Get current node's repeat counter (occurrence count of this tag name)
|
|
11155
|
+
* Get current node's repeat counter (occurrence count of this tag name).
|
|
9417
11156
|
* @returns {number}
|
|
9418
11157
|
*/
|
|
9419
11158
|
getCounter() {
|
|
@@ -9421,7 +11160,7 @@ var Matcher = class {
|
|
|
9421
11160
|
return this.path[this.path.length - 1].counter ?? 0;
|
|
9422
11161
|
}
|
|
9423
11162
|
/**
|
|
9424
|
-
* Get current node's sibling index (alias for getPosition
|
|
11163
|
+
* Get current node's sibling index (alias for getPosition).
|
|
9425
11164
|
* @returns {number}
|
|
9426
11165
|
* @deprecated Use getPosition() or getCounter() instead
|
|
9427
11166
|
*/
|
|
@@ -9429,27 +11168,27 @@ var Matcher = class {
|
|
|
9429
11168
|
return this.getPosition();
|
|
9430
11169
|
}
|
|
9431
11170
|
/**
|
|
9432
|
-
* Get current path depth
|
|
11171
|
+
* Get current path depth.
|
|
9433
11172
|
* @returns {number}
|
|
9434
11173
|
*/
|
|
9435
11174
|
getDepth() {
|
|
9436
11175
|
return this.path.length;
|
|
9437
11176
|
}
|
|
9438
11177
|
/**
|
|
9439
|
-
* Get path as string
|
|
9440
|
-
* @param {string} separator - Optional separator (uses default if not provided)
|
|
9441
|
-
* @param {boolean} includeNamespace
|
|
11178
|
+
* Get path as string.
|
|
11179
|
+
* @param {string} [separator] - Optional separator (uses default if not provided)
|
|
11180
|
+
* @param {boolean} [includeNamespace=true]
|
|
9442
11181
|
* @returns {string}
|
|
9443
11182
|
*/
|
|
9444
11183
|
toString(separator, includeNamespace = true) {
|
|
9445
11184
|
const sep = separator || this.separator;
|
|
9446
11185
|
const isDefault = sep === this.separator && includeNamespace === true;
|
|
9447
11186
|
if (isDefault) {
|
|
9448
|
-
if (this._pathStringCache !== null
|
|
11187
|
+
if (this._pathStringCache !== null) {
|
|
9449
11188
|
return this._pathStringCache;
|
|
9450
11189
|
}
|
|
9451
11190
|
const result = this.path.map(
|
|
9452
|
-
(n) =>
|
|
11191
|
+
(n) => n.namespace ? `${n.namespace}:${n.tag}` : n.tag
|
|
9453
11192
|
).join(sep);
|
|
9454
11193
|
this._pathStringCache = result;
|
|
9455
11194
|
return result;
|
|
@@ -9459,14 +11198,14 @@ var Matcher = class {
|
|
|
9459
11198
|
).join(sep);
|
|
9460
11199
|
}
|
|
9461
11200
|
/**
|
|
9462
|
-
* Get path as array of tag names
|
|
11201
|
+
* Get path as array of tag names.
|
|
9463
11202
|
* @returns {string[]}
|
|
9464
11203
|
*/
|
|
9465
11204
|
toArray() {
|
|
9466
11205
|
return this.path.map((n) => n.tag);
|
|
9467
11206
|
}
|
|
9468
11207
|
/**
|
|
9469
|
-
* Reset the path to empty
|
|
11208
|
+
* Reset the path to empty.
|
|
9470
11209
|
*/
|
|
9471
11210
|
reset() {
|
|
9472
11211
|
this._pathStringCache = null;
|
|
@@ -9474,9 +11213,9 @@ var Matcher = class {
|
|
|
9474
11213
|
this.siblingStacks = [];
|
|
9475
11214
|
}
|
|
9476
11215
|
/**
|
|
9477
|
-
* Match current path against an Expression
|
|
9478
|
-
* @param {Expression} expression
|
|
9479
|
-
* @returns {boolean}
|
|
11216
|
+
* Match current path against an Expression.
|
|
11217
|
+
* @param {Expression} expression
|
|
11218
|
+
* @returns {boolean}
|
|
9480
11219
|
*/
|
|
9481
11220
|
matches(expression) {
|
|
9482
11221
|
const segments = expression.segments;
|
|
@@ -9489,7 +11228,6 @@ var Matcher = class {
|
|
|
9489
11228
|
return this._matchSimple(segments);
|
|
9490
11229
|
}
|
|
9491
11230
|
/**
|
|
9492
|
-
* Match simple path (no deep wildcards)
|
|
9493
11231
|
* @private
|
|
9494
11232
|
*/
|
|
9495
11233
|
_matchSimple(segments) {
|
|
@@ -9497,17 +11235,13 @@ var Matcher = class {
|
|
|
9497
11235
|
return false;
|
|
9498
11236
|
}
|
|
9499
11237
|
for (let i = 0; i < segments.length; i++) {
|
|
9500
|
-
|
|
9501
|
-
const node = this.path[i];
|
|
9502
|
-
const isCurrentNode = i === this.path.length - 1;
|
|
9503
|
-
if (!this._matchSegment(segment, node, isCurrentNode)) {
|
|
11238
|
+
if (!this._matchSegment(segments[i], this.path[i], i === this.path.length - 1)) {
|
|
9504
11239
|
return false;
|
|
9505
11240
|
}
|
|
9506
11241
|
}
|
|
9507
11242
|
return true;
|
|
9508
11243
|
}
|
|
9509
11244
|
/**
|
|
9510
|
-
* Match path with deep wildcards
|
|
9511
11245
|
* @private
|
|
9512
11246
|
*/
|
|
9513
11247
|
_matchWithDeepWildcard(segments) {
|
|
@@ -9523,8 +11257,7 @@ var Matcher = class {
|
|
|
9523
11257
|
const nextSeg = segments[segIdx];
|
|
9524
11258
|
let found = false;
|
|
9525
11259
|
for (let i = pathIdx; i >= 0; i--) {
|
|
9526
|
-
|
|
9527
|
-
if (this._matchSegment(nextSeg, this.path[i], isCurrentNode)) {
|
|
11260
|
+
if (this._matchSegment(nextSeg, this.path[i], i === this.path.length - 1)) {
|
|
9528
11261
|
pathIdx = i - 1;
|
|
9529
11262
|
segIdx--;
|
|
9530
11263
|
found = true;
|
|
@@ -9535,8 +11268,7 @@ var Matcher = class {
|
|
|
9535
11268
|
return false;
|
|
9536
11269
|
}
|
|
9537
11270
|
} else {
|
|
9538
|
-
|
|
9539
|
-
if (!this._matchSegment(segment, this.path[pathIdx], isCurrentNode)) {
|
|
11271
|
+
if (!this._matchSegment(segment, this.path[pathIdx], pathIdx === this.path.length - 1)) {
|
|
9540
11272
|
return false;
|
|
9541
11273
|
}
|
|
9542
11274
|
pathIdx--;
|
|
@@ -9546,12 +11278,7 @@ var Matcher = class {
|
|
|
9546
11278
|
return segIdx < 0;
|
|
9547
11279
|
}
|
|
9548
11280
|
/**
|
|
9549
|
-
* Match a single segment against a node
|
|
9550
11281
|
* @private
|
|
9551
|
-
* @param {Object} segment - Segment from Expression
|
|
9552
|
-
* @param {Object} node - Node from path
|
|
9553
|
-
* @param {boolean} isCurrentNode - Whether this is the current (last) node
|
|
9554
|
-
* @returns {boolean}
|
|
9555
11282
|
*/
|
|
9556
11283
|
_matchSegment(segment, node, isCurrentNode) {
|
|
9557
11284
|
if (segment.tag !== "*" && segment.tag !== node.tag) {
|
|
@@ -9570,8 +11297,7 @@ var Matcher = class {
|
|
|
9570
11297
|
return false;
|
|
9571
11298
|
}
|
|
9572
11299
|
if (segment.attrValue !== void 0) {
|
|
9573
|
-
|
|
9574
|
-
if (String(actualValue) !== String(segment.attrValue)) {
|
|
11300
|
+
if (String(node.values[segment.attrName]) !== String(segment.attrValue)) {
|
|
9575
11301
|
return false;
|
|
9576
11302
|
}
|
|
9577
11303
|
}
|
|
@@ -9587,17 +11313,23 @@ var Matcher = class {
|
|
|
9587
11313
|
return false;
|
|
9588
11314
|
} else if (segment.position === "even" && counter % 2 !== 0) {
|
|
9589
11315
|
return false;
|
|
9590
|
-
} else if (segment.position === "nth") {
|
|
9591
|
-
|
|
9592
|
-
return false;
|
|
9593
|
-
}
|
|
11316
|
+
} else if (segment.position === "nth" && counter !== segment.positionValue) {
|
|
11317
|
+
return false;
|
|
9594
11318
|
}
|
|
9595
11319
|
}
|
|
9596
11320
|
return true;
|
|
9597
11321
|
}
|
|
9598
11322
|
/**
|
|
9599
|
-
*
|
|
9600
|
-
* @
|
|
11323
|
+
* Match any expression in the given set against the current path.
|
|
11324
|
+
* @param {ExpressionSet} exprSet
|
|
11325
|
+
* @returns {boolean}
|
|
11326
|
+
*/
|
|
11327
|
+
matchesAny(exprSet) {
|
|
11328
|
+
return exprSet.matchesAny(this);
|
|
11329
|
+
}
|
|
11330
|
+
/**
|
|
11331
|
+
* Create a snapshot of current state.
|
|
11332
|
+
* @returns {Object}
|
|
9601
11333
|
*/
|
|
9602
11334
|
snapshot() {
|
|
9603
11335
|
return {
|
|
@@ -9606,8 +11338,8 @@ var Matcher = class {
|
|
|
9606
11338
|
};
|
|
9607
11339
|
}
|
|
9608
11340
|
/**
|
|
9609
|
-
* Restore state from snapshot
|
|
9610
|
-
* @param {Object} snapshot
|
|
11341
|
+
* Restore state from snapshot.
|
|
11342
|
+
* @param {Object} snapshot
|
|
9611
11343
|
*/
|
|
9612
11344
|
restore(snapshot) {
|
|
9613
11345
|
this._pathStringCache = null;
|
|
@@ -9615,68 +11347,27 @@ var Matcher = class {
|
|
|
9615
11347
|
this.siblingStacks = snapshot.siblingStacks.map((map2) => new Map(map2));
|
|
9616
11348
|
}
|
|
9617
11349
|
/**
|
|
9618
|
-
* Return
|
|
11350
|
+
* Return the read-only {@link MatcherView} for this matcher.
|
|
9619
11351
|
*
|
|
9620
|
-
* The returned
|
|
9621
|
-
*
|
|
9622
|
-
*
|
|
9623
|
-
* are allowed but the returned arrays/objects are frozen so callers cannot
|
|
9624
|
-
* mutate internal state through them either.
|
|
11352
|
+
* The same instance is returned on every call — no allocation occurs.
|
|
11353
|
+
* It always reflects the current parser state and is safe to pass to
|
|
11354
|
+
* user callbacks without risk of accidental mutation.
|
|
9625
11355
|
*
|
|
9626
|
-
* @returns {
|
|
11356
|
+
* @returns {MatcherView}
|
|
9627
11357
|
*
|
|
9628
11358
|
* @example
|
|
9629
|
-
* const
|
|
9630
|
-
*
|
|
9631
|
-
*
|
|
9632
|
-
*
|
|
9633
|
-
*
|
|
9634
|
-
* ro.getCurrentTag(); // ✓ works
|
|
9635
|
-
* ro.push("child", {}); // ✗ throws TypeError
|
|
9636
|
-
* ro.reset(); // ✗ throws TypeError
|
|
11359
|
+
* const view = matcher.readOnly();
|
|
11360
|
+
* // pass view to callbacks — it stays in sync automatically
|
|
11361
|
+
* view.matches(expr); // ✓
|
|
11362
|
+
* view.getCurrentTag(); // ✓
|
|
11363
|
+
* // view.push(...) // ✗ method does not exist — caught by TypeScript
|
|
9637
11364
|
*/
|
|
9638
11365
|
readOnly() {
|
|
9639
|
-
|
|
9640
|
-
return new Proxy(self2, {
|
|
9641
|
-
get(target, prop, receiver) {
|
|
9642
|
-
if (MUTATING_METHODS.has(prop)) {
|
|
9643
|
-
return () => {
|
|
9644
|
-
throw new TypeError(
|
|
9645
|
-
`Cannot call '${prop}' on a read-only Matcher. Obtain a writable instance to mutate state.`
|
|
9646
|
-
);
|
|
9647
|
-
};
|
|
9648
|
-
}
|
|
9649
|
-
const value = Reflect.get(target, prop, receiver);
|
|
9650
|
-
if (prop === "path" || prop === "siblingStacks") {
|
|
9651
|
-
return Object.freeze(
|
|
9652
|
-
Array.isArray(value) ? value.map(
|
|
9653
|
-
(item) => item instanceof Map ? Object.freeze(new Map(item)) : Object.freeze({ ...item })
|
|
9654
|
-
// freeze a copy of each node
|
|
9655
|
-
) : value
|
|
9656
|
-
);
|
|
9657
|
-
}
|
|
9658
|
-
if (typeof value === "function") {
|
|
9659
|
-
return value.bind(target);
|
|
9660
|
-
}
|
|
9661
|
-
return value;
|
|
9662
|
-
},
|
|
9663
|
-
// Prevent any property assignment on the read-only view
|
|
9664
|
-
set(_target, prop) {
|
|
9665
|
-
throw new TypeError(
|
|
9666
|
-
`Cannot set property '${String(prop)}' on a read-only Matcher.`
|
|
9667
|
-
);
|
|
9668
|
-
},
|
|
9669
|
-
// Prevent property deletion
|
|
9670
|
-
deleteProperty(_target, prop) {
|
|
9671
|
-
throw new TypeError(
|
|
9672
|
-
`Cannot delete property '${String(prop)}' from a read-only Matcher.`
|
|
9673
|
-
);
|
|
9674
|
-
}
|
|
9675
|
-
});
|
|
11366
|
+
return this._view;
|
|
9676
11367
|
}
|
|
9677
11368
|
};
|
|
9678
11369
|
|
|
9679
|
-
// ../../.yarn/cache/fast-xml-parser-npm-5.
|
|
11370
|
+
// ../../.yarn/cache/fast-xml-parser-npm-5.7.2-960de42682-7f32d77127.zip/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js
|
|
9680
11371
|
function extractRawAttributes(prefixedAttrs, options2) {
|
|
9681
11372
|
if (!prefixedAttrs) return {};
|
|
9682
11373
|
const attrs = options2.attributesGroupName ? prefixedAttrs[options2.attributesGroupName] : prefixedAttrs;
|
|
@@ -9704,36 +11395,10 @@ function extractNamespace(rawTagName) {
|
|
|
9704
11395
|
return void 0;
|
|
9705
11396
|
}
|
|
9706
11397
|
var OrderedObjParser = class {
|
|
9707
|
-
constructor(options2) {
|
|
11398
|
+
constructor(options2, externalEntities) {
|
|
9708
11399
|
this.options = options2;
|
|
9709
11400
|
this.currentNode = null;
|
|
9710
11401
|
this.tagsNodeStack = [];
|
|
9711
|
-
this.docTypeEntities = {};
|
|
9712
|
-
this.lastEntities = {
|
|
9713
|
-
"apos": { regex: /&(apos|#39|#x27);/g, val: "'" },
|
|
9714
|
-
"gt": { regex: /&(gt|#62|#x3E);/g, val: ">" },
|
|
9715
|
-
"lt": { regex: /&(lt|#60|#x3C);/g, val: "<" },
|
|
9716
|
-
"quot": { regex: /&(quot|#34|#x22);/g, val: '"' }
|
|
9717
|
-
};
|
|
9718
|
-
this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" };
|
|
9719
|
-
this.htmlEntities = {
|
|
9720
|
-
"space": { regex: /&(nbsp|#160);/g, val: " " },
|
|
9721
|
-
// "lt" : { regex: /&(lt|#60);/g, val: "<" },
|
|
9722
|
-
// "gt" : { regex: /&(gt|#62);/g, val: ">" },
|
|
9723
|
-
// "amp" : { regex: /&(amp|#38);/g, val: "&" },
|
|
9724
|
-
// "quot" : { regex: /&(quot|#34);/g, val: "\"" },
|
|
9725
|
-
// "apos" : { regex: /&(apos|#39);/g, val: "'" },
|
|
9726
|
-
"cent": { regex: /&(cent|#162);/g, val: "\xA2" },
|
|
9727
|
-
"pound": { regex: /&(pound|#163);/g, val: "\xA3" },
|
|
9728
|
-
"yen": { regex: /&(yen|#165);/g, val: "\xA5" },
|
|
9729
|
-
"euro": { regex: /&(euro|#8364);/g, val: "\u20AC" },
|
|
9730
|
-
"copyright": { regex: /&(copy|#169);/g, val: "\xA9" },
|
|
9731
|
-
"reg": { regex: /&(reg|#174);/g, val: "\xAE" },
|
|
9732
|
-
"inr": { regex: /&(inr|#8377);/g, val: "\u20B9" },
|
|
9733
|
-
"num_dec": { regex: /&#([0-9]{1,7});/g, val: (_, str) => fromCodePoint(str, 10, "&#") },
|
|
9734
|
-
"num_hex": { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (_, str) => fromCodePoint(str, 16, "&#x") }
|
|
9735
|
-
};
|
|
9736
|
-
this.addExternalEntities = addExternalEntities;
|
|
9737
11402
|
this.parseXml = parseXml;
|
|
9738
11403
|
this.parseTextData = parseTextData;
|
|
9739
11404
|
this.resolveNameSpace = resolveNameSpace;
|
|
@@ -9746,52 +11411,61 @@ var OrderedObjParser = class {
|
|
|
9746
11411
|
this.ignoreAttributesFn = getIgnoreAttributesFn(this.options.ignoreAttributes);
|
|
9747
11412
|
this.entityExpansionCount = 0;
|
|
9748
11413
|
this.currentExpandedLength = 0;
|
|
11414
|
+
let namedEntities = { ...XML };
|
|
11415
|
+
if (this.options.entityDecoder) {
|
|
11416
|
+
this.entityDecoder = this.options.entityDecoder;
|
|
11417
|
+
} else {
|
|
11418
|
+
if (typeof this.options.htmlEntities === "object") namedEntities = this.options.htmlEntities;
|
|
11419
|
+
else if (this.options.htmlEntities === true) namedEntities = { ...COMMON_HTML, ...CURRENCY };
|
|
11420
|
+
this.entityDecoder = new EntityDecoder({
|
|
11421
|
+
namedEntities: { ...namedEntities, ...externalEntities },
|
|
11422
|
+
numericAllowed: this.options.htmlEntities,
|
|
11423
|
+
limit: {
|
|
11424
|
+
maxTotalExpansions: this.options.processEntities.maxTotalExpansions,
|
|
11425
|
+
maxExpandedLength: this.options.processEntities.maxExpandedLength,
|
|
11426
|
+
applyLimitsTo: this.options.processEntities.appliesTo
|
|
11427
|
+
}
|
|
11428
|
+
//postCheck: resolved => resolved
|
|
11429
|
+
});
|
|
11430
|
+
}
|
|
9749
11431
|
this.matcher = new Matcher();
|
|
9750
11432
|
this.readonlyMatcher = this.matcher.readOnly();
|
|
9751
11433
|
this.isCurrentNodeStopNode = false;
|
|
9752
|
-
|
|
9753
|
-
|
|
9754
|
-
|
|
9755
|
-
|
|
11434
|
+
this.stopNodeExpressionsSet = new ExpressionSet();
|
|
11435
|
+
const stopNodesOpts = this.options.stopNodes;
|
|
11436
|
+
if (stopNodesOpts && stopNodesOpts.length > 0) {
|
|
11437
|
+
for (let i = 0; i < stopNodesOpts.length; i++) {
|
|
11438
|
+
const stopNodeExp = stopNodesOpts[i];
|
|
9756
11439
|
if (typeof stopNodeExp === "string") {
|
|
9757
|
-
this.
|
|
11440
|
+
this.stopNodeExpressionsSet.add(new Expression(stopNodeExp));
|
|
9758
11441
|
} else if (stopNodeExp instanceof Expression) {
|
|
9759
|
-
this.
|
|
11442
|
+
this.stopNodeExpressionsSet.add(stopNodeExp);
|
|
9760
11443
|
}
|
|
9761
11444
|
}
|
|
11445
|
+
this.stopNodeExpressionsSet.seal();
|
|
9762
11446
|
}
|
|
9763
11447
|
}
|
|
9764
11448
|
};
|
|
9765
|
-
function addExternalEntities(externalEntities) {
|
|
9766
|
-
const entKeys = Object.keys(externalEntities);
|
|
9767
|
-
for (let i = 0; i < entKeys.length; i++) {
|
|
9768
|
-
const ent = entKeys[i];
|
|
9769
|
-
const escaped = ent.replace(/[.\-+*:]/g, "\\.");
|
|
9770
|
-
this.lastEntities[ent] = {
|
|
9771
|
-
regex: new RegExp("&" + escaped + ";", "g"),
|
|
9772
|
-
val: externalEntities[ent]
|
|
9773
|
-
};
|
|
9774
|
-
}
|
|
9775
|
-
}
|
|
9776
11449
|
function parseTextData(val, tagName, jPath, dontTrim, hasAttributes, isLeafNode, escapeEntities) {
|
|
11450
|
+
const options2 = this.options;
|
|
9777
11451
|
if (val !== void 0) {
|
|
9778
|
-
if (
|
|
11452
|
+
if (options2.trimValues && !dontTrim) {
|
|
9779
11453
|
val = val.trim();
|
|
9780
11454
|
}
|
|
9781
11455
|
if (val.length > 0) {
|
|
9782
11456
|
if (!escapeEntities) val = this.replaceEntitiesValue(val, tagName, jPath);
|
|
9783
|
-
const jPathOrMatcher =
|
|
9784
|
-
const newval =
|
|
11457
|
+
const jPathOrMatcher = options2.jPath ? jPath.toString() : jPath;
|
|
11458
|
+
const newval = options2.tagValueProcessor(tagName, val, jPathOrMatcher, hasAttributes, isLeafNode);
|
|
9785
11459
|
if (newval === null || newval === void 0) {
|
|
9786
11460
|
return val;
|
|
9787
11461
|
} else if (typeof newval !== typeof val || newval !== val) {
|
|
9788
11462
|
return newval;
|
|
9789
|
-
} else if (
|
|
9790
|
-
return parseValue(val,
|
|
11463
|
+
} else if (options2.trimValues) {
|
|
11464
|
+
return parseValue(val, options2.parseTagValue, options2.numberParseOptions);
|
|
9791
11465
|
} else {
|
|
9792
11466
|
const trimmedVal = val.trim();
|
|
9793
11467
|
if (trimmedVal === val) {
|
|
9794
|
-
return parseValue(val,
|
|
11468
|
+
return parseValue(val, options2.parseTagValue, options2.numberParseOptions);
|
|
9795
11469
|
} else {
|
|
9796
11470
|
return val;
|
|
9797
11471
|
}
|
|
@@ -9813,8 +11487,9 @@ function resolveNameSpace(tagname) {
|
|
|
9813
11487
|
return tagname;
|
|
9814
11488
|
}
|
|
9815
11489
|
var attrsRegx = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
|
|
9816
|
-
function buildAttributesMap(attrStr, jPath, tagName) {
|
|
9817
|
-
|
|
11490
|
+
function buildAttributesMap(attrStr, jPath, tagName, force = false) {
|
|
11491
|
+
const options2 = this.options;
|
|
11492
|
+
if (force === true || options2.ignoreAttributes !== true && typeof attrStr === "string") {
|
|
9818
11493
|
const matches = getAllMatches(attrStr, attrsRegx);
|
|
9819
11494
|
const len = matches.length;
|
|
9820
11495
|
const attrs = {};
|
|
@@ -9826,7 +11501,7 @@ function buildAttributesMap(attrStr, jPath, tagName) {
|
|
|
9826
11501
|
const oldVal = matches[i][4];
|
|
9827
11502
|
if (attrName.length && oldVal !== void 0) {
|
|
9828
11503
|
let val = oldVal;
|
|
9829
|
-
if (
|
|
11504
|
+
if (options2.trimValues) val = val.trim();
|
|
9830
11505
|
val = this.replaceEntitiesValue(val, tagName, this.readonlyMatcher);
|
|
9831
11506
|
processedVals[i] = val;
|
|
9832
11507
|
rawAttrsForMatcher[attrName] = val;
|
|
@@ -9836,38 +11511,38 @@ function buildAttributesMap(attrStr, jPath, tagName) {
|
|
|
9836
11511
|
if (hasRawAttrs && typeof jPath === "object" && jPath.updateCurrent) {
|
|
9837
11512
|
jPath.updateCurrent(rawAttrsForMatcher);
|
|
9838
11513
|
}
|
|
9839
|
-
const jPathStr =
|
|
11514
|
+
const jPathStr = options2.jPath ? jPath.toString() : this.readonlyMatcher;
|
|
9840
11515
|
let hasAttrs = false;
|
|
9841
11516
|
for (let i = 0; i < len; i++) {
|
|
9842
11517
|
const attrName = this.resolveNameSpace(matches[i][1]);
|
|
9843
11518
|
if (this.ignoreAttributesFn(attrName, jPathStr)) continue;
|
|
9844
|
-
let aName =
|
|
11519
|
+
let aName = options2.attributeNamePrefix + attrName;
|
|
9845
11520
|
if (attrName.length) {
|
|
9846
|
-
if (
|
|
9847
|
-
aName =
|
|
11521
|
+
if (options2.transformAttributeName) {
|
|
11522
|
+
aName = options2.transformAttributeName(aName);
|
|
9848
11523
|
}
|
|
9849
|
-
aName = sanitizeName(aName,
|
|
11524
|
+
aName = sanitizeName(aName, options2);
|
|
9850
11525
|
if (matches[i][4] !== void 0) {
|
|
9851
11526
|
const oldVal = processedVals[i];
|
|
9852
|
-
const newVal =
|
|
11527
|
+
const newVal = options2.attributeValueProcessor(attrName, oldVal, jPathStr);
|
|
9853
11528
|
if (newVal === null || newVal === void 0) {
|
|
9854
11529
|
attrs[aName] = oldVal;
|
|
9855
11530
|
} else if (typeof newVal !== typeof oldVal || newVal !== oldVal) {
|
|
9856
11531
|
attrs[aName] = newVal;
|
|
9857
11532
|
} else {
|
|
9858
|
-
attrs[aName] = parseValue(oldVal,
|
|
11533
|
+
attrs[aName] = parseValue(oldVal, options2.parseAttributeValue, options2.numberParseOptions);
|
|
9859
11534
|
}
|
|
9860
11535
|
hasAttrs = true;
|
|
9861
|
-
} else if (
|
|
11536
|
+
} else if (options2.allowBooleanAttributes) {
|
|
9862
11537
|
attrs[aName] = true;
|
|
9863
11538
|
hasAttrs = true;
|
|
9864
11539
|
}
|
|
9865
11540
|
}
|
|
9866
11541
|
}
|
|
9867
11542
|
if (!hasAttrs) return;
|
|
9868
|
-
if (
|
|
11543
|
+
if (options2.attributesGroupName && !options2.preserveOrder) {
|
|
9869
11544
|
const attrCollection = {};
|
|
9870
|
-
attrCollection[
|
|
11545
|
+
attrCollection[options2.attributesGroupName] = attrs;
|
|
9871
11546
|
return attrCollection;
|
|
9872
11547
|
}
|
|
9873
11548
|
return attrs;
|
|
@@ -9879,30 +11554,34 @@ var parseXml = function(xmlData) {
|
|
|
9879
11554
|
let currentNode = xmlObj;
|
|
9880
11555
|
let textData = "";
|
|
9881
11556
|
this.matcher.reset();
|
|
11557
|
+
this.entityDecoder.reset();
|
|
9882
11558
|
this.entityExpansionCount = 0;
|
|
9883
11559
|
this.currentExpandedLength = 0;
|
|
9884
|
-
const
|
|
9885
|
-
|
|
11560
|
+
const options2 = this.options;
|
|
11561
|
+
const docTypeReader = new DocTypeReader(options2.processEntities);
|
|
11562
|
+
const xmlLen = xmlData.length;
|
|
11563
|
+
for (let i = 0; i < xmlLen; i++) {
|
|
9886
11564
|
const ch = xmlData[i];
|
|
9887
11565
|
if (ch === "<") {
|
|
9888
|
-
|
|
11566
|
+
const c1 = xmlData.charCodeAt(i + 1);
|
|
11567
|
+
if (c1 === 47) {
|
|
9889
11568
|
const closeIndex = findClosingIndex(xmlData, ">", i, "Closing Tag is not closed.");
|
|
9890
11569
|
let tagName = xmlData.substring(i + 2, closeIndex).trim();
|
|
9891
|
-
if (
|
|
11570
|
+
if (options2.removeNSPrefix) {
|
|
9892
11571
|
const colonIndex = tagName.indexOf(":");
|
|
9893
11572
|
if (colonIndex !== -1) {
|
|
9894
11573
|
tagName = tagName.substr(colonIndex + 1);
|
|
9895
11574
|
}
|
|
9896
11575
|
}
|
|
9897
|
-
tagName = transformTagName(
|
|
11576
|
+
tagName = transformTagName(options2.transformTagName, tagName, "", options2).tagName;
|
|
9898
11577
|
if (currentNode) {
|
|
9899
11578
|
textData = this.saveTextToParentTag(textData, currentNode, this.readonlyMatcher);
|
|
9900
11579
|
}
|
|
9901
11580
|
const lastTagName = this.matcher.getCurrentTag();
|
|
9902
|
-
if (tagName &&
|
|
11581
|
+
if (tagName && options2.unpairedTagsSet.has(tagName)) {
|
|
9903
11582
|
throw new Error(`Unpaired tag can not be used as closing tag: </${tagName}>`);
|
|
9904
11583
|
}
|
|
9905
|
-
if (lastTagName &&
|
|
11584
|
+
if (lastTagName && options2.unpairedTagsSet.has(lastTagName)) {
|
|
9906
11585
|
this.matcher.pop();
|
|
9907
11586
|
this.tagsNodeStack.pop();
|
|
9908
11587
|
}
|
|
@@ -9911,48 +11590,53 @@ var parseXml = function(xmlData) {
|
|
|
9911
11590
|
currentNode = this.tagsNodeStack.pop();
|
|
9912
11591
|
textData = "";
|
|
9913
11592
|
i = closeIndex;
|
|
9914
|
-
} else if (
|
|
11593
|
+
} else if (c1 === 63) {
|
|
9915
11594
|
let tagData = readTagExp(xmlData, i, false, "?>");
|
|
9916
11595
|
if (!tagData) throw new Error("Pi Tag is not closed.");
|
|
9917
11596
|
textData = this.saveTextToParentTag(textData, currentNode, this.readonlyMatcher);
|
|
9918
|
-
|
|
11597
|
+
const attsMap = this.buildAttributesMap(tagData.tagExp, this.matcher, tagData.tagName, true);
|
|
11598
|
+
if (attsMap) {
|
|
11599
|
+
const ver = attsMap[this.options.attributeNamePrefix + "version"];
|
|
11600
|
+
this.entityDecoder.setXmlVersion(Number(ver) || 1);
|
|
11601
|
+
}
|
|
11602
|
+
if (options2.ignoreDeclaration && tagData.tagName === "?xml" || options2.ignorePiTags) {
|
|
9919
11603
|
} else {
|
|
9920
11604
|
const childNode = new XmlNode(tagData.tagName);
|
|
9921
|
-
childNode.add(
|
|
9922
|
-
if (tagData.tagName !== tagData.tagExp && tagData.attrExpPresent) {
|
|
9923
|
-
childNode[":@"] =
|
|
11605
|
+
childNode.add(options2.textNodeName, "");
|
|
11606
|
+
if (tagData.tagName !== tagData.tagExp && tagData.attrExpPresent && options2.ignoreAttributes !== true) {
|
|
11607
|
+
childNode[":@"] = attsMap;
|
|
9924
11608
|
}
|
|
9925
11609
|
this.addChild(currentNode, childNode, this.readonlyMatcher, i);
|
|
9926
11610
|
}
|
|
9927
11611
|
i = tagData.closeIndex + 1;
|
|
9928
|
-
} else if (xmlData.
|
|
11612
|
+
} else if (c1 === 33 && xmlData.charCodeAt(i + 2) === 45 && xmlData.charCodeAt(i + 3) === 45) {
|
|
9929
11613
|
const endIndex = findClosingIndex(xmlData, "-->", i + 4, "Comment is not closed.");
|
|
9930
|
-
if (
|
|
11614
|
+
if (options2.commentPropName) {
|
|
9931
11615
|
const comment = xmlData.substring(i + 4, endIndex - 2);
|
|
9932
11616
|
textData = this.saveTextToParentTag(textData, currentNode, this.readonlyMatcher);
|
|
9933
|
-
currentNode.add(
|
|
11617
|
+
currentNode.add(options2.commentPropName, [{ [options2.textNodeName]: comment }]);
|
|
9934
11618
|
}
|
|
9935
11619
|
i = endIndex;
|
|
9936
|
-
} else if (xmlData.
|
|
11620
|
+
} else if (c1 === 33 && xmlData.charCodeAt(i + 2) === 68) {
|
|
9937
11621
|
const result = docTypeReader.readDocType(xmlData, i);
|
|
9938
|
-
this.
|
|
11622
|
+
this.entityDecoder.addInputEntities(result.entities);
|
|
9939
11623
|
i = result.i;
|
|
9940
|
-
} else if (xmlData.
|
|
11624
|
+
} else if (c1 === 33 && xmlData.charCodeAt(i + 2) === 91) {
|
|
9941
11625
|
const closeIndex = findClosingIndex(xmlData, "]]>", i, "CDATA is not closed.") - 2;
|
|
9942
11626
|
const tagExp = xmlData.substring(i + 9, closeIndex);
|
|
9943
11627
|
textData = this.saveTextToParentTag(textData, currentNode, this.readonlyMatcher);
|
|
9944
11628
|
let val = this.parseTextData(tagExp, currentNode.tagname, this.readonlyMatcher, true, false, true, true);
|
|
9945
11629
|
if (val == void 0) val = "";
|
|
9946
|
-
if (
|
|
9947
|
-
currentNode.add(
|
|
11630
|
+
if (options2.cdataPropName) {
|
|
11631
|
+
currentNode.add(options2.cdataPropName, [{ [options2.textNodeName]: tagExp }]);
|
|
9948
11632
|
} else {
|
|
9949
|
-
currentNode.add(
|
|
11633
|
+
currentNode.add(options2.textNodeName, val);
|
|
9950
11634
|
}
|
|
9951
11635
|
i = closeIndex + 2;
|
|
9952
11636
|
} else {
|
|
9953
|
-
let result = readTagExp(xmlData, i,
|
|
11637
|
+
let result = readTagExp(xmlData, i, options2.removeNSPrefix);
|
|
9954
11638
|
if (!result) {
|
|
9955
|
-
const context = xmlData.substring(Math.max(0, i - 50), Math.min(
|
|
11639
|
+
const context = xmlData.substring(Math.max(0, i - 50), Math.min(xmlLen, i + 50));
|
|
9956
11640
|
throw new Error(`readTagExp returned undefined at position ${i}. Context: "${context}"`);
|
|
9957
11641
|
}
|
|
9958
11642
|
let tagName = result.tagName;
|
|
@@ -9960,8 +11644,8 @@ var parseXml = function(xmlData) {
|
|
|
9960
11644
|
let tagExp = result.tagExp;
|
|
9961
11645
|
let attrExpPresent = result.attrExpPresent;
|
|
9962
11646
|
let closeIndex = result.closeIndex;
|
|
9963
|
-
({ tagName, tagExp } = transformTagName(
|
|
9964
|
-
if (
|
|
11647
|
+
({ tagName, tagExp } = transformTagName(options2.transformTagName, tagName, tagExp, options2));
|
|
11648
|
+
if (options2.strictReservedNames && (tagName === options2.commentPropName || tagName === options2.cdataPropName || tagName === options2.textNodeName || tagName === options2.attributesGroupName)) {
|
|
9965
11649
|
throw new Error(`Invalid tag name: ${tagName}`);
|
|
9966
11650
|
}
|
|
9967
11651
|
if (currentNode && textData) {
|
|
@@ -9970,7 +11654,7 @@ var parseXml = function(xmlData) {
|
|
|
9970
11654
|
}
|
|
9971
11655
|
}
|
|
9972
11656
|
const lastTag = currentNode;
|
|
9973
|
-
if (lastTag &&
|
|
11657
|
+
if (lastTag && options2.unpairedTagsSet.has(lastTag.tagname)) {
|
|
9974
11658
|
currentNode = this.tagsNodeStack.pop();
|
|
9975
11659
|
this.matcher.pop();
|
|
9976
11660
|
}
|
|
@@ -9995,18 +11679,18 @@ var parseXml = function(xmlData) {
|
|
|
9995
11679
|
if (tagName !== tagExp && attrExpPresent) {
|
|
9996
11680
|
prefixedAttrs = this.buildAttributesMap(tagExp, this.matcher, tagName);
|
|
9997
11681
|
if (prefixedAttrs) {
|
|
9998
|
-
rawAttrs = extractRawAttributes(prefixedAttrs,
|
|
11682
|
+
rawAttrs = extractRawAttributes(prefixedAttrs, options2);
|
|
9999
11683
|
}
|
|
10000
11684
|
}
|
|
10001
11685
|
if (tagName !== xmlObj.tagname) {
|
|
10002
|
-
this.isCurrentNodeStopNode = this.isItStopNode(
|
|
11686
|
+
this.isCurrentNodeStopNode = this.isItStopNode();
|
|
10003
11687
|
}
|
|
10004
11688
|
const startIndex = i;
|
|
10005
11689
|
if (this.isCurrentNodeStopNode) {
|
|
10006
11690
|
let tagContent = "";
|
|
10007
11691
|
if (isSelfClosing) {
|
|
10008
11692
|
i = result.closeIndex;
|
|
10009
|
-
} else if (
|
|
11693
|
+
} else if (options2.unpairedTagsSet.has(tagName)) {
|
|
10010
11694
|
i = result.closeIndex;
|
|
10011
11695
|
} else {
|
|
10012
11696
|
const result2 = this.readStopNodeData(xmlData, rawTagName, closeIndex + 1);
|
|
@@ -10018,13 +11702,13 @@ var parseXml = function(xmlData) {
|
|
|
10018
11702
|
if (prefixedAttrs) {
|
|
10019
11703
|
childNode[":@"] = prefixedAttrs;
|
|
10020
11704
|
}
|
|
10021
|
-
childNode.add(
|
|
11705
|
+
childNode.add(options2.textNodeName, tagContent);
|
|
10022
11706
|
this.matcher.pop();
|
|
10023
11707
|
this.isCurrentNodeStopNode = false;
|
|
10024
11708
|
this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
|
|
10025
11709
|
} else {
|
|
10026
11710
|
if (isSelfClosing) {
|
|
10027
|
-
({ tagName, tagExp } = transformTagName(
|
|
11711
|
+
({ tagName, tagExp } = transformTagName(options2.transformTagName, tagName, tagExp, options2));
|
|
10028
11712
|
const childNode = new XmlNode(tagName);
|
|
10029
11713
|
if (prefixedAttrs) {
|
|
10030
11714
|
childNode[":@"] = prefixedAttrs;
|
|
@@ -10032,7 +11716,7 @@ var parseXml = function(xmlData) {
|
|
|
10032
11716
|
this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
|
|
10033
11717
|
this.matcher.pop();
|
|
10034
11718
|
this.isCurrentNodeStopNode = false;
|
|
10035
|
-
} else if (
|
|
11719
|
+
} else if (options2.unpairedTagsSet.has(tagName)) {
|
|
10036
11720
|
const childNode = new XmlNode(tagName);
|
|
10037
11721
|
if (prefixedAttrs) {
|
|
10038
11722
|
childNode[":@"] = prefixedAttrs;
|
|
@@ -10044,7 +11728,7 @@ var parseXml = function(xmlData) {
|
|
|
10044
11728
|
continue;
|
|
10045
11729
|
} else {
|
|
10046
11730
|
const childNode = new XmlNode(tagName);
|
|
10047
|
-
if (this.tagsNodeStack.length >
|
|
11731
|
+
if (this.tagsNodeStack.length > options2.maxNestedTags) {
|
|
10048
11732
|
throw new Error("Maximum nested tags exceeded");
|
|
10049
11733
|
}
|
|
10050
11734
|
this.tagsNodeStack.push(currentNode);
|
|
@@ -10094,60 +11778,7 @@ function replaceEntitiesValue(val, tagName, jPath) {
|
|
|
10094
11778
|
return val;
|
|
10095
11779
|
}
|
|
10096
11780
|
}
|
|
10097
|
-
|
|
10098
|
-
const entity = this.docTypeEntities[entityName];
|
|
10099
|
-
const matches = val.match(entity.regx);
|
|
10100
|
-
if (matches) {
|
|
10101
|
-
this.entityExpansionCount += matches.length;
|
|
10102
|
-
if (entityConfig.maxTotalExpansions && this.entityExpansionCount > entityConfig.maxTotalExpansions) {
|
|
10103
|
-
throw new Error(
|
|
10104
|
-
`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${entityConfig.maxTotalExpansions}`
|
|
10105
|
-
);
|
|
10106
|
-
}
|
|
10107
|
-
const lengthBefore = val.length;
|
|
10108
|
-
val = val.replace(entity.regx, entity.val);
|
|
10109
|
-
if (entityConfig.maxExpandedLength) {
|
|
10110
|
-
this.currentExpandedLength += val.length - lengthBefore;
|
|
10111
|
-
if (this.currentExpandedLength > entityConfig.maxExpandedLength) {
|
|
10112
|
-
throw new Error(
|
|
10113
|
-
`Total expanded content size exceeded: ${this.currentExpandedLength} > ${entityConfig.maxExpandedLength}`
|
|
10114
|
-
);
|
|
10115
|
-
}
|
|
10116
|
-
}
|
|
10117
|
-
}
|
|
10118
|
-
}
|
|
10119
|
-
if (val.indexOf("&") === -1) return val;
|
|
10120
|
-
for (const entityName of Object.keys(this.lastEntities)) {
|
|
10121
|
-
const entity = this.lastEntities[entityName];
|
|
10122
|
-
const matches = val.match(entity.regex);
|
|
10123
|
-
if (matches) {
|
|
10124
|
-
this.entityExpansionCount += matches.length;
|
|
10125
|
-
if (entityConfig.maxTotalExpansions && this.entityExpansionCount > entityConfig.maxTotalExpansions) {
|
|
10126
|
-
throw new Error(
|
|
10127
|
-
`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${entityConfig.maxTotalExpansions}`
|
|
10128
|
-
);
|
|
10129
|
-
}
|
|
10130
|
-
}
|
|
10131
|
-
val = val.replace(entity.regex, entity.val);
|
|
10132
|
-
}
|
|
10133
|
-
if (val.indexOf("&") === -1) return val;
|
|
10134
|
-
if (this.options.htmlEntities) {
|
|
10135
|
-
for (const entityName of Object.keys(this.htmlEntities)) {
|
|
10136
|
-
const entity = this.htmlEntities[entityName];
|
|
10137
|
-
const matches = val.match(entity.regex);
|
|
10138
|
-
if (matches) {
|
|
10139
|
-
this.entityExpansionCount += matches.length;
|
|
10140
|
-
if (entityConfig.maxTotalExpansions && this.entityExpansionCount > entityConfig.maxTotalExpansions) {
|
|
10141
|
-
throw new Error(
|
|
10142
|
-
`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${entityConfig.maxTotalExpansions}`
|
|
10143
|
-
);
|
|
10144
|
-
}
|
|
10145
|
-
}
|
|
10146
|
-
val = val.replace(entity.regex, entity.val);
|
|
10147
|
-
}
|
|
10148
|
-
}
|
|
10149
|
-
val = val.replace(this.ampEntity.regex, this.ampEntity.val);
|
|
10150
|
-
return val;
|
|
11781
|
+
return this.entityDecoder.decode(val);
|
|
10151
11782
|
}
|
|
10152
11783
|
function saveTextToParentTag(textData, parentNode, matcher, isLeafNode) {
|
|
10153
11784
|
if (textData) {
|
|
@@ -10166,42 +11797,37 @@ function saveTextToParentTag(textData, parentNode, matcher, isLeafNode) {
|
|
|
10166
11797
|
}
|
|
10167
11798
|
return textData;
|
|
10168
11799
|
}
|
|
10169
|
-
function isItStopNode(
|
|
10170
|
-
if (
|
|
10171
|
-
|
|
10172
|
-
if (matcher.matches(stopNodeExpressions[i])) {
|
|
10173
|
-
return true;
|
|
10174
|
-
}
|
|
10175
|
-
}
|
|
10176
|
-
return false;
|
|
11800
|
+
function isItStopNode() {
|
|
11801
|
+
if (this.stopNodeExpressionsSet.size === 0) return false;
|
|
11802
|
+
return this.matcher.matchesAny(this.stopNodeExpressionsSet);
|
|
10177
11803
|
}
|
|
10178
11804
|
function tagExpWithClosingIndex(xmlData, i, closingChar = ">") {
|
|
10179
|
-
let attrBoundary;
|
|
10180
|
-
|
|
10181
|
-
|
|
10182
|
-
|
|
11805
|
+
let attrBoundary = 0;
|
|
11806
|
+
const len = xmlData.length;
|
|
11807
|
+
const closeCode0 = closingChar.charCodeAt(0);
|
|
11808
|
+
const closeCode1 = closingChar.length > 1 ? closingChar.charCodeAt(1) : -1;
|
|
11809
|
+
let result = "";
|
|
11810
|
+
let segmentStart = i;
|
|
11811
|
+
for (let index = i; index < len; index++) {
|
|
11812
|
+
const code = xmlData.charCodeAt(index);
|
|
10183
11813
|
if (attrBoundary) {
|
|
10184
|
-
if (
|
|
10185
|
-
} else if (
|
|
10186
|
-
attrBoundary =
|
|
10187
|
-
} else if (
|
|
10188
|
-
if (
|
|
10189
|
-
if (xmlData
|
|
10190
|
-
|
|
10191
|
-
|
|
10192
|
-
index
|
|
10193
|
-
};
|
|
11814
|
+
if (code === attrBoundary) attrBoundary = 0;
|
|
11815
|
+
} else if (code === 34 || code === 39) {
|
|
11816
|
+
attrBoundary = code;
|
|
11817
|
+
} else if (code === closeCode0) {
|
|
11818
|
+
if (closeCode1 !== -1) {
|
|
11819
|
+
if (xmlData.charCodeAt(index + 1) === closeCode1) {
|
|
11820
|
+
result += xmlData.substring(segmentStart, index);
|
|
11821
|
+
return { data: result, index };
|
|
10194
11822
|
}
|
|
10195
11823
|
} else {
|
|
10196
|
-
|
|
10197
|
-
|
|
10198
|
-
index
|
|
10199
|
-
};
|
|
11824
|
+
result += xmlData.substring(segmentStart, index);
|
|
11825
|
+
return { data: result, index };
|
|
10200
11826
|
}
|
|
10201
|
-
} else if (
|
|
10202
|
-
|
|
11827
|
+
} else if (code === 9 && !attrBoundary) {
|
|
11828
|
+
result += xmlData.substring(segmentStart, index) + " ";
|
|
11829
|
+
segmentStart = index + 1;
|
|
10203
11830
|
}
|
|
10204
|
-
tagExp += ch;
|
|
10205
11831
|
}
|
|
10206
11832
|
}
|
|
10207
11833
|
function findClosingIndex(xmlData, str, i, errMsg) {
|
|
@@ -10212,6 +11838,11 @@ function findClosingIndex(xmlData, str, i, errMsg) {
|
|
|
10212
11838
|
return closingIndex + str.length - 1;
|
|
10213
11839
|
}
|
|
10214
11840
|
}
|
|
11841
|
+
function findClosingChar(xmlData, char, i, errMsg) {
|
|
11842
|
+
const closingIndex = xmlData.indexOf(char, i);
|
|
11843
|
+
if (closingIndex === -1) throw new Error(errMsg);
|
|
11844
|
+
return closingIndex;
|
|
11845
|
+
}
|
|
10215
11846
|
function readTagExp(xmlData, i, removeNSPrefix, closingChar = ">") {
|
|
10216
11847
|
const result = tagExpWithClosingIndex(xmlData, i + 1, closingChar);
|
|
10217
11848
|
if (!result) return;
|
|
@@ -10243,10 +11874,12 @@ function readTagExp(xmlData, i, removeNSPrefix, closingChar = ">") {
|
|
|
10243
11874
|
function readStopNodeData(xmlData, tagName, i) {
|
|
10244
11875
|
const startIndex = i;
|
|
10245
11876
|
let openTagCount = 1;
|
|
10246
|
-
|
|
11877
|
+
const xmllen = xmlData.length;
|
|
11878
|
+
for (; i < xmllen; i++) {
|
|
10247
11879
|
if (xmlData[i] === "<") {
|
|
10248
|
-
|
|
10249
|
-
|
|
11880
|
+
const c1 = xmlData.charCodeAt(i + 1);
|
|
11881
|
+
if (c1 === 47) {
|
|
11882
|
+
const closeIndex = findClosingChar(xmlData, ">", i, `${tagName} is not closed`);
|
|
10250
11883
|
let closeTagName = xmlData.substring(i + 2, closeIndex).trim();
|
|
10251
11884
|
if (closeTagName === tagName) {
|
|
10252
11885
|
openTagCount--;
|
|
@@ -10258,13 +11891,13 @@ function readStopNodeData(xmlData, tagName, i) {
|
|
|
10258
11891
|
}
|
|
10259
11892
|
}
|
|
10260
11893
|
i = closeIndex;
|
|
10261
|
-
} else if (
|
|
11894
|
+
} else if (c1 === 63) {
|
|
10262
11895
|
const closeIndex = findClosingIndex(xmlData, "?>", i + 1, "StopNode is not closed.");
|
|
10263
11896
|
i = closeIndex;
|
|
10264
|
-
} else if (xmlData.
|
|
11897
|
+
} else if (c1 === 33 && xmlData.charCodeAt(i + 2) === 45 && xmlData.charCodeAt(i + 3) === 45) {
|
|
10265
11898
|
const closeIndex = findClosingIndex(xmlData, "-->", i + 3, "StopNode is not closed.");
|
|
10266
11899
|
i = closeIndex;
|
|
10267
|
-
} else if (xmlData.
|
|
11900
|
+
} else if (c1 === 33 && xmlData.charCodeAt(i + 2) === 91) {
|
|
10268
11901
|
const closeIndex = findClosingIndex(xmlData, "]]>", i, "StopNode is not closed.") - 2;
|
|
10269
11902
|
i = closeIndex;
|
|
10270
11903
|
} else {
|
|
@@ -10294,14 +11927,6 @@ function parseValue(val, shouldParse, options2) {
|
|
|
10294
11927
|
}
|
|
10295
11928
|
}
|
|
10296
11929
|
}
|
|
10297
|
-
function fromCodePoint(str, base, prefix) {
|
|
10298
|
-
const codePoint = Number.parseInt(str, base);
|
|
10299
|
-
if (codePoint >= 0 && codePoint <= 1114111) {
|
|
10300
|
-
return String.fromCodePoint(codePoint);
|
|
10301
|
-
} else {
|
|
10302
|
-
return prefix + str + ";";
|
|
10303
|
-
}
|
|
10304
|
-
}
|
|
10305
11930
|
function transformTagName(fn, tagName, tagExp, options2) {
|
|
10306
11931
|
if (fn) {
|
|
10307
11932
|
const newTagName = fn(tagName);
|
|
@@ -10322,7 +11947,7 @@ function sanitizeName(name, options2) {
|
|
|
10322
11947
|
return name;
|
|
10323
11948
|
}
|
|
10324
11949
|
|
|
10325
|
-
// ../../.yarn/cache/fast-xml-parser-npm-5.
|
|
11950
|
+
// ../../.yarn/cache/fast-xml-parser-npm-5.7.2-960de42682-7f32d77127.zip/node_modules/fast-xml-parser/src/xmlparser/node2json.js
|
|
10326
11951
|
var METADATA_SYMBOL2 = XmlNode.getMetaDataSymbol();
|
|
10327
11952
|
function stripAttributePrefix(attrs, prefix) {
|
|
10328
11953
|
if (!attrs || typeof attrs !== "object") return {};
|
|
@@ -10431,7 +12056,7 @@ function isLeafTag(obj, options2) {
|
|
|
10431
12056
|
return false;
|
|
10432
12057
|
}
|
|
10433
12058
|
|
|
10434
|
-
// ../../.yarn/cache/fast-xml-parser-npm-5.
|
|
12059
|
+
// ../../.yarn/cache/fast-xml-parser-npm-5.7.2-960de42682-7f32d77127.zip/node_modules/fast-xml-parser/src/xmlparser/XMLParser.js
|
|
10435
12060
|
var XMLParser = class {
|
|
10436
12061
|
constructor(options2) {
|
|
10437
12062
|
this.externalEntities = {};
|
|
@@ -10455,8 +12080,7 @@ var XMLParser = class {
|
|
|
10455
12080
|
throw Error(`${result.err.msg}:${result.err.line}:${result.err.col}`);
|
|
10456
12081
|
}
|
|
10457
12082
|
}
|
|
10458
|
-
const orderedObjParser = new OrderedObjParser(this.options);
|
|
10459
|
-
orderedObjParser.addExternalEntities(this.externalEntities);
|
|
12083
|
+
const orderedObjParser = new OrderedObjParser(this.options, this.externalEntities);
|
|
10460
12084
|
const orderedResult = orderedObjParser.parseXml(xmlData);
|
|
10461
12085
|
if (this.options.preserveOrder || orderedResult === void 0) return orderedResult;
|
|
10462
12086
|
else return prettify(orderedResult, this.options, orderedObjParser.matcher, orderedObjParser.readonlyMatcher);
|
|
@@ -11113,13 +12737,22 @@ var DependencyManager = class _DependencyManager {
|
|
|
11113
12737
|
return this.config.noNamespace ? `import type * as ${namespace} from '${importPath}'` : `import type ${namespace} from '${importPath}';`;
|
|
11114
12738
|
}
|
|
11115
12739
|
createPackageJsonImport(importPath, libraryVersion) {
|
|
12740
|
+
const pinnedVersion = libraryVersion ? `${libraryVersion.toString()}-${APP_VERSION}` : APP_VERSION;
|
|
12741
|
+
const format = this.config.depVersionFormat ?? (this.config.workspace ? "workspace" : "exact");
|
|
11116
12742
|
let depVersion;
|
|
11117
|
-
|
|
11118
|
-
|
|
11119
|
-
|
|
11120
|
-
|
|
11121
|
-
|
|
11122
|
-
|
|
12743
|
+
switch (format) {
|
|
12744
|
+
case "workspace":
|
|
12745
|
+
depVersion = "workspace:^";
|
|
12746
|
+
break;
|
|
12747
|
+
case "caret":
|
|
12748
|
+
depVersion = `^${pinnedVersion}`;
|
|
12749
|
+
break;
|
|
12750
|
+
case "any":
|
|
12751
|
+
depVersion = "*";
|
|
12752
|
+
break;
|
|
12753
|
+
default:
|
|
12754
|
+
depVersion = pinnedVersion;
|
|
12755
|
+
break;
|
|
11123
12756
|
}
|
|
11124
12757
|
return `"${importPath}": "${depVersion}"`;
|
|
11125
12758
|
}
|
|
@@ -15202,16 +16835,16 @@ function transformBacktickTypeRefs(text, ctx) {
|
|
|
15202
16835
|
});
|
|
15203
16836
|
return text;
|
|
15204
16837
|
}
|
|
15205
|
-
function transformGirDocHighlights(
|
|
15206
|
-
return
|
|
16838
|
+
function transformGirDocHighlights(description8) {
|
|
16839
|
+
return description8.replace(/(?<!\{)(?<!\w)@([A-Za-z_][A-Za-z0-9_]*)/g, "`$1`");
|
|
15207
16840
|
}
|
|
15208
|
-
function transformGirDocCodeBlocks(
|
|
15209
|
-
|
|
16841
|
+
function transformGirDocCodeBlocks(description8) {
|
|
16842
|
+
description8 = description8.replaceAll(/```\s*\{\s*\.(\w+)[^}]*\}/gm, "```$1").replaceAll(/\|\[<!-- language="([^"]+)" -->/gm, (_match, lang) => {
|
|
15210
16843
|
if (lang === "plain" || lang === "text") return "\n```";
|
|
15211
16844
|
return `
|
|
15212
16845
|
\`\`\`${lang.toLowerCase()}`;
|
|
15213
16846
|
}).replaceAll(/\|\[/gm, "\n```").replaceAll(/\]\|/gm, "```\n");
|
|
15214
|
-
return
|
|
16847
|
+
return description8;
|
|
15215
16848
|
}
|
|
15216
16849
|
|
|
15217
16850
|
// ../lib/src/utils/objects.ts
|
|
@@ -19505,6 +21138,11 @@ var options = {
|
|
|
19505
21138
|
default: defaults.workspace,
|
|
19506
21139
|
normalize: true
|
|
19507
21140
|
},
|
|
21141
|
+
depVersionFormat: {
|
|
21142
|
+
type: "string",
|
|
21143
|
+
description: "Dependency version spec format in generated package.json files. Defaults to 'workspace' when --workspace, else 'exact'",
|
|
21144
|
+
choices: ["workspace", "caret", "any", "exact"]
|
|
21145
|
+
},
|
|
19508
21146
|
onlyVersionPrefix: {
|
|
19509
21147
|
type: "boolean",
|
|
19510
21148
|
description: "Only use the version prefix for the ambient module exports. This is useful if, for whatever reason, you want to use different library versions of the same library in your project.",
|
|
@@ -19557,6 +21195,7 @@ var generateOptions = {
|
|
|
19557
21195
|
promisify: options.promisify,
|
|
19558
21196
|
npmScope: options.npmScope,
|
|
19559
21197
|
workspace: options.workspace,
|
|
21198
|
+
depVersionFormat: options.depVersionFormat,
|
|
19560
21199
|
onlyVersionPrefix: options.onlyVersionPrefix,
|
|
19561
21200
|
noPrettyPrint: options.noPrettyPrint,
|
|
19562
21201
|
noAdvancedVariants: options.noAdvancedVariants,
|
|
@@ -19612,6 +21251,25 @@ var docOptions = {
|
|
|
19612
21251
|
description: "Directory containing pre-generated TypeDoc JSON files for merge mode (from 'ts-for-gir json')"
|
|
19613
21252
|
}
|
|
19614
21253
|
};
|
|
21254
|
+
var createOptions = {
|
|
21255
|
+
template: {
|
|
21256
|
+
type: "string",
|
|
21257
|
+
alias: "t",
|
|
21258
|
+
description: "Template to scaffold (types-locally, types-npm, types-workspace)",
|
|
21259
|
+
choices: ["types-locally", "types-npm", "types-workspace"]
|
|
21260
|
+
},
|
|
21261
|
+
install: {
|
|
21262
|
+
type: "boolean",
|
|
21263
|
+
description: "Run npm install after scaffolding (use --no-install to skip)",
|
|
21264
|
+
default: true
|
|
21265
|
+
},
|
|
21266
|
+
force: {
|
|
21267
|
+
type: "boolean",
|
|
21268
|
+
description: "Allow scaffolding into a non-empty target directory",
|
|
21269
|
+
default: false
|
|
21270
|
+
},
|
|
21271
|
+
verbose: options.verbose
|
|
21272
|
+
};
|
|
19615
21273
|
var analyzeOptions = {
|
|
19616
21274
|
reportFile: {
|
|
19617
21275
|
type: "string",
|
|
@@ -19778,6 +21436,7 @@ async function load(cliOptions) {
|
|
|
19778
21436
|
const stringKeys = [
|
|
19779
21437
|
["npmScope", options.npmScope.default],
|
|
19780
21438
|
["reporterOutput", options.reporterOutput.default],
|
|
21439
|
+
["depVersionFormat", void 0],
|
|
19781
21440
|
["theme", docOptions.theme.default],
|
|
19782
21441
|
["sourceLinkTemplate", void 0],
|
|
19783
21442
|
["readme", void 0],
|
|
@@ -19816,13 +21475,13 @@ async function load(cliOptions) {
|
|
|
19816
21475
|
}
|
|
19817
21476
|
|
|
19818
21477
|
// src/commands/command-builder.ts
|
|
19819
|
-
function createBuilder(options2,
|
|
21478
|
+
function createBuilder(options2, examples8) {
|
|
19820
21479
|
return (yargs2) => {
|
|
19821
21480
|
const optionNames = Object.keys(options2);
|
|
19822
21481
|
for (const optionName of optionNames) {
|
|
19823
21482
|
yargs2 = yargs2.option(optionName, options2[optionName]);
|
|
19824
21483
|
}
|
|
19825
|
-
return yargs2.example(
|
|
21484
|
+
return yargs2.example(examples8);
|
|
19826
21485
|
};
|
|
19827
21486
|
}
|
|
19828
21487
|
|
|
@@ -20643,9 +22302,184 @@ var copy = {
|
|
|
20643
22302
|
examples: examples2
|
|
20644
22303
|
};
|
|
20645
22304
|
|
|
22305
|
+
// src/commands/create.ts
|
|
22306
|
+
import { spawnSync } from "node:child_process";
|
|
22307
|
+
import { cpSync, existsSync as existsSync3, mkdirSync, readdirSync, readFileSync as readFileSync4, writeFileSync as writeFileSync2 } from "node:fs";
|
|
22308
|
+
import { dirname as dirname6, join as join9, resolve as resolve5 } from "node:path";
|
|
22309
|
+
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
22310
|
+
import { input, select as select2 } from "@inquirer/prompts";
|
|
22311
|
+
var command3 = "create [name]";
|
|
22312
|
+
var description3 = "Scaffold a new GJS TypeScript project from a template";
|
|
22313
|
+
var examples3 = [
|
|
22314
|
+
[`${APP_NAME} create my-app --template types-npm`, "Scaffold using the @girs/* NPM types"],
|
|
22315
|
+
[`${APP_NAME} create my-app --template types-locally`, "Scaffold and generate types into ./@types/ locally"],
|
|
22316
|
+
[
|
|
22317
|
+
`${APP_NAME} create my-app --template types-workspace`,
|
|
22318
|
+
"Scaffold an npm workspace with types as workspace packages"
|
|
22319
|
+
],
|
|
22320
|
+
[`${APP_NAME} create`, "Interactive: prompts for name and template"]
|
|
22321
|
+
];
|
|
22322
|
+
var TEMPLATE_CHOICES = [
|
|
22323
|
+
{
|
|
22324
|
+
value: "types-locally",
|
|
22325
|
+
name: "types-locally",
|
|
22326
|
+
description: "Generate GIR types directly into ./@types/ (no package format, no @girs/* deps)"
|
|
22327
|
+
},
|
|
22328
|
+
{
|
|
22329
|
+
value: "types-npm",
|
|
22330
|
+
name: "types-npm",
|
|
22331
|
+
description: "Use pre-generated types from the @girs/* NPM packages"
|
|
22332
|
+
},
|
|
22333
|
+
{
|
|
22334
|
+
value: "types-workspace",
|
|
22335
|
+
name: "types-workspace",
|
|
22336
|
+
description: "npm workspace; generate @girs/* as workspace packages under ./@girs/"
|
|
22337
|
+
}
|
|
22338
|
+
];
|
|
22339
|
+
var PROJECT_NAME_PLACEHOLDER = "__PROJECT_NAME__";
|
|
22340
|
+
var TEXT_FILE_EXT = /* @__PURE__ */ new Set([".json", ".md", ".ts", ".tsx", ".js", ".mjs", ".cjs"]);
|
|
22341
|
+
var builder3 = createBuilder(createOptions, examples3);
|
|
22342
|
+
function findTemplatesRoot() {
|
|
22343
|
+
const __filename2 = fileURLToPath4(import.meta.url);
|
|
22344
|
+
const __dirname3 = dirname6(__filename2);
|
|
22345
|
+
const candidates = [
|
|
22346
|
+
// Bundled production binary (bin/ts-for-gir): ../dist-templates
|
|
22347
|
+
resolve5(__dirname3, "..", "dist-templates"),
|
|
22348
|
+
// Source layout (src/commands/create.ts): ../../dist-templates then ../../templates
|
|
22349
|
+
resolve5(__dirname3, "..", "..", "dist-templates"),
|
|
22350
|
+
resolve5(__dirname3, "..", "..", "templates")
|
|
22351
|
+
];
|
|
22352
|
+
for (const path of candidates) {
|
|
22353
|
+
if (existsSync3(path)) return path;
|
|
22354
|
+
}
|
|
22355
|
+
throw new Error(
|
|
22356
|
+
`Could not locate templates directory. Looked in:
|
|
22357
|
+
${candidates.join("\n ")}
|
|
22358
|
+
If you are running from source, make sure packages/cli/templates/ exists. If you are running the published CLI, make sure dist-templates/ was packed.`
|
|
22359
|
+
);
|
|
22360
|
+
}
|
|
22361
|
+
function listTemplates(templatesRoot) {
|
|
22362
|
+
const knownIds = TEMPLATE_CHOICES.map((c) => c.value);
|
|
22363
|
+
return readdirSync(templatesRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).filter((name) => knownIds.includes(name));
|
|
22364
|
+
}
|
|
22365
|
+
function sanitizeProjectName(raw) {
|
|
22366
|
+
const trimmed = raw.trim();
|
|
22367
|
+
if (!trimmed) throw new Error("Project name cannot be empty");
|
|
22368
|
+
const cleaned = trimmed.toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^[._-]+/, "").replace(/[._-]+$/, "");
|
|
22369
|
+
if (!cleaned) throw new Error(`"${raw}" is not a valid npm package name`);
|
|
22370
|
+
return cleaned;
|
|
22371
|
+
}
|
|
22372
|
+
function isDirEmpty(path) {
|
|
22373
|
+
if (!existsSync3(path)) return true;
|
|
22374
|
+
return readdirSync(path).length === 0;
|
|
22375
|
+
}
|
|
22376
|
+
function substituteInFile(filePath, projectName) {
|
|
22377
|
+
const content = readFileSync4(filePath, "utf8");
|
|
22378
|
+
if (!content.includes(PROJECT_NAME_PLACEHOLDER)) return;
|
|
22379
|
+
writeFileSync2(filePath, content.replaceAll(PROJECT_NAME_PLACEHOLDER, projectName));
|
|
22380
|
+
}
|
|
22381
|
+
function walkAndSubstitute(rootDir, projectName) {
|
|
22382
|
+
for (const entry of readdirSync(rootDir, { withFileTypes: true })) {
|
|
22383
|
+
const full = join9(rootDir, entry.name);
|
|
22384
|
+
if (entry.isDirectory()) {
|
|
22385
|
+
if (entry.name === "node_modules") continue;
|
|
22386
|
+
walkAndSubstitute(full, projectName);
|
|
22387
|
+
continue;
|
|
22388
|
+
}
|
|
22389
|
+
if (!entry.isFile()) continue;
|
|
22390
|
+
const ext = entry.name.slice(entry.name.lastIndexOf("."));
|
|
22391
|
+
if (!TEXT_FILE_EXT.has(ext)) continue;
|
|
22392
|
+
substituteInFile(full, projectName);
|
|
22393
|
+
}
|
|
22394
|
+
}
|
|
22395
|
+
var handler3 = async (args) => {
|
|
22396
|
+
const opts = args;
|
|
22397
|
+
const log3 = new Logger(opts.verbose ?? false, "CreateCommand");
|
|
22398
|
+
const templatesRoot = findTemplatesRoot();
|
|
22399
|
+
const available = listTemplates(templatesRoot);
|
|
22400
|
+
if (available.length === 0) {
|
|
22401
|
+
throw new Error(`No templates found in ${templatesRoot}`);
|
|
22402
|
+
}
|
|
22403
|
+
let template2 = opts.template;
|
|
22404
|
+
if (template2 && !available.includes(template2)) {
|
|
22405
|
+
throw new Error(`Unknown template "${template2}". Available: ${available.join(", ")}`);
|
|
22406
|
+
}
|
|
22407
|
+
if (!template2) {
|
|
22408
|
+
if (!process.stdin.isTTY) {
|
|
22409
|
+
throw new Error(`--template is required (non-TTY). Available: ${available.join(", ")}`);
|
|
22410
|
+
}
|
|
22411
|
+
template2 = await select2({
|
|
22412
|
+
message: "Choose a template:",
|
|
22413
|
+
choices: TEMPLATE_CHOICES.filter((c) => available.includes(c.value)).map((c) => ({
|
|
22414
|
+
value: c.value,
|
|
22415
|
+
name: c.name,
|
|
22416
|
+
description: c.description
|
|
22417
|
+
}))
|
|
22418
|
+
});
|
|
22419
|
+
}
|
|
22420
|
+
let nameRaw = opts.name;
|
|
22421
|
+
if (!nameRaw) {
|
|
22422
|
+
if (!process.stdin.isTTY) {
|
|
22423
|
+
throw new Error("Project name is required (non-TTY). Pass it as the first positional argument.");
|
|
22424
|
+
}
|
|
22425
|
+
nameRaw = await input({
|
|
22426
|
+
message: "Project name:",
|
|
22427
|
+
default: "my-gjs-app",
|
|
22428
|
+
validate: (v) => v.trim().length > 0 ? true : "Project name cannot be empty"
|
|
22429
|
+
});
|
|
22430
|
+
}
|
|
22431
|
+
const projectName = sanitizeProjectName(nameRaw);
|
|
22432
|
+
const targetDir = resolve5(process.cwd(), projectName);
|
|
22433
|
+
if (existsSync3(targetDir) && !isDirEmpty(targetDir) && !opts.force) {
|
|
22434
|
+
throw new Error(
|
|
22435
|
+
`Target directory ${targetDir} exists and is not empty. Use --force to scaffold into a non-empty directory.`
|
|
22436
|
+
);
|
|
22437
|
+
}
|
|
22438
|
+
mkdirSync(targetDir, { recursive: true });
|
|
22439
|
+
const templateDir = join9(templatesRoot, template2);
|
|
22440
|
+
cpSync(templateDir, targetDir, { recursive: true });
|
|
22441
|
+
walkAndSubstitute(targetDir, projectName);
|
|
22442
|
+
log3.success(`Scaffolded ${template2} into ${targetDir}`);
|
|
22443
|
+
if (opts.install) {
|
|
22444
|
+
log3.info("Running npm install...");
|
|
22445
|
+
const result = spawnSync("npm", ["install", "--no-audit", "--no-fund"], {
|
|
22446
|
+
cwd: targetDir,
|
|
22447
|
+
stdio: "inherit"
|
|
22448
|
+
});
|
|
22449
|
+
if (result.status !== 0) {
|
|
22450
|
+
log3.warn("npm install failed; you can re-run it manually in the project directory.");
|
|
22451
|
+
}
|
|
22452
|
+
}
|
|
22453
|
+
log3.info("\nNext steps:");
|
|
22454
|
+
log3.white(` cd ${projectName}`);
|
|
22455
|
+
if (!opts.install) log3.white(" npm install");
|
|
22456
|
+
switch (template2) {
|
|
22457
|
+
case "types-locally":
|
|
22458
|
+
log3.white(" npm run generate");
|
|
22459
|
+
log3.white(" npm run check:types");
|
|
22460
|
+
log3.white(" npm run build && npm start");
|
|
22461
|
+
break;
|
|
22462
|
+
case "types-npm":
|
|
22463
|
+
log3.white(" npm run check");
|
|
22464
|
+
log3.white(" npm run build && npm start");
|
|
22465
|
+
break;
|
|
22466
|
+
case "types-workspace":
|
|
22467
|
+
log3.white(" npm run build:types && npm install");
|
|
22468
|
+
log3.white(" npm run build:app && npm start");
|
|
22469
|
+
break;
|
|
22470
|
+
}
|
|
22471
|
+
};
|
|
22472
|
+
var create = {
|
|
22473
|
+
command: command3,
|
|
22474
|
+
description: description3,
|
|
22475
|
+
builder: builder3,
|
|
22476
|
+
handler: handler3,
|
|
22477
|
+
examples: examples3
|
|
22478
|
+
};
|
|
22479
|
+
|
|
20646
22480
|
// ../generator-html-doc/src/html-doc-generator.ts
|
|
20647
22481
|
import { mkdir as mkdir4 } from "node:fs/promises";
|
|
20648
|
-
import { join as
|
|
22482
|
+
import { join as join16 } from "node:path";
|
|
20649
22483
|
|
|
20650
22484
|
// ../generator-json/src/gir-metadata-deserializer.ts
|
|
20651
22485
|
import { DeclarationReflection } from "typedoc";
|
|
@@ -20671,16 +22505,16 @@ var GirMetadataDeserializer = class {
|
|
|
20671
22505
|
|
|
20672
22506
|
// ../generator-json/src/json-definition-generator.ts
|
|
20673
22507
|
import { mkdir as mkdir3, writeFile as writeFile5 } from "node:fs/promises";
|
|
20674
|
-
import { join as
|
|
22508
|
+
import { join as join12 } from "node:path";
|
|
20675
22509
|
|
|
20676
22510
|
// ../generator-json/src/typedoc-pipeline.ts
|
|
20677
|
-
import { readFileSync as
|
|
22511
|
+
import { readFileSync as readFileSync5 } from "node:fs";
|
|
20678
22512
|
import { mkdtemp, rm } from "node:fs/promises";
|
|
20679
22513
|
import { tmpdir } from "node:os";
|
|
20680
|
-
import { join as
|
|
22514
|
+
import { join as join11 } from "node:path";
|
|
20681
22515
|
|
|
20682
22516
|
// ../generator-typescript/src/template-processor.ts
|
|
20683
|
-
import { dirname as
|
|
22517
|
+
import { dirname as dirname7, join as join10, relative } from "node:path";
|
|
20684
22518
|
var TemplateProcessor = class extends TemplateEngine {
|
|
20685
22519
|
data;
|
|
20686
22520
|
packageName;
|
|
@@ -20710,8 +22544,8 @@ var TemplateProcessor = class extends TemplateEngine {
|
|
|
20710
22544
|
dep,
|
|
20711
22545
|
deps,
|
|
20712
22546
|
typeDir,
|
|
20713
|
-
join:
|
|
20714
|
-
dirname:
|
|
22547
|
+
join: join10,
|
|
22548
|
+
dirname: dirname7,
|
|
20715
22549
|
...this.config,
|
|
20716
22550
|
packageName: this.packageName
|
|
20717
22551
|
};
|
|
@@ -20781,10 +22615,10 @@ ${append}`;
|
|
|
20781
22615
|
const rendered = await this.loadAll(templateDirname, fileExtension, ejsOptions, overrideTemplateData);
|
|
20782
22616
|
const result = {};
|
|
20783
22617
|
for (const filename of Object.keys(rendered)) {
|
|
20784
|
-
const destPath =
|
|
22618
|
+
const destPath = join10(baseOutputPath, outputDirname, filename);
|
|
20785
22619
|
result[destPath] = `${rendered[filename]}
|
|
20786
22620
|
${append}`;
|
|
20787
|
-
await this.write(result[destPath], baseOutputPath,
|
|
22621
|
+
await this.write(result[destPath], baseOutputPath, join10(outputDirname, filename));
|
|
20788
22622
|
}
|
|
20789
22623
|
return result;
|
|
20790
22624
|
}
|
|
@@ -20793,8 +22627,8 @@ ${append}`;
|
|
|
20793
22627
|
* This is TypeScript-specific logic for handling package.json mode
|
|
20794
22628
|
*/
|
|
20795
22629
|
getOutputPath(baseOutputPath, outputFilename) {
|
|
20796
|
-
const filePath = this.config.package ?
|
|
20797
|
-
const outputPath =
|
|
22630
|
+
const filePath = this.config.package ? join10(this.data?.importName || this.packageName, outputFilename) : outputFilename;
|
|
22631
|
+
const outputPath = join10(baseOutputPath, filePath);
|
|
20798
22632
|
return outputPath;
|
|
20799
22633
|
}
|
|
20800
22634
|
/**
|
|
@@ -24053,9 +25887,9 @@ var GirMetadataSerializer = class _GirMetadataSerializer {
|
|
|
24053
25887
|
[IntrospectedAlias, (s, o) => s.buildBaseMetadata(o, "alias")]
|
|
24054
25888
|
];
|
|
24055
25889
|
buildMetadata(girObj) {
|
|
24056
|
-
for (const [ctor,
|
|
25890
|
+
for (const [ctor, handler8] of _GirMetadataSerializer.METADATA_DISPATCH) {
|
|
24057
25891
|
if (girObj instanceof ctor) {
|
|
24058
|
-
return
|
|
25892
|
+
return handler8(this, girObj);
|
|
24059
25893
|
}
|
|
24060
25894
|
}
|
|
24061
25895
|
return null;
|
|
@@ -24180,7 +26014,7 @@ var TypeDocPipeline = class {
|
|
|
24180
26014
|
return this._modules;
|
|
24181
26015
|
}
|
|
24182
26016
|
async start() {
|
|
24183
|
-
this.tempDir = await mkdtemp(
|
|
26017
|
+
this.tempDir = await mkdtemp(join11(tmpdir(), "ts-for-gir-typedoc-"));
|
|
24184
26018
|
const tempConfig = {
|
|
24185
26019
|
...this.config,
|
|
24186
26020
|
outdir: this.tempDir,
|
|
@@ -24207,10 +26041,10 @@ var TypeDocPipeline = class {
|
|
|
24207
26041
|
* convert to ProjectReflection, and enrich with GIR metadata.
|
|
24208
26042
|
*/
|
|
24209
26043
|
async createTypeDocApp(module) {
|
|
24210
|
-
const moduleDir =
|
|
24211
|
-
const entryPoint =
|
|
24212
|
-
const tsconfigPath =
|
|
24213
|
-
const readmePath =
|
|
26044
|
+
const moduleDir = join11(this.tempDir, module.importName);
|
|
26045
|
+
const entryPoint = join11(moduleDir, `${module.importName}.d.ts`);
|
|
26046
|
+
const tsconfigPath = join11(moduleDir, "tsconfig.json");
|
|
26047
|
+
const readmePath = join11(moduleDir, "README.md");
|
|
24214
26048
|
const result = await this.bootstrapAndConvert(
|
|
24215
26049
|
{
|
|
24216
26050
|
entryPoints: [entryPoint],
|
|
@@ -24236,13 +26070,13 @@ var TypeDocPipeline = class {
|
|
|
24236
26070
|
* Useful for TypeDoc's `projectToObject()` base path.
|
|
24237
26071
|
*/
|
|
24238
26072
|
getModuleDir(module) {
|
|
24239
|
-
return normalizePath(
|
|
26073
|
+
return normalizePath(join11(this.tempDir, module.importName));
|
|
24240
26074
|
}
|
|
24241
26075
|
/**
|
|
24242
26076
|
* Get the normalized path to the GJS package temporary directory.
|
|
24243
26077
|
*/
|
|
24244
26078
|
getGjsDir() {
|
|
24245
|
-
return normalizePath(
|
|
26079
|
+
return normalizePath(join11(this.tempDir, "gjs"));
|
|
24246
26080
|
}
|
|
24247
26081
|
/**
|
|
24248
26082
|
* Bootstrap a TypeDoc Application for the GJS core types package.
|
|
@@ -24255,16 +26089,16 @@ var TypeDocPipeline = class {
|
|
|
24255
26089
|
* Returns null if the GJS package was not generated (e.g. temp dir missing).
|
|
24256
26090
|
*/
|
|
24257
26091
|
async createGjsTypeDocApp() {
|
|
24258
|
-
const gjsDir =
|
|
24259
|
-
const tsconfigPath =
|
|
24260
|
-
const readmePath =
|
|
26092
|
+
const gjsDir = join11(this.tempDir, "gjs");
|
|
26093
|
+
const tsconfigPath = join11(gjsDir, "tsconfig.json");
|
|
26094
|
+
const readmePath = join11(gjsDir, "README.md");
|
|
24261
26095
|
const entryPoints = [
|
|
24262
|
-
|
|
24263
|
-
|
|
24264
|
-
|
|
24265
|
-
|
|
24266
|
-
|
|
24267
|
-
|
|
26096
|
+
join11(gjsDir, "gjs.d.ts"),
|
|
26097
|
+
join11(gjsDir, "cairo.d.ts"),
|
|
26098
|
+
join11(gjsDir, "gettext.d.ts"),
|
|
26099
|
+
join11(gjsDir, "system.d.ts"),
|
|
26100
|
+
join11(gjsDir, "dom.d.ts"),
|
|
26101
|
+
join11(gjsDir, "console.d.ts")
|
|
24268
26102
|
];
|
|
24269
26103
|
try {
|
|
24270
26104
|
const result = await this.bootstrapAndConvert(
|
|
@@ -24293,7 +26127,7 @@ var TypeDocPipeline = class {
|
|
|
24293
26127
|
async createCombinedTypeDocApp() {
|
|
24294
26128
|
const result = await this.bootstrapAndConvert(
|
|
24295
26129
|
{
|
|
24296
|
-
entryPoints: [
|
|
26130
|
+
entryPoints: [join11(this.tempDir, "*")],
|
|
24297
26131
|
entryPointStrategy: "packages",
|
|
24298
26132
|
name: "TypeScript API Documentation for GJS",
|
|
24299
26133
|
...this.sourceLinkOptions,
|
|
@@ -24319,7 +26153,7 @@ var TypeDocPipeline = class {
|
|
|
24319
26153
|
async createMergedTypeDocApp(jsonDir) {
|
|
24320
26154
|
const app = await this.bootstrapApp(
|
|
24321
26155
|
{
|
|
24322
|
-
entryPoints: [
|
|
26156
|
+
entryPoints: [join11(jsonDir, "*.json")],
|
|
24323
26157
|
entryPointStrategy: "merge",
|
|
24324
26158
|
name: "TypeScript API Documentation for GJS"
|
|
24325
26159
|
},
|
|
@@ -24688,7 +26522,7 @@ var TypeDocPipeline = class {
|
|
|
24688
26522
|
/** Try to read the generated package.json for a module from the temp directory. */
|
|
24689
26523
|
readPackageJson(importName) {
|
|
24690
26524
|
try {
|
|
24691
|
-
const content =
|
|
26525
|
+
const content = readFileSync5(join11(this.tempDir, importName, "package.json"), "utf8");
|
|
24692
26526
|
return JSON.parse(content);
|
|
24693
26527
|
} catch {
|
|
24694
26528
|
return null;
|
|
@@ -24755,7 +26589,7 @@ var JsonDefinitionGenerator = class _JsonDefinitionGenerator {
|
|
|
24755
26589
|
const jsonStr = `${JSON.stringify(jsonOutput, null, pretty ? " " : "")}
|
|
24756
26590
|
`;
|
|
24757
26591
|
if (this.config.outdir) {
|
|
24758
|
-
const filepath =
|
|
26592
|
+
const filepath = join12(this.config.outdir, "Gjs.json");
|
|
24759
26593
|
await writeFile5(filepath, jsonStr, "utf8");
|
|
24760
26594
|
this.log.info(`Generated ${filepath}`);
|
|
24761
26595
|
} else {
|
|
@@ -24770,7 +26604,7 @@ var JsonDefinitionGenerator = class _JsonDefinitionGenerator {
|
|
|
24770
26604
|
const jsonStr = `${JSON.stringify(jsonOutput, null, pretty ? " " : "")}
|
|
24771
26605
|
`;
|
|
24772
26606
|
if (this.config.outdir) {
|
|
24773
|
-
const filepath =
|
|
26607
|
+
const filepath = join12(this.config.outdir, `${module.packageName}.json`);
|
|
24774
26608
|
await writeFile5(filepath, jsonStr, "utf8");
|
|
24775
26609
|
this.log.info(`Generated ${filepath}`);
|
|
24776
26610
|
} else {
|
|
@@ -24780,9 +26614,9 @@ var JsonDefinitionGenerator = class _JsonDefinitionGenerator {
|
|
|
24780
26614
|
};
|
|
24781
26615
|
|
|
24782
26616
|
// ../typedoc-theme/src/theme.ts
|
|
24783
|
-
import { copyFileSync, existsSync as
|
|
24784
|
-
import { dirname as
|
|
24785
|
-
import { fileURLToPath as
|
|
26617
|
+
import { copyFileSync, existsSync as existsSync4, mkdirSync as mkdirSync2, readdirSync as readdirSync2, writeFileSync as writeFileSync4 } from "node:fs";
|
|
26618
|
+
import { dirname as dirname9, join as join15 } from "node:path";
|
|
26619
|
+
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
24786
26620
|
import { DefaultTheme, RendererEvent } from "typedoc";
|
|
24787
26621
|
|
|
24788
26622
|
// ../typedoc-theme/src/context.ts
|
|
@@ -25055,8 +26889,8 @@ import { JSX as JSX3 } from "typedoc";
|
|
|
25055
26889
|
|
|
25056
26890
|
// ../typedoc-theme/src/search-splitter.ts
|
|
25057
26891
|
var import_lunr = __toESM(require_lunr(), 1);
|
|
25058
|
-
import { readFileSync as
|
|
25059
|
-
import { join as
|
|
26892
|
+
import { readFileSync as readFileSync6, writeFileSync as writeFileSync3 } from "node:fs";
|
|
26893
|
+
import { join as join13 } from "node:path";
|
|
25060
26894
|
import { deflateSync, inflateSync } from "node:zlib";
|
|
25061
26895
|
var KIND_MODULE = 2;
|
|
25062
26896
|
function sanitizeModuleName(name) {
|
|
@@ -25073,20 +26907,20 @@ function getModuleName(row, moduleNames) {
|
|
|
25073
26907
|
return void 0;
|
|
25074
26908
|
}
|
|
25075
26909
|
function buildChunk(rows) {
|
|
25076
|
-
const
|
|
25077
|
-
|
|
25078
|
-
|
|
25079
|
-
|
|
26910
|
+
const builder8 = new import_lunr.default.Builder();
|
|
26911
|
+
builder8.pipeline.add(import_lunr.default.trimmer);
|
|
26912
|
+
builder8.ref("id");
|
|
26913
|
+
builder8.field("name", { boost: 10 });
|
|
25080
26914
|
for (let i = 0; i < rows.length; i++) {
|
|
25081
|
-
|
|
26915
|
+
builder8.add({ id: i, name: rows[i].name });
|
|
25082
26916
|
}
|
|
25083
|
-
const index =
|
|
26917
|
+
const index = builder8.build();
|
|
25084
26918
|
const data = { rows, index };
|
|
25085
26919
|
const compressed = deflateSync(Buffer.from(JSON.stringify(data)));
|
|
25086
26920
|
return compressed.toString("base64");
|
|
25087
26921
|
}
|
|
25088
26922
|
function readSearchData(assetsDir) {
|
|
25089
|
-
const raw =
|
|
26923
|
+
const raw = readFileSync6(join13(assetsDir, "search.js"), "utf-8");
|
|
25090
26924
|
const match = raw.match(/window\.searchData\s*=\s*"([^"]+)"/);
|
|
25091
26925
|
if (!match?.[1]) {
|
|
25092
26926
|
throw new Error("Could not extract searchData from search.js");
|
|
@@ -25096,7 +26930,7 @@ function readSearchData(assetsDir) {
|
|
|
25096
26930
|
return JSON.parse(decompressed.toString("utf-8"));
|
|
25097
26931
|
}
|
|
25098
26932
|
async function splitSearchIndex(outputDir) {
|
|
25099
|
-
const assetsDir =
|
|
26933
|
+
const assetsDir = join13(outputDir, "assets");
|
|
25100
26934
|
let searchData;
|
|
25101
26935
|
try {
|
|
25102
26936
|
searchData = readSearchData(assetsDir);
|
|
@@ -25128,11 +26962,11 @@ async function splitSearchIndex(outputDir) {
|
|
|
25128
26962
|
for (const [moduleName, moduleRows] of moduleMap) {
|
|
25129
26963
|
const chunk = buildChunk(moduleRows);
|
|
25130
26964
|
const filename = `search-${sanitizeModuleName(moduleName)}.js`;
|
|
25131
|
-
|
|
26965
|
+
writeFileSync3(join13(assetsDir, filename), `window.searchData = "${chunk}";`);
|
|
25132
26966
|
}
|
|
25133
26967
|
const modulesChunk = buildChunk(moduleEntries);
|
|
25134
|
-
|
|
25135
|
-
|
|
26968
|
+
writeFileSync3(join13(assetsDir, "search-modules.js"), `window.searchData = "${modulesChunk}";`);
|
|
26969
|
+
writeFileSync3(join13(assetsDir, "search.js"), "window.searchData = null;");
|
|
25136
26970
|
const totalChunks = moduleMap.size + 1;
|
|
25137
26971
|
console.log(`[search-splitter] Split ${rows.length} entries into ${totalChunks} chunks (${moduleMap.size} modules)`);
|
|
25138
26972
|
}
|
|
@@ -25537,7 +27371,7 @@ function giDocgenModuleMemberSummary(context, member) {
|
|
|
25537
27371
|
}
|
|
25538
27372
|
const nsMeta = member.girNamespaceMetadata;
|
|
25539
27373
|
const commentSummary = context.commentShortSummary(member);
|
|
25540
|
-
const
|
|
27374
|
+
const description8 = commentSummary || (nsMeta?.description ? JSX4.createElement("p", null, nsMeta.description) : null);
|
|
25541
27375
|
return JSX4.createElement(
|
|
25542
27376
|
JSX4.Fragment,
|
|
25543
27377
|
null,
|
|
@@ -25549,7 +27383,7 @@ function giDocgenModuleMemberSummary(context, member) {
|
|
|
25549
27383
|
JSX4.createElement(
|
|
25550
27384
|
"dd",
|
|
25551
27385
|
{ class: classNames({ "tsd-member-summary": true }, context.getReflectionClasses(member)) },
|
|
25552
|
-
|
|
27386
|
+
description8
|
|
25553
27387
|
)
|
|
25554
27388
|
);
|
|
25555
27389
|
}
|
|
@@ -25658,16 +27492,16 @@ import { JSX as JSX7 } from "typedoc";
|
|
|
25658
27492
|
var giDocgenPageSidebar = (context, props) => JSX7.createElement(JSX7.Fragment, null, context.pageNavigation(props));
|
|
25659
27493
|
|
|
25660
27494
|
// ../typedoc-theme/src/partials/sidebar.ts
|
|
25661
|
-
import { readFileSync as
|
|
25662
|
-
import { dirname as
|
|
25663
|
-
import { fileURLToPath as
|
|
27495
|
+
import { readFileSync as readFileSync7 } from "node:fs";
|
|
27496
|
+
import { dirname as dirname8, join as join14 } from "node:path";
|
|
27497
|
+
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
25664
27498
|
import { i18n, JSX as JSX8, ReflectionKind as ReflectionKind4 } from "typedoc";
|
|
25665
27499
|
function getTsForGirVersion() {
|
|
25666
27500
|
if (true) {
|
|
25667
|
-
return "4.0.0-rc.
|
|
27501
|
+
return "4.0.0-rc.5";
|
|
25668
27502
|
}
|
|
25669
|
-
const __dirname3 =
|
|
25670
|
-
return JSON.parse(
|
|
27503
|
+
const __dirname3 = dirname8(fileURLToPath5(import.meta.url));
|
|
27504
|
+
return JSON.parse(readFileSync7(join14(__dirname3, "..", "..", "package.json"), "utf8")).version;
|
|
25671
27505
|
}
|
|
25672
27506
|
var TSFOR_GIR_VERSION = getTsForGirVersion();
|
|
25673
27507
|
function giDocgenModuleInfo(context, mod, nsMeta) {
|
|
@@ -26100,7 +27934,7 @@ var GiDocgenThemeRenderContext = class extends DefaultThemeRenderContext {
|
|
|
26100
27934
|
};
|
|
26101
27935
|
|
|
26102
27936
|
// ../typedoc-theme/src/theme.ts
|
|
26103
|
-
var __dirname2 =
|
|
27937
|
+
var __dirname2 = dirname9(fileURLToPath6(import.meta.url));
|
|
26104
27938
|
var FAVICON_FILES = [
|
|
26105
27939
|
"favicon.ico",
|
|
26106
27940
|
"favicon-96x96.png",
|
|
@@ -26123,21 +27957,21 @@ var GiDocgenTheme = class extends DefaultTheme {
|
|
|
26123
27957
|
constructor(renderer) {
|
|
26124
27958
|
super(renderer);
|
|
26125
27959
|
this.owner.on(RendererEvent.END, (event) => {
|
|
26126
|
-
const assetsDir =
|
|
26127
|
-
copyFileSync(
|
|
26128
|
-
copyFileSync(
|
|
26129
|
-
copyFileSync(
|
|
26130
|
-
const faviconDir =
|
|
27960
|
+
const assetsDir = join15(event.outputDirectory, "assets");
|
|
27961
|
+
copyFileSync(join15(__dirname2, "static", "style.css"), join15(assetsDir, "gi-docgen.css"));
|
|
27962
|
+
copyFileSync(join15(__dirname2, "static", "gi-docgen-inherited.js"), join15(assetsDir, "gi-docgen-inherited.js"));
|
|
27963
|
+
copyFileSync(join15(__dirname2, "static", "logo_x4.png"), join15(assetsDir, "logo_x4.png"));
|
|
27964
|
+
const faviconDir = join15(__dirname2, "static", "favicon");
|
|
26131
27965
|
for (const file of FAVICON_FILES) {
|
|
26132
|
-
copyFileSync(
|
|
27966
|
+
copyFileSync(join15(faviconDir, file), join15(assetsDir, file));
|
|
26133
27967
|
}
|
|
26134
|
-
const iconsSourceDir =
|
|
26135
|
-
const iconsOutputDir =
|
|
26136
|
-
if (
|
|
26137
|
-
|
|
26138
|
-
for (const file of
|
|
27968
|
+
const iconsSourceDir = join15(__dirname2, "..", "..", "..", "refs", "library-icons", "library-icons");
|
|
27969
|
+
const iconsOutputDir = join15(assetsDir, "library-icons");
|
|
27970
|
+
if (existsSync4(iconsSourceDir)) {
|
|
27971
|
+
mkdirSync2(iconsOutputDir, { recursive: true });
|
|
27972
|
+
for (const file of readdirSync2(iconsSourceDir)) {
|
|
26139
27973
|
if (file.endsWith("-r.svg")) {
|
|
26140
|
-
copyFileSync(
|
|
27974
|
+
copyFileSync(join15(iconsSourceDir, file), join15(iconsOutputDir, file));
|
|
26141
27975
|
}
|
|
26142
27976
|
}
|
|
26143
27977
|
}
|
|
@@ -26153,7 +27987,7 @@ var GiDocgenTheme = class extends DefaultTheme {
|
|
|
26153
27987
|
background_color: "#1e1e1e",
|
|
26154
27988
|
display: "standalone"
|
|
26155
27989
|
};
|
|
26156
|
-
|
|
27990
|
+
writeFileSync4(join15(assetsDir, "site.webmanifest"), JSON.stringify(manifest, null, 2));
|
|
26157
27991
|
});
|
|
26158
27992
|
}
|
|
26159
27993
|
getNavigation(project) {
|
|
@@ -26207,7 +28041,7 @@ var HtmlDocGenerator = class _HtmlDocGenerator {
|
|
|
26207
28041
|
} else {
|
|
26208
28042
|
for (const module of this.pipeline.modules) {
|
|
26209
28043
|
const result = await this.pipeline.createTypeDocApp(module);
|
|
26210
|
-
await this.generateDocsWithTheme(result,
|
|
28044
|
+
await this.generateDocsWithTheme(result, join16(outdir, module.packageName));
|
|
26211
28045
|
}
|
|
26212
28046
|
}
|
|
26213
28047
|
this.log.success(`HTML documentation generated for ${this.pipeline.modules.length} modules in ${outdir}`);
|
|
@@ -26252,9 +28086,9 @@ var HtmlDocGenerator = class _HtmlDocGenerator {
|
|
|
26252
28086
|
import prettier from "prettier";
|
|
26253
28087
|
var logger4 = new Logger(false, "TypeScriptFormatter");
|
|
26254
28088
|
var TypeScriptFormatter = class extends Formatter {
|
|
26255
|
-
format(
|
|
28089
|
+
format(input2) {
|
|
26256
28090
|
try {
|
|
26257
|
-
return prettier.format(
|
|
28091
|
+
return prettier.format(input2, {
|
|
26258
28092
|
singleQuote: true,
|
|
26259
28093
|
parser: "typescript",
|
|
26260
28094
|
printWidth: 120,
|
|
@@ -26262,7 +28096,7 @@ var TypeScriptFormatter = class extends Formatter {
|
|
|
26262
28096
|
});
|
|
26263
28097
|
} catch (error) {
|
|
26264
28098
|
logger4.warn("Failed to format with prettier, returning original input", error);
|
|
26265
|
-
return Promise.resolve(
|
|
28099
|
+
return Promise.resolve(input2);
|
|
26266
28100
|
}
|
|
26267
28101
|
}
|
|
26268
28102
|
};
|
|
@@ -26391,9 +28225,9 @@ async function runGenerationCommand(args, options2) {
|
|
|
26391
28225
|
}
|
|
26392
28226
|
|
|
26393
28227
|
// src/commands/doc.ts
|
|
26394
|
-
var
|
|
26395
|
-
var
|
|
26396
|
-
var
|
|
28228
|
+
var command4 = "doc [modules..]";
|
|
28229
|
+
var description4 = "Generates HTML documentation from GIR files using TypeDoc";
|
|
28230
|
+
var examples4 = [
|
|
26397
28231
|
[`${APP_NAME} doc Gtk-4.0 --outdir ./docs`, "Generate HTML documentation for Gtk-4.0"],
|
|
26398
28232
|
[`${APP_NAME} doc '*' --outdir ./docs`, "Generate documentation for all locally installed GIR modules"],
|
|
26399
28233
|
[
|
|
@@ -26401,8 +28235,8 @@ var examples3 = [
|
|
|
26401
28235
|
"Generate HTML from pre-generated JSON files (low memory)"
|
|
26402
28236
|
]
|
|
26403
28237
|
];
|
|
26404
|
-
var
|
|
26405
|
-
var
|
|
28238
|
+
var builder4 = createBuilder(docOptions, examples4);
|
|
28239
|
+
var handler4 = async (args) => {
|
|
26406
28240
|
const config = getOptionsGeneration(await load(args));
|
|
26407
28241
|
if (config.merge) {
|
|
26408
28242
|
if (!config.jsonDir) {
|
|
@@ -26421,17 +28255,17 @@ var handler3 = async (args) => {
|
|
|
26421
28255
|
});
|
|
26422
28256
|
};
|
|
26423
28257
|
var doc = {
|
|
26424
|
-
command:
|
|
26425
|
-
description:
|
|
26426
|
-
builder:
|
|
26427
|
-
handler:
|
|
26428
|
-
examples:
|
|
28258
|
+
command: command4,
|
|
28259
|
+
description: description4,
|
|
28260
|
+
builder: builder4,
|
|
28261
|
+
handler: handler4,
|
|
28262
|
+
examples: examples4
|
|
26429
28263
|
};
|
|
26430
28264
|
|
|
26431
28265
|
// src/commands/generate.ts
|
|
26432
|
-
var
|
|
26433
|
-
var
|
|
26434
|
-
var
|
|
28266
|
+
var command5 = "generate [modules..]";
|
|
28267
|
+
var description5 = "Generates Typescript type definition .d.ts files from GIR for GJS";
|
|
28268
|
+
var examples5 = [
|
|
26435
28269
|
[
|
|
26436
28270
|
`${APP_NAME} generate`,
|
|
26437
28271
|
`Run '${APP_NAME} generate' in your gjs project to generate typings for your project, pass the gir modules you need for your project`
|
|
@@ -26441,8 +28275,8 @@ var examples4 = [
|
|
|
26441
28275
|
[`${APP_NAME} generate --configName='.ts-for-gir.gtk4.rc.js`, "Use a special config file"],
|
|
26442
28276
|
[`${APP_NAME} generate --ignore=Gtk-4.0 xrandr-1.3`, "Generate .d.ts. files but not for Gtk-4.0 and xrandr-1.3"]
|
|
26443
28277
|
];
|
|
26444
|
-
var
|
|
26445
|
-
var
|
|
28278
|
+
var builder5 = createBuilder(generateOptions, examples5);
|
|
28279
|
+
var handler5 = async (args) => {
|
|
26446
28280
|
await runGenerationCommand(args, {
|
|
26447
28281
|
generatorType: 0 /* TYPES */,
|
|
26448
28282
|
loggerName: "GenerateCommand",
|
|
@@ -26452,25 +28286,25 @@ var handler4 = async (args) => {
|
|
|
26452
28286
|
});
|
|
26453
28287
|
};
|
|
26454
28288
|
var generate = {
|
|
26455
|
-
command:
|
|
26456
|
-
description:
|
|
26457
|
-
builder:
|
|
26458
|
-
handler:
|
|
26459
|
-
examples:
|
|
28289
|
+
command: command5,
|
|
28290
|
+
description: description5,
|
|
28291
|
+
builder: builder5,
|
|
28292
|
+
handler: handler5,
|
|
28293
|
+
examples: examples5
|
|
26460
28294
|
};
|
|
26461
28295
|
|
|
26462
28296
|
// src/commands/json.ts
|
|
26463
|
-
var
|
|
26464
|
-
var
|
|
26465
|
-
var
|
|
28297
|
+
var command6 = "json [modules..]";
|
|
28298
|
+
var description6 = "Generates JSON representation from GIR files for analysis and tooling";
|
|
28299
|
+
var examples6 = [
|
|
26466
28300
|
[`${APP_NAME} json`, `Run '${APP_NAME} json' in your gjs project to generate JSON files for your project`],
|
|
26467
28301
|
[`${APP_NAME} json 'Gtk*'`, "You can also use wild cards"],
|
|
26468
28302
|
[`${APP_NAME} json '*'`, "If you want to parse all of your locally installed gir modules run"],
|
|
26469
28303
|
[`${APP_NAME} json --configName='.ts-for-gir.gtk4.rc.js`, "Use a special config file"],
|
|
26470
28304
|
[`${APP_NAME} json --ignore=Gtk-4.0 xrandr-1.3`, "Generate JSON files but not for Gtk-4.0 and xrandr-1.3"]
|
|
26471
28305
|
];
|
|
26472
|
-
var
|
|
26473
|
-
var
|
|
28306
|
+
var builder6 = createBuilder(generateOptions, examples6);
|
|
28307
|
+
var handler6 = async (args) => {
|
|
26474
28308
|
await runGenerationCommand(args, {
|
|
26475
28309
|
generatorType: 2 /* JSON */,
|
|
26476
28310
|
loggerName: "JsonCommand",
|
|
@@ -26480,26 +28314,26 @@ var handler5 = async (args) => {
|
|
|
26480
28314
|
});
|
|
26481
28315
|
};
|
|
26482
28316
|
var json2 = {
|
|
26483
|
-
command:
|
|
26484
|
-
description:
|
|
26485
|
-
builder:
|
|
26486
|
-
handler:
|
|
26487
|
-
examples:
|
|
28317
|
+
command: command6,
|
|
28318
|
+
description: description6,
|
|
28319
|
+
builder: builder6,
|
|
28320
|
+
handler: handler6,
|
|
28321
|
+
examples: examples6
|
|
26488
28322
|
};
|
|
26489
28323
|
|
|
26490
28324
|
// src/commands/list.ts
|
|
26491
|
-
var
|
|
26492
|
-
var
|
|
28325
|
+
var command7 = "list [modules..]";
|
|
28326
|
+
var description7 = "Lists all available GIR modules";
|
|
26493
28327
|
var logger5 = new Logger(true, "ListCommand");
|
|
26494
|
-
var
|
|
28328
|
+
var examples7 = [
|
|
26495
28329
|
[`${APP_NAME} list -g ./vala-girs/gir-1.0`, "Lists all available GIR modules in ./vala-girs/gir-1.0"],
|
|
26496
28330
|
[
|
|
26497
28331
|
`${APP_NAME} list --ignore=Gtk-3.0 xrandr-1.3`,
|
|
26498
28332
|
"Lists all available GIR modules in /usr/share/gir-1.0 but not Gtk-3.0 and xrandr-1.3"
|
|
26499
28333
|
]
|
|
26500
28334
|
];
|
|
26501
|
-
var
|
|
26502
|
-
var
|
|
28335
|
+
var builder7 = createBuilder(listOptions, examples7);
|
|
28336
|
+
var handler7 = async (args) => {
|
|
26503
28337
|
const config = await load(args);
|
|
26504
28338
|
const generateConfig = getOptionsGeneration(config);
|
|
26505
28339
|
const registry = new NSRegistry();
|
|
@@ -26540,15 +28374,15 @@ var handler6 = async (args) => {
|
|
|
26540
28374
|
}
|
|
26541
28375
|
};
|
|
26542
28376
|
var list = {
|
|
26543
|
-
command:
|
|
26544
|
-
description:
|
|
26545
|
-
builder:
|
|
26546
|
-
handler:
|
|
26547
|
-
examples:
|
|
28377
|
+
command: command7,
|
|
28378
|
+
description: description7,
|
|
28379
|
+
builder: builder7,
|
|
28380
|
+
handler: handler7,
|
|
28381
|
+
examples: examples7
|
|
26548
28382
|
};
|
|
26549
28383
|
|
|
26550
28384
|
// src/start.ts
|
|
26551
|
-
void yargs(hideBin(process.argv)).scriptName(APP_NAME).strict().usage(APP_USAGE).version(APP_VERSION).command(analyze).command(generate).command(json2).command(list).command(copy).command(doc).demandCommand(1).help().argv;
|
|
28385
|
+
void yargs(hideBin(process.argv)).scriptName(APP_NAME).strict().usage(APP_USAGE).version(APP_VERSION).command(analyze).command(create).command(generate).command(json2).command(list).command(copy).command(doc).demandCommand(1).help().argv;
|
|
26552
28386
|
/*! Bundled license information:
|
|
26553
28387
|
|
|
26554
28388
|
lodash/lodash.js:
|