@cratis/screenplay-language 5.3.0 → 5.3.2

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.
Files changed (395) hide show
  1. package/dist/bundles/TypeReferenceSymbol.js.map +1 -1
  2. package/dist/bundles/action-subject-authoring.js.map +1 -1
  3. package/dist/bundles/bmp-word-characters.js.map +1 -1
  4. package/dist/bundles/case-authoring.js +1 -1
  5. package/dist/bundles/case-authoring.js.map +1 -1
  6. package/dist/bundles/code-actions.js.map +1 -1
  7. package/dist/bundles/command-read-completions.js.map +1 -1
  8. package/dist/bundles/compiler/Authoring/ActionSubjectQuickFixes.js +3 -3
  9. package/dist/bundles/compiler/Authoring/ActionSubjectQuickFixes.js.map +1 -1
  10. package/dist/bundles/compiler/Authoring/QuickFixes.js +4 -4
  11. package/dist/bundles/compiler/Authoring/QuickFixes.js.map +1 -1
  12. package/dist/bundles/compiler/Authoring/StructuredValueQuickFix.js +1 -1
  13. package/dist/bundles/compiler/Authoring/StructuredValueQuickFix.js.map +1 -1
  14. package/dist/bundles/compiler/Authoring/TimelineQuickFixContext.js +4 -4
  15. package/dist/bundles/compiler/Authoring/TimelineQuickFixContext.js.map +1 -1
  16. package/dist/bundles/compiler/Authoring/TimelineQuickFixImports.js +2 -2
  17. package/dist/bundles/compiler/Authoring/TimelineQuickFixImports.js.map +1 -1
  18. package/dist/bundles/compiler/Authoring/TimelineQuickFixes.js +1 -1
  19. package/dist/bundles/compiler/Authoring/TimelineQuickFixes.js.map +1 -1
  20. package/dist/bundles/compiler/Dependencies/DeclaredDependencies.js.map +1 -1
  21. package/dist/bundles/compiler/Dependencies/DeclaredDependencyTargets.js.map +1 -1
  22. package/dist/bundles/compiler/Dependencies/DependencyGraph.js +1 -1
  23. package/dist/bundles/compiler/Dependencies/DependencyGraph.js.map +1 -1
  24. package/dist/bundles/compiler/Dependencies/DependencyKind.js.map +1 -1
  25. package/dist/bundles/compiler/Dependencies/InvalidDependencyQuery.js.map +1 -1
  26. package/dist/bundles/compiler/Dependencies/SliceReferences.js.map +1 -1
  27. package/dist/bundles/compiler/Dependencies/StronglyConnectedGroups.js.map +1 -1
  28. package/dist/bundles/compiler/Diagnostics/DiagnosticArgument.js.map +1 -1
  29. package/dist/bundles/compiler/Diagnostics/DiagnosticCodes.js +1 -1
  30. package/dist/bundles/compiler/Diagnostics/DiagnosticCodes.js.map +1 -1
  31. package/dist/bundles/compiler/Diagnostics/ProductionDestinationDiagnostics.js +1 -1
  32. package/dist/bundles/compiler/Diagnostics/ProductionDestinationDiagnostics.js.map +1 -1
  33. package/dist/bundles/compiler/Diagnostics/SourceLocation.js.map +1 -1
  34. package/dist/bundles/compiler/Files/AuthoredOrder.js +1 -1
  35. package/dist/bundles/compiler/Files/AuthoredOrder.js.map +1 -1
  36. package/dist/bundles/compiler/Files/OrderingRoot.js +1 -1
  37. package/dist/bundles/compiler/Files/OrderingRoot.js.map +1 -1
  38. package/dist/bundles/compiler/Files/PlayApplicationAssembly.js +1 -1
  39. package/dist/bundles/compiler/Files/PlayApplicationAssembly.js.map +1 -1
  40. package/dist/bundles/compiler/Files/PlayDocumentSource.js.map +1 -1
  41. package/dist/bundles/compiler/Files/PlayFolderMerge.js +1 -1
  42. package/dist/bundles/compiler/Files/PlayFolderMerge.js.map +1 -1
  43. package/dist/bundles/compiler/Files/PlayGlob.js +2 -1
  44. package/dist/bundles/compiler/Files/PlayGlob.js.map +1 -1
  45. package/dist/bundles/compiler/Files/PlayImports.js +1 -1
  46. package/dist/bundles/compiler/Files/PlayImports.js.map +1 -1
  47. package/dist/bundles/compiler/Files/PlayPlacement.js.map +1 -1
  48. package/dist/bundles/compiler/Files/TimelineOrder.js +1 -1
  49. package/dist/bundles/compiler/Files/TimelineOrder.js.map +1 -1
  50. package/dist/bundles/compiler/Generation/FiniteGenerationRules.js +1 -1
  51. package/dist/bundles/compiler/Generation/GenerationAssessmentCache.js.map +1 -1
  52. package/dist/bundles/compiler/Generation/GenerationChecksum.js.map +1 -1
  53. package/dist/bundles/compiler/Generation/GenerationPattern.js +1 -1
  54. package/dist/bundles/compiler/Generation/GenerationPattern.js.map +1 -1
  55. package/dist/bundles/compiler/Generation/GenerationPatternAssessment.js.map +1 -1
  56. package/dist/bundles/compiler/Generation/GenerationPatternParser.js.map +1 -1
  57. package/dist/bundles/compiler/Generation/GenerationPatternToken.js.map +1 -1
  58. package/dist/bundles/compiler/Generation/GenerationRuleProof.js +1 -1
  59. package/dist/bundles/compiler/Generation/InvalidGenerationPattern.js.map +1 -1
  60. package/dist/bundles/compiler/Generation/RegexCharacters.js.map +1 -1
  61. package/dist/bundles/compiler/Generation/RegexExpression.js.map +1 -1
  62. package/dist/bundles/compiler/Generation/RuleConsistency.js +1 -1
  63. package/dist/bundles/compiler/Parsing/ActionSubjectClause.js.map +1 -1
  64. package/dist/bundles/compiler/Parsing/ActionSubjectInputs.js.map +1 -1
  65. package/dist/bundles/compiler/Parsing/ActionSubjectResolution.js.map +1 -1
  66. package/dist/bundles/compiler/Parsing/ApplicationContextParser.js +1 -1
  67. package/dist/bundles/compiler/Parsing/ApplicationContextParser.js.map +1 -1
  68. package/dist/bundles/compiler/Parsing/AuthorizeParser.js +1 -1
  69. package/dist/bundles/compiler/Parsing/AuthorizeParser.js.map +1 -1
  70. package/dist/bundles/compiler/Parsing/CanvasPlacement.js.map +1 -1
  71. package/dist/bundles/compiler/Parsing/CaptureEventFixturesValidator.js.map +1 -1
  72. package/dist/bundles/compiler/Parsing/CaptureParser.js +1 -1
  73. package/dist/bundles/compiler/Parsing/CaptureParser.js.map +1 -1
  74. package/dist/bundles/compiler/Parsing/ClockOperandParser.js.map +1 -1
  75. package/dist/bundles/compiler/Parsing/CodeBlockParser.js.map +1 -1
  76. package/dist/bundles/compiler/Parsing/CommandDestinationTypes.js.map +1 -1
  77. package/dist/bundles/compiler/Parsing/CommandHandlerValidator.js.map +1 -1
  78. package/dist/bundles/compiler/Parsing/CommandParser.js +1 -1
  79. package/dist/bundles/compiler/Parsing/CommandParser.js.map +1 -1
  80. package/dist/bundles/compiler/Parsing/CommandReadSources.js.map +1 -1
  81. package/dist/bundles/compiler/Parsing/CommandResponseParser.js +1 -1
  82. package/dist/bundles/compiler/Parsing/CommandResponseParser.js.map +1 -1
  83. package/dist/bundles/compiler/Parsing/CommandStreamCandidates.js.map +1 -1
  84. package/dist/bundles/compiler/Parsing/CompositeStreamIdValidator.js.map +1 -1
  85. package/dist/bundles/compiler/Parsing/CompositionParser.js +1 -1
  86. package/dist/bundles/compiler/Parsing/CompositionParser.js.map +1 -1
  87. package/dist/bundles/compiler/Parsing/ConceptComplianceParser.js +1 -1
  88. package/dist/bundles/compiler/Parsing/ConceptComplianceParser.js.map +1 -1
  89. package/dist/bundles/compiler/Parsing/ConditionDepthBudget.js +2 -0
  90. package/dist/bundles/compiler/Parsing/ConditionDepthBudget.js.map +1 -0
  91. package/dist/bundles/compiler/Parsing/ConditionParser.js +1 -1
  92. package/dist/bundles/compiler/Parsing/ConditionParser.js.map +1 -1
  93. package/dist/bundles/compiler/Parsing/ConstraintParser.js +1 -1
  94. package/dist/bundles/compiler/Parsing/ConstraintParser.js.map +1 -1
  95. package/dist/bundles/compiler/Parsing/ConstraintPropertyValidator.js +1 -1
  96. package/dist/bundles/compiler/Parsing/ConstraintPropertyValidator.js.map +1 -1
  97. package/dist/bundles/compiler/Parsing/ContinuationValues.js.map +1 -1
  98. package/dist/bundles/compiler/Parsing/DeclarationParsers.js +1 -1
  99. package/dist/bundles/compiler/Parsing/DeclarationParsers.js.map +1 -1
  100. package/dist/bundles/compiler/Parsing/DependencySourceParser.js +1 -1
  101. package/dist/bundles/compiler/Parsing/DependencySourceParser.js.map +1 -1
  102. package/dist/bundles/compiler/Parsing/DependsOnParser.js.map +1 -1
  103. package/dist/bundles/compiler/Parsing/DescriptionParser.js +1 -1
  104. package/dist/bundles/compiler/Parsing/DescriptionParser.js.map +1 -1
  105. package/dist/bundles/compiler/Parsing/DocumentationParser.js +1 -1
  106. package/dist/bundles/compiler/Parsing/DocumentationParser.js.map +1 -1
  107. package/dist/bundles/compiler/Parsing/EnumerationMembers.js +1 -1
  108. package/dist/bundles/compiler/Parsing/EnumerationMembers.js.map +1 -1
  109. package/dist/bundles/compiler/Parsing/EventMetadataParser.js +1 -1
  110. package/dist/bundles/compiler/Parsing/EventMetadataParser.js.map +1 -1
  111. package/dist/bundles/compiler/Parsing/EventSourceParser.js +1 -1
  112. package/dist/bundles/compiler/Parsing/EventSourceParser.js.map +1 -1
  113. package/dist/bundles/compiler/Parsing/EventSourceValidator.js +1 -1
  114. package/dist/bundles/compiler/Parsing/EventSourceValidator.js.map +1 -1
  115. package/dist/bundles/compiler/Parsing/EventSubjectValidator.js +1 -1
  116. package/dist/bundles/compiler/Parsing/EventSubjectValidator.js.map +1 -1
  117. package/dist/bundles/compiler/Parsing/ExpressionParser.js +1 -1
  118. package/dist/bundles/compiler/Parsing/ExpressionParser.js.map +1 -1
  119. package/dist/bundles/compiler/Parsing/FeatureBody.js +1 -1
  120. package/dist/bundles/compiler/Parsing/FeatureBody.js.map +1 -1
  121. package/dist/bundles/compiler/Parsing/FileImportParser.js.map +1 -1
  122. package/dist/bundles/compiler/Parsing/FileReferences.js.map +1 -1
  123. package/dist/bundles/compiler/Parsing/FoldedEventSources.js.map +1 -1
  124. package/dist/bundles/compiler/Parsing/GenerationBodyParser.js +1 -1
  125. package/dist/bundles/compiler/Parsing/GenerationBodyParser.js.map +1 -1
  126. package/dist/bundles/compiler/Parsing/GenerationParser.js +1 -1
  127. package/dist/bundles/compiler/Parsing/GenerationParser.js.map +1 -1
  128. package/dist/bundles/compiler/Parsing/GuardedActionInputs.js.map +1 -1
  129. package/dist/bundles/compiler/Parsing/GuardedActionParser.js +1 -1
  130. package/dist/bundles/compiler/Parsing/GuardedActionParser.js.map +1 -1
  131. package/dist/bundles/compiler/Parsing/GuardedActionShadowing.js.map +1 -1
  132. package/dist/bundles/compiler/Parsing/GuardedActionValidator.js +1 -1
  133. package/dist/bundles/compiler/Parsing/GuardedActionValidator.js.map +1 -1
  134. package/dist/bundles/compiler/Parsing/GuardedInteractions.js +1 -1
  135. package/dist/bundles/compiler/Parsing/GuardedInteractions.js.map +1 -1
  136. package/dist/bundles/compiler/Parsing/IdentifierComplianceValidator.js +1 -1
  137. package/dist/bundles/compiler/Parsing/IdentifierComplianceValidator.js.map +1 -1
  138. package/dist/bundles/compiler/Parsing/IdentityParser.js +1 -1
  139. package/dist/bundles/compiler/Parsing/IdentityParser.js.map +1 -1
  140. package/dist/bundles/compiler/Parsing/IdentityValidator.js.map +1 -1
  141. package/dist/bundles/compiler/Parsing/ImplementationParser.js +2 -2
  142. package/dist/bundles/compiler/Parsing/ImplementationParser.js.map +1 -1
  143. package/dist/bundles/compiler/Parsing/ImportDiscovery.js +1 -1
  144. package/dist/bundles/compiler/Parsing/ImportDiscovery.js.map +1 -1
  145. package/dist/bundles/compiler/Parsing/InlineEventValidator.js.map +1 -1
  146. package/dist/bundles/compiler/Parsing/InputUses.js +1 -1
  147. package/dist/bundles/compiler/Parsing/InputUses.js.map +1 -1
  148. package/dist/bundles/compiler/Parsing/InteractionAlternatives.js +1 -1
  149. package/dist/bundles/compiler/Parsing/InteractionAlternatives.js.map +1 -1
  150. package/dist/bundles/compiler/Parsing/InteractionExecutions.js +1 -1
  151. package/dist/bundles/compiler/Parsing/InteractionExecutions.js.map +1 -1
  152. package/dist/bundles/compiler/Parsing/LegacyTextRulePatterns.js.map +1 -1
  153. package/dist/bundles/compiler/Parsing/LineReader.js.map +1 -1
  154. package/dist/bundles/compiler/Parsing/LineText.js.map +1 -1
  155. package/dist/bundles/compiler/Parsing/MatchAmbiguity.js +1 -1
  156. package/dist/bundles/compiler/Parsing/MatchAmbiguity.js.map +1 -1
  157. package/dist/bundles/compiler/Parsing/MatchAmbiguityCharacters.js.map +1 -1
  158. package/dist/bundles/compiler/Parsing/MatchAmbiguityGraph.js.map +1 -1
  159. package/dist/bundles/compiler/Parsing/MatchAmbiguityParser.js.map +1 -1
  160. package/dist/bundles/compiler/Parsing/MatchOperandValidation.js +1 -1
  161. package/dist/bundles/compiler/Parsing/MatchOperandValidation.js.map +1 -1
  162. package/dist/bundles/compiler/Parsing/ModuleBody.js +1 -1
  163. package/dist/bundles/compiler/Parsing/ModuleBody.js.map +1 -1
  164. package/dist/bundles/compiler/Parsing/ObserverFilterParser.js +1 -1
  165. package/dist/bundles/compiler/Parsing/ObserverFilterParser.js.map +1 -1
  166. package/dist/bundles/compiler/Parsing/ObserverFilterValidator.js.map +1 -1
  167. package/dist/bundles/compiler/Parsing/OperationParser.js +1 -1
  168. package/dist/bundles/compiler/Parsing/OperationParser.js.map +1 -1
  169. package/dist/bundles/compiler/Parsing/OperationValidator.js +1 -1
  170. package/dist/bundles/compiler/Parsing/OperationValidator.js.map +1 -1
  171. package/dist/bundles/compiler/Parsing/ParserContext.js.map +1 -1
  172. package/dist/bundles/compiler/Parsing/PersonaCallerValidator.js.map +1 -1
  173. package/dist/bundles/compiler/Parsing/PolicyParser.js +1 -1
  174. package/dist/bundles/compiler/Parsing/PolicyParser.js.map +1 -1
  175. package/dist/bundles/compiler/Parsing/PortableMatchGroupName.js.map +1 -1
  176. package/dist/bundles/compiler/Parsing/PortableMatchPattern.js.map +1 -1
  177. package/dist/bundles/compiler/Parsing/PortableMatchSuggestions.js.map +1 -1
  178. package/dist/bundles/compiler/Parsing/PossibleEventsParser.js +1 -1
  179. package/dist/bundles/compiler/Parsing/PossibleEventsParser.js.map +1 -1
  180. package/dist/bundles/compiler/Parsing/ProducesParser.js +1 -1
  181. package/dist/bundles/compiler/Parsing/ProducesParser.js.map +1 -1
  182. package/dist/bundles/compiler/Parsing/ProjectionEventScopeValidator.js.map +1 -1
  183. package/dist/bundles/compiler/Parsing/ProjectionExpressionParser.js +1 -1
  184. package/dist/bundles/compiler/Parsing/ProjectionExpressionParser.js.map +1 -1
  185. package/dist/bundles/compiler/Parsing/ProjectionParser.js +1 -1
  186. package/dist/bundles/compiler/Parsing/ProjectionParser.js.map +1 -1
  187. package/dist/bundles/compiler/Parsing/ProjectionTargetValidator.js +1 -1
  188. package/dist/bundles/compiler/Parsing/ProjectionTargetValidator.js.map +1 -1
  189. package/dist/bundles/compiler/Parsing/PropertyLineParser.js +1 -1
  190. package/dist/bundles/compiler/Parsing/PropertyLineParser.js.map +1 -1
  191. package/dist/bundles/compiler/Parsing/PublicEventMetadataValidator.js +1 -1
  192. package/dist/bundles/compiler/Parsing/PublicEventMetadataValidator.js.map +1 -1
  193. package/dist/bundles/compiler/Parsing/PublicEventUsageCollector.js +1 -1
  194. package/dist/bundles/compiler/Parsing/PublicEventUsageCollector.js.map +1 -1
  195. package/dist/bundles/compiler/Parsing/PublicEventUsageValidator.js +1 -1
  196. package/dist/bundles/compiler/Parsing/PublicEventUsageValidator.js.map +1 -1
  197. package/dist/bundles/compiler/Parsing/PurposeParser.js +1 -1
  198. package/dist/bundles/compiler/Parsing/PurposeParser.js.map +1 -1
  199. package/dist/bundles/compiler/Parsing/PurposeValidator.js.map +1 -1
  200. package/dist/bundles/compiler/Parsing/QueryParser.js +1 -1
  201. package/dist/bundles/compiler/Parsing/QueryParser.js.map +1 -1
  202. package/dist/bundles/compiler/Parsing/ReactionIdentityParser.js +1 -1
  203. package/dist/bundles/compiler/Parsing/ReactionIdentityParser.js.map +1 -1
  204. package/dist/bundles/compiler/Parsing/ReactionParser.js +1 -1
  205. package/dist/bundles/compiler/Parsing/ReactionParser.js.map +1 -1
  206. package/dist/bundles/compiler/Parsing/ReactionRefusalValidator.js +1 -1
  207. package/dist/bundles/compiler/Parsing/ReactionRefusalValidator.js.map +1 -1
  208. package/dist/bundles/compiler/Parsing/ReadModelKeyValidator.js.map +1 -1
  209. package/dist/bundles/compiler/Parsing/ReadModelMemberTypeValidator.js.map +1 -1
  210. package/dist/bundles/compiler/Parsing/ReadsParser.js +1 -1
  211. package/dist/bundles/compiler/Parsing/ReadsParser.js.map +1 -1
  212. package/dist/bundles/compiler/Parsing/RedeliveryValues.js.map +1 -1
  213. package/dist/bundles/compiler/Parsing/RefusalDeclarations.js +1 -1
  214. package/dist/bundles/compiler/Parsing/RefusalDeclarations.js.map +1 -1
  215. package/dist/bundles/compiler/Parsing/RefusalValueWalker.js.map +1 -1
  216. package/dist/bundles/compiler/Parsing/ResponseCommandResolver.js.map +1 -1
  217. package/dist/bundles/compiler/Parsing/ResponseDateValues.js.map +1 -1
  218. package/dist/bundles/compiler/Parsing/ResponseValidator.js +1 -1
  219. package/dist/bundles/compiler/Parsing/ResponseValidator.js.map +1 -1
  220. package/dist/bundles/compiler/Parsing/ScreenParser.js +1 -1
  221. package/dist/bundles/compiler/Parsing/ScreenParser.js.map +1 -1
  222. package/dist/bundles/compiler/Parsing/ScreenplayParser.js +1 -1
  223. package/dist/bundles/compiler/Parsing/ScreenplayParser.js.map +1 -1
  224. package/dist/bundles/compiler/Parsing/SeedParser.js +1 -1
  225. package/dist/bundles/compiler/Parsing/SeedParser.js.map +1 -1
  226. package/dist/bundles/compiler/Parsing/SliceParser.js +1 -1
  227. package/dist/bundles/compiler/Parsing/SliceParser.js.map +1 -1
  228. package/dist/bundles/compiler/Parsing/SourceLine.js.map +1 -1
  229. package/dist/bundles/compiler/Parsing/SourceLineSplitter.js.map +1 -1
  230. package/dist/bundles/compiler/Parsing/SourceOptionsParser.js +1 -1
  231. package/dist/bundles/compiler/Parsing/SourceOptionsParser.js.map +1 -1
  232. package/dist/bundles/compiler/Parsing/SpecificationCaseParser.js +1 -1
  233. package/dist/bundles/compiler/Parsing/SpecificationCaseParser.js.map +1 -1
  234. package/dist/bundles/compiler/Parsing/SpecificationCaseValidator.js +1 -1
  235. package/dist/bundles/compiler/Parsing/SpecificationCaseValidator.js.map +1 -1
  236. package/dist/bundles/compiler/Parsing/SpecificationCommandExamples.js +1 -1
  237. package/dist/bundles/compiler/Parsing/SpecificationCommandExamples.js.map +1 -1
  238. package/dist/bundles/compiler/Parsing/SpecificationExampleParser.js +1 -1
  239. package/dist/bundles/compiler/Parsing/SpecificationExampleParser.js.map +1 -1
  240. package/dist/bundles/compiler/Parsing/SpecificationParser.js +1 -1
  241. package/dist/bundles/compiler/Parsing/SpecificationParser.js.map +1 -1
  242. package/dist/bundles/compiler/Parsing/SpecificationRedeliveryValidator.js +1 -1
  243. package/dist/bundles/compiler/Parsing/SpecificationRedeliveryValidator.js.map +1 -1
  244. package/dist/bundles/compiler/Parsing/SpecificationResponseParser.js +1 -1
  245. package/dist/bundles/compiler/Parsing/SpecificationResponseParser.js.map +1 -1
  246. package/dist/bundles/compiler/Parsing/SpecificationRouteComparison.js +1 -1
  247. package/dist/bundles/compiler/Parsing/SpecificationRouteComparison.js.map +1 -1
  248. package/dist/bundles/compiler/Parsing/SpecificationStreamValidator.js +1 -1
  249. package/dist/bundles/compiler/Parsing/SpecificationStreamValidator.js.map +1 -1
  250. package/dist/bundles/compiler/Parsing/StateMachineParser.js +1 -1
  251. package/dist/bundles/compiler/Parsing/StateMachineParser.js.map +1 -1
  252. package/dist/bundles/compiler/Parsing/StructuralInteractionSites.js.map +1 -1
  253. package/dist/bundles/compiler/Parsing/StructuredBlockParser.js +1 -1
  254. package/dist/bundles/compiler/Parsing/StructuredBlockParser.js.map +1 -1
  255. package/dist/bundles/compiler/Parsing/StructuredValueParser.js.map +1 -1
  256. package/dist/bundles/compiler/Parsing/TemplateReferenceText.js +1 -1
  257. package/dist/bundles/compiler/Parsing/TemplateReferenceText.js.map +1 -1
  258. package/dist/bundles/compiler/Parsing/TriggerDataParser.js +1 -1
  259. package/dist/bundles/compiler/Parsing/TriggerDataParser.js.map +1 -1
  260. package/dist/bundles/compiler/Parsing/UiBindingParser.js +1 -1
  261. package/dist/bundles/compiler/Parsing/UiBindingParser.js.map +1 -1
  262. package/dist/bundles/compiler/Parsing/UiProfileLegacyLayout.js +1 -1
  263. package/dist/bundles/compiler/Parsing/UiProfileLegacyLayout.js.map +1 -1
  264. package/dist/bundles/compiler/Parsing/WorkflowParser.js +1 -1
  265. package/dist/bundles/compiler/Parsing/WorkflowParser.js.map +1 -1
  266. package/dist/bundles/compiler/Parsing/checkPortableMatchPattern.js.map +1 -1
  267. package/dist/bundles/compiler/Parsing/hasExponentialMatchAmbiguity.js.map +1 -1
  268. package/dist/bundles/compiler/Parsing/trimMatchAmbiguityGraph.js.map +1 -1
  269. package/dist/bundles/compiler/ScreenActionSubjects.js.map +1 -1
  270. package/dist/bundles/compiler/ScreenplayCompiler.js +1 -1
  271. package/dist/bundles/compiler/ScreenplayCompiler.js.map +1 -1
  272. package/dist/bundles/compiler/Syntax/ActionSubjectInvariants.js.map +1 -1
  273. package/dist/bundles/compiler/Syntax/AuthoringProductionResolver.js.map +1 -1
  274. package/dist/bundles/compiler/Syntax/CaptureEventsSource.js.map +1 -1
  275. package/dist/bundles/compiler/Syntax/DependencySources.js.map +1 -1
  276. package/dist/bundles/compiler/Syntax/EventDeclarations.js.map +1 -1
  277. package/dist/bundles/compiler/Syntax/EventSourceCatalog.js.map +1 -1
  278. package/dist/bundles/compiler/Syntax/EventSourceReadConfidence.js.map +1 -1
  279. package/dist/bundles/compiler/Syntax/ExactMathFacts.js.map +1 -1
  280. package/dist/bundles/compiler/Syntax/ExactNumber.js.map +1 -1
  281. package/dist/bundles/compiler/Syntax/InvalidSyntaxJson.js.map +1 -1
  282. package/dist/bundles/compiler/Syntax/LegacyWireProjection.js.map +1 -1
  283. package/dist/bundles/compiler/Syntax/Operations.js.map +1 -1
  284. package/dist/bundles/compiler/Syntax/PersonaCallers.js.map +1 -1
  285. package/dist/bundles/compiler/Syntax/ProductionDestinations.js.map +1 -1
  286. package/dist/bundles/compiler/Syntax/PublicEventInvariants.js.map +1 -1
  287. package/dist/bundles/compiler/Syntax/ScreenplaySyntaxWalker.js.map +1 -1
  288. package/dist/bundles/compiler/Syntax/SourceOptions.js.map +1 -1
  289. package/dist/bundles/compiler/Syntax/SpecificationCaseOrigin.js.map +1 -1
  290. package/dist/bundles/compiler/Syntax/StreamIdFormatter.js.map +1 -1
  291. package/dist/bundles/compiler/Syntax/StrictSyntaxJson.js +1 -1
  292. package/dist/bundles/compiler/Syntax/Structure.js.map +1 -1
  293. package/dist/bundles/compiler/Syntax/SyntaxCollections.js.map +1 -1
  294. package/dist/bundles/compiler/Syntax/SyntaxInvariants.js +1 -1
  295. package/dist/bundles/compiler/Syntax/SyntaxInvariants.js.map +1 -1
  296. package/dist/bundles/compiler/Syntax/SyntaxJson.js +1 -1
  297. package/dist/bundles/compiler/Syntax/SyntaxJson.js.map +1 -1
  298. package/dist/bundles/compiler/Syntax/SyntaxMemberContracts.js.map +1 -1
  299. package/dist/bundles/compiler/Syntax/index.js +1 -1
  300. package/dist/bundles/compiler/Text/ImplementationHintText.js.map +1 -1
  301. package/dist/bundles/compiler/Text/ReservedWords.js.map +1 -1
  302. package/dist/bundles/compiler/Text/SourceStreamNames.js.map +1 -1
  303. package/dist/bundles/compiler/Text/StringLiteral.js.map +1 -1
  304. package/dist/bundles/compiler/Text/ordinalIgnoreCaseKey.js.map +1 -1
  305. package/dist/bundles/compiler/Text/patterns.js.map +1 -1
  306. package/dist/bundles/compiler/index.js +1 -1
  307. package/dist/bundles/completion-items.js +4 -4
  308. package/dist/bundles/completion-items.js.map +1 -1
  309. package/dist/bundles/completion-planner.js +2 -2
  310. package/dist/bundles/completion-planner.js.map +1 -1
  311. package/dist/bundles/completions.js +1 -1
  312. package/dist/bundles/completions.js.map +1 -1
  313. package/dist/bundles/continuation-responses.js +1 -1
  314. package/dist/bundles/continuation-responses.js.map +1 -1
  315. package/dist/bundles/declarations.js.map +1 -1
  316. package/dist/bundles/dependency-completions.js.map +1 -1
  317. package/dist/bundles/dependency-target-analysis.js.map +1 -1
  318. package/dist/bundles/diagnostic-codes.js +1 -1
  319. package/dist/bundles/diagnostic-codes.js.map +1 -1
  320. package/dist/bundles/diagnostics.js +1 -1
  321. package/dist/bundles/diagnostics.js.map +1 -1
  322. package/dist/bundles/document-context.js.map +1 -1
  323. package/dist/bundles/documentation-item.js.map +1 -1
  324. package/dist/bundles/event-analysis-source.js.map +1 -1
  325. package/dist/bundles/event-context-catalog.js.map +1 -1
  326. package/dist/bundles/event-context.js.map +1 -1
  327. package/dist/bundles/event-source-authoring.js +11 -11
  328. package/dist/bundles/event-source-authoring.js.map +1 -1
  329. package/dist/bundles/example-analysis.js +2 -2
  330. package/dist/bundles/example-analysis.js.map +1 -1
  331. package/dist/bundles/example-authoring.js +2 -2
  332. package/dist/bundles/example-authoring.js.map +1 -1
  333. package/dist/bundles/example-declaration-items.js.map +1 -1
  334. package/dist/bundles/example-values.js.map +1 -1
  335. package/dist/bundles/file-imports.js.map +1 -1
  336. package/dist/bundles/file-references.js.map +1 -1
  337. package/dist/bundles/generation-completions.js.map +1 -1
  338. package/dist/bundles/hover-content.js +5 -5
  339. package/dist/bundles/hover-content.js.map +1 -1
  340. package/dist/bundles/hover.js.map +1 -1
  341. package/dist/bundles/index.js +1 -1
  342. package/dist/bundles/index.js.map +1 -1
  343. package/dist/bundles/inlay-hints.js.map +1 -1
  344. package/dist/bundles/inline-completions.js +1 -1
  345. package/dist/bundles/inline-completions.js.map +1 -1
  346. package/dist/bundles/inline-event-validation.js +1 -1
  347. package/dist/bundles/inline-event-validation.js.map +1 -1
  348. package/dist/bundles/keyword-docs.js.map +1 -1
  349. package/dist/bundles/language.js.map +1 -1
  350. package/dist/bundles/named-rule-context.js.map +1 -1
  351. package/dist/bundles/operation-authoring.js +6 -6
  352. package/dist/bundles/operation-authoring.js.map +1 -1
  353. package/dist/bundles/persona-analysis.js +1 -1
  354. package/dist/bundles/persona-analysis.js.map +1 -1
  355. package/dist/bundles/production-destinations.js +1 -1
  356. package/dist/bundles/production-destinations.js.map +1 -1
  357. package/dist/bundles/purpose-items.js.map +1 -1
  358. package/dist/bundles/reaction-authoring.js +3 -3
  359. package/dist/bundles/reaction-authoring.js.map +1 -1
  360. package/dist/bundles/read-model-key-completions.js +1 -1
  361. package/dist/bundles/read-model-key-completions.js.map +1 -1
  362. package/dist/bundles/refusal-context.js.map +1 -1
  363. package/dist/bundles/response-analysis.js.map +1 -1
  364. package/dist/bundles/response-completions.js +1 -1
  365. package/dist/bundles/response-completions.js.map +1 -1
  366. package/dist/bundles/response-tokens.js +2 -2
  367. package/dist/bundles/response-tokens.js.map +1 -1
  368. package/dist/bundles/scope-items.js +3 -3
  369. package/dist/bundles/scope-items.js.map +1 -1
  370. package/dist/bundles/structure-completions.js.map +1 -1
  371. package/dist/bundles/sub-language-registry.js.map +1 -1
  372. package/dist/bundles/sub-languages/capture/CompletionProvider.js.map +1 -1
  373. package/dist/bundles/sub-languages/capture/HoverProvider.js.map +1 -1
  374. package/dist/bundles/sub-languages/capture/Validator.js.map +1 -1
  375. package/dist/bundles/sub-languages/capture/index.js.map +1 -1
  376. package/dist/bundles/sub-languages/capture/language.js.map +1 -1
  377. package/dist/bundles/sub-languages/cdl.js.map +1 -1
  378. package/dist/bundles/sub-languages/pdl.js.map +1 -1
  379. package/dist/bundles/sub-languages/projection/CodeActionProvider.js.map +1 -1
  380. package/dist/bundles/sub-languages/projection/CompletionProvider.js +1 -1
  381. package/dist/bundles/sub-languages/projection/CompletionProvider.js.map +1 -1
  382. package/dist/bundles/sub-languages/projection/HoverProvider.js.map +1 -1
  383. package/dist/bundles/sub-languages/projection/Validator.js.map +1 -1
  384. package/dist/bundles/sub-languages/projection/index.js.map +1 -1
  385. package/dist/bundles/sub-languages/projection/language.js.map +1 -1
  386. package/dist/bundles/symbols.js +2 -2
  387. package/dist/bundles/symbols.js.map +1 -1
  388. package/dist/bundles/themes/screenplay-dark.js.map +1 -1
  389. package/dist/bundles/themes/screenplay-light.js.map +1 -1
  390. package/dist/bundles/tokens.js.map +1 -1
  391. package/dist/bundles/validation.js +2 -2
  392. package/dist/bundles/validation.js.map +1 -1
  393. package/dist/diagnostic-codes.d.ts +1 -0
  394. package/dist/diagnostic-codes.d.ts.map +1 -1
  395. package/package.json +3 -3
