@wildwinter/toolkit 0.2.6 → 0.3.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.
@@ -9,10 +9,8 @@ interface HostSpec {
9
9
  readonly kinds: readonly string[];
10
10
  /** The node kinds a `reference` may point at. */
11
11
  readonly references: readonly string[];
12
- /** The node kinds with host fields of their own, which a claim may present. */
13
- readonly claimable: readonly string[];
14
12
  }
15
- /** Each host's node kinds, references and claimable kinds. */
13
+ /** Each host's node kinds and references. */
16
14
  declare const HOSTS: Readonly<Record<HostName, HostSpec>>;
17
15
  /** The family's seven scalar types, spelled as the family spells them. */
18
16
  declare const SCALAR_TYPES: readonly ["text", "multiline", "number", "boolean", "enum", "flags", "quality"];
@@ -83,25 +81,9 @@ interface FieldDecl extends TypeDecl {
83
81
  /** Stripped at compile: editor data, never in a bundle. A target's own fields only. */
84
82
  readonly editorOnly?: boolean;
85
83
  }
86
- /** A claim on a host field, named through one of the manifest's settings. */
87
- interface ClaimDecl extends TypeDecl {
88
- readonly setting: string;
89
- readonly label?: string;
90
- readonly help?: string;
91
- readonly required?: boolean;
92
- }
93
84
  /** What an extension declares for one node kind of one host. */
94
85
  interface TargetDecl {
95
86
  readonly fields?: readonly FieldDecl[];
96
- readonly claims?: readonly ClaimDecl[];
97
- }
98
- /** A project setting, naming a host field a claim presents. */
99
- interface SettingDecl {
100
- readonly name: string;
101
- readonly label?: string;
102
- readonly help?: string;
103
- /** The field name used when the project names none. */
104
- readonly default: string;
105
87
  }
