prpm 1.0.4 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2435 -53
- package/dist/schemas/gemini.schema.json +29 -0
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -495,6 +495,8 @@ function getDestinationDir2(format, subtype, name) {
|
|
|
495
495
|
case "kiro":
|
|
496
496
|
if (subtype === "hook") return ".kiro/hooks";
|
|
497
497
|
return ".kiro/steering";
|
|
498
|
+
case "gemini":
|
|
499
|
+
return ".gemini/commands";
|
|
498
500
|
case "agents.md":
|
|
499
501
|
return ".";
|
|
500
502
|
case "generic":
|
|
@@ -548,6 +550,7 @@ async function autoDetectFormat() {
|
|
|
548
550
|
{ format: "windsurf", dir: ".windsurf" },
|
|
549
551
|
{ format: "copilot", dir: ".github/instructions" },
|
|
550
552
|
{ format: "kiro", dir: ".kiro" },
|
|
553
|
+
{ format: "gemini", dir: ".gemini" },
|
|
551
554
|
{ format: "agents.md", dir: ".agents" }
|
|
552
555
|
];
|
|
553
556
|
for (const { format, dir } of formatDirs) {
|
|
@@ -802,6 +805,8 @@ function normalizeFormat(sourceFormat) {
|
|
|
802
805
|
return "kiro";
|
|
803
806
|
if (normalized.includes("agents.md") || normalized.includes("agentsmd"))
|
|
804
807
|
return "agents.md";
|
|
808
|
+
if (normalized.includes("gemini"))
|
|
809
|
+
return "gemini";
|
|
805
810
|
if (normalized.includes("mcp"))
|
|
806
811
|
return "mcp";
|
|
807
812
|
return "generic";
|
|
@@ -1441,7 +1446,7 @@ function constructYamlInteger(data) {
|
|
|
1441
1446
|
}
|
|
1442
1447
|
return sign * parseInt(value, 10);
|
|
1443
1448
|
}
|
|
1444
|
-
function
|
|
1449
|
+
function isInteger2(object) {
|
|
1445
1450
|
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !common.isNegativeZero(object));
|
|
1446
1451
|
}
|
|
1447
1452
|
function resolveYamlFloat(data) {
|
|
@@ -1502,7 +1507,7 @@ function representYamlFloat(object, style) {
|
|
|
1502
1507
|
res = object.toString(10);
|
|
1503
1508
|
return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
|
|
1504
1509
|
}
|
|
1505
|
-
function
|
|
1510
|
+
function isFloat2(object) {
|
|
1506
1511
|
return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common.isNegativeZero(object));
|
|
1507
1512
|
}
|
|
1508
1513
|
function resolveYamlTimestamp(data) {
|
|
@@ -2861,14 +2866,14 @@ function isPlainSafe(c, prev, inblock) {
|
|
|
2861
2866
|
(inblock ? (
|
|
2862
2867
|
// c = flow-in
|
|
2863
2868
|
cIsNsCharOrWhitespace
|
|
2864
|
-
) : cIsNsCharOrWhitespace && c !==
|
|
2869
|
+
) : cIsNsCharOrWhitespace && c !== CHAR_COMMA2 && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET) && c !== CHAR_SHARP && !(prev === CHAR_COLON2 && !cIsNsChar) || isNsCharOrWhitespace(prev) && !isWhitespace(prev) && c === CHAR_SHARP || prev === CHAR_COLON2 && cIsNsChar
|
|
2865
2870
|
);
|
|
2866
2871
|
}
|
|
2867
2872
|
function isPlainSafeFirst(c) {
|
|
2868
|
-
return isPrintable(c) && c !== CHAR_BOM && !isWhitespace(c) && c !== CHAR_MINUS && c !== CHAR_QUESTION && c !==
|
|
2873
|
+
return isPrintable(c) && c !== CHAR_BOM && !isWhitespace(c) && c !== CHAR_MINUS && c !== CHAR_QUESTION && c !== CHAR_COLON2 && c !== CHAR_COMMA2 && c !== CHAR_LEFT_SQUARE_BRACKET && c !== CHAR_RIGHT_SQUARE_BRACKET && c !== CHAR_LEFT_CURLY_BRACKET && c !== CHAR_RIGHT_CURLY_BRACKET && c !== CHAR_SHARP && c !== CHAR_AMPERSAND && c !== CHAR_ASTERISK && c !== CHAR_EXCLAMATION && c !== CHAR_VERTICAL_LINE && c !== CHAR_EQUALS2 && c !== CHAR_GREATER_THAN && c !== CHAR_SINGLE_QUOTE && c !== CHAR_DOUBLE_QUOTE && c !== CHAR_PERCENT && c !== CHAR_COMMERCIAL_AT && c !== CHAR_GRAVE_ACCENT;
|
|
2869
2874
|
}
|
|
2870
2875
|
function isPlainSafeLast(c) {
|
|
2871
|
-
return !isWhitespace(c) && c !==
|
|
2876
|
+
return !isWhitespace(c) && c !== CHAR_COLON2;
|
|
2872
2877
|
}
|
|
2873
2878
|
function codePointAt(string, pos) {
|
|
2874
2879
|
var first = string.charCodeAt(pos), second;
|
|
@@ -3311,7 +3316,7 @@ function renamed(from, to) {
|
|
|
3311
3316
|
throw new Error("Function yaml." + from + " is removed in js-yaml 4. Use yaml." + to + " instead, which is now safe by default.");
|
|
3312
3317
|
};
|
|
3313
3318
|
}
|
|
3314
|
-
var isNothing_1, isObject_1, toArray_1, repeat_1, isNegativeZero_1, extend_1, common, exception, snippet, TYPE_CONSTRUCTOR_OPTIONS, YAML_NODE_KINDS, type, schema, str, seq, map, failsafe, _null, bool, int, YAML_FLOAT_PATTERN, SCIENTIFIC_WITHOUT_DOT, float, json, core, YAML_DATE_REGEXP, YAML_TIMESTAMP_REGEXP, timestamp, merge, BASE64_MAP, binary, _hasOwnProperty$3, _toString$2, omap, _toString$1, pairs, _hasOwnProperty$2, set, _default, _hasOwnProperty$1, CONTEXT_FLOW_IN, CONTEXT_FLOW_OUT, CONTEXT_BLOCK_IN, CONTEXT_BLOCK_OUT, CHOMPING_CLIP, CHOMPING_STRIP, CHOMPING_KEEP, PATTERN_NON_PRINTABLE, PATTERN_NON_ASCII_LINE_BREAKS, PATTERN_FLOW_INDICATORS, PATTERN_TAG_HANDLE, PATTERN_TAG_URI, simpleEscapeCheck, simpleEscapeMap, i, directiveHandlers, loadAll_1, load_1, loader, _toString, _hasOwnProperty, CHAR_BOM, CHAR_TAB, CHAR_LINE_FEED, CHAR_CARRIAGE_RETURN, CHAR_SPACE, CHAR_EXCLAMATION, CHAR_DOUBLE_QUOTE, CHAR_SHARP, CHAR_PERCENT, CHAR_AMPERSAND, CHAR_SINGLE_QUOTE, CHAR_ASTERISK,
|
|
3319
|
+
var isNothing_1, isObject_1, toArray_1, repeat_1, isNegativeZero_1, extend_1, common, exception, snippet, TYPE_CONSTRUCTOR_OPTIONS, YAML_NODE_KINDS, type, schema, str, seq, map, failsafe, _null, bool, int, YAML_FLOAT_PATTERN, SCIENTIFIC_WITHOUT_DOT, float, json, core, YAML_DATE_REGEXP, YAML_TIMESTAMP_REGEXP, timestamp, merge, BASE64_MAP, binary, _hasOwnProperty$3, _toString$2, omap, _toString$1, pairs, _hasOwnProperty$2, set, _default, _hasOwnProperty$1, CONTEXT_FLOW_IN, CONTEXT_FLOW_OUT, CONTEXT_BLOCK_IN, CONTEXT_BLOCK_OUT, CHOMPING_CLIP, CHOMPING_STRIP, CHOMPING_KEEP, PATTERN_NON_PRINTABLE, PATTERN_NON_ASCII_LINE_BREAKS, PATTERN_FLOW_INDICATORS, PATTERN_TAG_HANDLE, PATTERN_TAG_URI, simpleEscapeCheck, simpleEscapeMap, i, directiveHandlers, loadAll_1, load_1, loader, _toString, _hasOwnProperty, CHAR_BOM, CHAR_TAB, CHAR_LINE_FEED, CHAR_CARRIAGE_RETURN, CHAR_SPACE, CHAR_EXCLAMATION, CHAR_DOUBLE_QUOTE, CHAR_SHARP, CHAR_PERCENT, CHAR_AMPERSAND, CHAR_SINGLE_QUOTE, CHAR_ASTERISK, CHAR_COMMA2, CHAR_MINUS, CHAR_COLON2, CHAR_EQUALS2, CHAR_GREATER_THAN, CHAR_QUESTION, CHAR_COMMERCIAL_AT, CHAR_LEFT_SQUARE_BRACKET, CHAR_RIGHT_SQUARE_BRACKET, CHAR_GRAVE_ACCENT, CHAR_LEFT_CURLY_BRACKET, CHAR_VERTICAL_LINE, CHAR_RIGHT_CURLY_BRACKET, ESCAPE_SEQUENCES, DEPRECATED_BOOLEANS_SYNTAX, DEPRECATED_BASE60_SYNTAX, QUOTING_TYPE_SINGLE, QUOTING_TYPE_DOUBLE, STYLE_PLAIN, STYLE_SINGLE, STYLE_LITERAL, STYLE_FOLDED, STYLE_DOUBLE, dump_1, dumper, Type, Schema, FAILSAFE_SCHEMA, JSON_SCHEMA, CORE_SCHEMA, DEFAULT_SCHEMA, load, loadAll, dump, YAMLException, types, safeLoad, safeLoadAll, safeDump, jsYaml;
|
|
3315
3320
|
var init_js_yaml = __esm({
|
|
3316
3321
|
"../converters/node_modules/js-yaml/dist/js-yaml.mjs"() {
|
|
3317
3322
|
"use strict";
|
|
@@ -3464,7 +3469,7 @@ var init_js_yaml = __esm({
|
|
|
3464
3469
|
kind: "scalar",
|
|
3465
3470
|
resolve: resolveYamlInteger,
|
|
3466
3471
|
construct: constructYamlInteger,
|
|
3467
|
-
predicate:
|
|
3472
|
+
predicate: isInteger2,
|
|
3468
3473
|
represent: {
|
|
3469
3474
|
binary: function(obj) {
|
|
3470
3475
|
return obj >= 0 ? "0b" + obj.toString(2) : "-0b" + obj.toString(2).slice(1);
|
|
@@ -3497,7 +3502,7 @@ var init_js_yaml = __esm({
|
|
|
3497
3502
|
kind: "scalar",
|
|
3498
3503
|
resolve: resolveYamlFloat,
|
|
3499
3504
|
construct: constructYamlFloat,
|
|
3500
|
-
predicate:
|
|
3505
|
+
predicate: isFloat2,
|
|
3501
3506
|
represent: representYamlFloat,
|
|
3502
3507
|
defaultStyle: "lowercase"
|
|
3503
3508
|
});
|
|
@@ -3653,10 +3658,10 @@ var init_js_yaml = __esm({
|
|
|
3653
3658
|
CHAR_AMPERSAND = 38;
|
|
3654
3659
|
CHAR_SINGLE_QUOTE = 39;
|
|
3655
3660
|
CHAR_ASTERISK = 42;
|
|
3656
|
-
|
|
3661
|
+
CHAR_COMMA2 = 44;
|
|
3657
3662
|
CHAR_MINUS = 45;
|
|
3658
|
-
|
|
3659
|
-
|
|
3663
|
+
CHAR_COLON2 = 58;
|
|
3664
|
+
CHAR_EQUALS2 = 61;
|
|
3660
3665
|
CHAR_GREATER_THAN = 62;
|
|
3661
3666
|
CHAR_QUESTION = 63;
|
|
3662
3667
|
CHAR_COMMERCIAL_AT = 64;
|
|
@@ -4602,6 +4607,2072 @@ var init_from_agents_md = __esm({
|
|
|
4602
4607
|
}
|
|
4603
4608
|
});
|
|
4604
4609
|
|
|
4610
|
+
// ../../node_modules/@iarna/toml/lib/parser.js
|
|
4611
|
+
var require_parser = __commonJS({
|
|
4612
|
+
"../../node_modules/@iarna/toml/lib/parser.js"(exports2, module2) {
|
|
4613
|
+
"use strict";
|
|
4614
|
+
init_cjs_shims();
|
|
4615
|
+
var ParserEND = 1114112;
|
|
4616
|
+
var ParserError = class _ParserError extends Error {
|
|
4617
|
+
/* istanbul ignore next */
|
|
4618
|
+
constructor(msg, filename, linenumber) {
|
|
4619
|
+
super("[ParserError] " + msg, filename, linenumber);
|
|
4620
|
+
this.name = "ParserError";
|
|
4621
|
+
this.code = "ParserError";
|
|
4622
|
+
if (Error.captureStackTrace) Error.captureStackTrace(this, _ParserError);
|
|
4623
|
+
}
|
|
4624
|
+
};
|
|
4625
|
+
var State2 = class {
|
|
4626
|
+
constructor(parser) {
|
|
4627
|
+
this.parser = parser;
|
|
4628
|
+
this.buf = "";
|
|
4629
|
+
this.returned = null;
|
|
4630
|
+
this.result = null;
|
|
4631
|
+
this.resultTable = null;
|
|
4632
|
+
this.resultArr = null;
|
|
4633
|
+
}
|
|
4634
|
+
};
|
|
4635
|
+
var Parser = class {
|
|
4636
|
+
constructor() {
|
|
4637
|
+
this.pos = 0;
|
|
4638
|
+
this.col = 0;
|
|
4639
|
+
this.line = 0;
|
|
4640
|
+
this.obj = {};
|
|
4641
|
+
this.ctx = this.obj;
|
|
4642
|
+
this.stack = [];
|
|
4643
|
+
this._buf = "";
|
|
4644
|
+
this.char = null;
|
|
4645
|
+
this.ii = 0;
|
|
4646
|
+
this.state = new State2(this.parseStart);
|
|
4647
|
+
}
|
|
4648
|
+
parse(str2) {
|
|
4649
|
+
if (str2.length === 0 || str2.length == null) return;
|
|
4650
|
+
this._buf = String(str2);
|
|
4651
|
+
this.ii = -1;
|
|
4652
|
+
this.char = -1;
|
|
4653
|
+
let getNext;
|
|
4654
|
+
while (getNext === false || this.nextChar()) {
|
|
4655
|
+
getNext = this.runOne();
|
|
4656
|
+
}
|
|
4657
|
+
this._buf = null;
|
|
4658
|
+
}
|
|
4659
|
+
nextChar() {
|
|
4660
|
+
if (this.char === 10) {
|
|
4661
|
+
++this.line;
|
|
4662
|
+
this.col = -1;
|
|
4663
|
+
}
|
|
4664
|
+
++this.ii;
|
|
4665
|
+
this.char = this._buf.codePointAt(this.ii);
|
|
4666
|
+
++this.pos;
|
|
4667
|
+
++this.col;
|
|
4668
|
+
return this.haveBuffer();
|
|
4669
|
+
}
|
|
4670
|
+
haveBuffer() {
|
|
4671
|
+
return this.ii < this._buf.length;
|
|
4672
|
+
}
|
|
4673
|
+
runOne() {
|
|
4674
|
+
return this.state.parser.call(this, this.state.returned);
|
|
4675
|
+
}
|
|
4676
|
+
finish() {
|
|
4677
|
+
this.char = ParserEND;
|
|
4678
|
+
let last;
|
|
4679
|
+
do {
|
|
4680
|
+
last = this.state.parser;
|
|
4681
|
+
this.runOne();
|
|
4682
|
+
} while (this.state.parser !== last);
|
|
4683
|
+
this.ctx = null;
|
|
4684
|
+
this.state = null;
|
|
4685
|
+
this._buf = null;
|
|
4686
|
+
return this.obj;
|
|
4687
|
+
}
|
|
4688
|
+
next(fn) {
|
|
4689
|
+
if (typeof fn !== "function") throw new ParserError("Tried to set state to non-existent state: " + JSON.stringify(fn));
|
|
4690
|
+
this.state.parser = fn;
|
|
4691
|
+
}
|
|
4692
|
+
goto(fn) {
|
|
4693
|
+
this.next(fn);
|
|
4694
|
+
return this.runOne();
|
|
4695
|
+
}
|
|
4696
|
+
call(fn, returnWith) {
|
|
4697
|
+
if (returnWith) this.next(returnWith);
|
|
4698
|
+
this.stack.push(this.state);
|
|
4699
|
+
this.state = new State2(fn);
|
|
4700
|
+
}
|
|
4701
|
+
callNow(fn, returnWith) {
|
|
4702
|
+
this.call(fn, returnWith);
|
|
4703
|
+
return this.runOne();
|
|
4704
|
+
}
|
|
4705
|
+
return(value) {
|
|
4706
|
+
if (this.stack.length === 0) throw this.error(new ParserError("Stack underflow"));
|
|
4707
|
+
if (value === void 0) value = this.state.buf;
|
|
4708
|
+
this.state = this.stack.pop();
|
|
4709
|
+
this.state.returned = value;
|
|
4710
|
+
}
|
|
4711
|
+
returnNow(value) {
|
|
4712
|
+
this.return(value);
|
|
4713
|
+
return this.runOne();
|
|
4714
|
+
}
|
|
4715
|
+
consume() {
|
|
4716
|
+
if (this.char === ParserEND) throw this.error(new ParserError("Unexpected end-of-buffer"));
|
|
4717
|
+
this.state.buf += this._buf[this.ii];
|
|
4718
|
+
}
|
|
4719
|
+
error(err) {
|
|
4720
|
+
err.line = this.line;
|
|
4721
|
+
err.col = this.col;
|
|
4722
|
+
err.pos = this.pos;
|
|
4723
|
+
return err;
|
|
4724
|
+
}
|
|
4725
|
+
/* istanbul ignore next */
|
|
4726
|
+
parseStart() {
|
|
4727
|
+
throw new ParserError("Must declare a parseStart method");
|
|
4728
|
+
}
|
|
4729
|
+
};
|
|
4730
|
+
Parser.END = ParserEND;
|
|
4731
|
+
Parser.Error = ParserError;
|
|
4732
|
+
module2.exports = Parser;
|
|
4733
|
+
}
|
|
4734
|
+
});
|
|
4735
|
+
|
|
4736
|
+
// ../../node_modules/@iarna/toml/lib/create-datetime.js
|
|
4737
|
+
var require_create_datetime = __commonJS({
|
|
4738
|
+
"../../node_modules/@iarna/toml/lib/create-datetime.js"(exports2, module2) {
|
|
4739
|
+
"use strict";
|
|
4740
|
+
init_cjs_shims();
|
|
4741
|
+
module2.exports = (value) => {
|
|
4742
|
+
const date = new Date(value);
|
|
4743
|
+
if (isNaN(date)) {
|
|
4744
|
+
throw new TypeError("Invalid Datetime");
|
|
4745
|
+
} else {
|
|
4746
|
+
return date;
|
|
4747
|
+
}
|
|
4748
|
+
};
|
|
4749
|
+
}
|
|
4750
|
+
});
|
|
4751
|
+
|
|
4752
|
+
// ../../node_modules/@iarna/toml/lib/format-num.js
|
|
4753
|
+
var require_format_num = __commonJS({
|
|
4754
|
+
"../../node_modules/@iarna/toml/lib/format-num.js"(exports2, module2) {
|
|
4755
|
+
"use strict";
|
|
4756
|
+
init_cjs_shims();
|
|
4757
|
+
module2.exports = (d, num) => {
|
|
4758
|
+
num = String(num);
|
|
4759
|
+
while (num.length < d) num = "0" + num;
|
|
4760
|
+
return num;
|
|
4761
|
+
};
|
|
4762
|
+
}
|
|
4763
|
+
});
|
|
4764
|
+
|
|
4765
|
+
// ../../node_modules/@iarna/toml/lib/create-datetime-float.js
|
|
4766
|
+
var require_create_datetime_float = __commonJS({
|
|
4767
|
+
"../../node_modules/@iarna/toml/lib/create-datetime-float.js"(exports2, module2) {
|
|
4768
|
+
"use strict";
|
|
4769
|
+
init_cjs_shims();
|
|
4770
|
+
var f = require_format_num();
|
|
4771
|
+
var FloatingDateTime = class extends Date {
|
|
4772
|
+
constructor(value) {
|
|
4773
|
+
super(value + "Z");
|
|
4774
|
+
this.isFloating = true;
|
|
4775
|
+
}
|
|
4776
|
+
toISOString() {
|
|
4777
|
+
const date = `${this.getUTCFullYear()}-${f(2, this.getUTCMonth() + 1)}-${f(2, this.getUTCDate())}`;
|
|
4778
|
+
const time = `${f(2, this.getUTCHours())}:${f(2, this.getUTCMinutes())}:${f(2, this.getUTCSeconds())}.${f(3, this.getUTCMilliseconds())}`;
|
|
4779
|
+
return `${date}T${time}`;
|
|
4780
|
+
}
|
|
4781
|
+
};
|
|
4782
|
+
module2.exports = (value) => {
|
|
4783
|
+
const date = new FloatingDateTime(value);
|
|
4784
|
+
if (isNaN(date)) {
|
|
4785
|
+
throw new TypeError("Invalid Datetime");
|
|
4786
|
+
} else {
|
|
4787
|
+
return date;
|
|
4788
|
+
}
|
|
4789
|
+
};
|
|
4790
|
+
}
|
|
4791
|
+
});
|
|
4792
|
+
|
|
4793
|
+
// ../../node_modules/@iarna/toml/lib/create-date.js
|
|
4794
|
+
var require_create_date = __commonJS({
|
|
4795
|
+
"../../node_modules/@iarna/toml/lib/create-date.js"(exports2, module2) {
|
|
4796
|
+
"use strict";
|
|
4797
|
+
init_cjs_shims();
|
|
4798
|
+
var f = require_format_num();
|
|
4799
|
+
var DateTime = global.Date;
|
|
4800
|
+
var Date2 = class extends DateTime {
|
|
4801
|
+
constructor(value) {
|
|
4802
|
+
super(value);
|
|
4803
|
+
this.isDate = true;
|
|
4804
|
+
}
|
|
4805
|
+
toISOString() {
|
|
4806
|
+
return `${this.getUTCFullYear()}-${f(2, this.getUTCMonth() + 1)}-${f(2, this.getUTCDate())}`;
|
|
4807
|
+
}
|
|
4808
|
+
};
|
|
4809
|
+
module2.exports = (value) => {
|
|
4810
|
+
const date = new Date2(value);
|
|
4811
|
+
if (isNaN(date)) {
|
|
4812
|
+
throw new TypeError("Invalid Datetime");
|
|
4813
|
+
} else {
|
|
4814
|
+
return date;
|
|
4815
|
+
}
|
|
4816
|
+
};
|
|
4817
|
+
}
|
|
4818
|
+
});
|
|
4819
|
+
|
|
4820
|
+
// ../../node_modules/@iarna/toml/lib/create-time.js
|
|
4821
|
+
var require_create_time = __commonJS({
|
|
4822
|
+
"../../node_modules/@iarna/toml/lib/create-time.js"(exports2, module2) {
|
|
4823
|
+
"use strict";
|
|
4824
|
+
init_cjs_shims();
|
|
4825
|
+
var f = require_format_num();
|
|
4826
|
+
var Time = class extends Date {
|
|
4827
|
+
constructor(value) {
|
|
4828
|
+
super(`0000-01-01T${value}Z`);
|
|
4829
|
+
this.isTime = true;
|
|
4830
|
+
}
|
|
4831
|
+
toISOString() {
|
|
4832
|
+
return `${f(2, this.getUTCHours())}:${f(2, this.getUTCMinutes())}:${f(2, this.getUTCSeconds())}.${f(3, this.getUTCMilliseconds())}`;
|
|
4833
|
+
}
|
|
4834
|
+
};
|
|
4835
|
+
module2.exports = (value) => {
|
|
4836
|
+
const date = new Time(value);
|
|
4837
|
+
if (isNaN(date)) {
|
|
4838
|
+
throw new TypeError("Invalid Datetime");
|
|
4839
|
+
} else {
|
|
4840
|
+
return date;
|
|
4841
|
+
}
|
|
4842
|
+
};
|
|
4843
|
+
}
|
|
4844
|
+
});
|
|
4845
|
+
|
|
4846
|
+
// ../../node_modules/@iarna/toml/lib/toml-parser.js
|
|
4847
|
+
var require_toml_parser = __commonJS({
|
|
4848
|
+
"../../node_modules/@iarna/toml/lib/toml-parser.js"(exports, module) {
|
|
4849
|
+
"use strict";
|
|
4850
|
+
init_cjs_shims();
|
|
4851
|
+
module.exports = makeParserClass(require_parser());
|
|
4852
|
+
module.exports.makeParserClass = makeParserClass;
|
|
4853
|
+
var TomlError = class _TomlError extends Error {
|
|
4854
|
+
constructor(msg) {
|
|
4855
|
+
super(msg);
|
|
4856
|
+
this.name = "TomlError";
|
|
4857
|
+
if (Error.captureStackTrace) Error.captureStackTrace(this, _TomlError);
|
|
4858
|
+
this.fromTOML = true;
|
|
4859
|
+
this.wrapped = null;
|
|
4860
|
+
}
|
|
4861
|
+
};
|
|
4862
|
+
TomlError.wrap = (err) => {
|
|
4863
|
+
const terr = new TomlError(err.message);
|
|
4864
|
+
terr.code = err.code;
|
|
4865
|
+
terr.wrapped = err;
|
|
4866
|
+
return terr;
|
|
4867
|
+
};
|
|
4868
|
+
module.exports.TomlError = TomlError;
|
|
4869
|
+
var createDateTime = require_create_datetime();
|
|
4870
|
+
var createDateTimeFloat = require_create_datetime_float();
|
|
4871
|
+
var createDate = require_create_date();
|
|
4872
|
+
var createTime = require_create_time();
|
|
4873
|
+
var CTRL_I = 9;
|
|
4874
|
+
var CTRL_J = 10;
|
|
4875
|
+
var CTRL_M = 13;
|
|
4876
|
+
var CTRL_CHAR_BOUNDARY = 31;
|
|
4877
|
+
var CHAR_SP = 32;
|
|
4878
|
+
var CHAR_QUOT = 34;
|
|
4879
|
+
var CHAR_NUM = 35;
|
|
4880
|
+
var CHAR_APOS = 39;
|
|
4881
|
+
var CHAR_PLUS = 43;
|
|
4882
|
+
var CHAR_COMMA = 44;
|
|
4883
|
+
var CHAR_HYPHEN = 45;
|
|
4884
|
+
var CHAR_PERIOD = 46;
|
|
4885
|
+
var CHAR_0 = 48;
|
|
4886
|
+
var CHAR_1 = 49;
|
|
4887
|
+
var CHAR_7 = 55;
|
|
4888
|
+
var CHAR_9 = 57;
|
|
4889
|
+
var CHAR_COLON = 58;
|
|
4890
|
+
var CHAR_EQUALS = 61;
|
|
4891
|
+
var CHAR_A = 65;
|
|
4892
|
+
var CHAR_E = 69;
|
|
4893
|
+
var CHAR_F = 70;
|
|
4894
|
+
var CHAR_T = 84;
|
|
4895
|
+
var CHAR_U = 85;
|
|
4896
|
+
var CHAR_Z = 90;
|
|
4897
|
+
var CHAR_LOWBAR = 95;
|
|
4898
|
+
var CHAR_a = 97;
|
|
4899
|
+
var CHAR_b = 98;
|
|
4900
|
+
var CHAR_e = 101;
|
|
4901
|
+
var CHAR_f = 102;
|
|
4902
|
+
var CHAR_i = 105;
|
|
4903
|
+
var CHAR_l = 108;
|
|
4904
|
+
var CHAR_n = 110;
|
|
4905
|
+
var CHAR_o = 111;
|
|
4906
|
+
var CHAR_r = 114;
|
|
4907
|
+
var CHAR_s = 115;
|
|
4908
|
+
var CHAR_t = 116;
|
|
4909
|
+
var CHAR_u = 117;
|
|
4910
|
+
var CHAR_x = 120;
|
|
4911
|
+
var CHAR_z = 122;
|
|
4912
|
+
var CHAR_LCUB = 123;
|
|
4913
|
+
var CHAR_RCUB = 125;
|
|
4914
|
+
var CHAR_LSQB = 91;
|
|
4915
|
+
var CHAR_BSOL = 92;
|
|
4916
|
+
var CHAR_RSQB = 93;
|
|
4917
|
+
var CHAR_DEL = 127;
|
|
4918
|
+
var SURROGATE_FIRST = 55296;
|
|
4919
|
+
var SURROGATE_LAST = 57343;
|
|
4920
|
+
var escapes = {
|
|
4921
|
+
[CHAR_b]: "\b",
|
|
4922
|
+
[CHAR_t]: " ",
|
|
4923
|
+
[CHAR_n]: "\n",
|
|
4924
|
+
[CHAR_f]: "\f",
|
|
4925
|
+
[CHAR_r]: "\r",
|
|
4926
|
+
[CHAR_QUOT]: '"',
|
|
4927
|
+
[CHAR_BSOL]: "\\"
|
|
4928
|
+
};
|
|
4929
|
+
function isDigit(cp) {
|
|
4930
|
+
return cp >= CHAR_0 && cp <= CHAR_9;
|
|
4931
|
+
}
|
|
4932
|
+
function isHexit(cp) {
|
|
4933
|
+
return cp >= CHAR_A && cp <= CHAR_F || cp >= CHAR_a && cp <= CHAR_f || cp >= CHAR_0 && cp <= CHAR_9;
|
|
4934
|
+
}
|
|
4935
|
+
function isBit(cp) {
|
|
4936
|
+
return cp === CHAR_1 || cp === CHAR_0;
|
|
4937
|
+
}
|
|
4938
|
+
function isOctit(cp) {
|
|
4939
|
+
return cp >= CHAR_0 && cp <= CHAR_7;
|
|
4940
|
+
}
|
|
4941
|
+
function isAlphaNumQuoteHyphen(cp) {
|
|
4942
|
+
return cp >= CHAR_A && cp <= CHAR_Z || cp >= CHAR_a && cp <= CHAR_z || cp >= CHAR_0 && cp <= CHAR_9 || cp === CHAR_APOS || cp === CHAR_QUOT || cp === CHAR_LOWBAR || cp === CHAR_HYPHEN;
|
|
4943
|
+
}
|
|
4944
|
+
function isAlphaNumHyphen(cp) {
|
|
4945
|
+
return cp >= CHAR_A && cp <= CHAR_Z || cp >= CHAR_a && cp <= CHAR_z || cp >= CHAR_0 && cp <= CHAR_9 || cp === CHAR_LOWBAR || cp === CHAR_HYPHEN;
|
|
4946
|
+
}
|
|
4947
|
+
var _type = Symbol("type");
|
|
4948
|
+
var _declared = Symbol("declared");
|
|
4949
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
4950
|
+
var defineProperty = Object.defineProperty;
|
|
4951
|
+
var descriptor = { configurable: true, enumerable: true, writable: true, value: void 0 };
|
|
4952
|
+
function hasKey(obj, key) {
|
|
4953
|
+
if (hasOwnProperty.call(obj, key)) return true;
|
|
4954
|
+
if (key === "__proto__") defineProperty(obj, "__proto__", descriptor);
|
|
4955
|
+
return false;
|
|
4956
|
+
}
|
|
4957
|
+
var INLINE_TABLE = Symbol("inline-table");
|
|
4958
|
+
function InlineTable() {
|
|
4959
|
+
return Object.defineProperties({}, {
|
|
4960
|
+
[_type]: { value: INLINE_TABLE }
|
|
4961
|
+
});
|
|
4962
|
+
}
|
|
4963
|
+
function isInlineTable(obj) {
|
|
4964
|
+
if (obj === null || typeof obj !== "object") return false;
|
|
4965
|
+
return obj[_type] === INLINE_TABLE;
|
|
4966
|
+
}
|
|
4967
|
+
var TABLE = Symbol("table");
|
|
4968
|
+
function Table() {
|
|
4969
|
+
return Object.defineProperties({}, {
|
|
4970
|
+
[_type]: { value: TABLE },
|
|
4971
|
+
[_declared]: { value: false, writable: true }
|
|
4972
|
+
});
|
|
4973
|
+
}
|
|
4974
|
+
function isTable(obj) {
|
|
4975
|
+
if (obj === null || typeof obj !== "object") return false;
|
|
4976
|
+
return obj[_type] === TABLE;
|
|
4977
|
+
}
|
|
4978
|
+
var _contentType = Symbol("content-type");
|
|
4979
|
+
var INLINE_LIST = Symbol("inline-list");
|
|
4980
|
+
function InlineList(type2) {
|
|
4981
|
+
return Object.defineProperties([], {
|
|
4982
|
+
[_type]: { value: INLINE_LIST },
|
|
4983
|
+
[_contentType]: { value: type2 }
|
|
4984
|
+
});
|
|
4985
|
+
}
|
|
4986
|
+
function isInlineList(obj) {
|
|
4987
|
+
if (obj === null || typeof obj !== "object") return false;
|
|
4988
|
+
return obj[_type] === INLINE_LIST;
|
|
4989
|
+
}
|
|
4990
|
+
var LIST = Symbol("list");
|
|
4991
|
+
function List() {
|
|
4992
|
+
return Object.defineProperties([], {
|
|
4993
|
+
[_type]: { value: LIST }
|
|
4994
|
+
});
|
|
4995
|
+
}
|
|
4996
|
+
function isList(obj) {
|
|
4997
|
+
if (obj === null || typeof obj !== "object") return false;
|
|
4998
|
+
return obj[_type] === LIST;
|
|
4999
|
+
}
|
|
5000
|
+
var _custom;
|
|
5001
|
+
try {
|
|
5002
|
+
const utilInspect = eval("require('util').inspect");
|
|
5003
|
+
_custom = utilInspect.custom;
|
|
5004
|
+
} catch (_) {
|
|
5005
|
+
}
|
|
5006
|
+
var _inspect = _custom || "inspect";
|
|
5007
|
+
var BoxedBigInt = class {
|
|
5008
|
+
constructor(value) {
|
|
5009
|
+
try {
|
|
5010
|
+
this.value = global.BigInt.asIntN(64, value);
|
|
5011
|
+
} catch (_) {
|
|
5012
|
+
this.value = null;
|
|
5013
|
+
}
|
|
5014
|
+
Object.defineProperty(this, _type, { value: INTEGER });
|
|
5015
|
+
}
|
|
5016
|
+
isNaN() {
|
|
5017
|
+
return this.value === null;
|
|
5018
|
+
}
|
|
5019
|
+
/* istanbul ignore next */
|
|
5020
|
+
toString() {
|
|
5021
|
+
return String(this.value);
|
|
5022
|
+
}
|
|
5023
|
+
/* istanbul ignore next */
|
|
5024
|
+
[_inspect]() {
|
|
5025
|
+
return `[BigInt: ${this.toString()}]}`;
|
|
5026
|
+
}
|
|
5027
|
+
valueOf() {
|
|
5028
|
+
return this.value;
|
|
5029
|
+
}
|
|
5030
|
+
};
|
|
5031
|
+
var INTEGER = Symbol("integer");
|
|
5032
|
+
function Integer(value) {
|
|
5033
|
+
let num = Number(value);
|
|
5034
|
+
if (Object.is(num, -0)) num = 0;
|
|
5035
|
+
if (global.BigInt && !Number.isSafeInteger(num)) {
|
|
5036
|
+
return new BoxedBigInt(value);
|
|
5037
|
+
} else {
|
|
5038
|
+
return Object.defineProperties(new Number(num), {
|
|
5039
|
+
isNaN: { value: function() {
|
|
5040
|
+
return isNaN(this);
|
|
5041
|
+
} },
|
|
5042
|
+
[_type]: { value: INTEGER },
|
|
5043
|
+
[_inspect]: { value: () => `[Integer: ${value}]` }
|
|
5044
|
+
});
|
|
5045
|
+
}
|
|
5046
|
+
}
|
|
5047
|
+
function isInteger(obj) {
|
|
5048
|
+
if (obj === null || typeof obj !== "object") return false;
|
|
5049
|
+
return obj[_type] === INTEGER;
|
|
5050
|
+
}
|
|
5051
|
+
var FLOAT = Symbol("float");
|
|
5052
|
+
function Float(value) {
|
|
5053
|
+
return Object.defineProperties(new Number(value), {
|
|
5054
|
+
[_type]: { value: FLOAT },
|
|
5055
|
+
[_inspect]: { value: () => `[Float: ${value}]` }
|
|
5056
|
+
});
|
|
5057
|
+
}
|
|
5058
|
+
function isFloat(obj) {
|
|
5059
|
+
if (obj === null || typeof obj !== "object") return false;
|
|
5060
|
+
return obj[_type] === FLOAT;
|
|
5061
|
+
}
|
|
5062
|
+
function tomlType(value) {
|
|
5063
|
+
const type2 = typeof value;
|
|
5064
|
+
if (type2 === "object") {
|
|
5065
|
+
if (value === null) return "null";
|
|
5066
|
+
if (value instanceof Date) return "datetime";
|
|
5067
|
+
if (_type in value) {
|
|
5068
|
+
switch (value[_type]) {
|
|
5069
|
+
case INLINE_TABLE:
|
|
5070
|
+
return "inline-table";
|
|
5071
|
+
case INLINE_LIST:
|
|
5072
|
+
return "inline-list";
|
|
5073
|
+
/* istanbul ignore next */
|
|
5074
|
+
case TABLE:
|
|
5075
|
+
return "table";
|
|
5076
|
+
/* istanbul ignore next */
|
|
5077
|
+
case LIST:
|
|
5078
|
+
return "list";
|
|
5079
|
+
case FLOAT:
|
|
5080
|
+
return "float";
|
|
5081
|
+
case INTEGER:
|
|
5082
|
+
return "integer";
|
|
5083
|
+
}
|
|
5084
|
+
}
|
|
5085
|
+
}
|
|
5086
|
+
return type2;
|
|
5087
|
+
}
|
|
5088
|
+
function makeParserClass(Parser) {
|
|
5089
|
+
class TOMLParser extends Parser {
|
|
5090
|
+
constructor() {
|
|
5091
|
+
super();
|
|
5092
|
+
this.ctx = this.obj = Table();
|
|
5093
|
+
}
|
|
5094
|
+
/* MATCH HELPER */
|
|
5095
|
+
atEndOfWord() {
|
|
5096
|
+
return this.char === CHAR_NUM || this.char === CTRL_I || this.char === CHAR_SP || this.atEndOfLine();
|
|
5097
|
+
}
|
|
5098
|
+
atEndOfLine() {
|
|
5099
|
+
return this.char === Parser.END || this.char === CTRL_J || this.char === CTRL_M;
|
|
5100
|
+
}
|
|
5101
|
+
parseStart() {
|
|
5102
|
+
if (this.char === Parser.END) {
|
|
5103
|
+
return null;
|
|
5104
|
+
} else if (this.char === CHAR_LSQB) {
|
|
5105
|
+
return this.call(this.parseTableOrList);
|
|
5106
|
+
} else if (this.char === CHAR_NUM) {
|
|
5107
|
+
return this.call(this.parseComment);
|
|
5108
|
+
} else if (this.char === CTRL_J || this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M) {
|
|
5109
|
+
return null;
|
|
5110
|
+
} else if (isAlphaNumQuoteHyphen(this.char)) {
|
|
5111
|
+
return this.callNow(this.parseAssignStatement);
|
|
5112
|
+
} else {
|
|
5113
|
+
throw this.error(new TomlError(`Unknown character "${this.char}"`));
|
|
5114
|
+
}
|
|
5115
|
+
}
|
|
5116
|
+
// HELPER, this strips any whitespace and comments to the end of the line
|
|
5117
|
+
// then RETURNS. Last state in a production.
|
|
5118
|
+
parseWhitespaceToEOL() {
|
|
5119
|
+
if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M) {
|
|
5120
|
+
return null;
|
|
5121
|
+
} else if (this.char === CHAR_NUM) {
|
|
5122
|
+
return this.goto(this.parseComment);
|
|
5123
|
+
} else if (this.char === Parser.END || this.char === CTRL_J) {
|
|
5124
|
+
return this.return();
|
|
5125
|
+
} else {
|
|
5126
|
+
throw this.error(new TomlError("Unexpected character, expected only whitespace or comments till end of line"));
|
|
5127
|
+
}
|
|
5128
|
+
}
|
|
5129
|
+
/* ASSIGNMENT: key = value */
|
|
5130
|
+
parseAssignStatement() {
|
|
5131
|
+
return this.callNow(this.parseAssign, this.recordAssignStatement);
|
|
5132
|
+
}
|
|
5133
|
+
recordAssignStatement(kv) {
|
|
5134
|
+
let target = this.ctx;
|
|
5135
|
+
let finalKey = kv.key.pop();
|
|
5136
|
+
for (let kw of kv.key) {
|
|
5137
|
+
if (hasKey(target, kw) && (!isTable(target[kw]) || target[kw][_declared])) {
|
|
5138
|
+
throw this.error(new TomlError("Can't redefine existing key"));
|
|
5139
|
+
}
|
|
5140
|
+
target = target[kw] = target[kw] || Table();
|
|
5141
|
+
}
|
|
5142
|
+
if (hasKey(target, finalKey)) {
|
|
5143
|
+
throw this.error(new TomlError("Can't redefine existing key"));
|
|
5144
|
+
}
|
|
5145
|
+
if (isInteger(kv.value) || isFloat(kv.value)) {
|
|
5146
|
+
target[finalKey] = kv.value.valueOf();
|
|
5147
|
+
} else {
|
|
5148
|
+
target[finalKey] = kv.value;
|
|
5149
|
+
}
|
|
5150
|
+
return this.goto(this.parseWhitespaceToEOL);
|
|
5151
|
+
}
|
|
5152
|
+
/* ASSSIGNMENT expression, key = value possibly inside an inline table */
|
|
5153
|
+
parseAssign() {
|
|
5154
|
+
return this.callNow(this.parseKeyword, this.recordAssignKeyword);
|
|
5155
|
+
}
|
|
5156
|
+
recordAssignKeyword(key) {
|
|
5157
|
+
if (this.state.resultTable) {
|
|
5158
|
+
this.state.resultTable.push(key);
|
|
5159
|
+
} else {
|
|
5160
|
+
this.state.resultTable = [key];
|
|
5161
|
+
}
|
|
5162
|
+
return this.goto(this.parseAssignKeywordPreDot);
|
|
5163
|
+
}
|
|
5164
|
+
parseAssignKeywordPreDot() {
|
|
5165
|
+
if (this.char === CHAR_PERIOD) {
|
|
5166
|
+
return this.next(this.parseAssignKeywordPostDot);
|
|
5167
|
+
} else if (this.char !== CHAR_SP && this.char !== CTRL_I) {
|
|
5168
|
+
return this.goto(this.parseAssignEqual);
|
|
5169
|
+
}
|
|
5170
|
+
}
|
|
5171
|
+
parseAssignKeywordPostDot() {
|
|
5172
|
+
if (this.char !== CHAR_SP && this.char !== CTRL_I) {
|
|
5173
|
+
return this.callNow(this.parseKeyword, this.recordAssignKeyword);
|
|
5174
|
+
}
|
|
5175
|
+
}
|
|
5176
|
+
parseAssignEqual() {
|
|
5177
|
+
if (this.char === CHAR_EQUALS) {
|
|
5178
|
+
return this.next(this.parseAssignPreValue);
|
|
5179
|
+
} else {
|
|
5180
|
+
throw this.error(new TomlError('Invalid character, expected "="'));
|
|
5181
|
+
}
|
|
5182
|
+
}
|
|
5183
|
+
parseAssignPreValue() {
|
|
5184
|
+
if (this.char === CHAR_SP || this.char === CTRL_I) {
|
|
5185
|
+
return null;
|
|
5186
|
+
} else {
|
|
5187
|
+
return this.callNow(this.parseValue, this.recordAssignValue);
|
|
5188
|
+
}
|
|
5189
|
+
}
|
|
5190
|
+
recordAssignValue(value) {
|
|
5191
|
+
return this.returnNow({ key: this.state.resultTable, value });
|
|
5192
|
+
}
|
|
5193
|
+
/* COMMENTS: #...eol */
|
|
5194
|
+
parseComment() {
|
|
5195
|
+
do {
|
|
5196
|
+
if (this.char === Parser.END || this.char === CTRL_J) {
|
|
5197
|
+
return this.return();
|
|
5198
|
+
}
|
|
5199
|
+
} while (this.nextChar());
|
|
5200
|
+
}
|
|
5201
|
+
/* TABLES AND LISTS, [foo] and [[foo]] */
|
|
5202
|
+
parseTableOrList() {
|
|
5203
|
+
if (this.char === CHAR_LSQB) {
|
|
5204
|
+
this.next(this.parseList);
|
|
5205
|
+
} else {
|
|
5206
|
+
return this.goto(this.parseTable);
|
|
5207
|
+
}
|
|
5208
|
+
}
|
|
5209
|
+
/* TABLE [foo.bar.baz] */
|
|
5210
|
+
parseTable() {
|
|
5211
|
+
this.ctx = this.obj;
|
|
5212
|
+
return this.goto(this.parseTableNext);
|
|
5213
|
+
}
|
|
5214
|
+
parseTableNext() {
|
|
5215
|
+
if (this.char === CHAR_SP || this.char === CTRL_I) {
|
|
5216
|
+
return null;
|
|
5217
|
+
} else {
|
|
5218
|
+
return this.callNow(this.parseKeyword, this.parseTableMore);
|
|
5219
|
+
}
|
|
5220
|
+
}
|
|
5221
|
+
parseTableMore(keyword) {
|
|
5222
|
+
if (this.char === CHAR_SP || this.char === CTRL_I) {
|
|
5223
|
+
return null;
|
|
5224
|
+
} else if (this.char === CHAR_RSQB) {
|
|
5225
|
+
if (hasKey(this.ctx, keyword) && (!isTable(this.ctx[keyword]) || this.ctx[keyword][_declared])) {
|
|
5226
|
+
throw this.error(new TomlError("Can't redefine existing key"));
|
|
5227
|
+
} else {
|
|
5228
|
+
this.ctx = this.ctx[keyword] = this.ctx[keyword] || Table();
|
|
5229
|
+
this.ctx[_declared] = true;
|
|
5230
|
+
}
|
|
5231
|
+
return this.next(this.parseWhitespaceToEOL);
|
|
5232
|
+
} else if (this.char === CHAR_PERIOD) {
|
|
5233
|
+
if (!hasKey(this.ctx, keyword)) {
|
|
5234
|
+
this.ctx = this.ctx[keyword] = Table();
|
|
5235
|
+
} else if (isTable(this.ctx[keyword])) {
|
|
5236
|
+
this.ctx = this.ctx[keyword];
|
|
5237
|
+
} else if (isList(this.ctx[keyword])) {
|
|
5238
|
+
this.ctx = this.ctx[keyword][this.ctx[keyword].length - 1];
|
|
5239
|
+
} else {
|
|
5240
|
+
throw this.error(new TomlError("Can't redefine existing key"));
|
|
5241
|
+
}
|
|
5242
|
+
return this.next(this.parseTableNext);
|
|
5243
|
+
} else {
|
|
5244
|
+
throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"));
|
|
5245
|
+
}
|
|
5246
|
+
}
|
|
5247
|
+
/* LIST [[a.b.c]] */
|
|
5248
|
+
parseList() {
|
|
5249
|
+
this.ctx = this.obj;
|
|
5250
|
+
return this.goto(this.parseListNext);
|
|
5251
|
+
}
|
|
5252
|
+
parseListNext() {
|
|
5253
|
+
if (this.char === CHAR_SP || this.char === CTRL_I) {
|
|
5254
|
+
return null;
|
|
5255
|
+
} else {
|
|
5256
|
+
return this.callNow(this.parseKeyword, this.parseListMore);
|
|
5257
|
+
}
|
|
5258
|
+
}
|
|
5259
|
+
parseListMore(keyword) {
|
|
5260
|
+
if (this.char === CHAR_SP || this.char === CTRL_I) {
|
|
5261
|
+
return null;
|
|
5262
|
+
} else if (this.char === CHAR_RSQB) {
|
|
5263
|
+
if (!hasKey(this.ctx, keyword)) {
|
|
5264
|
+
this.ctx[keyword] = List();
|
|
5265
|
+
}
|
|
5266
|
+
if (isInlineList(this.ctx[keyword])) {
|
|
5267
|
+
throw this.error(new TomlError("Can't extend an inline array"));
|
|
5268
|
+
} else if (isList(this.ctx[keyword])) {
|
|
5269
|
+
const next = Table();
|
|
5270
|
+
this.ctx[keyword].push(next);
|
|
5271
|
+
this.ctx = next;
|
|
5272
|
+
} else {
|
|
5273
|
+
throw this.error(new TomlError("Can't redefine an existing key"));
|
|
5274
|
+
}
|
|
5275
|
+
return this.next(this.parseListEnd);
|
|
5276
|
+
} else if (this.char === CHAR_PERIOD) {
|
|
5277
|
+
if (!hasKey(this.ctx, keyword)) {
|
|
5278
|
+
this.ctx = this.ctx[keyword] = Table();
|
|
5279
|
+
} else if (isInlineList(this.ctx[keyword])) {
|
|
5280
|
+
throw this.error(new TomlError("Can't extend an inline array"));
|
|
5281
|
+
} else if (isInlineTable(this.ctx[keyword])) {
|
|
5282
|
+
throw this.error(new TomlError("Can't extend an inline table"));
|
|
5283
|
+
} else if (isList(this.ctx[keyword])) {
|
|
5284
|
+
this.ctx = this.ctx[keyword][this.ctx[keyword].length - 1];
|
|
5285
|
+
} else if (isTable(this.ctx[keyword])) {
|
|
5286
|
+
this.ctx = this.ctx[keyword];
|
|
5287
|
+
} else {
|
|
5288
|
+
throw this.error(new TomlError("Can't redefine an existing key"));
|
|
5289
|
+
}
|
|
5290
|
+
return this.next(this.parseListNext);
|
|
5291
|
+
} else {
|
|
5292
|
+
throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"));
|
|
5293
|
+
}
|
|
5294
|
+
}
|
|
5295
|
+
parseListEnd(keyword) {
|
|
5296
|
+
if (this.char === CHAR_RSQB) {
|
|
5297
|
+
return this.next(this.parseWhitespaceToEOL);
|
|
5298
|
+
} else {
|
|
5299
|
+
throw this.error(new TomlError("Unexpected character, expected whitespace, . or ]"));
|
|
5300
|
+
}
|
|
5301
|
+
}
|
|
5302
|
+
/* VALUE string, number, boolean, inline list, inline object */
|
|
5303
|
+
parseValue() {
|
|
5304
|
+
if (this.char === Parser.END) {
|
|
5305
|
+
throw this.error(new TomlError("Key without value"));
|
|
5306
|
+
} else if (this.char === CHAR_QUOT) {
|
|
5307
|
+
return this.next(this.parseDoubleString);
|
|
5308
|
+
}
|
|
5309
|
+
if (this.char === CHAR_APOS) {
|
|
5310
|
+
return this.next(this.parseSingleString);
|
|
5311
|
+
} else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) {
|
|
5312
|
+
return this.goto(this.parseNumberSign);
|
|
5313
|
+
} else if (this.char === CHAR_i) {
|
|
5314
|
+
return this.next(this.parseInf);
|
|
5315
|
+
} else if (this.char === CHAR_n) {
|
|
5316
|
+
return this.next(this.parseNan);
|
|
5317
|
+
} else if (isDigit(this.char)) {
|
|
5318
|
+
return this.goto(this.parseNumberOrDateTime);
|
|
5319
|
+
} else if (this.char === CHAR_t || this.char === CHAR_f) {
|
|
5320
|
+
return this.goto(this.parseBoolean);
|
|
5321
|
+
} else if (this.char === CHAR_LSQB) {
|
|
5322
|
+
return this.call(this.parseInlineList, this.recordValue);
|
|
5323
|
+
} else if (this.char === CHAR_LCUB) {
|
|
5324
|
+
return this.call(this.parseInlineTable, this.recordValue);
|
|
5325
|
+
} else {
|
|
5326
|
+
throw this.error(new TomlError("Unexpected character, expecting string, number, datetime, boolean, inline array or inline table"));
|
|
5327
|
+
}
|
|
5328
|
+
}
|
|
5329
|
+
recordValue(value) {
|
|
5330
|
+
return this.returnNow(value);
|
|
5331
|
+
}
|
|
5332
|
+
parseInf() {
|
|
5333
|
+
if (this.char === CHAR_n) {
|
|
5334
|
+
return this.next(this.parseInf2);
|
|
5335
|
+
} else {
|
|
5336
|
+
throw this.error(new TomlError('Unexpected character, expected "inf", "+inf" or "-inf"'));
|
|
5337
|
+
}
|
|
5338
|
+
}
|
|
5339
|
+
parseInf2() {
|
|
5340
|
+
if (this.char === CHAR_f) {
|
|
5341
|
+
if (this.state.buf === "-") {
|
|
5342
|
+
return this.return(-Infinity);
|
|
5343
|
+
} else {
|
|
5344
|
+
return this.return(Infinity);
|
|
5345
|
+
}
|
|
5346
|
+
} else {
|
|
5347
|
+
throw this.error(new TomlError('Unexpected character, expected "inf", "+inf" or "-inf"'));
|
|
5348
|
+
}
|
|
5349
|
+
}
|
|
5350
|
+
parseNan() {
|
|
5351
|
+
if (this.char === CHAR_a) {
|
|
5352
|
+
return this.next(this.parseNan2);
|
|
5353
|
+
} else {
|
|
5354
|
+
throw this.error(new TomlError('Unexpected character, expected "nan"'));
|
|
5355
|
+
}
|
|
5356
|
+
}
|
|
5357
|
+
parseNan2() {
|
|
5358
|
+
if (this.char === CHAR_n) {
|
|
5359
|
+
return this.return(NaN);
|
|
5360
|
+
} else {
|
|
5361
|
+
throw this.error(new TomlError('Unexpected character, expected "nan"'));
|
|
5362
|
+
}
|
|
5363
|
+
}
|
|
5364
|
+
/* KEYS, barewords or basic, literal, or dotted */
|
|
5365
|
+
parseKeyword() {
|
|
5366
|
+
if (this.char === CHAR_QUOT) {
|
|
5367
|
+
return this.next(this.parseBasicString);
|
|
5368
|
+
} else if (this.char === CHAR_APOS) {
|
|
5369
|
+
return this.next(this.parseLiteralString);
|
|
5370
|
+
} else {
|
|
5371
|
+
return this.goto(this.parseBareKey);
|
|
5372
|
+
}
|
|
5373
|
+
}
|
|
5374
|
+
/* KEYS: barewords */
|
|
5375
|
+
parseBareKey() {
|
|
5376
|
+
do {
|
|
5377
|
+
if (this.char === Parser.END) {
|
|
5378
|
+
throw this.error(new TomlError("Key ended without value"));
|
|
5379
|
+
} else if (isAlphaNumHyphen(this.char)) {
|
|
5380
|
+
this.consume();
|
|
5381
|
+
} else if (this.state.buf.length === 0) {
|
|
5382
|
+
throw this.error(new TomlError("Empty bare keys are not allowed"));
|
|
5383
|
+
} else {
|
|
5384
|
+
return this.returnNow();
|
|
5385
|
+
}
|
|
5386
|
+
} while (this.nextChar());
|
|
5387
|
+
}
|
|
5388
|
+
/* STRINGS, single quoted (literal) */
|
|
5389
|
+
parseSingleString() {
|
|
5390
|
+
if (this.char === CHAR_APOS) {
|
|
5391
|
+
return this.next(this.parseLiteralMultiStringMaybe);
|
|
5392
|
+
} else {
|
|
5393
|
+
return this.goto(this.parseLiteralString);
|
|
5394
|
+
}
|
|
5395
|
+
}
|
|
5396
|
+
parseLiteralString() {
|
|
5397
|
+
do {
|
|
5398
|
+
if (this.char === CHAR_APOS) {
|
|
5399
|
+
return this.return();
|
|
5400
|
+
} else if (this.atEndOfLine()) {
|
|
5401
|
+
throw this.error(new TomlError("Unterminated string"));
|
|
5402
|
+
} else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I) {
|
|
5403
|
+
throw this.errorControlCharInString();
|
|
5404
|
+
} else {
|
|
5405
|
+
this.consume();
|
|
5406
|
+
}
|
|
5407
|
+
} while (this.nextChar());
|
|
5408
|
+
}
|
|
5409
|
+
parseLiteralMultiStringMaybe() {
|
|
5410
|
+
if (this.char === CHAR_APOS) {
|
|
5411
|
+
return this.next(this.parseLiteralMultiString);
|
|
5412
|
+
} else {
|
|
5413
|
+
return this.returnNow();
|
|
5414
|
+
}
|
|
5415
|
+
}
|
|
5416
|
+
parseLiteralMultiString() {
|
|
5417
|
+
if (this.char === CTRL_M) {
|
|
5418
|
+
return null;
|
|
5419
|
+
} else if (this.char === CTRL_J) {
|
|
5420
|
+
return this.next(this.parseLiteralMultiStringContent);
|
|
5421
|
+
} else {
|
|
5422
|
+
return this.goto(this.parseLiteralMultiStringContent);
|
|
5423
|
+
}
|
|
5424
|
+
}
|
|
5425
|
+
parseLiteralMultiStringContent() {
|
|
5426
|
+
do {
|
|
5427
|
+
if (this.char === CHAR_APOS) {
|
|
5428
|
+
return this.next(this.parseLiteralMultiEnd);
|
|
5429
|
+
} else if (this.char === Parser.END) {
|
|
5430
|
+
throw this.error(new TomlError("Unterminated multi-line string"));
|
|
5431
|
+
} else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I && this.char !== CTRL_J && this.char !== CTRL_M) {
|
|
5432
|
+
throw this.errorControlCharInString();
|
|
5433
|
+
} else {
|
|
5434
|
+
this.consume();
|
|
5435
|
+
}
|
|
5436
|
+
} while (this.nextChar());
|
|
5437
|
+
}
|
|
5438
|
+
parseLiteralMultiEnd() {
|
|
5439
|
+
if (this.char === CHAR_APOS) {
|
|
5440
|
+
return this.next(this.parseLiteralMultiEnd2);
|
|
5441
|
+
} else {
|
|
5442
|
+
this.state.buf += "'";
|
|
5443
|
+
return this.goto(this.parseLiteralMultiStringContent);
|
|
5444
|
+
}
|
|
5445
|
+
}
|
|
5446
|
+
parseLiteralMultiEnd2() {
|
|
5447
|
+
if (this.char === CHAR_APOS) {
|
|
5448
|
+
return this.return();
|
|
5449
|
+
} else {
|
|
5450
|
+
this.state.buf += "''";
|
|
5451
|
+
return this.goto(this.parseLiteralMultiStringContent);
|
|
5452
|
+
}
|
|
5453
|
+
}
|
|
5454
|
+
/* STRINGS double quoted */
|
|
5455
|
+
parseDoubleString() {
|
|
5456
|
+
if (this.char === CHAR_QUOT) {
|
|
5457
|
+
return this.next(this.parseMultiStringMaybe);
|
|
5458
|
+
} else {
|
|
5459
|
+
return this.goto(this.parseBasicString);
|
|
5460
|
+
}
|
|
5461
|
+
}
|
|
5462
|
+
parseBasicString() {
|
|
5463
|
+
do {
|
|
5464
|
+
if (this.char === CHAR_BSOL) {
|
|
5465
|
+
return this.call(this.parseEscape, this.recordEscapeReplacement);
|
|
5466
|
+
} else if (this.char === CHAR_QUOT) {
|
|
5467
|
+
return this.return();
|
|
5468
|
+
} else if (this.atEndOfLine()) {
|
|
5469
|
+
throw this.error(new TomlError("Unterminated string"));
|
|
5470
|
+
} else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I) {
|
|
5471
|
+
throw this.errorControlCharInString();
|
|
5472
|
+
} else {
|
|
5473
|
+
this.consume();
|
|
5474
|
+
}
|
|
5475
|
+
} while (this.nextChar());
|
|
5476
|
+
}
|
|
5477
|
+
recordEscapeReplacement(replacement) {
|
|
5478
|
+
this.state.buf += replacement;
|
|
5479
|
+
return this.goto(this.parseBasicString);
|
|
5480
|
+
}
|
|
5481
|
+
parseMultiStringMaybe() {
|
|
5482
|
+
if (this.char === CHAR_QUOT) {
|
|
5483
|
+
return this.next(this.parseMultiString);
|
|
5484
|
+
} else {
|
|
5485
|
+
return this.returnNow();
|
|
5486
|
+
}
|
|
5487
|
+
}
|
|
5488
|
+
parseMultiString() {
|
|
5489
|
+
if (this.char === CTRL_M) {
|
|
5490
|
+
return null;
|
|
5491
|
+
} else if (this.char === CTRL_J) {
|
|
5492
|
+
return this.next(this.parseMultiStringContent);
|
|
5493
|
+
} else {
|
|
5494
|
+
return this.goto(this.parseMultiStringContent);
|
|
5495
|
+
}
|
|
5496
|
+
}
|
|
5497
|
+
parseMultiStringContent() {
|
|
5498
|
+
do {
|
|
5499
|
+
if (this.char === CHAR_BSOL) {
|
|
5500
|
+
return this.call(this.parseMultiEscape, this.recordMultiEscapeReplacement);
|
|
5501
|
+
} else if (this.char === CHAR_QUOT) {
|
|
5502
|
+
return this.next(this.parseMultiEnd);
|
|
5503
|
+
} else if (this.char === Parser.END) {
|
|
5504
|
+
throw this.error(new TomlError("Unterminated multi-line string"));
|
|
5505
|
+
} else if (this.char === CHAR_DEL || this.char <= CTRL_CHAR_BOUNDARY && this.char !== CTRL_I && this.char !== CTRL_J && this.char !== CTRL_M) {
|
|
5506
|
+
throw this.errorControlCharInString();
|
|
5507
|
+
} else {
|
|
5508
|
+
this.consume();
|
|
5509
|
+
}
|
|
5510
|
+
} while (this.nextChar());
|
|
5511
|
+
}
|
|
5512
|
+
errorControlCharInString() {
|
|
5513
|
+
let displayCode = "\\u00";
|
|
5514
|
+
if (this.char < 16) {
|
|
5515
|
+
displayCode += "0";
|
|
5516
|
+
}
|
|
5517
|
+
displayCode += this.char.toString(16);
|
|
5518
|
+
return this.error(new TomlError(`Control characters (codes < 0x1f and 0x7f) are not allowed in strings, use ${displayCode} instead`));
|
|
5519
|
+
}
|
|
5520
|
+
recordMultiEscapeReplacement(replacement) {
|
|
5521
|
+
this.state.buf += replacement;
|
|
5522
|
+
return this.goto(this.parseMultiStringContent);
|
|
5523
|
+
}
|
|
5524
|
+
parseMultiEnd() {
|
|
5525
|
+
if (this.char === CHAR_QUOT) {
|
|
5526
|
+
return this.next(this.parseMultiEnd2);
|
|
5527
|
+
} else {
|
|
5528
|
+
this.state.buf += '"';
|
|
5529
|
+
return this.goto(this.parseMultiStringContent);
|
|
5530
|
+
}
|
|
5531
|
+
}
|
|
5532
|
+
parseMultiEnd2() {
|
|
5533
|
+
if (this.char === CHAR_QUOT) {
|
|
5534
|
+
return this.return();
|
|
5535
|
+
} else {
|
|
5536
|
+
this.state.buf += '""';
|
|
5537
|
+
return this.goto(this.parseMultiStringContent);
|
|
5538
|
+
}
|
|
5539
|
+
}
|
|
5540
|
+
parseMultiEscape() {
|
|
5541
|
+
if (this.char === CTRL_M || this.char === CTRL_J) {
|
|
5542
|
+
return this.next(this.parseMultiTrim);
|
|
5543
|
+
} else if (this.char === CHAR_SP || this.char === CTRL_I) {
|
|
5544
|
+
return this.next(this.parsePreMultiTrim);
|
|
5545
|
+
} else {
|
|
5546
|
+
return this.goto(this.parseEscape);
|
|
5547
|
+
}
|
|
5548
|
+
}
|
|
5549
|
+
parsePreMultiTrim() {
|
|
5550
|
+
if (this.char === CHAR_SP || this.char === CTRL_I) {
|
|
5551
|
+
return null;
|
|
5552
|
+
} else if (this.char === CTRL_M || this.char === CTRL_J) {
|
|
5553
|
+
return this.next(this.parseMultiTrim);
|
|
5554
|
+
} else {
|
|
5555
|
+
throw this.error(new TomlError("Can't escape whitespace"));
|
|
5556
|
+
}
|
|
5557
|
+
}
|
|
5558
|
+
parseMultiTrim() {
|
|
5559
|
+
if (this.char === CTRL_J || this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M) {
|
|
5560
|
+
return null;
|
|
5561
|
+
} else {
|
|
5562
|
+
return this.returnNow();
|
|
5563
|
+
}
|
|
5564
|
+
}
|
|
5565
|
+
parseEscape() {
|
|
5566
|
+
if (this.char in escapes) {
|
|
5567
|
+
return this.return(escapes[this.char]);
|
|
5568
|
+
} else if (this.char === CHAR_u) {
|
|
5569
|
+
return this.call(this.parseSmallUnicode, this.parseUnicodeReturn);
|
|
5570
|
+
} else if (this.char === CHAR_U) {
|
|
5571
|
+
return this.call(this.parseLargeUnicode, this.parseUnicodeReturn);
|
|
5572
|
+
} else {
|
|
5573
|
+
throw this.error(new TomlError("Unknown escape character: " + this.char));
|
|
5574
|
+
}
|
|
5575
|
+
}
|
|
5576
|
+
parseUnicodeReturn(char) {
|
|
5577
|
+
try {
|
|
5578
|
+
const codePoint = parseInt(char, 16);
|
|
5579
|
+
if (codePoint >= SURROGATE_FIRST && codePoint <= SURROGATE_LAST) {
|
|
5580
|
+
throw this.error(new TomlError("Invalid unicode, character in range 0xD800 - 0xDFFF is reserved"));
|
|
5581
|
+
}
|
|
5582
|
+
return this.returnNow(String.fromCodePoint(codePoint));
|
|
5583
|
+
} catch (err) {
|
|
5584
|
+
throw this.error(TomlError.wrap(err));
|
|
5585
|
+
}
|
|
5586
|
+
}
|
|
5587
|
+
parseSmallUnicode() {
|
|
5588
|
+
if (!isHexit(this.char)) {
|
|
5589
|
+
throw this.error(new TomlError("Invalid character in unicode sequence, expected hex"));
|
|
5590
|
+
} else {
|
|
5591
|
+
this.consume();
|
|
5592
|
+
if (this.state.buf.length >= 4) return this.return();
|
|
5593
|
+
}
|
|
5594
|
+
}
|
|
5595
|
+
parseLargeUnicode() {
|
|
5596
|
+
if (!isHexit(this.char)) {
|
|
5597
|
+
throw this.error(new TomlError("Invalid character in unicode sequence, expected hex"));
|
|
5598
|
+
} else {
|
|
5599
|
+
this.consume();
|
|
5600
|
+
if (this.state.buf.length >= 8) return this.return();
|
|
5601
|
+
}
|
|
5602
|
+
}
|
|
5603
|
+
/* NUMBERS */
|
|
5604
|
+
parseNumberSign() {
|
|
5605
|
+
this.consume();
|
|
5606
|
+
return this.next(this.parseMaybeSignedInfOrNan);
|
|
5607
|
+
}
|
|
5608
|
+
parseMaybeSignedInfOrNan() {
|
|
5609
|
+
if (this.char === CHAR_i) {
|
|
5610
|
+
return this.next(this.parseInf);
|
|
5611
|
+
} else if (this.char === CHAR_n) {
|
|
5612
|
+
return this.next(this.parseNan);
|
|
5613
|
+
} else {
|
|
5614
|
+
return this.callNow(this.parseNoUnder, this.parseNumberIntegerStart);
|
|
5615
|
+
}
|
|
5616
|
+
}
|
|
5617
|
+
parseNumberIntegerStart() {
|
|
5618
|
+
if (this.char === CHAR_0) {
|
|
5619
|
+
this.consume();
|
|
5620
|
+
return this.next(this.parseNumberIntegerExponentOrDecimal);
|
|
5621
|
+
} else {
|
|
5622
|
+
return this.goto(this.parseNumberInteger);
|
|
5623
|
+
}
|
|
5624
|
+
}
|
|
5625
|
+
parseNumberIntegerExponentOrDecimal() {
|
|
5626
|
+
if (this.char === CHAR_PERIOD) {
|
|
5627
|
+
this.consume();
|
|
5628
|
+
return this.call(this.parseNoUnder, this.parseNumberFloat);
|
|
5629
|
+
} else if (this.char === CHAR_E || this.char === CHAR_e) {
|
|
5630
|
+
this.consume();
|
|
5631
|
+
return this.next(this.parseNumberExponentSign);
|
|
5632
|
+
} else {
|
|
5633
|
+
return this.returnNow(Integer(this.state.buf));
|
|
5634
|
+
}
|
|
5635
|
+
}
|
|
5636
|
+
parseNumberInteger() {
|
|
5637
|
+
if (isDigit(this.char)) {
|
|
5638
|
+
this.consume();
|
|
5639
|
+
} else if (this.char === CHAR_LOWBAR) {
|
|
5640
|
+
return this.call(this.parseNoUnder);
|
|
5641
|
+
} else if (this.char === CHAR_E || this.char === CHAR_e) {
|
|
5642
|
+
this.consume();
|
|
5643
|
+
return this.next(this.parseNumberExponentSign);
|
|
5644
|
+
} else if (this.char === CHAR_PERIOD) {
|
|
5645
|
+
this.consume();
|
|
5646
|
+
return this.call(this.parseNoUnder, this.parseNumberFloat);
|
|
5647
|
+
} else {
|
|
5648
|
+
const result = Integer(this.state.buf);
|
|
5649
|
+
if (result.isNaN()) {
|
|
5650
|
+
throw this.error(new TomlError("Invalid number"));
|
|
5651
|
+
} else {
|
|
5652
|
+
return this.returnNow(result);
|
|
5653
|
+
}
|
|
5654
|
+
}
|
|
5655
|
+
}
|
|
5656
|
+
parseNoUnder() {
|
|
5657
|
+
if (this.char === CHAR_LOWBAR || this.char === CHAR_PERIOD || this.char === CHAR_E || this.char === CHAR_e) {
|
|
5658
|
+
throw this.error(new TomlError("Unexpected character, expected digit"));
|
|
5659
|
+
} else if (this.atEndOfWord()) {
|
|
5660
|
+
throw this.error(new TomlError("Incomplete number"));
|
|
5661
|
+
}
|
|
5662
|
+
return this.returnNow();
|
|
5663
|
+
}
|
|
5664
|
+
parseNoUnderHexOctBinLiteral() {
|
|
5665
|
+
if (this.char === CHAR_LOWBAR || this.char === CHAR_PERIOD) {
|
|
5666
|
+
throw this.error(new TomlError("Unexpected character, expected digit"));
|
|
5667
|
+
} else if (this.atEndOfWord()) {
|
|
5668
|
+
throw this.error(new TomlError("Incomplete number"));
|
|
5669
|
+
}
|
|
5670
|
+
return this.returnNow();
|
|
5671
|
+
}
|
|
5672
|
+
parseNumberFloat() {
|
|
5673
|
+
if (this.char === CHAR_LOWBAR) {
|
|
5674
|
+
return this.call(this.parseNoUnder, this.parseNumberFloat);
|
|
5675
|
+
} else if (isDigit(this.char)) {
|
|
5676
|
+
this.consume();
|
|
5677
|
+
} else if (this.char === CHAR_E || this.char === CHAR_e) {
|
|
5678
|
+
this.consume();
|
|
5679
|
+
return this.next(this.parseNumberExponentSign);
|
|
5680
|
+
} else {
|
|
5681
|
+
return this.returnNow(Float(this.state.buf));
|
|
5682
|
+
}
|
|
5683
|
+
}
|
|
5684
|
+
parseNumberExponentSign() {
|
|
5685
|
+
if (isDigit(this.char)) {
|
|
5686
|
+
return this.goto(this.parseNumberExponent);
|
|
5687
|
+
} else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) {
|
|
5688
|
+
this.consume();
|
|
5689
|
+
this.call(this.parseNoUnder, this.parseNumberExponent);
|
|
5690
|
+
} else {
|
|
5691
|
+
throw this.error(new TomlError("Unexpected character, expected -, + or digit"));
|
|
5692
|
+
}
|
|
5693
|
+
}
|
|
5694
|
+
parseNumberExponent() {
|
|
5695
|
+
if (isDigit(this.char)) {
|
|
5696
|
+
this.consume();
|
|
5697
|
+
} else if (this.char === CHAR_LOWBAR) {
|
|
5698
|
+
return this.call(this.parseNoUnder);
|
|
5699
|
+
} else {
|
|
5700
|
+
return this.returnNow(Float(this.state.buf));
|
|
5701
|
+
}
|
|
5702
|
+
}
|
|
5703
|
+
/* NUMBERS or DATETIMES */
|
|
5704
|
+
parseNumberOrDateTime() {
|
|
5705
|
+
if (this.char === CHAR_0) {
|
|
5706
|
+
this.consume();
|
|
5707
|
+
return this.next(this.parseNumberBaseOrDateTime);
|
|
5708
|
+
} else {
|
|
5709
|
+
return this.goto(this.parseNumberOrDateTimeOnly);
|
|
5710
|
+
}
|
|
5711
|
+
}
|
|
5712
|
+
parseNumberOrDateTimeOnly() {
|
|
5713
|
+
if (this.char === CHAR_LOWBAR) {
|
|
5714
|
+
return this.call(this.parseNoUnder, this.parseNumberInteger);
|
|
5715
|
+
} else if (isDigit(this.char)) {
|
|
5716
|
+
this.consume();
|
|
5717
|
+
if (this.state.buf.length > 4) this.next(this.parseNumberInteger);
|
|
5718
|
+
} else if (this.char === CHAR_E || this.char === CHAR_e) {
|
|
5719
|
+
this.consume();
|
|
5720
|
+
return this.next(this.parseNumberExponentSign);
|
|
5721
|
+
} else if (this.char === CHAR_PERIOD) {
|
|
5722
|
+
this.consume();
|
|
5723
|
+
return this.call(this.parseNoUnder, this.parseNumberFloat);
|
|
5724
|
+
} else if (this.char === CHAR_HYPHEN) {
|
|
5725
|
+
return this.goto(this.parseDateTime);
|
|
5726
|
+
} else if (this.char === CHAR_COLON) {
|
|
5727
|
+
return this.goto(this.parseOnlyTimeHour);
|
|
5728
|
+
} else {
|
|
5729
|
+
return this.returnNow(Integer(this.state.buf));
|
|
5730
|
+
}
|
|
5731
|
+
}
|
|
5732
|
+
parseDateTimeOnly() {
|
|
5733
|
+
if (this.state.buf.length < 4) {
|
|
5734
|
+
if (isDigit(this.char)) {
|
|
5735
|
+
return this.consume();
|
|
5736
|
+
} else if (this.char === CHAR_COLON) {
|
|
5737
|
+
return this.goto(this.parseOnlyTimeHour);
|
|
5738
|
+
} else {
|
|
5739
|
+
throw this.error(new TomlError("Expected digit while parsing year part of a date"));
|
|
5740
|
+
}
|
|
5741
|
+
} else {
|
|
5742
|
+
if (this.char === CHAR_HYPHEN) {
|
|
5743
|
+
return this.goto(this.parseDateTime);
|
|
5744
|
+
} else {
|
|
5745
|
+
throw this.error(new TomlError("Expected hyphen (-) while parsing year part of date"));
|
|
5746
|
+
}
|
|
5747
|
+
}
|
|
5748
|
+
}
|
|
5749
|
+
parseNumberBaseOrDateTime() {
|
|
5750
|
+
if (this.char === CHAR_b) {
|
|
5751
|
+
this.consume();
|
|
5752
|
+
return this.call(this.parseNoUnderHexOctBinLiteral, this.parseIntegerBin);
|
|
5753
|
+
} else if (this.char === CHAR_o) {
|
|
5754
|
+
this.consume();
|
|
5755
|
+
return this.call(this.parseNoUnderHexOctBinLiteral, this.parseIntegerOct);
|
|
5756
|
+
} else if (this.char === CHAR_x) {
|
|
5757
|
+
this.consume();
|
|
5758
|
+
return this.call(this.parseNoUnderHexOctBinLiteral, this.parseIntegerHex);
|
|
5759
|
+
} else if (this.char === CHAR_PERIOD) {
|
|
5760
|
+
return this.goto(this.parseNumberInteger);
|
|
5761
|
+
} else if (isDigit(this.char)) {
|
|
5762
|
+
return this.goto(this.parseDateTimeOnly);
|
|
5763
|
+
} else {
|
|
5764
|
+
return this.returnNow(Integer(this.state.buf));
|
|
5765
|
+
}
|
|
5766
|
+
}
|
|
5767
|
+
parseIntegerHex() {
|
|
5768
|
+
if (isHexit(this.char)) {
|
|
5769
|
+
this.consume();
|
|
5770
|
+
} else if (this.char === CHAR_LOWBAR) {
|
|
5771
|
+
return this.call(this.parseNoUnderHexOctBinLiteral);
|
|
5772
|
+
} else {
|
|
5773
|
+
const result = Integer(this.state.buf);
|
|
5774
|
+
if (result.isNaN()) {
|
|
5775
|
+
throw this.error(new TomlError("Invalid number"));
|
|
5776
|
+
} else {
|
|
5777
|
+
return this.returnNow(result);
|
|
5778
|
+
}
|
|
5779
|
+
}
|
|
5780
|
+
}
|
|
5781
|
+
parseIntegerOct() {
|
|
5782
|
+
if (isOctit(this.char)) {
|
|
5783
|
+
this.consume();
|
|
5784
|
+
} else if (this.char === CHAR_LOWBAR) {
|
|
5785
|
+
return this.call(this.parseNoUnderHexOctBinLiteral);
|
|
5786
|
+
} else {
|
|
5787
|
+
const result = Integer(this.state.buf);
|
|
5788
|
+
if (result.isNaN()) {
|
|
5789
|
+
throw this.error(new TomlError("Invalid number"));
|
|
5790
|
+
} else {
|
|
5791
|
+
return this.returnNow(result);
|
|
5792
|
+
}
|
|
5793
|
+
}
|
|
5794
|
+
}
|
|
5795
|
+
parseIntegerBin() {
|
|
5796
|
+
if (isBit(this.char)) {
|
|
5797
|
+
this.consume();
|
|
5798
|
+
} else if (this.char === CHAR_LOWBAR) {
|
|
5799
|
+
return this.call(this.parseNoUnderHexOctBinLiteral);
|
|
5800
|
+
} else {
|
|
5801
|
+
const result = Integer(this.state.buf);
|
|
5802
|
+
if (result.isNaN()) {
|
|
5803
|
+
throw this.error(new TomlError("Invalid number"));
|
|
5804
|
+
} else {
|
|
5805
|
+
return this.returnNow(result);
|
|
5806
|
+
}
|
|
5807
|
+
}
|
|
5808
|
+
}
|
|
5809
|
+
/* DATETIME */
|
|
5810
|
+
parseDateTime() {
|
|
5811
|
+
if (this.state.buf.length < 4) {
|
|
5812
|
+
throw this.error(new TomlError("Years less than 1000 must be zero padded to four characters"));
|
|
5813
|
+
}
|
|
5814
|
+
this.state.result = this.state.buf;
|
|
5815
|
+
this.state.buf = "";
|
|
5816
|
+
return this.next(this.parseDateMonth);
|
|
5817
|
+
}
|
|
5818
|
+
parseDateMonth() {
|
|
5819
|
+
if (this.char === CHAR_HYPHEN) {
|
|
5820
|
+
if (this.state.buf.length < 2) {
|
|
5821
|
+
throw this.error(new TomlError("Months less than 10 must be zero padded to two characters"));
|
|
5822
|
+
}
|
|
5823
|
+
this.state.result += "-" + this.state.buf;
|
|
5824
|
+
this.state.buf = "";
|
|
5825
|
+
return this.next(this.parseDateDay);
|
|
5826
|
+
} else if (isDigit(this.char)) {
|
|
5827
|
+
this.consume();
|
|
5828
|
+
} else {
|
|
5829
|
+
throw this.error(new TomlError("Incomplete datetime"));
|
|
5830
|
+
}
|
|
5831
|
+
}
|
|
5832
|
+
parseDateDay() {
|
|
5833
|
+
if (this.char === CHAR_T || this.char === CHAR_SP) {
|
|
5834
|
+
if (this.state.buf.length < 2) {
|
|
5835
|
+
throw this.error(new TomlError("Days less than 10 must be zero padded to two characters"));
|
|
5836
|
+
}
|
|
5837
|
+
this.state.result += "-" + this.state.buf;
|
|
5838
|
+
this.state.buf = "";
|
|
5839
|
+
return this.next(this.parseStartTimeHour);
|
|
5840
|
+
} else if (this.atEndOfWord()) {
|
|
5841
|
+
return this.returnNow(createDate(this.state.result + "-" + this.state.buf));
|
|
5842
|
+
} else if (isDigit(this.char)) {
|
|
5843
|
+
this.consume();
|
|
5844
|
+
} else {
|
|
5845
|
+
throw this.error(new TomlError("Incomplete datetime"));
|
|
5846
|
+
}
|
|
5847
|
+
}
|
|
5848
|
+
parseStartTimeHour() {
|
|
5849
|
+
if (this.atEndOfWord()) {
|
|
5850
|
+
return this.returnNow(createDate(this.state.result));
|
|
5851
|
+
} else {
|
|
5852
|
+
return this.goto(this.parseTimeHour);
|
|
5853
|
+
}
|
|
5854
|
+
}
|
|
5855
|
+
parseTimeHour() {
|
|
5856
|
+
if (this.char === CHAR_COLON) {
|
|
5857
|
+
if (this.state.buf.length < 2) {
|
|
5858
|
+
throw this.error(new TomlError("Hours less than 10 must be zero padded to two characters"));
|
|
5859
|
+
}
|
|
5860
|
+
this.state.result += "T" + this.state.buf;
|
|
5861
|
+
this.state.buf = "";
|
|
5862
|
+
return this.next(this.parseTimeMin);
|
|
5863
|
+
} else if (isDigit(this.char)) {
|
|
5864
|
+
this.consume();
|
|
5865
|
+
} else {
|
|
5866
|
+
throw this.error(new TomlError("Incomplete datetime"));
|
|
5867
|
+
}
|
|
5868
|
+
}
|
|
5869
|
+
parseTimeMin() {
|
|
5870
|
+
if (this.state.buf.length < 2 && isDigit(this.char)) {
|
|
5871
|
+
this.consume();
|
|
5872
|
+
} else if (this.state.buf.length === 2 && this.char === CHAR_COLON) {
|
|
5873
|
+
this.state.result += ":" + this.state.buf;
|
|
5874
|
+
this.state.buf = "";
|
|
5875
|
+
return this.next(this.parseTimeSec);
|
|
5876
|
+
} else {
|
|
5877
|
+
throw this.error(new TomlError("Incomplete datetime"));
|
|
5878
|
+
}
|
|
5879
|
+
}
|
|
5880
|
+
parseTimeSec() {
|
|
5881
|
+
if (isDigit(this.char)) {
|
|
5882
|
+
this.consume();
|
|
5883
|
+
if (this.state.buf.length === 2) {
|
|
5884
|
+
this.state.result += ":" + this.state.buf;
|
|
5885
|
+
this.state.buf = "";
|
|
5886
|
+
return this.next(this.parseTimeZoneOrFraction);
|
|
5887
|
+
}
|
|
5888
|
+
} else {
|
|
5889
|
+
throw this.error(new TomlError("Incomplete datetime"));
|
|
5890
|
+
}
|
|
5891
|
+
}
|
|
5892
|
+
parseOnlyTimeHour() {
|
|
5893
|
+
if (this.char === CHAR_COLON) {
|
|
5894
|
+
if (this.state.buf.length < 2) {
|
|
5895
|
+
throw this.error(new TomlError("Hours less than 10 must be zero padded to two characters"));
|
|
5896
|
+
}
|
|
5897
|
+
this.state.result = this.state.buf;
|
|
5898
|
+
this.state.buf = "";
|
|
5899
|
+
return this.next(this.parseOnlyTimeMin);
|
|
5900
|
+
} else {
|
|
5901
|
+
throw this.error(new TomlError("Incomplete time"));
|
|
5902
|
+
}
|
|
5903
|
+
}
|
|
5904
|
+
parseOnlyTimeMin() {
|
|
5905
|
+
if (this.state.buf.length < 2 && isDigit(this.char)) {
|
|
5906
|
+
this.consume();
|
|
5907
|
+
} else if (this.state.buf.length === 2 && this.char === CHAR_COLON) {
|
|
5908
|
+
this.state.result += ":" + this.state.buf;
|
|
5909
|
+
this.state.buf = "";
|
|
5910
|
+
return this.next(this.parseOnlyTimeSec);
|
|
5911
|
+
} else {
|
|
5912
|
+
throw this.error(new TomlError("Incomplete time"));
|
|
5913
|
+
}
|
|
5914
|
+
}
|
|
5915
|
+
parseOnlyTimeSec() {
|
|
5916
|
+
if (isDigit(this.char)) {
|
|
5917
|
+
this.consume();
|
|
5918
|
+
if (this.state.buf.length === 2) {
|
|
5919
|
+
return this.next(this.parseOnlyTimeFractionMaybe);
|
|
5920
|
+
}
|
|
5921
|
+
} else {
|
|
5922
|
+
throw this.error(new TomlError("Incomplete time"));
|
|
5923
|
+
}
|
|
5924
|
+
}
|
|
5925
|
+
parseOnlyTimeFractionMaybe() {
|
|
5926
|
+
this.state.result += ":" + this.state.buf;
|
|
5927
|
+
if (this.char === CHAR_PERIOD) {
|
|
5928
|
+
this.state.buf = "";
|
|
5929
|
+
this.next(this.parseOnlyTimeFraction);
|
|
5930
|
+
} else {
|
|
5931
|
+
return this.return(createTime(this.state.result));
|
|
5932
|
+
}
|
|
5933
|
+
}
|
|
5934
|
+
parseOnlyTimeFraction() {
|
|
5935
|
+
if (isDigit(this.char)) {
|
|
5936
|
+
this.consume();
|
|
5937
|
+
} else if (this.atEndOfWord()) {
|
|
5938
|
+
if (this.state.buf.length === 0) throw this.error(new TomlError("Expected digit in milliseconds"));
|
|
5939
|
+
return this.returnNow(createTime(this.state.result + "." + this.state.buf));
|
|
5940
|
+
} else {
|
|
5941
|
+
throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"));
|
|
5942
|
+
}
|
|
5943
|
+
}
|
|
5944
|
+
parseTimeZoneOrFraction() {
|
|
5945
|
+
if (this.char === CHAR_PERIOD) {
|
|
5946
|
+
this.consume();
|
|
5947
|
+
this.next(this.parseDateTimeFraction);
|
|
5948
|
+
} else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) {
|
|
5949
|
+
this.consume();
|
|
5950
|
+
this.next(this.parseTimeZoneHour);
|
|
5951
|
+
} else if (this.char === CHAR_Z) {
|
|
5952
|
+
this.consume();
|
|
5953
|
+
return this.return(createDateTime(this.state.result + this.state.buf));
|
|
5954
|
+
} else if (this.atEndOfWord()) {
|
|
5955
|
+
return this.returnNow(createDateTimeFloat(this.state.result + this.state.buf));
|
|
5956
|
+
} else {
|
|
5957
|
+
throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"));
|
|
5958
|
+
}
|
|
5959
|
+
}
|
|
5960
|
+
parseDateTimeFraction() {
|
|
5961
|
+
if (isDigit(this.char)) {
|
|
5962
|
+
this.consume();
|
|
5963
|
+
} else if (this.state.buf.length === 1) {
|
|
5964
|
+
throw this.error(new TomlError("Expected digit in milliseconds"));
|
|
5965
|
+
} else if (this.char === CHAR_HYPHEN || this.char === CHAR_PLUS) {
|
|
5966
|
+
this.consume();
|
|
5967
|
+
this.next(this.parseTimeZoneHour);
|
|
5968
|
+
} else if (this.char === CHAR_Z) {
|
|
5969
|
+
this.consume();
|
|
5970
|
+
return this.return(createDateTime(this.state.result + this.state.buf));
|
|
5971
|
+
} else if (this.atEndOfWord()) {
|
|
5972
|
+
return this.returnNow(createDateTimeFloat(this.state.result + this.state.buf));
|
|
5973
|
+
} else {
|
|
5974
|
+
throw this.error(new TomlError("Unexpected character in datetime, expected period (.), minus (-), plus (+) or Z"));
|
|
5975
|
+
}
|
|
5976
|
+
}
|
|
5977
|
+
parseTimeZoneHour() {
|
|
5978
|
+
if (isDigit(this.char)) {
|
|
5979
|
+
this.consume();
|
|
5980
|
+
if (/\d\d$/.test(this.state.buf)) return this.next(this.parseTimeZoneSep);
|
|
5981
|
+
} else {
|
|
5982
|
+
throw this.error(new TomlError("Unexpected character in datetime, expected digit"));
|
|
5983
|
+
}
|
|
5984
|
+
}
|
|
5985
|
+
parseTimeZoneSep() {
|
|
5986
|
+
if (this.char === CHAR_COLON) {
|
|
5987
|
+
this.consume();
|
|
5988
|
+
this.next(this.parseTimeZoneMin);
|
|
5989
|
+
} else {
|
|
5990
|
+
throw this.error(new TomlError("Unexpected character in datetime, expected colon"));
|
|
5991
|
+
}
|
|
5992
|
+
}
|
|
5993
|
+
parseTimeZoneMin() {
|
|
5994
|
+
if (isDigit(this.char)) {
|
|
5995
|
+
this.consume();
|
|
5996
|
+
if (/\d\d$/.test(this.state.buf)) return this.return(createDateTime(this.state.result + this.state.buf));
|
|
5997
|
+
} else {
|
|
5998
|
+
throw this.error(new TomlError("Unexpected character in datetime, expected digit"));
|
|
5999
|
+
}
|
|
6000
|
+
}
|
|
6001
|
+
/* BOOLEAN */
|
|
6002
|
+
parseBoolean() {
|
|
6003
|
+
if (this.char === CHAR_t) {
|
|
6004
|
+
this.consume();
|
|
6005
|
+
return this.next(this.parseTrue_r);
|
|
6006
|
+
} else if (this.char === CHAR_f) {
|
|
6007
|
+
this.consume();
|
|
6008
|
+
return this.next(this.parseFalse_a);
|
|
6009
|
+
}
|
|
6010
|
+
}
|
|
6011
|
+
parseTrue_r() {
|
|
6012
|
+
if (this.char === CHAR_r) {
|
|
6013
|
+
this.consume();
|
|
6014
|
+
return this.next(this.parseTrue_u);
|
|
6015
|
+
} else {
|
|
6016
|
+
throw this.error(new TomlError("Invalid boolean, expected true or false"));
|
|
6017
|
+
}
|
|
6018
|
+
}
|
|
6019
|
+
parseTrue_u() {
|
|
6020
|
+
if (this.char === CHAR_u) {
|
|
6021
|
+
this.consume();
|
|
6022
|
+
return this.next(this.parseTrue_e);
|
|
6023
|
+
} else {
|
|
6024
|
+
throw this.error(new TomlError("Invalid boolean, expected true or false"));
|
|
6025
|
+
}
|
|
6026
|
+
}
|
|
6027
|
+
parseTrue_e() {
|
|
6028
|
+
if (this.char === CHAR_e) {
|
|
6029
|
+
return this.return(true);
|
|
6030
|
+
} else {
|
|
6031
|
+
throw this.error(new TomlError("Invalid boolean, expected true or false"));
|
|
6032
|
+
}
|
|
6033
|
+
}
|
|
6034
|
+
parseFalse_a() {
|
|
6035
|
+
if (this.char === CHAR_a) {
|
|
6036
|
+
this.consume();
|
|
6037
|
+
return this.next(this.parseFalse_l);
|
|
6038
|
+
} else {
|
|
6039
|
+
throw this.error(new TomlError("Invalid boolean, expected true or false"));
|
|
6040
|
+
}
|
|
6041
|
+
}
|
|
6042
|
+
parseFalse_l() {
|
|
6043
|
+
if (this.char === CHAR_l) {
|
|
6044
|
+
this.consume();
|
|
6045
|
+
return this.next(this.parseFalse_s);
|
|
6046
|
+
} else {
|
|
6047
|
+
throw this.error(new TomlError("Invalid boolean, expected true or false"));
|
|
6048
|
+
}
|
|
6049
|
+
}
|
|
6050
|
+
parseFalse_s() {
|
|
6051
|
+
if (this.char === CHAR_s) {
|
|
6052
|
+
this.consume();
|
|
6053
|
+
return this.next(this.parseFalse_e);
|
|
6054
|
+
} else {
|
|
6055
|
+
throw this.error(new TomlError("Invalid boolean, expected true or false"));
|
|
6056
|
+
}
|
|
6057
|
+
}
|
|
6058
|
+
parseFalse_e() {
|
|
6059
|
+
if (this.char === CHAR_e) {
|
|
6060
|
+
return this.return(false);
|
|
6061
|
+
} else {
|
|
6062
|
+
throw this.error(new TomlError("Invalid boolean, expected true or false"));
|
|
6063
|
+
}
|
|
6064
|
+
}
|
|
6065
|
+
/* INLINE LISTS */
|
|
6066
|
+
parseInlineList() {
|
|
6067
|
+
if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M || this.char === CTRL_J) {
|
|
6068
|
+
return null;
|
|
6069
|
+
} else if (this.char === Parser.END) {
|
|
6070
|
+
throw this.error(new TomlError("Unterminated inline array"));
|
|
6071
|
+
} else if (this.char === CHAR_NUM) {
|
|
6072
|
+
return this.call(this.parseComment);
|
|
6073
|
+
} else if (this.char === CHAR_RSQB) {
|
|
6074
|
+
return this.return(this.state.resultArr || InlineList());
|
|
6075
|
+
} else {
|
|
6076
|
+
return this.callNow(this.parseValue, this.recordInlineListValue);
|
|
6077
|
+
}
|
|
6078
|
+
}
|
|
6079
|
+
recordInlineListValue(value) {
|
|
6080
|
+
if (this.state.resultArr) {
|
|
6081
|
+
const listType = this.state.resultArr[_contentType];
|
|
6082
|
+
const valueType = tomlType(value);
|
|
6083
|
+
if (listType !== valueType) {
|
|
6084
|
+
throw this.error(new TomlError(`Inline lists must be a single type, not a mix of ${listType} and ${valueType}`));
|
|
6085
|
+
}
|
|
6086
|
+
} else {
|
|
6087
|
+
this.state.resultArr = InlineList(tomlType(value));
|
|
6088
|
+
}
|
|
6089
|
+
if (isFloat(value) || isInteger(value)) {
|
|
6090
|
+
this.state.resultArr.push(value.valueOf());
|
|
6091
|
+
} else {
|
|
6092
|
+
this.state.resultArr.push(value);
|
|
6093
|
+
}
|
|
6094
|
+
return this.goto(this.parseInlineListNext);
|
|
6095
|
+
}
|
|
6096
|
+
parseInlineListNext() {
|
|
6097
|
+
if (this.char === CHAR_SP || this.char === CTRL_I || this.char === CTRL_M || this.char === CTRL_J) {
|
|
6098
|
+
return null;
|
|
6099
|
+
} else if (this.char === CHAR_NUM) {
|
|
6100
|
+
return this.call(this.parseComment);
|
|
6101
|
+
} else if (this.char === CHAR_COMMA) {
|
|
6102
|
+
return this.next(this.parseInlineList);
|
|
6103
|
+
} else if (this.char === CHAR_RSQB) {
|
|
6104
|
+
return this.goto(this.parseInlineList);
|
|
6105
|
+
} else {
|
|
6106
|
+
throw this.error(new TomlError("Invalid character, expected whitespace, comma (,) or close bracket (])"));
|
|
6107
|
+
}
|
|
6108
|
+
}
|
|
6109
|
+
/* INLINE TABLE */
|
|
6110
|
+
parseInlineTable() {
|
|
6111
|
+
if (this.char === CHAR_SP || this.char === CTRL_I) {
|
|
6112
|
+
return null;
|
|
6113
|
+
} else if (this.char === Parser.END || this.char === CHAR_NUM || this.char === CTRL_J || this.char === CTRL_M) {
|
|
6114
|
+
throw this.error(new TomlError("Unterminated inline array"));
|
|
6115
|
+
} else if (this.char === CHAR_RCUB) {
|
|
6116
|
+
return this.return(this.state.resultTable || InlineTable());
|
|
6117
|
+
} else {
|
|
6118
|
+
if (!this.state.resultTable) this.state.resultTable = InlineTable();
|
|
6119
|
+
return this.callNow(this.parseAssign, this.recordInlineTableValue);
|
|
6120
|
+
}
|
|
6121
|
+
}
|
|
6122
|
+
recordInlineTableValue(kv) {
|
|
6123
|
+
let target = this.state.resultTable;
|
|
6124
|
+
let finalKey = kv.key.pop();
|
|
6125
|
+
for (let kw of kv.key) {
|
|
6126
|
+
if (hasKey(target, kw) && (!isTable(target[kw]) || target[kw][_declared])) {
|
|
6127
|
+
throw this.error(new TomlError("Can't redefine existing key"));
|
|
6128
|
+
}
|
|
6129
|
+
target = target[kw] = target[kw] || Table();
|
|
6130
|
+
}
|
|
6131
|
+
if (hasKey(target, finalKey)) {
|
|
6132
|
+
throw this.error(new TomlError("Can't redefine existing key"));
|
|
6133
|
+
}
|
|
6134
|
+
if (isInteger(kv.value) || isFloat(kv.value)) {
|
|
6135
|
+
target[finalKey] = kv.value.valueOf();
|
|
6136
|
+
} else {
|
|
6137
|
+
target[finalKey] = kv.value;
|
|
6138
|
+
}
|
|
6139
|
+
return this.goto(this.parseInlineTableNext);
|
|
6140
|
+
}
|
|
6141
|
+
parseInlineTableNext() {
|
|
6142
|
+
if (this.char === CHAR_SP || this.char === CTRL_I) {
|
|
6143
|
+
return null;
|
|
6144
|
+
} else if (this.char === Parser.END || this.char === CHAR_NUM || this.char === CTRL_J || this.char === CTRL_M) {
|
|
6145
|
+
throw this.error(new TomlError("Unterminated inline array"));
|
|
6146
|
+
} else if (this.char === CHAR_COMMA) {
|
|
6147
|
+
return this.next(this.parseInlineTable);
|
|
6148
|
+
} else if (this.char === CHAR_RCUB) {
|
|
6149
|
+
return this.goto(this.parseInlineTable);
|
|
6150
|
+
} else {
|
|
6151
|
+
throw this.error(new TomlError("Invalid character, expected whitespace, comma (,) or close bracket (])"));
|
|
6152
|
+
}
|
|
6153
|
+
}
|
|
6154
|
+
}
|
|
6155
|
+
return TOMLParser;
|
|
6156
|
+
}
|
|
6157
|
+
}
|
|
6158
|
+
});
|
|
6159
|
+
|
|
6160
|
+
// ../../node_modules/@iarna/toml/parse-pretty-error.js
|
|
6161
|
+
var require_parse_pretty_error = __commonJS({
|
|
6162
|
+
"../../node_modules/@iarna/toml/parse-pretty-error.js"(exports2, module2) {
|
|
6163
|
+
"use strict";
|
|
6164
|
+
init_cjs_shims();
|
|
6165
|
+
module2.exports = prettyError;
|
|
6166
|
+
function prettyError(err, buf) {
|
|
6167
|
+
if (err.pos == null || err.line == null) return err;
|
|
6168
|
+
let msg = err.message;
|
|
6169
|
+
msg += ` at row ${err.line + 1}, col ${err.col + 1}, pos ${err.pos}:
|
|
6170
|
+
`;
|
|
6171
|
+
if (buf && buf.split) {
|
|
6172
|
+
const lines = buf.split(/\n/);
|
|
6173
|
+
const lineNumWidth = String(Math.min(lines.length, err.line + 3)).length;
|
|
6174
|
+
let linePadding = " ";
|
|
6175
|
+
while (linePadding.length < lineNumWidth) linePadding += " ";
|
|
6176
|
+
for (let ii = Math.max(0, err.line - 1); ii < Math.min(lines.length, err.line + 2); ++ii) {
|
|
6177
|
+
let lineNum = String(ii + 1);
|
|
6178
|
+
if (lineNum.length < lineNumWidth) lineNum = " " + lineNum;
|
|
6179
|
+
if (err.line === ii) {
|
|
6180
|
+
msg += lineNum + "> " + lines[ii] + "\n";
|
|
6181
|
+
msg += linePadding + " ";
|
|
6182
|
+
for (let hh = 0; hh < err.col; ++hh) {
|
|
6183
|
+
msg += " ";
|
|
6184
|
+
}
|
|
6185
|
+
msg += "^\n";
|
|
6186
|
+
} else {
|
|
6187
|
+
msg += lineNum + ": " + lines[ii] + "\n";
|
|
6188
|
+
}
|
|
6189
|
+
}
|
|
6190
|
+
}
|
|
6191
|
+
err.message = msg + "\n";
|
|
6192
|
+
return err;
|
|
6193
|
+
}
|
|
6194
|
+
}
|
|
6195
|
+
});
|
|
6196
|
+
|
|
6197
|
+
// ../../node_modules/@iarna/toml/parse-string.js
|
|
6198
|
+
var require_parse_string = __commonJS({
|
|
6199
|
+
"../../node_modules/@iarna/toml/parse-string.js"(exports2, module2) {
|
|
6200
|
+
"use strict";
|
|
6201
|
+
init_cjs_shims();
|
|
6202
|
+
module2.exports = parseString;
|
|
6203
|
+
var TOMLParser = require_toml_parser();
|
|
6204
|
+
var prettyError = require_parse_pretty_error();
|
|
6205
|
+
function parseString(str2) {
|
|
6206
|
+
if (global.Buffer && global.Buffer.isBuffer(str2)) {
|
|
6207
|
+
str2 = str2.toString("utf8");
|
|
6208
|
+
}
|
|
6209
|
+
const parser = new TOMLParser();
|
|
6210
|
+
try {
|
|
6211
|
+
parser.parse(str2);
|
|
6212
|
+
return parser.finish();
|
|
6213
|
+
} catch (err) {
|
|
6214
|
+
throw prettyError(err, str2);
|
|
6215
|
+
}
|
|
6216
|
+
}
|
|
6217
|
+
}
|
|
6218
|
+
});
|
|
6219
|
+
|
|
6220
|
+
// ../../node_modules/@iarna/toml/parse-async.js
|
|
6221
|
+
var require_parse_async = __commonJS({
|
|
6222
|
+
"../../node_modules/@iarna/toml/parse-async.js"(exports2, module2) {
|
|
6223
|
+
"use strict";
|
|
6224
|
+
init_cjs_shims();
|
|
6225
|
+
module2.exports = parseAsync;
|
|
6226
|
+
var TOMLParser = require_toml_parser();
|
|
6227
|
+
var prettyError = require_parse_pretty_error();
|
|
6228
|
+
function parseAsync(str2, opts) {
|
|
6229
|
+
if (!opts) opts = {};
|
|
6230
|
+
const index = 0;
|
|
6231
|
+
const blocksize = opts.blocksize || 40960;
|
|
6232
|
+
const parser = new TOMLParser();
|
|
6233
|
+
return new Promise((resolve2, reject) => {
|
|
6234
|
+
setImmediate(parseAsyncNext, index, blocksize, resolve2, reject);
|
|
6235
|
+
});
|
|
6236
|
+
function parseAsyncNext(index2, blocksize2, resolve2, reject) {
|
|
6237
|
+
if (index2 >= str2.length) {
|
|
6238
|
+
try {
|
|
6239
|
+
return resolve2(parser.finish());
|
|
6240
|
+
} catch (err) {
|
|
6241
|
+
return reject(prettyError(err, str2));
|
|
6242
|
+
}
|
|
6243
|
+
}
|
|
6244
|
+
try {
|
|
6245
|
+
parser.parse(str2.slice(index2, index2 + blocksize2));
|
|
6246
|
+
setImmediate(parseAsyncNext, index2 + blocksize2, blocksize2, resolve2, reject);
|
|
6247
|
+
} catch (err) {
|
|
6248
|
+
reject(prettyError(err, str2));
|
|
6249
|
+
}
|
|
6250
|
+
}
|
|
6251
|
+
}
|
|
6252
|
+
}
|
|
6253
|
+
});
|
|
6254
|
+
|
|
6255
|
+
// ../../node_modules/@iarna/toml/parse-stream.js
|
|
6256
|
+
var require_parse_stream = __commonJS({
|
|
6257
|
+
"../../node_modules/@iarna/toml/parse-stream.js"(exports2, module2) {
|
|
6258
|
+
"use strict";
|
|
6259
|
+
init_cjs_shims();
|
|
6260
|
+
module2.exports = parseStream;
|
|
6261
|
+
var stream = require("stream");
|
|
6262
|
+
var TOMLParser = require_toml_parser();
|
|
6263
|
+
function parseStream(stm) {
|
|
6264
|
+
if (stm) {
|
|
6265
|
+
return parseReadable(stm);
|
|
6266
|
+
} else {
|
|
6267
|
+
return parseTransform(stm);
|
|
6268
|
+
}
|
|
6269
|
+
}
|
|
6270
|
+
function parseReadable(stm) {
|
|
6271
|
+
const parser = new TOMLParser();
|
|
6272
|
+
stm.setEncoding("utf8");
|
|
6273
|
+
return new Promise((resolve2, reject) => {
|
|
6274
|
+
let readable;
|
|
6275
|
+
let ended = false;
|
|
6276
|
+
let errored = false;
|
|
6277
|
+
function finish() {
|
|
6278
|
+
ended = true;
|
|
6279
|
+
if (readable) return;
|
|
6280
|
+
try {
|
|
6281
|
+
resolve2(parser.finish());
|
|
6282
|
+
} catch (err) {
|
|
6283
|
+
reject(err);
|
|
6284
|
+
}
|
|
6285
|
+
}
|
|
6286
|
+
function error(err) {
|
|
6287
|
+
errored = true;
|
|
6288
|
+
reject(err);
|
|
6289
|
+
}
|
|
6290
|
+
stm.once("end", finish);
|
|
6291
|
+
stm.once("error", error);
|
|
6292
|
+
readNext();
|
|
6293
|
+
function readNext() {
|
|
6294
|
+
readable = true;
|
|
6295
|
+
let data;
|
|
6296
|
+
while ((data = stm.read()) !== null) {
|
|
6297
|
+
try {
|
|
6298
|
+
parser.parse(data);
|
|
6299
|
+
} catch (err) {
|
|
6300
|
+
return error(err);
|
|
6301
|
+
}
|
|
6302
|
+
}
|
|
6303
|
+
readable = false;
|
|
6304
|
+
if (ended) return finish();
|
|
6305
|
+
if (errored) return;
|
|
6306
|
+
stm.once("readable", readNext);
|
|
6307
|
+
}
|
|
6308
|
+
});
|
|
6309
|
+
}
|
|
6310
|
+
function parseTransform() {
|
|
6311
|
+
const parser = new TOMLParser();
|
|
6312
|
+
return new stream.Transform({
|
|
6313
|
+
objectMode: true,
|
|
6314
|
+
transform(chunk, encoding, cb) {
|
|
6315
|
+
try {
|
|
6316
|
+
parser.parse(chunk.toString(encoding));
|
|
6317
|
+
} catch (err) {
|
|
6318
|
+
this.emit("error", err);
|
|
6319
|
+
}
|
|
6320
|
+
cb();
|
|
6321
|
+
},
|
|
6322
|
+
flush(cb) {
|
|
6323
|
+
try {
|
|
6324
|
+
this.push(parser.finish());
|
|
6325
|
+
} catch (err) {
|
|
6326
|
+
this.emit("error", err);
|
|
6327
|
+
}
|
|
6328
|
+
cb();
|
|
6329
|
+
}
|
|
6330
|
+
});
|
|
6331
|
+
}
|
|
6332
|
+
}
|
|
6333
|
+
});
|
|
6334
|
+
|
|
6335
|
+
// ../../node_modules/@iarna/toml/parse.js
|
|
6336
|
+
var require_parse = __commonJS({
|
|
6337
|
+
"../../node_modules/@iarna/toml/parse.js"(exports2, module2) {
|
|
6338
|
+
"use strict";
|
|
6339
|
+
init_cjs_shims();
|
|
6340
|
+
module2.exports = require_parse_string();
|
|
6341
|
+
module2.exports.async = require_parse_async();
|
|
6342
|
+
module2.exports.stream = require_parse_stream();
|
|
6343
|
+
module2.exports.prettyError = require_parse_pretty_error();
|
|
6344
|
+
}
|
|
6345
|
+
});
|
|
6346
|
+
|
|
6347
|
+
// ../../node_modules/@iarna/toml/stringify.js
|
|
6348
|
+
var require_stringify = __commonJS({
|
|
6349
|
+
"../../node_modules/@iarna/toml/stringify.js"(exports2, module2) {
|
|
6350
|
+
"use strict";
|
|
6351
|
+
init_cjs_shims();
|
|
6352
|
+
module2.exports = stringify2;
|
|
6353
|
+
module2.exports.value = stringifyInline;
|
|
6354
|
+
function stringify2(obj) {
|
|
6355
|
+
if (obj === null) throw typeError("null");
|
|
6356
|
+
if (obj === void 0) throw typeError("undefined");
|
|
6357
|
+
if (typeof obj !== "object") throw typeError(typeof obj);
|
|
6358
|
+
if (typeof obj.toJSON === "function") obj = obj.toJSON();
|
|
6359
|
+
if (obj == null) return null;
|
|
6360
|
+
const type2 = tomlType2(obj);
|
|
6361
|
+
if (type2 !== "table") throw typeError(type2);
|
|
6362
|
+
return stringifyObject("", "", obj);
|
|
6363
|
+
}
|
|
6364
|
+
function typeError(type2) {
|
|
6365
|
+
return new Error("Can only stringify objects, not " + type2);
|
|
6366
|
+
}
|
|
6367
|
+
function arrayOneTypeError() {
|
|
6368
|
+
return new Error("Array values can't have mixed types");
|
|
6369
|
+
}
|
|
6370
|
+
function getInlineKeys(obj) {
|
|
6371
|
+
return Object.keys(obj).filter((key) => isInline(obj[key]));
|
|
6372
|
+
}
|
|
6373
|
+
function getComplexKeys(obj) {
|
|
6374
|
+
return Object.keys(obj).filter((key) => !isInline(obj[key]));
|
|
6375
|
+
}
|
|
6376
|
+
function toJSON(obj) {
|
|
6377
|
+
let nobj = Array.isArray(obj) ? [] : Object.prototype.hasOwnProperty.call(obj, "__proto__") ? { ["__proto__"]: void 0 } : {};
|
|
6378
|
+
for (let prop of Object.keys(obj)) {
|
|
6379
|
+
if (obj[prop] && typeof obj[prop].toJSON === "function" && !("toISOString" in obj[prop])) {
|
|
6380
|
+
nobj[prop] = obj[prop].toJSON();
|
|
6381
|
+
} else {
|
|
6382
|
+
nobj[prop] = obj[prop];
|
|
6383
|
+
}
|
|
6384
|
+
}
|
|
6385
|
+
return nobj;
|
|
6386
|
+
}
|
|
6387
|
+
function stringifyObject(prefix, indent, obj) {
|
|
6388
|
+
obj = toJSON(obj);
|
|
6389
|
+
var inlineKeys;
|
|
6390
|
+
var complexKeys;
|
|
6391
|
+
inlineKeys = getInlineKeys(obj);
|
|
6392
|
+
complexKeys = getComplexKeys(obj);
|
|
6393
|
+
var result = [];
|
|
6394
|
+
var inlineIndent = indent || "";
|
|
6395
|
+
inlineKeys.forEach((key) => {
|
|
6396
|
+
var type2 = tomlType2(obj[key]);
|
|
6397
|
+
if (type2 !== "undefined" && type2 !== "null") {
|
|
6398
|
+
result.push(inlineIndent + stringifyKey(key) + " = " + stringifyAnyInline(obj[key], true));
|
|
6399
|
+
}
|
|
6400
|
+
});
|
|
6401
|
+
if (result.length > 0) result.push("");
|
|
6402
|
+
var complexIndent = prefix && inlineKeys.length > 0 ? indent + " " : "";
|
|
6403
|
+
complexKeys.forEach((key) => {
|
|
6404
|
+
result.push(stringifyComplex(prefix, complexIndent, key, obj[key]));
|
|
6405
|
+
});
|
|
6406
|
+
return result.join("\n");
|
|
6407
|
+
}
|
|
6408
|
+
function isInline(value) {
|
|
6409
|
+
switch (tomlType2(value)) {
|
|
6410
|
+
case "undefined":
|
|
6411
|
+
case "null":
|
|
6412
|
+
case "integer":
|
|
6413
|
+
case "nan":
|
|
6414
|
+
case "float":
|
|
6415
|
+
case "boolean":
|
|
6416
|
+
case "string":
|
|
6417
|
+
case "datetime":
|
|
6418
|
+
return true;
|
|
6419
|
+
case "array":
|
|
6420
|
+
return value.length === 0 || tomlType2(value[0]) !== "table";
|
|
6421
|
+
case "table":
|
|
6422
|
+
return Object.keys(value).length === 0;
|
|
6423
|
+
/* istanbul ignore next */
|
|
6424
|
+
default:
|
|
6425
|
+
return false;
|
|
6426
|
+
}
|
|
6427
|
+
}
|
|
6428
|
+
function tomlType2(value) {
|
|
6429
|
+
if (value === void 0) {
|
|
6430
|
+
return "undefined";
|
|
6431
|
+
} else if (value === null) {
|
|
6432
|
+
return "null";
|
|
6433
|
+
} else if (typeof value === "bigint" || Number.isInteger(value) && !Object.is(value, -0)) {
|
|
6434
|
+
return "integer";
|
|
6435
|
+
} else if (typeof value === "number") {
|
|
6436
|
+
return "float";
|
|
6437
|
+
} else if (typeof value === "boolean") {
|
|
6438
|
+
return "boolean";
|
|
6439
|
+
} else if (typeof value === "string") {
|
|
6440
|
+
return "string";
|
|
6441
|
+
} else if ("toISOString" in value) {
|
|
6442
|
+
return isNaN(value) ? "undefined" : "datetime";
|
|
6443
|
+
} else if (Array.isArray(value)) {
|
|
6444
|
+
return "array";
|
|
6445
|
+
} else {
|
|
6446
|
+
return "table";
|
|
6447
|
+
}
|
|
6448
|
+
}
|
|
6449
|
+
function stringifyKey(key) {
|
|
6450
|
+
var keyStr = String(key);
|
|
6451
|
+
if (/^[-A-Za-z0-9_]+$/.test(keyStr)) {
|
|
6452
|
+
return keyStr;
|
|
6453
|
+
} else {
|
|
6454
|
+
return stringifyBasicString(keyStr);
|
|
6455
|
+
}
|
|
6456
|
+
}
|
|
6457
|
+
function stringifyBasicString(str2) {
|
|
6458
|
+
return '"' + escapeString2(str2).replace(/"/g, '\\"') + '"';
|
|
6459
|
+
}
|
|
6460
|
+
function stringifyLiteralString(str2) {
|
|
6461
|
+
return "'" + str2 + "'";
|
|
6462
|
+
}
|
|
6463
|
+
function numpad(num, str2) {
|
|
6464
|
+
while (str2.length < num) str2 = "0" + str2;
|
|
6465
|
+
return str2;
|
|
6466
|
+
}
|
|
6467
|
+
function escapeString2(str2) {
|
|
6468
|
+
return str2.replace(/\\/g, "\\\\").replace(/[\b]/g, "\\b").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\f/g, "\\f").replace(/\r/g, "\\r").replace(/([\u0000-\u001f\u007f])/, (c) => "\\u" + numpad(4, c.codePointAt(0).toString(16)));
|
|
6469
|
+
}
|
|
6470
|
+
function stringifyMultilineString(str2) {
|
|
6471
|
+
let escaped = str2.split(/\n/).map((str3) => {
|
|
6472
|
+
return escapeString2(str3).replace(/"(?="")/g, '\\"');
|
|
6473
|
+
}).join("\n");
|
|
6474
|
+
if (escaped.slice(-1) === '"') escaped += "\\\n";
|
|
6475
|
+
return '"""\n' + escaped + '"""';
|
|
6476
|
+
}
|
|
6477
|
+
function stringifyAnyInline(value, multilineOk) {
|
|
6478
|
+
let type2 = tomlType2(value);
|
|
6479
|
+
if (type2 === "string") {
|
|
6480
|
+
if (multilineOk && /\n/.test(value)) {
|
|
6481
|
+
type2 = "string-multiline";
|
|
6482
|
+
} else if (!/[\b\t\n\f\r']/.test(value) && /"/.test(value)) {
|
|
6483
|
+
type2 = "string-literal";
|
|
6484
|
+
}
|
|
6485
|
+
}
|
|
6486
|
+
return stringifyInline(value, type2);
|
|
6487
|
+
}
|
|
6488
|
+
function stringifyInline(value, type2) {
|
|
6489
|
+
if (!type2) type2 = tomlType2(value);
|
|
6490
|
+
switch (type2) {
|
|
6491
|
+
case "string-multiline":
|
|
6492
|
+
return stringifyMultilineString(value);
|
|
6493
|
+
case "string":
|
|
6494
|
+
return stringifyBasicString(value);
|
|
6495
|
+
case "string-literal":
|
|
6496
|
+
return stringifyLiteralString(value);
|
|
6497
|
+
case "integer":
|
|
6498
|
+
return stringifyInteger(value);
|
|
6499
|
+
case "float":
|
|
6500
|
+
return stringifyFloat(value);
|
|
6501
|
+
case "boolean":
|
|
6502
|
+
return stringifyBoolean(value);
|
|
6503
|
+
case "datetime":
|
|
6504
|
+
return stringifyDatetime(value);
|
|
6505
|
+
case "array":
|
|
6506
|
+
return stringifyInlineArray(value.filter((_) => tomlType2(_) !== "null" && tomlType2(_) !== "undefined" && tomlType2(_) !== "nan"));
|
|
6507
|
+
case "table":
|
|
6508
|
+
return stringifyInlineTable(value);
|
|
6509
|
+
/* istanbul ignore next */
|
|
6510
|
+
default:
|
|
6511
|
+
throw typeError(type2);
|
|
6512
|
+
}
|
|
6513
|
+
}
|
|
6514
|
+
function stringifyInteger(value) {
|
|
6515
|
+
return String(value).replace(/\B(?=(\d{3})+(?!\d))/g, "_");
|
|
6516
|
+
}
|
|
6517
|
+
function stringifyFloat(value) {
|
|
6518
|
+
if (value === Infinity) {
|
|
6519
|
+
return "inf";
|
|
6520
|
+
} else if (value === -Infinity) {
|
|
6521
|
+
return "-inf";
|
|
6522
|
+
} else if (Object.is(value, NaN)) {
|
|
6523
|
+
return "nan";
|
|
6524
|
+
} else if (Object.is(value, -0)) {
|
|
6525
|
+
return "-0.0";
|
|
6526
|
+
}
|
|
6527
|
+
var chunks = String(value).split(".");
|
|
6528
|
+
var int2 = chunks[0];
|
|
6529
|
+
var dec = chunks[1] || 0;
|
|
6530
|
+
return stringifyInteger(int2) + "." + dec;
|
|
6531
|
+
}
|
|
6532
|
+
function stringifyBoolean(value) {
|
|
6533
|
+
return String(value);
|
|
6534
|
+
}
|
|
6535
|
+
function stringifyDatetime(value) {
|
|
6536
|
+
return value.toISOString();
|
|
6537
|
+
}
|
|
6538
|
+
function isNumber(type2) {
|
|
6539
|
+
return type2 === "float" || type2 === "integer";
|
|
6540
|
+
}
|
|
6541
|
+
function arrayType(values) {
|
|
6542
|
+
var contentType = tomlType2(values[0]);
|
|
6543
|
+
if (values.every((_) => tomlType2(_) === contentType)) return contentType;
|
|
6544
|
+
if (values.every((_) => isNumber(tomlType2(_)))) return "float";
|
|
6545
|
+
return "mixed";
|
|
6546
|
+
}
|
|
6547
|
+
function validateArray(values) {
|
|
6548
|
+
const type2 = arrayType(values);
|
|
6549
|
+
if (type2 === "mixed") {
|
|
6550
|
+
throw arrayOneTypeError();
|
|
6551
|
+
}
|
|
6552
|
+
return type2;
|
|
6553
|
+
}
|
|
6554
|
+
function stringifyInlineArray(values) {
|
|
6555
|
+
values = toJSON(values);
|
|
6556
|
+
const type2 = validateArray(values);
|
|
6557
|
+
var result = "[";
|
|
6558
|
+
var stringified = values.map((_) => stringifyInline(_, type2));
|
|
6559
|
+
if (stringified.join(", ").length > 60 || /\n/.test(stringified)) {
|
|
6560
|
+
result += "\n " + stringified.join(",\n ") + "\n";
|
|
6561
|
+
} else {
|
|
6562
|
+
result += " " + stringified.join(", ") + (stringified.length > 0 ? " " : "");
|
|
6563
|
+
}
|
|
6564
|
+
return result + "]";
|
|
6565
|
+
}
|
|
6566
|
+
function stringifyInlineTable(value) {
|
|
6567
|
+
value = toJSON(value);
|
|
6568
|
+
var result = [];
|
|
6569
|
+
Object.keys(value).forEach((key) => {
|
|
6570
|
+
result.push(stringifyKey(key) + " = " + stringifyAnyInline(value[key], false));
|
|
6571
|
+
});
|
|
6572
|
+
return "{ " + result.join(", ") + (result.length > 0 ? " " : "") + "}";
|
|
6573
|
+
}
|
|
6574
|
+
function stringifyComplex(prefix, indent, key, value) {
|
|
6575
|
+
var valueType = tomlType2(value);
|
|
6576
|
+
if (valueType === "array") {
|
|
6577
|
+
return stringifyArrayOfTables(prefix, indent, key, value);
|
|
6578
|
+
} else if (valueType === "table") {
|
|
6579
|
+
return stringifyComplexTable(prefix, indent, key, value);
|
|
6580
|
+
} else {
|
|
6581
|
+
throw typeError(valueType);
|
|
6582
|
+
}
|
|
6583
|
+
}
|
|
6584
|
+
function stringifyArrayOfTables(prefix, indent, key, values) {
|
|
6585
|
+
values = toJSON(values);
|
|
6586
|
+
validateArray(values);
|
|
6587
|
+
var firstValueType = tomlType2(values[0]);
|
|
6588
|
+
if (firstValueType !== "table") throw typeError(firstValueType);
|
|
6589
|
+
var fullKey = prefix + stringifyKey(key);
|
|
6590
|
+
var result = "";
|
|
6591
|
+
values.forEach((table) => {
|
|
6592
|
+
if (result.length > 0) result += "\n";
|
|
6593
|
+
result += indent + "[[" + fullKey + "]]\n";
|
|
6594
|
+
result += stringifyObject(fullKey + ".", indent, table);
|
|
6595
|
+
});
|
|
6596
|
+
return result;
|
|
6597
|
+
}
|
|
6598
|
+
function stringifyComplexTable(prefix, indent, key, value) {
|
|
6599
|
+
var fullKey = prefix + stringifyKey(key);
|
|
6600
|
+
var result = "";
|
|
6601
|
+
if (getInlineKeys(value).length > 0) {
|
|
6602
|
+
result += indent + "[" + fullKey + "]\n";
|
|
6603
|
+
}
|
|
6604
|
+
return result + stringifyObject(fullKey + ".", indent, value);
|
|
6605
|
+
}
|
|
6606
|
+
}
|
|
6607
|
+
});
|
|
6608
|
+
|
|
6609
|
+
// ../../node_modules/@iarna/toml/toml.js
|
|
6610
|
+
var require_toml = __commonJS({
|
|
6611
|
+
"../../node_modules/@iarna/toml/toml.js"(exports2) {
|
|
6612
|
+
"use strict";
|
|
6613
|
+
init_cjs_shims();
|
|
6614
|
+
exports2.parse = require_parse();
|
|
6615
|
+
exports2.stringify = require_stringify();
|
|
6616
|
+
}
|
|
6617
|
+
});
|
|
6618
|
+
|
|
6619
|
+
// ../converters/dist/from-gemini.js
|
|
6620
|
+
function fromGemini(content, metadata, explicitSubtype) {
|
|
6621
|
+
let parsed;
|
|
6622
|
+
try {
|
|
6623
|
+
const tomlData = TOML.parse(content);
|
|
6624
|
+
parsed = tomlData;
|
|
6625
|
+
} catch (error) {
|
|
6626
|
+
throw new Error(`Failed to parse Gemini TOML: ${error instanceof Error ? error.message : String(error)}`);
|
|
6627
|
+
}
|
|
6628
|
+
if (!parsed.prompt) {
|
|
6629
|
+
throw new Error('Gemini command must have a "prompt" field');
|
|
6630
|
+
}
|
|
6631
|
+
const sections = [];
|
|
6632
|
+
sections.push({
|
|
6633
|
+
type: "metadata",
|
|
6634
|
+
data: {
|
|
6635
|
+
title: metadata.name || metadata.id,
|
|
6636
|
+
description: parsed.description || "Gemini custom command"
|
|
6637
|
+
}
|
|
6638
|
+
});
|
|
6639
|
+
sections.push({
|
|
6640
|
+
type: "instructions",
|
|
6641
|
+
title: "Prompt",
|
|
6642
|
+
content: parsed.prompt,
|
|
6643
|
+
priority: "high"
|
|
6644
|
+
});
|
|
6645
|
+
const canonicalContent = {
|
|
6646
|
+
format: "canonical",
|
|
6647
|
+
version: "1.0",
|
|
6648
|
+
sections
|
|
6649
|
+
};
|
|
6650
|
+
const pkg = {
|
|
6651
|
+
id: metadata.id,
|
|
6652
|
+
version: metadata.version || "1.0.0",
|
|
6653
|
+
name: metadata.name || metadata.id,
|
|
6654
|
+
description: parsed.description || "Gemini custom command",
|
|
6655
|
+
author: metadata.author || "unknown",
|
|
6656
|
+
tags: metadata.tags || ["gemini", "command"],
|
|
6657
|
+
format: "gemini",
|
|
6658
|
+
subtype: explicitSubtype || "slash-command",
|
|
6659
|
+
content: canonicalContent,
|
|
6660
|
+
sourceFormat: "gemini",
|
|
6661
|
+
metadata: {
|
|
6662
|
+
description: parsed.description
|
|
6663
|
+
}
|
|
6664
|
+
};
|
|
6665
|
+
return pkg;
|
|
6666
|
+
}
|
|
6667
|
+
var TOML;
|
|
6668
|
+
var init_from_gemini = __esm({
|
|
6669
|
+
"../converters/dist/from-gemini.js"() {
|
|
6670
|
+
"use strict";
|
|
6671
|
+
init_cjs_shims();
|
|
6672
|
+
TOML = __toESM(require_toml(), 1);
|
|
6673
|
+
}
|
|
6674
|
+
});
|
|
6675
|
+
|
|
4605
6676
|
// ../converters/dist/validation.js
|
|
4606
6677
|
function loadSchema(format, subtype) {
|
|
4607
6678
|
const cacheKey = subtype ? `${format}:${subtype}` : format;
|
|
@@ -4629,6 +6700,7 @@ function loadSchema(format, subtype) {
|
|
|
4629
6700
|
"copilot": "copilot.schema.json",
|
|
4630
6701
|
"kiro": "kiro-steering.schema.json",
|
|
4631
6702
|
"agents-md": "agents-md.schema.json",
|
|
6703
|
+
"gemini": "gemini.schema.json",
|
|
4632
6704
|
"canonical": "canonical.schema.json"
|
|
4633
6705
|
};
|
|
4634
6706
|
schemaFilename = schemaMap[format] || `${format}.schema.json`;
|
|
@@ -6047,6 +8119,181 @@ var init_to_agents_md = __esm({
|
|
|
6047
8119
|
}
|
|
6048
8120
|
});
|
|
6049
8121
|
|
|
8122
|
+
// ../converters/dist/to-gemini.js
|
|
8123
|
+
function toGemini(pkg, options = {}) {
|
|
8124
|
+
var _a;
|
|
8125
|
+
const warnings = [];
|
|
8126
|
+
let qualityScore = 100;
|
|
8127
|
+
try {
|
|
8128
|
+
const prompt3 = buildPrompt(pkg.content, warnings);
|
|
8129
|
+
const geminiCommand = {
|
|
8130
|
+
prompt: prompt3
|
|
8131
|
+
};
|
|
8132
|
+
if (pkg.description) {
|
|
8133
|
+
geminiCommand.description = pkg.description;
|
|
8134
|
+
} else if ((_a = pkg.metadata) == null ? void 0 : _a.description) {
|
|
8135
|
+
geminiCommand.description = pkg.metadata.description;
|
|
8136
|
+
}
|
|
8137
|
+
const tomlContent = TOML2.stringify(geminiCommand);
|
|
8138
|
+
const validation = validateFormat("gemini", geminiCommand);
|
|
8139
|
+
const validationErrors = validation.errors.map((e) => e.message);
|
|
8140
|
+
const validationWarnings = validation.warnings.map((w) => w.message);
|
|
8141
|
+
if (validationWarnings.length > 0) {
|
|
8142
|
+
warnings.push(...validationWarnings);
|
|
8143
|
+
}
|
|
8144
|
+
const lossyConversion = warnings.some((w) => w.includes("not supported") || w.includes("skipped"));
|
|
8145
|
+
if (lossyConversion) {
|
|
8146
|
+
qualityScore -= 10;
|
|
8147
|
+
}
|
|
8148
|
+
if (validationErrors.length > 0) {
|
|
8149
|
+
qualityScore -= validationErrors.length * 5;
|
|
8150
|
+
}
|
|
8151
|
+
return {
|
|
8152
|
+
content: tomlContent,
|
|
8153
|
+
format: "gemini",
|
|
8154
|
+
warnings: warnings.length > 0 ? warnings : void 0,
|
|
8155
|
+
validationErrors: validationErrors.length > 0 ? validationErrors : void 0,
|
|
8156
|
+
lossyConversion,
|
|
8157
|
+
qualityScore: Math.max(0, qualityScore)
|
|
8158
|
+
};
|
|
8159
|
+
} catch (error) {
|
|
8160
|
+
warnings.push(`Conversion error: ${error instanceof Error ? error.message : String(error)}`);
|
|
8161
|
+
return {
|
|
8162
|
+
content: "",
|
|
8163
|
+
format: "gemini",
|
|
8164
|
+
warnings,
|
|
8165
|
+
lossyConversion: true,
|
|
8166
|
+
qualityScore: 0
|
|
8167
|
+
};
|
|
8168
|
+
}
|
|
8169
|
+
}
|
|
8170
|
+
function buildPrompt(content, warnings) {
|
|
8171
|
+
const lines = [];
|
|
8172
|
+
for (const section of content.sections) {
|
|
8173
|
+
const sectionContent = convertSection7(section, warnings);
|
|
8174
|
+
if (sectionContent) {
|
|
8175
|
+
lines.push(sectionContent);
|
|
8176
|
+
lines.push("");
|
|
8177
|
+
}
|
|
8178
|
+
}
|
|
8179
|
+
return lines.join("\n").trim();
|
|
8180
|
+
}
|
|
8181
|
+
function convertSection7(section, warnings) {
|
|
8182
|
+
switch (section.type) {
|
|
8183
|
+
case "metadata":
|
|
8184
|
+
return "";
|
|
8185
|
+
case "instructions":
|
|
8186
|
+
return convertInstructions7(section);
|
|
8187
|
+
case "rules":
|
|
8188
|
+
return convertRules7(section);
|
|
8189
|
+
case "examples":
|
|
8190
|
+
return convertExamples7(section);
|
|
8191
|
+
case "persona":
|
|
8192
|
+
return convertPersona3(section);
|
|
8193
|
+
case "context":
|
|
8194
|
+
return convertContext7(section);
|
|
8195
|
+
case "tools":
|
|
8196
|
+
warnings.push("Tools section skipped (not supported by Gemini)");
|
|
8197
|
+
return "";
|
|
8198
|
+
case "hook":
|
|
8199
|
+
warnings.push("Hook section skipped (not supported by Gemini)");
|
|
8200
|
+
return "";
|
|
8201
|
+
case "custom":
|
|
8202
|
+
if (!section.editorType || section.editorType === "gemini") {
|
|
8203
|
+
return section.content;
|
|
8204
|
+
}
|
|
8205
|
+
warnings.push(`Custom ${section.editorType} section skipped`);
|
|
8206
|
+
return "";
|
|
8207
|
+
default:
|
|
8208
|
+
warnings.push(`Unknown section type: ${section.type}`);
|
|
8209
|
+
return "";
|
|
8210
|
+
}
|
|
8211
|
+
}
|
|
8212
|
+
function convertInstructions7(section) {
|
|
8213
|
+
const lines = [];
|
|
8214
|
+
if (section.priority === "high") {
|
|
8215
|
+
lines.push("**Important:**");
|
|
8216
|
+
lines.push("");
|
|
8217
|
+
}
|
|
8218
|
+
lines.push(section.content);
|
|
8219
|
+
return lines.join("\n");
|
|
8220
|
+
}
|
|
8221
|
+
function convertRules7(section) {
|
|
8222
|
+
const lines = [];
|
|
8223
|
+
lines.push(`# ${section.title}`);
|
|
8224
|
+
lines.push("");
|
|
8225
|
+
section.items.forEach((rule, index) => {
|
|
8226
|
+
const prefix = section.ordered ? `${index + 1}.` : "-";
|
|
8227
|
+
lines.push(`${prefix} ${rule.content}`);
|
|
8228
|
+
if (rule.rationale) {
|
|
8229
|
+
lines.push(` - *Rationale: ${rule.rationale}*`);
|
|
8230
|
+
}
|
|
8231
|
+
if (rule.examples) {
|
|
8232
|
+
rule.examples.forEach((example) => {
|
|
8233
|
+
lines.push(` - Example: \`${example}\``);
|
|
8234
|
+
});
|
|
8235
|
+
}
|
|
8236
|
+
});
|
|
8237
|
+
return lines.join("\n");
|
|
8238
|
+
}
|
|
8239
|
+
function convertExamples7(section) {
|
|
8240
|
+
const lines = [];
|
|
8241
|
+
lines.push(`# ${section.title}`);
|
|
8242
|
+
lines.push("");
|
|
8243
|
+
section.examples.forEach((example) => {
|
|
8244
|
+
const prefix = example.good === false ? "\u274C Bad" : "\u2705 Good";
|
|
8245
|
+
lines.push(`## ${prefix}: ${example.description}`);
|
|
8246
|
+
lines.push("");
|
|
8247
|
+
const lang = example.language || "";
|
|
8248
|
+
lines.push("```" + lang);
|
|
8249
|
+
lines.push(example.code);
|
|
8250
|
+
lines.push("```");
|
|
8251
|
+
lines.push("");
|
|
8252
|
+
});
|
|
8253
|
+
return lines.join("\n");
|
|
8254
|
+
}
|
|
8255
|
+
function convertPersona3(section) {
|
|
8256
|
+
const { name, role, icon, style, expertise } = section.data;
|
|
8257
|
+
const lines = [];
|
|
8258
|
+
lines.push("# Role");
|
|
8259
|
+
lines.push("");
|
|
8260
|
+
if (icon && typeof icon === "string" && name && typeof name === "string" && typeof role === "string") {
|
|
8261
|
+
lines.push(`${icon} **${name}** - ${role}`);
|
|
8262
|
+
} else if (name && typeof name === "string" && typeof role === "string") {
|
|
8263
|
+
lines.push(`**${name}** - ${role}`);
|
|
8264
|
+
} else if (typeof role === "string") {
|
|
8265
|
+
lines.push(role);
|
|
8266
|
+
}
|
|
8267
|
+
if (style && Array.isArray(style) && style.length > 0) {
|
|
8268
|
+
lines.push("");
|
|
8269
|
+
lines.push(`**Style:** ${style.join(", ")}`);
|
|
8270
|
+
}
|
|
8271
|
+
if (expertise && Array.isArray(expertise) && expertise.length > 0) {
|
|
8272
|
+
lines.push("");
|
|
8273
|
+
lines.push("**Expertise:**");
|
|
8274
|
+
expertise.forEach((area) => {
|
|
8275
|
+
lines.push(`- ${area}`);
|
|
8276
|
+
});
|
|
8277
|
+
}
|
|
8278
|
+
return lines.join("\n");
|
|
8279
|
+
}
|
|
8280
|
+
function convertContext7(section) {
|
|
8281
|
+
const lines = [];
|
|
8282
|
+
lines.push(`# ${section.title}`);
|
|
8283
|
+
lines.push("");
|
|
8284
|
+
lines.push(section.content);
|
|
8285
|
+
return lines.join("\n");
|
|
8286
|
+
}
|
|
8287
|
+
var TOML2;
|
|
8288
|
+
var init_to_gemini = __esm({
|
|
8289
|
+
"../converters/dist/to-gemini.js"() {
|
|
8290
|
+
"use strict";
|
|
8291
|
+
init_cjs_shims();
|
|
8292
|
+
TOML2 = __toESM(require_toml(), 1);
|
|
8293
|
+
init_validation();
|
|
8294
|
+
}
|
|
8295
|
+
});
|
|
8296
|
+
|
|
6050
8297
|
// ../converters/dist/index.js
|
|
6051
8298
|
var dist_exports = {};
|
|
6052
8299
|
__export(dist_exports, {
|
|
@@ -6057,6 +8304,7 @@ __export(dist_exports, {
|
|
|
6057
8304
|
fromContinue: () => fromContinue,
|
|
6058
8305
|
fromCopilot: () => fromCopilot,
|
|
6059
8306
|
fromCursor: () => fromCursor,
|
|
8307
|
+
fromGemini: () => fromGemini,
|
|
6060
8308
|
fromKiro: () => fromKiro,
|
|
6061
8309
|
fromWindsurf: () => fromWindsurf,
|
|
6062
8310
|
normalizeFormat: () => normalizeFormat,
|
|
@@ -6067,6 +8315,7 @@ __export(dist_exports, {
|
|
|
6067
8315
|
toContinue: () => toContinue,
|
|
6068
8316
|
toCopilot: () => toCopilot,
|
|
6069
8317
|
toCursor: () => toCursor,
|
|
8318
|
+
toGemini: () => toGemini,
|
|
6070
8319
|
toKiro: () => toKiro,
|
|
6071
8320
|
toWindsurf: () => toWindsurf,
|
|
6072
8321
|
validateConversion: () => validateConversion,
|
|
@@ -6085,6 +8334,7 @@ var init_dist = __esm({
|
|
|
6085
8334
|
init_from_kiro();
|
|
6086
8335
|
init_from_windsurf();
|
|
6087
8336
|
init_from_agents_md();
|
|
8337
|
+
init_from_gemini();
|
|
6088
8338
|
init_to_cursor();
|
|
6089
8339
|
init_to_claude();
|
|
6090
8340
|
init_to_continue();
|
|
@@ -6092,6 +8342,7 @@ var init_dist = __esm({
|
|
|
6092
8342
|
init_to_kiro();
|
|
6093
8343
|
init_to_windsurf();
|
|
6094
8344
|
init_to_agents_md();
|
|
8345
|
+
init_to_gemini();
|
|
6095
8346
|
init_taxonomy_utils();
|
|
6096
8347
|
init_validation();
|
|
6097
8348
|
}
|
|
@@ -6630,7 +8881,7 @@ async function handleCollectionInstall(collectionSpec, options) {
|
|
|
6630
8881
|
}
|
|
6631
8882
|
}
|
|
6632
8883
|
function createCollectionsCommand() {
|
|
6633
|
-
const command = new
|
|
8884
|
+
const command = new import_commander10.Command("collections");
|
|
6634
8885
|
command.description("Manage package collections").alias("collection").action(async (options) => {
|
|
6635
8886
|
await handleCollectionsList(options);
|
|
6636
8887
|
});
|
|
@@ -6649,12 +8900,12 @@ function createCollectionsCommand() {
|
|
|
6649
8900
|
});
|
|
6650
8901
|
return command;
|
|
6651
8902
|
}
|
|
6652
|
-
var
|
|
8903
|
+
var import_commander10, import_registry_client4;
|
|
6653
8904
|
var init_collections = __esm({
|
|
6654
8905
|
"src/commands/collections.ts"() {
|
|
6655
8906
|
"use strict";
|
|
6656
8907
|
init_cjs_shims();
|
|
6657
|
-
|
|
8908
|
+
import_commander10 = require("commander");
|
|
6658
8909
|
import_registry_client4 = require("@pr-pm/registry-client");
|
|
6659
8910
|
init_user_config();
|
|
6660
8911
|
init_install();
|
|
@@ -6686,6 +8937,7 @@ function getPackageIcon2(format, subtype) {
|
|
|
6686
8937
|
"continue": "\u27A1\uFE0F",
|
|
6687
8938
|
"copilot": "\u2708\uFE0F",
|
|
6688
8939
|
"kiro": "\u{1F3AF}",
|
|
8940
|
+
"gemini": "\u2728",
|
|
6689
8941
|
"mcp": "\u{1F517}",
|
|
6690
8942
|
"agents.md": "\u{1F4DD}",
|
|
6691
8943
|
"generic": "\u{1F4E6}"
|
|
@@ -6700,6 +8952,7 @@ function getPackageLabel2(format, subtype) {
|
|
|
6700
8952
|
"continue": "Continue",
|
|
6701
8953
|
"copilot": "GitHub Copilot",
|
|
6702
8954
|
"kiro": "Kiro",
|
|
8955
|
+
"gemini": "Gemini",
|
|
6703
8956
|
"mcp": "MCP",
|
|
6704
8957
|
"agents.md": "Agents.md",
|
|
6705
8958
|
"generic": ""
|
|
@@ -7394,7 +9647,7 @@ async function installFromLockfile(options) {
|
|
|
7394
9647
|
}
|
|
7395
9648
|
}
|
|
7396
9649
|
function createInstallCommand() {
|
|
7397
|
-
const command = new
|
|
9650
|
+
const command = new import_commander11.Command("install");
|
|
7398
9651
|
command.description("Install a package from the registry, or install all packages from prpm.lock if no package specified").argument("[package]", "Package to install (e.g., react-rules or react-rules@1.2.0). If omitted, installs all packages from prpm.lock").option("--version <version>", "Specific version to install").option("--as <format>", "Convert and install in specific format (cursor, claude, continue, windsurf, copilot, kiro, agents.md, canonical)").option("--format <format>", "Alias for --as").option("--location <path>", "Custom location for installed files (Agents.md or nested Cursor rules)").option("--subtype <subtype>", "Specify subtype when converting (skill, agent, rule, etc.)").option("--frozen-lockfile", "Fail if lock file needs to be updated (for CI)").action(async (packageSpec, options) => {
|
|
7399
9652
|
const convertTo = options.format || options.as;
|
|
7400
9653
|
if (convertTo && !["cursor", "claude", "continue", "windsurf", "copilot", "kiro", "agents.md", "canonical"].includes(convertTo)) {
|
|
@@ -7419,12 +9672,12 @@ function createInstallCommand() {
|
|
|
7419
9672
|
});
|
|
7420
9673
|
return command;
|
|
7421
9674
|
}
|
|
7422
|
-
var
|
|
9675
|
+
var import_commander11, import_registry_client5, import_stream, import_promises, tar, import_path8;
|
|
7423
9676
|
var init_install = __esm({
|
|
7424
9677
|
"src/commands/install.ts"() {
|
|
7425
9678
|
"use strict";
|
|
7426
9679
|
init_cjs_shims();
|
|
7427
|
-
|
|
9680
|
+
import_commander11 = require("commander");
|
|
7428
9681
|
import_registry_client5 = require("@pr-pm/registry-client");
|
|
7429
9682
|
init_user_config();
|
|
7430
9683
|
init_filesystem();
|
|
@@ -9004,7 +11257,7 @@ var require_source = __commonJS({
|
|
|
9004
11257
|
|
|
9005
11258
|
// src/index.ts
|
|
9006
11259
|
init_cjs_shims();
|
|
9007
|
-
var
|
|
11260
|
+
var import_commander28 = require("commander");
|
|
9008
11261
|
var import_fs13 = require("fs");
|
|
9009
11262
|
var import_path16 = require("path");
|
|
9010
11263
|
|
|
@@ -9606,6 +11859,7 @@ function getPackageIcon(format, subtype) {
|
|
|
9606
11859
|
"continue": "\u27A1\uFE0F",
|
|
9607
11860
|
"copilot": "\u2708\uFE0F",
|
|
9608
11861
|
"kiro": "\u{1F3AF}",
|
|
11862
|
+
"gemini": "\u2728",
|
|
9609
11863
|
"mcp": "\u{1F517}",
|
|
9610
11864
|
"agents.md": "\u{1F4DD}",
|
|
9611
11865
|
"generic": "\u{1F4E6}"
|
|
@@ -9620,6 +11874,7 @@ function getPackageLabel(format, subtype) {
|
|
|
9620
11874
|
"continue": "Continue",
|
|
9621
11875
|
"copilot": "GitHub Copilot",
|
|
9622
11876
|
"kiro": "Kiro",
|
|
11877
|
+
"gemini": "Gemini",
|
|
9623
11878
|
"mcp": "MCP",
|
|
9624
11879
|
"agents.md": "Agents.md",
|
|
9625
11880
|
"generic": ""
|
|
@@ -9923,9 +12178,135 @@ function createSearchCommand() {
|
|
|
9923
12178
|
return command;
|
|
9924
12179
|
}
|
|
9925
12180
|
|
|
9926
|
-
// src/commands/
|
|
12181
|
+
// src/commands/ai-search.ts
|
|
9927
12182
|
init_cjs_shims();
|
|
9928
12183
|
var import_commander8 = require("commander");
|
|
12184
|
+
init_user_config();
|
|
12185
|
+
init_telemetry();
|
|
12186
|
+
init_errors();
|
|
12187
|
+
function displayAIResults(response) {
|
|
12188
|
+
const { results, total_matches, execution_time_ms, query } = response;
|
|
12189
|
+
console.log("\n" + "\u2550".repeat(80));
|
|
12190
|
+
console.log(`\u2728 AI Search Results for "${query}"`);
|
|
12191
|
+
console.log(` ${total_matches} matches found in ${execution_time_ms}ms`);
|
|
12192
|
+
console.log("\u2550".repeat(80) + "\n");
|
|
12193
|
+
results.forEach((result, idx) => {
|
|
12194
|
+
const matchPercent = Math.round(result.similarity_score * 100);
|
|
12195
|
+
const matchColor = matchPercent >= 80 ? "\x1B[32m" : matchPercent >= 60 ? "\x1B[33m" : "\x1B[36m";
|
|
12196
|
+
const downloads = result.total_downloads >= 1e3 ? `${(result.total_downloads / 1e3).toFixed(1)}k` : result.total_downloads;
|
|
12197
|
+
console.log(`\x1B[1m${idx + 1}. ${result.name}\x1B[0m ${matchColor}${matchPercent}% match\x1B[0m`);
|
|
12198
|
+
if (result.ai_use_case_description) {
|
|
12199
|
+
console.log(` \u{1F4A1} ${result.ai_use_case_description}`);
|
|
12200
|
+
} else if (result.description) {
|
|
12201
|
+
console.log(` ${result.description}`);
|
|
12202
|
+
}
|
|
12203
|
+
if (result.ai_best_for) {
|
|
12204
|
+
console.log(` \u2728 Best for: ${result.ai_best_for}`);
|
|
12205
|
+
}
|
|
12206
|
+
console.log(` \u{1F4E6} ${result.format} ${result.subtype} | \u{1F4E5} ${downloads} downloads`);
|
|
12207
|
+
if (result.ai_similar_to && result.ai_similar_to.length > 0) {
|
|
12208
|
+
console.log(` \u{1F517} Similar to: ${result.ai_similar_to.slice(0, 3).join(", ")}`);
|
|
12209
|
+
}
|
|
12210
|
+
console.log();
|
|
12211
|
+
});
|
|
12212
|
+
console.log("\u2550".repeat(80));
|
|
12213
|
+
}
|
|
12214
|
+
async function handleAISearch(query, options) {
|
|
12215
|
+
const startTime = Date.now();
|
|
12216
|
+
let success = false;
|
|
12217
|
+
let error;
|
|
12218
|
+
let response = null;
|
|
12219
|
+
try {
|
|
12220
|
+
if (!query || query.trim().length === 0) {
|
|
12221
|
+
console.log("\u274C Please provide a search query");
|
|
12222
|
+
console.log("\n\u{1F4A1} Examples:");
|
|
12223
|
+
console.log(' prpm ai-search "build a REST API with authentication"');
|
|
12224
|
+
console.log(' prpm ai-search "Python testing best practices"');
|
|
12225
|
+
console.log(' prpm ai-search "React component architecture patterns"');
|
|
12226
|
+
console.log(' prpm ai-search "setting up CI/CD pipeline"');
|
|
12227
|
+
return;
|
|
12228
|
+
}
|
|
12229
|
+
console.log(`\u2728 AI searching for "${query}"...`);
|
|
12230
|
+
const config = await getConfig();
|
|
12231
|
+
const searchRequest = {
|
|
12232
|
+
query,
|
|
12233
|
+
limit: options.limit || 10
|
|
12234
|
+
};
|
|
12235
|
+
if (options.format || options.subtype) {
|
|
12236
|
+
searchRequest.filters = {};
|
|
12237
|
+
if (options.format) searchRequest.filters.format = options.format;
|
|
12238
|
+
if (options.subtype) searchRequest.filters.subtype = options.subtype;
|
|
12239
|
+
}
|
|
12240
|
+
const registryUrl = config.registryUrl || "https://registry.prpm.dev";
|
|
12241
|
+
const headers = {
|
|
12242
|
+
"Content-Type": "application/json"
|
|
12243
|
+
};
|
|
12244
|
+
if (config.token) {
|
|
12245
|
+
headers["Authorization"] = `Bearer ${config.token}`;
|
|
12246
|
+
}
|
|
12247
|
+
const res = await fetch(`${registryUrl}/api/v1/ai-search`, {
|
|
12248
|
+
method: "POST",
|
|
12249
|
+
headers,
|
|
12250
|
+
body: JSON.stringify(searchRequest)
|
|
12251
|
+
});
|
|
12252
|
+
if (!res.ok) {
|
|
12253
|
+
const errorText = await res.text().catch(() => "Unknown error");
|
|
12254
|
+
throw new Error(`API error ${res.status}: ${errorText}`);
|
|
12255
|
+
}
|
|
12256
|
+
response = await res.json();
|
|
12257
|
+
if (!response || response.results.length === 0) {
|
|
12258
|
+
console.log("\n\u274C No packages found for your query");
|
|
12259
|
+
console.log("\nTry:");
|
|
12260
|
+
console.log(" - Rephrasing your query");
|
|
12261
|
+
console.log(" - Being more specific about your use case");
|
|
12262
|
+
console.log(" - Using traditional search: \x1B[36mprpm search <query>\x1B[0m");
|
|
12263
|
+
return;
|
|
12264
|
+
}
|
|
12265
|
+
displayAIResults(response);
|
|
12266
|
+
console.log("\n\u{1F4A1} \x1B[1mQuick Actions:\x1B[0m");
|
|
12267
|
+
console.log(" Install: \x1B[36mprpm install <package-name>\x1B[0m");
|
|
12268
|
+
console.log(" More info: \x1B[36mprpm info <package-name>\x1B[0m");
|
|
12269
|
+
console.log(" View in browser: \x1B[36mhttps://prpm.dev/search\x1B[0m\n");
|
|
12270
|
+
success = true;
|
|
12271
|
+
} catch (err) {
|
|
12272
|
+
error = err instanceof Error ? err.message : String(err);
|
|
12273
|
+
if (!error.includes("Authentication") && !error.includes("subscription")) {
|
|
12274
|
+
console.error(`
|
|
12275
|
+
\u274C AI search failed: ${error}`);
|
|
12276
|
+
console.log("\n\u{1F4A1} Tip: Try traditional search instead:");
|
|
12277
|
+
console.log(` \x1B[36mprpm search ${query}\x1B[0m
|
|
12278
|
+
`);
|
|
12279
|
+
}
|
|
12280
|
+
throw new CLIError(error, 1);
|
|
12281
|
+
} finally {
|
|
12282
|
+
await telemetry.track({
|
|
12283
|
+
command: "ai-search",
|
|
12284
|
+
success,
|
|
12285
|
+
error,
|
|
12286
|
+
duration: Date.now() - startTime,
|
|
12287
|
+
data: {
|
|
12288
|
+
query: query.substring(0, 100),
|
|
12289
|
+
format: options.format,
|
|
12290
|
+
subtype: options.subtype,
|
|
12291
|
+
resultCount: success && response ? response.results.length : 0,
|
|
12292
|
+
executionTime: response == null ? void 0 : response.execution_time_ms
|
|
12293
|
+
}
|
|
12294
|
+
});
|
|
12295
|
+
await telemetry.shutdown();
|
|
12296
|
+
}
|
|
12297
|
+
}
|
|
12298
|
+
function createAISearchCommand() {
|
|
12299
|
+
const command = new import_commander8.Command("ai-search");
|
|
12300
|
+
command.description("AI-powered semantic search (100% Free, no login required)").argument("<query>", "Natural language search query").option("--limit <number>", "Number of results to return (default: 10)", "10").option("--format <format>", "Filter by package format (cursor, claude, continue, etc.)").option("--subtype <subtype>", "Filter by package subtype (rule, agent, skill, etc.)").action(async (query, options) => {
|
|
12301
|
+
const limit = options.limit ? parseInt(options.limit, 10) : 10;
|
|
12302
|
+
await handleAISearch(query, { limit, format: options.format, subtype: options.subtype });
|
|
12303
|
+
});
|
|
12304
|
+
return command;
|
|
12305
|
+
}
|
|
12306
|
+
|
|
12307
|
+
// src/commands/info.ts
|
|
12308
|
+
init_cjs_shims();
|
|
12309
|
+
var import_commander9 = require("commander");
|
|
9929
12310
|
var import_registry_client3 = require("@pr-pm/registry-client");
|
|
9930
12311
|
init_user_config();
|
|
9931
12312
|
init_telemetry();
|
|
@@ -9990,7 +12371,7 @@ async function handleInfo(packageName) {
|
|
|
9990
12371
|
}
|
|
9991
12372
|
}
|
|
9992
12373
|
function createInfoCommand() {
|
|
9993
|
-
const command = new
|
|
12374
|
+
const command = new import_commander9.Command("info");
|
|
9994
12375
|
command.description("Display detailed package information").argument("<package>", "Package ID to get information about").action(async (packageId) => {
|
|
9995
12376
|
await handleInfo(packageId);
|
|
9996
12377
|
});
|
|
@@ -10002,7 +12383,7 @@ init_install();
|
|
|
10002
12383
|
|
|
10003
12384
|
// src/commands/publish.ts
|
|
10004
12385
|
init_cjs_shims();
|
|
10005
|
-
var
|
|
12386
|
+
var import_commander12 = require("commander");
|
|
10006
12387
|
var import_promises5 = require("fs/promises");
|
|
10007
12388
|
var import_path12 = require("path");
|
|
10008
12389
|
var tar2 = __toESM(require("tar"));
|
|
@@ -11222,14 +13603,14 @@ ${"=".repeat(60)}`);
|
|
|
11222
13603
|
}
|
|
11223
13604
|
}
|
|
11224
13605
|
function createPublishCommand() {
|
|
11225
|
-
return new
|
|
13606
|
+
return new import_commander12.Command("publish").description("Publish packages and collections to the registry").option("--access <type>", "Package access (public or private) - overrides manifest setting").option("--tag <tag>", "NPM-style tag (e.g., latest, beta)", "latest").option("--dry-run", "Validate package without publishing").option("--package <name>", "Publish only a specific package from multi-package manifest").option("--collection <id>", "Publish only a specific collection from manifest").action(async (options) => {
|
|
11226
13607
|
await handlePublish(options);
|
|
11227
13608
|
});
|
|
11228
13609
|
}
|
|
11229
13610
|
|
|
11230
13611
|
// src/commands/login.ts
|
|
11231
13612
|
init_cjs_shims();
|
|
11232
|
-
var
|
|
13613
|
+
var import_commander13 = require("commander");
|
|
11233
13614
|
var jwt = __toESM(require("jsonwebtoken"));
|
|
11234
13615
|
init_telemetry();
|
|
11235
13616
|
init_user_config();
|
|
@@ -11396,14 +13777,14 @@ async function handleLogin(options) {
|
|
|
11396
13777
|
}
|
|
11397
13778
|
}
|
|
11398
13779
|
function createLoginCommand() {
|
|
11399
|
-
return new
|
|
13780
|
+
return new import_commander13.Command("login").description("Login to the PRMP registry").option("--token <token>", "Login with a personal access token").action(async (options) => {
|
|
11400
13781
|
await handleLogin(options);
|
|
11401
13782
|
});
|
|
11402
13783
|
}
|
|
11403
13784
|
|
|
11404
13785
|
// src/commands/whoami.ts
|
|
11405
13786
|
init_cjs_shims();
|
|
11406
|
-
var
|
|
13787
|
+
var import_commander14 = require("commander");
|
|
11407
13788
|
init_user_config();
|
|
11408
13789
|
var import_registry_client7 = require("@pr-pm/registry-client");
|
|
11409
13790
|
init_telemetry();
|
|
@@ -11461,7 +13842,7 @@ async function handleWhoami() {
|
|
|
11461
13842
|
}
|
|
11462
13843
|
}
|
|
11463
13844
|
function createWhoamiCommand() {
|
|
11464
|
-
return new
|
|
13845
|
+
return new import_commander14.Command("whoami").description("Show current logged-in user").action(async () => {
|
|
11465
13846
|
await handleWhoami();
|
|
11466
13847
|
});
|
|
11467
13848
|
}
|
|
@@ -11471,7 +13852,7 @@ init_collections();
|
|
|
11471
13852
|
|
|
11472
13853
|
// src/commands/outdated.ts
|
|
11473
13854
|
init_cjs_shims();
|
|
11474
|
-
var
|
|
13855
|
+
var import_commander15 = require("commander");
|
|
11475
13856
|
var import_registry_client8 = require("@pr-pm/registry-client");
|
|
11476
13857
|
init_user_config();
|
|
11477
13858
|
init_lockfile();
|
|
@@ -11571,14 +13952,14 @@ function getUpdateType(current, latest) {
|
|
|
11571
13952
|
return "patch";
|
|
11572
13953
|
}
|
|
11573
13954
|
function createOutdatedCommand() {
|
|
11574
|
-
return new
|
|
13955
|
+
return new import_commander15.Command("outdated").description("Check for package updates").action(async () => {
|
|
11575
13956
|
await handleOutdated();
|
|
11576
13957
|
});
|
|
11577
13958
|
}
|
|
11578
13959
|
|
|
11579
13960
|
// src/commands/update.ts
|
|
11580
13961
|
init_cjs_shims();
|
|
11581
|
-
var
|
|
13962
|
+
var import_commander16 = require("commander");
|
|
11582
13963
|
var import_registry_client9 = require("@pr-pm/registry-client");
|
|
11583
13964
|
init_user_config();
|
|
11584
13965
|
init_lockfile();
|
|
@@ -11668,14 +14049,14 @@ function getUpdateType2(current, latest) {
|
|
|
11668
14049
|
return "patch";
|
|
11669
14050
|
}
|
|
11670
14051
|
function createUpdateCommand() {
|
|
11671
|
-
return new
|
|
14052
|
+
return new import_commander16.Command("update").description("Update packages to latest compatible versions (minor/patch only)").argument("[package]", "Specific package to update (optional)").option("--all", "Update all packages").action(async (packageName, options) => {
|
|
11672
14053
|
await handleUpdate(packageName, options);
|
|
11673
14054
|
});
|
|
11674
14055
|
}
|
|
11675
14056
|
|
|
11676
14057
|
// src/commands/upgrade.ts
|
|
11677
14058
|
init_cjs_shims();
|
|
11678
|
-
var
|
|
14059
|
+
var import_commander17 = require("commander");
|
|
11679
14060
|
var import_registry_client10 = require("@pr-pm/registry-client");
|
|
11680
14061
|
init_user_config();
|
|
11681
14062
|
init_lockfile();
|
|
@@ -11765,14 +14146,14 @@ function getUpdateType3(current, latest) {
|
|
|
11765
14146
|
return "patch";
|
|
11766
14147
|
}
|
|
11767
14148
|
function createUpgradeCommand() {
|
|
11768
|
-
return new
|
|
14149
|
+
return new import_commander17.Command("upgrade").description("Upgrade packages to latest versions (including major updates)").argument("[package]", "Specific package to upgrade (optional)").option("--all", "Upgrade all packages").option("--force", "Skip warning for major version upgrades").action(async (packageName, options) => {
|
|
11769
14150
|
await handleUpgrade(packageName, options);
|
|
11770
14151
|
});
|
|
11771
14152
|
}
|
|
11772
14153
|
|
|
11773
14154
|
// src/commands/schema.ts
|
|
11774
14155
|
init_cjs_shims();
|
|
11775
|
-
var
|
|
14156
|
+
var import_commander18 = require("commander");
|
|
11776
14157
|
init_errors();
|
|
11777
14158
|
async function handleSchema() {
|
|
11778
14159
|
try {
|
|
@@ -11789,7 +14170,7 @@ async function handleSchema() {
|
|
|
11789
14170
|
}
|
|
11790
14171
|
}
|
|
11791
14172
|
function createSchemaCommand() {
|
|
11792
|
-
const command = new
|
|
14173
|
+
const command = new import_commander18.Command("schema");
|
|
11793
14174
|
command.description("Display the PRPM manifest JSON schema").action(async () => {
|
|
11794
14175
|
await handleSchema();
|
|
11795
14176
|
});
|
|
@@ -11798,7 +14179,7 @@ function createSchemaCommand() {
|
|
|
11798
14179
|
|
|
11799
14180
|
// src/commands/init.ts
|
|
11800
14181
|
init_cjs_shims();
|
|
11801
|
-
var
|
|
14182
|
+
var import_commander19 = require("commander");
|
|
11802
14183
|
var import_promises6 = require("fs/promises");
|
|
11803
14184
|
var import_path13 = require("path");
|
|
11804
14185
|
var import_fs11 = require("fs");
|
|
@@ -12394,7 +14775,7 @@ Current files (${config.files.length}):`);
|
|
|
12394
14775
|
console.log(" 3. Run `prpm publish` to publish your package\n");
|
|
12395
14776
|
}
|
|
12396
14777
|
function createInitCommand() {
|
|
12397
|
-
const command = new
|
|
14778
|
+
const command = new import_commander19.Command("init");
|
|
12398
14779
|
command.description("Initialize a new PRPM package with interactive prompts").option("-y, --yes", "Skip prompts and use defaults").option("--private", "Create a private package").option("-f, --force", "Overwrite existing prpm.json").action(async (options) => {
|
|
12399
14780
|
try {
|
|
12400
14781
|
await initPackage(options);
|
|
@@ -12408,7 +14789,7 @@ function createInitCommand() {
|
|
|
12408
14789
|
|
|
12409
14790
|
// src/commands/config.ts
|
|
12410
14791
|
init_cjs_shims();
|
|
12411
|
-
var
|
|
14792
|
+
var import_commander20 = require("commander");
|
|
12412
14793
|
init_user_config();
|
|
12413
14794
|
init_errors();
|
|
12414
14795
|
async function handleConfigGet(key) {
|
|
@@ -12499,7 +14880,7 @@ async function handleConfigDelete(key) {
|
|
|
12499
14880
|
}
|
|
12500
14881
|
}
|
|
12501
14882
|
function createConfigCommand() {
|
|
12502
|
-
const command = new
|
|
14883
|
+
const command = new import_commander20.Command("config").description("Manage CLI configuration");
|
|
12503
14884
|
command.command("list").alias("ls").description("List all configuration values").action(async () => {
|
|
12504
14885
|
await handleConfigList();
|
|
12505
14886
|
});
|
|
@@ -12520,7 +14901,7 @@ function createConfigCommand() {
|
|
|
12520
14901
|
|
|
12521
14902
|
// src/commands/catalog.ts
|
|
12522
14903
|
init_cjs_shims();
|
|
12523
|
-
var
|
|
14904
|
+
var import_commander21 = require("commander");
|
|
12524
14905
|
var import_promises7 = require("fs/promises");
|
|
12525
14906
|
var import_path14 = require("path");
|
|
12526
14907
|
init_telemetry();
|
|
@@ -12812,14 +15193,14 @@ async function handleCatalog(directories, options) {
|
|
|
12812
15193
|
}
|
|
12813
15194
|
}
|
|
12814
15195
|
function createCatalogCommand() {
|
|
12815
|
-
return new
|
|
15196
|
+
return new import_commander21.Command("catalog").description("Discover and catalog existing packages from directories").argument("[directories...]", "Directories to scan for packages (defaults to current directory)", ["."]).option("-o, --output <path>", "Output path for prpm.json (default: ./prpm.json)").option("-a, --append", "Append to existing prpm.json instead of overwriting").option("--dry-run", "Show what would be cataloged without making changes").action(async (directories, options) => {
|
|
12816
15197
|
await handleCatalog(directories, options);
|
|
12817
15198
|
});
|
|
12818
15199
|
}
|
|
12819
15200
|
|
|
12820
15201
|
// src/commands/playground.ts
|
|
12821
15202
|
init_cjs_shims();
|
|
12822
|
-
var
|
|
15203
|
+
var import_commander22 = require("commander");
|
|
12823
15204
|
init_user_config();
|
|
12824
15205
|
init_telemetry();
|
|
12825
15206
|
var readline4 = __toESM(require("readline"));
|
|
@@ -13259,7 +15640,7 @@ async function handlePlayground(options) {
|
|
|
13259
15640
|
}
|
|
13260
15641
|
}
|
|
13261
15642
|
function createPlaygroundCommand() {
|
|
13262
|
-
const command = new
|
|
15643
|
+
const command = new import_commander22.Command("playground");
|
|
13263
15644
|
command.description("Test a package or custom prompt with AI models in the playground").option("-p, --package <name>", "Package name to test").option("--input <text>", "Input text to send to the model (omit for interactive mode)").option(
|
|
13264
15645
|
"-m, --model <model>",
|
|
13265
15646
|
"AI model to use (sonnet, opus, gpt-4o, gpt-4o-mini, gpt-4-turbo)",
|
|
@@ -13328,7 +15709,7 @@ Note: Playground usage requires credits. Run 'prpm credits' to check balance.
|
|
|
13328
15709
|
|
|
13329
15710
|
// src/commands/credits.ts
|
|
13330
15711
|
init_cjs_shims();
|
|
13331
|
-
var
|
|
15712
|
+
var import_commander23 = require("commander");
|
|
13332
15713
|
init_user_config();
|
|
13333
15714
|
init_telemetry();
|
|
13334
15715
|
init_errors();
|
|
@@ -13455,7 +15836,7 @@ async function handleCredits(options) {
|
|
|
13455
15836
|
}
|
|
13456
15837
|
}
|
|
13457
15838
|
function createCreditsCommand() {
|
|
13458
|
-
const command = new
|
|
15839
|
+
const command = new import_commander23.Command("credits");
|
|
13459
15840
|
command.description("Check playground credits balance and transaction history").option("-h, --history", "Show transaction history instead of balance", false).option("-l, --limit <number>", "Number of transactions to show in history", "10").addHelpText(
|
|
13460
15841
|
"after",
|
|
13461
15842
|
`
|
|
@@ -13490,7 +15871,7 @@ Get more credits:
|
|
|
13490
15871
|
|
|
13491
15872
|
// src/commands/subscribe.ts
|
|
13492
15873
|
init_cjs_shims();
|
|
13493
|
-
var
|
|
15874
|
+
var import_commander24 = require("commander");
|
|
13494
15875
|
init_user_config();
|
|
13495
15876
|
init_telemetry();
|
|
13496
15877
|
var import_child_process2 = require("child_process");
|
|
@@ -13649,7 +16030,7 @@ async function handleSubscribe() {
|
|
|
13649
16030
|
}
|
|
13650
16031
|
}
|
|
13651
16032
|
function createSubscribeCommand() {
|
|
13652
|
-
const command = new
|
|
16033
|
+
const command = new import_commander24.Command("subscribe");
|
|
13653
16034
|
command.description("Subscribe to PRPM+ for monthly playground credits and benefits").addHelpText(
|
|
13654
16035
|
"after",
|
|
13655
16036
|
`
|
|
@@ -13690,7 +16071,7 @@ Note: You can cancel anytime from https://prpm.dev/settings/billing
|
|
|
13690
16071
|
|
|
13691
16072
|
// src/commands/buy-credits.ts
|
|
13692
16073
|
init_cjs_shims();
|
|
13693
|
-
var
|
|
16074
|
+
var import_commander25 = require("commander");
|
|
13694
16075
|
init_user_config();
|
|
13695
16076
|
init_telemetry();
|
|
13696
16077
|
var import_child_process3 = require("child_process");
|
|
@@ -13831,7 +16212,7 @@ async function handleBuyCredits(options) {
|
|
|
13831
16212
|
}
|
|
13832
16213
|
}
|
|
13833
16214
|
function createBuyCreditsCommand() {
|
|
13834
|
-
const command = new
|
|
16215
|
+
const command = new import_commander25.Command("buy-credits");
|
|
13835
16216
|
command.description("Purchase one-time playground credits (never expire)").option(
|
|
13836
16217
|
"-p, --package <package>",
|
|
13837
16218
|
"Credit package to purchase (small, medium, large)"
|
|
@@ -13884,7 +16265,7 @@ Note: Purchased credits are one-time and never expire, unlike monthly credits.
|
|
|
13884
16265
|
|
|
13885
16266
|
// src/commands/starred.ts
|
|
13886
16267
|
init_cjs_shims();
|
|
13887
|
-
var
|
|
16268
|
+
var import_commander26 = require("commander");
|
|
13888
16269
|
var import_registry_client11 = require("@pr-pm/registry-client");
|
|
13889
16270
|
init_user_config();
|
|
13890
16271
|
init_telemetry();
|
|
@@ -14000,14 +16381,14 @@ Total: ${packages.length + collections.length} starred items`);
|
|
|
14000
16381
|
}
|
|
14001
16382
|
}
|
|
14002
16383
|
function createStarredCommand() {
|
|
14003
|
-
const command = new
|
|
16384
|
+
const command = new import_commander26.Command("starred");
|
|
14004
16385
|
command.description("List your starred packages and collections").option("--packages", "Show only starred packages").option("--collections", "Show only starred collections").option("--format <format>", "Filter packages by format (cursor, claude, continue, windsurf, etc.)").option("--limit <number>", "Maximum number of items to fetch (default: 100)", (val) => parseInt(val, 10)).action(handleStarred);
|
|
14005
16386
|
return command;
|
|
14006
16387
|
}
|
|
14007
16388
|
|
|
14008
16389
|
// src/commands/convert.ts
|
|
14009
16390
|
init_cjs_shims();
|
|
14010
|
-
var
|
|
16391
|
+
var import_commander27 = require("commander");
|
|
14011
16392
|
var import_promises8 = require("fs/promises");
|
|
14012
16393
|
var import_path15 = require("path");
|
|
14013
16394
|
var import_fs12 = require("fs");
|
|
@@ -14234,7 +16615,7 @@ async function handleConvert(sourcePath, options) {
|
|
|
14234
16615
|
}
|
|
14235
16616
|
}
|
|
14236
16617
|
function createConvertCommand() {
|
|
14237
|
-
const command = new
|
|
16618
|
+
const command = new import_commander27.Command("convert").description("Convert AI prompt files between formats").argument("<source>", "Source file path to convert").option("-t, --to <format>", "Target format (cursor, claude, windsurf, kiro, copilot, continue, agents.md)").option("-s, --subtype <subtype>", "Target subtype (agent, skill, slash-command, rule, prompt, etc.)").option("-o, --output <path>", "Output path (defaults to format-specific location)").option("-y, --yes", "Skip confirmation prompts").action(async (source, options) => {
|
|
14238
16619
|
try {
|
|
14239
16620
|
if (!options.to) {
|
|
14240
16621
|
throw new CLIError("Target format is required. Use --to <format>");
|
|
@@ -14283,11 +16664,12 @@ function getVersion() {
|
|
|
14283
16664
|
return "0.0.0";
|
|
14284
16665
|
}
|
|
14285
16666
|
}
|
|
14286
|
-
var program = new
|
|
16667
|
+
var program = new import_commander28.Command();
|
|
14287
16668
|
program.name("prpm").description("Prompt Package Manager - Install and manage prompt-based files").version(getVersion());
|
|
14288
16669
|
program.addCommand(createInitCommand());
|
|
14289
16670
|
program.addCommand(createCatalogCommand());
|
|
14290
16671
|
program.addCommand(createSearchCommand());
|
|
16672
|
+
program.addCommand(createAISearchCommand());
|
|
14291
16673
|
program.addCommand(createInstallCommand());
|
|
14292
16674
|
program.addCommand(createInfoCommand());
|
|
14293
16675
|
program.addCommand(createTrendingCommand());
|