@@ -1,2 +1,2 @@
1
- import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"./DiagnosticCodes.js";import{AuthoringProductionResolver as t}from"../Syntax/AuthoringProductionResolver.js";function productionDestinationDiagnostics(n){let r=new t(n);return r.slices.flatMap(({slice:t})=>t.commands.flatMap(n=>{let i=n.properties.filter(e=>e.isIdentifier&&!e.type.isOptional&&!e.type.isCollection);return i.length===1?n.produces.filter(e=>r.isEventProduction(e,t)&&e.inlineEvent===null&&e.when===null&&e.for===null).map(t=>({severity:`information`,code:e.OmittedProductionDestination,message:`Plain 'produces ${t.event}' omits its destination - use 'for ${i[0].name}' to explicitly select the command's identifier.`,location:t.location})):[]}))}export{productionDestinationDiagnostics};
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{AuthoringProductionResolver as e}from"../Syntax/AuthoringProductionResolver.js";import{DiagnosticCodes as t}from"./DiagnosticCodes.js";function productionDestinationDiagnostics(n){let r=new e(n);return r.slices.flatMap(({slice:e})=>e.commands.flatMap(n=>{let i=n.properties.filter(e=>e.isIdentifier&&!e.type.isOptional&&!e.type.isCollection);return i.length===1?n.produces.filter(t=>r.isEventProduction(t,e)&&t.inlineEvent===null&&t.when===null&&t.for===null).map(e=>({severity:`information`,code:t.OmittedProductionDestination,message:`Plain 'produces ${e.event}' omits its destination - use 'for ${i[0].name}' to explicitly select the command's identifier.`,location:e.location})):[]}))}export{productionDestinationDiagnostics};
2
2
  //# sourceMappingURL=ProductionDestinationDiagnostics.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ProductionDestinationDiagnostics.js","names":["resolver","AuthoringProductionResolver","application","slice","identifiers","command","property","production","DiagnosticCodes"],"sources":["../../../../../../Compiler/Diagnostics/ProductionDestinationDiagnostics.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { AuthoringProductionResolver } from '../Syntax/AuthoringProductionResolver';\nimport { ApplicationSyntax } from '../Syntax/Structure';\nimport { Diagnostic } from './Diagnostic';\nimport { DiagnosticCodes } from './DiagnosticCodes';\n\n// Routing advice is appended after source validation, as in the C# compiler. It changes no default.\nexport function productionDestinationDiagnostics(application: ApplicationSyntax): Diagnostic[] {\n const resolver = new AuthoringProductionResolver(application);\n return resolver.slices.flatMap(({ slice }) => slice.commands.flatMap(command => {\n const identifiers = command.properties.filter(property => property.isIdentifier && !property.type.isOptional && !property.type.isCollection);\n if (identifiers.length !== 1) return [];\n return command.produces.filter(production => resolver.isEventProduction(production, slice) && production.inlineEvent === null && production.when === null && production.for === null)\n .map(production => ({ severity: 'information' as const, code: DiagnosticCodes.OmittedProductionDestination,\n message: `Plain 'produces ${production.event}' omits its destination - use 'for ${identifiers[0].name}' to explicitly select the command's identifier.`, location: production.location }));\n }));\n}\n"],"mappings":"mMASA,SAAgB,iCAAiC,EAA8C,CAC3F,IAAMA,EAAW,IAAIC,EAA4BC,CAAW,EAC5D,OAAOF,EAAS,OAAO,SAAS,CAAE,WAAYG,EAAM,SAAS,QAAQ,GAAW,CAC5E,IAAMC,EAAcC,EAAQ,WAAW,OAAO,GAAYC,EAAS,cAAgB,CAACA,EAAS,KAAK,YAAc,CAACA,EAAS,KAAK,YAAY,EAE3I,OADIF,EAAY,SAAW,EACpBC,EAAQ,SAAS,OAAO,GAAcL,EAAS,kBAAkBO,EAAYJ,CAAK,GAAKI,EAAW,cAAgB,MAAQA,EAAW,OAAS,MAAQA,EAAW,MAAQ,IAAI,CAAC,CAChL,IAAI,IAAe,CAAE,SAAU,cAAwB,KAAMC,EAAgB,6BAC1E,QAAS,mBAAmBD,EAAW,MAAM,qCAAqCH,EAAY,EAAE,CAAC,KAAK,kDAAmD,SAAUG,EAAW,QAAS,EAAE,EAH5J,CAAC,CAI1C,CAAC,CAAC,CACN"}
1
+ {"version":3,"file":"ProductionDestinationDiagnostics.js","names":["resolver","AuthoringProductionResolver","application","slice","identifiers","command","property","production","DiagnosticCodes"],"sources":["../../../../../../Compiler/Diagnostics/ProductionDestinationDiagnostics.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { AuthoringProductionResolver } from '../Syntax/AuthoringProductionResolver';\nimport { ApplicationSyntax } from '../Syntax/Structure';\nimport { Diagnostic } from './Diagnostic';\nimport { DiagnosticCodes } from './DiagnosticCodes';\n\n// Routing advice is appended after source validation, as in the C# compiler. It changes no default.\nexport function productionDestinationDiagnostics(application: ApplicationSyntax): Diagnostic[] {\n const resolver = new AuthoringProductionResolver(application);\n return resolver.slices.flatMap(({ slice }) => slice.commands.flatMap(command => {\n const identifiers = command.properties.filter(property => property.isIdentifier && !property.type.isOptional && !property.type.isCollection);\n if (identifiers.length !== 1) return [];\n return command.produces.filter(production => resolver.isEventProduction(production, slice) && production.inlineEvent === null && production.when === null && production.for === null)\n .map(production => ({ severity: 'information' as const, code: DiagnosticCodes.OmittedProductionDestination,\n message: `Plain 'produces ${production.event}' omits its destination - use 'for ${identifiers[0].name}' to explicitly select the command's identifier.`, location: production.location }));\n }));\n}\n"],"mappings":"A,mMASA,SAAgB,iCAAiC,EAA8C,CAC3F,IAAMA,EAAW,IAAIC,EAA4BC,CAAW,EAC5D,OAAOF,EAAS,OAAO,SAAS,CAAE,WAAYG,EAAM,SAAS,QAAQ,GAAW,CAC5E,IAAMC,EAAcC,EAAQ,WAAW,OAAO,GAAYC,EAAS,cAAgB,CAACA,EAAS,KAAK,YAAc,CAACA,EAAS,KAAK,YAAY,EAE3I,OADIF,EAAY,SAAW,EACpBC,EAAQ,SAAS,OAAO,GAAcL,EAAS,kBAAkBO,EAAYJ,CAAK,GAAKI,EAAW,cAAgB,MAAQA,EAAW,OAAS,MAAQA,EAAW,MAAQ,IAAI,CAAC,CAChL,IAAI,IAAe,CAAE,SAAU,cAAwB,KAAMC,EAAgB,6BAC1E,QAAS,mBAAmBD,EAAW,MAAM,qCAAqCH,EAAY,EAAE,CAAC,KAAK,kDAAmD,SAAUG,EAAW,QAAS,EAAE,EAH5J,CAAC,CAI1C,CAAC,CAAC,CACN,C"}
@@ -1 +1 @@
1
- {"version":3,"file":"SourceLocation.js","names":["path"],"sources":["../../../../../../Compiler/Diagnostics/SourceLocation.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n// Where a syntax node or a diagnostic came from: a one-based line and column, and the file when the\n// document was compiled as part of a folder. Mirrors the C# SourceLocation record.\nexport interface SourceLocation {\n readonly line: number;\n readonly column: number;\n readonly path?: string;\n}\n\nexport const sourceLocation = (line: number, column: number, path?: string): SourceLocation =>\n path === undefined ? { line, column } : { line, column, path };\n"],"mappings":"qDAWA,MAAa,gBAAkB,EAAc,EAAgB,IACzDA,IAAS,IAAA,GAAY,CAAE,OAAM,QAAO,EAAI,CAAE,OAAM,SAAQ,MAAK"}
1
+ {"version":3,"file":"SourceLocation.js","names":["path"],"sources":["../../../../../../Compiler/Diagnostics/SourceLocation.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n// Where a syntax node or a diagnostic came from: a one-based line and column, and the file when the\n// document was compiled as part of a folder. Mirrors the C# SourceLocation record.\nexport interface SourceLocation {\n readonly line: number;\n readonly column: number;\n readonly path?: string;\n}\n\nexport const sourceLocation = (line: number, column: number, path?: string): SourceLocation =>\n path === undefined ? { line, column } : { line, column, path };\n"],"mappings":"A,qDAWA,MAAa,gBAAkB,EAAc,EAAgB,IACzDA,IAAS,IAAA,GAAY,CAAE,OAAM,QAAO,EAAI,CAAE,OAAM,SAAQ,MAAK,E"}
@@ -1,2 +1,2 @@
1
- import"../../_virtual/_virtual/_rolldown/runtime.js";import{samePlacement as e}from"./PlayPlacement.js";import{placementFrom as t}from"../Parsing/ImportDiscovery.js";import{matchesPlayPattern as n,normalizePlayPath as r,resolvePlayPattern as i}from"./PlayGlob.js";import{discoverImports as a,parseForAuthoring as o}from"../ScreenplayCompiler.js";const s=/* @__PURE__ */ new WeakMap,authoredOriginsOf=e=>s.get(e)??/* @__PURE__ */ new Map,sameAuthoredStep=(e,t)=>e.path===t.path&&e.node.kind===t.node.kind&&e.node.location.line===t.node.location.line&&e.node.location.column===t.node.location.column&&e.targetPath===t.targetPath,c=/* @__PURE__ */ new WeakMap,authoredOrderKey=e=>JSON.stringify(e);function authoredOrderOf(e){return c.get(e)??/* @__PURE__ */ new Map}function declarations(e){let t=[],feature=(e,n,r)=>{let i=[...n,e.name],a=e.isPlacement?r:[...r,e];t.push({scope:i,...e.location,implicit:e.isPlacement,isContainer:!0,chain:a}),e.features.forEach(e=>feature(e,i,a)),e.slices.forEach(e=>t.push({scope:[...i,e.name],...e.location,implicit:!1,isContainer:!1,chain:[...a,e]}))};return e.modules.forEach(e=>{let n=e.isPlacement?[]:[e];t.push({scope:[e.name],...e.location,implicit:e.isPlacement,isContainer:!0,chain:n}),e.features.forEach(t=>feature(t,[e.name],n))}),t}function containerOwners(e,t){let n=/* @__PURE__ */ new Map;for(let[r,i]of e){let e=r.split(`/`),a=e[e.length-1].slice(0,-5);for(let o of i.filter(e=>e.isContainer&&!e.implicit)){let i=o.scope.indexOf(a);if(!t.has(r)&&i===-1)continue;let s=t.has(r)?0:i+1,c=authoredOrderKey(o.scope),l=n.get(c);(l===void 0||s<l.priority||s===l.priority&&e.length<l.depth)&&n.set(c,{path:r,priority:s,depth:e.length})}}return new Map([...n].map(([e,t])=>[e,t.path]))}function recordAuthoredOrder(l,u,d,f,p,m){let h=new Map(d.map(e=>[e.path,e])),g=new Map(d.filter(e=>e.isPlacementResolved!==!1).map(e=>[e.path,declarations(p?.get(e.path)??o(e.source,e.path,e.placement,!1,void 0,f).value)])),_=containerOwners(g,new Set(u.map(r))),v=new Set([...g.values()].flat().filter(e=>!e.implicit).map(e=>authoredOrderKey(e.scope))),y=/* @__PURE__ */ new Map,b=/* @__PURE__ */ new Map,x=/* @__PURE__ */ new Set,visit=(r,o)=>{let s=h.get(r);s===void 0||s.isPlacementResolved===!1||x.has(r)||(x.add(r),[...(g.get(r)??[]).filter(e=>{let t=authoredOrderKey(e.scope);return(!e.implicit||!v.has(t))&&(!e.isContainer||!_.has(t)||_.get(t)===r)}).map(e=>({line:e.line,column:e.column,run:()=>{let t=authoredOrderKey(e.scope);y.has(t)||(y.set(t,y.size),b.set(t,[...o,...e.chain.map(e=>({path:r,node:e}))]))}})),...(m?.get(r)??a(s.source,r,f)).map(a=>({...a.fileImport.location,run:()=>{let c=t(a,s.placement);if(c===void 0)return;let l=i(r,a.fileImport.pattern),u=(g.get(r)??[]).filter(e=>e.isContainer&&!e.implicit&&e.scope.length<=c.length&&e.scope.every((e,t)=>c[t]===e)).sort((e,t)=>e.scope.length-t.scope.length).map(e=>e.chain.at(-1));[...h.keys()].filter(e=>e!==r&&n(l,e)).sort().forEach((t,n)=>{e(h.get(t).placement,c)&&visit(t,[...o,...[...new Set(u)].map(e=>({path:r,node:e})),{path:r,node:a.fileImport,targetPath:t,matchIndex:n}])})}}))].sort((e,t)=>e.line-t.line||e.column-t.column).forEach(e=>e.run()))};u.map(r).forEach(e=>{h.get(e)?.placement.length===0&&visit(e,[])}),c.set(l,y),s.set(l,b)}export{authoredOrderKey,authoredOrderOf,authoredOriginsOf,recordAuthoredOrder,sameAuthoredStep};
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{placementFrom as e}from"../Parsing/ImportDiscovery.js";import{discoverImports as t,parseForAuthoring as n}from"../ScreenplayCompiler.js";import{matchesPlayPattern as r,normalizePlayPath as i,resolvePlayPattern as a}from"./PlayGlob.js";import{samePlacement as o}from"./PlayPlacement.js";const s=/* @__PURE__ */ new WeakMap,authoredOriginsOf=e=>s.get(e)??/* @__PURE__ */ new Map,sameAuthoredStep=(e,t)=>e.path===t.path&&e.node.kind===t.node.kind&&e.node.location.line===t.node.location.line&&e.node.location.column===t.node.location.column&&e.targetPath===t.targetPath,c=/* @__PURE__ */ new WeakMap,authoredOrderKey=e=>JSON.stringify(e);function authoredOrderOf(e){return c.get(e)??/* @__PURE__ */ new Map}function declarations(e){let t=[],feature=(e,n,r)=>{let i=[...n,e.name],a=e.isPlacement?r:[...r,e];t.push({scope:i,...e.location,implicit:e.isPlacement,isContainer:!0,chain:a}),e.features.forEach(e=>feature(e,i,a)),e.slices.forEach(e=>t.push({scope:[...i,e.name],...e.location,implicit:!1,isContainer:!1,chain:[...a,e]}))};return e.modules.forEach(e=>{let n=e.isPlacement?[]:[e];t.push({scope:[e.name],...e.location,implicit:e.isPlacement,isContainer:!0,chain:n}),e.features.forEach(t=>feature(t,[e.name],n))}),t}function containerOwners(e,t){let n=/* @__PURE__ */ new Map;for(let[r,i]of e){let e=r.split(`/`),a=e[e.length-1].slice(0,-5);for(let o of i.filter(e=>e.isContainer&&!e.implicit)){let i=o.scope.indexOf(a);if(!t.has(r)&&i===-1)continue;let s=t.has(r)?0:i+1,c=authoredOrderKey(o.scope),l=n.get(c);(l===void 0||s<l.priority||s===l.priority&&e.length<l.depth)&&n.set(c,{path:r,priority:s,depth:e.length})}}return new Map([...n].map(([e,t])=>[e,t.path]))}function recordAuthoredOrder(l,u,d,f,p,m){let h=new Map(d.map(e=>[e.path,e])),g=new Map(d.filter(e=>e.isPlacementResolved!==!1).map(e=>[e.path,declarations(p?.get(e.path)??n(e.source,e.path,e.placement,!1,void 0,f).value)])),_=containerOwners(g,new Set(u.map(i))),v=new Set([...g.values()].flat().filter(e=>!e.implicit).map(e=>authoredOrderKey(e.scope))),y=/* @__PURE__ */ new Map,b=/* @__PURE__ */ new Map,x=/* @__PURE__ */ new Set,visit=(n,i)=>{let s=h.get(n);s===void 0||s.isPlacementResolved===!1||x.has(n)||(x.add(n),[...(g.get(n)??[]).filter(e=>{let t=authoredOrderKey(e.scope);return(!e.implicit||!v.has(t))&&(!e.isContainer||!_.has(t)||_.get(t)===n)}).map(e=>({line:e.line,column:e.column,run:()=>{let t=authoredOrderKey(e.scope);y.has(t)||(y.set(t,y.size),b.set(t,[...i,...e.chain.map(e=>({path:n,node:e}))]))}})),...(m?.get(n)??t(s.source,n,f)).map(t=>({...t.fileImport.location,run:()=>{let c=e(t,s.placement);if(c===void 0)return;let l=a(n,t.fileImport.pattern),u=(g.get(n)??[]).filter(e=>e.isContainer&&!e.implicit&&e.scope.length<=c.length&&e.scope.every((e,t)=>c[t]===e)).sort((e,t)=>e.scope.length-t.scope.length).map(e=>e.chain.at(-1));[...h.keys()].filter(e=>e!==n&&r(l,e)).sort().forEach((e,r)=>{o(h.get(e).placement,c)&&visit(e,[...i,...[...new Set(u)].map(e=>({path:n,node:e})),{path:n,node:t.fileImport,targetPath:e,matchIndex:r}])})}}))].sort((e,t)=>e.line-t.line||e.column-t.column).forEach(e=>e.run()))};u.map(i).forEach(e=>{h.get(e)?.placement.length===0&&visit(e,[])}),c.set(l,y),s.set(l,b)}export{authoredOrderKey,authoredOrderOf,authoredOriginsOf,recordAuthoredOrder,sameAuthoredStep};
2
2
  //# sourceMappingURL=AuthoredOrder.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AuthoredOrder.js","names":["origins","application","left","right","orders","scope","found","outer","syntax","chain","ancestors","child","slice","module","owners","path","declarations","own","segments","name","declaration","ancestor","roots","priority","key","current","owner","files","documents","document","parsed","parseForAuthoring","languages","normalizePlayPath","explicit","order","trace","visited","imports","discoverImports","imported","placement","placementFrom","pattern","resolvePlayPattern","index","target","matchesPlayPattern","samePlacement","entry"],"sources":["../../../../../../Compiler/Files/AuthoredOrder.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiscoveredImport, placementFrom } from '../Parsing/ImportDiscovery';\nimport { discoverImports, parseForAuthoring } from '../ScreenplayCompiler';\nimport { ApplicationSyntax, FeatureSyntax } from '../Syntax/Structure';\nimport { PlacedPlayDocument } from './PlayDocumentSource';\nimport { matchesPlayPattern, normalizePlayPath, resolvePlayPattern } from './PlayGlob';\nimport { samePlacement } from './PlayPlacement';\nimport { AuthoredDeclaration } from './AuthoredDeclaration';\nimport { SyntaxNode } from '../Syntax/SyntaxNode';\n\n/** A physical declaration or one particular file reached by an import. Presentation only. */\nexport interface AuthoredOrderStep {\n readonly path: string;\n readonly node: SyntaxNode;\n readonly targetPath?: string;\n readonly matchIndex?: number;\n}\n\nconst origins = new WeakMap<ApplicationSyntax, ReadonlyMap<string, readonly AuthoredOrderStep[]>>();\nexport const authoredOriginsOf = (application: ApplicationSyntax): ReadonlyMap<string, readonly AuthoredOrderStep[]> => origins.get(application) ?? new Map();\nexport const sameAuthoredStep = (left: AuthoredOrderStep, right: AuthoredOrderStep): boolean => left.path === right.path && left.node.kind === right.node.kind &&\n left.node.location.line === right.node.location.line && left.node.location.column === right.node.location.column && left.targetPath === right.targetPath;\n\n// Presentation metadata never enters syntax JSON, semantic bytes or identity. Merging and diagnostics\n// still use the original document order; only a consumer explicitly requesting authored order sees it.\nconst orders = new WeakMap<ApplicationSyntax, ReadonlyMap<string, number>>();\nexport const authoredOrderKey = (scope: readonly string[]): string => JSON.stringify(scope);\n\nexport function authoredOrderOf(application: ApplicationSyntax): ReadonlyMap<string, number> {\n return orders.get(application) ?? new Map();\n}\n\n// A board may narrow an application without changing the order of its remaining declarations.\nexport function copyAuthoredOrder(original: ApplicationSyntax, narrowed: ApplicationSyntax): ApplicationSyntax {\n const order = orders.get(original);\n if (order !== undefined) orders.set(narrowed, order);\n return narrowed;\n}\n\nfunction declarations(application: ApplicationSyntax): (AuthoredDeclaration & { chain: readonly SyntaxNode[] })[] {\n const found: (AuthoredDeclaration & { chain: readonly SyntaxNode[] })[] = [];\n const feature = (syntax: FeatureSyntax, outer: readonly string[], ancestors: readonly SyntaxNode[]) => {\n const scope = [...outer, syntax.name];\n const chain = syntax.isPlacement ? ancestors : [...ancestors, syntax];\n found.push({ scope, ...syntax.location, implicit: syntax.isPlacement, isContainer: true, chain });\n syntax.features.forEach(child => feature(child, scope, chain));\n syntax.slices.forEach(slice => found.push({ scope: [...scope, slice.name], ...slice.location, implicit: false, isContainer: false, chain: [...chain, slice] }));\n };\n application.modules.forEach(module => {\n const chain = module.isPlacement ? [] : [module];\n found.push({ scope: [module.name], ...module.location, implicit: module.isPlacement, isContainer: true, chain });\n module.features.forEach(child => feature(child, [module.name], chain));\n });\n return found;\n}\n\n// A root's explicit declarations, or those in an enclosing container's own named file, define container\n// order before globbed slice files that merely restate the same containers. Prefer the outer named\n// composite, then the shallower path; absent one, the text walk keeps the first explicit occurrence.\nfunction containerOwners(own: ReadonlyMap<string, readonly AuthoredDeclaration[]>, roots: ReadonlySet<string>): ReadonlyMap<string, string> {\n const owners = new Map<string, { path: string; priority: number; depth: number }>();\n for (const [path, declarations] of own) {\n const segments = path.split('/');\n const name = segments[segments.length - 1].slice(0, -5);\n for (const declaration of declarations.filter(declaration => declaration.isContainer && !declaration.implicit)) {\n const ancestor = declaration.scope.indexOf(name);\n if (!roots.has(path) && ancestor === -1) continue;\n const priority = roots.has(path) ? 0 : ancestor + 1;\n const key = authoredOrderKey(declaration.scope);\n const current = owners.get(key);\n if (current === undefined || priority < current.priority || (priority === current.priority && segments.length < current.depth)) {\n owners.set(key, { path, priority, depth: segments.length });\n }\n }\n }\n return new Map([...owners].map(([key, owner]) => [key, owner.path]));\n}\n\n// Walk text, not the merged tree: placement stubs must not claim the position of a declaration that is\n// written elsewhere. Expand an import only if it contributes the file's settled (deepest) placement.\nexport function recordAuthoredOrder(application: ApplicationSyntax, roots: readonly string[], documents: readonly PlacedPlayDocument[], languages?: ReadonlySet<string>, parsed?: ReadonlyMap<string, ApplicationSyntax>, imports?: ReadonlyMap<string, readonly DiscoveredImport[]>): void {\n const files = new Map(documents.map(document => [document.path, document]));\n const own = new Map(documents.filter(document => document.isPlacementResolved !== false).map(document => [document.path, declarations(parsed?.get(document.path) ?? parseForAuthoring(document.source, document.path, document.placement, false, undefined, languages).value)]));\n const owners = containerOwners(own, new Set(roots.map(normalizePlayPath)));\n const explicit = new Set([...own.values()].flat().filter(declaration => !declaration.implicit).map(declaration => authoredOrderKey(declaration.scope)));\n const order = new Map<string, number>();\n const trace = new Map<string, readonly AuthoredOrderStep[]>();\n const visited = new Set<string>();\n const visit = (path: string, outer: readonly AuthoredOrderStep[]) => {\n const document = files.get(path);\n if (document === undefined || document.isPlacementResolved === false || visited.has(path)) return;\n visited.add(path);\n const entries = [\n ...(own.get(path) ?? []).filter(declaration => {\n const key = authoredOrderKey(declaration.scope);\n return (!declaration.implicit || !explicit.has(key)) && (!declaration.isContainer || !owners.has(key) || owners.get(key) === path);\n })\n .map(declaration => ({ line: declaration.line, column: declaration.column, run: () => {\n const key = authoredOrderKey(declaration.scope);\n if (!order.has(key)) {\n order.set(key, order.size);\n trace.set(key, [...outer, ...declaration.chain.map(node => ({ path, node }))]);\n }\n } })),\n ...(imports?.get(path) ?? discoverImports(document.source, path, languages)).map(imported => ({\n ...imported.fileImport.location,\n run: () => {\n const placement = placementFrom(imported, document.placement);\n if (placement === undefined) return;\n const pattern = resolvePlayPattern(path, imported.fileImport.pattern);\n const ancestors = (own.get(path) ?? []).filter(declaration => declaration.isContainer && !declaration.implicit &&\n declaration.scope.length <= placement.length && declaration.scope.every((name, index) => placement[index] === name))\n .sort((left, right) => left.scope.length - right.scope.length).map(declaration => declaration.chain.at(-1)!);\n [...files.keys()].filter(target => target !== path && matchesPlayPattern(pattern, target)).sort().forEach((target, matchIndex) => {\n if (samePlacement(files.get(target)!.placement, placement)) visit(target, [...outer, ...[...new Set(ancestors)].map(node => ({ path, node })), { path, node: imported.fileImport, targetPath: target, matchIndex }]);\n });\n },\n })),\n ];\n entries.sort((left, right) => left.line - right.line || left.column - right.column).forEach(entry => entry.run());\n };\n roots.map(normalizePlayPath).forEach(path => {\n const document = files.get(path);\n // A broad root glob can discover a file before the import that actually places it.\n if (document?.placement.length === 0) visit(path, []);\n });\n orders.set(application, order);\n origins.set(application, trace);\n}\n"],"mappings":"0VAoBA,MAAMA,kBAAU,IAAI,QACP,kBAAqB,GAAsFA,EAAQ,IAAIC,CAAW,mBAAK,IAAI,IA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Q,IAAIC,EAAamC,CAAK,CAClC"}
