@wildwinter/toolkit 0.2.0 → 0.2.1
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 +9 -0
- package/conformance/extensions/manifest.json +1023 -158
- package/conformance/extensions/values.json +736 -91
- package/dist/extensions.cjs +18 -3
- package/dist/extensions.cjs.map +1 -1
- package/dist/extensions.d.cts +12 -1
- package/dist/extensions.d.ts +12 -1
- package/dist/extensions.js +18 -4
- package/dist/extensions.js.map +1 -1
- package/extensions.md +4 -1
- package/package.json +1 -1
package/dist/extensions.cjs
CHANGED
|
@@ -406,7 +406,7 @@ function targetProblems(host, kind, target, path, settings, out) {
|
|
|
406
406
|
if (!SCALAR_TYPES.includes(claim.type)) {
|
|
407
407
|
out.push(err2("claim-type", atKey(at, "type"), "a claim presents a host field, which is a scalar"));
|
|
408
408
|
} else {
|
|
409
|
-
typeProblems(host, claim, at, false, out);
|
|
409
|
+
typeProblems(host, claim, at, false, out, true);
|
|
410
410
|
}
|
|
411
411
|
if (typeof claim.setting !== "string" || !settings.has(claim.setting)) {
|
|
412
412
|
out.push(err2("claim-setting", atKey(at, "setting"), `a claim names its field through a setting, and "${String(claim.setting)}" is not one of the manifest's settings`));
|
|
@@ -449,7 +449,7 @@ function fieldListProblems(host, fields, path, topLevel, out) {
|
|
|
449
449
|
}
|
|
450
450
|
});
|
|
451
451
|
}
|
|
452
|
-
function typeProblems(host, decl, path, named, out) {
|
|
452
|
+
function typeProblems(host, decl, path, named, out, claim = false) {
|
|
453
453
|
const typeAt = atKey(path, "type");
|
|
454
454
|
if (decl.type === "string") {
|
|
455
455
|
out.push(err2("string-type", typeAt, 'the text type is spelled "text"'));
|
|
@@ -465,6 +465,7 @@ function typeProblems(host, decl, path, named, out) {
|
|
|
465
465
|
case "enum":
|
|
466
466
|
case "flags": {
|
|
467
467
|
const values = decl.values;
|
|
468
|
+
if (claim && values === void 0) break;
|
|
468
469
|
if (!Array.isArray(values) || values.length === 0) {
|
|
469
470
|
out.push(err2("values-empty", at("values"), `an ${decl.type === "enum" ? "enum" : "flags field"} lists its values`));
|
|
470
471
|
sound = false;
|
|
@@ -483,6 +484,7 @@ function typeProblems(host, decl, path, named, out) {
|
|
|
483
484
|
break;
|
|
484
485
|
}
|
|
485
486
|
case "quality": {
|
|
487
|
+
if (claim && decl.stages === void 0) break;
|
|
486
488
|
for (const p of expr.qualityDeclarationProblems(decl.stages)) {
|
|
487
489
|
out.push(err2(
|
|
488
490
|
`quality-${p.kind === "default-not-a-stage" ? "default" : p.kind}`,
|
|
@@ -542,7 +544,11 @@ function typeProblems(host, decl, path, named, out) {
|
|
|
542
544
|
}
|
|
543
545
|
}
|
|
544
546
|
if (decl.renamedStages !== void 0) renamedStagesProblems(decl, at("renamedStages"), out);
|
|
545
|
-
if (decl.valueHelp !== void 0) {
|
|
547
|
+
if (decl.valueHelp !== void 0 && claim) {
|
|
548
|
+
if (!isObject(decl.valueHelp) || !["enum", "flags", "quality"].includes(decl.type)) {
|
|
549
|
+
out.push(err2("value-help", at("valueHelp"), "value help describes the values of an enum or flags field, or a quality's stages"));
|
|
550
|
+
}
|
|
551
|
+
} else if (decl.valueHelp !== void 0) {
|
|
546
552
|
const vocabulary = decl.type === "quality" ? decl.stages : decl.type === "enum" || decl.type === "flags" ? decl.values : void 0;
|
|
547
553
|
if (vocabulary === void 0 || !isObject(decl.valueHelp)) {
|
|
548
554
|
out.push(err2("value-help", at("valueHelp"), "value help describes the values of an enum or flags field, or a quality's stages"));
|
|
@@ -623,6 +629,14 @@ function targetOf(manifest, host, kind) {
|
|
|
623
629
|
const kinds = manifest?.targets[host];
|
|
624
630
|
return kinds !== void 0 && own(kinds, kind) ? kinds[kind] : void 0;
|
|
625
631
|
}
|
|
632
|
+
function effectiveClaim(claim, hostDecl) {
|
|
633
|
+
return {
|
|
634
|
+
...claim,
|
|
635
|
+
...claim.values === void 0 && hostDecl.values !== void 0 ? { values: hostDecl.values } : {},
|
|
636
|
+
...claim.stages === void 0 && hostDecl.stages !== void 0 ? { stages: hostDecl.stages } : {},
|
|
637
|
+
...claim.default === void 0 && hostDecl.default !== void 0 ? { default: hostDecl.default } : {}
|
|
638
|
+
};
|
|
639
|
+
}
|
|
626
640
|
|
|
627
641
|
// src/extensions/merge.ts
|
|
628
642
|
var ATOMIC = { kind: "atomic" };
|
|
@@ -907,6 +921,7 @@ exports.claimClashes = claimClashes;
|
|
|
907
921
|
exports.compileEntry = compileEntry;
|
|
908
922
|
exports.compiledTarget = compiledTarget;
|
|
909
923
|
exports.defaultOf = defaultOf;
|
|
924
|
+
exports.effectiveClaim = effectiveClaim;
|
|
910
925
|
exports.entryProblems = entryProblems;
|
|
911
926
|
exports.extensionDataStrategy = extensionDataStrategy;
|
|
912
927
|
exports.keyedBy = keyedBy;
|