106
88
  interface Manifest {
107
89
  readonly schema: string;
@@ -109,7 +91,6 @@ interface Manifest {
109
91
  readonly name: string;
110
92
  readonly version: string;
111
93
  readonly docs?: string;
112
- readonly settings?: readonly SettingDecl[];
113
94
  readonly targets: Readonly<Partial<Record<HostName, Readonly<Record<string, TargetDecl>>>>>;
114
95
  /** Views the extension's installed package supplies (tier 2), each a web component a host opens in a window. */
115
96
  readonly views?: readonly ViewDecl[];
@@ -167,35 +148,8 @@ declare function isViewEntry(entry: unknown): entry is string;
167
148
  /** The views a host offers from a manifest: those naming the host, or every view when it names none and the
168
149
  * manifest targets the host. A view that fails its checks is left out. */
169
150
  declare function viewsFor(manifest: Manifest, host: HostName): ViewDecl[];
170
- /** The host field each of a manifest's settings names, the project's choice
171
- * first, else the setting's default. */
172
- declare function settingValues(manifest: Manifest, chosen?: Readonly<Record<string, unknown>>): Record<string, string>;
173
- /** A claim as a project resolves it: the host field it presents, by name. */
174
- interface ResolvedClaim {
175
- readonly extension: string;
176
- readonly host: HostName;
177
- readonly kind: string;
178
- /** The host field's name, through the setting. */
179
- readonly field: string;
180
- readonly claim: ClaimDecl;
181
- }
182
- /** Every claim of a manifest for one host, resolved through the project's settings. */
183
- declare function resolvedClaims(manifest: Manifest, host: HostName, chosen?: Readonly<Record<string, unknown>>): ResolvedClaim[];
184
- /** Two extensions claiming one host field: an error naming both, once per pair. */
185
- declare function claimClashes(claims: readonly ResolvedClaim[]): Problem[];
186
151
  /** One manifest's declarations for one host and node kind, or undefined. */
187
152
  declare function targetOf(manifest: Manifest | undefined, host: HostName, kind: string): TargetDecl | undefined;
188
- /**
189
- * A claim as a host draws and checks its field: the claim's label, help, value help and constraints, over the
190
- * host's own declaration for what the claim leaves out (an enum's or flags' values, a quality's stages, the
191
- * default). The host's vocabulary stands when the claim names none, as the host's ladder always does.
192
- */
193
- declare function effectiveClaim<C extends ClaimDecl>(claim: C, hostDecl: {
194
- readonly type?: string;
195
- readonly values?: readonly string[];
196
- readonly stages?: readonly string[];
197
- readonly default?: unknown;
198
- }): C;
199
153
 
200
154
  /** What the host knows about its nodes, for references, and about the extension's project lists, for picks. */
201
155
  interface ValueContext {
@@ -418,4 +372,4 @@ declare const atKey: (base: string, key: string) => string;
418
372
  /** `base` and then list position `i`. */
419
373
  declare const atIndex: (base: string, i: number) => string;
420
374
 
421
- export { ATOMIC, COMMENTS, type ClaimDecl, type Conflict, type ConflictKind, type DataMergeResult, type ExtensionData, type FieldDecl, HOSTS, type HostName, type HostSpec, type JsonValue, MANIFEST_FILE_SUFFIX, MANIFEST_SCHEMA, type Manifest, type MergeWarning, type PickChoice, type PickSource, type PickSources, type Problem, type ResolvedClaim, SCALAR_TYPES, SET, type ScalarType, type SettingDecl, type StageRename, type Strategy, type TargetDecl, type TreeMergeOptions, type TreeMergeResult, type TypeDecl, UNRESOLVED_KEY, type UnresolvedEntry, VALUE_TYPES, type ValueContext, type ValueType, type ViewDecl, atIndex, atKey, claimClashes, compileEntry, compiledTarget, defaultOf, effectiveClaim, entryProblems, extensionDataStrategy, isTextList, isViewEntry, keyedBy, manifestProblems, mapOf, markUnresolved, mergeComments, mergeExtensionData, mergeTree, objectOf, orphanedEntries, parseManifest, pickChoices, pickClashes, pickLists, renameStages, resolvedClaims, settingValues, stableStringify, strategyForTarget, strategyForType, targetOf, unresolvedOf, unresolvedProblems, valueProblems, viewsFor, withoutMark };
375
+ export { ATOMIC, COMMENTS, type Conflict, type ConflictKind, type DataMergeResult, type ExtensionData, type FieldDecl, HOSTS, type HostName, type HostSpec, type JsonValue, MANIFEST_FILE_SUFFIX, MANIFEST_SCHEMA, type Manifest, type MergeWarning, type PickChoice, type PickSource, type PickSources, type Problem, SCALAR_TYPES, SET, type ScalarType, type StageRename, type Strategy, type TargetDecl, type TreeMergeOptions, type TreeMergeResult, type TypeDecl, UNRESOLVED_KEY, type UnresolvedEntry, VALUE_TYPES, type ValueContext, type ValueType, type ViewDecl, atIndex, atKey, compileEntry, compiledTarget, defaultOf, entryProblems, extensionDataStrategy, isTextList, isViewEntry, keyedBy, manifestProblems, mapOf, markUnresolved, mergeComments, mergeExtensionData, mergeTree, objectOf, orphanedEntries, parseManifest, pickChoices, pickClashes, pickLists, renameStages, stableStringify, strategyForTarget, strategyForType, targetOf, unresolvedOf, unresolvedProblems, valueProblems, viewsFor, withoutMark };
@@ -9,10 +9,8 @@ interface HostSpec {
9
9
  readonly kinds: readonly string[];
10
10
  /** The node kinds a `reference` may point at. */
11
11
  readonly references: readonly string[];
12
- /** The node kinds with host fields of their own, which a claim may present. */
13
- readonly claimable: readonly string[];
14
12
  }
15
- /** Each host's node kinds, references and claimable kinds. */
13
+ /** Each host's node kinds and references. */
16
14
  declare const HOSTS: Readonly<Record<HostName, HostSpec>>;
17
15
  /** The family's seven scalar types, spelled as the family spells them. */
18
16
  declare const SCALAR_TYPES: readonly ["text", "multiline", "number", "boolean", "enum", "flags", "quality"];
@@ -83,25 +81,9 @@ interface FieldDecl extends TypeDecl {
83
81
  /** Stripped at compile: editor data, never in a bundle. A target's own fields only. */
84
82
  readonly editorOnly?: boolean;
85
83
  }
86
- /** A claim on a host field, named through one of the manifest's settings. */
87
- interface ClaimDecl extends TypeDecl {
88
- readonly setting: string;
89
- readonly label?: string;
90
- readonly help?: string;
91
- readonly required?: boolean;
92
- }
93
84
  /** What an extension declares for one node kind of one host. */
94
85
  interface TargetDecl {
95
86
  readonly fields?: readonly FieldDecl[];
96
- readonly claims?: readonly ClaimDecl[];
97
- }
98
- /** A project setting, naming a host field a claim presents. */
99
- interface SettingDecl {
100
- readonly name: string;
101
- readonly label?: string;
102
- readonly help?: string;
103
- /** The field name used when the project names none. */
104
- readonly default: string;
105
87
  }
106
88
  interface Manifest {
107
89
  readonly schema: string;
@@ -109,7 +91,6 @@ interface Manifest {
109
91
  readonly name: string;
110
92
  readonly version: string;
111
93
  readonly docs?: string;
112
- readonly settings?: readonly SettingDecl[];
113
94
  readonly targets: Readonly<Partial<Record<HostName, Readonly<Record<string, TargetDecl>>>>>;
114
95
  /** Views the extension's installed package supplies (tier 2), each a web component a host opens in a window. */
115
96
  readonly views?: readonly ViewDecl[];
@@ -167,35 +148,8 @@ declare function isViewEntry(entry: unknown): entry is string;
167
148
  /** The views a host offers from a manifest: those naming the host, or every view when it names none and the
168
149
  * manifest targets the host. A view that fails its checks is left out. */
169
150
  declare function viewsFor(manifest: Manifest, host: HostName): ViewDecl[];
170
- /** The host field each of a manifest's settings names, the project's choice
171
- * first, else the setting's default. */
172
- declare function settingValues(manifest: Manifest, chosen?: Readonly<Record<string, unknown>>): Record<string, string>;
173
- /** A claim as a project resolves it: the host field it presents, by name. */
174
- interface ResolvedClaim {
175
- readonly extension: string;
176
- readonly host: HostName;
177
- readonly kind: string;
178
- /** The host field's name, through the setting. */
179
- readonly field: string;
180
- readonly claim: ClaimDecl;
181
- }
182
- /** Every claim of a manifest for one host, resolved through the project's settings. */
183
- declare function resolvedClaims(manifest: Manifest, host: HostName, chosen?: Readonly<Record<string, unknown>>): ResolvedClaim[];
184
- /** Two extensions claiming one host field: an error naming both, once per pair. */
185
- declare function claimClashes(claims: readonly ResolvedClaim[]): Problem[];
186
151
  /** One manifest's declarations for one host and node kind, or undefined. */
187
152
  declare function targetOf(manifest: Manifest | undefined, host: HostName, kind: string): TargetDecl | undefined;
188
- /**
189
- * A claim as a host draws and checks its field: the claim's label, help, value help and constraints, over the
190
- * host's own declaration for what the claim leaves out (an enum's or flags' values, a quality's stages, the
191
- * default). The host's vocabulary stands when the claim names none, as the host's ladder always does.
192
- */
193
- declare function effectiveClaim<C extends ClaimDecl>(claim: C, hostDecl: {
194
- readonly type?: string;
195
- readonly values?: readonly string[];
196
- readonly stages?: readonly string[];
197
- readonly default?: unknown;
198
- }): C;
199
153
 
200
154
  /** What the host knows about its nodes, for references, and about the extension's project lists, for picks. */
201
155
  interface ValueContext {
@@ -418,4 +372,4 @@ declare const atKey: (base: string, key: string) => string;
418
372
  /** `base` and then list position `i`. */
419
373
  declare const atIndex: (base: string, i: number) => string;
420
374
 
421
- export { ATOMIC, COMMENTS, type ClaimDecl, type Conflict, type ConflictKind, type DataMergeResult, type ExtensionData, type FieldDecl, HOSTS, type HostName, type HostSpec, type JsonValue, MANIFEST_FILE_SUFFIX, MANIFEST_SCHEMA, type Manifest, type MergeWarning, type PickChoice, type PickSource, type PickSources, type Problem, type ResolvedClaim, SCALAR_TYPES, SET, type ScalarType, type SettingDecl, type StageRename, type Strategy, type TargetDecl, type TreeMergeOptions, type TreeMergeResult, type TypeDecl, UNRESOLVED_KEY, type UnresolvedEntry, VALUE_TYPES, type ValueContext, type ValueType, type ViewDecl, atIndex, atKey, claimClashes, compileEntry, compiledTarget, defaultOf, effectiveClaim, entryProblems, extensionDataStrategy, isTextList, isViewEntry, keyedBy, manifestProblems, mapOf, markUnresolved, mergeComments, mergeExtensionData, mergeTree, objectOf, orphanedEntries, parseManifest, pickChoices, pickClashes, pickLists, renameStages, resolvedClaims, settingValues, stableStringify, strategyForTarget, strategyForType, targetOf, unresolvedOf, unresolvedProblems, valueProblems, viewsFor, withoutMark };
375
+ export { ATOMIC, COMMENTS, type Conflict, type ConflictKind, type DataMergeResult, type ExtensionData, type FieldDecl, HOSTS, type HostName, type HostSpec, type JsonValue, MANIFEST_FILE_SUFFIX, MANIFEST_SCHEMA, type Manifest, type MergeWarning, type PickChoice, type PickSource, type PickSources, type Problem, SCALAR_TYPES, SET, type ScalarType, type StageRename, type Strategy, type TargetDecl, type TreeMergeOptions, type TreeMergeResult, type TypeDecl, UNRESOLVED_KEY, type UnresolvedEntry, VALUE_TYPES, type ValueContext, type ValueType, type ViewDecl, atIndex, atKey, compileEntry, compiledTarget, defaultOf, entryProblems, extensionDataStrategy, isTextList, isViewEntry, keyedBy, manifestProblems, mapOf, markUnresolved, mergeComments, mergeExtensionData, mergeTree, objectOf, orphanedEntries, parseManifest, pickChoices, pickClashes, pickLists, renameStages, stableStringify, strategyForTarget, strategyForType, targetOf, unresolvedOf, unresolvedProblems, valueProblems, viewsFor, withoutMark };
@@ -8,13 +8,11 @@ var MANIFEST_FILE_SUFFIX = ".extension.json";
8
8
  var HOSTS = {
9
9
  patter: {
10
10
  kinds: ["scene", "block", "snippet", "line", "text", "gameEvent", "option", "project"],
11
- references: ["cast", "scene", "block", "snippet", "line"],
12
- claimable: ["scene", "block", "snippet", "line", "text", "gameEvent", "option"]
11
+ references: ["cast", "scene", "block", "snippet", "line"]
13
12
  },
14
13
  storylets: {
15
14
  kinds: ["box", "tagGroup", "tag", "deck", "card", "outcome", "handTemplate", "hand", "project"],
16
- references: ["box", "deck", "card", "outcome", "tag"],
17
- claimable: ["card", "outcome"]
15
+ references: ["box", "deck", "card", "outcome", "tag"]
18
16
  }
19
17
  };
20
18
  var SCALAR_TYPES = ["text", "multiline", "number", "boolean", "enum", "flags", "quality"];
@@ -358,9 +356,14 @@ var VERSION = /^\d+\.\d+\.\d+$/;
358
356
  var NAME = /^[A-Za-z_][A-Za-z0-9_]*$/;
359
357
  var TYPE_KEYS = ["type", "values", "stages", "renamedStages", "to", "from", "fields", "key", "of", "id", "min", "max", "valueHelp", "default"];
360
358
  var FIELD_KEYS = /* @__PURE__ */ new Set([...TYPE_KEYS, "name", "label", "help", "required", "group", "editorOnly"]);
361
- var CLAIM_KEYS = /* @__PURE__ */ new Set([...TYPE_KEYS, "setting", "label", "help", "required"]);
362
359
  var BARE_KEYS = new Set(TYPE_KEYS);
363
- var MANIFEST_KEYS = /* @__PURE__ */ new Set(["schema", "id", "name", "version", "docs", "settings", "targets", "views", "reads"]);
360
+ var MANIFEST_KEYS = /* @__PURE__ */ new Set(["schema", "id", "name", "version", "docs", "targets", "views", "reads"]);
361
+ var REMOVED_MANIFEST_KEYS = {
362
+ settings: "settings were removed with claims; declare the extension's own fields, or a project field for a project-wide value"
363
+ };
364
+ var REMOVED_TARGET_KEYS = {
365
+ claims: "claims on host fields were removed; declare a field of the extension's own, which the runtimes hand the game"
366
+ };
364
367
  var VIEW_KEYS = /* @__PURE__ */ new Set(["id", "name", "entry", "element", "hosts"]);
365
368
  var ELEMENT = /^[a-z][a-z0-9._]*-[a-z0-9._-]*$/;
366
369
  var err2 = (code, path, message) => ({ severity: "error", code, path, message });
@@ -371,7 +374,7 @@ function manifestProblems(manifest) {
371
374
  const out = [];
372
375
  if (!isObject(manifest)) return [err2("not-an-object", "", "a manifest is a JSON object")];
373
376
  const m = manifest;
374
- unknownKeys(m, MANIFEST_KEYS, "", out);
377
+ unknownKeys(m, MANIFEST_KEYS, "", out, REMOVED_MANIFEST_KEYS);
375
378
  if (m["schema"] !== MANIFEST_SCHEMA) {
376
379
  out.push(err2("schema", "schema", `the schema tag is ${JSON.stringify(m["schema"])}, not "${MANIFEST_SCHEMA}"`));
377
380
  }
@@ -383,7 +386,6 @@ function manifestProblems(manifest) {
383
386
  out.push(err2("version", "version", "the version is major.minor.patch, such as 1.0.0"));
384
387
  }
385
388
  if (m["docs"] !== void 0 && typeof m["docs"] !== "string") out.push(err2("docs", "docs", "docs is a link, as text"));
386
- const settings = settingsProblems(m["settings"], out);
387
389
  viewsProblems(m["views"], m["targets"], out);
388
390
  readsProblems(m["reads"], m["id"], out);
389
391
  const targets = m["targets"];
@@ -408,12 +410,16 @@ function manifestProblems(manifest) {
408
410
  out.push(err2("unknown-kind", kindPath, `"${kind}" is not a node kind of ${host}; it has ${spec.kinds.join(", ")}`));
409
411
  continue;
410
412
  }
411
- targetProblems(host, kind, target, kindPath, settings, out);
413
+ targetProblems(host, target, kindPath, out);
412
414
  }
413
415
  pickListProblems(kinds, hostPath, out);
414
416
  }
415
417
  return out;
416
418
  }
419
+ function pickWords(from) {
420
+ if (!Array.isArray(from)) return [];
421
+ return from.flatMap((s) => isObject(s) && Array.isArray(s["words"]) ? s["words"].filter((w) => typeof w === "string") : []);
422
+ }
417
423
  function pickSourcesSound(host, from, path, out) {
418
424
  if (!Array.isArray(from) || from.length === 0) {
419
425
  out.push(err2("pick-from", path, 'a pick lists its sources in "from": { "words": [...] }, { "to": a node kind }, or { "list": a project list }'));
@@ -550,81 +556,23 @@ function viewsFor(manifest, host) {
550
556
  const targeted = Object.keys(manifest.targets ?? {});
551
557
  return (Array.isArray(manifest.views) ? manifest.views : []).filter((v) => isObject(v) && typeof v.id === "string" && ID.test(v.id) && typeof v.name === "string" && isViewEntry(v.entry) && typeof v.element === "string" && ELEMENT.test(v.element) && (v.hosts === void 0 ? targeted.includes(host) : Array.isArray(v.hosts) && v.hosts.includes(host)));
552
558
  }
553
- function unknownKeys(obj, known, path, out) {
559
+ function unknownKeys(obj, known, path, out, removed = {}) {
554
560
  for (const k of Object.keys(obj)) {
555
- if (!known.has(k)) {
561
+ if (own(removed, k)) {
562
+ out.push({ severity: "warning", code: "removed-key", path: atKey(path, k), message: `"${k}" is ignored: ${removed[k]}` });
563
+ } else if (!known.has(k)) {
556
564
  out.push({ severity: "warning", code: "unknown-key", path: atKey(path, k), message: `"${k}" means nothing here; it is ignored` });
557
565
  }
558
566
  }
559
567
  }
560
- function settingsProblems(settings, out) {
561
- const names = /* @__PURE__ */ new Set();
562
- if (settings === void 0) return names;
563
- if (!Array.isArray(settings)) {
564
- out.push(err2("not-a-list", "settings", "settings are a list"));
565
- return names;
566
- }
567
- settings.forEach((s, i) => {
568
- const at = atIndex("settings", i);
569
- if (!isObject(s)) {
570
- out.push(err2("not-an-object", at, "a setting is an object"));
571
- return;
572
- }
573
- const name = s["name"];
574
- if (typeof name !== "string" || !NAME.test(name)) {
575
- out.push(err2("setting-name", atKey(at, "name"), "a setting's name is an identifier"));
576
- } else if (names.has(name)) {
577
- out.push(err2("setting-duplicate", atKey(at, "name"), `setting "${name}" is declared twice`));
578
- } else {
579
- names.add(name);
580
- }
581
- const dflt = s.default;
582
- if (typeof dflt !== "string" || !NAME.test(dflt)) {
583
- out.push(err2("setting-default", atKey(at, "default"), "a setting names a host field by default, so its default is a field name"));
584
- }
585
- });
586
- return names;
587
- }
588
- function targetProblems(host, kind, target, path, settings, out) {
568
+ function targetProblems(host, target, path, out) {
589
569
  if (!isObject(target)) {
590
570
  out.push(err2("not-an-object", path, "a target is an object"));
591
571
  return;
592
572
  }
593
- unknownKeys(target, /* @__PURE__ */ new Set(["fields", "claims"]), path, out);
573
+ unknownKeys(target, /* @__PURE__ */ new Set(["fields"]), path, out, REMOVED_TARGET_KEYS);
594
574
  const t = target;
595
575
  if (t.fields !== void 0) fieldListProblems(host, t.fields, atKey(path, "fields"), true, out);
596
- if (t.claims === void 0) return;
597
- if (!Array.isArray(t.claims)) {
598
- out.push(err2("not-a-list", atKey(path, "claims"), "claims are a list"));
599
- return;
600
- }
601
- const claimable = HOSTS[host].claimable.includes(kind);
602
- const claimed = /* @__PURE__ */ new Set();
603
- t.claims.forEach((c, i) => {
604
- const at = atIndex(atKey(path, "claims"), i);
605
- if (!claimable) {
606
- out.push(err2("claim-kind", at, `a ${kind} has no host fields to claim; ${host} has them on ${HOSTS[host].claimable.join(", ")}`));
607
- return;
608
- }
609
- if (!isObject(c)) {
610
- out.push(err2("not-an-object", at, "a claim is an object"));
611
- return;
612
- }
613
- const claim = c;
614
- unknownKeys(c, CLAIM_KEYS, at, out);
615
- if (!SCALAR_TYPES.includes(claim.type)) {
616
- out.push(err2("claim-type", atKey(at, "type"), "a claim presents a host field, which is a scalar"));
617
- } else {
618
- typeProblems(host, claim, at, false, out, true);
619
- }
620
- if (typeof claim.setting !== "string" || !settings.has(claim.setting)) {
621
- 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`));
622
- } else if (claimed.has(claim.setting)) {
623
- out.push(err2("claim-duplicate", atKey(at, "setting"), `setting "${claim.setting}" is claimed twice for one kind`));
624
- } else {
625
- claimed.add(claim.setting);
626
- }
627
- });
628
576
  }
629
577
  function fieldListProblems(host, fields, path, topLevel, out) {
630
578
  if (!Array.isArray(fields)) {
@@ -658,7 +606,7 @@ function fieldListProblems(host, fields, path, topLevel, out) {
658
606
  }
659
607
  });
660
608
  }
661
- function typeProblems(host, decl, path, named, out, claim = false) {
609
+ function typeProblems(host, decl, path, named, out) {
662
610
  const typeAt = atKey(path, "type");
663
611
  if (decl.type === "string") {
664
612
  out.push(err2("string-type", typeAt, 'the text type is spelled "text"'));
@@ -674,7 +622,6 @@ function typeProblems(host, decl, path, named, out, claim = false) {
674
622
  case "enum":
675
623
  case "flags": {
676
624
  const values = decl.values;
677
- if (claim && values === void 0) break;
678
625
  if (!Array.isArray(values) || values.length === 0) {
679
626
  out.push(err2("values-empty", at("values"), `an ${decl.type === "enum" ? "enum" : "flags field"} lists its values`));
680
627
  sound = false;
@@ -693,7 +640,6 @@ function typeProblems(host, decl, path, named, out, claim = false) {
693
640
  break;
694
641
  }
695
642
  case "quality": {
696
- if (claim && decl.stages === void 0) break;
697
643
  for (const p of qualityDeclarationProblems(decl.stages)) {
698
644
  out.push(err2(
699
645
  `quality-${p.kind === "default-not-a-stage" ? "default" : p.kind}`,
@@ -756,17 +702,15 @@ function typeProblems(host, decl, path, named, out, claim = false) {
756
702
  }
757
703
  }
758
704
  if (decl.renamedStages !== void 0) renamedStagesProblems(decl, at("renamedStages"), out);
759
- if (decl.valueHelp !== void 0 && claim) {
760
- if (!isObject(decl.valueHelp) || !["enum", "flags", "quality"].includes(decl.type)) {
761
- out.push(err2("value-help", at("valueHelp"), "value help describes the values of an enum or flags field, or a quality's stages"));
762
- }
763
- } else if (decl.valueHelp !== void 0) {
764
- const vocabulary = decl.type === "quality" ? decl.stages : decl.type === "enum" || decl.type === "flags" ? decl.values : void 0;
705
+ if (decl.valueHelp !== void 0) {
706
+ const vocabulary = decl.type === "quality" ? decl.stages : decl.type === "enum" || decl.type === "flags" ? decl.values : decl.type === "pick" ? pickWords(decl.from) : void 0;
765
707
  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 quality's stages"));
708
+ 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
709
  } else {
768
710
  for (const k of Object.keys(decl.valueHelp)) {
769
- if (!vocabulary.includes(k)) out.push(err2("value-help", atKey(at("valueHelp"), k), `"${k}" is not one of its values`));
711
+ if (!vocabulary.includes(k)) {
712
+ 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`));
713
+ }
770
714
  }
771
715
  }
772
716
  }
@@ -799,56 +743,10 @@ function renamedStagesProblems(decl, path, out) {
799
743
  }
800
744
  }
801
745
  }
802
- function settingValues(manifest, chosen) {
803
- const out = {};
804
- for (const s of manifest.settings ?? []) {
805
- const v = chosen !== void 0 && own(chosen, s.name) ? chosen[s.name] : void 0;
806
- out[s.name] = typeof v === "string" && v !== "" ? v : s.default;
807
- }
808
- return out;
809
- }
810
- function resolvedClaims(manifest, host, chosen) {
811
- const settings = settingValues(manifest, chosen);
812
- const out = [];
813
- for (const [kind, target] of Object.entries(manifest.targets[host] ?? {})) {
814
- for (const claim of target.claims ?? []) {
815
- const field = settings[claim.setting];
816
- if (field !== void 0) out.push({ extension: manifest.id, host, kind, field, claim });
817
- }
818
- }
819
- return out;
820
- }
821
- function claimClashes(claims) {
822
- const out = [];
823
- const first = /* @__PURE__ */ new Map();
824
- for (const c of claims) {
825
- const key = `${c.host}\0${c.kind}\0${c.field}`;
826
- const prior = first.get(key);
827
- if (prior === void 0) {
828
- first.set(key, c);
829
- continue;
830
- }
831
- if (prior.extension === c.extension) continue;
832
- out.push(err2(
833
- "claim-clash",
834
- `${c.kind}.${c.field}`,
835
- `extensions "${prior.extension}" and "${c.extension}" both claim the ${c.kind} field "${c.field}"`
836
- ));
837
- }
838
- return out;
839
- }
840
746
  function targetOf(manifest, host, kind) {
841
747
  const kinds = manifest?.targets[host];
842
748
  return kinds !== void 0 && own(kinds, kind) ? kinds[kind] : void 0;
843
749
  }
844
- function effectiveClaim(claim, hostDecl) {
845
- return {
846
- ...claim,
847
- ...claim.values === void 0 && hostDecl.values !== void 0 ? { values: hostDecl.values } : {},
848
- ...claim.stages === void 0 && hostDecl.stages !== void 0 ? { stages: hostDecl.stages } : {},
849
- ...claim.default === void 0 && hostDecl.default !== void 0 ? { default: hostDecl.default } : {}
850
- };
851
- }
852
750
 
853
751
  // src/extensions/merge.ts
854
752
  var ATOMIC = { kind: "atomic" };
@@ -1187,6 +1085,6 @@ function orphanedEntries(data, exists) {
1187
1085
  return out;
1188
1086
  }
1189
1087
 
1190
- export { ATOMIC, COMMENTS, HOSTS, MANIFEST_FILE_SUFFIX, MANIFEST_SCHEMA, SCALAR_TYPES, SET, UNRESOLVED_KEY, VALUE_TYPES, atIndex, atKey, claimClashes, compileEntry, compiledTarget, defaultOf, effectiveClaim, entryProblems, extensionDataStrategy, isTextList, isViewEntry, keyedBy, manifestProblems, mapOf, markUnresolved, mergeComments, mergeExtensionData, mergeTree, objectOf, orphanedEntries, parseManifest, pickChoices, pickClashes, pickLists, renameStages, resolvedClaims, settingValues, stableStringify, strategyForTarget, strategyForType, targetOf, unresolvedOf, unresolvedProblems, valueProblems, viewsFor, withoutMark };
1088
+ export { ATOMIC, COMMENTS, HOSTS, MANIFEST_FILE_SUFFIX, MANIFEST_SCHEMA, SCALAR_TYPES, SET, UNRESOLVED_KEY, VALUE_TYPES, atIndex, atKey, compileEntry, compiledTarget, defaultOf, entryProblems, extensionDataStrategy, isTextList, isViewEntry, keyedBy, manifestProblems, mapOf, markUnresolved, mergeComments, mergeExtensionData, mergeTree, objectOf, orphanedEntries, parseManifest, pickChoices, pickClashes, pickLists, renameStages, stableStringify, strategyForTarget, strategyForType, targetOf, unresolvedOf, unresolvedProblems, valueProblems, viewsFor, withoutMark };
1191
1089
  //# sourceMappingURL=extensions.js.map
1192
1090
  //# sourceMappingURL=extensions.js.map