1
+ {"version":3,"file":"AuthoredOrder.js","names":["origins","application","left","right","orders","scope","found","outer","syntax","chain","ancestors","child","slice","module","owners","path","declarations","own","segments","name","declaration","ancestor","roots","priority","key","current","owner","files","documents","document","parsed","parseForAuthoring","languages","normalizePlayPath","explicit","order","trace","visited","imports","discoverImports","imported","placement","placementFrom","pattern","resolvePlayPattern","index","target","matchesPlayPattern","samePlacement","entry"],"sources":["../../../../../../Compiler/Files/AuthoredOrder.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiscoveredImport, placementFrom } from '../Parsing/ImportDiscovery';\nimport { discoverImports, parseForAuthoring } from '../ScreenplayCompiler';\nimport { ApplicationSyntax, FeatureSyntax } from '../Syntax/Structure';\nimport { PlacedPlayDocument } from './PlayDocumentSource';\nimport { matchesPlayPattern, normalizePlayPath, resolvePlayPattern } from './PlayGlob';\nimport { samePlacement } from './PlayPlacement';\nimport { AuthoredDeclaration } from './AuthoredDeclaration';\nimport { SyntaxNode } from '../Syntax/SyntaxNode';\n\n/** A physical declaration or one particular file reached by an import. Presentation only. */\nexport interface AuthoredOrderStep {\n readonly path: string;\n readonly node: SyntaxNode;\n readonly targetPath?: string;\n readonly matchIndex?: number;\n}\n\nconst origins = new WeakMap<ApplicationSyntax, ReadonlyMap<string, readonly AuthoredOrderStep[]>>();\nexport const authoredOriginsOf = (application: ApplicationSyntax): ReadonlyMap<string, readonly AuthoredOrderStep[]> => origins.get(application) ?? new Map();\nexport const sameAuthoredStep = (left: AuthoredOrderStep, right: AuthoredOrderStep): boolean => left.path === right.path && left.node.kind === right.node.kind &&\n left.node.location.line === right.node.location.line && left.node.location.column === right.node.location.column && left.targetPath === right.targetPath;\n\n// Presentation metadata never enters syntax JSON, semantic bytes or identity. Merging and diagnostics\n// still use the original document order; only a consumer explicitly requesting authored order sees it.\nconst orders = new WeakMap<ApplicationSyntax, ReadonlyMap<string, number>>();\nexport const authoredOrderKey = (scope: readonly string[]): string => JSON.stringify(scope);\n\nexport function authoredOrderOf(application: ApplicationSyntax): ReadonlyMap<string, number> {\n return orders.get(application) ?? new Map();\n}\n\n// A board may narrow an application without changing the order of its remaining declarations.\nexport function copyAuthoredOrder(original: ApplicationSyntax, narrowed: ApplicationSyntax): ApplicationSyntax {\n const order = orders.get(original);\n if (order !== undefined) orders.set(narrowed, order);\n return narrowed;\n}\n\nfunction declarations(application: ApplicationSyntax): (AuthoredDeclaration & { chain: readonly SyntaxNode[] })[] {\n const found: (AuthoredDeclaration & { chain: readonly SyntaxNode[] })[] = [];\n const feature = (syntax: FeatureSyntax, outer: readonly string[], ancestors: readonly SyntaxNode[]) => {\n const scope = [...outer, syntax.name];\n const chain = syntax.isPlacement ? ancestors : [...ancestors, syntax];\n found.push({ scope, ...syntax.location, implicit: syntax.isPlacement, isContainer: true, chain });\n syntax.features.forEach(child => feature(child, scope, chain));\n syntax.slices.forEach(slice => found.push({ scope: [...scope, slice.name], ...slice.location, implicit: false, isContainer: false, chain: [...chain, slice] }));\n };\n application.modules.forEach(module => {\n const chain = module.isPlacement ? [] : [module];\n found.push({ scope: [module.name], ...module.location, implicit: module.isPlacement, isContainer: true, chain });\n module.features.forEach(child => feature(child, [module.name], chain));\n });\n return found;\n}\n\n// A root's explicit declarations, or those in an enclosing container's own named file, define container\n// order before globbed slice files that merely restate the same containers. Prefer the outer named\n// composite, then the shallower path; absent one, the text walk keeps the first explicit occurrence.\nfunction containerOwners(own: ReadonlyMap<string, readonly AuthoredDeclaration[]>, roots: ReadonlySet<string>): ReadonlyMap<string, string> {\n const owners = new Map<string, { path: string; priority: number; depth: number }>();\n for (const [path, declarations] of own) {\n const segments = path.split('/');\n const name = segments[segments.length - 1].slice(0, -5);\n for (const declaration of declarations.filter(declaration => declaration.isContainer && !declaration.implicit)) {\n const ancestor = declaration.scope.indexOf(name);\n if (!roots.has(path) && ancestor === -1) continue;\n const priority = roots.has(path) ? 0 : ancestor + 1;\n const key = authoredOrderKey(declaration.scope);\n const current = owners.get(key);\n if (current === undefined || priority < current.priority || (priority === current.priority && segments.length < current.depth)) {\n owners.set(key, { path, priority, depth: segments.length });\n }\n }\n }\n return new Map([...owners].map(([key, owner]) => [key, owner.path]));\n}\n\n// Walk text, not the merged tree: placement stubs must not claim the position of a declaration that is\n// written elsewhere. Expand an import only if it contributes the file's settled (deepest) placement.\nexport function recordAuthoredOrder(application: ApplicationSyntax, roots: readonly string[], documents: readonly PlacedPlayDocument[], languages?: ReadonlySet<string>, parsed?: ReadonlyMap<string, ApplicationSyntax>, imports?: ReadonlyMap<string, readonly DiscoveredImport[]>): void {\n const files = new Map(documents.map(document => [document.path, document]));\n const own = new Map(documents.filter(document => document.isPlacementResolved !== false).map(document => [document.path, declarations(parsed?.get(document.path) ?? parseForAuthoring(document.source, document.path, document.placement, false, undefined, languages).value)]));\n const owners = containerOwners(own, new Set(roots.map(normalizePlayPath)));\n const explicit = new Set([...own.values()].flat().filter(declaration => !declaration.implicit).map(declaration => authoredOrderKey(declaration.scope)));\n const order = new Map<string, number>();\n const trace = new Map<string, readonly AuthoredOrderStep[]>();\n const visited = new Set<string>();\n const visit = (path: string, outer: readonly AuthoredOrderStep[]) => {\n const document = files.get(path);\n if (document === undefined || document.isPlacementResolved === false || visited.has(path)) return;\n visited.add(path);\n const entries = [\n ...(own.get(path) ?? []).filter(declaration => {\n const key = authoredOrderKey(declaration.scope);\n return (!declaration.implicit || !explicit.has(key)) && (!declaration.isContainer || !owners.has(key) || owners.get(key) === path);\n })\n .map(declaration => ({ line: declaration.line, column: declaration.column, run: () => {\n const key = authoredOrderKey(declaration.scope);\n if (!order.has(key)) {\n order.set(key, order.size);\n trace.set(key, [...outer, ...declaration.chain.map(node => ({ path, node }))]);\n }\n } })),\n ...(imports?.get(path) ?? discoverImports(document.source, path, languages)).map(imported => ({\n ...imported.fileImport.location,\n run: () => {\n const placement = placementFrom(imported, document.placement);\n if (placement === undefined) return;\n const pattern = resolvePlayPattern(path, imported.fileImport.pattern);\n const ancestors = (own.get(path) ?? []).filter(declaration => declaration.isContainer && !declaration.implicit &&\n declaration.scope.length <= placement.length && declaration.scope.every((name, index) => placement[index] === name))\n .sort((left, right) => left.scope.length - right.scope.length).map(declaration => declaration.chain.at(-1)!);\n [...files.keys()].filter(target => target !== path && matchesPlayPattern(pattern, target)).sort().forEach((target, matchIndex) => {\n if (samePlacement(files.get(target)!.placement, placement)) visit(target, [...outer, ...[...new Set(ancestors)].map(node => ({ path, node })), { path, node: imported.fileImport, targetPath: target, matchIndex }]);\n });\n },\n })),\n ];\n entries.sort((left, right) => left.line - right.line || left.column - right.column).forEach(entry => entry.run());\n };\n roots.map(normalizePlayPath).forEach(path => {\n const document = files.get(path);\n // A broad root glob can discover a file before the import that actually places it.\n if (document?.placement.length === 0) visit(path, []);\n });\n orders.set(application, order);\n origins.set(application, trace);\n}\n"],"mappings":"A,0VAoBA,MAAMA,kBAAU,IAAI,QACP,kBAAqB,GAAsFA,EAAQ,IAAIC,CAAW,mBAAK,IAAI,IAC3I,kBAAoB,EAAyB,IAAsCC,EAAK,OAASC,EAAM,MAAQD,EAAK,KAAK,OAASC,EAAM,KAAK,MACtJD,EAAK,KAAK,SAAS,OAASC,EAAM,KAAK,SAAS,MAAQD,EAAK,KAAK,SAAS,SAAWC,EAAM,KAAK,SAAS,QAAUD,EAAK,aAAeC,EAAM,WAI5IC,kBAAS,IAAI,QACN,iBAAoB,GAAqC,KAAK,UAAUC,CAAK,EAE1F,SAAgB,gBAAgB,EAA6D,CACzF,OAAOD,EAAO,IAAIH,CAAW,mBAAK,IAAI,GAC1C,CASA,SAAS,aAAa,EAA4F,CAC9G,IAAMK,EAAoE,CAAC,EACrE,SAAW,EAAuB,EAA0B,IAAqC,CACnG,IAAMD,EAAQ,CAAC,GAAGE,EAAOC,EAAO,IAAI,EAC9BC,EAAQD,EAAO,YAAcE,EAAY,CAAC,GAAGA,EAAWF,CAAM,EACpEF,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C,KAAK,CAAC,CAAC,SAAS,EAAQ,IAAe,CAC1HE,EAAcrB,EAAM,IAAImB,CAAM,CAAC,CAAE,UAAWL,CAAS,GAAG,MAAMK,EAAQ,CAAC,GAAGvC,EAAO,GAAG,CAAC,GAAG,IAAI,IAAIG,CAAS,CAAC,CAAC,CAAC,IAAI,IAAS,CAAE,OAAM,MAAK,EAAE,EAAG,CAAE,OAAM,KAAM8B,EAAS,WAAY,WAAYM,EAAQ,YAAW,CAAC,CAAC,CACvN,CAAC,CACL,CACJ,EAAE,CAEA,CAAC,CAAC,MAAM,EAAM,IAAU5C,EAAK,KAAOC,EAAM,MAAQD,EAAK,OAASC,EAAM,MAAM,CAAC,CAAC,QAAQ,GAAS8C,EAAM,IAAI,CAAC,EACpH,EACA3B,EAAM,IAAIW,CAAiB,CAAC,CAAC,QAAQ,GAAQ,CACxBN,EAAM,IAAIZ,CAEhB,CAAC,EAAE,UAAU,SAAW,GAAG,MAAMA,EAAM,CAAC,CAAC,CACxD,CAAC,EACDX,EAAO,IAAIH,EAAakC,CAAK,EAC7BnC,EAAQ,IAAIC,EAAamC,CAAK,CAClC,C"}
@@ -1,2 +1,2 @@
1
- import"../../_virtual/_virtual/_rolldown/runtime.js";import{matchesPlayPattern as e,normalizePlayPath as t,resolvePlayPattern as n}from"./PlayGlob.js";import{discoverImports as r}from"../ScreenplayCompiler.js";function selectOrderingRoot(i,a,o,s){let c=[...new Set(i.map(t))];if(c.length===1)return c[0];if(s??=new Map(a.map(e=>[e.path,r(e.source,e.path,o)])),(s.get(`application.play`)?.length??0)>0)return`application.play`;let l=/* @__PURE__ */ new Set;for(let[t,r]of s)for(let i of r){let r=n(t,i.fileImport.pattern);a.filter(n=>n.path!==t&&e(r,n.path)).forEach(e=>l.add(e.path))}let u=[...s].filter(([e,t])=>t.length>0&&!l.has(e)).map(([e])=>e);return u.length===1?u[0]:void 0}export{selectOrderingRoot};
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{discoverImports as e}from"../ScreenplayCompiler.js";import{matchesPlayPattern as t,normalizePlayPath as n,resolvePlayPattern as r}from"./PlayGlob.js";function selectOrderingRoot(i,a,o,s){let c=[...new Set(i.map(n))];if(c.length===1)return c[0];if(s??=new Map(a.map(t=>[t.path,e(t.source,t.path,o)])),(s.get(`application.play`)?.length??0)>0)return`application.play`;let l=/* @__PURE__ */ new Set;for(let[e,n]of s)for(let i of n){let n=r(e,i.fileImport.pattern);a.filter(r=>r.path!==e&&t(n,r.path)).forEach(e=>l.add(e.path))}let u=[...s].filter(([e,t])=>t.length>0&&!l.has(e)).map(([e])=>e);return u.length===1?u[0]:void 0}export{selectOrderingRoot};
2
2
  //# sourceMappingURL=OrderingRoot.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OrderingRoot.js","names":["normalized","roots","normalizePlayPath","documents","document","discoverImports","languages","imports","imported","path","entries","entry","pattern","resolvePlayPattern","matchesPlayPattern","candidates"],"sources":["../../../../../../Compiler/Files/OrderingRoot.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiscoveredImport } from '../Parsing/ImportDiscovery';\nimport { discoverImports } from '../ScreenplayCompiler';\nimport { PlacedPlayDocument } from './PlayDocumentSource';\nimport { matchesPlayPattern, normalizePlayPath, resolvePlayPattern } from './PlayGlob';\n\n// Choosing presentation order never changes the roots used for resolving or merging documents.\nexport function selectOrderingRoot(roots: readonly string[], documents: readonly PlacedPlayDocument[], languages?: ReadonlySet<string>, imports?: ReadonlyMap<string, readonly DiscoveredImport[]>): string | undefined {\n const normalized = [...new Set(roots.map(normalizePlayPath))];\n if (normalized.length === 1) return normalized[0];\n imports ??= new Map(documents.map(document => [document.path, discoverImports(document.source, document.path, languages)]));\n if ((imports.get('application.play')?.length ?? 0) > 0) return 'application.play';\n const imported = new Set<string>();\n for (const [path, entries] of imports) {\n for (const entry of entries) {\n const pattern = resolvePlayPattern(path, entry.fileImport.pattern);\n documents.filter(document => document.path !== path && matchesPlayPattern(pattern, document.path)).forEach(document => imported.add(document.path));\n }\n }\n const candidates = [...imports].filter(([path, entries]) => entries.length > 0 && !imported.has(path)).map(([path]) => path);\n return candidates.length === 1 ? candidates[0] : undefined;\n}\n"],"mappings":"kNASA,SAAgB,mBAAmB,EAA0B,EAA0C,EAAiC,EAAgF,CACpN,IAAMA,EAAa,CAAC,GAAG,IAAI,IAAIC,EAAM,IAAIC,CAAiB,CAAC,CAAC,EAC5D,GAAIF,EAAW,SAAW,EAAG,OAAOA,EAAW,GAE/C,GADA,IAAY,IAAI,IAAIG,EAAU,IAAI,GAAY,CAACC,EAAS,KAAMC,EAAgBD,EAAS,OAAQA,EAAS,KAAME,CAAS,CAAC,CAAC,CAAC,GACrHC,EAAQ,IAAI,kBAAkB,CAAC,EAAE,QAAU,GAAK,EAAG,MAAO,mBAC/D,IAAMC,kBAAW,IAAI,IACrB,IAAK,GAAM,CAACC,EAAMC,KAAYH,EAC1B,IAAK,IAAMI,KAASD,EAAS,CACzB,IAAME,EAAUC,EAAmBJ,EAAME,EAAM,WAAW,OAAO,EACjER,EAAU,OAAO,GAAYC,EAAS,OAASK,GAAQK,EAAmBF,EAASR,EAAS,IAAI,CAAC,CAAC,CAAC,QAAQ,GAAYI,EAAS,IAAIJ,EAAS,IAAI,CAAC,CACtJ,CAEJ,IAAMW,EAAa,CAAC,GAAGR,CAAO,CAAC,CAAC,QAAQ,CAACE,EAAMC,KAAaA,EAAQ,OAAS,GAAK,CAACF,EAAS,IAAIC,CAAI,CAAC,CAAC,CAAC,KAAK,CAACA,KAAUA,CAAI,EAC3H,OAAOM,EAAW,SAAW,EAAIA,EAAW,GAAK,IAAA,EACrD"}
