@loopstack/loopstack-studio 0.27.0 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/rolldown_runtime.js +13 -15
- package/dist/components/ai-elements/code-block.js +2 -2
- package/dist/components/dynamic-form/Form.js +49 -52
- package/dist/components/loopstack-elements/tool.js +18 -9
- package/dist/config.js +6 -0
- package/dist/features/debug/components/WorkflowFlowViewer.js +94 -81
- package/dist/features/debug/components/workflow-flow/StateNode.js +154 -79
- package/dist/features/debug/components/workflow-flow/WorkflowGraph.js +43 -31
- package/dist/features/debug/components/workflow-flow/WorkflowTransitionEdge.js +52 -51
- package/dist/features/debug/lib/edge-paths.js +45 -30
- package/dist/features/debug/lib/flow-types.js +2 -0
- package/dist/features/debug/lib/flow-utils.js +66 -64
- package/dist/features/documents/DocumentRenderer.js +2 -2
- package/dist/features/documents/components/DocumentList.js +19 -18
- package/dist/features/documents/renderers/LlmMessage.js +89 -0
- package/dist/features/workbench/WorkflowItem.js +4 -3
- package/dist/features/workbench/components/EmbedLogsContent.js +5 -0
- package/dist/features/workbench/components/PreviewEmptyState.js +10 -0
- package/dist/features/workbench/components/PreviewWorkbench.js +14 -0
- package/dist/features/workbench/components/RecentRunItem.js +48 -0
- package/dist/features/workbench/components/WorkflowForms.js +4 -3
- package/dist/features/workbench/hooks/useEmbedBridge.js +3 -0
- package/dist/features/workbench/hooks/useWorkflowData.js +9 -9
- package/dist/features/workbench/index.js +4 -0
- package/dist/features/workspaces/components/ExecutionTimeline.js +9 -8
- package/dist/loopstack-studio.css +1 -1
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{architecture-YZFGNWBL.js → architecture-7EHR7CIX.js} +2 -2
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-7N4EOEYR.js → chunk-4EGX6M5U.js} +9 -13
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-KGLVRYIC.js → chunk-5DO6E6H7.js} +3 -7
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-BR22UD5L.js +56 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-2KRD3SAO.js → chunk-FHYWG6QK.js} +3 -7
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-FOC6F5B3.js → chunk-MPE355IW.js} +3 -7
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-MZUSXYTE.js +24 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-N66VUXT2.js +48 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-NNHCCRGN.js +20219 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-PUPMXCY4.js +19 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{chunk-67CJDMHE.js → chunk-UIBZB4QT.js} +3 -7
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-WCWK7LTN.js +25 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/eventmodeling-FCH6USID.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{gitGraph-7Q5UKJZL.js → gitGraph-WXDBUCRP.js} +2 -2
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/info-J43DQDTF.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/packet-YPE3B663.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/pie-LRSECV5Y.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/radar-GUYGQ44K.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/{treeView-SZITEDCU.js → treeView-BLDUP644.js} +2 -2
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/treemap-LRROVOQU.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/wardley-L42UT6IY.js +3 -0
- package/dist/node_modules/@mermaid-js/parser/dist/mermaid-parser.core.js +24 -19
- package/dist/node_modules/@ungap/structured-clone/esm/deserialize.js +36 -26
- package/dist/node_modules/@xyflow/react/dist/esm/index.js +1 -1
- package/dist/node_modules/cytoscape/dist/cytoscape.esm.js +257 -254
- package/dist/node_modules/dagre-d3-es/src/dagre/greedy-fas.js +19 -19
- package/dist/node_modules/dagre-d3-es/src/dagre/layout.js +48 -48
- package/dist/node_modules/dagre-d3-es/src/dagre/nesting-graph.js +9 -9
- package/dist/node_modules/dagre-d3-es/src/dagre/order/cross-count.js +3 -3
- package/dist/node_modules/dagre-d3-es/src/dagre/order/index.js +11 -11
- package/dist/node_modules/dagre-d3-es/src/dagre/order/init-order.js +4 -4
- package/dist/node_modules/dagre-d3-es/src/dagre/order/resolve-conflicts.js +4 -4
- package/dist/node_modules/dagre-d3-es/src/dagre/order/sort-subgraph.js +8 -8
- package/dist/node_modules/dagre-d3-es/src/dagre/order/sort.js +5 -5
- package/dist/node_modules/dagre-d3-es/src/dagre/position/bk.js +72 -72
- package/dist/node_modules/dagre-d3-es/src/dagre/position/index.js +1 -1
- package/dist/node_modules/dagre-d3-es/src/dagre/rank/network-simplex.js +25 -25
- package/dist/node_modules/dagre-d3-es/src/dagre/rank/util.js +8 -8
- package/dist/node_modules/dagre-d3-es/src/dagre/util.js +48 -48
- package/dist/node_modules/dagre-d3-es/src/graphlib/graph.js +109 -109
- package/dist/node_modules/dagre-d3-es/src/graphlib/json.js +17 -17
- package/dist/node_modules/dompurify/dist/purify.es.js +301 -209
- package/dist/node_modules/es-toolkit/dist/_internal/globalThis.js +4 -0
- package/dist/node_modules/es-toolkit/dist/_internal/isUnsafeProperty.js +4 -0
- package/dist/node_modules/es-toolkit/dist/compat/_internal/getSymbols.js +4 -0
- package/dist/node_modules/es-toolkit/dist/compat/_internal/getTag.js +4 -0
- package/dist/node_modules/es-toolkit/dist/compat/_internal/isPrototype.js +5 -0
- package/dist/node_modules/es-toolkit/dist/compat/_internal/tags.js +2 -0
- package/dist/node_modules/es-toolkit/dist/compat/function/memoize.js +12 -0
- package/dist/node_modules/es-toolkit/dist/compat/object/clone.js +97 -0
- package/dist/node_modules/es-toolkit/dist/compat/object/cloneDeep.js +5 -0
- package/dist/node_modules/es-toolkit/dist/compat/object/cloneDeepWith.js +29 -0
- package/dist/node_modules/es-toolkit/dist/compat/object/merge.js +6 -0
- package/dist/node_modules/es-toolkit/dist/compat/object/mergeWith.js +49 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isArguments.js +5 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isArray.js +4 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isArrayLike.js +5 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isArrayLikeObject.js +6 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isEmpty.js +16 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isObjectLike.js +4 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isPlainObject.js +12 -0
- package/dist/node_modules/es-toolkit/dist/compat/predicate/isTypedArray.js +5 -0
- package/dist/node_modules/es-toolkit/dist/function/noop.js +2 -0
- package/dist/node_modules/es-toolkit/dist/object/clone.js +29 -0
- package/dist/node_modules/es-toolkit/dist/object/cloneDeepWith.js +114 -0
- package/dist/node_modules/es-toolkit/dist/predicate/isBuffer.js +5 -0
- package/dist/node_modules/es-toolkit/dist/predicate/isLength.js +4 -0
- package/dist/node_modules/es-toolkit/dist/predicate/isPrimitive.js +4 -0
- package/dist/node_modules/es-toolkit/dist/predicate/isTypedArray.js +4 -0
- package/dist/node_modules/hast-util-raw/node_modules/parse5/dist/tokenizer/index.js +2 -2
- package/dist/node_modules/internmap/src/index.js +1 -1
- package/dist/node_modules/katex/dist/katex.js +379 -417
- package/dist/node_modules/lodash-es/_arrayLikeKeys.js +3 -3
- package/dist/node_modules/lodash-es/_assignMergeValue.js +1 -1
- package/dist/node_modules/lodash-es/_assignValue.js +1 -1
- package/dist/node_modules/lodash-es/_baseClone.js +9 -9
- package/dist/node_modules/lodash-es/_baseForOwn.js +1 -1
- package/dist/node_modules/lodash-es/_baseIsEqualDeep.js +1 -1
- package/dist/node_modules/lodash-es/_baseMatchesProperty.js +6 -6
- package/dist/node_modules/lodash-es/_baseMerge.js +2 -2
- package/dist/node_modules/lodash-es/_baseMergeDeep.js +7 -7
- package/dist/node_modules/lodash-es/_baseOrderBy.js +12 -12
- package/dist/node_modules/lodash-es/_baseRest.js +1 -1
- package/dist/node_modules/lodash-es/_baseSet.js +1 -1
- package/dist/node_modules/lodash-es/_baseSetToString.js +3 -3
- package/dist/node_modules/lodash-es/_baseToString.js +2 -2
- package/dist/node_modules/lodash-es/_baseUniq.js +1 -1
- package/dist/node_modules/lodash-es/_createRange.js +1 -1
- package/dist/node_modules/lodash-es/_createSet.js +3 -3
- package/dist/node_modules/lodash-es/_flatRest.js +1 -1
- package/dist/node_modules/lodash-es/_getAllKeys.js +2 -2
- package/dist/node_modules/lodash-es/_getAllKeysIn.js +1 -1
- package/dist/node_modules/lodash-es/_getSymbolsIn.js +1 -1
- package/dist/node_modules/lodash-es/_getTag.js +1 -1
- package/dist/node_modules/lodash-es/_hasPath.js +2 -2
- package/dist/node_modules/lodash-es/_initCloneByTag.js +1 -1
- package/dist/node_modules/lodash-es/_initCloneObject.js +1 -1
- package/dist/node_modules/lodash-es/_isFlattenable.js +1 -1
- package/dist/node_modules/lodash-es/_isIterateeCall.js +1 -1
- package/dist/node_modules/lodash-es/_isKey.js +1 -1
- package/dist/node_modules/lodash-es/_setToString.js +1 -1
- package/dist/node_modules/lodash-es/defaults.js +1 -1
- package/dist/node_modules/lodash-es/findIndex.js +2 -2
- package/dist/node_modules/lodash-es/forEach.js +1 -1
- package/dist/node_modules/lodash-es/forIn.js +1 -1
- package/dist/node_modules/lodash-es/isEmpty.js +2 -2
- package/dist/node_modules/lodash-es/isPlainObject.js +1 -1
- package/dist/node_modules/lodash-es/map.js +1 -1
- package/dist/node_modules/lodash-es/max.js +1 -1
- package/dist/node_modules/lodash-es/merge.js +3 -3
- package/dist/node_modules/lodash-es/min.js +1 -1
- package/dist/node_modules/lodash-es/minBy.js +1 -1
- package/dist/node_modules/lodash-es/reduce.js +1 -1
- package/dist/node_modules/lodash-es/toNumber.js +1 -1
- package/dist/node_modules/lodash-es/union.js +3 -3
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{architectureDiagram-Q4EWVU46.js → architectureDiagram-3BPJPVTR.js} +310 -308
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{blockDiagram-DXYQGD6D.js → blockDiagram-GPEHLZMM.js} +215 -190
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{c4Diagram-AHTNJAMY.js → c4Diagram-AAUBKEIU.js} +3 -3
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-EDXVE4YY.js → chunk-2J33WTMH.js} +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-5FUZZQ4R.js → chunk-3OPIFGDE.js} +48 -20
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-5PVQY5BW.js → chunk-5ZQYHXKU.js} +8 -8
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-4TB4RGXK.js → chunk-727SXJPM.js} +555 -459
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-OYMX7WX6.js → chunk-AQP2D5EJ.js} +155 -145
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-ICPOFSXX.js → chunk-CSCIHK7Q.js} +106 -12
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-ENJZ2VHE.js → chunk-KSCS5N6A.js} +12 -12
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-ZZ45TVLE.js → chunk-L5ZTLDWV.js} +2 -2
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-336JU56O.js → chunk-LZXEDZCA.js} +5 -5
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-YZCP3GAM.js → chunk-ND2GUHAM.js} +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-X2U36JSP.js → chunk-NZK2D7GU.js} +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-U2HBQHQK.js → chunk-O5CBEL6O.js} +2 -2
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{chunk-426QAEUC.js → chunk-WU5MYG2G.js} +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{classDiagram-6PBFFD2Q.js → classDiagram-4FO5ZUOK.js} +11 -11
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{classDiagram-v2-HSJHXN6E.js → classDiagram-v2-Q7XG4LA2.js} +11 -11
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{dagre-KV5264BT.js → dagre-BM42HDAG.js} +8 -8
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{diagram-MMDJMWI5.js → diagram-2AECGRRQ.js} +3 -3
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{diagram-5BDNPKRD.js → diagram-5GNKFQAL.js} +3 -3
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/diagram-KO2AKTUF.js +433 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{diagram-TYMM5635.js → diagram-LMA3HP47.js} +3 -3
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{diagram-G4DWMVQ6.js → diagram-OG6HWLK6.js} +5 -5
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{erDiagram-SMLLAGMA.js → erDiagram-TEJ5UH35.js} +9 -9
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{flowDiagram-DWJPFMVM.js → flowDiagram-I6XJVG4X.js} +10 -10
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{ganttDiagram-T4ZO3ILL.js → ganttDiagram-6RSMTGT7.js} +7 -4
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{gitGraphDiagram-UUTBAWPF.js → gitGraphDiagram-PVQCEYII.js} +2 -2
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{infoDiagram-42DDH7IO.js → infoDiagram-5YYISTIA.js} +3 -3
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{ishikawaDiagram-UXIWVN3A.js → ishikawaDiagram-YF4QCWOH.js} +3 -3
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{journeyDiagram-VCZTEJTY.js → journeyDiagram-JHISSGLW.js} +2 -2
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{kanban-definition-6JOO6SKY.js → kanban-definition-UN3LZRKU.js} +7 -7
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{mindmap-definition-QFDTVHPH.js → mindmap-definition-RKZ34NQL.js} +9 -9
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{pieDiagram-DEJITSTG.js → pieDiagram-4H26LBE5.js} +3 -3
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{quadrantDiagram-34T5L4WZ.js → quadrantDiagram-W4KKPZXB.js} +364 -337
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{requirementDiagram-MS252O5E.js → requirementDiagram-4Y6WPE33.js} +9 -9
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{sankeyDiagram-XADWPNL6.js → sankeyDiagram-5OEKKPKP.js} +187 -138
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{sequenceDiagram-FGHM5R23.js → sequenceDiagram-3UESZ5HK.js} +15 -8
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{stateDiagram-FHFEXIEX.js → stateDiagram-AJRCARHV.js} +10 -10
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{stateDiagram-v2-QKLJ7IA2.js → stateDiagram-v2-BHNVJYJU.js} +10 -10
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{timeline-definition-GMOUNBTQ.js → timeline-definition-PNZ67QCA.js} +3 -3
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{vennDiagram-DHZGUBPP.js → vennDiagram-CIIHVFJN.js} +3 -3
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/wardleyDiagram-YWT4CUSO.js +640 -0
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/{xychartDiagram-5P7HB3ND.js → xychartDiagram-2RQKCTM6.js} +4 -4
- package/dist/node_modules/mermaid/dist/mermaid.core.js +96 -70
- package/dist/node_modules/stylis/src/Enum.js +2 -2
- package/dist/node_modules/stylis/src/Middleware.js +9 -0
- package/dist/node_modules/stylis/src/Parser.js +55 -44
- package/dist/node_modules/stylis/src/Utility.js +9 -12
- package/dist/node_modules/unified/lib/index.js +1 -1
- package/dist/packages/contracts/dist/enums/index.js +4 -24
- package/dist/packages/contracts/dist/enums/registry.enum.js +9 -20
- package/dist/packages/contracts/dist/enums/sort-order.enum.js +5 -10
- package/dist/packages/contracts/dist/enums/user-type.enum.js +5 -10
- package/dist/packages/contracts/dist/enums/workflow-state.enum.js +5 -10
- package/dist/pages/EmbedWorkbenchPage.js +4 -3
- package/dist/pages/PreviewWorkbenchPage.js +126 -124
- package/dist/pages/StudioLandingPage.js +28 -72
- package/package.json +2 -2
- package/dist/features/documents/renderers/ClaudeMessage.js +0 -96
- package/dist/node_modules/@chevrotain/gast/lib/src/helpers.js +0 -23
- package/dist/node_modules/@chevrotain/gast/lib/src/model.js +0 -151
- package/dist/node_modules/@chevrotain/gast/lib/src/visitor.js +0 -40
- package/dist/node_modules/@chevrotain/regexp-to-ast/lib/src/api.js +0 -2
- package/dist/node_modules/@chevrotain/regexp-to-ast/lib/src/base-regexp-visitor.js +0 -85
- package/dist/node_modules/@chevrotain/regexp-to-ast/lib/src/character-classes.js +0 -35
- package/dist/node_modules/@chevrotain/regexp-to-ast/lib/src/regexp-parser.js +0 -570
- package/dist/node_modules/@chevrotain/regexp-to-ast/lib/src/utils.js +0 -25
- package/dist/node_modules/@chevrotain/utils/lib/src/print.js +0 -9
- package/dist/node_modules/@chevrotain/utils/lib/src/timer.js +0 -8
- package/dist/node_modules/@chevrotain/utils/lib/src/to-fast-properties.js +0 -10
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-AA7GKIK3.js +0 -28
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-CIAEETIT.js +0 -23
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-K5T4RW27.js +0 -1197
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-LIHQZDEY.js +0 -60
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/chunk-ORNJ4GCN.js +0 -29
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/info-OMHHGYJF.js +0 -3
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/packet-4T2RLAQJ.js +0 -3
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/pie-ZZUOXDRM.js +0 -3
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/radar-PYXPWWZC.js +0 -3
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/treemap-W4RFUUIX.js +0 -3
- package/dist/node_modules/@mermaid-js/parser/dist/chunks/mermaid-parser.core/wardley-RL74JXVD.js +0 -3
- package/dist/node_modules/chevrotain/lib/src/api.js +0 -10
- package/dist/node_modules/chevrotain/lib/src/lang/lang_extensions.js +0 -10
- package/dist/node_modules/chevrotain/lib/src/parse/constants.js +0 -2
- package/dist/node_modules/chevrotain/lib/src/parse/cst/cst.js +0 -13
- package/dist/node_modules/chevrotain/lib/src/parse/cst/cst_visitor.js +0 -49
- package/dist/node_modules/chevrotain/lib/src/parse/errors_public.js +0 -77
- package/dist/node_modules/chevrotain/lib/src/parse/exceptions_public.js +0 -33
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/checks.js +0 -275
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/first.js +0 -23
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/follow.js +0 -28
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/gast/gast_resolver_public.js +0 -14
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/interpreter.js +0 -262
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/keys.js +0 -5
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/llk_lookahead.js +0 -41
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/lookahead.js +0 -241
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/resolver.js +0 -30
- package/dist/node_modules/chevrotain/lib/src/parse/grammar/rest.js +0 -56
- package/dist/node_modules/chevrotain/lib/src/parse/parser/parser.js +0 -114
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/error_handler.js +0 -46
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/gast_recorder.js +0 -166
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/lexer_adapter.js +0 -43
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/looksahead.js +0 -107
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/perf_tracer.js +0 -21
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_api.js +0 -312
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/recognizer_engine.js +0 -285
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/recoverable.js +0 -144
- package/dist/node_modules/chevrotain/lib/src/parse/parser/traits/tree_builder.js +0 -92
- package/dist/node_modules/chevrotain/lib/src/parse/parser/utils/apply_mixins.js +0 -11
- package/dist/node_modules/chevrotain/lib/src/scan/lexer.js +0 -437
- package/dist/node_modules/chevrotain/lib/src/scan/lexer_errors_public.js +0 -9
- package/dist/node_modules/chevrotain/lib/src/scan/lexer_public.js +0 -253
- package/dist/node_modules/chevrotain/lib/src/scan/reg_exp.js +0 -152
- package/dist/node_modules/chevrotain/lib/src/scan/reg_exp_parser.js +0 -15
- package/dist/node_modules/chevrotain/lib/src/scan/tokens.js +0 -65
- package/dist/node_modules/chevrotain/lib/src/scan/tokens_public.js +0 -39
- package/dist/node_modules/chevrotain-allstar/lib/all-star-lookahead.js +0 -346
- package/dist/node_modules/chevrotain-allstar/lib/atn.js +0 -194
- package/dist/node_modules/chevrotain-allstar/lib/dfa.js +0 -32
- package/dist/node_modules/chevrotain-allstar/lib/index.js +0 -1
- package/dist/node_modules/langium/lib/default-module.js +0 -85
- package/dist/node_modules/langium/lib/dependency-injection.js +0 -62
- package/dist/node_modules/langium/lib/documentation/comment-provider.js +0 -11
- package/dist/node_modules/langium/lib/documentation/documentation-provider.js +0 -36
- package/dist/node_modules/langium/lib/documentation/jsdoc.js +0 -303
- package/dist/node_modules/langium/lib/index.js +0 -182
- package/dist/node_modules/langium/lib/languages/generated/ast.js +0 -1089
- package/dist/node_modules/langium/lib/languages/grammar-config.js +0 -13
- package/dist/node_modules/langium/lib/parser/async-parser.js +0 -83
- package/dist/node_modules/langium/lib/parser/completion-parser-builder.js +0 -7
- package/dist/node_modules/langium/lib/parser/cst-node-builder.js +0 -160
- package/dist/node_modules/langium/lib/parser/indentation-aware.js +0 -141
- package/dist/node_modules/langium/lib/parser/langium-parser-builder.js +0 -11
- package/dist/node_modules/langium/lib/parser/langium-parser.js +0 -388
- package/dist/node_modules/langium/lib/parser/lexer.js +0 -50
- package/dist/node_modules/langium/lib/parser/parser-builder-base.js +0 -275
- package/dist/node_modules/langium/lib/parser/token-builder.js +0 -61
- package/dist/node_modules/langium/lib/parser/value-converter.js +0 -78
- package/dist/node_modules/langium/lib/references/linker.js +0 -190
- package/dist/node_modules/langium/lib/references/name-provider.js +0 -13
- package/dist/node_modules/langium/lib/references/references.js +0 -76
- package/dist/node_modules/langium/lib/references/scope-computation.js +0 -35
- package/dist/node_modules/langium/lib/references/scope-provider.js +0 -34
- package/dist/node_modules/langium/lib/references/scope.js +0 -73
- package/dist/node_modules/langium/lib/serializer/hydrator.js +0 -125
- package/dist/node_modules/langium/lib/serializer/json-serializer.js +0 -145
- package/dist/node_modules/langium/lib/service-registry.js +0 -37
- package/dist/node_modules/langium/lib/syntax-tree.js +0 -70
- package/dist/node_modules/langium/lib/utils/ast-utils.js +0 -157
- package/dist/node_modules/langium/lib/utils/caching.js +0 -91
- package/dist/node_modules/langium/lib/utils/cancellation.js +0 -5
- package/dist/node_modules/langium/lib/utils/collections.js +0 -85
- package/dist/node_modules/langium/lib/utils/cst-utils.js +0 -190
- package/dist/node_modules/langium/lib/utils/disposable.js +0 -8
- package/dist/node_modules/langium/lib/utils/errors.js +0 -12
- package/dist/node_modules/langium/lib/utils/event.js +0 -5
- package/dist/node_modules/langium/lib/utils/grammar-loader.js +0 -22
- package/dist/node_modules/langium/lib/utils/grammar-utils.js +0 -296
- package/dist/node_modules/langium/lib/utils/index.js +0 -53
- package/dist/node_modules/langium/lib/utils/promise-utils.js +0 -30
- package/dist/node_modules/langium/lib/utils/regexp-utils.js +0 -167
- package/dist/node_modules/langium/lib/utils/stream.js +0 -327
- package/dist/node_modules/langium/lib/utils/uri-utils.js +0 -107
- package/dist/node_modules/langium/lib/validation/document-validator.js +0 -210
- package/dist/node_modules/langium/lib/validation/validation-registry.js +0 -87
- package/dist/node_modules/langium/lib/workspace/ast-descriptions.js +0 -57
- package/dist/node_modules/langium/lib/workspace/ast-node-locator.js +0 -28
- package/dist/node_modules/langium/lib/workspace/configuration.js +0 -51
- package/dist/node_modules/langium/lib/workspace/document-builder.js +0 -201
- package/dist/node_modules/langium/lib/workspace/documents.js +0 -142
- package/dist/node_modules/langium/lib/workspace/file-system-provider.js +0 -34
- package/dist/node_modules/langium/lib/workspace/index-manager.js +0 -49
- package/dist/node_modules/langium/lib/workspace/profiler.js +0 -89
- package/dist/node_modules/langium/lib/workspace/workspace-lock.js +0 -42
- package/dist/node_modules/langium/lib/workspace/workspace-manager.js +0 -66
- package/dist/node_modules/lodash-es/flatMap.js +0 -7
- package/dist/node_modules/lodash-es/uniqBy.js +0 -7
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/wardleyDiagram-NUSXRM2D.js +0 -574
- package/dist/node_modules/vscode-jsonrpc/browser.js +0 -7
- package/dist/node_modules/vscode-jsonrpc/lib/browser/main.js +0 -52
- package/dist/node_modules/vscode-jsonrpc/lib/browser/ril.js +0 -120
- package/dist/node_modules/vscode-jsonrpc/lib/common/api.js +0 -337
- package/dist/node_modules/vscode-jsonrpc/lib/common/cancellation.js +0 -57
- package/dist/node_modules/vscode-jsonrpc/lib/common/connection.js +0 -647
- package/dist/node_modules/vscode-jsonrpc/lib/common/disposable.js +0 -13
- package/dist/node_modules/vscode-jsonrpc/lib/common/events.js +0 -64
- package/dist/node_modules/vscode-jsonrpc/lib/common/is.js +0 -34
- package/dist/node_modules/vscode-jsonrpc/lib/common/linkedMap.js +0 -235
- package/dist/node_modules/vscode-jsonrpc/lib/common/messageBuffer.js +0 -93
- package/dist/node_modules/vscode-jsonrpc/lib/common/messageReader.js +0 -129
- package/dist/node_modules/vscode-jsonrpc/lib/common/messageWriter.js +0 -85
- package/dist/node_modules/vscode-jsonrpc/lib/common/messages.js +0 -161
- package/dist/node_modules/vscode-jsonrpc/lib/common/ral.js +0 -18
- package/dist/node_modules/vscode-jsonrpc/lib/common/semaphore.js +0 -44
- package/dist/node_modules/vscode-jsonrpc/lib/common/sharedArrayCancellation.js +0 -58
- package/dist/node_modules/vscode-languageserver-protocol/lib/browser/main.js +0 -28
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/api.js +0 -36
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/connection.js +0 -12
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/messages.js +0 -31
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.callHierarchy.js +0 -19
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.colorProvider.js +0 -15
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.configuration.js +0 -11
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.declaration.js +0 -11
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.diagnostic.js +0 -33
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.fileOperations.js +0 -35
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.foldingRange.js +0 -15
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.implementation.js +0 -11
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlayHint.js +0 -19
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineCompletion.js +0 -11
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineValue.js +0 -15
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.js +0 -674
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.linkedEditingRange.js +0 -11
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.moniker.js +0 -19
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.notebook.js +0 -126
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.progress.js +0 -24
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.selectionRange.js +0 -11
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.semanticTokens.js +0 -31
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.showDocument.js +0 -11
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.typeDefinition.js +0 -11
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.typeHierarchy.js +0 -19
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/protocol.workspaceFolder.js +0 -15
- package/dist/node_modules/vscode-languageserver-protocol/lib/common/utils/is.js +0 -42
- package/dist/node_modules/vscode-languageserver-textdocument/lib/esm/main.js +0 -138
- package/dist/node_modules/vscode-languageserver-types/lib/esm/main.js +0 -1084
- package/dist/node_modules/vscode-uri/lib/esm/index.js +0 -373
- /package/dist/node_modules/{entities → hast-util-raw/node_modules/entities}/dist/esm/decode-codepoint.js +0 -0
- /package/dist/node_modules/{entities → hast-util-raw/node_modules/entities}/dist/esm/decode.js +0 -0
- /package/dist/node_modules/{entities → hast-util-raw/node_modules/entities}/dist/esm/generated/decode-data-html.js +0 -0
- /package/dist/node_modules/{unified/node_modules/is-plain-obj → is-plain-obj}/index.js +0 -0
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { streamAllContents, streamContents } from "../utils/ast-utils.js";
|
|
2
|
-
import { cancellation_exports } from "../utils/cancellation.js";
|
|
3
|
-
import { interruptAndCheck } from "../utils/promise-utils.js";
|
|
4
|
-
import { MultiMap } from "../utils/collections.js";
|
|
5
|
-
var DefaultScopeComputation = class {
|
|
6
|
-
constructor(e) {
|
|
7
|
-
this.nameProvider = e.references.NameProvider, this.descriptions = e.workspace.AstNodeDescriptionProvider;
|
|
8
|
-
}
|
|
9
|
-
async collectExportedSymbols(e, t = cancellation_exports.CancellationToken.None) {
|
|
10
|
-
return this.collectExportedSymbolsForNode(e.parseResult.value, e, void 0, t);
|
|
11
|
-
}
|
|
12
|
-
async collectExportedSymbolsForNode(e, i, a = streamContents, o = cancellation_exports.CancellationToken.None) {
|
|
13
|
-
let s = [];
|
|
14
|
-
this.addExportedSymbol(e, s, i);
|
|
15
|
-
for (let t of a(e)) await interruptAndCheck(o), this.addExportedSymbol(t, s, i);
|
|
16
|
-
return s;
|
|
17
|
-
}
|
|
18
|
-
addExportedSymbol(e, t, n) {
|
|
19
|
-
let r = this.nameProvider.getName(e);
|
|
20
|
-
r && t.push(this.descriptions.createDescription(e, r, n));
|
|
21
|
-
}
|
|
22
|
-
async collectLocalSymbols(t, a = cancellation_exports.CancellationToken.None) {
|
|
23
|
-
let o = t.parseResult.value, s = new MultiMap();
|
|
24
|
-
for (let n of streamAllContents(o)) await interruptAndCheck(a), this.addLocalSymbol(n, t, s);
|
|
25
|
-
return s;
|
|
26
|
-
}
|
|
27
|
-
addLocalSymbol(e, t, n) {
|
|
28
|
-
let r = e.$container;
|
|
29
|
-
if (r) {
|
|
30
|
-
let i = this.nameProvider.getName(e);
|
|
31
|
-
i && n.add(r, this.descriptions.createDescription(e, i, t));
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
export { DefaultScopeComputation };
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { stream } from "../utils/stream.js";
|
|
2
|
-
import { getDocument } from "../utils/ast-utils.js";
|
|
3
|
-
import { MultiMapScope, StreamScope } from "./scope.js";
|
|
4
|
-
import { WorkspaceCache } from "../utils/caching.js";
|
|
5
|
-
var DefaultScopeProvider = class {
|
|
6
|
-
constructor(e) {
|
|
7
|
-
this.reflection = e.shared.AstReflection, this.nameProvider = e.references.NameProvider, this.descriptions = e.workspace.AstNodeDescriptionProvider, this.indexManager = e.shared.workspace.IndexManager, this.globalScopeCache = new WorkspaceCache(e.shared);
|
|
8
|
-
}
|
|
9
|
-
getScope(e) {
|
|
10
|
-
let n = [], r = this.reflection.getReferenceType(e), i = getDocument(e.container).localSymbols;
|
|
11
|
-
if (i) {
|
|
12
|
-
let t = e.container;
|
|
13
|
-
do
|
|
14
|
-
i.has(t) && n.push(i.getStream(t).filter((e) => this.reflection.isSubtype(e.type, r))), t = t.$container;
|
|
15
|
-
while (t);
|
|
16
|
-
}
|
|
17
|
-
let a = this.getGlobalScope(r, e);
|
|
18
|
-
for (let e = n.length - 1; e >= 0; e--) a = this.createScope(n[e], a);
|
|
19
|
-
return a;
|
|
20
|
-
}
|
|
21
|
-
createScope(t, n, i) {
|
|
22
|
-
return new StreamScope(stream(t), n, i);
|
|
23
|
-
}
|
|
24
|
-
createScopeForNodes(t, n, i) {
|
|
25
|
-
return new StreamScope(stream(t).map((e) => {
|
|
26
|
-
let t = this.nameProvider.getName(e);
|
|
27
|
-
if (t) return this.descriptions.createDescription(e, t);
|
|
28
|
-
}).nonNullable(), n, i);
|
|
29
|
-
}
|
|
30
|
-
getGlobalScope(e, t) {
|
|
31
|
-
return this.globalScopeCache.get(e, () => new MultiMapScope(this.indexManager.allElements(e)));
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
export { DefaultScopeProvider };
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { EMPTY_STREAM, stream } from "../utils/stream.js";
|
|
2
|
-
import { MultiMap } from "../utils/collections.js";
|
|
3
|
-
var StreamScope = class {
|
|
4
|
-
constructor(e, r, i) {
|
|
5
|
-
this.elements = e, this.outerScope = r, this.caseInsensitive = i?.caseInsensitive ?? !1, this.concatOuterScope = i?.concatOuterScope ?? !0;
|
|
6
|
-
}
|
|
7
|
-
getAllElements() {
|
|
8
|
-
return this.outerScope ? this.elements.concat(this.outerScope.getAllElements()) : this.elements;
|
|
9
|
-
}
|
|
10
|
-
getElement(e) {
|
|
11
|
-
let r = this.caseInsensitive ? e.toLowerCase() : e, i = this.caseInsensitive ? this.elements.find((e) => e.name.toLowerCase() === r) : this.elements.find((r) => r.name === e);
|
|
12
|
-
if (i) return i;
|
|
13
|
-
if (this.outerScope) return this.outerScope.getElement(e);
|
|
14
|
-
}
|
|
15
|
-
getElements(e) {
|
|
16
|
-
let r = this.caseInsensitive ? e.toLowerCase() : e, i = this.caseInsensitive ? this.elements.filter((e) => e.name.toLowerCase() === r) : this.elements.filter((r) => r.name === e);
|
|
17
|
-
return (this.concatOuterScope || i.isEmpty()) && this.outerScope ? i.concat(this.outerScope.getElements(e)) : i;
|
|
18
|
-
}
|
|
19
|
-
}, MapScope = class {
|
|
20
|
-
constructor(e, r, i) {
|
|
21
|
-
this.elements = /* @__PURE__ */ new Map(), this.caseInsensitive = i?.caseInsensitive ?? !1, this.concatOuterScope = i?.concatOuterScope ?? !0;
|
|
22
|
-
for (let r of e) {
|
|
23
|
-
let e = this.caseInsensitive ? r.name.toLowerCase() : r.name;
|
|
24
|
-
this.elements.set(e, r);
|
|
25
|
-
}
|
|
26
|
-
this.outerScope = r;
|
|
27
|
-
}
|
|
28
|
-
getElement(e) {
|
|
29
|
-
let r = this.caseInsensitive ? e.toLowerCase() : e, i = this.elements.get(r);
|
|
30
|
-
if (i) return i;
|
|
31
|
-
if (this.outerScope) return this.outerScope.getElement(e);
|
|
32
|
-
}
|
|
33
|
-
getElements(e) {
|
|
34
|
-
let i = this.caseInsensitive ? e.toLowerCase() : e, a = this.elements.get(i), o = a ? [a] : [];
|
|
35
|
-
return (this.concatOuterScope || o.length > 0) && this.outerScope ? stream(o).concat(this.outerScope.getElements(e)) : stream(o);
|
|
36
|
-
}
|
|
37
|
-
getAllElements() {
|
|
38
|
-
let e = stream(this.elements.values());
|
|
39
|
-
return this.outerScope && (e = e.concat(this.outerScope.getAllElements())), e;
|
|
40
|
-
}
|
|
41
|
-
}, MultiMapScope = class {
|
|
42
|
-
constructor(e, r, a) {
|
|
43
|
-
this.elements = new MultiMap(), this.caseInsensitive = a?.caseInsensitive ?? !1, this.concatOuterScope = a?.concatOuterScope ?? !0;
|
|
44
|
-
for (let r of e) {
|
|
45
|
-
let e = this.caseInsensitive ? r.name.toLowerCase() : r.name;
|
|
46
|
-
this.elements.add(e, r);
|
|
47
|
-
}
|
|
48
|
-
this.outerScope = r;
|
|
49
|
-
}
|
|
50
|
-
getElement(e) {
|
|
51
|
-
let r = this.caseInsensitive ? e.toLowerCase() : e, i = this.elements.get(r)[0];
|
|
52
|
-
if (i) return i;
|
|
53
|
-
if (this.outerScope) return this.outerScope.getElement(e);
|
|
54
|
-
}
|
|
55
|
-
getElements(e) {
|
|
56
|
-
let i = this.caseInsensitive ? e.toLowerCase() : e, a = this.elements.get(i);
|
|
57
|
-
return (this.concatOuterScope || a.length === 0) && this.outerScope ? stream(a).concat(this.outerScope.getElements(e)) : stream(a);
|
|
58
|
-
}
|
|
59
|
-
getAllElements() {
|
|
60
|
-
let e = stream(this.elements.values());
|
|
61
|
-
return this.outerScope && (e = e.concat(this.outerScope.getAllElements())), e;
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
const EMPTY_SCOPE = {
|
|
65
|
-
getElement() {},
|
|
66
|
-
getElements() {
|
|
67
|
-
return EMPTY_STREAM;
|
|
68
|
-
},
|
|
69
|
-
getAllElements() {
|
|
70
|
-
return EMPTY_STREAM;
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
export { EMPTY_SCOPE, MapScope, MultiMapScope, StreamScope };
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import { isAstNode, isCompositeCstNode, isLeafCstNode, isReference, isRootCstNode } from "../syntax-tree.js";
|
|
2
|
-
import { streamAst } from "../utils/ast-utils.js";
|
|
3
|
-
import { isAbstractElement } from "../languages/generated/ast.js";
|
|
4
|
-
import { streamCst } from "../utils/cst-utils.js";
|
|
5
|
-
import { CompositeCstNodeImpl, LeafCstNodeImpl, RootCstNodeImpl } from "../parser/cst-node-builder.js";
|
|
6
|
-
import { BiMap } from "../utils/collections.js";
|
|
7
|
-
var DefaultHydrator = class {
|
|
8
|
-
constructor(e) {
|
|
9
|
-
this.grammarElementIdMap = new BiMap(), this.tokenTypeIdMap = new BiMap(), this.grammar = e.Grammar, this.lexer = e.parser.Lexer, this.linker = e.references.Linker;
|
|
10
|
-
}
|
|
11
|
-
dehydrate(e) {
|
|
12
|
-
return {
|
|
13
|
-
lexerErrors: e.lexerErrors,
|
|
14
|
-
lexerReport: e.lexerReport ? this.dehydrateLexerReport(e.lexerReport) : void 0,
|
|
15
|
-
parserErrors: e.parserErrors.map((e) => ({
|
|
16
|
-
...e,
|
|
17
|
-
message: e.message
|
|
18
|
-
})),
|
|
19
|
-
value: this.dehydrateAstNode(e.value, this.createDehyrationContext(e.value))
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
dehydrateLexerReport(e) {
|
|
23
|
-
return e;
|
|
24
|
-
}
|
|
25
|
-
createDehyrationContext(e) {
|
|
26
|
-
let a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
|
|
27
|
-
for (let o of streamAst(e)) a.set(o, {});
|
|
28
|
-
if (e.$cstNode) for (let a of streamCst(e.$cstNode)) o.set(a, {});
|
|
29
|
-
return {
|
|
30
|
-
astNodes: a,
|
|
31
|
-
cstNodes: o
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
dehydrateAstNode(a, o) {
|
|
35
|
-
let c = o.astNodes.get(a);
|
|
36
|
-
c.$type = a.$type, c.$containerIndex = a.$containerIndex, c.$containerProperty = a.$containerProperty, a.$cstNode !== void 0 && (c.$cstNode = this.dehydrateCstNode(a.$cstNode, o));
|
|
37
|
-
for (let [l, u] of Object.entries(a)) if (!l.startsWith("$")) if (Array.isArray(u)) {
|
|
38
|
-
let a = [];
|
|
39
|
-
c[l] = a;
|
|
40
|
-
for (let c of u) isAstNode(c) ? a.push(this.dehydrateAstNode(c, o)) : isReference(c) ? a.push(this.dehydrateReference(c, o)) : a.push(c);
|
|
41
|
-
} else isAstNode(u) ? c[l] = this.dehydrateAstNode(u, o) : isReference(u) ? c[l] = this.dehydrateReference(u, o) : u !== void 0 && (c[l] = u);
|
|
42
|
-
return c;
|
|
43
|
-
}
|
|
44
|
-
dehydrateReference(e, a) {
|
|
45
|
-
let o = {};
|
|
46
|
-
return o.$refText = e.$refText, e.$refNode && (o.$refNode = a.cstNodes.get(e.$refNode)), o;
|
|
47
|
-
}
|
|
48
|
-
dehydrateCstNode(e, s) {
|
|
49
|
-
let l = s.cstNodes.get(e);
|
|
50
|
-
return isRootCstNode(e) ? l.fullText = e.fullText : l.grammarSource = this.getGrammarElementId(e.grammarSource), l.hidden = e.hidden, l.astNode = s.astNodes.get(e.astNode), isCompositeCstNode(e) ? l.content = e.content.map((e) => this.dehydrateCstNode(e, s)) : isLeafCstNode(e) && (l.tokenType = e.tokenType.name, l.offset = e.offset, l.length = e.length, l.startLine = e.range.start.line, l.startColumn = e.range.start.character, l.endLine = e.range.end.line, l.endColumn = e.range.end.character), l;
|
|
51
|
-
}
|
|
52
|
-
hydrate(e) {
|
|
53
|
-
let a = e.value, o = this.createHydrationContext(a);
|
|
54
|
-
return "$cstNode" in a && this.hydrateCstNode(a.$cstNode, o), {
|
|
55
|
-
lexerErrors: e.lexerErrors,
|
|
56
|
-
lexerReport: e.lexerReport,
|
|
57
|
-
parserErrors: e.parserErrors,
|
|
58
|
-
value: this.hydrateAstNode(a, o)
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
createHydrationContext(e) {
|
|
62
|
-
let a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
|
|
63
|
-
for (let o of streamAst(e)) a.set(o, {});
|
|
64
|
-
let s;
|
|
65
|
-
if (e.$cstNode) for (let a of streamCst(e.$cstNode)) {
|
|
66
|
-
let e;
|
|
67
|
-
"fullText" in a ? (e = new RootCstNodeImpl(a.fullText), s = e) : "content" in a ? e = new CompositeCstNodeImpl() : "tokenType" in a && (e = this.hydrateCstLeafNode(a)), e && (o.set(a, e), e.root = s);
|
|
68
|
-
}
|
|
69
|
-
return {
|
|
70
|
-
astNodes: a,
|
|
71
|
-
cstNodes: o
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
hydrateAstNode(a, o) {
|
|
75
|
-
let c = o.astNodes.get(a);
|
|
76
|
-
c.$type = a.$type, c.$containerIndex = a.$containerIndex, c.$containerProperty = a.$containerProperty, a.$cstNode && (c.$cstNode = o.cstNodes.get(a.$cstNode));
|
|
77
|
-
for (let [l, u] of Object.entries(a)) if (!l.startsWith("$")) if (Array.isArray(u)) {
|
|
78
|
-
let a = [];
|
|
79
|
-
c[l] = a;
|
|
80
|
-
for (let d of u) isAstNode(d) ? a.push(this.setParent(this.hydrateAstNode(d, o), c)) : isReference(d) ? a.push(this.hydrateReference(d, c, l, o)) : a.push(d);
|
|
81
|
-
} else isAstNode(u) ? c[l] = this.setParent(this.hydrateAstNode(u, o), c) : isReference(u) ? c[l] = this.hydrateReference(u, c, l, o) : u !== void 0 && (c[l] = u);
|
|
82
|
-
return c;
|
|
83
|
-
}
|
|
84
|
-
setParent(e, a) {
|
|
85
|
-
return e.$container = a, e;
|
|
86
|
-
}
|
|
87
|
-
hydrateReference(e, a, o, s) {
|
|
88
|
-
return this.linker.buildReference(a, o, s.cstNodes.get(e.$refNode), e.$refText);
|
|
89
|
-
}
|
|
90
|
-
hydrateCstNode(e, o, s = 0) {
|
|
91
|
-
let c = o.cstNodes.get(e);
|
|
92
|
-
if (typeof e.grammarSource == "number" && (c.grammarSource = this.getGrammarElement(e.grammarSource)), c.astNode = o.astNodes.get(e.astNode), isCompositeCstNode(c)) for (let a of e.content) {
|
|
93
|
-
let e = this.hydrateCstNode(a, o, s++);
|
|
94
|
-
c.content.push(e);
|
|
95
|
-
}
|
|
96
|
-
return c;
|
|
97
|
-
}
|
|
98
|
-
hydrateCstLeafNode(e) {
|
|
99
|
-
let a = this.getTokenType(e.tokenType), o = e.offset, s = e.length, c = e.startLine, l = e.startColumn, u = e.endLine, d = e.endColumn, f = e.hidden;
|
|
100
|
-
return new LeafCstNodeImpl(o, s, {
|
|
101
|
-
start: {
|
|
102
|
-
line: c,
|
|
103
|
-
character: l
|
|
104
|
-
},
|
|
105
|
-
end: {
|
|
106
|
-
line: u,
|
|
107
|
-
character: d
|
|
108
|
-
}
|
|
109
|
-
}, a, f);
|
|
110
|
-
}
|
|
111
|
-
getTokenType(e) {
|
|
112
|
-
return this.lexer.definition[e];
|
|
113
|
-
}
|
|
114
|
-
getGrammarElementId(e) {
|
|
115
|
-
if (e) return this.grammarElementIdMap.size === 0 && this.createGrammarElementIdMap(), this.grammarElementIdMap.get(e);
|
|
116
|
-
}
|
|
117
|
-
getGrammarElement(e) {
|
|
118
|
-
return this.grammarElementIdMap.size === 0 && this.createGrammarElementIdMap(), this.grammarElementIdMap.getKey(e);
|
|
119
|
-
}
|
|
120
|
-
createGrammarElementIdMap() {
|
|
121
|
-
let e = 0;
|
|
122
|
-
for (let a of streamAst(this.grammar)) isAbstractElement(a) && this.grammarElementIdMap.set(a, e++);
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
export { DefaultHydrator };
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import { isAstNode, isMultiReference, isReference } from "../syntax-tree.js";
|
|
2
|
-
import { getDocument } from "../utils/ast-utils.js";
|
|
3
|
-
import { findNodesForProperty } from "../utils/grammar-utils.js";
|
|
4
|
-
import { URI } from "../../../vscode-uri/lib/esm/index.js";
|
|
5
|
-
function isAstNodeWithComment(e) {
|
|
6
|
-
return typeof e.$comment == "string";
|
|
7
|
-
}
|
|
8
|
-
function isIntermediateReference(e) {
|
|
9
|
-
return typeof e == "object" && !!e && ("$ref" in e || "$error" in e);
|
|
10
|
-
}
|
|
11
|
-
var DefaultJsonSerializer = class {
|
|
12
|
-
constructor(e) {
|
|
13
|
-
this.ignoreProperties = new Set([
|
|
14
|
-
"$container",
|
|
15
|
-
"$containerProperty",
|
|
16
|
-
"$containerIndex",
|
|
17
|
-
"$document",
|
|
18
|
-
"$cstNode"
|
|
19
|
-
]), this.langiumDocuments = e.shared.workspace.LangiumDocuments, this.astNodeLocator = e.workspace.AstNodeLocator, this.nameProvider = e.references.NameProvider, this.commentProvider = e.documentation.CommentProvider;
|
|
20
|
-
}
|
|
21
|
-
serialize(e, t) {
|
|
22
|
-
let n = t ?? {}, i = t?.replacer, a = (e, t) => this.replacer(e, t, n), o = i ? (e, t) => i(e, t, a) : a;
|
|
23
|
-
try {
|
|
24
|
-
return this.currentDocument = getDocument(e), JSON.stringify(e, o, t?.space);
|
|
25
|
-
} finally {
|
|
26
|
-
this.currentDocument = void 0;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
deserialize(e, t) {
|
|
30
|
-
let n = t ?? {}, r = JSON.parse(e);
|
|
31
|
-
return this.linkNode(r, r, n), r;
|
|
32
|
-
}
|
|
33
|
-
replacer(i, a, { refText: o, sourceText: s, textRegions: c, comments: l, uriConverter: u }) {
|
|
34
|
-
if (!this.ignoreProperties.has(i)) if (isReference(a)) {
|
|
35
|
-
let e = a.ref, t = o ? a.$refText : void 0;
|
|
36
|
-
if (e) {
|
|
37
|
-
let n = getDocument(e), i = "";
|
|
38
|
-
this.currentDocument && this.currentDocument !== n && (i = u ? u(n.uri, e) : n.uri.toString());
|
|
39
|
-
let a = this.astNodeLocator.getAstNodePath(e);
|
|
40
|
-
return {
|
|
41
|
-
$ref: `${i}#${a}`,
|
|
42
|
-
$refText: t
|
|
43
|
-
};
|
|
44
|
-
} else return {
|
|
45
|
-
$error: a.error?.message ?? "Could not resolve reference",
|
|
46
|
-
$refText: t
|
|
47
|
-
};
|
|
48
|
-
} else if (isMultiReference(a)) {
|
|
49
|
-
let e = o ? a.$refText : void 0, t = [];
|
|
50
|
-
for (let e of a.items) {
|
|
51
|
-
let n = e.ref, i = getDocument(e.ref), a = "";
|
|
52
|
-
this.currentDocument && this.currentDocument !== i && (a = u ? u(i.uri, n) : i.uri.toString());
|
|
53
|
-
let o = this.astNodeLocator.getAstNodePath(n);
|
|
54
|
-
t.push(`${a}#${o}`);
|
|
55
|
-
}
|
|
56
|
-
return {
|
|
57
|
-
$refs: t,
|
|
58
|
-
$refText: e
|
|
59
|
-
};
|
|
60
|
-
} else if (isAstNode(a)) {
|
|
61
|
-
let e;
|
|
62
|
-
if (c && (e = this.addAstNodeRegionWithAssignmentsTo({ ...a }), (!i || a.$document) && e?.$textRegion && (e.$textRegion.documentURI = this.currentDocument?.uri.toString())), s && !i && (e ??= { ...a }, e.$sourceText = a.$cstNode?.text), l) {
|
|
63
|
-
e ??= { ...a };
|
|
64
|
-
let t = this.commentProvider.getComment(a);
|
|
65
|
-
t && (e.$comment = t.replace(/\r/g, ""));
|
|
66
|
-
}
|
|
67
|
-
return e ?? a;
|
|
68
|
-
} else return a;
|
|
69
|
-
}
|
|
70
|
-
addAstNodeRegionWithAssignmentsTo(e) {
|
|
71
|
-
let t = (e) => ({
|
|
72
|
-
offset: e.offset,
|
|
73
|
-
end: e.end,
|
|
74
|
-
length: e.length,
|
|
75
|
-
range: e.range
|
|
76
|
-
});
|
|
77
|
-
if (e.$cstNode) {
|
|
78
|
-
let n = e.$textRegion = t(e.$cstNode), r = n.assignments = {};
|
|
79
|
-
return Object.keys(e).filter((e) => !e.startsWith("$")).forEach((n) => {
|
|
80
|
-
let a = findNodesForProperty(e.$cstNode, n).map(t);
|
|
81
|
-
a.length !== 0 && (r[n] = a);
|
|
82
|
-
}), e;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
linkNode(t, n, r, i, a, o) {
|
|
86
|
-
for (let [i, a] of Object.entries(t)) if (Array.isArray(a)) for (let o = 0; o < a.length; o++) {
|
|
87
|
-
let c = a[o];
|
|
88
|
-
isIntermediateReference(c) ? a[o] = this.reviveReference(t, i, n, c, r) : isAstNode(c) && this.linkNode(c, n, r, t, i, o);
|
|
89
|
-
}
|
|
90
|
-
else isIntermediateReference(a) ? t[i] = this.reviveReference(t, i, n, a, r) : isAstNode(a) && this.linkNode(a, n, r, t, i);
|
|
91
|
-
let c = t;
|
|
92
|
-
c.$container = i, c.$containerProperty = a, c.$containerIndex = o;
|
|
93
|
-
}
|
|
94
|
-
reviveReference(t, n, r, i, a) {
|
|
95
|
-
let o = i.$refText, s = i.$error, c;
|
|
96
|
-
if (i.$ref) {
|
|
97
|
-
let t = this.getRefNode(r, i.$ref, a.uriConverter);
|
|
98
|
-
if (isAstNode(t)) return o ||= this.nameProvider.getName(t), {
|
|
99
|
-
$refText: o ?? "",
|
|
100
|
-
ref: t
|
|
101
|
-
};
|
|
102
|
-
s = t;
|
|
103
|
-
} else if (i.$refs) {
|
|
104
|
-
let t = [];
|
|
105
|
-
for (let n of i.$refs) {
|
|
106
|
-
let i = this.getRefNode(r, n, a.uriConverter);
|
|
107
|
-
isAstNode(i) && t.push({ ref: i });
|
|
108
|
-
}
|
|
109
|
-
if (t.length === 0) c = {
|
|
110
|
-
$refText: o ?? "",
|
|
111
|
-
items: t
|
|
112
|
-
}, s ??= "Could not resolve multi-reference";
|
|
113
|
-
else return {
|
|
114
|
-
$refText: o ?? "",
|
|
115
|
-
items: t
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
if (s) return c ??= {
|
|
119
|
-
$refText: o ?? "",
|
|
120
|
-
ref: void 0
|
|
121
|
-
}, c.error = {
|
|
122
|
-
info: {
|
|
123
|
-
container: t,
|
|
124
|
-
property: n,
|
|
125
|
-
reference: c
|
|
126
|
-
},
|
|
127
|
-
message: s
|
|
128
|
-
}, c;
|
|
129
|
-
}
|
|
130
|
-
getRefNode(e, t, n) {
|
|
131
|
-
try {
|
|
132
|
-
let r = t.indexOf("#");
|
|
133
|
-
if (r === 0) return this.astNodeLocator.getAstNode(e, t.substring(1)) || "Could not resolve path: " + t;
|
|
134
|
-
if (r < 0) {
|
|
135
|
-
let e = n ? n(t) : URI.parse(t), r = this.langiumDocuments.getDocument(e);
|
|
136
|
-
return r ? r.parseResult.value : "Could not find document for URI: " + t;
|
|
137
|
-
}
|
|
138
|
-
let i = n ? n(t.substring(0, r)) : URI.parse(t.substring(0, r)), o = this.langiumDocuments.getDocument(i);
|
|
139
|
-
return o ? r === t.length - 1 ? o.parseResult.value : this.astNodeLocator.getAstNode(o.parseResult.value, t.substring(r + 1)) || "Could not resolve URI: " + t : "Could not find document for URI: " + t;
|
|
140
|
-
} catch (e) {
|
|
141
|
-
return String(e);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
export { DefaultJsonSerializer, isAstNodeWithComment };
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { UriUtils } from "./utils/uri-utils.js";
|
|
2
|
-
var DefaultServiceRegistry = class {
|
|
3
|
-
get map() {
|
|
4
|
-
return this.fileExtensionMap;
|
|
5
|
-
}
|
|
6
|
-
constructor(e) {
|
|
7
|
-
this.languageIdMap = /* @__PURE__ */ new Map(), this.fileExtensionMap = /* @__PURE__ */ new Map(), this.fileNameMap = /* @__PURE__ */ new Map(), this.textDocuments = e?.workspace.TextDocuments;
|
|
8
|
-
}
|
|
9
|
-
register(e) {
|
|
10
|
-
let t = e.LanguageMetaData;
|
|
11
|
-
for (let n of t.fileExtensions) this.fileExtensionMap.has(n) && console.warn(`The file extension ${n} is used by multiple languages. It is now assigned to '${t.languageId}'.`), this.fileExtensionMap.set(n, e);
|
|
12
|
-
if (t.fileNames) for (let n of t.fileNames) this.fileNameMap.has(n) && console.warn(`The file name ${n} is used by multiple languages. It is now assigned to '${t.languageId}'.`), this.fileNameMap.set(n, e);
|
|
13
|
-
this.languageIdMap.set(t.languageId, e);
|
|
14
|
-
}
|
|
15
|
-
getServices(t) {
|
|
16
|
-
if (this.languageIdMap.size === 0) throw Error("The service registry is empty. Use `register` to register the services of a language.");
|
|
17
|
-
let n = this.textDocuments?.get(t)?.languageId;
|
|
18
|
-
if (n !== void 0) {
|
|
19
|
-
let e = this.languageIdMap.get(n);
|
|
20
|
-
if (e) return e;
|
|
21
|
-
}
|
|
22
|
-
let r = UriUtils.extname(t), i = UriUtils.basename(t), a = this.fileNameMap.get(i) ?? this.fileExtensionMap.get(r);
|
|
23
|
-
if (!a) throw n ? Error(`The service registry contains no services for the extension '${r}' for language '${n}'.`) : Error(`The service registry contains no services for the extension '${r}'.`);
|
|
24
|
-
return a;
|
|
25
|
-
}
|
|
26
|
-
hasServices(e) {
|
|
27
|
-
try {
|
|
28
|
-
return this.getServices(e), !0;
|
|
29
|
-
} catch {
|
|
30
|
-
return !1;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
get all() {
|
|
34
|
-
return Array.from(this.languageIdMap.values());
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
export { DefaultServiceRegistry };
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
function isAstNode(e) {
|
|
2
|
-
return typeof e == "object" && !!e && typeof e.$type == "string";
|
|
3
|
-
}
|
|
4
|
-
function isReference(e) {
|
|
5
|
-
return typeof e == "object" && !!e && typeof e.$refText == "string" && "ref" in e;
|
|
6
|
-
}
|
|
7
|
-
function isMultiReference(e) {
|
|
8
|
-
return typeof e == "object" && !!e && typeof e.$refText == "string" && "items" in e;
|
|
9
|
-
}
|
|
10
|
-
function isAstNodeDescription(e) {
|
|
11
|
-
return typeof e == "object" && !!e && typeof e.name == "string" && typeof e.type == "string" && typeof e.path == "string";
|
|
12
|
-
}
|
|
13
|
-
function isLinkingError(e) {
|
|
14
|
-
return typeof e == "object" && !!e && typeof e.info == "object" && typeof e.message == "string";
|
|
15
|
-
}
|
|
16
|
-
var AbstractAstReflection = class {
|
|
17
|
-
constructor() {
|
|
18
|
-
this.subtypes = {}, this.allSubtypes = {};
|
|
19
|
-
}
|
|
20
|
-
getAllTypes() {
|
|
21
|
-
return Object.keys(this.types);
|
|
22
|
-
}
|
|
23
|
-
getReferenceType(e) {
|
|
24
|
-
let a = this.types[e.container.$type];
|
|
25
|
-
if (!a) throw Error(`Type ${e.container.$type || "undefined"} not found.`);
|
|
26
|
-
let o = a.properties[e.property]?.referenceType;
|
|
27
|
-
if (!o) throw Error(`Property ${e.property || "undefined"} of type ${e.container.$type} is not a reference.`);
|
|
28
|
-
return o;
|
|
29
|
-
}
|
|
30
|
-
getTypeMetaData(e) {
|
|
31
|
-
return this.types[e] || {
|
|
32
|
-
name: e,
|
|
33
|
-
properties: {},
|
|
34
|
-
superTypes: []
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
isInstance(a, o) {
|
|
38
|
-
return isAstNode(a) && this.isSubtype(a.$type, o);
|
|
39
|
-
}
|
|
40
|
-
isSubtype(e, a) {
|
|
41
|
-
if (e === a) return !0;
|
|
42
|
-
let o = this.subtypes[e];
|
|
43
|
-
o ||= this.subtypes[e] = {};
|
|
44
|
-
let s = o[a];
|
|
45
|
-
if (s !== void 0) return s;
|
|
46
|
-
{
|
|
47
|
-
let s = this.types[e], c = s ? s.superTypes.some((e) => this.isSubtype(e, a)) : !1;
|
|
48
|
-
return o[a] = c, c;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
getAllSubTypes(e) {
|
|
52
|
-
let a = this.allSubtypes[e];
|
|
53
|
-
if (a) return a;
|
|
54
|
-
{
|
|
55
|
-
let a = this.getAllTypes(), o = [];
|
|
56
|
-
for (let s of a) this.isSubtype(s, e) && o.push(s);
|
|
57
|
-
return this.allSubtypes[e] = o, o;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
function isCompositeCstNode(e) {
|
|
62
|
-
return typeof e == "object" && !!e && Array.isArray(e.content);
|
|
63
|
-
}
|
|
64
|
-
function isLeafCstNode(e) {
|
|
65
|
-
return typeof e == "object" && !!e && typeof e.tokenType == "object";
|
|
66
|
-
}
|
|
67
|
-
function isRootCstNode(e) {
|
|
68
|
-
return isCompositeCstNode(e) && typeof e.fullText == "string";
|
|
69
|
-
}
|
|
70
|
-
export { AbstractAstReflection, isAstNode, isAstNodeDescription, isCompositeCstNode, isLeafCstNode, isLinkingError, isMultiReference, isReference, isRootCstNode };
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import { __export } from "../../../../_virtual/rolldown_runtime.js";
|
|
2
|
-
import { isAstNode, isMultiReference, isReference } from "../syntax-tree.js";
|
|
3
|
-
import { DONE_RESULT, StreamImpl, TreeStreamImpl } from "./stream.js";
|
|
4
|
-
import { inRange } from "./cst-utils.js";
|
|
5
|
-
var ast_utils_exports = /* @__PURE__ */ __export({
|
|
6
|
-
assignMandatoryProperties: () => assignMandatoryProperties,
|
|
7
|
-
copyAstNode: () => copyAstNode,
|
|
8
|
-
findRootNode: () => findRootNode,
|
|
9
|
-
getContainerOfType: () => getContainerOfType,
|
|
10
|
-
getDocument: () => getDocument,
|
|
11
|
-
getReferenceNodes: () => getReferenceNodes,
|
|
12
|
-
hasContainerOfType: () => hasContainerOfType,
|
|
13
|
-
linkContentToContainer: () => linkContentToContainer,
|
|
14
|
-
streamAllContents: () => streamAllContents,
|
|
15
|
-
streamAst: () => streamAst,
|
|
16
|
-
streamContents: () => streamContents,
|
|
17
|
-
streamReferences: () => streamReferences
|
|
18
|
-
}, 1);
|
|
19
|
-
function linkContentToContainer(e, g = {}) {
|
|
20
|
-
for (let [_, v] of Object.entries(e)) _.startsWith("$") || (Array.isArray(v) ? v.forEach((v, y) => {
|
|
21
|
-
isAstNode(v) && (v.$container = e, v.$containerProperty = _, v.$containerIndex = y, g.deep && linkContentToContainer(v, g));
|
|
22
|
-
}) : isAstNode(v) && (v.$container = e, v.$containerProperty = _, g.deep && linkContentToContainer(v, g)));
|
|
23
|
-
}
|
|
24
|
-
function getContainerOfType(e, h) {
|
|
25
|
-
let g = e;
|
|
26
|
-
for (; g;) {
|
|
27
|
-
if (h(g)) return g;
|
|
28
|
-
g = g.$container;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
function hasContainerOfType(e, h) {
|
|
32
|
-
let g = e;
|
|
33
|
-
for (; g;) {
|
|
34
|
-
if (h(g)) return !0;
|
|
35
|
-
g = g.$container;
|
|
36
|
-
}
|
|
37
|
-
return !1;
|
|
38
|
-
}
|
|
39
|
-
function getDocument(e) {
|
|
40
|
-
let h = findRootNode(e).$document;
|
|
41
|
-
if (!h) throw Error("AST node has no document.");
|
|
42
|
-
return h;
|
|
43
|
-
}
|
|
44
|
-
function findRootNode(e) {
|
|
45
|
-
for (; e.$container;) e = e.$container;
|
|
46
|
-
return e;
|
|
47
|
-
}
|
|
48
|
-
function getReferenceNodes(e) {
|
|
49
|
-
return isReference(e) ? e.ref ? [e.ref] : [] : isMultiReference(e) ? e.items.map((e) => e.ref) : [];
|
|
50
|
-
}
|
|
51
|
-
function streamContents(e, g) {
|
|
52
|
-
if (!e) throw Error("Node must be an AstNode.");
|
|
53
|
-
let _ = g?.range;
|
|
54
|
-
return new StreamImpl(() => ({
|
|
55
|
-
keys: Object.keys(e),
|
|
56
|
-
keyIndex: 0,
|
|
57
|
-
arrayIndex: 0
|
|
58
|
-
}), (g) => {
|
|
59
|
-
for (; g.keyIndex < g.keys.length;) {
|
|
60
|
-
let v = g.keys[g.keyIndex];
|
|
61
|
-
if (!v.startsWith("$")) {
|
|
62
|
-
let y = e[v];
|
|
63
|
-
if (isAstNode(y)) {
|
|
64
|
-
if (g.keyIndex++, isAstNodeInRange(y, _)) return {
|
|
65
|
-
done: !1,
|
|
66
|
-
value: y
|
|
67
|
-
};
|
|
68
|
-
} else if (Array.isArray(y)) {
|
|
69
|
-
for (; g.arrayIndex < y.length;) {
|
|
70
|
-
let e = y[g.arrayIndex++];
|
|
71
|
-
if (isAstNode(e) && isAstNodeInRange(e, _)) return {
|
|
72
|
-
done: !1,
|
|
73
|
-
value: e
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
g.arrayIndex = 0;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
g.keyIndex++;
|
|
80
|
-
}
|
|
81
|
-
return DONE_RESULT;
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
function streamAllContents(e, h) {
|
|
85
|
-
if (!e) throw Error("Root node must be an AstNode.");
|
|
86
|
-
return new TreeStreamImpl(e, (e) => streamContents(e, h));
|
|
87
|
-
}
|
|
88
|
-
function streamAst(e, h) {
|
|
89
|
-
if (e) {
|
|
90
|
-
if (h?.range && !isAstNodeInRange(e, h.range)) return new TreeStreamImpl(e, () => []);
|
|
91
|
-
} else throw Error("Root node must be an AstNode.");
|
|
92
|
-
return new TreeStreamImpl(e, (e) => streamContents(e, h), { includeRoot: !0 });
|
|
93
|
-
}
|
|
94
|
-
function isAstNodeInRange(e, h) {
|
|
95
|
-
if (!h) return !0;
|
|
96
|
-
let g = e.$cstNode?.range;
|
|
97
|
-
return g ? inRange(g, h) : !1;
|
|
98
|
-
}
|
|
99
|
-
function streamReferences(e) {
|
|
100
|
-
return new StreamImpl(() => ({
|
|
101
|
-
keys: Object.keys(e),
|
|
102
|
-
keyIndex: 0,
|
|
103
|
-
arrayIndex: 0
|
|
104
|
-
}), (h) => {
|
|
105
|
-
for (; h.keyIndex < h.keys.length;) {
|
|
106
|
-
let v = h.keys[h.keyIndex];
|
|
107
|
-
if (!v.startsWith("$")) {
|
|
108
|
-
let y = e[v];
|
|
109
|
-
if (isReference(y) || isMultiReference(y)) return h.keyIndex++, {
|
|
110
|
-
done: !1,
|
|
111
|
-
value: {
|
|
112
|
-
reference: y,
|
|
113
|
-
container: e,
|
|
114
|
-
property: v
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
if (Array.isArray(y)) {
|
|
118
|
-
for (; h.arrayIndex < y.length;) {
|
|
119
|
-
let b = h.arrayIndex++, x = y[b];
|
|
120
|
-
if (isReference(x) || isMultiReference(y)) return {
|
|
121
|
-
done: !1,
|
|
122
|
-
value: {
|
|
123
|
-
reference: x,
|
|
124
|
-
container: e,
|
|
125
|
-
property: v,
|
|
126
|
-
index: b
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
h.arrayIndex = 0;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
h.keyIndex++;
|
|
134
|
-
}
|
|
135
|
-
return DONE_RESULT;
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
function assignMandatoryProperties(e, h) {
|
|
139
|
-
let g = e.getTypeMetaData(h.$type), _ = h;
|
|
140
|
-
for (let e of Object.values(g.properties)) e.defaultValue !== void 0 && _[e.name] === void 0 && (_[e.name] = copyDefaultValue(e.defaultValue));
|
|
141
|
-
}
|
|
142
|
-
function copyDefaultValue(e) {
|
|
143
|
-
return Array.isArray(e) ? [...e.map(copyDefaultValue)] : e;
|
|
144
|
-
}
|
|
145
|
-
function copyAstNode(e, g, v) {
|
|
146
|
-
let y = { $type: e.$type };
|
|
147
|
-
v && (v.set(e, y), v.set(y, e));
|
|
148
|
-
for (let [b, x] of Object.entries(e)) if (!b.startsWith("$")) if (isAstNode(x)) y[b] = copyAstNode(x, g, v);
|
|
149
|
-
else if (isReference(x)) y[b] = g(y, b, x.$refNode, x.$refText, x);
|
|
150
|
-
else if (Array.isArray(x)) {
|
|
151
|
-
let e = [];
|
|
152
|
-
for (let S of x) isAstNode(S) ? e.push(copyAstNode(S, g, v)) : isReference(S) ? e.push(g(y, b, S.$refNode, S.$refText, S)) : e.push(S);
|
|
153
|
-
y[b] = e;
|
|
154
|
-
} else y[b] = x;
|
|
155
|
-
return linkContentToContainer(y, { deep: !0 }), y;
|
|
156
|
-
}
|
|
157
|
-
export { assignMandatoryProperties, ast_utils_exports, findRootNode, getContainerOfType, getDocument, getReferenceNodes, linkContentToContainer, streamAllContents, streamAst, streamContents, streamReferences };
|