@patterkit/compiler 0.9.0 → 0.10.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.cjs CHANGED
@@ -555,6 +555,7 @@ function extensionPass(input) {
555
555
  }
556
556
  }
557
557
  const bundle = {};
558
+ const chosen = new Map(takenList.map((t) => [t.id, t.settings]));
558
559
  for (const [id, manifest] of [...sound.entries()].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0)) {
559
560
  const fields = {};
560
561
  for (const kind of Object.keys(manifest.targets.patter ?? {}).sort()) {
@@ -562,7 +563,13 @@ function extensionPass(input) {
562
563
  if (target !== void 0) fields[kind] = (0, import_extensions.compiledTarget)(target);
563
564
  }
564
565
  const projectEntry = projectValues.get(id);
565
- bundle[id] = { version: manifest.version, fields, ...projectEntry !== void 0 ? { project: projectEntry } : {} };
566
+ const settings = (manifest.settings ?? []).length > 0 ? sortRecord((0, import_extensions.settingValues)(manifest, chosen.get(id))) : void 0;
567
+ bundle[id] = {
568
+ version: manifest.version,
569
+ fields,
570
+ ...projectEntry !== void 0 ? { project: projectEntry } : {},
571
+ ...settings !== void 0 ? { settings } : {}
572
+ };
566
573
  }
567
574
  const sortedNodes = new Map([...values.entries()].map(([id, v]) => [id, sortRecord(v)]));
568
575
  return { issues, compiled: { bundle, nodes: sortedNodes } };
@@ -592,10 +599,11 @@ function claimIssues(input, nodes, claims) {
592
599
  });
593
600
  continue;
594
601
  }
602
+ const effective = (0, import_extensions.effectiveClaim)(claim.claim, decl);
595
603
  for (const [id, node] of nodes) {
596
604
  if (node.kind !== claim.kind || node.gameData === void 0 || !own(node.gameData, claim.field)) continue;
597
605
  const file = (node.scene !== void 0 ? input.sceneFiles?.[node.scene] : void 0) ?? projectPath;
598
- for (const p of (0, import_extensions.valueProblems)(claim.claim, node.gameData[claim.field])) {
606
+ for (const p of (0, import_extensions.valueProblems)(effective, node.gameData[claim.field])) {
599
607
  issues.push({
600
608
  severity: p.severity,
601
609
  file,
@@ -809,7 +817,8 @@ function exportBundle(input) {
809
817
  Object.entries(project.gameDataFields).map(([kind, fields]) => [kind, resolved(fields)])
810
818
  ),
811
819
  // The extensions the project takes: each one's version, its compiled declarations by node kind (every
812
- // default resolved, editor-only fields and the editor's words left out) and the project node's values.
820
+ // default resolved, editor-only fields and the editor's words left out), the project node's values, and
821
+ // its settings, each the project's value or else the default.
813
822
  ...extensionSection !== void 0 ? { extensions: extensionSection } : {},
814
823
  // Closed-caption delimiters ride along only when the project pins a non-default pair (#214); the
815
824
  // runtime falls back to `[` / `]` when absent, so default projects keep their exact prior bundle.
package/dist/index.js CHANGED
@@ -324,10 +324,12 @@ import {
324
324
  claimClashes,
325
325
  compileEntry,
326
326
  compiledTarget,
327
+ effectiveClaim,
327
328
  entryProblems,
328
329
  manifestProblems,
329
330
  orphanedEntries,
330
331
  resolvedClaims,
332
+ settingValues,
331
333
  targetOf,
332
334
  valueProblems
333
335
  } from "@wildwinter/toolkit/extensions";
@@ -530,6 +532,7 @@ function extensionPass(input) {
530
532
  }
531
533
  }
532
534
  const bundle = {};
535
+ const chosen = new Map(takenList.map((t) => [t.id, t.settings]));
533
536
  for (const [id, manifest] of [...sound.entries()].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0)) {
534
537
  const fields = {};
535
538
  for (const kind of Object.keys(manifest.targets.patter ?? {}).sort()) {
@@ -537,7 +540,13 @@ function extensionPass(input) {
537
540
  if (target !== void 0) fields[kind] = compiledTarget(target);
538
541
  }
539
542
  const projectEntry = projectValues.get(id);
540
- bundle[id] = { version: manifest.version, fields, ...projectEntry !== void 0 ? { project: projectEntry } : {} };
543
+ const settings = (manifest.settings ?? []).length > 0 ? sortRecord(settingValues(manifest, chosen.get(id))) : void 0;
544
+ bundle[id] = {
545
+ version: manifest.version,
546
+ fields,
547
+ ...projectEntry !== void 0 ? { project: projectEntry } : {},
548
+ ...settings !== void 0 ? { settings } : {}
549
+ };
541
550
  }
542
551
  const sortedNodes = new Map([...values.entries()].map(([id, v]) => [id, sortRecord(v)]));
543
552
  return { issues, compiled: { bundle, nodes: sortedNodes } };
@@ -567,10 +576,11 @@ function claimIssues(input, nodes, claims) {
567
576
  });
568
577
  continue;
569
578
  }
579
+ const effective = effectiveClaim(claim.claim, decl);
570
580
  for (const [id, node] of nodes) {
571
581
  if (node.kind !== claim.kind || node.gameData === void 0 || !own(node.gameData, claim.field)) continue;
572
582
  const file = (node.scene !== void 0 ? input.sceneFiles?.[node.scene] : void 0) ?? projectPath;
573
- for (const p of valueProblems(claim.claim, node.gameData[claim.field])) {
583
+ for (const p of valueProblems(effective, node.gameData[claim.field])) {
574
584
  issues.push({
575
585
  severity: p.severity,
576
586
  file,
@@ -784,7 +794,8 @@ function exportBundle(input) {
784
794
  Object.entries(project.gameDataFields).map(([kind, fields]) => [kind, resolved(fields)])
785
795
  ),
786
796
  // The extensions the project takes: each one's version, its compiled declarations by node kind (every
787
- // default resolved, editor-only fields and the editor's words left out) and the project node's values.
797
+ // default resolved, editor-only fields and the editor's words left out), the project node's values, and
798
+ // its settings, each the project's value or else the default.
788
799
  ...extensionSection !== void 0 ? { extensions: extensionSection } : {},
789
800
  // Closed-caption delimiters ride along only when the project pins a non-default pair (#214); the
790
801
  // runtime falls back to `[` / `]` when absent, so default projects keep their exact prior bundle.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patterkit/compiler",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "Patter compiler: compile condition/effect expressions, validate them, and export source to the runtime bundle.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -34,11 +34,11 @@
34
34
  "build": "tsup src/index.ts --format esm,cjs --dts --clean"
35
35
  },
36
36
  "dependencies": {
37
- "@patterkit/model": "0.16.0",
38
- "@patterkit/core": "0.9.0",
39
- "@patterkit/dialect": "0.2.13",
37
+ "@patterkit/model": "0.17.0",
38
+ "@patterkit/core": "0.9.1",
39
+ "@patterkit/dialect": "0.2.14",
40
40
  "@wildwinter/expr": "^0.6.0",
41
- "@wildwinter/toolkit": "^0.2.0"
41
+ "@wildwinter/toolkit": "^0.2.1"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "@wildwinter/scoperegistry": ">=0.9.0 <1.0.0"