1
+ {"version":3,"file":"OrderingRoot.js","names":["normalized","roots","normalizePlayPath","documents","document","discoverImports","languages","imports","imported","path","entries","entry","pattern","resolvePlayPattern","matchesPlayPattern","candidates"],"sources":["../../../../../../Compiler/Files/OrderingRoot.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiscoveredImport } from '../Parsing/ImportDiscovery';\nimport { discoverImports } from '../ScreenplayCompiler';\nimport { PlacedPlayDocument } from './PlayDocumentSource';\nimport { matchesPlayPattern, normalizePlayPath, resolvePlayPattern } from './PlayGlob';\n\n// Choosing presentation order never changes the roots used for resolving or merging documents.\nexport function selectOrderingRoot(roots: readonly string[], documents: readonly PlacedPlayDocument[], languages?: ReadonlySet<string>, imports?: ReadonlyMap<string, readonly DiscoveredImport[]>): string | undefined {\n const normalized = [...new Set(roots.map(normalizePlayPath))];\n if (normalized.length === 1) return normalized[0];\n imports ??= new Map(documents.map(document => [document.path, discoverImports(document.source, document.path, languages)]));\n if ((imports.get('application.play')?.length ?? 0) > 0) return 'application.play';\n const imported = new Set<string>();\n for (const [path, entries] of imports) {\n for (const entry of entries) {\n const pattern = resolvePlayPattern(path, entry.fileImport.pattern);\n documents.filter(document => document.path !== path && matchesPlayPattern(pattern, document.path)).forEach(document => imported.add(document.path));\n }\n }\n const candidates = [...imports].filter(([path, entries]) => entries.length > 0 && !imported.has(path)).map(([path]) => path);\n return candidates.length === 1 ? candidates[0] : undefined;\n}\n"],"mappings":"A,kNASA,SAAgB,mBAAmB,EAA0B,EAA0C,EAAiC,EAAgF,CACpN,IAAMA,EAAa,CAAC,GAAG,IAAI,IAAIC,EAAM,IAAIC,CAAiB,CAAC,CAAC,EAC5D,GAAIF,EAAW,SAAW,EAAG,OAAOA,EAAW,GAE/C,GADA,IAAY,IAAI,IAAIG,EAAU,IAAI,GAAY,CAACC,EAAS,KAAMC,EAAgBD,EAAS,OAAQA,EAAS,KAAME,CAAS,CAAC,CAAC,CAAC,GACrHC,EAAQ,IAAI,kBAAkB,CAAC,EAAE,QAAU,GAAK,EAAG,MAAO,mBAC/D,IAAMC,kBAAW,IAAI,IACrB,IAAK,GAAM,CAACC,EAAMC,KAAYH,EAC1B,IAAK,IAAMI,KAASD,EAAS,CACzB,IAAME,EAAUC,EAAmBJ,EAAME,EAAM,WAAW,OAAO,EACjER,EAAU,OAAO,GAAYC,EAAS,OAASK,GAAQK,EAAmBF,EAASR,EAAS,IAAI,CAAC,CAAC,CAAC,QAAQ,GAAYI,EAAS,IAAIJ,EAAS,IAAI,CAAC,CACtJ,CAEJ,IAAMW,EAAa,CAAC,GAAGR,CAAO,CAAC,CAAC,QAAQ,CAACE,EAAMC,KAAaA,EAAQ,OAAS,GAAK,CAACF,EAAS,IAAIC,CAAI,CAAC,CAAC,CAAC,KAAK,CAACA,KAAUA,CAAI,EAC3H,OAAOM,EAAW,SAAW,EAAIA,EAAW,GAAK,IAAA,EACrD,C"}
@@ -1,2 +1,2 @@
1
- import"../../_virtual/_virtual/_rolldown/runtime.js";import{splitLines as e}from"../Parsing/SourceLineSplitter.js";import{effectiveStructuralInteractions as t}from"../Parsing/StructuralInteractionSites.js";import{expandSpecificationExamples as n,validateSpecificationExampleTypes as r}from"../Parsing/SpecificationCommandExamples.js";import{validateResponses as i}from"../Parsing/ResponseValidator.js";import{validateSpecificationCases as a}from"../Parsing/SpecificationCaseValidator.js";import{productionDestinationDiagnostics as o}from"../Diagnostics/ProductionDestinationDiagnostics.js";import{validateConstraintProperties as s}from"../Parsing/ConstraintPropertyValidator.js";import{validateDependencyDeclarations as c}from"../Dependencies/DeclaredDependencyTargets.js";import{LineReader as l}from"../Parsing/LineReader.js";import{ParserContext as u}from"../Parsing/ParserContext.js";import{normalizePlayPath as d}from"./PlayGlob.js";import{recordAuthoredOrder as f}from"./AuthoredOrder.js";import{DeclaredDependencies as p}from"../Dependencies/DeclaredDependencies.js";import{validatePublicEventUsage as m}from"../Parsing/PublicEventUsageValidator.js";import{validateInlineEvents as h}from"../Parsing/InlineEventValidator.js";import{validateOperations as g}from"../Parsing/OperationValidator.js";import{CommandStreamCandidates as _}from"../Parsing/CommandStreamCandidates.js";import{validateEventSources as v}from"../Parsing/EventSourceValidator.js";import{validateProjectionTargets as y}from"../Parsing/ProjectionTargetValidator.js";import{validateIdentifierCompliance as b}from"../Parsing/IdentifierComplianceValidator.js";import{validateEventSubjects as x}from"../Parsing/EventSubjectValidator.js";import{validateReadModelKeys as S}from"../Parsing/ReadModelKeyValidator.js";import{validateReadModelMemberTypes as C}from"../Parsing/ReadModelMemberTypeValidator.js";import{validateReactionRefusals as w}from"../Parsing/ReactionRefusalValidator.js";import{validateSpecificationRedelivery as T}from"../Parsing/SpecificationRedeliveryValidator.js";import{validateGuardedActions as E}from"../Parsing/GuardedActionValidator.js";import{validatePersonaCallers as D}from"../Parsing/PersonaCallerValidator.js";import{validatePurposes as O}from"../Parsing/PurposeValidator.js";import{timelineOrderDiagnostics as k}from"./TimelineOrder.js";import{discoverImports as A,parseForAuthoring as j}from"../ScreenplayCompiler.js";import{EventSourceReadConfidence as M}from"../Syntax/EventSourceReadConfidence.js";import{mergeDocuments as N}from"./PlayFolderMerge.js";import{inMemoryDocumentSource as P}from"./PlayDocumentSource.js";import{resolveImports as F}from"./PlayImports.js";import{selectOrderingRoot as I}from"./OrderingRoot.js";function assembleApplication(e,t,n,r){let i=[...e],{documents:a,diagnostics:o}=F(i,t,n),{result:s,syntax:c}=parsePlacedDocumentsWithSyntax(a,n),l=new Map(a.map(e=>[e.path,A(e.source,e.path,n)])),u=r===null?void 0:I(r===void 0?i:[r],a,n,l);u!==void 0&&f(s.value,[u],a,n,c,l);let d=u===void 0?[]:k(s.value),p=[...o,...s.diagnostics,...d];return{...s,documents:a,diagnostics:p,success:!p.some(e=>e.severity===`error`)}}function parsePlacedDocuments(e,t,n=!1){return parsePlacedDocumentsWithSyntax(e,t,n).result}function parsePlacedDocumentsWithSyntax(d,f,k=!1){let A=_.capturePlaced(d.filter(e=>e.isPlacementResolved!==!1).map(t=>({lines:e(t.source,!1,t.path),placement:t.placement})),f),P=d.map(e=>j(e.source,e.path,e.isPlacementResolved===!1?[]:e.placement,!1,A,f)),F=P.flatMap((e,t)=>(e.value.eventSources??[]).map(e=>({source:e,placementResolved:d[t].isPlacementResolved!==!1}))),I=d.every(e=>e.isPlacementResolved!==!1)&&P.every(e=>!M.hasUnknownExtent(e.diagnostics)),L=P.map((e,t)=>d[t].isPlacementResolved===!1?{...e,value:{...e.value,eventSources:[]}}:e),R=N(L),z=new u(new l([]),void 0,f);R.value.sourceOptions!==void 0&&(z.sourceOptions=R.value.sourceOptions),z.guardedInteractions.push(...L.flatMap(e=>e.guardedInteractions)),z.interactionBehaviors.push(...L.flatMap(e=>e.interactionBehaviors)),z.interactionUses.push(...t(R.value).filter(e=>`behavior`in e),...L.flatMap(e=>e.interactionUses).filter(e=>e.ancestors.some(e=>e.keyword===`screen`))),z.continuationValues.push(...L.flatMap(e=>e.continuationValues)),a(R.value,z),r(R.value,z,k);let B=n(R.value);v(R.value,z),g(R.value,z),m(R.value,z),h(R.value,z),s(R.value,z),i(B,z,L.flatMap(e=>e.inputUses)),y(R.value,z),b(B,z),x(R.value,z),S(R.value,z),C(R.value,z),w(R.value,z),T(R.value,z),E(R.value,z),D(R.value,z),O(R.value,z);let V=c(R.value,z);p.validate(V,z);for(let e of o(V))z.information(e.code,e.message,e.location);let H=R.diagnostics,U=new Set(H.map(diagnosticKey)),W=[...H,...z.diagnostics.filter(e=>!U.has(diagnosticKey(e)))];return{result:{...R,value:V,diagnostics:W,success:!W.some(e=>e.severity===`error`),physicalEventSources:F,sourceInventoryComplete:I,continuationValues:z.continuationValues},syntax:new Map(L.map((e,t)=>[d[t].path,e.value]))}}function diagnosticKey(e){return JSON.stringify([e.code,e.location.path,e.location.line,e.location.column])}function compileApplication(e,t,n,r){let i=new Map([...e].map(([e,t])=>[d(e),t]));return assembleApplication(t??[...i.keys()].sort(),P(i),n,r)}export{assembleApplication,compileApplication,parsePlacedDocuments};
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{validateSpecificationCases as e}from"../Parsing/SpecificationCaseValidator.js";import{expandSpecificationExamples as t,validateSpecificationExampleTypes as n}from"../Parsing/SpecificationCommandExamples.js";import{productionDestinationDiagnostics as r}from"../Diagnostics/ProductionDestinationDiagnostics.js";import{validateConstraintProperties as i}from"../Parsing/ConstraintPropertyValidator.js";import{validateDependencyDeclarations as a}from"../Dependencies/DeclaredDependencyTargets.js";import{DeclaredDependencies as o}from"../Dependencies/DeclaredDependencies.js";import{validateInlineEvents as s}from"../Parsing/InlineEventValidator.js";import{LineReader as c}from"../Parsing/LineReader.js";import{CommandStreamCandidates as l}from"../Parsing/CommandStreamCandidates.js";import{validateEventSources as u}from"../Parsing/EventSourceValidator.js";import{validateProjectionTargets as d}from"../Parsing/ProjectionTargetValidator.js";import{validateIdentifierCompliance as f}from"../Parsing/IdentifierComplianceValidator.js";import{validateEventSubjects as p}from"../Parsing/EventSubjectValidator.js";import{validateReadModelKeys as m}from"../Parsing/ReadModelKeyValidator.js";import{validateReadModelMemberTypes as h}from"../Parsing/ReadModelMemberTypeValidator.js";import{validateReactionRefusals as g}from"../Parsing/ReactionRefusalValidator.js";import{validateSpecificationRedelivery as _}from"../Parsing/SpecificationRedeliveryValidator.js";import{effectiveStructuralInteractions as v}from"../Parsing/StructuralInteractionSites.js";import{validateGuardedActions as y}from"../Parsing/GuardedActionValidator.js";import{validatePersonaCallers as b}from"../Parsing/PersonaCallerValidator.js";import{validatePurposes as x}from"../Parsing/PurposeValidator.js";import{splitLines as S}from"../Parsing/SourceLineSplitter.js";import{ParserContext as C}from"../Parsing/ParserContext.js";import{validateResponses as w}from"../Parsing/ResponseValidator.js";import{validatePublicEventUsage as T}from"../Parsing/PublicEventUsageValidator.js";import{validateOperations as E}from"../Parsing/OperationValidator.js";import{discoverImports as D,parseForAuthoring as O}from"../ScreenplayCompiler.js";import{EventSourceReadConfidence as k}from"../Syntax/EventSourceReadConfidence.js";import{mergeDocuments as A}from"./PlayFolderMerge.js";import{inMemoryDocumentSource as j}from"./PlayDocumentSource.js";import{normalizePlayPath as M}from"./PlayGlob.js";import{resolveImports as N}from"./PlayImports.js";import{recordAuthoredOrder as P}from"./AuthoredOrder.js";import{selectOrderingRoot as F}from"./OrderingRoot.js";import{timelineOrderDiagnostics as I}from"./TimelineOrder.js";function assembleApplication(e,t,n,r){let i=[...e],{documents:a,diagnostics:o}=N(i,t,n),{result:s,syntax:c}=parsePlacedDocumentsWithSyntax(a,n),l=new Map(a.map(e=>[e.path,D(e.source,e.path,n)])),u=r===null?void 0:F(r===void 0?i:[r],a,n,l);u!==void 0&&P(s.value,[u],a,n,c,l);let d=u===void 0?[]:I(s.value),f=[...o,...s.diagnostics,...d];return{...s,documents:a,diagnostics:f,success:!f.some(e=>e.severity===`error`)}}function parsePlacedDocuments(e,t,n=!1){return parsePlacedDocumentsWithSyntax(e,t,n).result}function parsePlacedDocumentsWithSyntax(D,j,M=!1){let N=l.capturePlaced(D.filter(e=>e.isPlacementResolved!==!1).map(e=>({lines:S(e.source,!1,e.path),placement:e.placement})),j),P=D.map(e=>O(e.source,e.path,e.isPlacementResolved===!1?[]:e.placement,!1,N,j)),F=P.flatMap((e,t)=>(e.value.eventSources??[]).map(e=>({source:e,placementResolved:D[t].isPlacementResolved!==!1}))),I=D.every(e=>e.isPlacementResolved!==!1)&&P.every(e=>!k.hasUnknownExtent(e.diagnostics)),L=P.map((e,t)=>D[t].isPlacementResolved===!1?{...e,value:{...e.value,eventSources:[]}}:e),R=A(L),z=new C(new c([]),void 0,j);R.value.sourceOptions!==void 0&&(z.sourceOptions=R.value.sourceOptions),z.guardedInteractions.push(...L.flatMap(e=>e.guardedInteractions)),z.interactionBehaviors.push(...L.flatMap(e=>e.interactionBehaviors)),z.interactionUses.push(...v(R.value).filter(e=>`behavior`in e),...L.flatMap(e=>e.interactionUses).filter(e=>e.ancestors.some(e=>e.keyword===`screen`))),z.continuationValues.push(...L.flatMap(e=>e.continuationValues)),e(R.value,z),n(R.value,z,M);let B=t(R.value);u(R.value,z),E(R.value,z),T(R.value,z),s(R.value,z),i(R.value,z),w(B,z,L.flatMap(e=>e.inputUses)),d(R.value,z),f(B,z),p(R.value,z),m(R.value,z),h(R.value,z),g(R.value,z),_(R.value,z),y(R.value,z),b(R.value,z),x(R.value,z);let V=a(R.value,z);o.validate(V,z);for(let e of r(V))z.information(e.code,e.message,e.location);let H=R.diagnostics,U=new Set(H.map(diagnosticKey)),W=[...H,...z.diagnostics.filter(e=>!U.has(diagnosticKey(e)))];return{result:{...R,value:V,diagnostics:W,success:!W.some(e=>e.severity===`error`),physicalEventSources:F,sourceInventoryComplete:I,continuationValues:z.continuationValues},syntax:new Map(L.map((e,t)=>[D[t].path,e.value]))}}function diagnosticKey(e){return JSON.stringify([e.code,e.location.path,e.location.line,e.location.column])}function compileApplication(e,t,n,r){let i=new Map([...e].map(([e,t])=>[M(e),t]));return assembleApplication(t??[...i.keys()].sort(),j(i),n,r)}export{assembleApplication,compileApplication,parsePlacedDocuments};
2
2
  //# sourceMappingURL=PlayApplicationAssembly.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PlayApplicationAssembly.js","names":["rootPaths","roots","resolveImports","source","languages","merged","documents","imports","document","discoverImports","orderingRoot","presentationRoot","selectOrderingRoot","recordAuthoredOrder","syntax","timeline","timelineOrderDiagnostics","all","diagnostics","diagnostic","deferImportedExampleTypes","candidates","CommandStreamCandidates","splitLines","physical","parseForAuthoring","physicalEventSources","result","index","sourceInventoryComplete","EventSourceReadConfidence","parsed","mergeDocuments","context","ParserContext","LineReader","effectiveStructuralInteractions","site","ancestor","validateSpecificationCases","validateSpecificationExampleTypes","effective","expandSpecificationExamples","validateEventSources","validateOperations","validatePublicEventUsage","validateInlineEvents","validateConstraintProperties","validateResponses","validateProjectionTargets","validateIdentifierCompliance","validateEventSubjects","validateReadModelKeys","validateReadModelMemberTypes","validateReactionRefusals","validateSpecificationRedelivery","validateGuardedActions","validatePersonaCallers","validatePurposes","value","validateDependencyDeclarations","DeclaredDependencies","productionDestinationDiagnostics","existing","reported","normalized","path","normalizePlayPath","inMemoryDocumentSource"],"sources":["../../../../../../Compiler/Files/PlayApplicationAssembly.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Diagnostic } from '../Diagnostics/Diagnostic';\nimport { validateSpecificationCases } from '../Parsing/SpecificationCaseValidator';\nimport { expandSpecificationExamples, validateSpecificationExampleTypes } from '../Parsing/SpecificationCommandExamples';\nimport { productionDestinationDiagnostics } from '../Diagnostics/ProductionDestinationDiagnostics';\nimport { validateConstraintProperties } from '../Parsing/ConstraintPropertyValidator';\nimport { validateDependencyDeclarations } from '../Dependencies/DeclaredDependencyTargets';\nimport { DeclaredDependencies } from '../Dependencies/DeclaredDependencies';\nimport { validateInlineEvents } from '../Parsing/InlineEventValidator';\nimport { LineReader } from '../Parsing/LineReader';\nimport { CommandStreamCandidates } from '../Parsing/CommandStreamCandidates';\nimport { validateEventSources } from '../Parsing/EventSourceValidator';\nimport { validateProjectionTargets } from '../Parsing/ProjectionTargetValidator';\nimport { validateIdentifierCompliance } from '../Parsing/IdentifierComplianceValidator';\nimport { validateEventSubjects } from '../Parsing/EventSubjectValidator';\nimport { validateReadModelKeys } from '../Parsing/ReadModelKeyValidator';\nimport { validateReadModelMemberTypes } from '../Parsing/ReadModelMemberTypeValidator';\nimport { validateReactionRefusals } from '../Parsing/ReactionRefusalValidator';\nimport { validateSpecificationRedelivery } from '../Parsing/SpecificationRedeliveryValidator';\nimport { effectiveStructuralInteractions } from '../Parsing/StructuralInteractionSites';\nimport { validateGuardedActions } from '../Parsing/GuardedActionValidator';\nimport { validatePersonaCallers } from '../Parsing/PersonaCallerValidator';\nimport { validatePurposes } from '../Parsing/PurposeValidator';\nimport { splitLines } from '../Parsing/SourceLineSplitter';\nimport { ParserContext } from '../Parsing/ParserContext';\nimport { validateResponses } from '../Parsing/ResponseValidator';\nimport { validatePublicEventUsage } from '../Parsing/PublicEventUsageValidator';\nimport { validateOperations } from '../Parsing/OperationValidator';\nimport { CompilationResult, discoverImports, parseForAuthoring } from '../ScreenplayCompiler';\nimport { ApplicationSyntax } from '../Syntax/Structure';\nimport { EventSourceSyntax } from '../Syntax/EventSources';\nimport { EventSourceReadConfidence } from '../Syntax/EventSourceReadConfidence';\nimport { mergeDocuments } from './PlayFolderMerge';\nimport { inMemoryDocumentSource, PlacedPlayDocument, PlayDocumentSource } from './PlayDocumentSource';\nimport { normalizePlayPath } from './PlayGlob';\nimport { resolveImports } from './PlayImports';\nimport { recordAuthoredOrder } from './AuthoredOrder';\nimport { selectOrderingRoot } from './OrderingRoot';\nimport { timelineOrderDiagnostics } from './TimelineOrder';\n\n// One .play document of a folder: its path relative to the folder, and its text.\nexport interface PlayFileSource {\n readonly path: string;\n readonly source: string;\n}\n\n// One application compiled from documents: the documents that make it up, each with where its top level\n// belongs, and the merged syntax with every diagnostic - resolving, parsing and merging.\nexport interface ApplicationCompilation extends CompilationResult<ApplicationSyntax> {\n readonly documents: readonly PlacedPlayDocument[];\n}\n\n// Assembles one application from documents - following their imports from the roots, parsing each where it is\n// placed, and merging the lot. The port of the C# PlayApplicationAssembly.Compile.\nexport function assembleApplication(roots: Iterable<string>, source: PlayDocumentSource, languages?: ReadonlySet<string>, presentationRoot?: string | null): ApplicationCompilation {\n const rootPaths = [...roots];\n const { documents, diagnostics } = resolveImports(rootPaths, source, languages);\n const { result: merged, syntax } = parsePlacedDocumentsWithSyntax(documents, languages);\n // Resolution owns its import inventory; share one discovery between the presentation passes.\n const imports = new Map(documents.map(document => [document.path, discoverImports(document.source, document.path, languages)]));\n const orderingRoot = presentationRoot === null ? undefined : selectOrderingRoot(presentationRoot === undefined ? rootPaths : [presentationRoot], documents, languages, imports);\n if (orderingRoot !== undefined) recordAuthoredOrder(merged.value, [orderingRoot], documents, languages, syntax, imports);\n const timeline = orderingRoot === undefined ? [] : timelineOrderDiagnostics(merged.value);\n const all = [...diagnostics, ...merged.diagnostics, ...timeline];\n return { ...merged, documents, diagnostics: all, success: !all.some(diagnostic => diagnostic.severity === 'error') };\n}\n\n// Parses documents whose source identities and placements are already known (for example unsaved\n// editor buffers), then validates contracts against the merged declaration inventory. Editor callers may\n// defer example types whose imports are not in that inventory; resolved types are still checked.\nexport function parsePlacedDocuments(documents: readonly PlacedPlayDocument[], languages?: ReadonlySet<string>, deferImportedExampleTypes = false): CompilationResult<ApplicationSyntax> & {\n readonly physicalEventSources: readonly { source: EventSourceSyntax; placementResolved: boolean }[];\n readonly sourceInventoryComplete: boolean;\n readonly continuationValues: ReturnType<typeof parseForAuthoring>['continuationValues'];\n} {\n return parsePlacedDocumentsWithSyntax(documents, languages, deferImportedExampleTypes).result;\n}\n\nfunction parsePlacedDocumentsWithSyntax(documents: readonly PlacedPlayDocument[], languages?: ReadonlySet<string>, deferImportedExampleTypes = false) {\n const candidates = CommandStreamCandidates.capturePlaced(documents.filter(document => document.isPlacementResolved !== false).map(document => ({ lines: splitLines(document.source, false, document.path), placement: document.placement })), languages);\n const physical = documents.map(document => parseForAuthoring(document.source, document.path, document.isPlacementResolved === false ? [] : document.placement, false, candidates, languages));\n const physicalEventSources = physical.flatMap((result, index) => (result.value.eventSources ?? []).map(source => ({ source, placementResolved: documents[index].isPlacementResolved !== false })));\n const sourceInventoryComplete = documents.every(document => document.isPlacementResolved !== false) && physical.every(result => !EventSourceReadConfidence.hasUnknownExtent(result.diagnostics));\n const parsed = physical.map((result, index) => documents[index].isPlacementResolved === false ? { ...result, value: { ...result.value, eventSources: [] } } : result);\n const merged = mergeDocuments(parsed);\n const context = new ParserContext(new LineReader([]), undefined, languages);\n if (merged.value.sourceOptions !== undefined) context.sourceOptions = merged.value.sourceOptions;\n context.guardedInteractions.push(...parsed.flatMap(document => document.guardedInteractions));\n context.interactionBehaviors.push(...parsed.flatMap(document => document.interactionBehaviors));\n context.interactionUses.push(...effectiveStructuralInteractions(merged.value).filter(site => 'behavior' in site),\n ...parsed.flatMap(document => document.interactionUses).filter(site => site.ancestors.some(ancestor => ancestor.keyword === 'screen')));\n context.continuationValues.push(...parsed.flatMap(document => document.continuationValues));\n validateSpecificationCases(merged.value, context);\n validateSpecificationExampleTypes(merged.value, context, deferImportedExampleTypes);\n const effective = expandSpecificationExamples(merged.value);\n validateEventSources(merged.value, context);\n validateOperations(merged.value, context);\n validatePublicEventUsage(merged.value, context);\n validateInlineEvents(merged.value, context);\n validateConstraintProperties(merged.value, context);\n validateResponses(effective, context, parsed.flatMap(document => document.inputUses));\n validateProjectionTargets(merged.value, context);\n validateIdentifierCompliance(effective, context);\n validateEventSubjects(merged.value, context);\n validateReadModelKeys(merged.value, context);\n validateReadModelMemberTypes(merged.value, context);\n validateReactionRefusals(merged.value, context);\n validateSpecificationRedelivery(merged.value, context);\n validateGuardedActions(merged.value, context);\n validatePersonaCallers(merged.value, context);\n validatePurposes(merged.value, context);\n const value = validateDependencyDeclarations(merged.value, context);\n DeclaredDependencies.validate(value, context);\n for (const diagnostic of productionDestinationDiagnostics(value)) context.information(diagnostic.code, diagnostic.message, diagnostic.location);\n const existing = merged.diagnostics;\n const reported = new Set(existing.map(diagnosticKey));\n const all = [...existing, ...context.diagnostics.filter(diagnostic => !reported.has(diagnosticKey(diagnostic)))];\n return {\n result: { ...merged, value, diagnostics: all, success: !all.some(diagnostic => diagnostic.severity === 'error'), physicalEventSources, sourceInventoryComplete, continuationValues: context.continuationValues },\n syntax: new Map(parsed.map((result, index) => [documents[index].path, result.value])),\n };\n}\n\nfunction diagnosticKey(diagnostic: Diagnostic): string {\n return JSON.stringify([diagnostic.code, diagnostic.location.path, diagnostic.location.line, diagnostic.location.column]);\n}\n\n// Compiles documents held in memory, keyed by portable path, as one application. Without roots every\n// document is a root, in ordinal order of its path - a folder compiled as one application, where a file an\n// import places in a module or feature is placed there. With roots, only those documents and what they import\n// make up the application - a single file compiled with its imports followed. The default sort compares\n// UTF-16 code units, which is the C# ordinal order.\nexport function compileApplication(documents: ReadonlyMap<string, string>, roots?: readonly string[], languages?: ReadonlySet<string>, presentationRoot?: string | null): ApplicationCompilation {\n const normalized = new Map([...documents].map(([path, source]) => [normalizePlayPath(path), source]));\n return assembleApplication(roots ?? [...normalized.keys()].sort(), inMemoryDocumentSource(normalized), languages, presentationRoot);\n}\n\n// Compiles the documents of a folder as one application - the counterpart of the C# CompileFolder. Every\n// document is a root, read in ordinal order of its relative path as the C# compiler reads them, so a merge\n// keeps the same first declaration in either language; one an import places in a module or feature is\n// placed there.\nexport function parseFolder(files: readonly PlayFileSource[], languages?: ReadonlySet<string>): ApplicationCompilation {\n return compileApplication(new Map(files.map(file => [file.path, file.source])), undefined, languages);\n}\n\n"],"mappings":"mqFAwDA,SAAgB,oBAAoB,EAAyB,EAA4B,EAAiC,EAA0D,CAChL,IAAMA,EAAY,CAAC,GAAGC,CAAK,EACrB,CAAE,YAAW,eAAgBC,EAAeF,EAAWG,EAAQC,CAAS,EACxE,CAAE,OAAQC,EAAQ,UAAW,+BAA+BC,EAAWF,CAAS,EAEhFG,EAAU,IAAI,IAAID,EAAU,IAAI,GAAY,CAACE,EAAS,KAAMC,EAAgBD,EAAS,OAAQA,EAAS,KAAMJ,CAAS,CAAC,CAAC,CAAC,EACxHM,EAAeC,IAAqB,KAAO,IAAA,GAAYC,EAAmBD,IAAqB,IAAA,GAAYX,EAAY,CAACW,CAAgB,EAAGL,EAAWF,EAAWG,CAAO,EAC1KG,IAAiB,IAAA,IAAWG,EAAoBR,EAAO,MAAO,CAACK,CAAY,EAAGJ,EAAWF,EAAWU,EAAQP,CAAO,EACvH,IAAMQ,EAAWL,IAAiB,IAAA,GAAY,CAAC,EAAIM,EAAyBX,EAAO,KAAK,EAClFY,EAAM,CAAC,GAAGC,EAAa,GAAGb,EAAO,YAAa,GAAGU,CAAQ,EAC/D,MAAO,CAAE,GAAGV,EAAQ,YAAW,YAAaY,EAAK,QAAS,CAACA,EAAI,KAAK,GAAcE,EAAW,WAAa,OAAO,CAAE,CACvH,CAKA,SAAgB,qBAAqB,EAA0C,EAAiC,EAA4B,GAI1I,CACE,OAAO,+BAA+Bb,EAAWF,EAAWgB,CAAyB,CAAC,CAAC,MAC3F,CAEA,SAAS,+BAA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,EAAW1D,EAAO,YAClB2D,EAAW,IAAI,IAAID,EAAS,IAAI,aAAa,CAAC,EAC9C9C,EAAM,CAAC,GAAG8C,EAAU,GAAG9B,EAAQ,YAAY,OAAO,GAAc,CAAC+B,EAAS,IAAI,cAAc7C,CAAU,CAAC,CAAC,CAAC,EAC/G,MAAO,CACH,OAAQ,CAAE,GAAGd,EAAQ,QAAO,YAAaY,EAAK,QAAS,CAACA,EAAI,KAAK,GAAcE,EAAW,WAAa,OAAO,EAAG,uBAAsB,0BAAyB,mBAAoBc,EAAQ,kBAAmB,EAC/M,OAAQ,IAAI,IAAIF,EAAO,KAAK,EAAQ,IAAU,CAACzB,EAAUsB,EAAM,CAAC,KAAMD,EAAO,KAAK,CAAC,CAAC,CACxF,CACJ,CAEA,SAAS,cAAc,EAAgC,CACnD,OAAO,KAAK,UAAU,CAACR,EAAW,KAAMA,EAAW,SAAS,KAAMA,EAAW,SAAS,KAAMA,EAAW,SAAS,MAAM,CAAC,CAC3H,CAOA,SAAgB,mBAAmB,EAAwC,EAA2B,EAAiC,EAA0D,CAC7L,IAAM8C,EAAa,IAAI,IAAI,CAAC,GAAG3D,CAAS,CAAC,CAAC,KAAK,CAAC4D,EAAM/D,KAAY,CAACgE,EAAkBD,CAAI,EAAG/D,CAAM,CAAC,CAAC,EACpG,OAAO,oBAAoBF,GAAS,CAAC,GAAGgE,EAAW,KAAK,CAAC,CAAC,CAAC,KAAK,EAAGG,EAAuBH,CAAU,EAAG7D,EAAWO,CAAgB,CACtI"}
