@patterkit/compiler 0.14.0 → 0.15.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
@@ -454,6 +454,16 @@ function extensionPass(input) {
454
454
  takenList.push({ id, manifest });
455
455
  }
456
456
  const sound = new Map(takenList.filter((t) => t.manifest !== void 0).map((t) => [t.id, t.manifest]));
457
+ for (const [id, manifest] of sound) {
458
+ for (const req of (0, import_extensions.missingRequirements)(manifest, Object.keys(taken))) {
459
+ issues.push({
460
+ severity: "warning",
461
+ file: projectPath,
462
+ code: "requires-missing",
463
+ message: `the project takes "${id}", which requires the extension "${req}", but doesn't take it; add "${req}" to the project, or ${manifest.name} won't work in the game`
464
+ });
465
+ }
466
+ }
457
467
  const nodes = extensionNodes(project, scenes);
458
468
  const exists = (kind, id) => kind === "cast" ? (project.cast ?? []).some((c) => c.name === id) : nodes.get(id)?.kind === kind;
459
469
  const projectId = project.project.id;
@@ -755,6 +765,8 @@ function exportBundle(input) {
755
765
  }
756
766
  }
757
767
  }
768
+ const startScene = project.start ? scenesOut[project.start.scene] : void 0;
769
+ const start = startScene === void 0 ? void 0 : project.start.block !== void 0 && startScene.blocks.some((b) => b.id === project.start.block) ? { scene: project.start.scene, block: project.start.block } : { scene: project.start.scene };
758
770
  return {
759
771
  schema: "patter/bundle@0",
760
772
  content: {
@@ -772,7 +784,8 @@ function exportBundle(input) {
772
784
  ...qualifiers.length > 0 ? { qualifiers } : {},
773
785
  ...typeof project.padAfterDefault === "number" ? { padAfterDefault: project.padAfterDefault } : {},
774
786
  // Each node's values are in `scenes`; the declarations and the project's own values are here.
775
- ...extensionSection !== void 0 ? { extensions: extensionSection } : {}
787
+ ...extensionSection !== void 0 ? { extensions: extensionSection } : {},
788
+ ...start !== void 0 ? { start } : {}
776
789
  }, { trailingComma: false })),
777
790
  // Structure-only fingerprint (live bundle refresh): the same hash with the string tables left
778
791
  // out. Same structureHash + a different hash = a text-only edit, safe to swap in place with
@@ -784,11 +797,15 @@ function exportBundle(input) {
784
797
  ...foreignScopes ? { scopeRegistry: foreignScopes } : {},
785
798
  ...qualifiers.length > 0 ? { qualifiers } : {},
786
799
  ...typeof project.padAfterDefault === "number" ? { padAfterDefault: project.padAfterDefault } : {},
787
- ...extensionSection !== void 0 ? { extensions: extensionSection } : {}
800
+ ...extensionSection !== void 0 ? { extensions: extensionSection } : {},
801
+ ...start !== void 0 ? { start } : {}
788
802
  }, { trailingComma: false }))
789
803
  },
790
804
  voiced: project.voiced ?? false,
791
805
  locales: { default: project.locales.default, included: Object.keys(strings) },
806
+ // Where a flow opened without a scene starts: the project's start, when it names a scene (and block) the
807
+ // bundle has. Absent otherwise, and every runtime starts at the first scene (validate says so).
808
+ ...start !== void 0 ? { start } : {},
792
809
  // The cast is copied field by field, on purpose. Most of a CastMember is authoring context that must
793
810
  // never reach players: `notes` are production chatter, `gender` is translator context (it rides the
794
811
  // localisation formats), and `actor` is a real person's name (it belongs in the VO script). Listing
