@wildwinter/toolkit 0.2.6 → 0.2.7
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/CHANGELOG.md +7 -0
- package/conformance/extensions/manifest.json +75 -0
- package/dist/extensions.cjs +9 -3
- package/dist/extensions.cjs.map +1 -1
- package/dist/extensions.js +9 -3
- package/dist/extensions.js.map +1 -1
- package/extensions.md +4 -2
- package/package.json +1 -1
package/dist/extensions.js
CHANGED
|
@@ -414,6 +414,10 @@ function manifestProblems(manifest) {
|
|
|
414
414
|
}
|
|
415
415
|
return out;
|
|
416
416
|
}
|
|
417
|
+
function pickWords(from) {
|
|
418
|
+
if (!Array.isArray(from)) return [];
|
|
419
|
+
return from.flatMap((s) => isObject(s) && Array.isArray(s["words"]) ? s["words"].filter((w) => typeof w === "string") : []);
|
|
420
|
+
}
|
|
417
421
|
function pickSourcesSound(host, from, path, out) {
|
|
418
422
|
if (!Array.isArray(from) || from.length === 0) {
|
|
419
423
|
out.push(err2("pick-from", path, 'a pick lists its sources in "from": { "words": [...] }, { "to": a node kind }, or { "list": a project list }'));
|
|
@@ -761,12 +765,14 @@ function typeProblems(host, decl, path, named, out, claim = false) {
|
|
|
761
765
|
out.push(err2("value-help", at("valueHelp"), "value help describes the values of an enum or flags field, or a quality's stages"));
|
|
762
766
|
}
|
|
763
767
|
} else if (decl.valueHelp !== void 0) {
|
|
764
|
-
const vocabulary = decl.type === "quality" ? decl.stages : decl.type === "enum" || decl.type === "flags" ? decl.values : void 0;
|
|
768
|
+
const vocabulary = decl.type === "quality" ? decl.stages : decl.type === "enum" || decl.type === "flags" ? decl.values : decl.type === "pick" ? pickWords(decl.from) : void 0;
|
|
765
769
|
if (vocabulary === void 0 || !isObject(decl.valueHelp)) {
|
|
766
|
-
out.push(err2("value-help", at("valueHelp"), "value help describes the values of an enum or flags field, or a
|
|
770
|
+
out.push(err2("value-help", at("valueHelp"), "value help describes the values of an enum or flags field, a quality's stages, or a pick's words"));
|
|
767
771
|
} else {
|
|
768
772
|
for (const k of Object.keys(decl.valueHelp)) {
|
|
769
|
-
if (!vocabulary.includes(k))
|
|
773
|
+
if (!vocabulary.includes(k)) {
|
|
774
|
+
out.push(err2("value-help", atKey(at("valueHelp"), k), decl.type === "pick" ? `"${k}" is not one of its words: value help describes a pick's fixed words, never the project's lists or nodes` : `"${k}" is not one of its values`));
|
|
775
|
+
}
|
|
770
776
|
}
|
|
771
777
|
}
|
|
772
778
|
}
|