1
+ {"version":3,"file":"PlayApplicationAssembly.js","names":["rootPaths","roots","resolveImports","source","languages","merged","documents","imports","document","discoverImports","orderingRoot","presentationRoot","selectOrderingRoot","recordAuthoredOrder","syntax","timeline","timelineOrderDiagnostics","all","diagnostics","diagnostic","deferImportedExampleTypes","candidates","CommandStreamCandidates","splitLines","physical","parseForAuthoring","physicalEventSources","result","index","sourceInventoryComplete","EventSourceReadConfidence","parsed","mergeDocuments","context","ParserContext","LineReader","effectiveStructuralInteractions","site","ancestor","validateSpecificationCases","validateSpecificationExampleTypes","effective","expandSpecificationExamples","validateEventSources","validateOperations","validatePublicEventUsage","validateInlineEvents","validateConstraintProperties","validateResponses","validateProjectionTargets","validateIdentifierCompliance","validateEventSubjects","validateReadModelKeys","validateReadModelMemberTypes","validateReactionRefusals","validateSpecificationRedelivery","validateGuardedActions","validatePersonaCallers","validatePurposes","value","validateDependencyDeclarations","DeclaredDependencies","productionDestinationDiagnostics","existing","reported","normalized","path","normalizePlayPath","inMemoryDocumentSource"],"sources":["../../../../../../Compiler/Files/PlayApplicationAssembly.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Diagnostic } from '../Diagnostics/Diagnostic';\nimport { validateSpecificationCases } from '../Parsing/SpecificationCaseValidator';\nimport { expandSpecificationExamples, validateSpecificationExampleTypes } from '../Parsing/SpecificationCommandExamples';\nimport { productionDestinationDiagnostics } from '../Diagnostics/ProductionDestinationDiagnostics';\nimport { validateConstraintProperties } from '../Parsing/ConstraintPropertyValidator';\nimport { validateDependencyDeclarations } from '../Dependencies/DeclaredDependencyTargets';\nimport { DeclaredDependencies } from '../Dependencies/DeclaredDependencies';\nimport { validateInlineEvents } from '../Parsing/InlineEventValidator';\nimport { LineReader } from '../Parsing/LineReader';\nimport { CommandStreamCandidates } from '../Parsing/CommandStreamCandidates';\nimport { validateEventSources } from '../Parsing/EventSourceValidator';\nimport { validateProjectionTargets } from '../Parsing/ProjectionTargetValidator';\nimport { validateIdentifierCompliance } from '../Parsing/IdentifierComplianceValidator';\nimport { validateEventSubjects } from '../Parsing/EventSubjectValidator';\nimport { validateReadModelKeys } from '../Parsing/ReadModelKeyValidator';\nimport { validateReadModelMemberTypes } from '../Parsing/ReadModelMemberTypeValidator';\nimport { validateReactionRefusals } from '../Parsing/ReactionRefusalValidator';\nimport { validateSpecificationRedelivery } from '../Parsing/SpecificationRedeliveryValidator';\nimport { effectiveStructuralInteractions } from '../Parsing/StructuralInteractionSites';\nimport { validateGuardedActions } from '../Parsing/GuardedActionValidator';\nimport { validatePersonaCallers } from '../Parsing/PersonaCallerValidator';\nimport { validatePurposes } from '../Parsing/PurposeValidator';\nimport { splitLines } from '../Parsing/SourceLineSplitter';\nimport { ParserContext } from '../Parsing/ParserContext';\nimport { validateResponses } from '../Parsing/ResponseValidator';\nimport { validatePublicEventUsage } from '../Parsing/PublicEventUsageValidator';\nimport { validateOperations } from '../Parsing/OperationValidator';\nimport { CompilationResult, discoverImports, parseForAuthoring } from '../ScreenplayCompiler';\nimport { ApplicationSyntax } from '../Syntax/Structure';\nimport { EventSourceSyntax } from '../Syntax/EventSources';\nimport { EventSourceReadConfidence } from '../Syntax/EventSourceReadConfidence';\nimport { mergeDocuments } from './PlayFolderMerge';\nimport { inMemoryDocumentSource, PlacedPlayDocument, PlayDocumentSource } from './PlayDocumentSource';\nimport { normalizePlayPath } from './PlayGlob';\nimport { resolveImports } from './PlayImports';\nimport { recordAuthoredOrder } from './AuthoredOrder';\nimport { selectOrderingRoot } from './OrderingRoot';\nimport { timelineOrderDiagnostics } from './TimelineOrder';\n\n// One .play document of a folder: its path relative to the folder, and its text.\nexport interface PlayFileSource {\n readonly path: string;\n readonly source: string;\n}\n\n// One application compiled from documents: the documents that make it up, each with where its top level\n// belongs, and the merged syntax with every diagnostic - resolving, parsing and merging.\nexport interface ApplicationCompilation extends CompilationResult<ApplicationSyntax> {\n readonly documents: readonly PlacedPlayDocument[];\n}\n\n// Assembles one application from documents - following their imports from the roots, parsing each where it is\n// placed, and merging the lot. The port of the C# PlayApplicationAssembly.Compile.\nexport function assembleApplication(roots: Iterable<string>, source: PlayDocumentSource, languages?: ReadonlySet<string>, presentationRoot?: string | null): ApplicationCompilation {\n const rootPaths = [...roots];\n const { documents, diagnostics } = resolveImports(rootPaths, source, languages);\n const { result: merged, syntax } = parsePlacedDocumentsWithSyntax(documents, languages);\n // Resolution owns its import inventory; share one discovery between the presentation passes.\n const imports = new Map(documents.map(document => [document.path, discoverImports(document.source, document.path, languages)]));\n const orderingRoot = presentationRoot === null ? undefined : selectOrderingRoot(presentationRoot === undefined ? rootPaths : [presentationRoot], documents, languages, imports);\n if (orderingRoot !== undefined) recordAuthoredOrder(merged.value, [orderingRoot], documents, languages, syntax, imports);\n const timeline = orderingRoot === undefined ? [] : timelineOrderDiagnostics(merged.value);\n const all = [...diagnostics, ...merged.diagnostics, ...timeline];\n return { ...merged, documents, diagnostics: all, success: !all.some(diagnostic => diagnostic.severity === 'error') };\n}\n\n// Parses documents whose source identities and placements are already known (for example unsaved\n// editor buffers), then validates contracts against the merged declaration inventory. Editor callers may\n// defer example types whose imports are not in that inventory; resolved types are still checked.\nexport function parsePlacedDocuments(documents: readonly PlacedPlayDocument[], languages?: ReadonlySet<string>, deferImportedExampleTypes = false): CompilationResult<ApplicationSyntax> & {\n readonly physicalEventSources: readonly { source: EventSourceSyntax; placementResolved: boolean }[];\n readonly sourceInventoryComplete: boolean;\n readonly continuationValues: ReturnType<typeof parseForAuthoring>['continuationValues'];\n} {\n return parsePlacedDocumentsWithSyntax(documents, languages, deferImportedExampleTypes).result;\n}\n\nfunction parsePlacedDocumentsWithSyntax(documents: readonly PlacedPlayDocument[], languages?: ReadonlySet<string>, deferImportedExampleTypes = false) {\n const candidates = CommandStreamCandidates.capturePlaced(documents.filter(document => document.isPlacementResolved !== false).map(document => ({ lines: splitLines(document.source, false, document.path), placement: document.placement })), languages);\n const physical = documents.map(document => parseForAuthoring(document.source, document.path, document.isPlacementResolved === false ? [] : document.placement, false, candidates, languages));\n const physicalEventSources = physical.flatMap((result, index) => (result.value.eventSources ?? []).map(source => ({ source, placementResolved: documents[index].isPlacementResolved !== false })));\n const sourceInventoryComplete = documents.every(document => document.isPlacementResolved !== false) && physical.every(result => !EventSourceReadConfidence.hasUnknownExtent(result.diagnostics));\n const parsed = physical.map((result, index) => documents[index].isPlacementResolved === false ? { ...result, value: { ...result.value, eventSources: [] } } : result);\n const merged = mergeDocuments(parsed);\n const context = new ParserContext(new LineReader([]), undefined, languages);\n if (merged.value.sourceOptions !== undefined) context.sourceOptions = merged.value.sourceOptions;\n context.guardedInteractions.push(...parsed.flatMap(document => document.guardedInteractions));\n context.interactionBehaviors.push(...parsed.flatMap(document => document.interactionBehaviors));\n context.interactionUses.push(...effectiveStructuralInteractions(merged.value).filter(site => 'behavior' in site),\n ...parsed.flatMap(document => document.interactionUses).filter(site => site.ancestors.some(ancestor => ancestor.keyword === 'screen')));\n context.continuationValues.push(...parsed.flatMap(document => document.continuationValues));\n validateSpecificationCases(merged.value, context);\n validateSpecificationExampleTypes(merged.value, context, deferImportedExampleTypes);\n const effective = expandSpecificationExamples(merged.value);\n validateEventSources(merged.value, context);\n validateOperations(merged.value, context);\n validatePublicEventUsage(merged.value, context);\n validateInlineEvents(merged.value, context);\n validateConstraintProperties(merged.value, context);\n validateResponses(effective, context, parsed.flatMap(document => document.inputUses));\n validateProjectionTargets(merged.value, context);\n validateIdentifierCompliance(effective, context);\n validateEventSubjects(merged.value, context);\n validateReadModelKeys(merged.value, context);\n validateReadModelMemberTypes(merged.value, context);\n validateReactionRefusals(merged.value, context);\n validateSpecificationRedelivery(merged.value, context);\n validateGuardedActions(merged.value, context);\n validatePersonaCallers(merged.value, context);\n validatePurposes(merged.value, context);\n const value = validateDependencyDeclarations(merged.value, context);\n DeclaredDependencies.validate(value, context);\n for (const diagnostic of productionDestinationDiagnostics(value)) context.information(diagnostic.code, diagnostic.message, diagnostic.location);\n const existing = merged.diagnostics;\n const reported = new Set(existing.map(diagnosticKey));\n const all = [...existing, ...context.diagnostics.filter(diagnostic => !reported.has(diagnosticKey(diagnostic)))];\n return {\n result: { ...merged, value, diagnostics: all, success: !all.some(diagnostic => diagnostic.severity === 'error'), physicalEventSources, sourceInventoryComplete, continuationValues: context.continuationValues },\n syntax: new Map(parsed.map((result, index) => [documents[index].path, result.value])),\n };\n}\n\nfunction diagnosticKey(diagnostic: Diagnostic): string {\n return JSON.stringify([diagnostic.code, diagnostic.location.path, diagnostic.location.line, diagnostic.location.column]);\n}\n\n// Compiles documents held in memory, keyed by portable path, as one application. Without roots every\n// document is a root, in ordinal order of its path - a folder compiled as one application, where a file an\n// import places in a module or feature is placed there. With roots, only those documents and what they import\n// make up the application - a single file compiled with its imports followed. The default sort compares\n// UTF-16 code units, which is the C# ordinal order.\nexport function compileApplication(documents: ReadonlyMap<string, string>, roots?: readonly string[], languages?: ReadonlySet<string>, presentationRoot?: string | null): ApplicationCompilation {\n const normalized = new Map([...documents].map(([path, source]) => [normalizePlayPath(path), source]));\n return assembleApplication(roots ?? [...normalized.keys()].sort(), inMemoryDocumentSource(normalized), languages, presentationRoot);\n}\n\n// Compiles the documents of a folder as one application - the counterpart of the C# CompileFolder. Every\n// document is a root, read in ordinal order of its relative path as the C# compiler reads them, so a merge\n// keeps the same first declaration in either language; one an import places in a module or feature is\n// placed there.\nexport function parseFolder(files: readonly PlayFileSource[], languages?: ReadonlySet<string>): ApplicationCompilation {\n return compileApplication(new Map(files.map(file => [file.path, file.source])), undefined, languages);\n}\n\n"],"mappings":"A,mqFAwDA,SAAgB,oBAAoB,EAAyB,EAA4B,EAAiC,EAA0D,CAChL,IAAMA,EAAY,CAAC,GAAGC,CAAK,EACrB,CAAE,YAAW,eAAgBC,EAAeF,EAAWG,EAAQC,CAAS,EACxE,CAAE,OAAQC,EAAQ,UAAW,+BAA+BC,EAAWF,CAAS,EAEhFG,EAAU,IAAI,IAAID,EAAU,IAAI,GAAY,CAACE,EAAS,KAAMC,EAAgBD,EAAS,OAAQA,EAAS,KAAMJ,CAAS,CAAC,CAAC,CAAC,EACxHM,EAAeC,IAAqB,KAAO,IAAA,GAAYC,EAAmBD,IAAqB,IAAA,GAAYX,EAAY,CAACW,CAAgB,EAAGL,EAAWF,EAAWG,CAAO,EAC1KG,IAAiB,IAAA,IAAWG,EAAoBR,EAAO,MAAO,CAACK,CAAY,EAAGJ,EAAWF,EAAWU,EAAQP,CA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AAGgE,EAAW,KAAK,CAAC,CAAC,CAAC,KAAK,EAAGG,EAAuBH,CAAU,EAAG7D,EAAWO,CAAgB,CACtI,C"}
@@ -1 +1 @@
1
- {"version":3,"file":"PlayDocumentSource.js","names":["documents","folder","path","source"],"sources":["../../../../../../Compiler/Files/PlayDocumentSource.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { PlayPlacement } from './PlayPlacement';\n\n// Where the documents an import names come from - a folder on disk, or the documents of a workspace. Every\n// path is portable: '/' separated and relative to one root. A path may begin with '..' when an import climbs\n// above that root. The port of the C# IPlayDocumentSource.\nexport interface PlayDocumentSource {\n // Every .play file beneath a portable folder path, at any depth - the empty folder is the root.\n filesBeneath(folder: string): Iterable<string>;\n\n // The source text of a document.\n read(path: string): string;\n}\n\n// A document of an application together with where its top level belongs.\nexport interface PlacedPlayDocument {\n readonly path: string;\n readonly source: string;\n readonly placement: PlayPlacement;\n // False for conflicting/cyclic placement and every descendant of such an importer.\n readonly isPlacementResolved?: boolean;\n}\n\n// A document source over documents held in memory, keyed by portable path.\nexport function inMemoryDocumentSource(documents: ReadonlyMap<string, string>): PlayDocumentSource {\n return {\n filesBeneath: folder => [...documents.keys()].filter(path => folder.length === 0 || path.startsWith(`${folder}/`)),\n read: path => {\n const source = documents.get(path);\n if (source === undefined) {\n throw new Error(`There is no document '${path}'`);\n }\n return source;\n },\n };\n}\n"],"mappings":"qDA0BA,SAAgB,uBAAuB,EAA4D,CAC/F,MAAO,CACH,aAAc,GAAU,CAAC,GAAGA,EAAU,KAAK,CAAC,CAAC,CAAC,OAAO,GAAQC,EAAO,SAAW,GAAKC,EAAK,WAAW,GAAGD,EAAO,EAAE,CAAC,EACjH,KAAM,GAAQ,CACV,IAAME,EAASH,EAAU,IAAIE,CAAI,EACjC,GAAIC,IAAW,IAAA,GACX,MAAU,MAAM,yBAAyBD,EAAK,EAAE,EAEpD,OAAOC,CACX,CACJ,CACJ"}
1
+ {"version":3,"file":"PlayDocumentSource.js","names":["documents","folder","path","source"],"sources":["../../../../../../Compiler/Files/PlayDocumentSource.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { PlayPlacement } from './PlayPlacement';\n\n// Where the documents an import names come from - a folder on disk, or the documents of a workspace. Every\n// path is portable: '/' separated and relative to one root. A path may begin with '..' when an import climbs\n// above that root. The port of the C# IPlayDocumentSource.\nexport interface PlayDocumentSource {\n // Every .play file beneath a portable folder path, at any depth - the empty folder is the root.\n filesBeneath(folder: string): Iterable<string>;\n\n // The source text of a document.\n read(path: string): string;\n}\n\n// A document of an application together with where its top level belongs.\nexport interface PlacedPlayDocument {\n readonly path: string;\n readonly source: string;\n readonly placement: PlayPlacement;\n // False for conflicting/cyclic placement and every descendant of such an importer.\n readonly isPlacementResolved?: boolean;\n}\n\n// A document source over documents held in memory, keyed by portable path.\nexport function inMemoryDocumentSource(documents: ReadonlyMap<string, string>): PlayDocumentSource {\n return {\n filesBeneath: folder => [...documents.keys()].filter(path => folder.length === 0 || path.startsWith(`${folder}/`)),\n read: path => {\n const source = documents.get(path);\n if (source === undefined) {\n throw new Error(`There is no document '${path}'`);\n }\n return source;\n },\n };\n}\n"],"mappings":"A,qDA0BA,SAAgB,uBAAuB,EAA4D,CAC/F,MAAO,CACH,aAAc,GAAU,CAAC,GAAGA,EAAU,KAAK,CAAC,CAAC,CAAC,OAAO,GAAQC,EAAO,SAAW,GAAKC,EAAK,WAAW,GAAGD,EAAO,EAAE,CAAC,EACjH,KAAM,GAAQ,CACV,IAAME,EAASH,EAAU,IAAIE,CAAI,EACjC,GAAIC,IAAW,IAAA,GACX,MAAU,MAAM,yBAAyBD,EAAK,EAAE,EAEpD,OAAOC,CACX,CACJ,CACJ,C"}
@@ -1,2 +1,2 @@
1
- import"../../_virtual/_virtual/_rolldown/runtime.js";import{DiagnosticCodes as e}from"../Diagnostics/DiagnosticCodes.js";import{combineAuthorize as t}from"../Parsing/AuthorizeParser.js";import{validateIdentity as n}from"../Parsing/IdentityValidator.js";import{validateApplicationHandlers as r}from"../Parsing/CommandHandlerValidator.js";import{mergeStructuralInteractions as i}from"../Parsing/StructuralInteractionSites.js";import{LineReader as a}from"../Parsing/LineReader.js";import{InvalidSyntaxJson as o}from"../Syntax/InvalidSyntaxJson.js";import{invalidSourceOptions as s,isAuthoredDocument as c,legacySourceOptions as l,validatedSourceOptions as u}from"../Syntax/SourceOptions.js";import{ParserContext as d}from"../Parsing/ParserContext.js";import{toSyntaxJson as f}from"../Syntax/SyntaxJson.js";function mergeDocuments(t){let c=[],f=t.map(e=>e.value),p=/* @__PURE__ */ new Map,m=!1;for(let t of f)try{p.set(t,Object.hasOwn(t,`sourceOptions`)?u(t.sourceOptions):l)}catch(n){if(!(n instanceof o))throw n;m=!0,c.push(error(e.IncompatibleNumericSource,n.message,t.location))}let h=f.filter(e=>p.get(e)?.numericMode===`exact`||hasDeclarations(e)),g=p.get(h[0])??l;for(let t of h.slice(1))p.get(t)?.numericMode!==g.numericMode&&(m=!0,c.push(error(e.MixedNumericModes,`Declaration-bearing documents and marked import barrels must independently select the same numeric mode.`,t.location)));m&&(g=s);let _=/* @__PURE__ */ new Map,v=declaredInOneFile(f.flatMap(e=>e.concepts),`declaration of`,c,void 0,_),y=declaredInOneFile(f.flatMap(e=>e.types),`declaration of`,c,void 0,_),b=f.flatMap(e=>e.identity==null?[]:[e.identity]);for(let t of b.slice(1))c.push(error(e.RepeatedSingularDeclarationAcrossFiles,`The folder already declares an identity block in '${describe(b[0].location.path)}' - a folder compiles to one application, which can have at most one`,t.location));let x=f.flatMap(e=>e.context==null?[]:[e.context]);for(let t of x.slice(1))c.push(error(e.RepeatedSingularDeclarationAcrossFiles,`The folder already declares a context block in '${describe(x[0].location.path)}' - a folder compiles to one application, which can have at most one`,t.location));let S=f.filter(e=>e.commandReadMode!=null);for(let t of S.slice(1))c.push(error(e.InvalidCommandReadsDeclaration,`Declare 'command reads protected' once at the application root.`,t.location));let C=f.filter(e=>e.timeZone!=null);for(let t of C.slice(1))c.push(error(e.InvalidTimeZoneDeclaration,`Declare 'time zone' once at the application root.`,t.location));let w=f.filter(e=>e.reactionProductionMode!=null);for(let t of w.slice(1))c.push(error(e.InvalidReactionBatchesDeclaration,`Declare 'reaction batches atomic' once at the application root.`,t.location));let T=f.map(e=>e.domain).filter(e=>e!==null);for(let t of T.slice(1))c.push(error(e.RepeatedSingularDeclarationAcrossFiles,`The folder already declares a domain in '${describe(T[0].location.path)}' - a folder compiles to one application, which can have at most one`,t.location));let E=mergeModules(f.flatMap(e=>e.modules),c),D=declaredInOneFile(f.flatMap(e=>e.personas),`persona`,c),O=f.flatMap(e=>e.policies??[]),k=declaredInOneFile(O,`policy`,c),A=O.filter(e=>!k.includes(e)).map(e=>e.location),j={kind:`ApplicationSyntax`,sourceOptions:g,...w.length===0?{}:{reactionProductionMode:w[0].reactionProductionMode},...S.length===0?{}:{commandReadMode:S[0].commandReadMode},...C.length===0?{}:{timeZone:C[0].timeZone},...b.length===0?{}:{identity:b[0]},...x.length===0?{}:{context:x[0]},domain:T[0]??null,imports:firstOfEach(f.flatMap(e=>e.imports),e=>e.qualifiedName),concepts:v,types:y,examples:f.flatMap(e=>e.examples??[]),systems:f.flatMap(e=>e.systems??[]),...f.some(e=>(e.stateMachines?.length??0)>0)?{stateMachines:f.flatMap(e=>e.stateMachines??[])}:{},...f.some(e=>(e.workflows?.length??0)>0)?{workflows:f.flatMap(e=>e.workflows??[])}:{},purposes:declaredInOneFile(f.flatMap(e=>e.purposes??[]),`purpose`,c),eventSources:f.flatMap(e=>e.eventSources??[]),declaredTriggers:f.flatMap(e=>e.declaredTriggers??[]),modules:E,personas:D,policies:k,seeds:f.flatMap(e=>e.seeds??[]),fileImports:f.flatMap(e=>e.fileImports),...presentOnly(`stickyNotes`,f.flatMap(e=>e.stickyNotes??[])),...presentOnly(`exposures`,f.flatMap(e=>e.exposures??[])),...presentOnly(`instanceContributions`,f.flatMap(e=>e.instanceContributions??[])),location:f[0]?.location??{line:1,column:1}};i(j,f);let M=new d(new a([]));r(j,M),n(j,M),c.push(...M.diagnostics);let N=[...t.flatMap(e=>e.diagnostics).filter(t=>t.code!==e.DuplicateDeclaration||!A.some(e=>sameLocation(e,t.location))),...c];return{value:j,diagnostics:N,success:!N.some(e=>e.severity===`error`)}}function hasDeclarations(e){if(c(e)||e.context!=null||e.identity!=null||e.domain!==null||e.concepts.length>0||e.types.length>0||e.personas.length>0||(e.policies?.length??0)>0||(e.purposes?.length??0)>0||(e.seeds?.length??0)>0||(e.systems?.length??0)>0||(e.stateMachines?.length??0)>0||(e.workflows?.length??0)>0||(e.eventSources?.length??0)>0||(e.examples?.length??0)>0||(e.stickyNotes?.length??0)>0)return!0;let feature=e=>!e.isPlacement||(e.examples?.length??0)>0||e.slices.length>0||e.features.some(feature);return e.modules.some(e=>!e.isPlacement||(e.examples?.length??0)>0||e.features.some(feature))}function mergeModules(e,t){return groupByName(e).map(placedLast).map(e=>{if(e.length===1)return i({...e[0],isPlacement:!1,features:e[0].features.map(unplaced)},e);let n=i({...e[0],isPlacement:!1,fileImports:e.flatMap(e=>e.fileImports),examples:e.flatMap(e=>e.examples??[]),purposes:firstOfEach(e.flatMap(e=>e.purposes??[]),e=>e.name),description:firstDescription(e,`module '${e[0].name}'`,t),documentation:firstDocumentation(e,`module '${e[0].name}'`,t),authorize:combineAuthorization(e.map(e=>e.authorize),`module '${e[0].name}'`,t),dependsOn:groupDependencies(e)},e,t);return i({...n,features:mergeFeatures(e.flatMap(e=>e.features),t)},[n])})}function mergeFeatures(e,t){return groupByName(e).map(placedLast).map(e=>{if(e.length===1)return unplaced(e[0]);let n=i({...e[0],isPlacement:!1,fileImports:e.flatMap(e=>e.fileImports),examples:e.flatMap(e=>e.examples??[]),purposes:firstOfEach(e.flatMap(e=>e.purposes??[]),e=>e.name),description:firstDescription(e,`feature '${e[0].name}'`,t),documentation:firstDocumentation(e,`feature '${e[0].name}'`,t),authorize:combineAuthorization(e.map(e=>e.authorize),`feature '${e[0].name}'`,t),dependsOn:groupDependencies(e)},e,t);return i({...n,features:mergeFeatures(e.flatMap(e=>e.features),t),slices:declaredInOneFile(e.flatMap(e=>e.slices),`slice`,t,`feature '${e[0].name}'`)},[n])})}function groupDependencies(e){return[...e].sort((e,t)=>(e.location.path??``)<(t.location.path??``)?-1:+((e.location.path??``)>(t.location.path??``))).flatMap(e=>e.dependsOn??[])}function placedLast(e){return[...e.filter(e=>!e.isPlacement),...e.filter(e=>e.isPlacement)]}function unplaced(e){return i({...e,isPlacement:!1,features:e.features.map(unplaced)},[e])}function combineAuthorization(n,r,i){let a=[];for(let t of n.filter(e=>e!==null)){let n=a.find(e=>e.location.path!==t.location.path&&JSON.stringify(f(e))===JSON.stringify(f(t)));n===void 0?a.push(t):i.push(warning(e.DuplicateAuthorizationAcrossFiles,`An identical authorization is already declared on the ${r} in '${describe(n.location.path)}' - this repeated gate is ignored`,t.location))}return a.reduce((e,n)=>t(e,n),null)}function firstOfEach(e,t){let n=/* @__PURE__ */ new Set;return e.filter(e=>!n.has(t(e))&&n.add(t(e))!==void 0)}function groupByName(e){let t=/* @__PURE__ */ new Map;for(let n of e)t.set(n.name,[...t.get(n.name)??[],n]);return[...t.values()]}function firstDocumentation(t,n,r){let i=t.filter(e=>e.documentation!=null);for(let t of i.slice(1).filter(e=>e.documentation!==i[0].documentation))r.push(warning(e.ConflictingDocumentationAcrossFiles,`The ${n} is already documented in '${describe(i[0].location.path)}' - keeping that documentation`,t.location));return i[0]?.documentation??null}function firstDescription(t,n,r){let i=t.filter(e=>e.description!==null);for(let t of i.slice(1).filter(e=>e.description!==i[0].description))r.push(warning(e.ConflictingDescriptionAcrossFiles,`The ${n} is already described in '${describe(i[0].location.path)}' - keeping that description`,t.location));return i[0]?.description??null}function declaredInOneFile(t,n,r,i,a=/* @__PURE__ */ new Map){let o=[];for(let s of t){let t=a.get(s.name);t!==void 0&&t.path!==s.location.path?r.push(error(e.RepeatedDeclarationAcrossFiles,`Duplicate ${n} '${s.name}'${i===void 0?``:` in ${i}`} - already declared in '${describe(t.path)}'`,s.location)):(t===void 0&&a.set(s.name,s.location),o.push(s))}return o}const describe=e=>e??`another file`,sameLocation=(e,t)=>e.path===t.path&&e.line===t.line&&e.column===t.column,error=(e,t,n)=>({severity:`error`,code:e,message:t,location:n}),warning=(e,t,n)=>({severity:`warning`,code:e,message:t,location:n});function presentOnly(e,t){return t.length===0?{}:{[e]:t}}export{mergeDocuments};
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";import{mergeStructuralInteractions as e}from"../Parsing/StructuralInteractionSites.js";import{validateIdentity as t}from"../Parsing/IdentityValidator.js";import{validateApplicationHandlers as n}from"../Parsing/CommandHandlerValidator.js";import{ParserContext as r}from"../Parsing/ParserContext.js";import{LineReader as i}from"../Parsing/LineReader.js";import{DiagnosticCodes as a}from"../Diagnostics/DiagnosticCodes.js";import{authorizationWasRefused as o,combineAuthorize as s}from"../Parsing/AuthorizeParser.js";import{invalidSourceOptions as c,isAuthoredDocument as l,legacySourceOptions as u,validatedSourceOptions as d}from"../Syntax/SourceOptions.js";import{InvalidSyntaxJson as f}from"../Syntax/InvalidSyntaxJson.js";function mergeDocuments(o){let s=[],l=o.map(e=>e.value),p=/* @__PURE__ */ new Map,m=!1;for(let e of l)try{p.set(e,Object.hasOwn(e,`sourceOptions`)?d(e.sourceOptions):u)}catch(t){if(!(t instanceof f))throw t;m=!0,s.push(error(a.IncompatibleNumericSource,t.message,e.location))}let h=l.filter(e=>p.get(e)?.numericMode===`exact`||hasDeclarations(e)),g=p.get(h[0])??u;for(let e of h.slice(1))p.get(e)?.numericMode!==g.numericMode&&(m=!0,s.push(error(a.MixedNumericModes,`Declaration-bearing documents and marked import barrels must independently select the same numeric mode.`,e.location)));m&&(g=c);let _=/* @__PURE__ */ new Map,v=declaredInOneFile(l.flatMap(e=>e.concepts),`declaration of`,s,void 0,_),y=declaredInOneFile(l.flatMap(e=>e.types),`declaration of`,s,void 0,_),b=l.flatMap(e=>e.identity==null?[]:[e.identity]);for(let e of b.slice(1))s.push(error(a.RepeatedSingularDeclarationAcrossFiles,`The folder already declares an identity block in '${describe(b[0].location.path)}' - a folder compiles to one application, which can have at most one`,e.location));let x=l.flatMap(e=>e.context==null?[]:[e.context]);for(let e of x.slice(1))s.push(error(a.RepeatedSingularDeclarationAcrossFiles,`The folder already declares a context block in '${describe(x[0].location.path)}' - a folder compiles to one application, which can have at most one`,e.location));let S=l.filter(e=>e.commandReadMode!=null);for(let e of S.slice(1))s.push(error(a.InvalidCommandReadsDeclaration,`Declare 'command reads protected' once at the application root.`,e.location));let C=l.filter(e=>e.timeZone!=null);for(let e of C.slice(1))s.push(error(a.InvalidTimeZoneDeclaration,`Declare 'time zone' once at the application root.`,e.location));let w=l.filter(e=>e.reactionProductionMode!=null);for(let e of w.slice(1))s.push(error(a.InvalidReactionBatchesDeclaration,`Declare 'reaction batches atomic' once at the application root.`,e.location));let T=l.map(e=>e.domain).filter(e=>e!==null);for(let e of T.slice(1))s.push(error(a.RepeatedSingularDeclarationAcrossFiles,`The folder already declares a domain in '${describe(T[0].location.path)}' - a folder compiles to one application, which can have at most one`,e.location));let E=mergeModules(l.flatMap(e=>e.modules),s),D=declaredInOneFile(l.flatMap(e=>e.personas),`persona`,s),O=l.flatMap(e=>e.policies??[]),k=declaredInOneFile(O,`policy`,s),A=O.filter(e=>!k.includes(e)).map(e=>e.location),j={kind:`ApplicationSyntax`,sourceOptions:g,...w.length===0?{}:{reactionProductionMode:w[0].reactionProductionMode},...S.length===0?{}:{commandReadMode:S[0].commandReadMode},...C.length===0?{}:{timeZone:C[0].timeZone},...b.length===0?{}:{identity:b[0]},...x.length===0?{}:{context:x[0]},domain:T[0]??null,imports:firstOfEach(l.flatMap(e=>e.imports),e=>e.qualifiedName),concepts:v,types:y,examples:l.flatMap(e=>e.examples??[]),systems:l.flatMap(e=>e.systems??[]),...l.some(e=>(e.stateMachines?.length??0)>0)?{stateMachines:l.flatMap(e=>e.stateMachines??[])}:{},...l.some(e=>(e.workflows?.length??0)>0)?{workflows:l.flatMap(e=>e.workflows??[])}:{},purposes:declaredInOneFile(l.flatMap(e=>e.purposes??[]),`purpose`,s),eventSources:l.flatMap(e=>e.eventSources??[]),declaredTriggers:l.flatMap(e=>e.declaredTriggers??[]),modules:E,personas:D,policies:k,seeds:l.flatMap(e=>e.seeds??[]),fileImports:l.flatMap(e=>e.fileImports),...presentOnly(`stickyNotes`,l.flatMap(e=>e.stickyNotes??[])),...presentOnly(`exposures`,l.flatMap(e=>e.exposures??[])),...presentOnly(`instanceContributions`,l.flatMap(e=>e.instanceContributions??[])),location:l[0]?.location??{line:1,column:1}};e(j,l);let M=new r(new i([]));n(j,M),t(j,M),s.push(...M.diagnostics);let N=[...o.flatMap(e=>e.diagnostics).filter(e=>e.code!==a.DuplicateDeclaration||!A.some(t=>sameLocation(t,e.location))),...s];return{value:j,diagnostics:N,success:!N.some(e=>e.severity===`error`)}}function hasDeclarations(e){if(l(e)||e.context!=null||e.identity!=null||e.domain!==null||e.concepts.length>0||e.types.length>0||e.personas.length>0||(e.policies?.length??0)>0||(e.purposes?.length??0)>0||(e.seeds?.length??0)>0||(e.systems?.length??0)>0||(e.stateMachines?.length??0)>0||(e.workflows?.length??0)>0||(e.eventSources?.length??0)>0||(e.examples?.length??0)>0||(e.stickyNotes?.length??0)>0)return!0;let feature=e=>!e.isPlacement||(e.examples?.length??0)>0||e.slices.length>0||e.features.some(feature);return e.modules.some(e=>!e.isPlacement||(e.examples?.length??0)>0||e.features.some(feature))}function mergeModules(t,n){return groupByName(t).map(placedLast).map(t=>{if(t.length===1)return e({...t[0],isPlacement:!1,features:t[0].features.map(unplaced)},t);let r=e({...t[0],isPlacement:!1,fileImports:t.flatMap(e=>e.fileImports),examples:t.flatMap(e=>e.examples??[]),purposes:firstOfEach(t.flatMap(e=>e.purposes??[]),e=>e.name),description:firstDescription(t,`module '${t[0].name}'`,n),documentation:firstDocumentation(t,`module '${t[0].name}'`,n),authorize:t.some(e=>o(e.fileImports))?null:combineAuthorization(t.map(e=>e.authorize),`module '${t[0].name}'`,n),dependsOn:groupDependencies(t)},t,n);return e({...r,features:mergeFeatures(t.flatMap(e=>e.features),n)},[r])})}function mergeFeatures(t,n){return groupByName(t).map(placedLast).map(t=>{if(t.length===1)return unplaced(t[0]);let r=e({...t[0],isPlacement:!1,fileImports:t.flatMap(e=>e.fileImports),examples:t.flatMap(e=>e.examples??[]),purposes:firstOfEach(t.flatMap(e=>e.purposes??[]),e=>e.name),description:firstDescription(t,`feature '${t[0].name}'`,n),documentation:firstDocumentation(t,`feature '${t[0].name}'`,n),authorize:t.some(e=>o(e.fileImports))?null:combineAuthorization(t.map(e=>e.authorize),`feature '${t[0].name}'`,n),dependsOn:groupDependencies(t)},t,n);return e({...r,features:mergeFeatures(t.flatMap(e=>e.features),n),slices:declaredInOneFile(t.flatMap(e=>e.slices),`slice`,n,`feature '${t[0].name}'`)},[r])})}function groupDependencies(e){return[...e].sort((e,t)=>(e.location.path??``)<(t.location.path??``)?-1:+((e.location.path??``)>(t.location.path??``))).flatMap(e=>e.dependsOn??[])}function placedLast(e){return[...e.filter(e=>!e.isPlacement),...e.filter(e=>e.isPlacement)]}function unplaced(t){return e({...t,isPlacement:!1,features:t.features.map(unplaced)},[t])}function combineAuthorization(e,t,n){let o=[];for(let r of e.filter(e=>e!==null)){let e=o.find(e=>e.location.path!==r.location.path&&sameRequirement(e.requirement,r.requirement));e===void 0?o.push(r):n.push(warning(a.DuplicateAuthorizationAcrossFiles,`An identical authorization is already declared on the ${t} in '${describe(e.location.path)}' - this repeated gate is ignored`,r.location))}let c=new r(new i([])),l=null;for(let e of o)if(l=s(l,e,c),l===null)break;return n.push(...c.diagnostics),l}function sameRequirement(e,t){let n=[{first:e,second:t}];for(;n.length>0;){let e=n.pop();if(e.first.kind===`PolicyReferenceSyntax`&&e.second.kind===`PolicyReferenceSyntax`){if(e.first.name!==e.second.name)return!1}else if(e.first.kind===`LogicalPolicyRequirementSyntax`&&e.second.kind===`LogicalPolicyRequirementSyntax`){if(e.first.operator!==e.second.operator)return!1;n.push({first:e.first.left,second:e.second.left},{first:e.first.right,second:e.second.right})}else return!1}return!0}function firstOfEach(e,t){let n=/* @__PURE__ */ new Set;return e.filter(e=>!n.has(t(e))&&n.add(t(e))!==void 0)}function groupByName(e){let t=/* @__PURE__ */ new Map;for(let n of e)t.set(n.name,[...t.get(n.name)??[],n]);return[...t.values()]}function firstDocumentation(e,t,n){let r=e.filter(e=>e.documentation!=null);for(let e of r.slice(1).filter(e=>e.documentation!==r[0].documentation))n.push(warning(a.ConflictingDocumentationAcrossFiles,`The ${t} is already documented in '${describe(r[0].location.path)}' - keeping that documentation`,e.location));return r[0]?.documentation??null}function firstDescription(e,t,n){let r=e.filter(e=>e.description!==null);for(let e of r.slice(1).filter(e=>e.description!==r[0].description))n.push(warning(a.ConflictingDescriptionAcrossFiles,`The ${t} is already described in '${describe(r[0].location.path)}' - keeping that description`,e.location));return r[0]?.description??null}function declaredInOneFile(e,t,n,r,i=/* @__PURE__ */ new Map){let o=[];for(let s of e){let e=i.get(s.name);e!==void 0&&e.path!==s.location.path?n.push(error(a.RepeatedDeclarationAcrossFiles,`Duplicate ${t} '${s.name}'${r===void 0?``:` in ${r}`} - already declared in '${describe(e.path)}'`,s.location)):(e===void 0&&i.set(s.name,s.location),o.push(s))}return o}const describe=e=>e??`another file`,sameLocation=(e,t)=>e.path===t.path&&e.line===t.line&&e.column===t.column,error=(e,t,n)=>({severity:`error`,code:e,message:t,location:n}),warning=(e,t,n)=>({severity:`warning`,code:e,message:t,location:n});function presentOnly(e,t){return t.length===0?{}:{[e]:t}}export{mergeDocuments};
2
2
  //# sourceMappingURL=PlayFolderMerge.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PlayFolderMerge.js","names":["diagnostics","applications","documents","document","options","invalid","application","validatedSourceOptions","legacySourceOptions","failure","InvalidSyntaxJson","DiagnosticCodes","asserted","sourceOptions","invalidSourceOptions","named","concepts","types","identities","extra","contexts","readModes","zones","modes","domains","domain","modules","personas","declaredPolicies","policies","droppedPolicies","policy","value","item","mergeStructuralInteractions","identityContext","ParserContext","LineReader","validateApplicationHandlers","validateIdentity","all","diagnostic","location","isAuthoredDocument","node","module","parts","owner","part","reference","features","left","right","feature","kept","authorization","declarations","declaration","first","earlier","toSyntaxJson","combineAuthorize","combined","next","seen","items","key","groups","documented","disagreeing","described","claimed","keyword","within","path","values"],"sources":["../../../../../../Compiler/Files/PlayFolderMerge.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { mergeStructuralInteractions } from '../Parsing/StructuralInteractionSites';\nimport { validateIdentity } from '../Parsing/IdentityValidator';\nimport { validateApplicationHandlers } from '../Parsing/CommandHandlerValidator';\nimport { ParserContext } from '../Parsing/ParserContext';\nimport { LineReader } from '../Parsing/LineReader';\nimport { Diagnostic } from '../Diagnostics/Diagnostic';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { combineAuthorize } from '../Parsing/AuthorizeParser';\nimport { CompilationResult } from '../ScreenplayCompiler';\nimport { AuthorizeSyntax, PersonaSyntax } from '../Syntax/Authorization';\nimport { ConceptSyntax, TypeSyntax } from '../Syntax/Declarations';\nimport { ApplicationSyntax, FeatureSyntax, ModuleSyntax } from '../Syntax/Structure';\nimport { toSyntaxJson } from '../Syntax/SyntaxJson';\nimport { invalidSourceOptions, isAuthoredDocument, legacySourceOptions, SourceOptions, validatedSourceOptions } from '../Syntax/SourceOptions';\nimport { InvalidSyntaxJson } from '../Syntax/InvalidSyntaxJson';\n\n// \"The documents of a folder are one document\": modules and features with the same name combine, and a\n// name declared in two files is reported - the port of the C# PlayFolderMerge for what this compiler\n// models. The semantic validation the C# merge runs afterwards is not ported.\nexport function mergeDocuments(documents: readonly CompilationResult<ApplicationSyntax>[]): CompilationResult<ApplicationSyntax> {\n const diagnostics: Diagnostic[] = [];\n const applications = documents.map(document => document.value);\n const options = new Map<ApplicationSyntax, SourceOptions>();\n let invalid = false;\n for (const application of applications) {\n try {\n options.set(application, Object.hasOwn(application, 'sourceOptions') ? validatedSourceOptions(application.sourceOptions) : legacySourceOptions);\n } catch (failure) {\n if (!(failure instanceof InvalidSyntaxJson)) throw failure;\n invalid = true;\n diagnostics.push(error(DiagnosticCodes.IncompatibleNumericSource, failure.message, application.location));\n }\n }\n const asserted = applications.filter(application => options.get(application)?.numericMode === 'exact' || hasDeclarations(application));\n let sourceOptions = options.get(asserted[0]) ?? legacySourceOptions;\n for (const application of asserted.slice(1)) {\n if (options.get(application)?.numericMode !== sourceOptions.numericMode) {\n invalid = true;\n diagnostics.push(error(DiagnosticCodes.MixedNumericModes, 'Declaration-bearing documents and marked import barrels must independently select the same numeric mode.', application.location));\n }\n }\n if (invalid) sourceOptions = invalidSourceOptions;\n const named = new Map<string, SourceLocation>();\n const concepts = declaredInOneFile<ConceptSyntax>(applications.flatMap(application => application.concepts), 'declaration of', diagnostics, undefined, named);\n const types = declaredInOneFile<TypeSyntax>(applications.flatMap(application => application.types), 'declaration of', diagnostics, undefined, named);\n const identities = applications.flatMap(application => application.identity == null ? [] : [application.identity]);\n for (const extra of identities.slice(1)) diagnostics.push(error(DiagnosticCodes.RepeatedSingularDeclarationAcrossFiles,\n `The folder already declares an identity block in '${describe(identities[0].location.path)}' - a folder compiles to one application, which can have at most one`, extra.location));\n const contexts = applications.flatMap(application => application.context == null ? [] : [application.context]);\n for (const extra of contexts.slice(1)) diagnostics.push(error(DiagnosticCodes.RepeatedSingularDeclarationAcrossFiles,\n `The folder already declares a context block in '${describe(contexts[0].location.path)}' - a folder compiles to one application, which can have at most one`, extra.location));\n const readModes = applications.filter(application => application.commandReadMode != null);\n for (const extra of readModes.slice(1)) diagnostics.push(error(DiagnosticCodes.InvalidCommandReadsDeclaration,\n \"Declare 'command reads protected' once at the application root.\", extra.location));\n const zones = applications.filter(application => application.timeZone != null);\n for (const extra of zones.slice(1)) diagnostics.push(error(DiagnosticCodes.InvalidTimeZoneDeclaration,\n \"Declare 'time zone' once at the application root.\", extra.location));\n const modes = applications.filter(application => application.reactionProductionMode != null);\n for (const extra of modes.slice(1)) diagnostics.push(error(DiagnosticCodes.InvalidReactionBatchesDeclaration,\n \"Declare 'reaction batches atomic' once at the application root.\", extra.location));\n const domains = applications.map(application => application.domain).filter(domain => domain !== null);\n for (const extra of domains.slice(1)) {\n diagnostics.push(error(DiagnosticCodes.RepeatedSingularDeclarationAcrossFiles,\n `The folder already declares a domain in '${describe(domains[0].location.path)}' - a folder compiles to one application, which can have at most one`, extra.location));\n }\n // Modules merge before personas are claimed, so the diagnostics come in the order the C# merge reports them.\n const modules = mergeModules(applications.flatMap(application => application.modules), diagnostics);\n const personas = declaredInOneFile<PersonaSyntax>(applications.flatMap(application => application.personas), 'persona', diagnostics);\n const declaredPolicies = applications.flatMap(application => application.policies ?? []);\n const policies = declaredInOneFile(declaredPolicies, 'policy', diagnostics);\n // Like the C# merge, a policy dropped as repeated across files is not also reported as repeated within its file.\n const droppedPolicies = declaredPolicies.filter(policy => !policies.includes(policy)).map(policy => policy.location);\n const value: ApplicationSyntax = {\n kind: 'ApplicationSyntax',\n sourceOptions,\n ...(modes.length === 0 ? {} : { reactionProductionMode: modes[0].reactionProductionMode }),\n ...(readModes.length === 0 ? {} : { commandReadMode: readModes[0].commandReadMode }),\n ...(zones.length === 0 ? {} : { timeZone: zones[0].timeZone }),\n ...(identities.length === 0 ? {} : { identity: identities[0] }),\n ...(contexts.length === 0 ? {} : { context: contexts[0] }),\n domain: domains[0] ?? null,\n imports: firstOfEach(applications.flatMap(application => application.imports), item => item.qualifiedName),\n concepts,\n types,\n examples: applications.flatMap(application => application.examples ?? []),\n systems: applications.flatMap(application => application.systems ?? []),\n ...(applications.some(application => (application.stateMachines?.length ?? 0) > 0) ? { stateMachines: applications.flatMap(application => application.stateMachines ?? []) } : {}),\n ...(applications.some(application => (application.workflows?.length ?? 0) > 0) ? { workflows: applications.flatMap(application => application.workflows ?? []) } : {}),\n purposes: declaredInOneFile(applications.flatMap(application => application.purposes ?? []), 'purpose', diagnostics),\n eventSources: applications.flatMap(application => application.eventSources ?? []),\n declaredTriggers: applications.flatMap(application => application.declaredTriggers ?? []),\n modules,\n personas,\n policies,\n seeds: applications.flatMap(application => application.seeds ?? []),\n fileImports: applications.flatMap(application => application.fileImports),\n ...presentOnly('stickyNotes', applications.flatMap(application => application.stickyNotes ?? [])),\n ...presentOnly('exposures', applications.flatMap(application => application.exposures ?? [])),\n ...presentOnly('instanceContributions', applications.flatMap(application => application.instanceContributions ?? [])),\n location: applications[0]?.location ?? { line: 1, column: 1 },\n };\n mergeStructuralInteractions(value, applications);\n const identityContext = new ParserContext(new LineReader([]));\n validateApplicationHandlers(value, identityContext);\n validateIdentity(value, identityContext);\n diagnostics.push(...identityContext.diagnostics);\n const documentDiagnostics = documents.flatMap(document => document.diagnostics).filter(diagnostic =>\n diagnostic.code !== DiagnosticCodes.DuplicateDeclaration || !droppedPolicies.some(location => sameLocation(location, diagnostic.location)));\n const all = [...documentDiagnostics, ...diagnostics];\n return { value, diagnostics: all, success: !all.some(diagnostic => diagnostic.severity === 'error') };\n}\n\nfunction hasDeclarations(application: ApplicationSyntax): boolean {\n if (isAuthoredDocument(application)) return true;\n if (application.context != null || application.identity != null || application.domain !== null || application.concepts.length > 0 || application.types.length > 0 || application.personas.length > 0 || (application.policies?.length ?? 0) > 0 || (application.purposes?.length ?? 0) > 0 || (application.seeds?.length ?? 0) > 0 || (application.systems?.length ?? 0) > 0 || (application.stateMachines?.length ?? 0) > 0 || (application.workflows?.length ?? 0) > 0 || (application.eventSources?.length ?? 0) > 0 || (application.examples?.length ?? 0) > 0 || (application.stickyNotes?.length ?? 0) > 0) return true;\n const feature = (node: FeatureSyntax): boolean => !node.isPlacement || (node.examples?.length ?? 0) > 0 || node.slices.length > 0 || node.features.some(feature);\n return application.modules.some(module => !module.isPlacement || (module.examples?.length ?? 0) > 0 || module.features.some(feature));\n}\n\nfunction mergeModules(modules: readonly ModuleSyntax[], diagnostics: Diagnostic[]): ModuleSyntax[] {\n return groupByName(modules).map(placedLast).map(parts => {\n if (parts.length === 1) return mergeStructuralInteractions({ ...parts[0], isPlacement: false, features: parts[0].features.map(unplaced) }, parts);\n const owner = mergeStructuralInteractions({\n ...parts[0],\n isPlacement: false,\n fileImports: parts.flatMap(part => part.fileImports),\n examples: parts.flatMap(part => part.examples ?? []),\n purposes: firstOfEach(parts.flatMap(part => part.purposes ?? []), reference => reference.name),\n description: firstDescription(parts, `module '${parts[0].name}'`, diagnostics),\n documentation: firstDocumentation(parts, `module '${parts[0].name}'`, diagnostics),\n authorize: combineAuthorization(parts.map(part => part.authorize), `module '${parts[0].name}'`, diagnostics),\n dependsOn: groupDependencies(parts),\n }, parts, diagnostics);\n return mergeStructuralInteractions({ ...owner, features: mergeFeatures(parts.flatMap(part => part.features), diagnostics) }, [owner]);\n });\n}\n\nfunction mergeFeatures(features: readonly FeatureSyntax[], diagnostics: Diagnostic[]): FeatureSyntax[] {\n return groupByName(features).map(placedLast).map(parts => {\n if (parts.length === 1) return unplaced(parts[0]);\n const owner = mergeStructuralInteractions({\n ...parts[0],\n isPlacement: false,\n fileImports: parts.flatMap(part => part.fileImports),\n examples: parts.flatMap(part => part.examples ?? []),\n purposes: firstOfEach(parts.flatMap(part => part.purposes ?? []), reference => reference.name),\n description: firstDescription(parts, `feature '${parts[0].name}'`, diagnostics),\n documentation: firstDocumentation(parts, `feature '${parts[0].name}'`, diagnostics),\n authorize: combineAuthorization(parts.map(part => part.authorize), `feature '${parts[0].name}'`, diagnostics),\n dependsOn: groupDependencies(parts),\n }, parts, diagnostics);\n return mergeStructuralInteractions({ ...owner,\n features: mergeFeatures(parts.flatMap(part => part.features), diagnostics),\n slices: declaredInOneFile(parts.flatMap(part => part.slices), 'slice', diagnostics, `feature '${parts[0].name}'`),\n }, [owner]);\n });\n}\n\n// Dependencies accumulate in path order, independently of which header owns the container.\nfunction groupDependencies(parts: readonly (ModuleSyntax | FeatureSyntax)[]) {\n return [...parts].sort((left, right) => (left.location.path ?? '') < (right.location.path ?? '') ? -1 : (left.location.path ?? '') > (right.location.path ?? '') ? 1 : 0).flatMap(part => part.dependsOn ?? []);\n}\n\n// Where a module or feature is written comes before files merely placed in it, so the merged one is located\n// at its declaration. Within each kind, path order is kept.\nfunction placedLast<T extends { readonly isPlacement: boolean }>(parts: readonly T[]): T[] {\n return [...parts.filter(part => !part.isPlacement), ...parts.filter(part => part.isPlacement)];\n}\n\n// Once merged, a feature is the feature - whether a file was placed in it no longer says anything.\nfunction unplaced(feature: FeatureSyntax): FeatureSyntax {\n return mergeStructuralInteractions({ ...feature, isPlacement: false, features: feature.features.map(unplaced) }, [feature]);\n}\n\n// Combines the gates files declare on one module or feature with 'and', never weakening an earlier one. The\n// same gate repeated in another file says nothing new and is reported and left out.\nfunction combineAuthorization(declarations: readonly (AuthorizeSyntax | null)[], owner: string, diagnostics: Diagnostic[]): AuthorizeSyntax | null {\n const kept: AuthorizeSyntax[] = [];\n for (const authorization of declarations.filter(declaration => declaration !== null)) {\n const first = kept.find(earlier => earlier.location.path !== authorization.location.path\n && JSON.stringify(toSyntaxJson(earlier)) === JSON.stringify(toSyntaxJson(authorization)));\n if (first !== undefined) {\n diagnostics.push(warning(DiagnosticCodes.DuplicateAuthorizationAcrossFiles,\n `An identical authorization is already declared on the ${owner} in '${describe(first.location.path)}' - this repeated gate is ignored`, authorization.location));\n continue;\n }\n kept.push(authorization);\n }\n return kept.reduce<AuthorizeSyntax | null>((combined, next) => combineAuthorize(combined, next), null);\n}\n\nfunction firstOfEach<T>(items: readonly T[], key: (item: T) => string): T[] {\n const seen = new Set<string>();\n return items.filter(item => !seen.has(key(item)) && seen.add(key(item)) !== undefined);\n}\n\n// Groups by name, keeping the order each name first appears in.\nfunction groupByName<T extends { readonly name: string }>(items: readonly T[]): T[][] {\n const groups = new Map<string, T[]>();\n for (const item of items) {\n groups.set(item.name, [...(groups.get(item.name) ?? []), item]);\n }\n return [...groups.values()];\n}\n\nfunction firstDocumentation(parts: readonly { documentation?: string | null; location: SourceLocation }[], owner: string, diagnostics: Diagnostic[]): string | null {\n const documented = parts.filter(part => part.documentation != null);\n for (const disagreeing of documented.slice(1).filter(part => part.documentation !== documented[0].documentation)) {\n diagnostics.push(warning(DiagnosticCodes.ConflictingDocumentationAcrossFiles,\n `The ${owner} is already documented in '${describe(documented[0].location.path)}' - keeping that documentation`, disagreeing.location));\n }\n return documented[0]?.documentation ?? null;\n}\n\nfunction firstDescription(parts: readonly { description: string | null; location: SourceLocation }[], owner: string, diagnostics: Diagnostic[]): string | null {\n const described = parts.filter(part => part.description !== null);\n for (const disagreeing of described.slice(1).filter(part => part.description !== described[0].description)) {\n diagnostics.push(warning(DiagnosticCodes.ConflictingDescriptionAcrossFiles,\n `The ${owner} is already described in '${describe(described[0].location.path)}' - keeping that description`, disagreeing.location));\n }\n return described[0]?.description ?? null;\n}\n\n// Keeps the first declaration of each name; one in another file with the same name is reported and dropped.\n// A repeat within one file is left for that file's own checks.\nfunction declaredInOneFile<T extends { readonly name: string; readonly location: SourceLocation }>(\n declarations: readonly T[], keyword: string, diagnostics: Diagnostic[], within?: string, claimed = new Map<string, SourceLocation>()): T[] {\n const kept: T[] = [];\n for (const declaration of declarations) {\n const first = claimed.get(declaration.name);\n if (first !== undefined && first.path !== declaration.location.path) {\n diagnostics.push(error(DiagnosticCodes.RepeatedDeclarationAcrossFiles,\n `Duplicate ${keyword} '${declaration.name}'${within === undefined ? '' : ` in ${within}`} - already declared in '${describe(first.path)}'`, declaration.location));\n continue;\n }\n if (first === undefined) {\n claimed.set(declaration.name, declaration.location);\n }\n kept.push(declaration);\n }\n return kept;\n}\n\nconst describe = (path: string | undefined): string => path ?? 'another file';\nconst sameLocation = (left: SourceLocation, right: SourceLocation): boolean => left.path === right.path && left.line === right.line && left.column === right.column;\nconst error = (code: string, message: string, location: SourceLocation): Diagnostic => ({ severity: 'error', code, message, location });\nconst warning = (code: string, message: string, location: SourceLocation): Diagnostic => ({ severity: 'warning', code, message, location });\n\n// Composition members are written only when a document declares them, matching the C# canonical JSON.\nfunction presentOnly<TKey extends string, TValue>(key: TKey, values: readonly TValue[]): Partial<Record<TKey, readonly TValue[]>> {\n return values.length === 0 ? {} : { [key]: values } as Partial<Record<TKey, readonly TValue[]>>;\n}\n"],"mappings":"myBAuBA,SAAgB,eAAe,EAAkG,CAC7H,IAAMA,EAA4B,CAAC,EAC7BC,EAAeC,EAAU,IAAI,GAAYC,EAAS,KAAK,EACvDC,kBAAU,IAAI,IAChBC,EAAU,GACd,IAAK,IAAMC,KAAeL,EACtB,GAAI,CACAG,EAAQ,IAAIE,EAAa,OAAO,OAAOA,EAAa,eAAe,EAAIC,EAAuBD,EAAY,aAAa,EAAIE,CAAmB,CAClJ,OAASC,EAAS,CACd,GAAI,EAAEA,aAAmBC,GAAoB,MAAMD,EACnD,EAAU,GACVT,EAAY,KAAK,MAAMW,EAAgB,0BAA2BF,EAAQ,QAASH,EAAY,QAAQ,CAAC,CAC5G,CAEJ,IAAMM,EAAWX,EAAa,OAAO,GAAeG,EAAQ,IAAIE,CAAW,CAAC,EAAE,cAAgB,SAAW,gBAAgBA,CAAW,CAAC,EACjIO,EAAgBT,EAAQ,IAAIQ,EAAS,EAAE,GAAKJ,EAChD,IAAK,IAAMF,KAAeM,EAAS,MAAM,CAAC,EAClCR,EAAQ,IAAIE,CAAW,CAAC,EAAE,cAAgBO,EAAc,cACxD,EAAU,GACVb,EAAY,KAAK,MAAMW,EAAgB,kBAAmB,2GAA4GL,EAAY,QAAQ,CAAC,GAG/LD,IAAS,EAAgBS,GAC7B,IAAMC,kBAAQ,IAAI,IACZC,EAAW,kBAAiCf,EAAa,QAAQ,GAAeK,EAAY,QAAQ,EAAG,iBAAkBN,EAAa,IAAA,GAAWe,CAAK,EACtJE,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document","options","invalid","application","validatedSourceOptions","legacySourceOptions","failure","InvalidSyntaxJson","DiagnosticCodes","asserted","sourceOptions","invalidSourceOptions","named","concepts","types","identities","extra","contexts","readModes","zones","modes","domains","domain","modules","personas","declaredPolicies","policies","droppedPolicies","policy","value","item","mergeStructuralInteractions","identityContext","ParserContext","LineReader","validateApplicationHandlers","validateIdentity","all","diagnostic","location","isAuthoredDocument","node","module","parts","owner","part","reference","authorizationWasRefused","features","left","right","feature","kept","authorization","declarations","declaration","first","earlier","context","combined","next","combineAuthorize","pending","pair","seen","items","key","groups","documented","disagreeing","described","claimed","keyword","within","path","values"],"sources":["../../../../../../Compiler/Files/PlayFolderMerge.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { mergeStructuralInteractions } from '../Parsing/StructuralInteractionSites';\nimport { validateIdentity } from '../Parsing/IdentityValidator';\nimport { validateApplicationHandlers } from '../Parsing/CommandHandlerValidator';\nimport { ParserContext } from '../Parsing/ParserContext';\nimport { LineReader } from '../Parsing/LineReader';\nimport { Diagnostic } from '../Diagnostics/Diagnostic';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { authorizationWasRefused, combineAuthorize } from '../Parsing/AuthorizeParser';\nimport { CompilationResult } from '../ScreenplayCompiler';\nimport { AuthorizeSyntax, PersonaSyntax, PolicyRequirementSyntax } from '../Syntax/Authorization';\nimport { ConceptSyntax, TypeSyntax } from '../Syntax/Declarations';\nimport { ApplicationSyntax, FeatureSyntax, ModuleSyntax } from '../Syntax/Structure';\nimport { invalidSourceOptions, isAuthoredDocument, legacySourceOptions, SourceOptions, validatedSourceOptions } from '../Syntax/SourceOptions';\nimport { InvalidSyntaxJson } from '../Syntax/InvalidSyntaxJson';\n\n// \"The documents of a folder are one document\": modules and features with the same name combine, and a\n// name declared in two files is reported - the port of the C# PlayFolderMerge for what this compiler\n// models. The semantic validation the C# merge runs afterwards is not ported.\nexport function mergeDocuments(documents: readonly CompilationResult<ApplicationSyntax>[]): CompilationResult<ApplicationSyntax> {\n const diagnostics: Diagnostic[] = [];\n const applications = documents.map(document => document.value);\n const options = new Map<ApplicationSyntax, SourceOptions>();\n let invalid = false;\n for (const application of applications) {\n try {\n options.set(application, Object.hasOwn(application, 'sourceOptions') ? validatedSourceOptions(application.sourceOptions) : legacySourceOptions);\n } catch (failure) {\n if (!(failure instanceof InvalidSyntaxJson)) throw failure;\n invalid = true;\n diagnostics.push(error(DiagnosticCodes.IncompatibleNumericSource, failure.message, application.location));\n }\n }\n const asserted = applications.filter(application => options.get(application)?.numericMode === 'exact' || hasDeclarations(application));\n let sourceOptions = options.get(asserted[0]) ?? legacySourceOptions;\n for (const application of asserted.slice(1)) {\n if (options.get(application)?.numericMode !== sourceOptions.numericMode) {\n invalid = true;\n diagnostics.push(error(DiagnosticCodes.MixedNumericModes, 'Declaration-bearing documents and marked import barrels must independently select the same numeric mode.', application.location));\n }\n }\n if (invalid) sourceOptions = invalidSourceOptions;\n const named = new Map<string, SourceLocation>();\n const concepts = declaredInOneFile<ConceptSyntax>(applications.flatMap(application => application.concepts), 'declaration of', diagnostics, undefined, named);\n const types = declaredInOneFile<TypeSyntax>(applications.flatMap(application => application.types), 'declaration of', diagnostics, undefined, named);\n const identities = applications.flatMap(application => application.identity == null ? [] : [application.identity]);\n for (const extra of identities.slice(1)) diagnostics.push(error(DiagnosticCodes.RepeatedSingularDeclarationAcrossFiles,\n `The folder already declares an identity block in '${describe(identities[0].location.path)}' - a folder compiles to one application, which can have at most one`, extra.location));\n const contexts = applications.flatMap(application => application.context == null ? [] : [application.context]);\n for (const extra of contexts.slice(1)) diagnostics.push(error(DiagnosticCodes.RepeatedSingularDeclarationAcrossFiles,\n `The folder already declares a context block in '${describe(contexts[0].location.path)}' - a folder compiles to one application, which can have at most one`, extra.location));\n const readModes = applications.filter(application => application.commandReadMode != null);\n for (const extra of readModes.slice(1)) diagnostics.push(error(DiagnosticCodes.InvalidCommandReadsDeclaration,\n \"Declare 'command reads protected' once at the application root.\", extra.location));\n const zones = applications.filter(application => application.timeZone != null);\n for (const extra of zones.slice(1)) diagnostics.push(error(DiagnosticCodes.InvalidTimeZoneDeclaration,\n \"Declare 'time zone' once at the application root.\", extra.location));\n const modes = applications.filter(application => application.reactionProductionMode != null);\n for (const extra of modes.slice(1)) diagnostics.push(error(DiagnosticCodes.InvalidReactionBatchesDeclaration,\n \"Declare 'reaction batches atomic' once at the application root.\", extra.location));\n const domains = applications.map(application => application.domain).filter(domain => domain !== null);\n for (const extra of domains.slice(1)) {\n diagnostics.push(error(DiagnosticCodes.RepeatedSingularDeclarationAcrossFiles,\n `The folder already declares a domain in '${describe(domains[0].location.path)}' - a folder compiles to one application, which can have at most one`, extra.location));\n }\n // Modules merge before personas are claimed, so the diagnostics come in the order the C# merge reports them.\n const modules = mergeModules(applications.flatMap(application => application.modules), diagnostics);\n const personas = declaredInOneFile<PersonaSyntax>(applications.flatMap(application => application.personas), 'persona', diagnostics);\n const declaredPolicies = applications.flatMap(application => application.policies ?? []);\n const policies = declaredInOneFile(declaredPolicies, 'policy', diagnostics);\n // Like the C# merge, a policy dropped as repeated across files is not also reported as repeated within its file.\n const droppedPolicies = declaredPolicies.filter(policy => !policies.includes(policy)).map(policy => policy.location);\n const value: ApplicationSyntax = {\n kind: 'ApplicationSyntax',\n sourceOptions,\n ...(modes.length === 0 ? {} : { reactionProductionMode: modes[0].reactionProductionMode }),\n ...(readModes.length === 0 ? {} : { commandReadMode: readModes[0].commandReadMode }),\n ...(zones.length === 0 ? {} : { timeZone: zones[0].timeZone }),\n ...(identities.length === 0 ? {} : { identity: identities[0] }),\n ...(contexts.length === 0 ? {} : { context: contexts[0] }),\n domain: domains[0] ?? null,\n imports: firstOfEach(applications.flatMap(application => application.imports), item => item.qualifiedName),\n concepts,\n types,\n examples: applications.flatMap(application => application.examples ?? []),\n systems: applications.flatMap(application => application.systems ?? []),\n ...(applications.some(application => (application.stateMachines?.length ?? 0) > 0) ? { stateMachines: applications.flatMap(application => application.stateMachines ?? []) } : {}),\n ...(applications.some(application => (application.workflows?.length ?? 0) > 0) ? { workflows: applications.flatMap(application => application.workflows ?? []) } : {}),\n purposes: declaredInOneFile(applications.flatMap(application => application.purposes ?? []), 'purpose', diagnostics),\n eventSources: applications.flatMap(application => application.eventSources ?? []),\n declaredTriggers: applications.flatMap(application => application.declaredTriggers ?? []),\n modules,\n personas,\n policies,\n seeds: applications.flatMap(application => application.seeds ?? []),\n fileImports: applications.flatMap(application => application.fileImports),\n ...presentOnly('stickyNotes', applications.flatMap(application => application.stickyNotes ?? [])),\n ...presentOnly('exposures', applications.flatMap(application => application.exposures ?? [])),\n ...presentOnly('instanceContributions', applications.flatMap(application => application.instanceContributions ?? [])),\n location: applications[0]?.location ?? { line: 1, column: 1 },\n };\n mergeStructuralInteractions(value, applications);\n const identityContext = new ParserContext(new LineReader([]));\n validateApplicationHandlers(value, identityContext);\n validateIdentity(value, identityContext);\n diagnostics.push(...identityContext.diagnostics);\n const documentDiagnostics = documents.flatMap(document => document.diagnostics).filter(diagnostic =>\n diagnostic.code !== DiagnosticCodes.DuplicateDeclaration || !droppedPolicies.some(location => sameLocation(location, diagnostic.location)));\n const all = [...documentDiagnostics, ...diagnostics];\n return { value, diagnostics: all, success: !all.some(diagnostic => diagnostic.severity === 'error') };\n}\n\nfunction hasDeclarations(application: ApplicationSyntax): boolean {\n if (isAuthoredDocument(application)) return true;\n if (application.context != null || application.identity != null || application.domain !== null || application.concepts.length > 0 || application.types.length > 0 || application.personas.length > 0 || (application.policies?.length ?? 0) > 0 || (application.purposes?.length ?? 0) > 0 || (application.seeds?.length ?? 0) > 0 || (application.systems?.length ?? 0) > 0 || (application.stateMachines?.length ?? 0) > 0 || (application.workflows?.length ?? 0) > 0 || (application.eventSources?.length ?? 0) > 0 || (application.examples?.length ?? 0) > 0 || (application.stickyNotes?.length ?? 0) > 0) return true;\n const feature = (node: FeatureSyntax): boolean => !node.isPlacement || (node.examples?.length ?? 0) > 0 || node.slices.length > 0 || node.features.some(feature);\n return application.modules.some(module => !module.isPlacement || (module.examples?.length ?? 0) > 0 || module.features.some(feature));\n}\n\nfunction mergeModules(modules: readonly ModuleSyntax[], diagnostics: Diagnostic[]): ModuleSyntax[] {\n return groupByName(modules).map(placedLast).map(parts => {\n if (parts.length === 1) return mergeStructuralInteractions({ ...parts[0], isPlacement: false, features: parts[0].features.map(unplaced) }, parts);\n const owner = mergeStructuralInteractions({\n ...parts[0],\n isPlacement: false,\n fileImports: parts.flatMap(part => part.fileImports),\n examples: parts.flatMap(part => part.examples ?? []),\n purposes: firstOfEach(parts.flatMap(part => part.purposes ?? []), reference => reference.name),\n description: firstDescription(parts, `module '${parts[0].name}'`, diagnostics),\n documentation: firstDocumentation(parts, `module '${parts[0].name}'`, diagnostics),\n authorize: parts.some(part => authorizationWasRefused(part.fileImports))\n ? null\n : combineAuthorization(parts.map(part => part.authorize), `module '${parts[0].name}'`, diagnostics),\n dependsOn: groupDependencies(parts),\n }, parts, diagnostics);\n return mergeStructuralInteractions({ ...owner, features: mergeFeatures(parts.flatMap(part => part.features), diagnostics) }, [owner]);\n });\n}\n\nfunction mergeFeatures(features: readonly FeatureSyntax[], diagnostics: Diagnostic[]): FeatureSyntax[] {\n return groupByName(features).map(placedLast).map(parts => {\n if (parts.length === 1) return unplaced(parts[0]);\n const owner = mergeStructuralInteractions({\n ...parts[0],\n isPlacement: false,\n fileImports: parts.flatMap(part => part.fileImports),\n examples: parts.flatMap(part => part.examples ?? []),\n purposes: firstOfEach(parts.flatMap(part => part.purposes ?? []), reference => reference.name),\n description: firstDescription(parts, `feature '${parts[0].name}'`, diagnostics),\n documentation: firstDocumentation(parts, `feature '${parts[0].name}'`, diagnostics),\n authorize: parts.some(part => authorizationWasRefused(part.fileImports))\n ? null\n : combineAuthorization(parts.map(part => part.authorize), `feature '${parts[0].name}'`, diagnostics),\n dependsOn: groupDependencies(parts),\n }, parts, diagnostics);\n return mergeStructuralInteractions({ ...owner,\n features: mergeFeatures(parts.flatMap(part => part.features), diagnostics),\n slices: declaredInOneFile(parts.flatMap(part => part.slices), 'slice', diagnostics, `feature '${parts[0].name}'`),\n }, [owner]);\n });\n}\n\n// Dependencies accumulate in path order, independently of which header owns the container.\nfunction groupDependencies(parts: readonly (ModuleSyntax | FeatureSyntax)[]) {\n return [...parts].sort((left, right) => (left.location.path ?? '') < (right.location.path ?? '') ? -1 : (left.location.path ?? '') > (right.location.path ?? '') ? 1 : 0).flatMap(part => part.dependsOn ?? []);\n}\n\n// Where a module or feature is written comes before files merely placed in it, so the merged one is located\n// at its declaration. Within each kind, path order is kept.\nfunction placedLast<T extends { readonly isPlacement: boolean }>(parts: readonly T[]): T[] {\n return [...parts.filter(part => !part.isPlacement), ...parts.filter(part => part.isPlacement)];\n}\n\n// Once merged, a feature is the feature - whether a file was placed in it no longer says anything.\nfunction unplaced(feature: FeatureSyntax): FeatureSyntax {\n return mergeStructuralInteractions({ ...feature, isPlacement: false, features: feature.features.map(unplaced) }, [feature]);\n}\n\n// Combines the gates files declare on one module or feature with 'and', never weakening an earlier one. The\n// same gate repeated in another file says nothing new and is reported and left out.\nfunction combineAuthorization(declarations: readonly (AuthorizeSyntax | null)[], owner: string, diagnostics: Diagnostic[]): AuthorizeSyntax | null {\n const kept: AuthorizeSyntax[] = [];\n for (const authorization of declarations.filter(declaration => declaration !== null)) {\n const first = kept.find(earlier => earlier.location.path !== authorization.location.path\n && sameRequirement(earlier.requirement, authorization.requirement));\n if (first !== undefined) {\n diagnostics.push(warning(DiagnosticCodes.DuplicateAuthorizationAcrossFiles,\n `An identical authorization is already declared on the ${owner} in '${describe(first.location.path)}' - this repeated gate is ignored`, authorization.location));\n continue;\n }\n kept.push(authorization);\n }\n const context = new ParserContext(new LineReader([]));\n let combined: AuthorizeSyntax | null = null;\n for (const next of kept) {\n combined = combineAuthorize(combined, next, context);\n if (combined === null) break;\n }\n diagnostics.push(...context.diagnostics);\n return combined;\n}\n\nfunction sameRequirement(first: PolicyRequirementSyntax, second: PolicyRequirementSyntax): boolean {\n const pending = [{ first, second }];\n while (pending.length > 0) {\n const pair = pending.pop()!;\n if (pair.first.kind === 'PolicyReferenceSyntax' && pair.second.kind === 'PolicyReferenceSyntax') {\n if (pair.first.name !== pair.second.name) return false;\n } else if (pair.first.kind === 'LogicalPolicyRequirementSyntax' && pair.second.kind === 'LogicalPolicyRequirementSyntax') {\n if (pair.first.operator !== pair.second.operator) return false;\n pending.push({ first: pair.first.left, second: pair.second.left }, { first: pair.first.right, second: pair.second.right });\n } else {\n return false;\n }\n }\n return true;\n}\n\nfunction firstOfEach<T>(items: readonly T[], key: (item: T) => string): T[] {\n const seen = new Set<string>();\n return items.filter(item => !seen.has(key(item)) && seen.add(key(item)) !== undefined);\n}\n\n// Groups by name, keeping the order each name first appears in.\nfunction groupByName<T extends { readonly name: string }>(items: readonly T[]): T[][] {\n const groups = new Map<string, T[]>();\n for (const item of items) {\n groups.set(item.name, [...(groups.get(item.name) ?? []), item]);\n }\n return [...groups.values()];\n}\n\nfunction firstDocumentation(parts: readonly { documentation?: string | null; location: SourceLocation }[], owner: string, diagnostics: Diagnostic[]): string | null {\n const documented = parts.filter(part => part.documentation != null);\n for (const disagreeing of documented.slice(1).filter(part => part.documentation !== documented[0].documentation)) {\n diagnostics.push(warning(DiagnosticCodes.ConflictingDocumentationAcrossFiles,\n `The ${owner} is already documented in '${describe(documented[0].location.path)}' - keeping that documentation`, disagreeing.location));\n }\n return documented[0]?.documentation ?? null;\n}\n\nfunction firstDescription(parts: readonly { description: string | null; location: SourceLocation }[], owner: string, diagnostics: Diagnostic[]): string | null {\n const described = parts.filter(part => part.description !== null);\n for (const disagreeing of described.slice(1).filter(part => part.description !== described[0].description)) {\n diagnostics.push(warning(DiagnosticCodes.ConflictingDescriptionAcrossFiles,\n `The ${owner} is already described in '${describe(described[0].location.path)}' - keeping that description`, disagreeing.location));\n }\n return described[0]?.description ?? null;\n}\n\n// Keeps the first declaration of each name; one in another file with the same name is reported and dropped.\n// A repeat within one file is left for that file's own checks.\nfunction declaredInOneFile<T extends { readonly name: string; readonly location: SourceLocation }>(\n declarations: readonly T[], keyword: string, diagnostics: Diagnostic[], within?: string, claimed = new Map<string, SourceLocation>()): T[] {\n const kept: T[] = [];\n for (const declaration of declarations) {\n const first = claimed.get(declaration.name);\n if (first !== undefined && first.path !== declaration.location.path) {\n diagnostics.push(error(DiagnosticCodes.RepeatedDeclarationAcrossFiles,\n `Duplicate ${keyword} '${declaration.name}'${within === undefined ? '' : ` in ${within}`} - already declared in '${describe(first.path)}'`, declaration.location));\n continue;\n }\n if (first === undefined) {\n claimed.set(declaration.name, declaration.location);\n }\n kept.push(declaration);\n }\n return kept;\n}\n\nconst describe = (path: string | undefined): string => path ?? 'another file';\nconst sameLocation = (left: SourceLocation, right: SourceLocation): boolean => left.path === right.path && left.line === right.line && left.column === right.column;\nconst error = (code: string, message: string, location: SourceLocation): Diagnostic => ({ severity: 'error', code, message, location });\nconst warning = (code: string, message: string, location: SourceLocation): Diagnostic => ({ severity: 'warning', code, message, location });\n\n// Composition members are written only when a document declares them, matching the C# canonical JSON.\nfunction presentOnly<TKey extends string, TValue>(key: TKey, values: readonly TValue[]): Partial<Record<TKey, readonly TValue[]>> {\n return values.length === 0 ? {} : { [key]: values } as Partial<Record<TKey, readonly TValue[]>>;\n}\n"],"mappings":"A,ywBAsBA,SAAgB,eAAe,EAAkG,CAC7H,IAAMA,EAA4B,CAAC,EAC7BC,EAAeC,EAAU,IAAI,GAAYC,EAAS,KAAK,EACvDC,kBAAU,IAAI,IAChBC,EAAU,GACd,IAAK,IAAMC,KAAeL,EACtB,GAAI,CACAG,EAAQ,IAAIE,EAAa,OAAO,OAAOA,EAAa,eAAe,EAAIC,EAAuBD,EAAY,aAAa,EAAIE,CAAmB,CAClJ,OAASC,EAAS,CACd,GAAI,EAAEA,aAAmBC,GAAoB,MAAMD,EACnD,EAAU,GACVT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UAAS,GAGzI,SAAS,YAAyC,EAAW,EAAqE,CAC9H,OAAOyB,EAAO,SAAW,EAAI,CAAC,EAAI,EAAGT,GAAMS,CAAO,CACtD,C"}