package/dist/index.js CHANGED
@@ -325,6 +325,7 @@ import {
325
325
  compiledTarget,
326
326
  entryProblems,
327
327
  manifestProblems,
328
+ missingRequirements,
328
329
  orphanedEntries,
329
330
  pickClashes,
330
331
  pickLists,
@@ -428,6 +429,16 @@ function extensionPass(input) {
428
429
  takenList.push({ id, manifest });
429
430
  }
430
431
  const sound = new Map(takenList.filter((t) => t.manifest !== void 0).map((t) => [t.id, t.manifest]));
432
+ for (const [id, manifest] of sound) {
433
+ for (const req of missingRequirements(manifest, Object.keys(taken))) {
434
+ issues.push({
435
+ severity: "warning",
436
+ file: projectPath,
437
+ code: "requires-missing",
438
+ message: `the project takes "${id}", which requires the extension "${req}", but doesn't take it; add "${req}" to the project, or ${manifest.name} won't work in the game`
439
+ });
440
+ }
441
+ }
431
442
  const nodes = extensionNodes(project, scenes);
432
443
  const exists = (kind, id) => kind === "cast" ? (project.cast ?? []).some((c) => c.name === id) : nodes.get(id)?.kind === kind;
433
444
  const projectId = project.project.id;
@@ -729,6 +740,8 @@ function exportBundle(input) {
729
740
  }
730
741
  }
731
742
  }
743
+ const startScene = project.start ? scenesOut[project.start.scene] : void 0;
744
+ const start = startScene === void 0 ? void 0 : project.start.block !== void 0 && startScene.blocks.some((b) => b.id === project.start.block) ? { scene: project.start.scene, block: project.start.block } : { scene: project.start.scene };
732
745
  return {
733
746
  schema: "patter/bundle@0",
734
747
  content: {
@@ -746,7 +759,8 @@ function exportBundle(input) {
746
759
  ...qualifiers.length > 0 ? { qualifiers } : {},
747
760
  ...typeof project.padAfterDefault === "number" ? { padAfterDefault: project.padAfterDefault } : {},
748
761
  // Each node's values are in `scenes`; the declarations and the project's own values are here.
749
- ...extensionSection !== void 0 ? { extensions: extensionSection } : {}
762
+ ...extensionSection !== void 0 ? { extensions: extensionSection } : {},
763
+ ...start !== void 0 ? { start } : {}
750
764
  }, { trailingComma: false })),
751
765
  // Structure-only fingerprint (live bundle refresh): the same hash with the string tables left
752
766
  // out. Same structureHash + a different hash = a text-only edit, safe to swap in place with
@@ -758,11 +772,15 @@ function exportBundle(input) {
758
772
  ...foreignScopes ? { scopeRegistry: foreignScopes } : {},
759
773
  ...qualifiers.length > 0 ? { qualifiers } : {},
760
774
  ...typeof project.padAfterDefault === "number" ? { padAfterDefault: project.padAfterDefault } : {},
761
- ...extensionSection !== void 0 ? { extensions: extensionSection } : {}
775
+ ...extensionSection !== void 0 ? { extensions: extensionSection } : {},
776
+ ...start !== void 0 ? { start } : {}
762
777
  }, { trailingComma: false }))
763
778
  },
764
779
  voiced: project.voiced ?? false,
765
780
  locales: { default: project.locales.default, included: Object.keys(strings) },
781
+ // Where a flow opened without a scene starts: the project's start, when it names a scene (and block) the
782
+ // bundle has. Absent otherwise, and every runtime starts at the first scene (validate says so).
783
+ ...start !== void 0 ? { start } : {},
766
784
  // The cast is copied field by field, on purpose. Most of a CastMember is authoring context that must
767
785
  // never reach players: `notes` are production chatter, `gender` is translator context (it rides the
768
786
  // localisation formats), and `actor` is a real person's name (it belongs in the VO script). Listing
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patterkit/compiler",
3
- "version": "0.14.0",
3
+ "version": "0.15.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.20.0",
38
- "@patterkit/core": "0.9.5",
39
- "@patterkit/dialect": "0.2.17",
37
+ "@patterkit/model": "0.21.0",
38
+ "@patterkit/core": "0.10.0",
39
+ "@patterkit/dialect": "0.2.18",
40
40
  "@wildwinter/expr": "^0.6.0",
41
- "@wildwinter/toolkit": "^0.3.0"
41
+ "@wildwinter/toolkit": "^0.4.0"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "@wildwinter/scoperegistry": ">=0.9.0 <1.0.0"