@rpgm-tools/neo-angband-mod-sdk 0.16.0 → 0.18.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/contested.d.ts +1 -1
- package/dist/contested.d.ts.map +1 -1
- package/dist/contested.js +2 -0
- package/dist/contested.js.map +1 -1
- package/dist/semver.d.ts +14 -8
- package/dist/semver.d.ts.map +1 -1
- package/dist/semver.js +55 -10
- package/dist/semver.js.map +1 -1
- package/package.json +1 -1
- package/src/contested.ts +4 -1
- package/src/semver.ts +53 -10
package/dist/contested.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ export type ContestedLayer = "record" | "graphics" | "behaviour" | "rule" | "con
|
|
|
46
46
|
* are the ones worth a player's attention; the rest combine, and are reported so
|
|
47
47
|
* the picture is complete rather than because anything is wrong.
|
|
48
48
|
*/
|
|
49
|
-
export type Fold = "last-wins" | "last-answer" | "single-slot" | "all-must-agree" | "chained" | "any-yes";
|
|
49
|
+
export type Fold = "last-wins" | "last-answer" | "single-slot" | "all-must-agree" | "chained" | "any-yes" | "all-observe";
|
|
50
50
|
/** Whether a fold silently drops somebody's contribution. */
|
|
51
51
|
export declare function foldDiscards(fold: Fold): boolean;
|
|
52
52
|
/** One mod's claim on one slot. */
|
package/dist/contested.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contested.d.ts","sourceRoot":"","sources":["../src/contested.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,2DAA2D;AAC3D,MAAM,MAAM,cAAc,GACtB,QAAQ,GACR,UAAU,GACV,WAAW,GACX,MAAM,GACN,YAAY,CAAC;AAEjB;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,IAAI,GACZ,WAAW,GACX,aAAa,GACb,aAAa,GACb,gBAAgB,GAChB,SAAS,GACT,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"contested.d.ts","sour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,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,EAAE,GAC7D,aAAa,EAAE,CA6BjB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,gBAAgB;IAC/B,iCAAiC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,2EAA2E;IAC3E,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,gDAAgD;AAChD,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,gBAAgB,EAC1B,MAAM,GAAE,MAAmB,GAC1B,MAAM,CAGR"}
|
package/dist/contested.js
CHANGED
|
@@ -80,6 +80,8 @@ export function describeContested(slot, nameOf = (id) => id) {
|
|
|
80
80
|
return `${who} all change ${slot.what}, in load order, each one seeing the last one's result.`;
|
|
81
81
|
case "any-yes":
|
|
82
82
|
return `${who} all ask for ${slot.what}; one asking is enough, so they do not conflict.`;
|
|
83
|
+
case "all-observe":
|
|
84
|
+
return `${who} are all told about ${slot.what}; none of them answers, so they do not conflict.`;
|
|
83
85
|
}
|
|
84
86
|
}
|
|
85
87
|
/**
|
package/dist/contested.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contested.js","sourceRoot":"","sources":["../src/contested.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;
|
|
1
|
+
{"version":3,"file":"contested.js","sourceRoot":"","sources":["../src/contested.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AA+BH,6DAA6D;AAC7D,MAAM,UAAU,YAAY,CAAC,IAAU;IACrC,OAAO,IAAI,KAAK,WAAW,IAAI,IAAI,KAAK,aAAa,IAAI,IAAI,KAAK,aAAa,CAAC;AAClF,CAAC;AAiCD,2DAA2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K,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACjF,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,2BAA2B,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,KAAK,KAAK,QAAQ,CAAC,OAAO,EAAE,CAAC;AACnH,CAAC"}
|
package/dist/semver.d.ts
CHANGED
|
@@ -18,14 +18,20 @@
|
|
|
18
18
|
* - comparator sets: `>=`, `>`, `<=`, `<`, `=`, combined with spaces and
|
|
19
19
|
* ANDed together, e.g. `>=1.0.0 <2.0.0`.
|
|
20
20
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
21
|
+
* Prerelease tags (`1.0.0-beta.2`) are ordered by the spec's rule: split on
|
|
22
|
+
* dots, compare identifier by identifier, numeric identifiers numerically and
|
|
23
|
+
* ranking below alphanumeric ones, and a longer identifier list wins a tie
|
|
24
|
+
* against its own prefix. A version with no prerelease outranks any prerelease
|
|
25
|
+
* of the same major.minor.patch.
|
|
26
|
+
*
|
|
27
|
+
* THIS USED TO BE A DOCUMENTED LIMITATION - one lexicographic string compare -
|
|
28
|
+
* and the note said pack authors needing exact prerelease ordering should not
|
|
29
|
+
* rely on it. That was honest while nothing did. Then the updater's `early`
|
|
30
|
+
* channel started naming builds `0.16.1-edge.7`, and a string compare puts
|
|
31
|
+
* `edge.9` ABOVE `edge.10`: the tenth build of the day would not be offered to
|
|
32
|
+
* anyone running the ninth, and the game would sit there reporting itself up to
|
|
33
|
+
* date. A documented limitation stops being documentation the moment something
|
|
34
|
+
* depends on it, so it is implemented rather than described.
|
|
29
35
|
*/
|
|
30
36
|
export declare class SemverError extends Error {
|
|
31
37
|
}
|
package/dist/semver.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"semver.d.ts","sourceRoot":"","sources":["../src/semver.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"semver.d.ts","sourceRoot":"","sources":["../src/semver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,qBAAa,WAAY,SAAQ,KAAK;CAAG;AAgGzC;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAUjE;AAgID;;;GAGG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAWjE"}
|
package/dist/semver.js
CHANGED
|
@@ -18,14 +18,20 @@
|
|
|
18
18
|
* - comparator sets: `>=`, `>`, `<=`, `<`, `=`, combined with spaces and
|
|
19
19
|
* ANDed together, e.g. `>=1.0.0 <2.0.0`.
|
|
20
20
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
21
|
+
* Prerelease tags (`1.0.0-beta.2`) are ordered by the spec's rule: split on
|
|
22
|
+
* dots, compare identifier by identifier, numeric identifiers numerically and
|
|
23
|
+
* ranking below alphanumeric ones, and a longer identifier list wins a tie
|
|
24
|
+
* against its own prefix. A version with no prerelease outranks any prerelease
|
|
25
|
+
* of the same major.minor.patch.
|
|
26
|
+
*
|
|
27
|
+
* THIS USED TO BE A DOCUMENTED LIMITATION - one lexicographic string compare -
|
|
28
|
+
* and the note said pack authors needing exact prerelease ordering should not
|
|
29
|
+
* rely on it. That was honest while nothing did. Then the updater's `early`
|
|
30
|
+
* channel started naming builds `0.16.1-edge.7`, and a string compare puts
|
|
31
|
+
* `edge.9` ABOVE `edge.10`: the tenth build of the day would not be offered to
|
|
32
|
+
* anyone running the ninth, and the game would sit there reporting itself up to
|
|
33
|
+
* date. A documented limitation stops being documentation the moment something
|
|
34
|
+
* depends on it, so it is implemented rather than described.
|
|
29
35
|
*/
|
|
30
36
|
export class SemverError extends Error {
|
|
31
37
|
}
|
|
@@ -53,7 +59,46 @@ function parseVersion(s) {
|
|
|
53
59
|
}
|
|
54
60
|
return { major: p.major, minor: p.minor, patch: p.patch, prerelease: p.prerelease };
|
|
55
61
|
}
|
|
56
|
-
|
|
62
|
+
const NUMERIC_ID = /^\d+$/u;
|
|
63
|
+
/**
|
|
64
|
+
* Order two prerelease tags by semver's rule (spec item 11.4).
|
|
65
|
+
*
|
|
66
|
+
* Identifier by identifier: two numeric identifiers compare as numbers, two
|
|
67
|
+
* alphanumeric ones compare as ASCII, and a numeric identifier always ranks
|
|
68
|
+
* BELOW an alphanumeric one. Running out of identifiers first loses, so
|
|
69
|
+
* `1.0.0-alpha` precedes `1.0.0-alpha.1`.
|
|
70
|
+
*/
|
|
71
|
+
function comparePrerelease(a, b) {
|
|
72
|
+
const left = a.split(".");
|
|
73
|
+
const right = b.split(".");
|
|
74
|
+
for (let i = 0; i < Math.max(left.length, right.length); i++) {
|
|
75
|
+
const l = left[i];
|
|
76
|
+
const r = right[i];
|
|
77
|
+
/* One side ran out: the shorter list is the lower precedence. */
|
|
78
|
+
if (l === undefined)
|
|
79
|
+
return -1;
|
|
80
|
+
if (r === undefined)
|
|
81
|
+
return 1;
|
|
82
|
+
if (l === r)
|
|
83
|
+
continue;
|
|
84
|
+
const lNum = NUMERIC_ID.test(l);
|
|
85
|
+
const rNum = NUMERIC_ID.test(r);
|
|
86
|
+
/* Numeric identifiers always have lower precedence than alphanumeric ones,
|
|
87
|
+
* which is why this cannot be a string compare with a numeric special case:
|
|
88
|
+
* `beta` outranks `2`, and "2" < "beta" in ASCII only by luck of the table. */
|
|
89
|
+
if (lNum !== rNum)
|
|
90
|
+
return lNum ? -1 : 1;
|
|
91
|
+
if (lNum && rNum) {
|
|
92
|
+
/* Number(), not localeCompare: `edge.9` vs `edge.10` is the case that
|
|
93
|
+
* made this function exist, and it is the one a string compare gets
|
|
94
|
+
* backwards. Leading zeroes are not legal semver, so parsing is safe. */
|
|
95
|
+
return Number(l) < Number(r) ? -1 : 1;
|
|
96
|
+
}
|
|
97
|
+
return l < r ? -1 : 1;
|
|
98
|
+
}
|
|
99
|
+
return 0;
|
|
100
|
+
}
|
|
101
|
+
/** -1 if a < b, 0 if equal, 1 if a > b. */
|
|
57
102
|
function compareVersions(a, b) {
|
|
58
103
|
if (a.major !== b.major)
|
|
59
104
|
return a.major - b.major < 0 ? -1 : 1;
|
|
@@ -67,7 +112,7 @@ function compareVersions(a, b) {
|
|
|
67
112
|
return 1; // no prerelease outranks any prerelease
|
|
68
113
|
if (b.prerelease === null)
|
|
69
114
|
return -1;
|
|
70
|
-
return a.prerelease
|
|
115
|
+
return comparePrerelease(a.prerelease, b.prerelease);
|
|
71
116
|
}
|
|
72
117
|
/**
|
|
73
118
|
* Order two version strings: negative if `a` is older, 0 if equal, positive if
|
package/dist/semver.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"semver.js","sourceRoot":"","sources":["../src/semver.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"semver.js","sourceRoot":"","sources":["../src/semver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,MAAM,OAAO,WAAY,SAAQ,KAAK;CAAG;AAgBzC,MAAM,UAAU,GACd,yEAAyE,CAAC;AAE5E,SAAS,eAAe,CAAC,CAAS;IAChC,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC;AAC7C,CAAC;AAED,6EAA6E;AAC7E,SAAS,YAAY,CAAC,CAAS;IAC7B,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjC,IAAI,CAAC,KAAK,EA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,CAAC,qBAAqB,CAAC,CAAC;IAC/C,CAAC;IACD,IAAI,OAAO,KAAK,GAAG,IAAI,OAAO,CAAC,WAAW,EAAE,KAAK,GAAG,EAAE,CAAC;QACrD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,CAAC,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;IAChC,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACpC,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rpgm-tools/neo-angband-mod-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.0",
|
|
4
4
|
"description": "Pack schemas, validation, and tooling for Neo Angband mods (content packs, tile packs, scripted plugins)",
|
|
5
5
|
"license": "GPL-2.0-only",
|
|
6
6
|
"author": "neostryder (RPGM Tools)",
|
package/src/contested.ts
CHANGED
|
@@ -59,7 +59,8 @@ export type Fold =
|
|
|
59
59
|
| "single-slot" // only one may hold it; a later claim displaces the earlier silently
|
|
60
60
|
| "all-must-agree" // every claim runs and any refusal decides
|
|
61
61
|
| "chained" // each claim transforms the previous one's result, so the last speaks last
|
|
62
|
-
| "any-yes"
|
|
62
|
+
| "any-yes" // one claim asking is enough
|
|
63
|
+
| "all-observe"; // a notification: every claim is told, and none of them answers
|
|
63
64
|
|
|
64
65
|
/** Whether a fold silently drops somebody's contribution. */
|
|
65
66
|
export function foldDiscards(fold: Fold): boolean {
|
|
@@ -143,6 +144,8 @@ export function describeContested(slot: ContestedSlot, nameOf: NameOf = (id) =>
|
|
|
143
144
|
return `${who} all change ${slot.what}, in load order, each one seeing the last one's result.`;
|
|
144
145
|
case "any-yes":
|
|
145
146
|
return `${who} all ask for ${slot.what}; one asking is enough, so they do not conflict.`;
|
|
147
|
+
case "all-observe":
|
|
148
|
+
return `${who} are all told about ${slot.what}; none of them answers, so they do not conflict.`;
|
|
146
149
|
}
|
|
147
150
|
}
|
|
148
151
|
|
package/src/semver.ts
CHANGED
|
@@ -18,14 +18,20 @@
|
|
|
18
18
|
* - comparator sets: `>=`, `>`, `<=`, `<`, `=`, combined with spaces and
|
|
19
19
|
* ANDed together, e.g. `>=1.0.0 <2.0.0`.
|
|
20
20
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
21
|
+
* Prerelease tags (`1.0.0-beta.2`) are ordered by the spec's rule: split on
|
|
22
|
+
* dots, compare identifier by identifier, numeric identifiers numerically and
|
|
23
|
+
* ranking below alphanumeric ones, and a longer identifier list wins a tie
|
|
24
|
+
* against its own prefix. A version with no prerelease outranks any prerelease
|
|
25
|
+
* of the same major.minor.patch.
|
|
26
|
+
*
|
|
27
|
+
* THIS USED TO BE A DOCUMENTED LIMITATION - one lexicographic string compare -
|
|
28
|
+
* and the note said pack authors needing exact prerelease ordering should not
|
|
29
|
+
* rely on it. That was honest while nothing did. Then the updater's `early`
|
|
30
|
+
* channel started naming builds `0.16.1-edge.7`, and a string compare puts
|
|
31
|
+
* `edge.9` ABOVE `edge.10`: the tenth build of the day would not be offered to
|
|
32
|
+
* anyone running the ninth, and the game would sit there reporting itself up to
|
|
33
|
+
* date. A documented limitation stops being documentation the moment something
|
|
34
|
+
* depends on it, so it is implemented rather than described.
|
|
29
35
|
*/
|
|
30
36
|
|
|
31
37
|
export class SemverError extends Error {}
|
|
@@ -76,7 +82,44 @@ function parseVersion(s: string): FullVersion {
|
|
|
76
82
|
return { major: p.major, minor: p.minor, patch: p.patch, prerelease: p.prerelease };
|
|
77
83
|
}
|
|
78
84
|
|
|
79
|
-
|
|
85
|
+
const NUMERIC_ID = /^\d+$/u;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Order two prerelease tags by semver's rule (spec item 11.4).
|
|
89
|
+
*
|
|
90
|
+
* Identifier by identifier: two numeric identifiers compare as numbers, two
|
|
91
|
+
* alphanumeric ones compare as ASCII, and a numeric identifier always ranks
|
|
92
|
+
* BELOW an alphanumeric one. Running out of identifiers first loses, so
|
|
93
|
+
* `1.0.0-alpha` precedes `1.0.0-alpha.1`.
|
|
94
|
+
*/
|
|
95
|
+
function comparePrerelease(a: string, b: string): number {
|
|
96
|
+
const left = a.split(".");
|
|
97
|
+
const right = b.split(".");
|
|
98
|
+
for (let i = 0; i < Math.max(left.length, right.length); i++) {
|
|
99
|
+
const l = left[i];
|
|
100
|
+
const r = right[i];
|
|
101
|
+
/* One side ran out: the shorter list is the lower precedence. */
|
|
102
|
+
if (l === undefined) return -1;
|
|
103
|
+
if (r === undefined) return 1;
|
|
104
|
+
if (l === r) continue;
|
|
105
|
+
const lNum = NUMERIC_ID.test(l);
|
|
106
|
+
const rNum = NUMERIC_ID.test(r);
|
|
107
|
+
/* Numeric identifiers always have lower precedence than alphanumeric ones,
|
|
108
|
+
* which is why this cannot be a string compare with a numeric special case:
|
|
109
|
+
* `beta` outranks `2`, and "2" < "beta" in ASCII only by luck of the table. */
|
|
110
|
+
if (lNum !== rNum) return lNum ? -1 : 1;
|
|
111
|
+
if (lNum && rNum) {
|
|
112
|
+
/* Number(), not localeCompare: `edge.9` vs `edge.10` is the case that
|
|
113
|
+
* made this function exist, and it is the one a string compare gets
|
|
114
|
+
* backwards. Leading zeroes are not legal semver, so parsing is safe. */
|
|
115
|
+
return Number(l) < Number(r) ? -1 : 1;
|
|
116
|
+
}
|
|
117
|
+
return l < r ? -1 : 1;
|
|
118
|
+
}
|
|
119
|
+
return 0;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** -1 if a < b, 0 if equal, 1 if a > b. */
|
|
80
123
|
function compareVersions(a: FullVersion, b: FullVersion): number {
|
|
81
124
|
if (a.major !== b.major) return a.major - b.major < 0 ? -1 : 1;
|
|
82
125
|
if (a.minor !== b.minor) return a.minor - b.minor < 0 ? -1 : 1;
|
|
@@ -84,7 +127,7 @@ function compareVersions(a: FullVersion, b: FullVersion): number {
|
|
|
84
127
|
if (a.prerelease === b.prerelease) return 0;
|
|
85
128
|
if (a.prerelease === null) return 1; // no prerelease outranks any prerelease
|
|
86
129
|
if (b.prerelease === null) return -1;
|
|
87
|
-
return a.prerelease
|
|
130
|
+
return comparePrerelease(a.prerelease, b.prerelease);
|
|
88
131
|
}
|
|
89
132
|
|
|
90
133
|
/**
|