@@ -1,2 +1,3 @@
1
- import"../../_virtual/_virtual/_rolldown/runtime.js";const hasWildcard=e=>e.includes(`*`)||e.includes(`?`);function normalizePlayPath(e){let t=[];for(let n of e.replaceAll(`\\`,`/`).split(`/`).filter(e=>e.length>0))n!==`.`&&(n===`..`&&t.length>0&&t[t.length-1]!==`..`?t.pop():t.push(n));return t.join(`/`)}function resolvePlayPattern(e,t){let n=e.lastIndexOf(`/`),r=n>=0?e.substring(0,n):``;return normalizePlayPath(t.startsWith(`/`)?t.replace(/^\/+/,``):r.length===0?t:`${r}/${t}`)}function staticFolderOf(e){let t=e.split(`/`).slice(0,-1),n=t.findIndex(hasWildcard);return(n<0?t:t.slice(0,n)).join(`/`)}function matchesPlayPattern(e,t){return t.toLowerCase().endsWith(`.play`)&&toRegularExpression(e).test(t)}function toRegularExpression(e){let t=`^`,n=e.split(`/`);return n.forEach((e,r)=>{let i=r===n.length-1;if(e===`**`)t+=i?`.*`:`(?:[^/]+/)*`;else{for(let n of e)t+=n===`*`?`[^/]*`:n===`?`?`[^/]`:n.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);i||(t+=`/`)}}),RegExp(`${t}$`,`u`)}export{hasWildcard,matchesPlayPattern,normalizePlayPath,resolvePlayPattern,staticFolderOf};
1
+ import"../../_virtual/_virtual/_rolldown/runtime.js";const hasWildcard=e=>e.includes(`*`)||e.includes(`?`);function normalizePlayPath(e){let t=[];for(let n of e.replaceAll(`\\`,`/`).split(`/`).filter(e=>e.length>0))n!==`.`&&(n===`..`&&t.length>0&&t[t.length-1]!==`..`?t.pop():t.push(n));return t.join(`/`)}function resolvePlayPattern(e,t){let n=e.lastIndexOf(`/`),r=n>=0?e.substring(0,n):``;return normalizePlayPath(t.startsWith(`/`)?t.replace(/^\/+/,``):r.length===0?t:`${r}/${t}`)}function staticFolderOf(e){let t=e.split(`/`).slice(0,-1),n=t.findIndex(hasWildcard);return(n<0?t:t.slice(0,n)).join(`/`)}function matchesPlayPattern(e,t){if(t.slice(-5).toLowerCase()!==`.play`)return!1;let n=patternStates(e),r=Array(n.length+1).fill(!1),i=Array(n.length+1).fill(!1);r[0]=!0;for(let e of t){i.fill(!1);for(let t=0;t<n.length;t++){if(!r[t])continue;let{skip:a,consume:o}=n[t];a>0&&(r[t+a]=!0);let s=o(e);s>=0&&(i[s]=!0)}let t=r;r=i,i=t}for(let e=0;e<n.length;e++)r[e]&&n[e].skip>0&&(r[e+n[e].skip]=!0);return r[n.length]}function patternStates(e){let t=[],n=e.split(`/`);for(let e=0;e<n.length;e++){let r=t.length,i=e===n.length-1;if(n[e]===`**`)i?t.push({skip:1,consume:e=>`
2
+ \r\u2028\u2029`.includes(e)?-1:r}):(t.push({skip:2,consume:e=>e===`/`?-1:r+1}),t.push({skip:0,consume:e=>e===`/`?r:r+1}));else{for(let r of n[e]){let e=t.length;t.push({skip:+(r===`*`),consume:t=>t===`/`?-1:r===`*`?e:r===`?`||t===r?e+1:-1})}if(!i){let e=t.length;t.push({skip:0,consume:t=>t===`/`?e+1:-1})}}}return t}export{hasWildcard,matchesPlayPattern,normalizePlayPath,resolvePlayPattern,staticFolderOf};
2
3
  //# sourceMappingURL=PlayGlob.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PlayGlob.js","names":["pattern","segments","segment","path","each","slash","importingPath","folder","resolvedPattern","wildcard","expression","last","index","character"],"sources":["../../../../../../Compiler/Files/PlayGlob.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n// Matches the path or glob pattern of a file import against portable '/' separated paths - the port of the\n// C# PlayGlob, so a folder resolves the same way in an editor and in a build. '**' as a whole segment matches\n// any number of folders, including none; '*' matches any run of characters within one segment and '?' one\n// character. A pattern is relative to the folder of the file that imports, may climb with '..', and only ever\n// matches .play files.\n\n// Whether a pattern holds a wildcard, as opposed to naming one file.\nexport const hasWildcard = (pattern: string): boolean => pattern.includes('*') || pattern.includes('?');\n\n// Normalizes a portable path - separators to '/', '.' segments removed, '..' applied. Leading '..' segments\n// that climb above the root are kept.\nexport function normalizePlayPath(path: string): string {\n const segments: string[] = [];\n for (const segment of path.replaceAll('\\\\', '/').split('/').filter(each => each.length > 0)) {\n if (segment === '.') continue;\n if (segment === '..' && segments.length > 0 && segments[segments.length - 1] !== '..') {\n segments.pop();\n continue;\n }\n segments.push(segment);\n }\n return segments.join('/');\n}\n\n// Resolves a pattern written in a file against the folder that file is in, relative to the same root as the\n// importing path.\nexport function resolvePlayPattern(importingPath: string, pattern: string): string {\n const slash = importingPath.lastIndexOf('/');\n const folder = slash >= 0 ? importingPath.substring(0, slash) : '';\n const combined = pattern.startsWith('/') ? pattern.replace(/^\\/+/, '') : (folder.length === 0 ? pattern : `${folder}/${pattern}`);\n return normalizePlayPath(combined);\n}\n\n// The folder a resolved pattern can only match beneath - everything before its first wildcard segment.\nexport function staticFolderOf(resolvedPattern: string): string {\n const segments = resolvedPattern.split('/').slice(0, -1);\n const wildcard = segments.findIndex(hasWildcard);\n return (wildcard < 0 ? segments : segments.slice(0, wildcard)).join('/');\n}\n\n// Whether a normalized portable path is a .play file a resolved pattern names.\nexport function matchesPlayPattern(resolvedPattern: string, path: string): boolean {\n return path.toLowerCase().endsWith('.play') && toRegularExpression(resolvedPattern).test(path);\n}\n\nfunction toRegularExpression(pattern: string): RegExp {\n let expression = '^';\n const segments = pattern.split('/');\n segments.forEach((segment, index) => {\n const last = index === segments.length - 1;\n if (segment === '**') {\n expression += last ? '.*' : '(?:[^/]+/)*';\n return;\n }\n for (const character of segment) {\n expression += character === '*' ? '[^/]*' : character === '?' ? '[^/]' : character.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n }\n if (!last) expression += '/';\n });\n return new RegExp(`${expression}$`, 'u');\n}\n"],"mappings":"qDAUA,MAAa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KAAO,kBAGhC,KAAK,IAAME,KAAaX,EACpB,GAAcW,IAAc,IAAM,QAAUA,IAAc,IAAM,OAASA,EAAU,QAAQ,sBAAuB,MAAM,EAEvHF,IAAM,GAAc,IAFmG,CAGhI,CAAC,EACU,OAAO,GAAGD,EAAW,GAAI,GAAG,CAC3C"}
1
+ {"version":3,"file":"PlayGlob.js","names":["pattern","segments","segment","path","each","slash","importingPath","folder","resolvedPattern","wildcard","states","reachable","next","character","state","skip","target","consume","previous","index","last","token","position"],"sources":["../../../../../../Compiler/Files/PlayGlob.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n// Matches the path or glob pattern of a file import against portable '/' separated paths - the port of the\n// C# PlayGlob, so a folder resolves the same way in an editor and in a build. '**' as a whole segment matches\n// any number of folders, including none; '*' matches any run of characters within one segment and '?' one\n// character. A pattern is relative to the folder of the file that imports, may climb with '..', and only ever\n// matches .play files.\n\n// Whether a pattern holds a wildcard, as opposed to naming one file.\nexport const hasWildcard = (pattern: string): boolean => pattern.includes('*') || pattern.includes('?');\n\n// Normalizes a portable path - separators to '/', '.' segments removed, '..' applied. Leading '..' segments\n// that climb above the root are kept.\nexport function normalizePlayPath(path: string): string {\n const segments: string[] = [];\n for (const segment of path.replaceAll('\\\\', '/').split('/').filter(each => each.length > 0)) {\n if (segment === '.') continue;\n if (segment === '..' && segments.length > 0 && segments[segments.length - 1] !== '..') {\n segments.pop();\n continue;\n }\n segments.push(segment);\n }\n return segments.join('/');\n}\n\n// Resolves a pattern written in a file against the folder that file is in, relative to the same root as the\n// importing path.\nexport function resolvePlayPattern(importingPath: string, pattern: string): string {\n const slash = importingPath.lastIndexOf('/');\n const folder = slash >= 0 ? importingPath.substring(0, slash) : '';\n const combined = pattern.startsWith('/') ? pattern.replace(/^\\/+/, '') : (folder.length === 0 ? pattern : `${folder}/${pattern}`);\n return normalizePlayPath(combined);\n}\n\n// The folder a resolved pattern can only match beneath - everything before its first wildcard segment.\nexport function staticFolderOf(resolvedPattern: string): string {\n const segments = resolvedPattern.split('/').slice(0, -1);\n const wildcard = segments.findIndex(hasWildcard);\n return (wildcard < 0 ? segments : segments.slice(0, wildcard)).join('/');\n}\n\n// Whether a normalized portable path is a .play file a resolved pattern names.\nexport function matchesPlayPattern(resolvedPattern: string, path: string): boolean {\n if (path.slice(-5).toLowerCase() !== '.play') return false;\n const states = patternStates(resolvedPattern);\n let reachable = Array<boolean>(states.length + 1).fill(false);\n let next = Array<boolean>(states.length + 1).fill(false);\n reachable[0] = true;\n // Epsilon transitions only advance, so one forward pass closes each rolling state set.\n for (const character of path) {\n next.fill(false);\n for (let state = 0; state < states.length; state++) {\n if (!reachable[state]) continue;\n const { skip, consume } = states[state]!;\n if (skip > 0) reachable[state + skip] = true;\n const target = consume(character);\n if (target >= 0) next[target] = true;\n }\n const previous = reachable;\n reachable = next;\n next = previous;\n }\n for (let state = 0; state < states.length; state++) {\n if (reachable[state] && states[state]!.skip > 0) reachable[state + states[state]!.skip] = true;\n }\n return reachable[states.length]!;\n}\n\nfunction patternStates(pattern: string): { skip: number; consume: (character: string) => number }[] {\n const states: { skip: number; consume: (character: string) => number }[] = [];\n const segments = pattern.split('/');\n for (let segment = 0; segment < segments.length; segment++) {\n const index = states.length;\n const last = segment === segments.length - 1;\n if (segments[segment] === '**') {\n if (last) {\n // Like the former trailing `.*`, this loop does not cross line separators.\n states.push({ skip: 1, consume: character => '\\n\\r\\u2028\\u2029'.includes(character) ? -1 : index });\n } else {\n // (?:[^/]+/)*: skipping consumes no folder; entering requires a nonempty one.\n states.push({ skip: 2, consume: character => character === '/' ? -1 : index + 1 });\n states.push({ skip: 0, consume: character => character === '/' ? index : index + 1 });\n }\n continue;\n }\n for (const token of segments[segment]!) {\n const position = states.length;\n states.push({\n skip: token === '*' ? 1 : 0,\n consume: character => {\n if (character === '/') return -1;\n if (token === '*') return position;\n return token === '?' || character === token ? position + 1 : -1;\n },\n });\n }\n // An ordinary segment always consumes its separator, including before a trailing **.\n if (!last) {\n const position = states.length;\n states.push({ skip: 0, consume: character => character === '/' ? position + 1 : -1 });\n }\n }\n return states;\n}\n"],"mappings":"A,qDAUA,MAAa,YAAe,GAA6BA,EAAQ,SAAS,GAAG,GAAKA,EAAQ,SAAS,GAAG,EAItG,SAAgB,kBAAkB,EAAsB,CACpD,IAAMC,EAAqB,CAAC,EAC5B,IAAK,IAAMC,KAAWC,EAAK,WAAW,KAAM,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,OAAO,GAAQC,EAAK,OAAS,CAAC,EAClFF,IAAY,MACZA,IAAY,MAAQD,EAAS,OAAS,GAAKA,EAASA,EAAS,OAAS,KAAO,KAC7EA,EAAS,IAAI,EAGjBA,EAAS,KAAKC,CAAO,GAEzB,OAAOD,EAAS,KAAK,GAAG,CAC5B,CAIA,SAAgB,mBAAmB,EAAuB,EAAyB,CAC/E,IAAMI,EAAQC,EAAc,YAAY,GAAG,EACrCC,EAASF,GAAS,EAAIC,EAAc,UAAU,EAAGD,CAAK,EAAI,GAEhE,OAAO,kBADUL,EAAQ,WAAW,GAAG,EAAIA,EAAQ,QAAQ,OAAQ,EAAE,EAAKO,EAAO,SAAW,EAAIP,EAAU,GAAGO,EAAO,GAAGP,GACtF,CACrC,CAGA,SAAgB,eAAe,EAAiC,CAC5D,IAAMC,EAAWO,EAAgB,MAAM,GAAG,CAAC,CAAC,MAAM,EAAG,EAAE,EACjDC,EAAWR,EAAS,UAAU,WAAW,EAC/C,OAAQQ,EAAW,EAAIR,EAAWA,EAAS,MAAM,EAAGQ,CAAQ,EAAA,CAAG,KAAK,GAAG,CAC3E,CAGA,SAAgB,mBAAmB,EAAyB,EAAuB,CAC/E,GAAIN,EAAK,MAAM,EAAE,CAAC,CAAC,YAAY,IAAM,QAAS,MAAO,GACrD,IAAMO,EAAS,cAAcF,CAAe,EACxCG,EAAY,MAAeD,EAAO,OAAS,CAAC,CAAC,CAAC,KAAK,EAAK,EACxDE,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