@synergenius/flow-weaver 0.33.2 → 0.44.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/LICENSE +201 -226
- package/NOTICE +13 -0
- package/README.md +152 -245
- package/dist/agent/agent-loop.d.ts +4 -2
- package/dist/agent/cli-session.d.ts +3 -3
- package/dist/agent/cli-session.js +511 -438
- package/dist/agent/cli-spawn-config.d.ts +4 -4
- package/dist/agent/gate.d.ts +164 -0
- package/dist/agent/index.d.ts +4 -4
- package/dist/agent/index.js +174 -28
- package/dist/agent/mcp-bridge.d.ts +1 -1
- package/dist/agent/mcp-bridge.js +114 -128
- package/dist/agent/mcp-tool-server.d.ts +2 -2
- package/dist/agent/mcp-tool-server.js +147 -189
- package/dist/agent/profiles.d.ts +69 -0
- package/dist/agent/providers/anthropic.d.ts +2 -4
- package/dist/agent/providers/claude-cli.d.ts +4 -5
- package/dist/agent/providers/openai-compat.d.ts +8 -1
- package/dist/agent/streaming.d.ts +2 -2
- package/dist/agent/types.d.ts +16 -10
- package/dist/api/builder.d.ts +3 -3
- package/dist/api/compile.d.ts +9 -4
- package/dist/api/durable-validation.d.ts +15 -0
- package/dist/api/generate-in-place.d.ts +21 -19
- package/dist/api/generate.d.ts +21 -16
- package/dist/api/generated-module/local-node-functions.d.ts +24 -0
- package/dist/api/generated-module/module-format.d.ts +23 -0
- package/dist/api/generated-module/module-writer.d.ts +34 -0
- package/dist/api/generated-module/node-type-imports.d.ts +39 -0
- package/dist/api/generated-module/preamble.d.ts +16 -0
- package/dist/api/generated-module/workflow-functions.d.ts +29 -0
- package/dist/api/graph-identity.d.ts +39 -0
- package/dist/api/helpers.d.ts +4 -60
- package/dist/api/in-place/built-in-nodes.d.ts +18 -0
- package/dist/api/in-place/function-body.d.ts +21 -0
- package/dist/api/in-place/fw-imports.d.ts +30 -0
- package/dist/api/in-place/macro-coverage.d.ts +14 -0
- package/dist/api/in-place/node-type-functions.d.ts +18 -0
- package/dist/api/in-place/node-type-jsdoc.d.ts +20 -0
- package/dist/api/in-place/orphaned-node-types.d.ts +16 -0
- package/dist/api/in-place/runtime-section.d.ts +16 -0
- package/dist/api/in-place/signature.d.ts +47 -0
- package/dist/api/in-place/source-file.d.ts +19 -0
- package/dist/api/in-place/workflow-jsdoc.d.ts +19 -0
- package/dist/api/index.d.ts +18 -21
- package/dist/api/index.js +259 -53
- package/dist/api/inline-engine.generated.d.ts +3 -0
- package/dist/api/inline-runtime.d.ts +10 -2
- package/dist/api/manipulation/connections.d.ts +1 -1
- package/dist/api/manipulation/index.d.ts +8 -8
- package/dist/api/manipulation/node-types.d.ts +1 -1
- package/dist/api/manipulation/nodes.d.ts +3 -13
- package/dist/api/manipulation/ports.d.ts +1 -1
- package/dist/api/manipulation/scopes.d.ts +1 -1
- package/dist/api/manipulation/workflow.d.ts +1 -1
- package/dist/api/modify-operation.d.ts +0 -2
- package/dist/api/parse.d.ts +22 -1
- package/dist/api/port-references.d.ts +66 -0
- package/dist/api/query.d.ts +18 -2
- package/dist/api/templates.d.ts +1 -1
- package/dist/api/transform.d.ts +1 -1
- package/dist/api/validate.d.ts +1 -1
- package/dist/api/validation-registry.d.ts +2 -2
- package/dist/artifacts/brief.d.ts +43 -0
- package/dist/artifacts/index.d.ts +31 -0
- package/dist/artifacts/pdf.d.ts +19 -0
- package/dist/ast/builder.d.ts +3 -3
- package/dist/ast/index.d.ts +4 -4
- package/dist/ast/index.js +60 -5
- package/dist/ast/serialization-node.d.ts +1 -1
- package/dist/ast/serialization.d.ts +1 -1
- package/dist/ast/types.d.ts +82 -291
- package/dist/ast/workflow-utils.d.ts +4 -4
- package/dist/built-in-nodes/coercion-types.d.ts +1 -1
- package/dist/built-in-nodes/delay.d.ts +3 -1
- package/dist/built-in-nodes/generated-registry.d.ts +1 -1
- package/dist/built-in-nodes/index.d.ts +6 -5
- package/dist/built-in-nodes/index.js +79 -5
- package/dist/built-in-nodes/invoke-workflow.d.ts +2 -1
- package/dist/built-in-nodes/mock-types.d.ts +45 -14
- package/dist/built-in-nodes/sleep.d.ts +12 -0
- package/dist/built-in-nodes/wait-for-agent.d.ts +2 -1
- package/dist/built-in-nodes/wait-for-event.d.ts +2 -1
- package/dist/chevrotain-parser/coerce-parser.d.ts +1 -1
- package/dist/chevrotain-parser/connect-parser.d.ts +1 -1
- package/dist/chevrotain-parser/grammar-diagrams.d.ts +1 -1
- package/dist/chevrotain-parser/index.d.ts +20 -23
- package/dist/chevrotain-parser/node-parser.d.ts +7 -8
- package/dist/chevrotain-parser/parse-line.d.ts +54 -0
- package/dist/chevrotain-parser/tokens.d.ts +0 -17
- package/dist/chevrotain-parser/trigger-cancel-parser.d.ts +6 -1
- package/dist/chunks/chunk-4EUSHAY6.js +298 -0
- package/dist/chunks/chunk-4KDUEOFD.js +197 -0
- package/dist/chunks/chunk-5Y3AIUWY.js +911 -0
- package/dist/chunks/chunk-6KMVP6AU.js +20 -0
- package/dist/chunks/chunk-6PNJORFL.js +128 -0
- package/dist/chunks/chunk-7AAQNGRH.js +2001 -0
- package/dist/chunks/chunk-7YYKTPJ5.js +22705 -0
- package/dist/chunks/chunk-A5MBOFVY.js +33 -0
- package/dist/chunks/chunk-AXNQRVJB.js +18 -0
- package/dist/chunks/chunk-B6HQ6YS5.js +572 -0
- package/dist/chunks/chunk-CY3RNVML.js +296 -0
- package/dist/chunks/chunk-CYHYDLV4.js +653 -0
- package/dist/chunks/chunk-CZBCCK4Y.js +82 -0
- package/dist/chunks/chunk-DCMGQP5V.js +505 -0
- package/dist/chunks/chunk-DIAA66GL.js +72 -0
- package/dist/chunks/chunk-DUO6H5PR.js +20 -0
- package/dist/chunks/chunk-E5WN7IGO.js +125 -0
- package/dist/chunks/chunk-EFGFXXQF.js +184 -0
- package/dist/chunks/chunk-F3RTZV2A.js +2811 -0
- package/dist/chunks/chunk-FMTLP5ZX.js +1397 -0
- package/dist/chunks/chunk-HKZLQJDV.js +79 -0
- package/dist/chunks/chunk-INDEVYEC.js +146 -0
- package/dist/chunks/chunk-JQTF4R5L.js +390 -0
- package/dist/chunks/chunk-KMCAYNUM.js +331 -0
- package/dist/chunks/chunk-KMWCCOUJ.js +1444 -0
- package/dist/chunks/chunk-KU3CLJI2.js +338 -0
- package/dist/chunks/chunk-NDSTGMKR.js +3300 -0
- package/dist/chunks/chunk-NQNLUAPO.js +505 -0
- package/dist/chunks/chunk-O2U2LO57.js +466 -0
- package/dist/chunks/chunk-OOQG7UPP.js +457 -0
- package/dist/chunks/chunk-OZQAW5ZG.js +112 -0
- package/dist/chunks/chunk-P2CVDGHR.js +487 -0
- package/dist/chunks/chunk-P44RIZ7C.js +592 -0
- package/dist/chunks/chunk-PEZCT37T.js +1475 -0
- package/dist/chunks/chunk-PKWSAW6O.js +152 -0
- package/dist/chunks/chunk-Q6MDDZMT.js +4373 -0
- package/dist/chunks/chunk-QDE4Z7KW.js +6 -0
- package/dist/chunks/chunk-QJDAVSNY.js +8 -0
- package/dist/chunks/chunk-QYPORSLO.js +7552 -0
- package/dist/chunks/chunk-R4QGNK34.js +183 -0
- package/dist/chunks/chunk-REEYC73I.js +3002 -0
- package/dist/chunks/chunk-SEWDMQ6Q.js +46 -0
- package/dist/chunks/chunk-TAIUWKZB.js +3057 -0
- package/dist/chunks/chunk-TN4YZ3O7.js +196 -0
- package/dist/chunks/chunk-TRMFB43C.js +143 -0
- package/dist/chunks/chunk-VO4QXG2X.js +1016 -0
- package/dist/chunks/chunk-VP2P3BPA.js +1002 -0
- package/dist/chunks/chunk-VQ7H33J4.js +2176 -0
- package/dist/chunks/chunk-VWA7MCV2.js +105 -0
- package/dist/chunks/chunk-XAV22WD7.js +253 -0
- package/dist/chunks/chunk-YSPBPZDV.js +148 -0
- package/dist/chunks/chunk-ZKEGXO73.js +282 -0
- package/dist/chunks/chunk-ZMGN6F3S.js +4256 -0
- package/dist/chunks/grammar-diagrams-AI7VDXOM.js +14 -0
- package/dist/chunks/index.min-ECJD6GZC.js +37 -0
- package/dist/chunks/manifest-EPTR5MYH.js +21 -0
- package/dist/chunks/openapi-document-6TCGVDUW.js +69 -0
- package/dist/chunks/registry-K2U5KUTY.js +23 -0
- package/dist/chunks/serialization-node-UGY6CFH6.js +38 -0
- package/dist/chunks/validate-GEKSZPIN.js +24 -0
- package/dist/chunks/validation-registry-IQZX3UE3.js +7 -0
- package/dist/chunks/validator-VXFHLPDW.js +26 -0
- package/dist/chunks/workflow-executor-KBGFKHNR.js +36 -0
- package/dist/cli/commands/agents.d.ts +16 -0
- package/dist/cli/commands/artifact.d.ts +10 -0
- package/dist/cli/commands/compile.d.ts +0 -30
- package/dist/cli/commands/console.d.ts +32 -0
- package/dist/cli/commands/context.d.ts +0 -3
- package/dist/cli/commands/describe.js +386 -352
- package/dist/cli/commands/dev.d.ts +9 -4
- package/dist/cli/commands/diagram.d.ts +3 -5
- package/dist/cli/commands/doctor.d.ts +27 -4
- package/dist/cli/commands/doctor.js +3307 -633
- package/dist/cli/commands/export.d.ts +6 -4
- package/dist/cli/commands/grammar.d.ts +0 -3
- package/dist/cli/commands/implement.d.ts +1 -1
- package/dist/cli/commands/init/agent-handoff.d.ts +28 -0
- package/dist/cli/commands/init/config.d.ts +3 -0
- package/dist/cli/commands/init/files.d.ts +12 -0
- package/dist/cli/commands/init/naming.d.ts +13 -0
- package/dist/cli/commands/init/output.d.ts +12 -0
- package/dist/cli/commands/init/setup.d.ts +21 -0
- package/dist/cli/commands/init/types.d.ts +53 -0
- package/dist/cli/commands/init-personas.d.ts +9 -1
- package/dist/cli/commands/init.d.ts +24 -88
- package/dist/cli/commands/market.d.ts +1 -1
- package/dist/cli/commands/mcp-setup.d.ts +1 -4
- package/dist/cli/commands/modify.d.ts +0 -5
- package/dist/cli/commands/openapi.d.ts +9 -11
- package/dist/cli/commands/run.d.ts +0 -4
- package/dist/cli/commands/serve.d.ts +24 -26
- package/dist/cli/commands/status.d.ts +1 -1
- package/dist/cli/exports.d.ts +3 -4
- package/dist/cli/exports.js +124 -23
- package/dist/cli/flow-weaver-agents-H653446S.mjs +81 -0
- package/dist/cli/flow-weaver-artifact-WBFYTW76.mjs +58 -0
- package/dist/cli/flow-weaver-chunk-265CEK74.mjs +2 -0
- package/dist/cli/flow-weaver-chunk-2C7PZCV5.mjs +186 -0
- package/dist/cli/flow-weaver-chunk-3BSYCWPL.mjs +3109 -0
- package/dist/cli/flow-weaver-chunk-3MKUQP3D.mjs +547 -0
- package/dist/cli/flow-weaver-chunk-3ZLMPQTH.mjs +27 -0
- package/dist/cli/flow-weaver-chunk-4DVY73ML.mjs +280 -0
- package/dist/cli/flow-weaver-chunk-54M4KNEL.mjs +200 -0
- package/dist/cli/flow-weaver-chunk-55QMUZIA.mjs +256 -0
- package/dist/cli/flow-weaver-chunk-6ZUJ7LMX.mjs +2003 -0
- package/dist/cli/flow-weaver-chunk-7ET6N32V.mjs +419 -0
- package/dist/cli/flow-weaver-chunk-7G63RR4K.mjs +8880 -0
- package/dist/cli/flow-weaver-chunk-A6M5K3W7.mjs +4418 -0
- package/dist/cli/flow-weaver-chunk-AA3NATMX.mjs +154 -0
- package/dist/cli/flow-weaver-chunk-APX6MQ5A.mjs +5652 -0
- package/dist/cli/flow-weaver-chunk-BHCC5FE5.mjs +17 -0
- package/dist/cli/flow-weaver-chunk-DM4BBRRU.mjs +35 -0
- package/dist/cli/flow-weaver-chunk-DRN7KPWY.mjs +168 -0
- package/dist/cli/flow-weaver-chunk-EKWF27G6.mjs +23 -0
- package/dist/cli/flow-weaver-chunk-EM5HWQ4R.mjs +338 -0
- package/dist/cli/flow-weaver-chunk-FPPPU2DG.mjs +226 -0
- package/dist/cli/flow-weaver-chunk-GAQXZHNO.mjs +3005 -0
- package/dist/cli/flow-weaver-chunk-GBUNNP33.mjs +1329 -0
- package/dist/cli/flow-weaver-chunk-HMAKDE55.mjs +636 -0
- package/dist/cli/flow-weaver-chunk-HQ3ZAN44.mjs +367 -0
- package/dist/cli/flow-weaver-chunk-I4APCXYN.mjs +21442 -0
- package/dist/cli/flow-weaver-chunk-IJJ4JXTL.mjs +2297 -0
- package/dist/cli/flow-weaver-chunk-J7EPZW2I.mjs +33 -0
- package/dist/cli/flow-weaver-chunk-KOEMJHLG.mjs +83 -0
- package/dist/cli/flow-weaver-chunk-M6CBWQKJ.mjs +271 -0
- package/dist/cli/flow-weaver-chunk-MHJ4N652.mjs +1580 -0
- package/dist/cli/flow-weaver-chunk-MKAFQWLP.mjs +202 -0
- package/dist/cli/flow-weaver-chunk-MMV2XGD3.mjs +3291 -0
- package/dist/cli/flow-weaver-chunk-MSI2UJES.mjs +125 -0
- package/dist/cli/flow-weaver-chunk-N767YRAI.mjs +48 -0
- package/dist/cli/flow-weaver-chunk-NQKKWDGF.mjs +56 -0
- package/dist/cli/flow-weaver-chunk-NYZDQYFU.mjs +45 -0
- package/dist/cli/flow-weaver-chunk-OMVWSNHJ.mjs +14 -0
- package/dist/cli/flow-weaver-chunk-PUWZ47H5.mjs +2188 -0
- package/dist/cli/flow-weaver-chunk-QOPRVDES.mjs +46 -0
- package/dist/cli/flow-weaver-chunk-RIWE7YTR.mjs +216 -0
- package/dist/cli/flow-weaver-chunk-S63Q3JIU.mjs +789 -0
- package/dist/cli/flow-weaver-chunk-T7X5A23H.mjs +558 -0
- package/dist/cli/flow-weaver-chunk-TLV3VZUN.mjs +2 -0
- package/dist/cli/flow-weaver-chunk-TS5P3PIN.mjs +194 -0
- package/dist/cli/flow-weaver-chunk-U3EO3X4B.mjs +649 -0
- package/dist/cli/flow-weaver-chunk-UNFS3NQP.mjs +34 -0
- package/dist/cli/flow-weaver-chunk-V6DHWFQG.mjs +2811 -0
- package/dist/cli/flow-weaver-chunk-VXWNLYQU.mjs +9 -0
- package/dist/cli/flow-weaver-chunk-W3YNK26P.mjs +149 -0
- package/dist/cli/flow-weaver-chunk-XG2WKXYZ.mjs +324 -0
- package/dist/cli/flow-weaver-chunk-YLSRZWFK.mjs +2219 -0
- package/dist/cli/flow-weaver-chunk-YVPURWS6.mjs +40 -0
- package/dist/cli/flow-weaver-chunk-Z44JK332.mjs +582 -0
- package/dist/cli/flow-weaver-chunk-Z5ZJPNSY.mjs +517 -0
- package/dist/cli/flow-weaver-chunk-ZQALO25T.mjs +594 -0
- package/dist/cli/flow-weaver-compile-A2CABDSB.mjs +37 -0
- package/dist/cli/flow-weaver-console-6EBHDBTN.mjs +71 -0
- package/dist/cli/flow-weaver-context-ECLYANFF.mjs +17 -0
- package/dist/cli/flow-weaver-context-ZRUMW2KE.mjs +69 -0
- package/dist/cli/flow-weaver-create-WIP4EFNP.mjs +124 -0
- package/dist/cli/flow-weaver-deployment-WJJRK7NO.mjs +14 -0
- package/dist/cli/flow-weaver-describe-XDIFF5LI.mjs +41 -0
- package/dist/cli/flow-weaver-dev-LG2NSQAU.mjs +196 -0
- package/dist/cli/flow-weaver-diagram-3EVQARQE.mjs +52 -0
- package/dist/cli/flow-weaver-diagram-7LR7O4M2.mjs +44 -0
- package/dist/cli/flow-weaver-diff-USF7DJLU.mjs +85 -0
- package/dist/cli/flow-weaver-docs-QU2ZOXKH.mjs +96 -0
- package/dist/cli/flow-weaver-doctor-K447YWHR.mjs +43 -0
- package/dist/cli/flow-weaver-export-LAS6N56Y.mjs +140 -0
- package/dist/cli/flow-weaver-grammar-RIRUS3Q6.mjs +49 -0
- package/dist/cli/flow-weaver-grammar-diagrams-WXRTW5SK.mjs +15 -0
- package/dist/cli/flow-weaver-implement-5JG6BCFZ.mjs +114 -0
- package/dist/cli/flow-weaver-index.min-OR5SIHXD.mjs +39 -0
- package/dist/cli/flow-weaver-init-34YZNPQX.mjs +972 -0
- package/dist/cli/flow-weaver-init-personas-NOGZTQQ2.mjs +48 -0
- package/dist/cli/flow-weaver-manifest-4JNUSEB3.mjs +18 -0
- package/dist/cli/flow-weaver-market-WA4CKHKV.mjs +444 -0
- package/dist/cli/flow-weaver-mcp-setup-O26MGXSD.mjs +22 -0
- package/dist/cli/flow-weaver-migrate-VFVEUTPH.mjs +119 -0
- package/dist/cli/flow-weaver-modify-VM3JP5K6.mjs +97 -0
- package/dist/cli/flow-weaver-openapi-IRBWI3HM.mjs +71 -0
- package/dist/cli/flow-weaver-openapi-document-7N6YMPG3.mjs +30 -0
- package/dist/cli/flow-weaver-pack-commands-OS2QRXAK.mjs +146 -0
- package/dist/cli/flow-weaver-registry-5MLFRPPT.mjs +25 -0
- package/dist/cli/flow-weaver-run-DSTLSTHR.mjs +555 -0
- package/dist/cli/flow-weaver-serialization-node-LE6PCG4M.mjs +50 -0
- package/dist/cli/flow-weaver-serve-NVLCLSOW.mjs +192 -0
- package/dist/cli/flow-weaver-server-7IERLVXE.mjs +2925 -0
- package/dist/cli/flow-weaver-server-KWF4PXYC.mjs +19112 -0
- package/dist/cli/flow-weaver-status-75W2S3YB.mjs +138 -0
- package/dist/cli/flow-weaver-strip-AZPXUYVA.mjs +79 -0
- package/dist/cli/flow-weaver-templates-DSNMB6K7.mjs +72 -0
- package/dist/cli/flow-weaver-validate-A4UWDQN6.mjs +19 -0
- package/dist/cli/flow-weaver-validate-GRBZ5W4C.mjs +296 -0
- package/dist/cli/flow-weaver-validation-registry-BINGUNXX.mjs +9 -0
- package/dist/cli/flow-weaver-validator-TY56CI42.mjs +21 -0
- package/dist/cli/flow-weaver-watch-OPPERXL6.mjs +114 -0
- package/dist/cli/flow-weaver-workflow-executor-6AHYPXAN.mjs +26 -0
- package/dist/cli/flow-weaver.mjs +3557 -89384
- package/dist/cli/index.d.ts +5 -2
- package/dist/cli/pack-commands-needed.d.ts +12 -0
- package/dist/cli/program.d.ts +14 -0
- package/dist/cli/templates/ai/mock-provider.d.ts +1 -1
- package/dist/cli/templates/index.d.ts +1 -8
- package/dist/cli/templates/nodes/agent-router.d.ts +1 -1
- package/dist/cli/templates/nodes/aggregator.d.ts +1 -1
- package/dist/cli/templates/nodes/conversation-memory.d.ts +1 -1
- package/dist/cli/templates/nodes/http.d.ts +1 -1
- package/dist/cli/templates/nodes/human-approval.d.ts +1 -1
- package/dist/cli/templates/nodes/json-extractor.d.ts +1 -1
- package/dist/cli/templates/nodes/llm-call.d.ts +1 -1
- package/dist/cli/templates/nodes/prompt-template.d.ts +1 -1
- package/dist/cli/templates/nodes/rag-retriever.d.ts +1 -1
- package/dist/cli/templates/nodes/tool-executor.d.ts +1 -1
- package/dist/cli/templates/nodes/transformer.d.ts +1 -1
- package/dist/cli/templates/nodes/validator.d.ts +1 -1
- package/dist/cli/templates/shared/approval-types.d.ts +1 -1
- package/dist/cli/templates/shared/case.d.ts +14 -0
- package/dist/cli/templates/shared/llm-types.d.ts +4 -4
- package/dist/cli/templates/workflows/aggregator.d.ts +1 -1
- package/dist/cli/templates/workflows/ai-agent.d.ts +1 -1
- package/dist/cli/templates/workflows/ai-chat.d.ts +1 -1
- package/dist/cli/templates/workflows/ai-rag.d.ts +1 -1
- package/dist/cli/templates/workflows/ai-react.d.ts +1 -1
- package/dist/cli/templates/workflows/approval.d.ts +10 -0
- package/dist/cli/templates/workflows/conditional.d.ts +2 -2
- package/dist/cli/templates/workflows/error-handler.d.ts +2 -2
- package/dist/cli/templates/workflows/foreach.d.ts +1 -1
- package/dist/cli/templates/workflows/sequential.d.ts +1 -1
- package/dist/cli/templates/workflows/webhook.d.ts +1 -1
- package/dist/cli/utils/interactive.d.ts +6 -0
- package/dist/cli/utils/json-option.d.ts +8 -0
- package/dist/cli/utils/logger.d.ts +2 -0
- package/dist/compiler/durable-source-proof.d.ts +23 -0
- package/dist/compiler/executable-artifact.d.ts +29 -0
- package/dist/compiler/index.d.ts +4 -0
- package/dist/compiler/index.js +36 -0
- package/dist/console/app.js +106 -0
- package/dist/console/assets/synergenius.svg +18 -0
- package/dist/console/author.d.ts +32 -0
- package/dist/console/cli-catalog.d.ts +21 -0
- package/dist/console/cli-run.d.ts +35 -0
- package/dist/console/cli-run.js +46 -0
- package/dist/console/debug.d.ts +67 -0
- package/dist/console/diff-view.d.ts +96 -0
- package/dist/console/export.d.ts +36 -0
- package/dist/console/git.d.ts +27 -0
- package/dist/console/index.d.ts +4 -0
- package/dist/console/index.html +16 -0
- package/dist/console/index.js +203 -0
- package/dist/console/packs.d.ts +100 -0
- package/dist/console/request-guard.d.ts +10 -0
- package/dist/console/respond.d.ts +16 -0
- package/dist/console/router.d.ts +64 -0
- package/dist/console/routes-agents.d.ts +14 -0
- package/dist/console/routes-project.d.ts +3 -0
- package/dist/console/routes-runs.d.ts +3 -0
- package/dist/console/routes-services.d.ts +7 -0
- package/dist/console/routes-tools.d.ts +3 -0
- package/dist/console/runs.d.ts +69 -0
- package/dist/console/scan.d.ts +49 -0
- package/dist/console/schema.d.ts +74 -0
- package/dist/console/server.d.ts +34 -0
- package/dist/console/server.js +43264 -0
- package/dist/console/services.d.ts +119 -0
- package/dist/console/source.d.ts +23 -0
- package/dist/console/status.d.ts +68 -0
- package/dist/console/styles.css +1023 -0
- package/dist/console/terminals.d.ts +22 -0
- package/dist/console/workflow-view.d.ts +153 -0
- package/dist/constants.d.ts +5 -1
- package/dist/constants.js +56 -167
- package/dist/context/index.d.ts +10 -0
- package/dist/context/index.js +14 -191
- package/dist/coordinator/agent-gate.d.ts +107 -0
- package/dist/coordinator/bundle-digest.d.ts +20 -0
- package/dist/coordinator/clock-tick.d.ts +4 -0
- package/dist/coordinator/effect-receipts.d.ts +10 -0
- package/dist/coordinator/errors.d.ts +31 -0
- package/dist/coordinator/file-store.d.ts +3 -0
- package/dist/coordinator/gate-labeling.d.ts +33 -0
- package/dist/coordinator/gate-resolution.d.ts +28 -0
- package/dist/coordinator/index.d.ts +12 -0
- package/dist/coordinator/index.js +107 -0
- package/dist/coordinator/memory-store.d.ts +3 -0
- package/dist/coordinator/params.d.ts +18 -0
- package/dist/coordinator/run-annotations.d.ts +6 -0
- package/dist/coordinator/run-context.d.ts +11 -0
- package/dist/coordinator/run-ending.d.ts +5 -0
- package/dist/coordinator/run-outcome.d.ts +31 -0
- package/dist/coordinator/run-resume.d.ts +6 -0
- package/dist/coordinator/run-start.d.ts +4 -0
- package/dist/coordinator/run-store.d.ts +275 -0
- package/dist/coordinator/run-trace.d.ts +41 -0
- package/dist/coordinator/run-views.d.ts +12 -0
- package/dist/coordinator/runs-dir.d.ts +26 -0
- package/dist/coordinator/store.d.ts +67 -0
- package/dist/coordinator/time.d.ts +39 -0
- package/dist/coordinator/workflow-selection.d.ts +6 -0
- package/dist/deployment/index.d.ts +11 -16
- package/dist/deployment/index.js +541 -50
- package/dist/deployment/targets/base.d.ts +11 -13
- package/dist/deployment/targets/openapi-parts.d.ts +92 -0
- package/dist/diagram/arms.d.ts +70 -0
- package/dist/diagram/ascii-renderer.d.ts +1 -1
- package/dist/diagram/geometry.d.ts +20 -32
- package/dist/diagram/graph/bounds.d.ts +30 -0
- package/dist/diagram/graph/metrics.d.ts +21 -0
- package/dist/diagram/graph/nodes.d.ts +33 -0
- package/dist/diagram/graph/placement.d.ts +22 -0
- package/dist/diagram/graph/ports.d.ts +23 -0
- package/dist/diagram/graph/routing.d.ts +40 -0
- package/dist/diagram/graph/scopes.d.ts +30 -0
- package/dist/diagram/index.d.ts +15 -23
- package/dist/diagram/index.js +632 -111
- package/dist/diagram/labels.d.ts +12 -0
- package/dist/diagram/lanes.d.ts +93 -0
- package/dist/diagram/layout.d.ts +1 -1
- package/dist/diagram/material-symbols.d.ts +7 -0
- package/dist/diagram/orthogonal-router.d.ts +2 -3
- package/dist/diagram/process-view.d.ts +79 -0
- package/dist/diagram/spine.d.ts +25 -0
- package/dist/diagram/theme.d.ts +1 -5
- package/dist/diagram/types.d.ts +6 -20
- package/dist/diff/index.js +53 -9
- package/dist/diff/types.d.ts +1 -5
- package/dist/doc-metadata/extractors/annotations.d.ts +0 -4
- package/dist/doc-metadata/extractors/cli-commands.d.ts +2 -1
- package/dist/doc-metadata/extractors/core-metadata.d.ts +19 -4
- package/dist/doc-metadata/extractors/error-codes.d.ts +1 -1
- package/dist/doc-metadata/extractors/mcp-tools.d.ts +7 -3
- package/dist/doc-metadata/index.d.ts +1 -2
- package/dist/doc-metadata/index.js +2368 -9
- package/dist/doc-metadata/types.d.ts +7 -24
- package/dist/docs/guide.d.ts +33 -0
- package/dist/docs/index.d.ts +7 -4
- package/dist/docs/index.js +298 -298
- package/dist/docs/pack-topics.d.ts +18 -0
- package/dist/editor-completions/annotationValues.d.ts +1 -1
- package/dist/editor-completions/contextParser.d.ts +3 -2
- package/dist/editor-completions/dataTypes.d.ts +1 -1
- package/dist/editor-completions/goToDefinition.d.ts +1 -1
- package/dist/editor-completions/index.d.ts +8 -8
- package/dist/editor-completions/index.js +1244 -175
- package/dist/editor-completions/jsDocAnnotations.d.ts +1 -1
- package/dist/editor-completions/modifierCompletions.d.ts +1 -1
- package/dist/export/index.d.ts +7 -1
- package/dist/generated-branding.js +8 -21
- package/dist/generated-version.d.ts +1 -1
- package/dist/generated-version.js +7 -3
- package/dist/generator/annotation-generator.d.ts +84 -0
- package/dist/generator/async-detection.d.ts +1 -1
- package/dist/{body-generator.d.ts → generator/body-generator.d.ts} +7 -3
- package/dist/generator/code-utils.d.ts +15 -60
- package/dist/generator/connection-reads.d.ts +94 -0
- package/dist/generator/control-flow-plan.d.ts +74 -0
- package/dist/generator/control-flow.d.ts +1 -1
- package/dist/generator/exit-assembly.d.ts +11 -0
- package/dist/generator/index.d.ts +4 -5
- package/dist/generator/index.js +34 -11
- package/dist/generator/input-port-values.d.ts +22 -0
- package/dist/generator/{scope-function-generator.d.ts → node-arguments.d.ts} +76 -1
- package/dist/generator/node-invocation.d.ts +74 -0
- package/dist/{node-types-generator.d.ts → generator/node-types-generator.d.ts} +3 -2
- package/dist/generator/scope-closure.d.ts +23 -0
- package/dist/generator/scoped-child.d.ts +49 -0
- package/dist/{sugar-optimizer.d.ts → generator/sugar-optimizer.d.ts} +1 -1
- package/dist/generator/unified.d.ts +14 -2
- package/dist/generator/workflow-generator.d.ts +37 -0
- package/dist/index.d.ts +29 -26
- package/dist/index.js +1322 -92
- package/dist/jsdoc-port-sync/apply-diff.d.ts +15 -0
- package/dist/jsdoc-port-sync/callback-signature.d.ts +17 -0
- package/dist/jsdoc-port-sync/diff.d.ts +5 -7
- package/dist/jsdoc-port-sync/incomplete-lines.d.ts +41 -0
- package/dist/jsdoc-port-sync/index.d.ts +11 -11
- package/dist/jsdoc-port-sync/index.js +88 -45
- package/dist/jsdoc-port-sync/jsdoc-to-signature.d.ts +66 -0
- package/dist/jsdoc-port-sync/port-parser.d.ts +6 -24
- package/dist/jsdoc-port-sync/port-tag-placement.d.ts +55 -0
- package/dist/jsdoc-port-sync/scoped-ports.d.ts +21 -0
- package/dist/jsdoc-port-sync/signature-parser.d.ts +8 -1
- package/dist/jsdoc-port-sync/signature-to-jsdoc.d.ts +77 -0
- package/dist/jsdoc-port-sync/sync.d.ts +4 -1
- package/dist/marketplace/index.d.ts +5 -3
- package/dist/marketplace/index.js +62 -10
- package/dist/marketplace/install.d.ts +24 -0
- package/dist/marketplace/manifest.d.ts +1 -1
- package/dist/marketplace/npmrc.d.ts +24 -0
- package/dist/marketplace/registry.d.ts +46 -11
- package/dist/marketplace/types.d.ts +41 -24
- package/dist/marketplace/validator.d.ts +1 -1
- package/dist/mcp/debug-session.d.ts +2 -4
- package/dist/mcp/dist-imports.d.ts +12 -0
- package/dist/mcp/response-utils.d.ts +11 -9
- package/dist/mcp/server.d.ts +0 -1
- package/dist/mcp/tools-context.d.ts +11 -0
- package/dist/mcp/tools-diagram.d.ts +1 -2
- package/dist/mcp/tools-export.d.ts +2 -2
- package/dist/mcp/tools-marketplace.d.ts +1 -1
- package/dist/mcp/tools-run.d.ts +17 -0
- package/dist/mcp/tools-workflow.d.ts +3 -0
- package/dist/mcp/types.d.ts +4 -14
- package/dist/mcp/workflow-executor.d.ts +57 -19
- package/dist/npm-packages.d.ts +1 -1
- package/dist/npm-packages.js +10 -473
- package/dist/parser/annotation-parser.d.ts +88 -0
- package/dist/parser/annotation-suggestion.d.ts +23 -0
- package/dist/parser/durable-effect-contract.d.ts +10 -0
- package/dist/parser/expression-references.d.ts +101 -0
- package/dist/parser/external-node-types.d.ts +69 -0
- package/dist/{function-like.d.ts → parser/function-like.d.ts} +10 -3
- package/dist/parser/generated-sections.d.ts +25 -0
- package/dist/parser/import-resolution.d.ts +67 -0
- package/dist/parser/import-stub.d.ts +29 -0
- package/dist/parser/jsdoc/config-types.d.ts +209 -0
- package/dist/parser/jsdoc/graph-tags.d.ts +54 -0
- package/dist/parser/jsdoc/node-type-block.d.ts +23 -0
- package/dist/parser/jsdoc/parse-line-once.d.ts +11 -0
- package/dist/parser/jsdoc/port-tags.d.ts +42 -0
- package/dist/parser/jsdoc/runtime-tags.d.ts +65 -0
- package/dist/parser/jsdoc/signature-types.d.ts +52 -0
- package/dist/parser/jsdoc/workflow-block.d.ts +22 -0
- package/dist/parser/jsdoc-parser.d.ts +23 -0
- package/dist/parser/macro-expansion.d.ts +80 -0
- package/dist/parser/module-resolution.d.ts +38 -0
- package/dist/parser/node-inference.d.ts +39 -0
- package/dist/parser/npm-node-types.d.ts +24 -0
- package/dist/parser/pack-handlers.d.ts +12 -0
- package/dist/parser/path-data-resolution.d.ts +75 -0
- package/dist/parser/port-inference.d.ts +15 -0
- package/dist/{resolve-package-types.d.ts → parser/resolve-package-types.d.ts} +4 -0
- package/dist/parser/serialize-deploy-annotations.d.ts +19 -0
- package/dist/parser/tag-registry.d.ts +22 -0
- package/dist/parser/workflow-extraction.d.ts +39 -0
- package/dist/runtime/ExecutionContext.d.ts +87 -99
- package/dist/runtime/continuation-core.d.ts +147 -0
- package/dist/runtime/continuation.d.ts +48 -0
- package/dist/runtime/debug-controller.d.ts +7 -22
- package/dist/runtime/durable-execution.d.ts +176 -0
- package/dist/runtime/events.d.ts +16 -1
- package/dist/runtime/executable-module-contract.d.ts +16 -0
- package/dist/runtime/index.d.ts +13 -10
- package/dist/runtime/index.js +947 -9
- package/dist/runtime/strict-json.d.ts +15 -0
- package/dist/server/access.d.ts +12 -0
- package/dist/server/api.d.ts +126 -0
- package/dist/server/callback-delivery.d.ts +62 -0
- package/dist/server/callback-url.d.ts +44 -0
- package/dist/server/context.d.ts +35 -0
- package/dist/server/http-error.d.ts +10 -0
- package/dist/server/index.d.ts +7 -1
- package/dist/server/index.js +125 -6
- package/dist/server/openapi-document.d.ts +33 -0
- package/dist/server/openapi.d.ts +32 -0
- package/dist/server/respond.d.ts +35 -0
- package/dist/server/route-params.d.ts +17 -0
- package/dist/server/route-plan.d.ts +41 -0
- package/dist/server/routes-catalog.d.ts +5 -0
- package/dist/server/routes-declared.d.ts +12 -0
- package/dist/server/routes-runs.d.ts +8 -0
- package/dist/server/run-driver.d.ts +58 -0
- package/dist/server/run-view.d.ts +26 -0
- package/dist/server/transport.d.ts +35 -0
- package/dist/server/types.d.ts +143 -52
- package/dist/server/webhook-server.d.ts +12 -38
- package/dist/server/workflow-registry.d.ts +7 -4
- package/dist/service-registry.d.ts +49 -0
- package/dist/service-registry.js +123 -0
- package/dist/testing/assertions.d.ts +2 -2
- package/dist/testing/index.d.ts +14 -13
- package/dist/testing/index.js +582 -24
- package/dist/testing/mock-approval.d.ts +3 -5
- package/dist/testing/mock-llm.d.ts +2 -3
- package/dist/testing/recorder.d.ts +5 -6
- package/dist/testing/replayer.d.ts +6 -7
- package/dist/testing/run-store-check.d.ts +3 -0
- package/dist/testing/token-tracker.d.ts +2 -2
- package/dist/{type-mappings.d.ts → types/type-mappings.d.ts} +13 -1
- package/dist/utils/error-utils.d.ts +4 -2
- package/dist/utils/port-ordering.d.ts +2 -2
- package/dist/utils/port-tag-utils.d.ts +1 -1
- package/dist/validation/agent-detection.d.ts +17 -5
- package/dist/validation/agent-rules.d.ts +6 -7
- package/dist/validation/core-rules.d.ts +49 -0
- package/dist/validation/design-rules.d.ts +9 -3
- package/dist/validation/rule-registry.d.ts +3 -3
- package/dist/validation/rules/connections.d.ts +27 -0
- package/dist/validation/rules/context.d.ts +11 -0
- package/dist/validation/rules/cycles.d.ts +17 -0
- package/dist/validation/rules/data-flow.d.ts +19 -0
- package/dist/validation/rules/scope-topology.d.ts +35 -0
- package/dist/validation/rules/type-compatibility.d.ts +30 -0
- package/dist/validation/type-checker.d.ts +39 -0
- package/dist/validation/validator-helpers.d.ts +31 -0
- package/dist/validation/validator.d.ts +30 -0
- package/docs/reference/advanced-annotations.md +277 -60
- package/docs/reference/built-in-nodes.md +164 -94
- package/docs/reference/cancellation.md +44 -0
- package/docs/reference/cli-reference.md +252 -234
- package/docs/reference/compilation.md +36 -109
- package/docs/reference/concepts.md +80 -63
- package/docs/reference/console.md +169 -0
- package/docs/reference/debugging.md +26 -57
- package/docs/reference/deployment.md +217 -143
- package/docs/reference/durable-gates.md +445 -0
- package/docs/reference/error-codes.md +90 -43
- package/docs/reference/export-interface.md +91 -26
- package/docs/reference/iterative-development.md +50 -28
- package/docs/reference/jsdoc-grammar.md +66 -311
- package/docs/reference/library.md +250 -0
- package/docs/reference/marketplace.md +301 -152
- package/docs/reference/mcp-tools.md +102 -0
- package/docs/reference/node-conversion.md +84 -59
- package/docs/reference/orientation.md +68 -0
- package/docs/reference/scaffold.md +5 -4
- package/docs/reference/tutorial.md +106 -166
- package/docs/reference/visual-reference.md +1 -1
- package/package.json +85 -50
- package/dist/agent/agent-loop.js +0 -156
- package/dist/agent/cli-spawn-config.js +0 -65
- package/dist/agent/device-connection.d.ts +0 -79
- package/dist/agent/device-connection.js +0 -184
- package/dist/agent/env-allowlist.js +0 -60
- package/dist/agent/providers/anthropic.js +0 -198
- package/dist/agent/providers/claude-cli.js +0 -161
- package/dist/agent/providers/openai-compat.js +0 -205
- package/dist/agent/providers/platform.d.ts +0 -23
- package/dist/agent/providers/platform.js +0 -132
- package/dist/agent/streaming.js +0 -186
- package/dist/agent/types.js +0 -20
- package/dist/annotation-generator.d.ts +0 -50
- package/dist/annotation-generator.js +0 -743
- package/dist/api/builder.js +0 -345
- package/dist/api/command-runner.js +0 -787
- package/dist/api/compile.js +0 -148
- package/dist/api/extract-types.js +0 -57
- package/dist/api/generate-in-place.js +0 -1477
- package/dist/api/generate.js +0 -514
- package/dist/api/helpers.js +0 -285
- package/dist/api/inline-runtime.js +0 -526
- package/dist/api/manipulation/connections.js +0 -151
- package/dist/api/manipulation/index.js +0 -41
- package/dist/api/manipulation/node-types.js +0 -200
- package/dist/api/manipulation/nodes.js +0 -355
- package/dist/api/manipulation/ports.js +0 -228
- package/dist/api/manipulation/scopes.js +0 -156
- package/dist/api/manipulation/workflow.js +0 -116
- package/dist/api/modify-operation.js +0 -177
- package/dist/api/parse.js +0 -115
- package/dist/api/patterns.d.ts +0 -112
- package/dist/api/patterns.js +0 -303
- package/dist/api/query.js +0 -840
- package/dist/api/templates.js +0 -117
- package/dist/api/transform.js +0 -40
- package/dist/api/validate.js +0 -64
- package/dist/api/validation-registry.js +0 -10
- package/dist/api/workflow-file-operations.js +0 -180
- package/dist/ast/builder.js +0 -395
- package/dist/ast/serialization-node.js +0 -30
- package/dist/ast/serialization.js +0 -134
- package/dist/ast/types.js +0 -2
- package/dist/ast/workflow-utils.js +0 -114
- package/dist/body-generator.js +0 -35
- package/dist/built-in-nodes/coercion-types.js +0 -61
- package/dist/built-in-nodes/delay.js +0 -29
- package/dist/built-in-nodes/generated-registry.js +0 -299
- package/dist/built-in-nodes/invoke-workflow.js +0 -36
- package/dist/built-in-nodes/mock-types.js +0 -42
- package/dist/built-in-nodes/wait-for-agent.js +0 -31
- package/dist/built-in-nodes/wait-for-event.js +0 -25
- package/dist/chevrotain-parser/coerce-parser.js +0 -103
- package/dist/chevrotain-parser/connect-parser.js +0 -136
- package/dist/chevrotain-parser/fan-parser.js +0 -149
- package/dist/chevrotain-parser/grammar-diagrams.js +0 -273
- package/dist/chevrotain-parser/index.js +0 -31
- package/dist/chevrotain-parser/map-parser.js +0 -130
- package/dist/chevrotain-parser/node-parser.js +0 -558
- package/dist/chevrotain-parser/path-parser.js +0 -140
- package/dist/chevrotain-parser/port-parser.js +0 -519
- package/dist/chevrotain-parser/position-parser.d.ts +0 -20
- package/dist/chevrotain-parser/position-parser.js +0 -83
- package/dist/chevrotain-parser/scope-parser.js +0 -104
- package/dist/chevrotain-parser/tokens.js +0 -429
- package/dist/chevrotain-parser/trigger-cancel-parser.js +0 -291
- package/dist/cli/commands/account.d.ts +0 -4
- package/dist/cli/commands/account.js +0 -50
- package/dist/cli/commands/ai-credentials.d.ts +0 -12
- package/dist/cli/commands/ai-credentials.js +0 -95
- package/dist/cli/commands/apikey.d.ts +0 -4
- package/dist/cli/commands/apikey.js +0 -64
- package/dist/cli/commands/auth.d.ts +0 -9
- package/dist/cli/commands/auth.js +0 -255
- package/dist/cli/commands/compile.js +0 -331
- package/dist/cli/commands/connect.d.ts +0 -4
- package/dist/cli/commands/connect.js +0 -163
- package/dist/cli/commands/context.js +0 -51
- package/dist/cli/commands/create.js +0 -139
- package/dist/cli/commands/deploy.d.ts +0 -6
- package/dist/cli/commands/deploy.js +0 -74
- package/dist/cli/commands/dev.js +0 -227
- package/dist/cli/commands/diagram.js +0 -39
- package/dist/cli/commands/diff.js +0 -57
- package/dist/cli/commands/docs.js +0 -74
- package/dist/cli/commands/export.js +0 -153
- package/dist/cli/commands/grammar.js +0 -40
- package/dist/cli/commands/implement.js +0 -91
- package/dist/cli/commands/init-personas.js +0 -541
- package/dist/cli/commands/init.js +0 -797
- package/dist/cli/commands/market.js +0 -440
- package/dist/cli/commands/mcp-setup.js +0 -433
- package/dist/cli/commands/migrate.js +0 -91
- package/dist/cli/commands/modify.js +0 -58
- package/dist/cli/commands/openapi.js +0 -71
- package/dist/cli/commands/org.d.ts +0 -8
- package/dist/cli/commands/org.js +0 -136
- package/dist/cli/commands/pattern.d.ts +0 -34
- package/dist/cli/commands/pattern.js +0 -186
- package/dist/cli/commands/plugin.d.ts +0 -16
- package/dist/cli/commands/plugin.js +0 -176
- package/dist/cli/commands/run.js +0 -742
- package/dist/cli/commands/serve.js +0 -93
- package/dist/cli/commands/status.js +0 -123
- package/dist/cli/commands/strip.js +0 -61
- package/dist/cli/commands/templates.js +0 -58
- package/dist/cli/commands/validate.js +0 -267
- package/dist/cli/commands/watch.js +0 -71
- package/dist/cli/config/credentials.d.ts +0 -15
- package/dist/cli/config/credentials.js +0 -43
- package/dist/cli/config/platform-client.d.ts +0 -123
- package/dist/cli/config/platform-client.js +0 -248
- package/dist/cli/env-setup.js +0 -12
- package/dist/cli/index.js +0 -850
- package/dist/cli/pack-commands.js +0 -122
- package/dist/cli/postinstall.d.ts +0 -16
- package/dist/cli/postinstall.js +0 -119
- package/dist/cli/templates/ai/mock-provider.js +0 -64
- package/dist/cli/templates/ai/types.js +0 -5
- package/dist/cli/templates/approvals/index.d.ts +0 -15
- package/dist/cli/templates/approvals/index.js +0 -241
- package/dist/cli/templates/index.js +0 -123
- package/dist/cli/templates/nodes/agent-router.js +0 -114
- package/dist/cli/templates/nodes/aggregator.js +0 -63
- package/dist/cli/templates/nodes/conversation-memory.js +0 -85
- package/dist/cli/templates/nodes/http.js +0 -80
- package/dist/cli/templates/nodes/human-approval.js +0 -109
- package/dist/cli/templates/nodes/json-extractor.js +0 -119
- package/dist/cli/templates/nodes/llm-call.js +0 -106
- package/dist/cli/templates/nodes/prompt-template.js +0 -52
- package/dist/cli/templates/nodes/rag-retriever.js +0 -128
- package/dist/cli/templates/nodes/tool-executor.js +0 -108
- package/dist/cli/templates/nodes/transformer.js +0 -68
- package/dist/cli/templates/nodes/validator.js +0 -62
- package/dist/cli/templates/pack-loader.js +0 -58
- package/dist/cli/templates/providers/index.js +0 -239
- package/dist/cli/templates/shared/approval-types.js +0 -31
- package/dist/cli/templates/shared/llm-types.js +0 -109
- package/dist/cli/templates/workflows/aggregator.js +0 -101
- package/dist/cli/templates/workflows/ai-agent.js +0 -326
- package/dist/cli/templates/workflows/ai-chat.js +0 -167
- package/dist/cli/templates/workflows/ai-rag.js +0 -184
- package/dist/cli/templates/workflows/ai-react.js +0 -293
- package/dist/cli/templates/workflows/conditional.js +0 -139
- package/dist/cli/templates/workflows/error-handler.js +0 -145
- package/dist/cli/templates/workflows/foreach.js +0 -140
- package/dist/cli/templates/workflows/sequential.js +0 -200
- package/dist/cli/templates/workflows/webhook.js +0 -158
- package/dist/cli/utils/cli-helpers.d.ts +0 -44
- package/dist/cli/utils/cli-helpers.js +0 -99
- package/dist/cli/utils/logger.js +0 -126
- package/dist/cli/utils/parse-int-strict.js +0 -17
- package/dist/cli/utils/safe-write.js +0 -54
- package/dist/deployment/config/defaults.d.ts +0 -29
- package/dist/deployment/config/defaults.js +0 -98
- package/dist/deployment/config/loader.d.ts +0 -24
- package/dist/deployment/config/loader.js +0 -237
- package/dist/deployment/config/types.d.ts +0 -117
- package/dist/deployment/config/types.js +0 -5
- package/dist/deployment/core/adapters.d.ts +0 -66
- package/dist/deployment/core/adapters.js +0 -156
- package/dist/deployment/core/executor.d.ts +0 -62
- package/dist/deployment/core/executor.js +0 -197
- package/dist/deployment/core/formatters.d.ts +0 -42
- package/dist/deployment/core/formatters.js +0 -146
- package/dist/deployment/openapi/generator.d.ts +0 -146
- package/dist/deployment/openapi/generator.js +0 -347
- package/dist/deployment/openapi/schema-converter.d.ts +0 -49
- package/dist/deployment/openapi/schema-converter.js +0 -192
- package/dist/deployment/targets/base.js +0 -855
- package/dist/deployment/types.d.ts +0 -140
- package/dist/deployment/types.js +0 -8
- package/dist/diagram/ascii-renderer.js +0 -528
- package/dist/diagram/geometry.js +0 -1226
- package/dist/diagram/html-viewer.d.ts +0 -21
- package/dist/diagram/html-viewer.js +0 -1745
- package/dist/diagram/layout.js +0 -143
- package/dist/diagram/orthogonal-router.js +0 -458
- package/dist/diagram/renderer.d.ts +0 -3
- package/dist/diagram/renderer.js +0 -280
- package/dist/diagram/theme.js +0 -282
- package/dist/diagram/types.js +0 -2
- package/dist/diff/WorkflowDiffer.js +0 -429
- package/dist/diff/formatDiff.js +0 -239
- package/dist/diff/impact.js +0 -119
- package/dist/diff/types.js +0 -35
- package/dist/doc-metadata/extractors/annotations.js +0 -638
- package/dist/doc-metadata/extractors/cli-commands.js +0 -326
- package/dist/doc-metadata/extractors/core-metadata.js +0 -61
- package/dist/doc-metadata/extractors/error-codes.js +0 -372
- package/dist/doc-metadata/extractors/grammar-rules.js +0 -51
- package/dist/doc-metadata/extractors/mcp-tools.js +0 -705
- package/dist/doc-metadata/extractors/plugin-api.d.ts +0 -19
- package/dist/doc-metadata/extractors/plugin-api.js +0 -279
- package/dist/doc-metadata/types.js +0 -5
- package/dist/editor-completions/annotationValues.js +0 -146
- package/dist/editor-completions/contextParser.js +0 -410
- package/dist/editor-completions/dataTypes.js +0 -95
- package/dist/editor-completions/goToDefinition.js +0 -112
- package/dist/editor-completions/jsDocAnnotations.js +0 -359
- package/dist/editor-completions/modifierCompletions.js +0 -197
- package/dist/editor-completions/types.js +0 -8
- package/dist/export/index.js +0 -212
- package/dist/extensions/index.d.ts +0 -16
- package/dist/extensions/index.js +0 -17
- package/dist/friendly-errors.js +0 -761
- package/dist/function-like.js +0 -84
- package/dist/generator/async-detection.js +0 -56
- package/dist/generator/code-utils.js +0 -551
- package/dist/generator/compile-target-registry.d.ts +0 -20
- package/dist/generator/compile-target-registry.js +0 -20
- package/dist/generator/control-flow.js +0 -358
- package/dist/generator/dev-mode-registry.d.ts +0 -27
- package/dist/generator/dev-mode-registry.js +0 -20
- package/dist/generator/scope-function-generator.js +0 -397
- package/dist/generator/unified.js +0 -1831
- package/dist/generator.d.ts +0 -54
- package/dist/generator.js +0 -101
- package/dist/jsdoc-parser.d.ts +0 -377
- package/dist/jsdoc-parser.js +0 -1189
- package/dist/jsdoc-port-sync/constants.js +0 -103
- package/dist/jsdoc-port-sync/diff.js +0 -319
- package/dist/jsdoc-port-sync/port-parser.js +0 -579
- package/dist/jsdoc-port-sync/rename.js +0 -256
- package/dist/jsdoc-port-sync/signature-parser.js +0 -559
- package/dist/jsdoc-port-sync/sync.js +0 -653
- package/dist/marketplace/manifest.js +0 -194
- package/dist/marketplace/registry.js +0 -198
- package/dist/marketplace/types.js +0 -9
- package/dist/marketplace/validator.js +0 -150
- package/dist/mcp/agent-channel.d.ts +0 -35
- package/dist/mcp/agent-channel.js +0 -61
- package/dist/mcp/auto-registration.d.ts +0 -3
- package/dist/mcp/auto-registration.js +0 -62
- package/dist/mcp/debug-session.js +0 -25
- package/dist/mcp/index.d.ts +0 -11
- package/dist/mcp/index.js +0 -10
- package/dist/mcp/pack-tools.js +0 -59
- package/dist/mcp/prompts.js +0 -68
- package/dist/mcp/response-utils.js +0 -97
- package/dist/mcp/run-registry.d.ts +0 -29
- package/dist/mcp/run-registry.js +0 -24
- package/dist/mcp/server.js +0 -63
- package/dist/mcp/tools-context.js +0 -51
- package/dist/mcp/tools-debug.js +0 -451
- package/dist/mcp/tools-diagram.js +0 -97
- package/dist/mcp/tools-docs.js +0 -62
- package/dist/mcp/tools-export.js +0 -222
- package/dist/mcp/tools-marketplace.js +0 -132
- package/dist/mcp/tools-model.d.ts +0 -3
- package/dist/mcp/tools-model.js +0 -279
- package/dist/mcp/tools-pattern.d.ts +0 -3
- package/dist/mcp/tools-pattern.js +0 -604
- package/dist/mcp/tools-query.js +0 -377
- package/dist/mcp/tools-resources.js +0 -41
- package/dist/mcp/tools-template.js +0 -119
- package/dist/mcp/tools-workflow-run.d.ts +0 -40
- package/dist/mcp/tools-workflow-run.js +0 -150
- package/dist/mcp/types.js +0 -2
- package/dist/mcp/workflow-executor.js +0 -242
- package/dist/migration/registry.js +0 -29
- package/dist/node-types-generator.js +0 -139
- package/dist/parser/tag-registry.js +0 -57
- package/dist/parser.d.ts +0 -232
- package/dist/parser.js +0 -2500
- package/dist/plugin/PluginPanel.d.ts +0 -12
- package/dist/plugin/PluginPanel.js +0 -5
- package/dist/plugin/index.d.ts +0 -13
- package/dist/plugin/index.js +0 -14
- package/dist/plugin/types.d.ts +0 -75
- package/dist/plugin/types.js +0 -8
- package/dist/resolve-package-types.js +0 -123
- package/dist/runtime/CancellationError.js +0 -20
- package/dist/runtime/ExecutionContext.js +0 -280
- package/dist/runtime/builtin-functions.js +0 -549
- package/dist/runtime/checkpoint.d.ts +0 -84
- package/dist/runtime/checkpoint.js +0 -225
- package/dist/runtime/debug-controller.js +0 -247
- package/dist/runtime/events.js +0 -2
- package/dist/runtime/function-registry.js +0 -66
- package/dist/runtime/parameter-resolver.js +0 -113
- package/dist/server/types.js +0 -5
- package/dist/server/webhook-server.js +0 -269
- package/dist/server/workflow-registry.js +0 -202
- package/dist/shared-project.js +0 -28
- package/dist/sugar-optimizer.js +0 -498
- package/dist/testing/assertions.js +0 -127
- package/dist/testing/mock-approval.js +0 -98
- package/dist/testing/mock-llm.js +0 -119
- package/dist/testing/recorder.js +0 -70
- package/dist/testing/replayer.js +0 -143
- package/dist/testing/token-tracker.js +0 -94
- package/dist/type-checker.d.ts +0 -42
- package/dist/type-checker.js +0 -190
- package/dist/type-mappings.js +0 -131
- package/dist/types/branded-ports.d.ts +0 -151
- package/dist/types/branded-ports.js +0 -121
- package/dist/types/index.d.ts +0 -5
- package/dist/types/index.js +0 -5
- package/dist/types.d.ts +0 -139
- package/dist/types.js +0 -15
- package/dist/utils/error-utils.js +0 -27
- package/dist/utils/lru-cache.js +0 -40
- package/dist/utils/port-ordering.js +0 -81
- package/dist/utils/port-tag-utils.js +0 -41
- package/dist/utils/string-distance.js +0 -56
- package/dist/validation/agent-detection.js +0 -115
- package/dist/validation/agent-rules.js +0 -262
- package/dist/validation/design-rules.js +0 -377
- package/dist/validation/rule-registry.js +0 -37
- package/dist/validator.d.ts +0 -113
- package/dist/validator.js +0 -1631
- package/docs/reference/patterns.md +0 -159
- package/scripts/postinstall.cjs +0 -86
- /package/dist/{shared-project.d.ts → parser/shared-project.d.ts} +0 -0
- /package/dist/{friendly-errors.d.ts → validation/friendly-errors.d.ts} +0 -0
|
@@ -1,713 +1,3387 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
let
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
+
try {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
} catch (e) {
|
|
11
|
+
throw mod = 0, e;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
var __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from))
|
|
17
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
28
|
+
mod
|
|
29
|
+
));
|
|
30
|
+
|
|
31
|
+
// node_modules/picocolors/picocolors.js
|
|
32
|
+
var require_picocolors = __commonJS({
|
|
33
|
+
"node_modules/picocolors/picocolors.js"(exports, module) {
|
|
34
|
+
var p = process || {};
|
|
35
|
+
var argv = p.argv || [];
|
|
36
|
+
var env = p.env || {};
|
|
37
|
+
var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
38
|
+
var formatter = (open, close, replace = open) => (input) => {
|
|
39
|
+
let string = "" + input, index = string.indexOf(close, open.length);
|
|
40
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
41
|
+
};
|
|
42
|
+
var replaceClose = (string, close, replace, index) => {
|
|
43
|
+
let result = "", cursor = 0;
|
|
44
|
+
do {
|
|
45
|
+
result += string.substring(cursor, index) + replace;
|
|
46
|
+
cursor = index + close.length;
|
|
47
|
+
index = string.indexOf(close, cursor);
|
|
48
|
+
} while (~index);
|
|
49
|
+
return result + string.substring(cursor);
|
|
50
|
+
};
|
|
51
|
+
var createColors = (enabled = isColorSupported) => {
|
|
52
|
+
let f = enabled ? formatter : () => String;
|
|
53
|
+
return {
|
|
54
|
+
isColorSupported: enabled,
|
|
55
|
+
reset: f("\x1B[0m", "\x1B[0m"),
|
|
56
|
+
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
57
|
+
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
58
|
+
italic: f("\x1B[3m", "\x1B[23m"),
|
|
59
|
+
underline: f("\x1B[4m", "\x1B[24m"),
|
|
60
|
+
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
61
|
+
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
62
|
+
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
63
|
+
black: f("\x1B[30m", "\x1B[39m"),
|
|
64
|
+
red: f("\x1B[31m", "\x1B[39m"),
|
|
65
|
+
green: f("\x1B[32m", "\x1B[39m"),
|
|
66
|
+
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
67
|
+
blue: f("\x1B[34m", "\x1B[39m"),
|
|
68
|
+
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
69
|
+
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
70
|
+
white: f("\x1B[37m", "\x1B[39m"),
|
|
71
|
+
gray: f("\x1B[90m", "\x1B[39m"),
|
|
72
|
+
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
73
|
+
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
74
|
+
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
75
|
+
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
76
|
+
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
77
|
+
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
78
|
+
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
79
|
+
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
80
|
+
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
81
|
+
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
82
|
+
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
83
|
+
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
84
|
+
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
85
|
+
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
86
|
+
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
87
|
+
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
88
|
+
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
89
|
+
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
90
|
+
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
91
|
+
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
92
|
+
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
93
|
+
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
94
|
+
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
95
|
+
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
module.exports = createColors();
|
|
99
|
+
module.exports.createColors = createColors;
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
// src/service-registry.ts
|
|
104
|
+
import * as fs from "node:fs";
|
|
105
|
+
import * as os from "node:os";
|
|
106
|
+
import * as path from "node:path";
|
|
107
|
+
|
|
108
|
+
// src/generated-version.ts
|
|
109
|
+
var VERSION = "0.44.0";
|
|
110
|
+
|
|
111
|
+
// src/service-registry.ts
|
|
112
|
+
function servicesDir() {
|
|
113
|
+
return process.env.FW_SERVICES_DIR ?? path.join(os.homedir(), ".fw", "services");
|
|
114
|
+
}
|
|
115
|
+
function isAlive(pid) {
|
|
116
|
+
try {
|
|
117
|
+
process.kill(pid, 0);
|
|
118
|
+
return true;
|
|
119
|
+
} catch (err) {
|
|
120
|
+
return err.code === "EPERM";
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
function listServices(dir = servicesDir()) {
|
|
124
|
+
let names;
|
|
125
|
+
try {
|
|
126
|
+
names = fs.readdirSync(dir).filter((n) => n.endsWith(".json"));
|
|
127
|
+
} catch {
|
|
128
|
+
return [];
|
|
129
|
+
}
|
|
130
|
+
const out = [];
|
|
131
|
+
for (const name of names) {
|
|
132
|
+
const file = path.join(dir, name);
|
|
133
|
+
let record;
|
|
134
|
+
try {
|
|
135
|
+
record = JSON.parse(fs.readFileSync(file, "utf8"));
|
|
136
|
+
} catch {
|
|
137
|
+
continue;
|
|
48
138
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
export function detectProjectModuleFormat(cwd) {
|
|
56
|
-
// First check package.json "type" field
|
|
57
|
-
const pkgPath = path.join(cwd, 'package.json');
|
|
58
|
-
if (fs.existsSync(pkgPath)) {
|
|
59
|
-
try {
|
|
60
|
-
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
61
|
-
if (pkg.type === 'module') {
|
|
62
|
-
return { format: 'esm', source: 'package.json', details: '"type": "module"' };
|
|
63
|
-
}
|
|
64
|
-
// "commonjs" or no type field means CJS
|
|
65
|
-
if (pkg.type === 'commonjs' || !pkg.type) {
|
|
66
|
-
return {
|
|
67
|
-
format: 'cjs',
|
|
68
|
-
source: 'package.json',
|
|
69
|
-
details: pkg.type ? '"type": "commonjs"' : 'no "type" field (defaults to CommonJS)',
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
catch {
|
|
74
|
-
// Fall through to tsconfig check
|
|
75
|
-
}
|
|
139
|
+
if (!record || typeof record.pid !== "number" || !isAlive(record.pid)) {
|
|
140
|
+
try {
|
|
141
|
+
fs.rmSync(file, { force: true });
|
|
142
|
+
} catch {
|
|
143
|
+
}
|
|
144
|
+
continue;
|
|
76
145
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
146
|
+
out.push(record);
|
|
147
|
+
}
|
|
148
|
+
return out.sort((a, b) => b.startedAt.localeCompare(a.startedAt));
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// src/cli/commands/doctor.ts
|
|
152
|
+
import * as fs2 from "fs";
|
|
153
|
+
import * as path2 from "path";
|
|
154
|
+
import { fileURLToPath } from "url";
|
|
155
|
+
import { execSync } from "child_process";
|
|
156
|
+
|
|
157
|
+
// node_modules/js-yaml/dist/js-yaml.mjs
|
|
158
|
+
var NOT_RESOLVED = /* @__PURE__ */ Symbol("NOT_RESOLVED");
|
|
159
|
+
function defineScalarTag(tagName, options) {
|
|
160
|
+
return {
|
|
161
|
+
tagName,
|
|
162
|
+
nodeKind: "scalar",
|
|
163
|
+
implicit: options.implicit ?? false,
|
|
164
|
+
matchByTagPrefix: options.matchByTagPrefix ?? false,
|
|
165
|
+
implicitFirstChars: options.implicitFirstChars ?? null,
|
|
166
|
+
resolve: options.resolve,
|
|
167
|
+
identify: options.identify,
|
|
168
|
+
represent: options.represent ?? ((data) => String(data)),
|
|
169
|
+
representTagName: options.representTagName ?? (() => tagName)
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
function defineSequenceTag(tagName, options) {
|
|
173
|
+
const carrierIsResult = options.finalize === void 0;
|
|
174
|
+
return {
|
|
175
|
+
tagName,
|
|
176
|
+
nodeKind: "sequence",
|
|
177
|
+
implicit: false,
|
|
178
|
+
matchByTagPrefix: options.matchByTagPrefix ?? false,
|
|
179
|
+
create: options.create,
|
|
180
|
+
addItem: options.addItem,
|
|
181
|
+
finalize: options.finalize ?? ((carrier) => carrier),
|
|
182
|
+
carrierIsResult,
|
|
183
|
+
identify: options.identify,
|
|
184
|
+
represent: options.represent ?? ((data) => data),
|
|
185
|
+
representTagName: options.representTagName ?? (() => tagName)
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
function defineMappingTag(tagName, options) {
|
|
189
|
+
const carrierIsResult = options.finalize === void 0;
|
|
190
|
+
return {
|
|
191
|
+
tagName,
|
|
192
|
+
nodeKind: "mapping",
|
|
193
|
+
implicit: false,
|
|
194
|
+
matchByTagPrefix: options.matchByTagPrefix ?? false,
|
|
195
|
+
create: options.create,
|
|
196
|
+
addPair: options.addPair,
|
|
197
|
+
has: options.has,
|
|
198
|
+
keys: options.keys,
|
|
199
|
+
get: options.get,
|
|
200
|
+
finalize: options.finalize ?? ((carrier) => carrier),
|
|
201
|
+
carrierIsResult,
|
|
202
|
+
identify: options.identify,
|
|
203
|
+
represent: options.represent ?? ((data) => data),
|
|
204
|
+
representTagName: options.representTagName ?? (() => tagName)
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
var strTag = defineScalarTag("tag:yaml.org,2002:str", {
|
|
208
|
+
resolve: (source) => source,
|
|
209
|
+
identify: (data) => typeof data === "string"
|
|
210
|
+
});
|
|
211
|
+
var NULL_VALUES$1 = [
|
|
212
|
+
"",
|
|
213
|
+
"~",
|
|
214
|
+
"null",
|
|
215
|
+
"Null",
|
|
216
|
+
"NULL"
|
|
217
|
+
];
|
|
218
|
+
var nullCoreTag = defineScalarTag("tag:yaml.org,2002:null", {
|
|
219
|
+
implicit: true,
|
|
220
|
+
implicitFirstChars: [
|
|
221
|
+
"",
|
|
222
|
+
"~",
|
|
223
|
+
"n",
|
|
224
|
+
"N"
|
|
225
|
+
],
|
|
226
|
+
resolve: (source) => {
|
|
227
|
+
if (NULL_VALUES$1.indexOf(source) !== -1) return null;
|
|
228
|
+
return NOT_RESOLVED;
|
|
229
|
+
},
|
|
230
|
+
identify: (object) => object === null,
|
|
231
|
+
represent: () => "null"
|
|
232
|
+
});
|
|
233
|
+
var nullJsonTag = defineScalarTag("tag:yaml.org,2002:null", {
|
|
234
|
+
implicit: true,
|
|
235
|
+
implicitFirstChars: ["n"],
|
|
236
|
+
resolve: (source, isExplicit) => {
|
|
237
|
+
if (source === "null" || isExplicit && source === "") return null;
|
|
238
|
+
return NOT_RESOLVED;
|
|
239
|
+
},
|
|
240
|
+
identify: (object) => object === null,
|
|
241
|
+
represent: () => "null"
|
|
242
|
+
});
|
|
243
|
+
var NULL_VALUES = [
|
|
244
|
+
"",
|
|
245
|
+
"~",
|
|
246
|
+
"null",
|
|
247
|
+
"Null",
|
|
248
|
+
"NULL"
|
|
249
|
+
];
|
|
250
|
+
var nullYaml11Tag = defineScalarTag("tag:yaml.org,2002:null", {
|
|
251
|
+
implicit: true,
|
|
252
|
+
implicitFirstChars: [
|
|
253
|
+
"",
|
|
254
|
+
"~",
|
|
255
|
+
"n",
|
|
256
|
+
"N"
|
|
257
|
+
],
|
|
258
|
+
resolve: (source) => {
|
|
259
|
+
if (NULL_VALUES.indexOf(source) !== -1) return null;
|
|
260
|
+
return NOT_RESOLVED;
|
|
261
|
+
},
|
|
262
|
+
identify: (object) => object === null,
|
|
263
|
+
represent: () => "null"
|
|
264
|
+
});
|
|
265
|
+
var TRUE_VALUES$2 = [
|
|
266
|
+
"true",
|
|
267
|
+
"True",
|
|
268
|
+
"TRUE"
|
|
269
|
+
];
|
|
270
|
+
var FALSE_VALUES$2 = [
|
|
271
|
+
"false",
|
|
272
|
+
"False",
|
|
273
|
+
"FALSE"
|
|
274
|
+
];
|
|
275
|
+
var boolCoreTag = defineScalarTag("tag:yaml.org,2002:bool", {
|
|
276
|
+
implicit: true,
|
|
277
|
+
implicitFirstChars: [
|
|
278
|
+
"t",
|
|
279
|
+
"T",
|
|
280
|
+
"f",
|
|
281
|
+
"F"
|
|
282
|
+
],
|
|
283
|
+
resolve: (source) => {
|
|
284
|
+
if (TRUE_VALUES$2.indexOf(source) !== -1) return true;
|
|
285
|
+
if (FALSE_VALUES$2.indexOf(source) !== -1) return false;
|
|
286
|
+
return NOT_RESOLVED;
|
|
287
|
+
},
|
|
288
|
+
identify: (object) => Object.prototype.toString.call(object) === "[object Boolean]",
|
|
289
|
+
represent: (object) => object ? "true" : "false"
|
|
290
|
+
});
|
|
291
|
+
var TRUE_VALUES$1 = ["true"];
|
|
292
|
+
var FALSE_VALUES$1 = ["false"];
|
|
293
|
+
var boolJsonTag = defineScalarTag("tag:yaml.org,2002:bool", {
|
|
294
|
+
implicit: true,
|
|
295
|
+
implicitFirstChars: ["t", "f"],
|
|
296
|
+
resolve: (source) => {
|
|
297
|
+
if (TRUE_VALUES$1.indexOf(source) !== -1) return true;
|
|
298
|
+
if (FALSE_VALUES$1.indexOf(source) !== -1) return false;
|
|
299
|
+
return NOT_RESOLVED;
|
|
300
|
+
},
|
|
301
|
+
identify: (object) => Object.prototype.toString.call(object) === "[object Boolean]",
|
|
302
|
+
represent: (object) => object ? "true" : "false"
|
|
303
|
+
});
|
|
304
|
+
var TRUE_VALUES = [
|
|
305
|
+
"true",
|
|
306
|
+
"True",
|
|
307
|
+
"TRUE",
|
|
308
|
+
"y",
|
|
309
|
+
"Y",
|
|
310
|
+
"yes",
|
|
311
|
+
"Yes",
|
|
312
|
+
"YES",
|
|
313
|
+
"on",
|
|
314
|
+
"On",
|
|
315
|
+
"ON"
|
|
316
|
+
];
|
|
317
|
+
var FALSE_VALUES = [
|
|
318
|
+
"false",
|
|
319
|
+
"False",
|
|
320
|
+
"FALSE",
|
|
321
|
+
"n",
|
|
322
|
+
"N",
|
|
323
|
+
"no",
|
|
324
|
+
"No",
|
|
325
|
+
"NO",
|
|
326
|
+
"off",
|
|
327
|
+
"Off",
|
|
328
|
+
"OFF"
|
|
329
|
+
];
|
|
330
|
+
var boolYaml11Tag = defineScalarTag("tag:yaml.org,2002:bool", {
|
|
331
|
+
implicit: true,
|
|
332
|
+
implicitFirstChars: [
|
|
333
|
+
"y",
|
|
334
|
+
"Y",
|
|
335
|
+
"n",
|
|
336
|
+
"N",
|
|
337
|
+
"t",
|
|
338
|
+
"T",
|
|
339
|
+
"f",
|
|
340
|
+
"F",
|
|
341
|
+
"o",
|
|
342
|
+
"O"
|
|
343
|
+
],
|
|
344
|
+
resolve: (source) => {
|
|
345
|
+
if (TRUE_VALUES.indexOf(source) !== -1) return true;
|
|
346
|
+
if (FALSE_VALUES.indexOf(source) !== -1) return false;
|
|
347
|
+
return NOT_RESOLVED;
|
|
348
|
+
},
|
|
349
|
+
identify: (object) => Object.prototype.toString.call(object) === "[object Boolean]",
|
|
350
|
+
represent: (object) => object ? "true" : "false"
|
|
351
|
+
});
|
|
352
|
+
var YAML_INTEGER_IMPLICIT_PATTERN$1 = /* @__PURE__ */ new RegExp("^(?:0o[0-7]+|0x[0-9a-fA-F]+|[-+]?[0-9]+)$");
|
|
353
|
+
var YAML_INTEGER_EXPLICIT_PATTERN$1 = /* @__PURE__ */ new RegExp("^(?:[-+]?0b[0-1]+|[-+]?0o[0-7]+|[-+]?0x[0-9a-fA-F]+|[-+]?[0-9]+)$");
|
|
354
|
+
function parseYamlInteger$2(source) {
|
|
355
|
+
let value = source;
|
|
356
|
+
let sign = 1;
|
|
357
|
+
if (value[0] === "-" || value[0] === "+") {
|
|
358
|
+
if (value[0] === "-") sign = -1;
|
|
359
|
+
value = value.slice(1);
|
|
360
|
+
}
|
|
361
|
+
if (value.startsWith("0b")) return sign * parseInt(value.slice(2), 2);
|
|
362
|
+
if (value.startsWith("0o")) return sign * parseInt(value.slice(2), 8);
|
|
363
|
+
if (value.startsWith("0x")) return sign * parseInt(value.slice(2), 16);
|
|
364
|
+
return sign * parseInt(value, 10);
|
|
365
|
+
}
|
|
366
|
+
function resolveYamlInteger$2(source, isExplicit) {
|
|
367
|
+
if (isExplicit) {
|
|
368
|
+
if (!YAML_INTEGER_EXPLICIT_PATTERN$1.test(source)) return NOT_RESOLVED;
|
|
369
|
+
} else if (!YAML_INTEGER_IMPLICIT_PATTERN$1.test(source)) return NOT_RESOLVED;
|
|
370
|
+
const result = parseYamlInteger$2(source);
|
|
371
|
+
return Number.isFinite(result) ? result : NOT_RESOLVED;
|
|
372
|
+
}
|
|
373
|
+
var intCoreTag = defineScalarTag("tag:yaml.org,2002:int", {
|
|
374
|
+
implicit: true,
|
|
375
|
+
implicitFirstChars: [
|
|
376
|
+
"-",
|
|
377
|
+
"+",
|
|
378
|
+
..."0123456789"
|
|
379
|
+
],
|
|
380
|
+
resolve: resolveYamlInteger$2,
|
|
381
|
+
identify: (object) => Number.isInteger(object) && !Object.is(object, -0) && object.toString(10).indexOf("e") < 0,
|
|
382
|
+
represent: (object) => object.toString(10)
|
|
383
|
+
});
|
|
384
|
+
var YAML_INTEGER_IMPLICIT_PATTERN = /* @__PURE__ */ new RegExp("^-?(?:0|[1-9][0-9]*)$");
|
|
385
|
+
var YAML_INTEGER_EXPLICIT_PATTERN = /* @__PURE__ */ new RegExp("^(?:[-+]?0b[0-1]+|[-+]?0o[0-7]+|[-+]?0x[0-9a-fA-F]+|[-+]?[0-9]+)$");
|
|
386
|
+
function parseYamlInteger$1(source) {
|
|
387
|
+
let value = source;
|
|
388
|
+
let sign = 1;
|
|
389
|
+
if (value[0] === "-" || value[0] === "+") {
|
|
390
|
+
if (value[0] === "-") sign = -1;
|
|
391
|
+
value = value.slice(1);
|
|
392
|
+
}
|
|
393
|
+
if (value.startsWith("0b")) return sign * parseInt(value.slice(2), 2);
|
|
394
|
+
if (value.startsWith("0o")) return sign * parseInt(value.slice(2), 8);
|
|
395
|
+
if (value.startsWith("0x")) return sign * parseInt(value.slice(2), 16);
|
|
396
|
+
return sign * parseInt(value, 10);
|
|
397
|
+
}
|
|
398
|
+
function resolveYamlInteger$1(source, isExplicit) {
|
|
399
|
+
if (isExplicit) {
|
|
400
|
+
if (!YAML_INTEGER_EXPLICIT_PATTERN.test(source)) return NOT_RESOLVED;
|
|
401
|
+
} else if (!YAML_INTEGER_IMPLICIT_PATTERN.test(source)) return NOT_RESOLVED;
|
|
402
|
+
const result = parseYamlInteger$1(source);
|
|
403
|
+
return Number.isFinite(result) ? result : NOT_RESOLVED;
|
|
404
|
+
}
|
|
405
|
+
var intJsonTag = defineScalarTag("tag:yaml.org,2002:int", {
|
|
406
|
+
implicit: true,
|
|
407
|
+
implicitFirstChars: ["-", ..."0123456789"],
|
|
408
|
+
resolve: resolveYamlInteger$1,
|
|
409
|
+
identify: (object) => Number.isInteger(object) && !Object.is(object, -0) && object.toString(10).indexOf("e") < 0,
|
|
410
|
+
represent: (object) => object.toString(10)
|
|
411
|
+
});
|
|
412
|
+
var YAML_INTEGER_PATTERN = /* @__PURE__ */ new RegExp("^(?:[-+]?0b[0-1_]+|[-+]?0[0-7_]+|[-+]?0x[0-9a-fA-F_]+|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+|[-+]?(?:0|[1-9][0-9_]*))$");
|
|
413
|
+
function parseYamlInteger(source) {
|
|
414
|
+
let value = source.replace(/_/g, "");
|
|
415
|
+
let sign = 1;
|
|
416
|
+
if (value[0] === "-" || value[0] === "+") {
|
|
417
|
+
if (value[0] === "-") sign = -1;
|
|
418
|
+
value = value.slice(1);
|
|
419
|
+
}
|
|
420
|
+
if (value.startsWith("0b")) return sign * parseInt(value.slice(2), 2);
|
|
421
|
+
if (value.startsWith("0x")) return sign * parseInt(value.slice(2), 16);
|
|
422
|
+
if (value.includes(":")) {
|
|
423
|
+
let result = 0;
|
|
424
|
+
for (const part of value.split(":")) result = result * 60 + Number(part);
|
|
425
|
+
return sign * result;
|
|
426
|
+
}
|
|
427
|
+
if (value !== "0" && value[0] === "0") return sign * parseInt(value, 8);
|
|
428
|
+
return sign * parseInt(value, 10);
|
|
429
|
+
}
|
|
430
|
+
function resolveYamlInteger(source) {
|
|
431
|
+
if (!YAML_INTEGER_PATTERN.test(source)) return NOT_RESOLVED;
|
|
432
|
+
const result = parseYamlInteger(source);
|
|
433
|
+
return Number.isFinite(result) ? result : NOT_RESOLVED;
|
|
434
|
+
}
|
|
435
|
+
var intYaml11Tag = defineScalarTag("tag:yaml.org,2002:int", {
|
|
436
|
+
implicit: true,
|
|
437
|
+
implicitFirstChars: [
|
|
438
|
+
"-",
|
|
439
|
+
"+",
|
|
440
|
+
..."0123456789"
|
|
441
|
+
],
|
|
442
|
+
resolve: resolveYamlInteger,
|
|
443
|
+
identify: (object) => Number.isInteger(object) && !Object.is(object, -0) && object.toString(10).indexOf("e") < 0,
|
|
444
|
+
represent: (object) => object.toString(10)
|
|
445
|
+
});
|
|
446
|
+
var YAML_FLOAT_PATTERN$1 = /* @__PURE__ */ new RegExp("^(?:[-+]?[0-9]+(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|[-+]?\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
|
|
447
|
+
var YAML_FLOAT_SPECIAL_PATTERN$1 = /* @__PURE__ */ new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
|
|
448
|
+
function resolveYamlFloat$2(source) {
|
|
449
|
+
if (!YAML_FLOAT_PATTERN$1.test(source)) return NOT_RESOLVED;
|
|
450
|
+
let value = source.toLowerCase();
|
|
451
|
+
const sign = value[0] === "-" ? -1 : 1;
|
|
452
|
+
if ("+-".includes(value[0])) value = value.slice(1);
|
|
453
|
+
if (value === ".inf") return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
|
|
454
|
+
if (value === ".nan") return NaN;
|
|
455
|
+
const result = sign * parseFloat(value);
|
|
456
|
+
if (Number.isFinite(result) || YAML_FLOAT_SPECIAL_PATTERN$1.test(source)) return result;
|
|
457
|
+
return NOT_RESOLVED;
|
|
458
|
+
}
|
|
459
|
+
function representYamlFloat$2(object) {
|
|
460
|
+
if (isNaN(object)) return ".nan";
|
|
461
|
+
if (object === Number.POSITIVE_INFINITY) return ".inf";
|
|
462
|
+
if (object === Number.NEGATIVE_INFINITY) return "-.inf";
|
|
463
|
+
if (Object.is(object, -0)) return "-0.0";
|
|
464
|
+
const result = object.toString(10);
|
|
465
|
+
return /^[-+]?[0-9]+e/.test(result) ? result.replace("e", ".e") : result;
|
|
466
|
+
}
|
|
467
|
+
var floatCoreTag = defineScalarTag("tag:yaml.org,2002:float", {
|
|
468
|
+
implicit: true,
|
|
469
|
+
implicitFirstChars: [
|
|
470
|
+
"-",
|
|
471
|
+
"+",
|
|
472
|
+
".",
|
|
473
|
+
..."0123456789"
|
|
474
|
+
],
|
|
475
|
+
resolve: resolveYamlFloat$2,
|
|
476
|
+
identify: (object) => typeof object === "number" && (!Number.isInteger(object) || Object.is(object, -0) || object.toString(10).indexOf("e") >= 0),
|
|
477
|
+
represent: representYamlFloat$2
|
|
478
|
+
});
|
|
479
|
+
var YAML_FLOAT_IMPLICIT_PATTERN = /* @__PURE__ */ new RegExp("^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$");
|
|
480
|
+
var YAML_FLOAT_EXPLICIT_PATTERN = /* @__PURE__ */ new RegExp("^(?:[-+]?[0-9]+(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|[-+]?\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
|
|
481
|
+
function resolveYamlFloat$1(source, isExplicit) {
|
|
482
|
+
if (isExplicit) {
|
|
483
|
+
if (!YAML_FLOAT_EXPLICIT_PATTERN.test(source)) return NOT_RESOLVED;
|
|
484
|
+
let value = source.toLowerCase();
|
|
485
|
+
const sign = value[0] === "-" ? -1 : 1;
|
|
486
|
+
if ("+-".includes(value[0])) value = value.slice(1);
|
|
487
|
+
if (value === ".inf") return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
|
|
488
|
+
if (value === ".nan") return NaN;
|
|
489
|
+
const result2 = sign * parseFloat(value);
|
|
490
|
+
return Number.isFinite(result2) ? result2 : NOT_RESOLVED;
|
|
491
|
+
}
|
|
492
|
+
if (!YAML_FLOAT_IMPLICIT_PATTERN.test(source)) return NOT_RESOLVED;
|
|
493
|
+
const result = Number(source);
|
|
494
|
+
if (Number.isFinite(result)) return result;
|
|
495
|
+
return NOT_RESOLVED;
|
|
496
|
+
}
|
|
497
|
+
function representYamlFloat$1(object) {
|
|
498
|
+
if (isNaN(object)) return ".nan";
|
|
499
|
+
if (object === Number.POSITIVE_INFINITY) return ".inf";
|
|
500
|
+
if (object === Number.NEGATIVE_INFINITY) return "-.inf";
|
|
501
|
+
if (Object.is(object, -0)) return "-0.0";
|
|
502
|
+
const result = object.toString(10);
|
|
503
|
+
return /^[-+]?[0-9]+e/.test(result) ? result.replace("e", ".e") : result;
|
|
504
|
+
}
|
|
505
|
+
var floatJsonTag = defineScalarTag("tag:yaml.org,2002:float", {
|
|
506
|
+
implicit: true,
|
|
507
|
+
implicitFirstChars: ["-", ..."0123456789"],
|
|
508
|
+
resolve: resolveYamlFloat$1,
|
|
509
|
+
identify: (object) => typeof object === "number" && (!Number.isInteger(object) || Object.is(object, -0) || object.toString(10).indexOf("e") >= 0),
|
|
510
|
+
represent: representYamlFloat$1
|
|
511
|
+
});
|
|
512
|
+
var YAML_FLOAT_PATTERN = /* @__PURE__ */ new RegExp("^(?:[-+]?(?:(?:[0-9][0-9_]*)?\\.[0-9_]*)(?:[eE][-+][0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
|
|
513
|
+
var YAML_FLOAT_SPECIAL_PATTERN = /* @__PURE__ */ new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");
|
|
514
|
+
function resolveYamlFloat(source) {
|
|
515
|
+
if (!YAML_FLOAT_PATTERN.test(source)) return NOT_RESOLVED;
|
|
516
|
+
let value = source.toLowerCase().replace(/_/g, "");
|
|
517
|
+
const sign = value[0] === "-" ? -1 : 1;
|
|
518
|
+
if ("+-".includes(value[0])) value = value.slice(1);
|
|
519
|
+
if (value === ".inf") return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
|
|
520
|
+
if (value === ".nan") return NaN;
|
|
521
|
+
let result = 0;
|
|
522
|
+
if (value.includes(":")) {
|
|
523
|
+
for (const part of value.split(":")) result = result * 60 + Number(part);
|
|
524
|
+
result *= sign;
|
|
525
|
+
} else result = sign * parseFloat(value);
|
|
526
|
+
if (Number.isFinite(result) || YAML_FLOAT_SPECIAL_PATTERN.test(source)) return result;
|
|
527
|
+
return NOT_RESOLVED;
|
|
528
|
+
}
|
|
529
|
+
function representYamlFloat(object) {
|
|
530
|
+
if (isNaN(object)) return ".nan";
|
|
531
|
+
if (object === Number.POSITIVE_INFINITY) return ".inf";
|
|
532
|
+
if (object === Number.NEGATIVE_INFINITY) return "-.inf";
|
|
533
|
+
if (Object.is(object, -0)) return "-0.0";
|
|
534
|
+
const result = object.toString(10);
|
|
535
|
+
return /^[-+]?[0-9]+e/.test(result) ? result.replace("e", ".e") : result;
|
|
536
|
+
}
|
|
537
|
+
var floatYaml11Tag = defineScalarTag("tag:yaml.org,2002:float", {
|
|
538
|
+
implicit: true,
|
|
539
|
+
implicitFirstChars: [
|
|
540
|
+
"-",
|
|
541
|
+
"+",
|
|
542
|
+
".",
|
|
543
|
+
..."0123456789"
|
|
544
|
+
],
|
|
545
|
+
resolve: resolveYamlFloat,
|
|
546
|
+
identify: (object) => typeof object === "number" && (!Number.isInteger(object) || Object.is(object, -0) || object.toString(10).indexOf("e") >= 0),
|
|
547
|
+
represent: representYamlFloat
|
|
548
|
+
});
|
|
549
|
+
var mergeTag = defineScalarTag("tag:yaml.org,2002:merge", {
|
|
550
|
+
implicit: true,
|
|
551
|
+
implicitFirstChars: ["<"],
|
|
552
|
+
resolve: (source, isExplicit) => {
|
|
553
|
+
if (source === "<<" || isExplicit && source === "") return "<<";
|
|
554
|
+
return NOT_RESOLVED;
|
|
555
|
+
},
|
|
556
|
+
identify: () => false
|
|
557
|
+
});
|
|
558
|
+
var BASE64_PATTERN = /^[A-Za-z0-9+/]*={0,2}$/;
|
|
559
|
+
function resolveYamlBinary(source) {
|
|
560
|
+
const input = source.replace(/\s/g, "");
|
|
561
|
+
if (input.length % 4 !== 0 || !BASE64_PATTERN.test(input)) return NOT_RESOLVED;
|
|
562
|
+
const binary = atob(input);
|
|
563
|
+
const result = new Uint8Array(binary.length);
|
|
564
|
+
for (let index = 0; index < binary.length; index++) result[index] = binary.charCodeAt(index);
|
|
565
|
+
return result;
|
|
566
|
+
}
|
|
567
|
+
function representYamlBinary(object) {
|
|
568
|
+
let binary = "";
|
|
569
|
+
for (let index = 0; index < object.length; index++) binary += String.fromCharCode(object[index]);
|
|
570
|
+
return btoa(binary);
|
|
571
|
+
}
|
|
572
|
+
var binaryTag = defineScalarTag("tag:yaml.org,2002:binary", {
|
|
573
|
+
resolve: resolveYamlBinary,
|
|
574
|
+
identify: (object) => Object.prototype.toString.call(object) === "[object Uint8Array]",
|
|
575
|
+
represent: representYamlBinary
|
|
576
|
+
});
|
|
577
|
+
var YAML_DATE_REGEXP = /* @__PURE__ */ new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$");
|
|
578
|
+
var YAML_TIMESTAMP_REGEXP = /* @__PURE__ */ new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");
|
|
579
|
+
function makeUtcDate(year, month, day, hour = 0, minute = 0, second = 0, fraction = 0) {
|
|
580
|
+
const date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
|
|
581
|
+
date.setUTCFullYear(year, month, day);
|
|
582
|
+
return date;
|
|
583
|
+
}
|
|
584
|
+
function resolveYamlTimestamp(source) {
|
|
585
|
+
let match = YAML_DATE_REGEXP.exec(source);
|
|
586
|
+
if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(source);
|
|
587
|
+
if (match === null) return NOT_RESOLVED;
|
|
588
|
+
const year = +match[1];
|
|
589
|
+
const month = +match[2] - 1;
|
|
590
|
+
const day = +match[3];
|
|
591
|
+
if (!match[4]) {
|
|
592
|
+
const date2 = makeUtcDate(year, month, day);
|
|
593
|
+
if (date2.getUTCFullYear() !== year || date2.getUTCMonth() !== month || date2.getUTCDate() !== day) return NOT_RESOLVED;
|
|
594
|
+
return date2;
|
|
595
|
+
}
|
|
596
|
+
const hour = +match[4];
|
|
597
|
+
const minute = +match[5];
|
|
598
|
+
const second = +match[6];
|
|
599
|
+
let fraction = 0;
|
|
600
|
+
if (hour > 23 || minute > 59 || second > 59) return NOT_RESOLVED;
|
|
601
|
+
if (match[7]) {
|
|
602
|
+
let value = match[7].slice(0, 3);
|
|
603
|
+
while (value.length < 3) value += "0";
|
|
604
|
+
fraction = +value;
|
|
605
|
+
}
|
|
606
|
+
const date = makeUtcDate(year, month, day, hour, minute, second, fraction);
|
|
607
|
+
if (date.getUTCFullYear() !== year || date.getUTCMonth() !== month || date.getUTCDate() !== day) return NOT_RESOLVED;
|
|
608
|
+
if (match[9]) {
|
|
609
|
+
const offsetHour = +match[10];
|
|
610
|
+
const offsetMinute = +(match[11] || 0);
|
|
611
|
+
if (offsetHour > 23 || offsetMinute > 59) return NOT_RESOLVED;
|
|
612
|
+
const offset = (offsetHour * 60 + offsetMinute) * 6e4;
|
|
613
|
+
date.setTime(date.getTime() - (match[9] === "-" ? -offset : offset));
|
|
614
|
+
}
|
|
615
|
+
return date;
|
|
616
|
+
}
|
|
617
|
+
var timestampTag = defineScalarTag("tag:yaml.org,2002:timestamp", {
|
|
618
|
+
implicit: true,
|
|
619
|
+
implicitFirstChars: [..."0123456789"],
|
|
620
|
+
resolve: resolveYamlTimestamp,
|
|
621
|
+
identify: (object) => object instanceof Date,
|
|
622
|
+
represent: (object) => object.toISOString()
|
|
623
|
+
});
|
|
624
|
+
var seqTag = defineSequenceTag("tag:yaml.org,2002:seq", {
|
|
625
|
+
create: () => [],
|
|
626
|
+
addItem: (container, item) => {
|
|
627
|
+
container.push(item);
|
|
628
|
+
},
|
|
629
|
+
identify: Array.isArray
|
|
630
|
+
});
|
|
631
|
+
function isPlainObject(data) {
|
|
632
|
+
if (data === null || typeof data !== "object" || Array.isArray(data)) return false;
|
|
633
|
+
const prototype = Object.getPrototypeOf(data);
|
|
634
|
+
return prototype === null || prototype === Object.prototype;
|
|
635
|
+
}
|
|
636
|
+
function pick(object, keys) {
|
|
637
|
+
const result = {};
|
|
638
|
+
for (const key of keys) if (object[key] !== void 0) result[key] = object[key];
|
|
639
|
+
return result;
|
|
640
|
+
}
|
|
641
|
+
var omapTag = defineSequenceTag("tag:yaml.org,2002:omap", {
|
|
642
|
+
create: () => ({
|
|
643
|
+
list: [],
|
|
644
|
+
seen: /* @__PURE__ */ new Set()
|
|
645
|
+
}),
|
|
646
|
+
addItem: (carrier, item) => {
|
|
647
|
+
let key;
|
|
648
|
+
if (item instanceof Map) {
|
|
649
|
+
if (item.size !== 1) return "cannot resolve an ordered map item";
|
|
650
|
+
key = item.keys().next().value;
|
|
651
|
+
} else if (isPlainObject(item)) {
|
|
652
|
+
const itemKeys = Object.keys(item);
|
|
653
|
+
if (itemKeys.length !== 1) return "cannot resolve an ordered map item";
|
|
654
|
+
key = itemKeys[0];
|
|
655
|
+
} else return "cannot resolve an ordered map item";
|
|
656
|
+
if (carrier.seen.has(key)) return "duplicate key in ordered map";
|
|
657
|
+
carrier.seen.add(key);
|
|
658
|
+
carrier.list.push(item);
|
|
659
|
+
return "";
|
|
660
|
+
},
|
|
661
|
+
finalize: (carrier) => carrier.list,
|
|
662
|
+
identify: () => false
|
|
663
|
+
});
|
|
664
|
+
var pairsTag = defineSequenceTag("tag:yaml.org,2002:pairs", {
|
|
665
|
+
create: () => [],
|
|
666
|
+
addItem: (container, item) => {
|
|
667
|
+
if (item instanceof Map) {
|
|
668
|
+
if (item.size !== 1) return "cannot resolve a pairs item";
|
|
669
|
+
container.push(item.entries().next().value);
|
|
670
|
+
return "";
|
|
101
671
|
}
|
|
102
|
-
|
|
103
|
-
|
|
672
|
+
if (Object.prototype.toString.call(item) !== "[object Object]") return "cannot resolve a pairs item";
|
|
673
|
+
const object = item;
|
|
674
|
+
const keys = Object.keys(object);
|
|
675
|
+
if (keys.length !== 1) return "cannot resolve a pairs item";
|
|
676
|
+
container.push([keys[0], object[keys[0]]]);
|
|
677
|
+
return "";
|
|
678
|
+
},
|
|
679
|
+
identify: () => false
|
|
680
|
+
});
|
|
681
|
+
var mapTag = defineMappingTag("tag:yaml.org,2002:map", {
|
|
682
|
+
create: () => ({}),
|
|
683
|
+
identify: isPlainObject,
|
|
684
|
+
represent: (o) => {
|
|
685
|
+
const map = /* @__PURE__ */ new Map();
|
|
686
|
+
for (const key of Object.keys(o)) map.set(key, o[key]);
|
|
687
|
+
return map;
|
|
688
|
+
},
|
|
689
|
+
addPair: (container, key, value) => {
|
|
690
|
+
if (key !== null && typeof key === "object") return "object-based map does not support complex keys";
|
|
691
|
+
const normalizedKey = String(key);
|
|
692
|
+
if (normalizedKey === "__proto__") Object.defineProperty(container, normalizedKey, {
|
|
693
|
+
value,
|
|
694
|
+
enumerable: true,
|
|
695
|
+
configurable: true,
|
|
696
|
+
writable: true
|
|
697
|
+
});
|
|
698
|
+
else container[normalizedKey] = value;
|
|
699
|
+
return "";
|
|
700
|
+
},
|
|
701
|
+
has: (container, key) => {
|
|
702
|
+
if (key !== null && typeof key === "object") return false;
|
|
703
|
+
return Object.prototype.hasOwnProperty.call(container, String(key));
|
|
704
|
+
},
|
|
705
|
+
keys: (container) => Object.keys(container),
|
|
706
|
+
get: (container, key) => {
|
|
707
|
+
const normalizedKey = String(key);
|
|
708
|
+
if (!Object.prototype.hasOwnProperty.call(container, normalizedKey)) return null;
|
|
709
|
+
return container[normalizedKey];
|
|
710
|
+
}
|
|
711
|
+
});
|
|
712
|
+
var setTag = defineMappingTag("tag:yaml.org,2002:set", {
|
|
713
|
+
create: () => /* @__PURE__ */ new Set(),
|
|
714
|
+
identify: (data) => data instanceof Set,
|
|
715
|
+
represent: (data) => {
|
|
716
|
+
const map = /* @__PURE__ */ new Map();
|
|
717
|
+
for (const key of data) map.set(key, null);
|
|
718
|
+
return map;
|
|
719
|
+
},
|
|
720
|
+
addPair: (container, key, value) => {
|
|
721
|
+
if (value !== null) return "cannot resolve a set item";
|
|
722
|
+
container.add(key);
|
|
723
|
+
return "";
|
|
724
|
+
},
|
|
725
|
+
has: (container, key) => container.has(key),
|
|
726
|
+
keys: (container) => container.keys(),
|
|
727
|
+
get: () => null
|
|
728
|
+
});
|
|
729
|
+
function createTagDefinitionMap() {
|
|
730
|
+
return {
|
|
731
|
+
scalar: /* @__PURE__ */ Object.create(null),
|
|
732
|
+
sequence: /* @__PURE__ */ Object.create(null),
|
|
733
|
+
mapping: /* @__PURE__ */ Object.create(null)
|
|
734
|
+
};
|
|
104
735
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
736
|
+
function createTagDefinitionListMap() {
|
|
737
|
+
return {
|
|
738
|
+
scalar: [],
|
|
739
|
+
sequence: [],
|
|
740
|
+
mapping: []
|
|
741
|
+
};
|
|
742
|
+
}
|
|
743
|
+
function compileTags(tags) {
|
|
744
|
+
const result = [];
|
|
745
|
+
for (const tag of tags) {
|
|
746
|
+
let index = result.length;
|
|
747
|
+
for (let previousIndex = 0; previousIndex < result.length; previousIndex++) {
|
|
748
|
+
const previous = result[previousIndex];
|
|
749
|
+
if (previous.nodeKind === tag.nodeKind && previous.tagName === tag.tagName && previous.matchByTagPrefix === tag.matchByTagPrefix) {
|
|
750
|
+
index = previousIndex;
|
|
751
|
+
break;
|
|
752
|
+
}
|
|
114
753
|
}
|
|
754
|
+
result[index] = tag;
|
|
755
|
+
}
|
|
756
|
+
return result;
|
|
757
|
+
}
|
|
758
|
+
var Schema = class Schema2 {
|
|
759
|
+
tags;
|
|
760
|
+
/** @internal */
|
|
761
|
+
implicitScalarTags;
|
|
762
|
+
/**
|
|
763
|
+
* Dispatch implicit scalar resolvers by `source.charAt(0)`. Each bucket holds
|
|
764
|
+
* the resolvers that may match that key, in schema order; a key absent from
|
|
765
|
+
* the map uses
|
|
766
|
+
* {@link Schema.implicitScalarAnyFirstChar}
|
|
767
|
+
* (resolvers that declared no first-char constraint, so they apply to any
|
|
768
|
+
* first character).
|
|
769
|
+
*/
|
|
770
|
+
implicitScalarByFirstChar;
|
|
771
|
+
implicitScalarAnyFirstChar;
|
|
772
|
+
/**
|
|
773
|
+
* The default scalar tag (`!!str`), resolved once so the composer's fallback
|
|
774
|
+
* for unresolved plain scalars avoids a keyed lookup per scalar.
|
|
775
|
+
*
|
|
776
|
+
* @internal
|
|
777
|
+
*/
|
|
778
|
+
defaultScalarTag;
|
|
779
|
+
/**
|
|
780
|
+
* The default container tags (`!!seq` / `!!map`), used by the dumper: when a
|
|
781
|
+
* value is identified by its default tag, the tag is implicit and not
|
|
782
|
+
* printed. Undefined if the schema does not define them (then such values
|
|
783
|
+
* can't be dumped).
|
|
784
|
+
*
|
|
785
|
+
* @internal
|
|
786
|
+
*/
|
|
787
|
+
defaultSequenceTag;
|
|
788
|
+
/** @internal */
|
|
789
|
+
defaultMappingTag;
|
|
790
|
+
exact;
|
|
791
|
+
prefix;
|
|
792
|
+
constructor(tags) {
|
|
793
|
+
const compiledTags = compileTags(tags);
|
|
794
|
+
const implicitScalarTags = [];
|
|
795
|
+
const exact = createTagDefinitionMap();
|
|
796
|
+
const prefix = createTagDefinitionListMap();
|
|
797
|
+
for (const tag of compiledTags) {
|
|
798
|
+
if (tag.nodeKind === "scalar" && tag.implicit) {
|
|
799
|
+
if (tag.matchByTagPrefix) throw new Error("Implicit scalar tags cannot match by tag prefix");
|
|
800
|
+
implicitScalarTags.push(tag);
|
|
801
|
+
}
|
|
802
|
+
switch (tag.nodeKind) {
|
|
803
|
+
case "scalar":
|
|
804
|
+
if (tag.matchByTagPrefix) prefix.scalar.push(tag);
|
|
805
|
+
else exact.scalar[tag.tagName] = tag;
|
|
806
|
+
break;
|
|
807
|
+
case "sequence":
|
|
808
|
+
if (tag.matchByTagPrefix) prefix.sequence.push(tag);
|
|
809
|
+
else exact.sequence[tag.tagName] = tag;
|
|
810
|
+
break;
|
|
811
|
+
case "mapping":
|
|
812
|
+
if (tag.matchByTagPrefix) prefix.mapping.push(tag);
|
|
813
|
+
else exact.mapping[tag.tagName] = tag;
|
|
814
|
+
break;
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
const implicitScalarAnyFirstChar = implicitScalarTags.filter((tag) => tag.implicitFirstChars === null);
|
|
818
|
+
const keys = /* @__PURE__ */ new Set();
|
|
819
|
+
for (const tag of implicitScalarTags) if (tag.implicitFirstChars !== null) for (const key of tag.implicitFirstChars) keys.add(key);
|
|
820
|
+
const implicitScalarByFirstChar = /* @__PURE__ */ new Map();
|
|
821
|
+
for (const key of keys) implicitScalarByFirstChar.set(key, implicitScalarTags.filter((tag) => tag.implicitFirstChars === null || tag.implicitFirstChars.indexOf(key) !== -1));
|
|
822
|
+
const defaultScalarTag = exact.scalar["tag:yaml.org,2002:str"];
|
|
823
|
+
if (!defaultScalarTag) throw new Error("schema does not define the default scalar tag (tag:yaml.org,2002:str)");
|
|
824
|
+
this.tags = compiledTags;
|
|
825
|
+
this.implicitScalarTags = implicitScalarTags;
|
|
826
|
+
this.implicitScalarByFirstChar = implicitScalarByFirstChar;
|
|
827
|
+
this.implicitScalarAnyFirstChar = implicitScalarAnyFirstChar;
|
|
828
|
+
this.defaultScalarTag = defaultScalarTag;
|
|
829
|
+
this.defaultSequenceTag = exact.sequence["tag:yaml.org,2002:seq"];
|
|
830
|
+
this.defaultMappingTag = exact.mapping["tag:yaml.org,2002:map"];
|
|
831
|
+
this.exact = exact;
|
|
832
|
+
this.prefix = prefix;
|
|
833
|
+
}
|
|
834
|
+
/** @internal */
|
|
835
|
+
lookupScalarTag(tagName) {
|
|
836
|
+
const exactTag = this.exact.scalar[tagName];
|
|
837
|
+
if (exactTag) return exactTag;
|
|
838
|
+
for (const tag of this.prefix.scalar) if (tagName.startsWith(tag.tagName)) return tag;
|
|
839
|
+
}
|
|
840
|
+
/** @internal */
|
|
841
|
+
lookupSequenceTag(tagName) {
|
|
842
|
+
const exactTag = this.exact.sequence[tagName];
|
|
843
|
+
if (exactTag) return exactTag;
|
|
844
|
+
for (const tag of this.prefix.sequence) if (tagName.startsWith(tag.tagName)) return tag;
|
|
845
|
+
}
|
|
846
|
+
/** @internal */
|
|
847
|
+
lookupMappingTag(tagName) {
|
|
848
|
+
const exactTag = this.exact.mapping[tagName];
|
|
849
|
+
if (exactTag) return exactTag;
|
|
850
|
+
for (const tag of this.prefix.mapping) if (tagName.startsWith(tag.tagName)) return tag;
|
|
851
|
+
}
|
|
852
|
+
/** @internal */
|
|
853
|
+
resolveImplicitScalarTag(source) {
|
|
854
|
+
const candidates = this.implicitScalarByFirstChar.get(source.charAt(0)) ?? this.implicitScalarAnyFirstChar;
|
|
855
|
+
for (const tag2 of candidates) {
|
|
856
|
+
const value = tag2.resolve(source, false, tag2.tagName);
|
|
857
|
+
if (value !== NOT_RESOLVED) return {
|
|
858
|
+
value,
|
|
859
|
+
tag: tag2
|
|
860
|
+
};
|
|
861
|
+
}
|
|
862
|
+
const tag = this.defaultScalarTag;
|
|
115
863
|
return {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
message: `Node.js ${process.version} is below the minimum (18)`,
|
|
119
|
-
fix: 'Install Node.js 18 or later: https://nodejs.org',
|
|
864
|
+
value: tag.resolve(source, false, tag.tagName),
|
|
865
|
+
tag
|
|
120
866
|
};
|
|
867
|
+
}
|
|
868
|
+
/**
|
|
869
|
+
* Creates a new schema with the specified tags added. If a tag already
|
|
870
|
+
* exists, it is replaced by the specified tag.
|
|
871
|
+
*
|
|
872
|
+
* @example
|
|
873
|
+
*
|
|
874
|
+
* ```javascript
|
|
875
|
+
* import { CORE_SCHEMA, mergeTag, realMapTag } from 'js-yaml'
|
|
876
|
+
*
|
|
877
|
+
* const schema = CORE_SCHEMA.withTags(mergeTag, realMapTag)
|
|
878
|
+
* ```
|
|
879
|
+
*/
|
|
880
|
+
withTags(...tags) {
|
|
881
|
+
let flatTags = [];
|
|
882
|
+
for (const tag of tags) flatTags = flatTags.concat(tag);
|
|
883
|
+
return new Schema2([...this.tags, ...flatTags]);
|
|
884
|
+
}
|
|
885
|
+
};
|
|
886
|
+
var FAILSAFE_SCHEMA = new Schema([
|
|
887
|
+
strTag,
|
|
888
|
+
seqTag,
|
|
889
|
+
mapTag
|
|
890
|
+
]);
|
|
891
|
+
var JSON_SCHEMA = new Schema([
|
|
892
|
+
...FAILSAFE_SCHEMA.tags,
|
|
893
|
+
nullJsonTag,
|
|
894
|
+
boolJsonTag,
|
|
895
|
+
intJsonTag,
|
|
896
|
+
floatJsonTag
|
|
897
|
+
]);
|
|
898
|
+
var CORE_SCHEMA = new Schema([
|
|
899
|
+
...FAILSAFE_SCHEMA.tags,
|
|
900
|
+
nullCoreTag,
|
|
901
|
+
boolCoreTag,
|
|
902
|
+
intCoreTag,
|
|
903
|
+
floatCoreTag
|
|
904
|
+
]);
|
|
905
|
+
var YAML11_SCHEMA = new Schema([
|
|
906
|
+
...FAILSAFE_SCHEMA.tags,
|
|
907
|
+
nullYaml11Tag,
|
|
908
|
+
boolYaml11Tag,
|
|
909
|
+
intYaml11Tag,
|
|
910
|
+
floatYaml11Tag,
|
|
911
|
+
timestampTag,
|
|
912
|
+
mergeTag,
|
|
913
|
+
binaryTag,
|
|
914
|
+
omapTag,
|
|
915
|
+
pairsTag,
|
|
916
|
+
setTag
|
|
917
|
+
]);
|
|
918
|
+
var DUMP_SCHEMA = YAML11_SCHEMA.withTags({
|
|
919
|
+
...intYaml11Tag,
|
|
920
|
+
resolve: (source, isExplicit, tagName) => {
|
|
921
|
+
const result = intYaml11Tag.resolve(source, isExplicit, tagName);
|
|
922
|
+
return result === NOT_RESOLVED ? intCoreTag.resolve(source, isExplicit, tagName) : result;
|
|
923
|
+
}
|
|
924
|
+
}, {
|
|
925
|
+
...floatYaml11Tag,
|
|
926
|
+
resolve: (source, isExplicit, tagName) => {
|
|
927
|
+
const result = floatYaml11Tag.resolve(source, isExplicit, tagName);
|
|
928
|
+
return result === NOT_RESOLVED ? floatCoreTag.resolve(source, isExplicit, tagName) : result;
|
|
929
|
+
}
|
|
930
|
+
});
|
|
931
|
+
var realMapTag = defineMappingTag("tag:yaml.org,2002:map", {
|
|
932
|
+
create: () => /* @__PURE__ */ new Map(),
|
|
933
|
+
addPair: (container, key, value) => {
|
|
934
|
+
container.set(key, value);
|
|
935
|
+
return "";
|
|
936
|
+
},
|
|
937
|
+
has: (container, key) => container.has(key),
|
|
938
|
+
keys: (container) => container.keys(),
|
|
939
|
+
get: (container, key) => container.get(key),
|
|
940
|
+
identify: (data) => data instanceof Map || isPlainObject(data),
|
|
941
|
+
represent: (data) => {
|
|
942
|
+
if (data instanceof Map) return data;
|
|
943
|
+
const map = /* @__PURE__ */ new Map();
|
|
944
|
+
const obj = data;
|
|
945
|
+
for (const key of Object.keys(obj)) map.set(key, obj[key]);
|
|
946
|
+
return map;
|
|
947
|
+
}
|
|
948
|
+
});
|
|
949
|
+
function normalizeKey(key) {
|
|
950
|
+
if (Array.isArray(key)) {
|
|
951
|
+
const array = Array.prototype.slice.call(key);
|
|
952
|
+
for (let index = 0; index < array.length; index++) {
|
|
953
|
+
if (Array.isArray(array[index])) return null;
|
|
954
|
+
if (typeof array[index] === "object" && Object.prototype.toString.call(array[index]) === "[object Object]") array[index] = "[object Object]";
|
|
955
|
+
}
|
|
956
|
+
return String(array);
|
|
957
|
+
}
|
|
958
|
+
if (typeof key === "object" && Object.prototype.toString.call(key) === "[object Object]") return "[object Object]";
|
|
959
|
+
return String(key);
|
|
121
960
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
961
|
+
var legacyMapTag = defineMappingTag("tag:yaml.org,2002:map", {
|
|
962
|
+
create: () => ({}),
|
|
963
|
+
identify: isPlainObject,
|
|
964
|
+
represent: (o) => {
|
|
965
|
+
const map = /* @__PURE__ */ new Map();
|
|
966
|
+
for (const key of Object.keys(o)) map.set(key, o[key]);
|
|
967
|
+
return map;
|
|
968
|
+
},
|
|
969
|
+
addPair: (container, key, value) => {
|
|
970
|
+
const normalizedKey = normalizeKey(key);
|
|
971
|
+
if (normalizedKey === null) return "nested arrays are not supported inside keys";
|
|
972
|
+
if (normalizedKey === "__proto__") Object.defineProperty(container, normalizedKey, {
|
|
973
|
+
value,
|
|
974
|
+
enumerable: true,
|
|
975
|
+
configurable: true,
|
|
976
|
+
writable: true
|
|
977
|
+
});
|
|
978
|
+
else container[normalizedKey] = value;
|
|
979
|
+
return "";
|
|
980
|
+
},
|
|
981
|
+
has: (container, key) => {
|
|
982
|
+
const normalizedKey = normalizeKey(key);
|
|
983
|
+
return normalizedKey !== null && Object.prototype.hasOwnProperty.call(container, normalizedKey);
|
|
984
|
+
},
|
|
985
|
+
keys: (container) => Object.keys(container),
|
|
986
|
+
get: (container, key) => {
|
|
987
|
+
const normalizedKey = String(key);
|
|
988
|
+
if (!Object.prototype.hasOwnProperty.call(container, normalizedKey)) return null;
|
|
989
|
+
return container[normalizedKey];
|
|
990
|
+
}
|
|
991
|
+
});
|
|
992
|
+
var DEFAULT_SNIPPET_OPTIONS = {
|
|
993
|
+
maxLength: 79,
|
|
994
|
+
indent: 1,
|
|
995
|
+
linesBefore: 3,
|
|
996
|
+
linesAfter: 2
|
|
997
|
+
};
|
|
998
|
+
function getLine(buffer, lineStart, lineEnd, position, maxLineLength) {
|
|
999
|
+
let head = "";
|
|
1000
|
+
let tail = "";
|
|
1001
|
+
const maxHalfLength = Math.floor(maxLineLength / 2) - 1;
|
|
1002
|
+
if (position - lineStart > maxHalfLength) {
|
|
1003
|
+
head = " ... ";
|
|
1004
|
+
lineStart = position - maxHalfLength + head.length;
|
|
1005
|
+
}
|
|
1006
|
+
if (lineEnd - position > maxHalfLength) {
|
|
1007
|
+
tail = " ...";
|
|
1008
|
+
lineEnd = position + maxHalfLength - tail.length;
|
|
1009
|
+
}
|
|
1010
|
+
return {
|
|
1011
|
+
str: head + buffer.slice(lineStart, lineEnd).replace(/\t/g, "\u2192") + tail,
|
|
1012
|
+
pos: position - lineStart + head.length
|
|
1013
|
+
};
|
|
1014
|
+
}
|
|
1015
|
+
function padStart(string, max) {
|
|
1016
|
+
return " ".repeat(Math.max(max - string.length, 0)) + string;
|
|
1017
|
+
}
|
|
1018
|
+
function makeSnippet(mark, options) {
|
|
1019
|
+
if (!mark.buffer) return null;
|
|
1020
|
+
const opts = {
|
|
1021
|
+
...DEFAULT_SNIPPET_OPTIONS,
|
|
1022
|
+
...options
|
|
1023
|
+
};
|
|
1024
|
+
const re = /\r?\n|\r|\0/g;
|
|
1025
|
+
const lineStarts = [0];
|
|
1026
|
+
const lineEnds = [];
|
|
1027
|
+
let match;
|
|
1028
|
+
let foundLineNo = -1;
|
|
1029
|
+
while (match = re.exec(mark.buffer)) {
|
|
1030
|
+
lineEnds.push(match.index);
|
|
1031
|
+
lineStarts.push(match.index + match[0].length);
|
|
1032
|
+
if (mark.position <= match.index && foundLineNo < 0) foundLineNo = lineStarts.length - 2;
|
|
1033
|
+
}
|
|
1034
|
+
if (foundLineNo < 0) foundLineNo = lineStarts.length - 1;
|
|
1035
|
+
let result = "";
|
|
1036
|
+
const lineNoLength = Math.min(mark.line + opts.linesAfter, lineEnds.length).toString().length;
|
|
1037
|
+
const maxLineLength = opts.maxLength - (opts.indent + lineNoLength + 3);
|
|
1038
|
+
for (let i = 1; i <= opts.linesBefore; i++) {
|
|
1039
|
+
if (foundLineNo - i < 0) break;
|
|
1040
|
+
const line2 = getLine(mark.buffer, lineStarts[foundLineNo - i], lineEnds[foundLineNo - i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo - i]), maxLineLength);
|
|
1041
|
+
result = `${" ".repeat(opts.indent)}${padStart((mark.line - i + 1).toString(), lineNoLength)} | ${line2.str}
|
|
1042
|
+
${result}`;
|
|
1043
|
+
}
|
|
1044
|
+
const line = getLine(mark.buffer, lineStarts[foundLineNo], lineEnds[foundLineNo], mark.position, maxLineLength);
|
|
1045
|
+
result += `${" ".repeat(opts.indent)}${padStart((mark.line + 1).toString(), lineNoLength)} | ${line.str}
|
|
1046
|
+
`;
|
|
1047
|
+
result += `${"-".repeat(opts.indent + lineNoLength + 3 + line.pos)}^
|
|
1048
|
+
`;
|
|
1049
|
+
for (let i = 1; i <= opts.linesAfter; i++) {
|
|
1050
|
+
if (foundLineNo + i >= lineEnds.length) break;
|
|
1051
|
+
const line2 = getLine(mark.buffer, lineStarts[foundLineNo + i], lineEnds[foundLineNo + i], mark.position - (lineStarts[foundLineNo] - lineStarts[foundLineNo + i]), maxLineLength);
|
|
1052
|
+
result += `${" ".repeat(opts.indent)}${padStart((mark.line + i + 1).toString(), lineNoLength)} | ${line2.str}
|
|
1053
|
+
`;
|
|
1054
|
+
}
|
|
1055
|
+
return result.replace(/\n$/, "");
|
|
1056
|
+
}
|
|
1057
|
+
function formatError(exception, compact) {
|
|
1058
|
+
let where = "";
|
|
1059
|
+
if (!exception.mark) return exception.reason;
|
|
1060
|
+
if (exception.mark.name) where += `in "${exception.mark.name}" `;
|
|
1061
|
+
where += `(${exception.mark.line + 1}:${exception.mark.column + 1})`;
|
|
1062
|
+
if (!compact && exception.mark.snippet) where += `
|
|
1063
|
+
|
|
1064
|
+
${exception.mark.snippet}`;
|
|
1065
|
+
return `${exception.reason} ${where}`;
|
|
1066
|
+
}
|
|
1067
|
+
var YAMLException = class YAMLException2 extends Error {
|
|
1068
|
+
reason;
|
|
1069
|
+
mark;
|
|
1070
|
+
/**
|
|
1071
|
+
* Optional `mark` contains source snippet data. Usually, use
|
|
1072
|
+
* {@link YAMLException.throwAt} instead of passing it directly.
|
|
1073
|
+
*/
|
|
1074
|
+
constructor(reason, mark) {
|
|
1075
|
+
super();
|
|
1076
|
+
this.name = "YAMLException";
|
|
1077
|
+
this.reason = reason;
|
|
1078
|
+
this.mark = mark;
|
|
1079
|
+
this.message = formatError(this, false);
|
|
1080
|
+
if (Error.captureStackTrace) Error.captureStackTrace(this, this.constructor);
|
|
1081
|
+
}
|
|
1082
|
+
/**
|
|
1083
|
+
* Returns the formatted error, omitting the source snippet in compact mode.
|
|
1084
|
+
*/
|
|
1085
|
+
toString(compact) {
|
|
1086
|
+
return `${this.name}: ${formatError(this, compact)}`;
|
|
1087
|
+
}
|
|
1088
|
+
/**
|
|
1089
|
+
* Builds a YAMLException with a source snippet and throws it. `source` is
|
|
1090
|
+
* the raw input text; `position` is an offset into it.
|
|
1091
|
+
*/
|
|
1092
|
+
static throwAt(source, position, message, filename = "") {
|
|
1093
|
+
let line = 0;
|
|
1094
|
+
let lineStart = 0;
|
|
1095
|
+
for (let index = 0; index < position; index++) {
|
|
1096
|
+
const ch = source.charCodeAt(index);
|
|
1097
|
+
if (ch === 10) {
|
|
1098
|
+
line++;
|
|
1099
|
+
lineStart = index + 1;
|
|
1100
|
+
} else if (ch === 13) {
|
|
1101
|
+
line++;
|
|
1102
|
+
if (source.charCodeAt(index + 1) === 10) index++;
|
|
1103
|
+
lineStart = index + 1;
|
|
1104
|
+
}
|
|
131
1105
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
1106
|
+
const mark = {
|
|
1107
|
+
name: filename,
|
|
1108
|
+
buffer: source,
|
|
1109
|
+
position,
|
|
1110
|
+
line,
|
|
1111
|
+
column: position - lineStart
|
|
1112
|
+
};
|
|
1113
|
+
mark.snippet = makeSnippet(mark);
|
|
1114
|
+
throw new YAMLException2(message, mark);
|
|
1115
|
+
}
|
|
1116
|
+
};
|
|
1117
|
+
var EVENT_ID = {
|
|
1118
|
+
DOCUMENT: 1,
|
|
1119
|
+
SEQUENCE: 2,
|
|
1120
|
+
MAPPING: 3,
|
|
1121
|
+
SCALAR: 4,
|
|
1122
|
+
ALIAS: 5,
|
|
1123
|
+
POP: 6
|
|
1124
|
+
};
|
|
1125
|
+
var SCALAR_STYLE = {
|
|
1126
|
+
PLAIN: 1,
|
|
1127
|
+
SINGLE_QUOTED: 2,
|
|
1128
|
+
DOUBLE_QUOTED: 3,
|
|
1129
|
+
LITERAL_BLOCK: 4,
|
|
1130
|
+
FOLDED_BLOCK: 5
|
|
1131
|
+
};
|
|
1132
|
+
var COLLECTION_STYLE = {
|
|
1133
|
+
BLOCK: 1,
|
|
1134
|
+
FLOW: 2
|
|
1135
|
+
};
|
|
1136
|
+
var CHOMPING_MODE = {
|
|
1137
|
+
CLIP: 1,
|
|
1138
|
+
STRIP: 2,
|
|
1139
|
+
KEEP: 3
|
|
1140
|
+
};
|
|
1141
|
+
var NO_RANGE$3 = -1;
|
|
1142
|
+
function simpleEscapeSequence(c) {
|
|
1143
|
+
switch (c) {
|
|
1144
|
+
case 48:
|
|
1145
|
+
return "\0";
|
|
1146
|
+
case 97:
|
|
1147
|
+
return "\x07";
|
|
1148
|
+
case 98:
|
|
1149
|
+
return "\b";
|
|
1150
|
+
case 116:
|
|
1151
|
+
return " ";
|
|
1152
|
+
case 9:
|
|
1153
|
+
return " ";
|
|
1154
|
+
case 110:
|
|
1155
|
+
return "\n";
|
|
1156
|
+
case 118:
|
|
1157
|
+
return "\v";
|
|
1158
|
+
case 102:
|
|
1159
|
+
return "\f";
|
|
1160
|
+
case 114:
|
|
1161
|
+
return "\r";
|
|
1162
|
+
case 101:
|
|
1163
|
+
return "\x1B";
|
|
1164
|
+
case 32:
|
|
1165
|
+
return " ";
|
|
1166
|
+
case 34:
|
|
1167
|
+
return '"';
|
|
1168
|
+
case 47:
|
|
1169
|
+
return "/";
|
|
1170
|
+
case 92:
|
|
1171
|
+
return "\\";
|
|
1172
|
+
case 78:
|
|
1173
|
+
return "\x85";
|
|
1174
|
+
case 95:
|
|
1175
|
+
return "\xA0";
|
|
1176
|
+
case 76:
|
|
1177
|
+
return "\u2028";
|
|
1178
|
+
case 80:
|
|
1179
|
+
return "\u2029";
|
|
1180
|
+
default:
|
|
1181
|
+
return "";
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
var simpleEscapeCheck = new Array(256);
|
|
1185
|
+
var simpleEscapeMap = new Array(256);
|
|
1186
|
+
for (let i = 0; i < 256; i++) {
|
|
1187
|
+
simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
|
|
1188
|
+
simpleEscapeMap[i] = simpleEscapeSequence(i);
|
|
1189
|
+
}
|
|
1190
|
+
function charFromCodepoint(c) {
|
|
1191
|
+
if (c <= 65535) return String.fromCharCode(c);
|
|
1192
|
+
return String.fromCharCode((c - 65536 >> 10) + 55296, (c - 65536 & 1023) + 56320);
|
|
1193
|
+
}
|
|
1194
|
+
function fromHexCode$1(c) {
|
|
1195
|
+
if (c >= 48 && c <= 57) return c - 48;
|
|
1196
|
+
return (c | 32) - 97 + 10;
|
|
1197
|
+
}
|
|
1198
|
+
function escapedHexLen$1(c) {
|
|
1199
|
+
if (c === 120) return 2;
|
|
1200
|
+
if (c === 117) return 4;
|
|
1201
|
+
return 8;
|
|
1202
|
+
}
|
|
1203
|
+
function skipFoldedBreaks(input, position, end) {
|
|
1204
|
+
let breaks = 0;
|
|
1205
|
+
while (position < end) {
|
|
1206
|
+
const ch = input.charCodeAt(position);
|
|
1207
|
+
if (ch === 10) {
|
|
1208
|
+
breaks++;
|
|
1209
|
+
position++;
|
|
1210
|
+
} else if (ch === 13) {
|
|
1211
|
+
breaks++;
|
|
1212
|
+
position++;
|
|
1213
|
+
if (input.charCodeAt(position) === 10) position++;
|
|
1214
|
+
} else if (ch === 32 || ch === 9) position++;
|
|
1215
|
+
else break;
|
|
1216
|
+
}
|
|
1217
|
+
return {
|
|
1218
|
+
position,
|
|
1219
|
+
breaks
|
|
1220
|
+
};
|
|
1221
|
+
}
|
|
1222
|
+
function foldedBreaks(count) {
|
|
1223
|
+
if (count === 1) return " ";
|
|
1224
|
+
return "\n".repeat(count - 1);
|
|
1225
|
+
}
|
|
1226
|
+
function getPlainValue(input, start, end) {
|
|
1227
|
+
let result = "";
|
|
1228
|
+
let position = start;
|
|
1229
|
+
let captureStart = start;
|
|
1230
|
+
let captureEnd = start;
|
|
1231
|
+
while (position < end) {
|
|
1232
|
+
const ch = input.charCodeAt(position);
|
|
1233
|
+
if (ch === 10 || ch === 13) {
|
|
1234
|
+
result += input.slice(captureStart, captureEnd);
|
|
1235
|
+
const fold = skipFoldedBreaks(input, position, end);
|
|
1236
|
+
result += foldedBreaks(fold.breaks);
|
|
1237
|
+
position = captureStart = captureEnd = fold.position;
|
|
1238
|
+
} else {
|
|
1239
|
+
position++;
|
|
1240
|
+
if (ch !== 32 && ch !== 9) captureEnd = position;
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
return result + input.slice(captureStart, captureEnd);
|
|
1244
|
+
}
|
|
1245
|
+
function getSingleQuotedValue(input, start, end) {
|
|
1246
|
+
let result = "";
|
|
1247
|
+
let position = start;
|
|
1248
|
+
let captureStart = start;
|
|
1249
|
+
let captureEnd = start;
|
|
1250
|
+
while (position < end) {
|
|
1251
|
+
const ch = input.charCodeAt(position);
|
|
1252
|
+
if (ch === 39) {
|
|
1253
|
+
result += input.slice(captureStart, position) + "'";
|
|
1254
|
+
position += 2;
|
|
1255
|
+
captureStart = captureEnd = position;
|
|
1256
|
+
} else if (ch === 10 || ch === 13) {
|
|
1257
|
+
result += input.slice(captureStart, captureEnd);
|
|
1258
|
+
const fold = skipFoldedBreaks(input, position, end);
|
|
1259
|
+
result += foldedBreaks(fold.breaks);
|
|
1260
|
+
position = captureStart = captureEnd = fold.position;
|
|
1261
|
+
} else {
|
|
1262
|
+
position++;
|
|
1263
|
+
if (ch !== 32 && ch !== 9) captureEnd = position;
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
return result + input.slice(captureStart, end);
|
|
1267
|
+
}
|
|
1268
|
+
function getDoubleQuotedValue(input, start, end) {
|
|
1269
|
+
let result = "";
|
|
1270
|
+
let position = start;
|
|
1271
|
+
let captureStart = start;
|
|
1272
|
+
let captureEnd = start;
|
|
1273
|
+
while (position < end) {
|
|
1274
|
+
const ch = input.charCodeAt(position);
|
|
1275
|
+
if (ch === 92) {
|
|
1276
|
+
result += input.slice(captureStart, position);
|
|
1277
|
+
position++;
|
|
1278
|
+
const escaped = input.charCodeAt(position);
|
|
1279
|
+
if (escaped === 10 || escaped === 13) position = skipFoldedBreaks(input, position, end).position;
|
|
1280
|
+
else if (escaped < 256 && simpleEscapeCheck[escaped]) {
|
|
1281
|
+
result += simpleEscapeMap[escaped];
|
|
1282
|
+
position++;
|
|
1283
|
+
} else {
|
|
1284
|
+
let hexLength = escapedHexLen$1(escaped);
|
|
1285
|
+
let hexResult = 0;
|
|
1286
|
+
for (; hexLength > 0; hexLength--) {
|
|
1287
|
+
position++;
|
|
1288
|
+
const digit = fromHexCode$1(input.charCodeAt(position));
|
|
1289
|
+
hexResult = (hexResult << 4) + digit;
|
|
141
1290
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
1291
|
+
result += charFromCodepoint(hexResult);
|
|
1292
|
+
position++;
|
|
1293
|
+
}
|
|
1294
|
+
captureStart = captureEnd = position;
|
|
1295
|
+
} else if (ch === 10 || ch === 13) {
|
|
1296
|
+
result += input.slice(captureStart, captureEnd);
|
|
1297
|
+
const fold = skipFoldedBreaks(input, position, end);
|
|
1298
|
+
result += foldedBreaks(fold.breaks);
|
|
1299
|
+
position = captureStart = captureEnd = fold.position;
|
|
1300
|
+
} else {
|
|
1301
|
+
position++;
|
|
1302
|
+
if (ch !== 32 && ch !== 9) captureEnd = position;
|
|
148
1303
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
1304
|
+
}
|
|
1305
|
+
return result + input.slice(captureStart, end);
|
|
1306
|
+
}
|
|
1307
|
+
function getBlockValue(input, start, end, indent, chomping, folded) {
|
|
1308
|
+
const textIndent = indent < 0 ? 0 : indent;
|
|
1309
|
+
const region = input.slice(start, end).replace(/\r\n?/g, "\n");
|
|
1310
|
+
const lines = region === "" ? [] : (region.endsWith("\n") ? region.slice(0, -1) : region).split("\n");
|
|
1311
|
+
let result = "";
|
|
1312
|
+
let didReadContent = false;
|
|
1313
|
+
let emptyLines = 0;
|
|
1314
|
+
let atMoreIndented = false;
|
|
1315
|
+
for (const line of lines) {
|
|
1316
|
+
let column = 0;
|
|
1317
|
+
while (column < textIndent && line.charCodeAt(column) === 32) column++;
|
|
1318
|
+
if (indent < 0 || column >= line.length) {
|
|
1319
|
+
emptyLines++;
|
|
1320
|
+
continue;
|
|
156
1321
|
}
|
|
1322
|
+
const content = line.slice(textIndent);
|
|
1323
|
+
const first = content.charCodeAt(0);
|
|
1324
|
+
if (folded) if (first === 32 || first === 9) {
|
|
1325
|
+
atMoreIndented = true;
|
|
1326
|
+
result += "\n".repeat(didReadContent ? 1 + emptyLines : emptyLines);
|
|
1327
|
+
} else if (atMoreIndented) {
|
|
1328
|
+
atMoreIndented = false;
|
|
1329
|
+
result += "\n".repeat(emptyLines + 1);
|
|
1330
|
+
} else if (emptyLines === 0) {
|
|
1331
|
+
if (didReadContent) result += " ";
|
|
1332
|
+
} else result += "\n".repeat(emptyLines);
|
|
1333
|
+
else result += "\n".repeat(didReadContent ? 1 + emptyLines : emptyLines);
|
|
1334
|
+
result += content;
|
|
1335
|
+
didReadContent = true;
|
|
1336
|
+
emptyLines = 0;
|
|
1337
|
+
}
|
|
1338
|
+
if (chomping === CHOMPING_MODE.KEEP) result += "\n".repeat(didReadContent ? 1 + emptyLines : emptyLines);
|
|
1339
|
+
else if (chomping !== CHOMPING_MODE.STRIP) {
|
|
1340
|
+
if (didReadContent) result += "\n";
|
|
1341
|
+
}
|
|
1342
|
+
return result;
|
|
157
1343
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
1344
|
+
function getScalarValue(input, scalar) {
|
|
1345
|
+
if (scalar.valueStart === NO_RANGE$3) return "";
|
|
1346
|
+
const { valueStart, valueEnd } = scalar;
|
|
1347
|
+
if (scalar.fast) return input.slice(valueStart, valueEnd);
|
|
1348
|
+
switch (scalar.style) {
|
|
1349
|
+
case SCALAR_STYLE.SINGLE_QUOTED:
|
|
1350
|
+
return getSingleQuotedValue(input, valueStart, valueEnd);
|
|
1351
|
+
case SCALAR_STYLE.DOUBLE_QUOTED:
|
|
1352
|
+
return getDoubleQuotedValue(input, valueStart, valueEnd);
|
|
1353
|
+
case SCALAR_STYLE.LITERAL_BLOCK:
|
|
1354
|
+
return getBlockValue(input, valueStart, valueEnd, scalar.indent, scalar.chomping, false);
|
|
1355
|
+
case SCALAR_STYLE.FOLDED_BLOCK:
|
|
1356
|
+
return getBlockValue(input, valueStart, valueEnd, scalar.indent, scalar.chomping, true);
|
|
1357
|
+
default:
|
|
1358
|
+
return getPlainValue(input, valueStart, valueEnd);
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
var DEFAULT_TAG_HANDLERS = Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
1362
|
+
"!": "!",
|
|
1363
|
+
"!!": "tag:yaml.org,2002:"
|
|
1364
|
+
});
|
|
1365
|
+
function tagNameFull(rawTag, tagHandlers) {
|
|
1366
|
+
if (rawTag.startsWith("!<") && rawTag.endsWith(">")) return decodeURIComponent(rawTag.slice(2, -1));
|
|
1367
|
+
const handleEnd = rawTag.indexOf("!", 1);
|
|
1368
|
+
const handle = handleEnd === -1 ? "!" : rawTag.slice(0, handleEnd + 1);
|
|
1369
|
+
const prefix = tagHandlers?.[handle] ?? DEFAULT_TAG_HANDLERS[handle] ?? handle;
|
|
1370
|
+
return decodeURIComponent(prefix) + decodeURIComponent(rawTag.slice(handle.length));
|
|
1371
|
+
}
|
|
1372
|
+
var NO_RANGE$2 = -1;
|
|
1373
|
+
var MERGE_TAG_NAME = "tag:yaml.org,2002:merge";
|
|
1374
|
+
var DEFAULT_CONSTRUCTOR_OPTIONS = {
|
|
1375
|
+
filename: "",
|
|
1376
|
+
schema: CORE_SCHEMA,
|
|
1377
|
+
json: false,
|
|
1378
|
+
maxTotalMergeKeys: 1e4,
|
|
1379
|
+
maxAliases: -1
|
|
1380
|
+
};
|
|
1381
|
+
function eventPosition$1(event) {
|
|
1382
|
+
if ("tagStart" in event && event.tagStart !== NO_RANGE$2) return event.tagStart;
|
|
1383
|
+
if ("anchorStart" in event && event.anchorStart !== NO_RANGE$2) return event.anchorStart;
|
|
1384
|
+
if ("valueStart" in event && event.valueStart !== NO_RANGE$2) return event.valueStart;
|
|
1385
|
+
if ("start" in event) return event.start;
|
|
1386
|
+
return 0;
|
|
1387
|
+
}
|
|
1388
|
+
function throwError$1(state, message) {
|
|
1389
|
+
YAMLException.throwAt(state.source, state.position, message, state.filename);
|
|
1390
|
+
}
|
|
1391
|
+
function finalizeCollection(state, position, tag, carrier) {
|
|
1392
|
+
try {
|
|
1393
|
+
return tag.finalize(carrier);
|
|
1394
|
+
} catch (error) {
|
|
1395
|
+
if (error instanceof YAMLException) throw error;
|
|
1396
|
+
YAMLException.throwAt(state.source, position, error instanceof Error ? error.message : String(error), state.filename);
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
function constructScalar(state, event) {
|
|
1400
|
+
const source = getScalarValue(state.source, event);
|
|
1401
|
+
const rawTag = event.tagStart === NO_RANGE$2 ? "" : state.source.slice(event.tagStart, event.tagEnd);
|
|
1402
|
+
const strTag2 = state.schema.defaultScalarTag;
|
|
1403
|
+
if (rawTag !== "") {
|
|
1404
|
+
if (rawTag === "!") return {
|
|
1405
|
+
value: source,
|
|
1406
|
+
tag: strTag2
|
|
1407
|
+
};
|
|
1408
|
+
const tagName = tagNameFull(rawTag, state.tagHandlers);
|
|
1409
|
+
const scalarTag = state.schema.lookupScalarTag(tagName);
|
|
1410
|
+
if (scalarTag) {
|
|
1411
|
+
const result = scalarTag.resolve(source, true, tagName);
|
|
1412
|
+
if (result === NOT_RESOLVED) throwError$1(state, `cannot resolve a node with !<${tagName}> explicit tag`);
|
|
1413
|
+
return {
|
|
1414
|
+
value: result,
|
|
1415
|
+
tag: scalarTag
|
|
1416
|
+
};
|
|
167
1417
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
1418
|
+
const collectionTagDef = state.schema.lookupMappingTag(tagName) ?? state.schema.lookupSequenceTag(tagName);
|
|
1419
|
+
if (collectionTagDef) {
|
|
1420
|
+
if (source !== "") throwError$1(state, `cannot resolve a node with !<${tagName}> explicit tag`);
|
|
1421
|
+
const carrier = collectionTagDef.create(tagName);
|
|
1422
|
+
return {
|
|
1423
|
+
value: collectionTagDef.carrierIsResult ? carrier : finalizeCollection(state, state.position, collectionTagDef, carrier),
|
|
1424
|
+
tag: collectionTagDef
|
|
1425
|
+
};
|
|
1426
|
+
}
|
|
1427
|
+
throwError$1(state, `unknown scalar tag !<${tagName}>`);
|
|
1428
|
+
}
|
|
1429
|
+
if (event.style === SCALAR_STYLE.PLAIN) return state.schema.resolveImplicitScalarTag(source);
|
|
1430
|
+
return {
|
|
1431
|
+
value: strTag2.resolve(source, false, strTag2.tagName),
|
|
1432
|
+
tag: strTag2
|
|
1433
|
+
};
|
|
1434
|
+
}
|
|
1435
|
+
function collectionTagName(state, event, defaultTagName) {
|
|
1436
|
+
const rawTag = event.tagStart === NO_RANGE$2 ? "" : state.source.slice(event.tagStart, event.tagEnd);
|
|
1437
|
+
return rawTag === "" || rawTag === "!" ? defaultTagName : tagNameFull(rawTag, state.tagHandlers);
|
|
1438
|
+
}
|
|
1439
|
+
function isMappingTag(tag) {
|
|
1440
|
+
return tag.nodeKind === "mapping";
|
|
1441
|
+
}
|
|
1442
|
+
function chargeMergeWork(state) {
|
|
1443
|
+
state.totalMergeKeys++;
|
|
1444
|
+
if (state.maxTotalMergeKeys !== -1 && state.totalMergeKeys > state.maxTotalMergeKeys) throwError$1(state, `merge keys exceeded maxTotalMergeKeys (${state.maxTotalMergeKeys})`);
|
|
1445
|
+
}
|
|
1446
|
+
function mergeKeys(state, frame, source, sourceTag) {
|
|
1447
|
+
chargeMergeWork(state);
|
|
1448
|
+
for (const sourceKey of sourceTag.keys(source)) {
|
|
1449
|
+
chargeMergeWork(state);
|
|
1450
|
+
if (frame.tag.has(frame.value, sourceKey)) continue;
|
|
1451
|
+
const err = frame.tag.addPair(frame.value, sourceKey, sourceTag.get(source, sourceKey));
|
|
1452
|
+
if (err) throwError$1(state, err);
|
|
1453
|
+
frame.overridable ??= /* @__PURE__ */ new Set();
|
|
1454
|
+
frame.overridable.add(sourceKey);
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
function mergeSource(state, frame, source, sourceTag) {
|
|
1458
|
+
state.position = frame.keyPosition;
|
|
1459
|
+
if (isMappingTag(sourceTag)) mergeKeys(state, frame, source, sourceTag);
|
|
1460
|
+
else if (sourceTag.nodeKind === "sequence" && Array.isArray(source)) {
|
|
1461
|
+
if (source.length > 100) throwError$1(state, "abnormal merge sequence size");
|
|
1462
|
+
for (const element of source) {
|
|
1463
|
+
const elementTag = state.nodeTags.get(element);
|
|
1464
|
+
if (!elementTag) throwError$1(state, "cannot merge mappings; the provided source object is unacceptable");
|
|
1465
|
+
mergeKeys(state, frame, element, elementTag);
|
|
1466
|
+
}
|
|
1467
|
+
} else throwError$1(state, "cannot merge mappings; the provided source object is unacceptable");
|
|
1468
|
+
}
|
|
1469
|
+
function addMappingValue(state, frame, key, value, tag) {
|
|
1470
|
+
state.position = frame.keyPosition;
|
|
1471
|
+
if (frame.keyIsMerge) {
|
|
1472
|
+
mergeSource(state, frame, value, tag);
|
|
1473
|
+
return;
|
|
1474
|
+
}
|
|
1475
|
+
if (!state.json && frame.tag.has(frame.value, key) && !frame.overridable?.has(key)) throwError$1(state, "duplicated mapping key");
|
|
1476
|
+
const err = frame.tag.addPair(frame.value, key, value);
|
|
1477
|
+
if (err) throwError$1(state, err);
|
|
1478
|
+
frame.overridable?.delete(key);
|
|
1479
|
+
}
|
|
1480
|
+
function addValue(state, value, tag) {
|
|
1481
|
+
const frame = state.frames[state.frames.length - 1];
|
|
1482
|
+
if (frame.kind === "document") {
|
|
1483
|
+
frame.value = value;
|
|
1484
|
+
frame.hasValue = true;
|
|
1485
|
+
} else if (frame.kind === "sequence") {
|
|
1486
|
+
if (isMappingTag(tag)) state.nodeTags.set(value, tag);
|
|
1487
|
+
const err = frame.tag.addItem(frame.value, value, frame.index++);
|
|
1488
|
+
if (err) throwError$1(state, err);
|
|
1489
|
+
} else if (frame.hasKey) {
|
|
1490
|
+
const key = frame.key;
|
|
1491
|
+
frame.key = void 0;
|
|
1492
|
+
frame.hasKey = false;
|
|
1493
|
+
addMappingValue(state, frame, key, value, tag);
|
|
1494
|
+
} else {
|
|
1495
|
+
frame.key = value;
|
|
1496
|
+
frame.keyPosition = state.position;
|
|
1497
|
+
frame.hasKey = true;
|
|
1498
|
+
frame.keyIsMerge = tag.tagName === MERGE_TAG_NAME;
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1501
|
+
function storeAnchor(state, event, value, tag, isValueFinal) {
|
|
1502
|
+
if (event.anchorStart !== NO_RANGE$2) {
|
|
1503
|
+
const anchor = {
|
|
1504
|
+
value,
|
|
1505
|
+
tag,
|
|
1506
|
+
isValueFinal
|
|
1507
|
+
};
|
|
1508
|
+
state.anchors.set(state.source.slice(event.anchorStart, event.anchorEnd), anchor);
|
|
1509
|
+
return anchor;
|
|
1510
|
+
}
|
|
1511
|
+
return null;
|
|
1512
|
+
}
|
|
1513
|
+
function constructFromEvents(events, options) {
|
|
1514
|
+
const state = {
|
|
1515
|
+
...DEFAULT_CONSTRUCTOR_OPTIONS,
|
|
1516
|
+
...options,
|
|
1517
|
+
events,
|
|
1518
|
+
documents: [],
|
|
1519
|
+
eventIndex: 0,
|
|
1520
|
+
position: 0,
|
|
1521
|
+
frames: [],
|
|
1522
|
+
anchors: /* @__PURE__ */ new Map(),
|
|
1523
|
+
nodeTags: /* @__PURE__ */ new Map(),
|
|
1524
|
+
tagHandlers: /* @__PURE__ */ Object.create(null),
|
|
1525
|
+
totalMergeKeys: 0,
|
|
1526
|
+
aliasCount: 0
|
|
1527
|
+
};
|
|
1528
|
+
while (state.eventIndex < state.events.length) {
|
|
1529
|
+
const event = state.events[state.eventIndex++];
|
|
1530
|
+
state.position = eventPosition$1(event);
|
|
1531
|
+
switch (event.type) {
|
|
1532
|
+
case EVENT_ID.DOCUMENT:
|
|
1533
|
+
state.anchors = /* @__PURE__ */ new Map();
|
|
1534
|
+
state.nodeTags = /* @__PURE__ */ new Map();
|
|
1535
|
+
state.aliasCount = 0;
|
|
1536
|
+
state.tagHandlers = /* @__PURE__ */ Object.create(null);
|
|
1537
|
+
for (const directive of event.directives) if (directive.kind === "tag") state.tagHandlers[directive.handle] = directive.prefix;
|
|
1538
|
+
state.frames.push({
|
|
1539
|
+
kind: "document",
|
|
1540
|
+
position: state.position,
|
|
1541
|
+
value: void 0,
|
|
1542
|
+
hasValue: false
|
|
1543
|
+
});
|
|
1544
|
+
break;
|
|
1545
|
+
case EVENT_ID.SCALAR: {
|
|
1546
|
+
const { value, tag } = constructScalar(state, event);
|
|
1547
|
+
storeAnchor(state, event, value, tag, true);
|
|
1548
|
+
addValue(state, value, tag);
|
|
1549
|
+
break;
|
|
1550
|
+
}
|
|
1551
|
+
case EVENT_ID.SEQUENCE: {
|
|
1552
|
+
const tagName = collectionTagName(state, event, "tag:yaml.org,2002:seq");
|
|
1553
|
+
const tag = state.schema.lookupSequenceTag(tagName);
|
|
1554
|
+
if (!tag) throwError$1(state, `unknown sequence tag !<${tagName}>`);
|
|
1555
|
+
const value = tag.create(tagName);
|
|
1556
|
+
const anchor = storeAnchor(state, event, value, tag, tag.carrierIsResult);
|
|
1557
|
+
state.frames.push({
|
|
1558
|
+
kind: "sequence",
|
|
1559
|
+
position: state.position,
|
|
1560
|
+
value,
|
|
1561
|
+
tag,
|
|
1562
|
+
anchor,
|
|
1563
|
+
index: 0
|
|
1564
|
+
});
|
|
1565
|
+
break;
|
|
1566
|
+
}
|
|
1567
|
+
case EVENT_ID.MAPPING: {
|
|
1568
|
+
const tagName = collectionTagName(state, event, "tag:yaml.org,2002:map");
|
|
1569
|
+
const tag = state.schema.lookupMappingTag(tagName);
|
|
1570
|
+
if (!tag) throwError$1(state, `unknown mapping tag !<${tagName}>`);
|
|
1571
|
+
const value = tag.create(tagName);
|
|
1572
|
+
const anchor = storeAnchor(state, event, value, tag, tag.carrierIsResult);
|
|
1573
|
+
state.frames.push({
|
|
1574
|
+
kind: "mapping",
|
|
1575
|
+
position: state.position,
|
|
1576
|
+
value,
|
|
1577
|
+
tag,
|
|
1578
|
+
anchor,
|
|
1579
|
+
key: void 0,
|
|
1580
|
+
keyPosition: state.position,
|
|
1581
|
+
hasKey: false,
|
|
1582
|
+
keyIsMerge: false,
|
|
1583
|
+
overridable: null
|
|
1584
|
+
});
|
|
1585
|
+
break;
|
|
1586
|
+
}
|
|
1587
|
+
case EVENT_ID.ALIAS: {
|
|
1588
|
+
if (state.maxAliases !== -1 && ++state.aliasCount > state.maxAliases) throwError$1(state, `aliases exceeded maxAliases (${state.maxAliases})`);
|
|
1589
|
+
const name = state.source.slice(event.anchorStart, event.anchorEnd);
|
|
1590
|
+
const anchor = state.anchors.get(name);
|
|
1591
|
+
if (!anchor) throwError$1(state, `unidentified alias "${name}"`);
|
|
1592
|
+
if (!anchor.isValueFinal) throwError$1(state, `recursive alias "${name}" is not supported for tag ${anchor.tag.tagName} because it uses finalize()`);
|
|
1593
|
+
addValue(state, anchor.value, anchor.tag);
|
|
1594
|
+
break;
|
|
1595
|
+
}
|
|
1596
|
+
case EVENT_ID.POP: {
|
|
1597
|
+
const frame = state.frames.pop();
|
|
1598
|
+
if (frame.kind === "mapping" && frame.hasKey) {
|
|
1599
|
+
state.position = frame.keyPosition;
|
|
1600
|
+
throwError$1(state, "incomplete mapping pair in event stream");
|
|
176
1601
|
}
|
|
177
|
-
if (
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
1602
|
+
if (frame.kind === "document") state.documents.push(frame.value);
|
|
1603
|
+
else {
|
|
1604
|
+
const value = frame.tag.carrierIsResult ? frame.value : finalizeCollection(state, frame.position, frame.tag, frame.value);
|
|
1605
|
+
if (frame.anchor) {
|
|
1606
|
+
frame.anchor.value = value;
|
|
1607
|
+
frame.anchor.isValueFinal = true;
|
|
1608
|
+
}
|
|
1609
|
+
addValue(state, value, frame.tag);
|
|
183
1610
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
name: 'package.json "type"',
|
|
187
|
-
status: 'pass',
|
|
188
|
-
message: 'No "type" field (defaults to CommonJS)',
|
|
189
|
-
details: 'Add "type": "module" if you prefer ESM',
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
catch {
|
|
193
|
-
return {
|
|
194
|
-
name: 'package.json "type"',
|
|
195
|
-
status: 'fail',
|
|
196
|
-
message: 'Could not parse package.json',
|
|
197
|
-
fix: 'Fix JSON syntax in package.json',
|
|
198
|
-
};
|
|
1611
|
+
break;
|
|
1612
|
+
}
|
|
199
1613
|
}
|
|
1614
|
+
}
|
|
1615
|
+
return state.documents;
|
|
200
1616
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
1617
|
+
var NO_RANGE$1 = -1;
|
|
1618
|
+
var HAS_OWN = Object.prototype.hasOwnProperty;
|
|
1619
|
+
var CONTEXT_FLOW_IN = 1;
|
|
1620
|
+
var CONTEXT_FLOW_OUT = 2;
|
|
1621
|
+
var CONTEXT_BLOCK_IN = 3;
|
|
1622
|
+
var CONTEXT_BLOCK_OUT = 4;
|
|
1623
|
+
var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
|
|
1624
|
+
var PATTERN_FLOW_INDICATORS = /[,\[\]{}]/;
|
|
1625
|
+
var PATTERN_TAG_HANDLE = /^(?:!|!!|![0-9A-Za-z-]+!)$/;
|
|
1626
|
+
var NS_URI_CHAR = String.raw`(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-#;/?:@&=+$,_.!~*'()\[\]])`;
|
|
1627
|
+
var NS_TAG_CHAR = String.raw`(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-#;/?:@&=+$.~*'()_])`;
|
|
1628
|
+
var PATTERN_TAG_URI = new RegExp(`^(?:${NS_URI_CHAR})*$`);
|
|
1629
|
+
var PATTERN_TAG_SUFFIX = new RegExp(`^(?:${NS_TAG_CHAR})+$`);
|
|
1630
|
+
var PATTERN_TAG_PREFIX = new RegExp(`^(?:!(?:${NS_URI_CHAR})*|${NS_TAG_CHAR}(?:${NS_URI_CHAR})*)$`);
|
|
1631
|
+
var DEFAULT_PARSER_OPTIONS = {
|
|
1632
|
+
filename: "",
|
|
1633
|
+
maxDepth: 100
|
|
1634
|
+
};
|
|
1635
|
+
function addDocumentEvent(state, explicitStart, explicitEnd) {
|
|
1636
|
+
state.events.push({
|
|
1637
|
+
type: EVENT_ID.DOCUMENT,
|
|
1638
|
+
explicitStart,
|
|
1639
|
+
explicitEnd,
|
|
1640
|
+
directives: state.directives
|
|
1641
|
+
});
|
|
1642
|
+
}
|
|
1643
|
+
function addSequenceEvent(state, start, anchorStart, anchorEnd, tagStart, tagEnd, style) {
|
|
1644
|
+
state.events.push({
|
|
1645
|
+
type: EVENT_ID.SEQUENCE,
|
|
1646
|
+
start,
|
|
1647
|
+
anchorStart,
|
|
1648
|
+
anchorEnd,
|
|
1649
|
+
tagStart,
|
|
1650
|
+
tagEnd,
|
|
1651
|
+
style
|
|
1652
|
+
});
|
|
1653
|
+
}
|
|
1654
|
+
function addMappingEvent(state, start, anchorStart, anchorEnd, tagStart, tagEnd, style) {
|
|
1655
|
+
state.events.push({
|
|
1656
|
+
type: EVENT_ID.MAPPING,
|
|
1657
|
+
start,
|
|
1658
|
+
anchorStart,
|
|
1659
|
+
anchorEnd,
|
|
1660
|
+
tagStart,
|
|
1661
|
+
tagEnd,
|
|
1662
|
+
style
|
|
1663
|
+
});
|
|
1664
|
+
}
|
|
1665
|
+
function insertFlowPairMappingEvent(state, snapshot) {
|
|
1666
|
+
state.events.splice(snapshot.eventsLength, 0, {
|
|
1667
|
+
type: EVENT_ID.MAPPING,
|
|
1668
|
+
start: snapshot.position,
|
|
1669
|
+
anchorStart: NO_RANGE$1,
|
|
1670
|
+
anchorEnd: NO_RANGE$1,
|
|
1671
|
+
tagStart: NO_RANGE$1,
|
|
1672
|
+
tagEnd: NO_RANGE$1,
|
|
1673
|
+
style: COLLECTION_STYLE.FLOW
|
|
1674
|
+
});
|
|
1675
|
+
}
|
|
1676
|
+
function addScalarEvent(state, valueStart, valueEnd, anchorStart, anchorEnd, tagStart, tagEnd, style, chomping = CHOMPING_MODE.CLIP, indent = -1, fast = false) {
|
|
1677
|
+
state.events.push({
|
|
1678
|
+
type: EVENT_ID.SCALAR,
|
|
1679
|
+
valueStart,
|
|
1680
|
+
valueEnd,
|
|
1681
|
+
anchorStart,
|
|
1682
|
+
anchorEnd,
|
|
1683
|
+
tagStart,
|
|
1684
|
+
tagEnd,
|
|
1685
|
+
style,
|
|
1686
|
+
chomping,
|
|
1687
|
+
indent,
|
|
1688
|
+
fast
|
|
1689
|
+
});
|
|
1690
|
+
}
|
|
1691
|
+
function addAliasEvent(state, anchorStart, anchorEnd) {
|
|
1692
|
+
state.events.push({
|
|
1693
|
+
type: EVENT_ID.ALIAS,
|
|
1694
|
+
anchorStart,
|
|
1695
|
+
anchorEnd
|
|
1696
|
+
});
|
|
1697
|
+
}
|
|
1698
|
+
function addPopEvent(state) {
|
|
1699
|
+
state.events.push({ type: EVENT_ID.POP });
|
|
1700
|
+
}
|
|
1701
|
+
function addEmptyScalarEvent(state) {
|
|
1702
|
+
addScalarEvent(state, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, NO_RANGE$1, SCALAR_STYLE.PLAIN);
|
|
1703
|
+
}
|
|
1704
|
+
function emptyProperties() {
|
|
1705
|
+
return {
|
|
1706
|
+
anchorStart: NO_RANGE$1,
|
|
1707
|
+
anchorEnd: NO_RANGE$1,
|
|
1708
|
+
tagStart: NO_RANGE$1,
|
|
1709
|
+
tagEnd: NO_RANGE$1
|
|
1710
|
+
};
|
|
1711
|
+
}
|
|
1712
|
+
function snapshotState(state) {
|
|
1713
|
+
return {
|
|
1714
|
+
position: state.position,
|
|
1715
|
+
line: state.line,
|
|
1716
|
+
lineStart: state.lineStart,
|
|
1717
|
+
lineIndent: state.lineIndent,
|
|
1718
|
+
firstTabInLine: state.firstTabInLine,
|
|
1719
|
+
eventsLength: state.events.length
|
|
1720
|
+
};
|
|
1721
|
+
}
|
|
1722
|
+
function restoreState(state, snapshot) {
|
|
1723
|
+
state.position = snapshot.position;
|
|
1724
|
+
state.line = snapshot.line;
|
|
1725
|
+
state.lineStart = snapshot.lineStart;
|
|
1726
|
+
state.lineIndent = snapshot.lineIndent;
|
|
1727
|
+
state.firstTabInLine = snapshot.firstTabInLine;
|
|
1728
|
+
state.events.length = snapshot.eventsLength;
|
|
1729
|
+
}
|
|
1730
|
+
function throwError(state, message) {
|
|
1731
|
+
YAMLException.throwAt(state.input.slice(0, state.length), state.position, message, state.filename);
|
|
1732
|
+
}
|
|
1733
|
+
function isEol(c) {
|
|
1734
|
+
return c === 10 || c === 13;
|
|
1735
|
+
}
|
|
1736
|
+
function isWhiteSpace(c) {
|
|
1737
|
+
return c === 9 || c === 32;
|
|
1738
|
+
}
|
|
1739
|
+
function isWsOrEol(c) {
|
|
1740
|
+
return isWhiteSpace(c) || isEol(c);
|
|
1741
|
+
}
|
|
1742
|
+
function isWsOrEolOrEnd(c) {
|
|
1743
|
+
return c === 0 || isWsOrEol(c);
|
|
1744
|
+
}
|
|
1745
|
+
function isFlowIndicator(c) {
|
|
1746
|
+
return c === 44 || c === 91 || c === 93 || c === 123 || c === 125;
|
|
1747
|
+
}
|
|
1748
|
+
function fromDecimalCode(c) {
|
|
1749
|
+
return c >= 48 && c <= 57 ? c - 48 : -1;
|
|
1750
|
+
}
|
|
1751
|
+
function fromHexCode(c) {
|
|
1752
|
+
if (c >= 48 && c <= 57) return c - 48;
|
|
1753
|
+
const lc = c | 32;
|
|
1754
|
+
if (lc >= 97 && lc <= 102) return lc - 97 + 10;
|
|
1755
|
+
return -1;
|
|
1756
|
+
}
|
|
1757
|
+
function escapedHexLen(c) {
|
|
1758
|
+
if (c === 120) return 2;
|
|
1759
|
+
if (c === 117) return 4;
|
|
1760
|
+
if (c === 85) return 8;
|
|
1761
|
+
return 0;
|
|
1762
|
+
}
|
|
1763
|
+
function isSimpleEscape(c) {
|
|
1764
|
+
return c === 48 || c === 97 || c === 98 || c === 116 || c === 9 || c === 110 || c === 118 || c === 102 || c === 114 || c === 101 || c === 32 || c === 34 || c === 47 || c === 92 || c === 78 || c === 95 || c === 76 || c === 80;
|
|
1765
|
+
}
|
|
1766
|
+
function consumeLineBreak(state) {
|
|
1767
|
+
if (state.input.charCodeAt(state.position) === 10) state.position++;
|
|
1768
|
+
else {
|
|
1769
|
+
state.position++;
|
|
1770
|
+
if (state.input.charCodeAt(state.position) === 10) state.position++;
|
|
1771
|
+
}
|
|
1772
|
+
state.line++;
|
|
1773
|
+
state.lineStart = state.position;
|
|
1774
|
+
state.lineIndent = 0;
|
|
1775
|
+
state.firstTabInLine = -1;
|
|
1776
|
+
}
|
|
1777
|
+
function skipSeparationSpace(state, allowComments) {
|
|
1778
|
+
let lineBreaks = 0;
|
|
1779
|
+
let ch = state.input.charCodeAt(state.position);
|
|
1780
|
+
let hasSeparation = state.position === state.lineStart || isWsOrEol(state.input.charCodeAt(state.position - 1));
|
|
1781
|
+
while (ch !== 0) {
|
|
1782
|
+
while (isWhiteSpace(ch)) {
|
|
1783
|
+
hasSeparation = true;
|
|
1784
|
+
if (ch === 9 && state.firstTabInLine === -1) state.firstTabInLine = state.position;
|
|
1785
|
+
ch = state.input.charCodeAt(++state.position);
|
|
205
1786
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
1787
|
+
if (allowComments && hasSeparation && ch === 35) do
|
|
1788
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1789
|
+
while (!isEol(ch) && ch !== 0);
|
|
1790
|
+
if (!isEol(ch)) break;
|
|
1791
|
+
consumeLineBreak(state);
|
|
1792
|
+
lineBreaks++;
|
|
1793
|
+
hasSeparation = true;
|
|
1794
|
+
ch = state.input.charCodeAt(state.position);
|
|
1795
|
+
while (ch === 32) {
|
|
1796
|
+
state.lineIndent++;
|
|
1797
|
+
ch = state.input.charCodeAt(++state.position);
|
|
210
1798
|
}
|
|
211
|
-
|
|
212
|
-
|
|
1799
|
+
}
|
|
1800
|
+
return lineBreaks;
|
|
1801
|
+
}
|
|
1802
|
+
function testDocumentSeparator(state, position = state.position) {
|
|
1803
|
+
const ch = state.input.charCodeAt(position);
|
|
1804
|
+
if ((ch === 45 || ch === 46) && ch === state.input.charCodeAt(position + 1) && ch === state.input.charCodeAt(position + 2)) {
|
|
1805
|
+
const following = state.input.charCodeAt(position + 3);
|
|
1806
|
+
return following === 0 || isWsOrEol(following);
|
|
1807
|
+
}
|
|
1808
|
+
return false;
|
|
1809
|
+
}
|
|
1810
|
+
function skipByteOrderMark(state) {
|
|
1811
|
+
if (state.position === state.lineStart && state.input.charCodeAt(state.position) === 65279) {
|
|
1812
|
+
state.position++;
|
|
1813
|
+
state.lineStart = state.position;
|
|
1814
|
+
}
|
|
1815
|
+
}
|
|
1816
|
+
function testDocumentBoundary(state) {
|
|
1817
|
+
if (state.position !== state.lineStart) return false;
|
|
1818
|
+
if (testDocumentSeparator(state)) return true;
|
|
1819
|
+
if (state.input.charCodeAt(state.position) !== 65279) return false;
|
|
1820
|
+
const snapshot = snapshotState(state);
|
|
1821
|
+
skipByteOrderMark(state);
|
|
1822
|
+
skipSeparationSpace(state, true);
|
|
1823
|
+
const ch = state.input.charCodeAt(state.position);
|
|
1824
|
+
const result = state.position === state.lineStart && (ch === 37 || ch === 45 && testDocumentSeparator(state));
|
|
1825
|
+
restoreState(state, snapshot);
|
|
1826
|
+
return result;
|
|
1827
|
+
}
|
|
1828
|
+
function skipUntilLineEnd(state) {
|
|
1829
|
+
let ch = state.input.charCodeAt(state.position);
|
|
1830
|
+
while (ch !== 0 && !isEol(ch)) ch = state.input.charCodeAt(++state.position);
|
|
1831
|
+
}
|
|
1832
|
+
function checkPrintable(state, start, end) {
|
|
1833
|
+
if (PATTERN_NON_PRINTABLE.test(state.input.slice(start, end))) throwError(state, "the stream contains non-printable characters");
|
|
1834
|
+
}
|
|
1835
|
+
function readTagProperty(state, props, inFlow) {
|
|
1836
|
+
if (state.input.charCodeAt(state.position) !== 33) return false;
|
|
1837
|
+
if (props.tagStart !== NO_RANGE$1) throwError(state, "duplication of a tag property");
|
|
1838
|
+
const start = state.position;
|
|
1839
|
+
let isVerbatim = false;
|
|
1840
|
+
let isNamed = false;
|
|
1841
|
+
let tagHandle = "!";
|
|
1842
|
+
let ch = state.input.charCodeAt(++state.position);
|
|
1843
|
+
if (ch === 60) {
|
|
1844
|
+
isVerbatim = true;
|
|
1845
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1846
|
+
} else if (ch === 33) {
|
|
1847
|
+
isNamed = true;
|
|
1848
|
+
tagHandle = "!!";
|
|
1849
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1850
|
+
}
|
|
1851
|
+
let suffixStart = state.position;
|
|
1852
|
+
let tagName;
|
|
1853
|
+
if (isVerbatim) {
|
|
1854
|
+
while (ch !== 0 && ch !== 62) ch = state.input.charCodeAt(++state.position);
|
|
1855
|
+
if (ch !== 62) throwError(state, "unexpected end of the stream within a verbatim tag");
|
|
1856
|
+
tagName = state.input.slice(suffixStart, state.position);
|
|
1857
|
+
state.position++;
|
|
1858
|
+
} else {
|
|
1859
|
+
while (ch !== 0 && !isWsOrEol(ch) && !(inFlow && isFlowIndicator(ch))) {
|
|
1860
|
+
if (ch === 33) if (!isNamed) {
|
|
1861
|
+
tagHandle = state.input.slice(suffixStart - 1, state.position + 1);
|
|
1862
|
+
if (!PATTERN_TAG_HANDLE.test(tagHandle)) throwError(state, "named tag handle cannot contain such characters");
|
|
1863
|
+
isNamed = true;
|
|
1864
|
+
suffixStart = state.position + 1;
|
|
1865
|
+
} else throwError(state, "tag suffix cannot contain exclamation marks");
|
|
1866
|
+
ch = state.input.charCodeAt(++state.position);
|
|
213
1867
|
}
|
|
1868
|
+
tagName = state.input.slice(suffixStart, state.position);
|
|
1869
|
+
if (PATTERN_FLOW_INDICATORS.test(tagName)) throwError(state, "tag suffix cannot contain flow indicator characters");
|
|
1870
|
+
}
|
|
1871
|
+
if (tagName && !(isVerbatim ? PATTERN_TAG_URI.test(tagName) : PATTERN_TAG_SUFFIX.test(tagName))) throwError(state, `tag name cannot contain such characters: ${tagName}`);
|
|
1872
|
+
if (!isVerbatim && tagHandle !== "!" && tagHandle !== "!!" && !HAS_OWN.call(state.tagHandlers, tagHandle)) throwError(state, `undeclared tag handle "${tagHandle}"`);
|
|
1873
|
+
props.tagStart = start;
|
|
1874
|
+
props.tagEnd = state.position;
|
|
1875
|
+
return true;
|
|
214
1876
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
1877
|
+
function readAnchorProperty(state, props) {
|
|
1878
|
+
if (state.input.charCodeAt(state.position) !== 38) return false;
|
|
1879
|
+
if (props.anchorStart !== NO_RANGE$1) throwError(state, "duplication of an anchor property");
|
|
1880
|
+
state.position++;
|
|
1881
|
+
const start = state.position;
|
|
1882
|
+
while (state.input.charCodeAt(state.position) !== 0 && !isWsOrEol(state.input.charCodeAt(state.position)) && !isFlowIndicator(state.input.charCodeAt(state.position))) state.position++;
|
|
1883
|
+
if (state.position === start) throwError(state, "name of an anchor node must contain at least one character");
|
|
1884
|
+
props.anchorStart = start;
|
|
1885
|
+
props.anchorEnd = state.position;
|
|
1886
|
+
return true;
|
|
1887
|
+
}
|
|
1888
|
+
function readAlias(state, props) {
|
|
1889
|
+
if (state.input.charCodeAt(state.position) !== 42) return false;
|
|
1890
|
+
if (props.anchorStart !== NO_RANGE$1 || props.tagStart !== NO_RANGE$1) throwError(state, "alias node should not have any properties");
|
|
1891
|
+
state.position++;
|
|
1892
|
+
const start = state.position;
|
|
1893
|
+
while (state.input.charCodeAt(state.position) !== 0 && !isWsOrEol(state.input.charCodeAt(state.position)) && !isFlowIndicator(state.input.charCodeAt(state.position))) state.position++;
|
|
1894
|
+
if (state.position === start) throwError(state, "name of an alias node must contain at least one character");
|
|
1895
|
+
addAliasEvent(state, start, state.position);
|
|
1896
|
+
return true;
|
|
1897
|
+
}
|
|
1898
|
+
function readFlowScalarBreak(state, nodeIndent) {
|
|
1899
|
+
skipSeparationSpace(state, false);
|
|
1900
|
+
if (state.lineIndent < nodeIndent) throwError(state, "deficient indentation");
|
|
1901
|
+
}
|
|
1902
|
+
function readSingleQuotedScalar(state, nodeIndent, props) {
|
|
1903
|
+
if (state.input.charCodeAt(state.position) !== 39) return false;
|
|
1904
|
+
state.position++;
|
|
1905
|
+
const start = state.position;
|
|
1906
|
+
let simple = true;
|
|
1907
|
+
while (state.input.charCodeAt(state.position) !== 0) {
|
|
1908
|
+
const ch = state.input.charCodeAt(state.position);
|
|
1909
|
+
if (ch === 39) {
|
|
1910
|
+
if (state.input.charCodeAt(state.position + 1) === 39) {
|
|
1911
|
+
simple = false;
|
|
1912
|
+
state.position += 2;
|
|
1913
|
+
continue;
|
|
1914
|
+
}
|
|
1915
|
+
const end = state.position;
|
|
1916
|
+
state.position++;
|
|
1917
|
+
addScalarEvent(state, start, end, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, SCALAR_STYLE.SINGLE_QUOTED, CHOMPING_MODE.CLIP, -1, simple);
|
|
1918
|
+
return true;
|
|
224
1919
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
1920
|
+
if (isEol(ch)) {
|
|
1921
|
+
simple = false;
|
|
1922
|
+
readFlowScalarBreak(state, nodeIndent);
|
|
1923
|
+
} else if (state.position === state.lineStart && testDocumentSeparator(state)) throwError(state, "unexpected end of the document within a single quoted scalar");
|
|
1924
|
+
else if (ch !== 9 && ch < 32) throwError(state, "expected valid JSON character");
|
|
1925
|
+
else state.position++;
|
|
1926
|
+
}
|
|
1927
|
+
throwError(state, "unexpected end of the stream within a single quoted scalar");
|
|
1928
|
+
}
|
|
1929
|
+
function readDoubleQuotedScalar(state, nodeIndent, props) {
|
|
1930
|
+
if (state.input.charCodeAt(state.position) !== 34) return false;
|
|
1931
|
+
state.position++;
|
|
1932
|
+
const start = state.position;
|
|
1933
|
+
let simple = true;
|
|
1934
|
+
while (state.input.charCodeAt(state.position) !== 0) {
|
|
1935
|
+
const ch = state.input.charCodeAt(state.position);
|
|
1936
|
+
if (ch === 34) {
|
|
1937
|
+
const end = state.position;
|
|
1938
|
+
state.position++;
|
|
1939
|
+
addScalarEvent(state, start, end, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, SCALAR_STYLE.DOUBLE_QUOTED, CHOMPING_MODE.CLIP, -1, simple);
|
|
1940
|
+
return true;
|
|
234
1941
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
1942
|
+
if (ch === 92) {
|
|
1943
|
+
simple = false;
|
|
1944
|
+
const escaped = state.input.charCodeAt(++state.position);
|
|
1945
|
+
if (isEol(escaped)) readFlowScalarBreak(state, nodeIndent);
|
|
1946
|
+
else if (isSimpleEscape(escaped)) state.position++;
|
|
1947
|
+
else {
|
|
1948
|
+
let hexLength = escapedHexLen(escaped);
|
|
1949
|
+
if (hexLength === 0) throwError(state, "unknown escape sequence");
|
|
1950
|
+
while (hexLength-- > 0) {
|
|
1951
|
+
state.position++;
|
|
1952
|
+
if (fromHexCode(state.input.charCodeAt(state.position)) < 0) throwError(state, "expected hexadecimal character");
|
|
245
1953
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
1954
|
+
state.position++;
|
|
1955
|
+
}
|
|
1956
|
+
} else if (isEol(ch)) {
|
|
1957
|
+
simple = false;
|
|
1958
|
+
readFlowScalarBreak(state, nodeIndent);
|
|
1959
|
+
} else if (state.position === state.lineStart && testDocumentSeparator(state)) throwError(state, "unexpected end of the document within a double quoted scalar");
|
|
1960
|
+
else if (ch !== 9 && ch < 32) throwError(state, "expected valid JSON character");
|
|
1961
|
+
else state.position++;
|
|
1962
|
+
}
|
|
1963
|
+
throwError(state, "unexpected end of the stream within a double quoted scalar");
|
|
1964
|
+
}
|
|
1965
|
+
function readBlockScalar(state, parentIndent, props) {
|
|
1966
|
+
const ch = state.input.charCodeAt(state.position);
|
|
1967
|
+
let chomping = CHOMPING_MODE.CLIP;
|
|
1968
|
+
let indent = -1;
|
|
1969
|
+
let detectedIndent = false;
|
|
1970
|
+
if (ch !== 124 && ch !== 62) return false;
|
|
1971
|
+
const style = ch === 124 ? SCALAR_STYLE.LITERAL_BLOCK : SCALAR_STYLE.FOLDED_BLOCK;
|
|
1972
|
+
state.position++;
|
|
1973
|
+
while (state.input.charCodeAt(state.position) !== 0) {
|
|
1974
|
+
const current = state.input.charCodeAt(state.position);
|
|
1975
|
+
const digit = fromDecimalCode(current);
|
|
1976
|
+
if (current === 43 || current === 45) {
|
|
1977
|
+
if (chomping !== CHOMPING_MODE.CLIP) throwError(state, "repeat of a chomping mode identifier");
|
|
1978
|
+
chomping = current === 43 ? CHOMPING_MODE.KEEP : CHOMPING_MODE.STRIP;
|
|
1979
|
+
state.position++;
|
|
1980
|
+
} else if (digit >= 0) {
|
|
1981
|
+
if (digit === 0) throwError(state, "bad explicit indentation width of a block scalar; it cannot be less than one");
|
|
1982
|
+
if (detectedIndent) throwError(state, "repeat of an indentation width identifier");
|
|
1983
|
+
indent = parentIndent + digit - 1;
|
|
1984
|
+
detectedIndent = true;
|
|
1985
|
+
state.position++;
|
|
1986
|
+
} else break;
|
|
1987
|
+
}
|
|
1988
|
+
let hadWhitespace = false;
|
|
1989
|
+
while (isWhiteSpace(state.input.charCodeAt(state.position))) {
|
|
1990
|
+
hadWhitespace = true;
|
|
1991
|
+
state.position++;
|
|
1992
|
+
}
|
|
1993
|
+
if (hadWhitespace && state.input.charCodeAt(state.position) === 35) skipUntilLineEnd(state);
|
|
1994
|
+
if (isEol(state.input.charCodeAt(state.position))) consumeLineBreak(state);
|
|
1995
|
+
else if (state.input.charCodeAt(state.position) !== 0) throwError(state, "a line break is expected");
|
|
1996
|
+
let contentIndent = detectedIndent ? indent : -1;
|
|
1997
|
+
let maxLeadingIndent = 0;
|
|
1998
|
+
const valueStart = state.position;
|
|
1999
|
+
let valueEnd = state.position;
|
|
2000
|
+
while (state.input.charCodeAt(state.position) !== 0) {
|
|
2001
|
+
const linePosition = state.position;
|
|
2002
|
+
let column = 0;
|
|
2003
|
+
while (state.input.charCodeAt(linePosition + column) === 32) column++;
|
|
2004
|
+
const first = state.input.charCodeAt(linePosition + column);
|
|
2005
|
+
if (first === 0) {
|
|
2006
|
+
if (contentIndent >= 0) {
|
|
2007
|
+
if (column > contentIndent) valueEnd = linePosition + column;
|
|
2008
|
+
} else if (column > 0) valueEnd = linePosition + column;
|
|
2009
|
+
break;
|
|
252
2010
|
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
if (
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
name: 'tsconfig "module"',
|
|
265
|
-
status: 'warn',
|
|
266
|
-
message: `"module" is "${compilerOptions.module}" but package.json suggests CJS`,
|
|
267
|
-
fix: 'Align tsconfig.json "module" with package.json "type"',
|
|
268
|
-
};
|
|
2011
|
+
if (testDocumentBoundary(state)) break;
|
|
2012
|
+
if (!detectedIndent && contentIndent === -1 && isEol(first)) maxLeadingIndent = Math.max(maxLeadingIndent, column);
|
|
2013
|
+
if (!detectedIndent && contentIndent === -1 && !isEol(first)) {
|
|
2014
|
+
if (first === 9 && column < parentIndent) {
|
|
2015
|
+
state.position = linePosition + column;
|
|
2016
|
+
throwError(state, "tab characters must not be used in indentation");
|
|
2017
|
+
}
|
|
2018
|
+
if (column < maxLeadingIndent) {
|
|
2019
|
+
state.position = linePosition + column;
|
|
2020
|
+
throwError(state, "bad indentation of a mapping entry");
|
|
2021
|
+
}
|
|
269
2022
|
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
}
|
|
2023
|
+
if (contentIndent === -1 && first !== 0 && !isEol(first) && column < parentIndent) {
|
|
2024
|
+
state.lineIndent = column;
|
|
2025
|
+
state.position = linePosition + column;
|
|
2026
|
+
break;
|
|
2027
|
+
}
|
|
2028
|
+
if (!detectedIndent && first !== 0 && !isEol(first) && contentIndent === -1) contentIndent = column;
|
|
2029
|
+
const requiredIndent = contentIndent === -1 ? parentIndent + 1 : contentIndent;
|
|
2030
|
+
if (first !== 0 && !isEol(first) && column < requiredIndent) {
|
|
2031
|
+
state.lineIndent = column;
|
|
2032
|
+
state.position = linePosition + column;
|
|
2033
|
+
break;
|
|
2034
|
+
}
|
|
2035
|
+
skipUntilLineEnd(state);
|
|
2036
|
+
valueEnd = state.position;
|
|
2037
|
+
if (isEol(state.input.charCodeAt(state.position))) {
|
|
2038
|
+
consumeLineBreak(state);
|
|
2039
|
+
valueEnd = state.position;
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
2042
|
+
checkPrintable(state, valueStart, valueEnd);
|
|
2043
|
+
addScalarEvent(state, valueStart, valueEnd, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, style, chomping, contentIndent);
|
|
2044
|
+
return true;
|
|
275
2045
|
}
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
2046
|
+
function canStartPlainScalar(state, nodeContext) {
|
|
2047
|
+
const ch = state.input.charCodeAt(state.position);
|
|
2048
|
+
const inFlow = nodeContext === CONTEXT_FLOW_IN;
|
|
2049
|
+
if (ch === 0 || isWsOrEol(ch) || ch === 35 || ch === 38 || ch === 42 || ch === 33 || ch === 124 || ch === 62 || ch === 39 || ch === 34 || ch === 37 || ch === 64 || ch === 96 || inFlow && isFlowIndicator(ch)) return false;
|
|
2050
|
+
if (ch === 63 || ch === 45) {
|
|
2051
|
+
const following = state.input.charCodeAt(state.position + 1);
|
|
2052
|
+
if (isWsOrEolOrEnd(following) || inFlow && isFlowIndicator(following)) return false;
|
|
2053
|
+
}
|
|
2054
|
+
return true;
|
|
2055
|
+
}
|
|
2056
|
+
function readPlainScalar(state, nodeIndent, nodeContext, props) {
|
|
2057
|
+
if (!canStartPlainScalar(state, nodeContext)) return false;
|
|
2058
|
+
const start = state.position;
|
|
2059
|
+
let end = state.position;
|
|
2060
|
+
let ch = state.input.charCodeAt(state.position);
|
|
2061
|
+
const inFlow = nodeContext === CONTEXT_FLOW_IN;
|
|
2062
|
+
let multiline = false;
|
|
2063
|
+
while (ch !== 0) {
|
|
2064
|
+
if (testDocumentBoundary(state)) break;
|
|
2065
|
+
if (ch === 58) {
|
|
2066
|
+
const following = state.input.charCodeAt(state.position + 1);
|
|
2067
|
+
if (isWsOrEolOrEnd(following) || inFlow && isFlowIndicator(following)) break;
|
|
2068
|
+
} else if (ch === 35) {
|
|
2069
|
+
if (isWsOrEol(state.input.charCodeAt(state.position - 1))) break;
|
|
2070
|
+
} else if (inFlow && isFlowIndicator(ch)) break;
|
|
2071
|
+
else if (isEol(ch)) {
|
|
2072
|
+
const savedPosition = state.position;
|
|
2073
|
+
const savedLine = state.line;
|
|
2074
|
+
const savedLineStart = state.lineStart;
|
|
2075
|
+
const savedLineIndent = state.lineIndent;
|
|
2076
|
+
skipSeparationSpace(state, false);
|
|
2077
|
+
if (state.lineIndent >= nodeIndent) {
|
|
2078
|
+
multiline = true;
|
|
2079
|
+
ch = state.input.charCodeAt(state.position);
|
|
2080
|
+
continue;
|
|
2081
|
+
}
|
|
2082
|
+
state.position = savedPosition;
|
|
2083
|
+
state.line = savedLine;
|
|
2084
|
+
state.lineStart = savedLineStart;
|
|
2085
|
+
state.lineIndent = savedLineIndent;
|
|
2086
|
+
break;
|
|
285
2087
|
}
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
2088
|
+
if (!isWhiteSpace(ch)) end = state.position + 1;
|
|
2089
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2090
|
+
}
|
|
2091
|
+
if (end === start) return false;
|
|
2092
|
+
checkPrintable(state, start, end);
|
|
2093
|
+
addScalarEvent(state, start, end, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, SCALAR_STYLE.PLAIN, CHOMPING_MODE.CLIP, -1, !multiline);
|
|
2094
|
+
return true;
|
|
2095
|
+
}
|
|
2096
|
+
function skipFlowSeparationSpace(state, nodeIndent) {
|
|
2097
|
+
const startLine = state.line;
|
|
2098
|
+
skipSeparationSpace(state, true);
|
|
2099
|
+
if (state.line > startLine && state.lineIndent < nodeIndent || state.firstTabInLine !== -1 && state.lineIndent < nodeIndent) throwError(state, "deficient indentation");
|
|
2100
|
+
}
|
|
2101
|
+
function readFlowCollection(state, nodeIndent, props) {
|
|
2102
|
+
const ch = state.input.charCodeAt(state.position);
|
|
2103
|
+
const isMapping = ch === 123;
|
|
2104
|
+
const start = state.position;
|
|
2105
|
+
let readNext = true;
|
|
2106
|
+
if (ch !== 91 && ch !== 123) return false;
|
|
2107
|
+
const terminator = isMapping ? 125 : 93;
|
|
2108
|
+
if (isMapping) addMappingEvent(state, start, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, COLLECTION_STYLE.FLOW);
|
|
2109
|
+
else addSequenceEvent(state, start, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, COLLECTION_STYLE.FLOW);
|
|
2110
|
+
state.position++;
|
|
2111
|
+
while (state.input.charCodeAt(state.position) !== 0) {
|
|
2112
|
+
skipFlowSeparationSpace(state, nodeIndent);
|
|
2113
|
+
let ch2 = state.input.charCodeAt(state.position);
|
|
2114
|
+
if (ch2 === terminator) {
|
|
2115
|
+
state.position++;
|
|
2116
|
+
addPopEvent(state);
|
|
2117
|
+
return true;
|
|
2118
|
+
} else if (!readNext) throwError(state, "missed comma between flow collection entries");
|
|
2119
|
+
else if (ch2 === 44) throwError(state, "expected the node content, but found ','");
|
|
2120
|
+
let isPair = false;
|
|
2121
|
+
let isExplicitPair = false;
|
|
2122
|
+
if (ch2 === 63 && isWsOrEol(state.input.charCodeAt(state.position + 1))) {
|
|
2123
|
+
isPair = isExplicitPair = true;
|
|
2124
|
+
state.position += 1;
|
|
2125
|
+
skipFlowSeparationSpace(state, nodeIndent);
|
|
297
2126
|
}
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
2127
|
+
const entryLine = state.line;
|
|
2128
|
+
const entryStart = snapshotState(state);
|
|
2129
|
+
const keyWasRead = parseNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
|
|
2130
|
+
skipFlowSeparationSpace(state, nodeIndent);
|
|
2131
|
+
ch2 = state.input.charCodeAt(state.position);
|
|
2132
|
+
if ((isMapping || isExplicitPair || state.line === entryLine) && ch2 === 58) {
|
|
2133
|
+
isPair = true;
|
|
2134
|
+
state.position++;
|
|
2135
|
+
skipFlowSeparationSpace(state, nodeIndent);
|
|
2136
|
+
if (!isMapping) {
|
|
2137
|
+
insertFlowPairMappingEvent(state, entryStart);
|
|
2138
|
+
if (!keyWasRead) addEmptyScalarEvent(state);
|
|
2139
|
+
} else if (!keyWasRead) addEmptyScalarEvent(state);
|
|
2140
|
+
if (!parseNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true)) addEmptyScalarEvent(state);
|
|
2141
|
+
skipFlowSeparationSpace(state, nodeIndent);
|
|
2142
|
+
if (!isMapping) addPopEvent(state);
|
|
2143
|
+
} else if (isMapping && isPair) {
|
|
2144
|
+
if (!keyWasRead) addEmptyScalarEvent(state);
|
|
2145
|
+
addEmptyScalarEvent(state);
|
|
2146
|
+
} else if (isMapping) addEmptyScalarEvent(state);
|
|
2147
|
+
else if (isPair) {
|
|
2148
|
+
insertFlowPairMappingEvent(state, entryStart);
|
|
2149
|
+
if (!keyWasRead) addEmptyScalarEvent(state);
|
|
2150
|
+
addEmptyScalarEvent(state);
|
|
2151
|
+
addPopEvent(state);
|
|
306
2152
|
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
};
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
};
|
|
323
|
-
}
|
|
324
|
-
catch {
|
|
325
|
-
// exists but unreadable — still pass
|
|
326
|
-
return {
|
|
327
|
-
name: '@synergenius/flow-weaver installed',
|
|
328
|
-
status: 'pass',
|
|
329
|
-
message: '@synergenius/flow-weaver is installed',
|
|
330
|
-
};
|
|
331
|
-
}
|
|
2153
|
+
ch2 = state.input.charCodeAt(state.position);
|
|
2154
|
+
if (ch2 === 44) {
|
|
2155
|
+
readNext = true;
|
|
2156
|
+
state.position++;
|
|
2157
|
+
} else readNext = false;
|
|
2158
|
+
}
|
|
2159
|
+
throwError(state, "unexpected end of the stream within a flow collection");
|
|
2160
|
+
}
|
|
2161
|
+
function readBlockSequence(state, nodeIndent, props) {
|
|
2162
|
+
if (state.firstTabInLine !== -1 || state.input.charCodeAt(state.position) !== 45 || !isWsOrEolOrEnd(state.input.charCodeAt(state.position + 1))) return false;
|
|
2163
|
+
addSequenceEvent(state, state.position, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, COLLECTION_STYLE.BLOCK);
|
|
2164
|
+
while (state.input.charCodeAt(state.position) === 45 && isWsOrEolOrEnd(state.input.charCodeAt(state.position + 1))) {
|
|
2165
|
+
if (state.firstTabInLine !== -1) {
|
|
2166
|
+
state.position = state.firstTabInLine;
|
|
2167
|
+
throwError(state, "tab characters must not be used in indentation");
|
|
332
2168
|
}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
2169
|
+
const entryLine = state.line;
|
|
2170
|
+
state.position++;
|
|
2171
|
+
const hadBreak = skipSeparationSpace(state, true) > 0;
|
|
2172
|
+
if (state.firstTabInLine !== -1 && state.input.charCodeAt(state.position) === 45 && isWsOrEolOrEnd(state.input.charCodeAt(state.position + 1))) throwError(state, "bad indentation of a sequence entry");
|
|
2173
|
+
if (hadBreak && state.lineIndent <= nodeIndent) addEmptyScalarEvent(state);
|
|
2174
|
+
else parseNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
|
|
2175
|
+
skipSeparationSpace(state, true);
|
|
2176
|
+
if (state.lineIndent < nodeIndent || state.position >= state.length) break;
|
|
2177
|
+
if (state.lineIndent > nodeIndent) throwError(state, "bad indentation of a sequence entry");
|
|
2178
|
+
if (state.line === entryLine && state.input.charCodeAt(state.position) === 45 && isWsOrEolOrEnd(state.input.charCodeAt(state.position + 1))) throwError(state, "bad indentation of a sequence entry");
|
|
2179
|
+
}
|
|
2180
|
+
addPopEvent(state);
|
|
2181
|
+
return true;
|
|
339
2182
|
}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
2183
|
+
function readBlockMapping(state, nodeIndent, flowIndent, props) {
|
|
2184
|
+
let atExplicitKey = false;
|
|
2185
|
+
let detected = false;
|
|
2186
|
+
let mappingOpened = false;
|
|
2187
|
+
let pendingExplicitKey = false;
|
|
2188
|
+
if (state.firstTabInLine !== -1) return false;
|
|
2189
|
+
let ch = state.input.charCodeAt(state.position);
|
|
2190
|
+
while (ch !== 0) {
|
|
2191
|
+
if (!atExplicitKey && state.firstTabInLine !== -1) {
|
|
2192
|
+
state.position = state.firstTabInLine;
|
|
2193
|
+
throwError(state, "tab characters must not be used in indentation");
|
|
350
2194
|
}
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
2195
|
+
const following = state.input.charCodeAt(state.position + 1);
|
|
2196
|
+
const entryLine = state.line;
|
|
2197
|
+
if ((ch === 63 || ch === 58) && isWsOrEolOrEnd(following)) {
|
|
2198
|
+
if (!mappingOpened) {
|
|
2199
|
+
addMappingEvent(state, state.position, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, COLLECTION_STYLE.BLOCK);
|
|
2200
|
+
mappingOpened = true;
|
|
2201
|
+
}
|
|
2202
|
+
if (ch === 63) {
|
|
2203
|
+
if (atExplicitKey) addEmptyScalarEvent(state);
|
|
2204
|
+
detected = true;
|
|
2205
|
+
atExplicitKey = true;
|
|
2206
|
+
} else if (atExplicitKey) atExplicitKey = false;
|
|
2207
|
+
else {
|
|
2208
|
+
addEmptyScalarEvent(state);
|
|
2209
|
+
detected = true;
|
|
2210
|
+
atExplicitKey = false;
|
|
2211
|
+
}
|
|
2212
|
+
state.position += 1;
|
|
2213
|
+
pendingExplicitKey = true;
|
|
2214
|
+
} else {
|
|
2215
|
+
if (atExplicitKey) {
|
|
2216
|
+
addEmptyScalarEvent(state);
|
|
2217
|
+
atExplicitKey = false;
|
|
2218
|
+
}
|
|
2219
|
+
const beforeKey = snapshotState(state);
|
|
2220
|
+
if (!parseNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) break;
|
|
2221
|
+
if (state.line === entryLine) {
|
|
2222
|
+
ch = state.input.charCodeAt(state.position);
|
|
2223
|
+
while (isWhiteSpace(ch)) ch = state.input.charCodeAt(++state.position);
|
|
2224
|
+
if (ch === 58) {
|
|
2225
|
+
ch = state.input.charCodeAt(++state.position);
|
|
2226
|
+
if (!isWsOrEolOrEnd(ch)) throwError(state, "a whitespace character is expected after the key-value separator within a block mapping");
|
|
2227
|
+
if (!mappingOpened) {
|
|
2228
|
+
restoreState(state, beforeKey);
|
|
2229
|
+
addMappingEvent(state, beforeKey.position, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, COLLECTION_STYLE.BLOCK);
|
|
2230
|
+
mappingOpened = true;
|
|
2231
|
+
parseNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true);
|
|
2232
|
+
ch = state.input.charCodeAt(state.position);
|
|
2233
|
+
while (isWhiteSpace(ch)) ch = state.input.charCodeAt(++state.position);
|
|
2234
|
+
state.position++;
|
|
2235
|
+
}
|
|
2236
|
+
detected = true;
|
|
2237
|
+
atExplicitKey = false;
|
|
2238
|
+
pendingExplicitKey = false;
|
|
2239
|
+
} else if (detected) throwError(state, "expected ':' after a mapping key");
|
|
2240
|
+
else {
|
|
2241
|
+
if (props.anchorStart !== NO_RANGE$1 || props.tagStart !== NO_RANGE$1) {
|
|
2242
|
+
restoreState(state, beforeKey);
|
|
2243
|
+
return false;
|
|
2244
|
+
}
|
|
2245
|
+
return true;
|
|
368
2246
|
}
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
};
|
|
2247
|
+
} else if (detected) throwError(state, "can not read a block mapping entry; a multiline key may not be an implicit key");
|
|
2248
|
+
else {
|
|
2249
|
+
if (props.anchorStart !== NO_RANGE$1 || props.tagStart !== NO_RANGE$1) {
|
|
2250
|
+
restoreState(state, beforeKey);
|
|
2251
|
+
return false;
|
|
375
2252
|
}
|
|
2253
|
+
return true;
|
|
2254
|
+
}
|
|
376
2255
|
}
|
|
377
|
-
|
|
378
|
-
|
|
2256
|
+
if (parseNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, pendingExplicitKey)) pendingExplicitKey = false;
|
|
2257
|
+
if (!atExplicitKey) {
|
|
2258
|
+
if (pendingExplicitKey) {
|
|
2259
|
+
addEmptyScalarEvent(state);
|
|
2260
|
+
pendingExplicitKey = false;
|
|
2261
|
+
}
|
|
379
2262
|
}
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
2263
|
+
skipSeparationSpace(state, true);
|
|
2264
|
+
ch = state.input.charCodeAt(state.position);
|
|
2265
|
+
if ((state.line === entryLine || state.lineIndent > nodeIndent) && ch !== 0) throwError(state, "bad indentation of a mapping entry");
|
|
2266
|
+
else if (state.lineIndent < nodeIndent) break;
|
|
2267
|
+
}
|
|
2268
|
+
if (!detected) return false;
|
|
2269
|
+
if (atExplicitKey) addEmptyScalarEvent(state);
|
|
2270
|
+
if (mappingOpened) addPopEvent(state);
|
|
2271
|
+
return true;
|
|
2272
|
+
}
|
|
2273
|
+
function parseNode(state, parentIndent, nodeContext, allowToSeek, allowCompact, allowPropertyMapping = true) {
|
|
2274
|
+
if (state.depth >= state.maxDepth) throwError(state, `nesting exceeded maxDepth (${state.maxDepth})`);
|
|
2275
|
+
state.depth++;
|
|
2276
|
+
let indentStatus = 1;
|
|
2277
|
+
let atNewLine = false;
|
|
2278
|
+
let hasContent = false;
|
|
2279
|
+
let propertyStart = null;
|
|
2280
|
+
const props = emptyProperties();
|
|
2281
|
+
let allowBlockScalars = nodeContext === CONTEXT_BLOCK_OUT || nodeContext === CONTEXT_BLOCK_IN;
|
|
2282
|
+
let allowBlockCollections = allowBlockScalars;
|
|
2283
|
+
const allowBlockStyles = allowBlockScalars;
|
|
2284
|
+
if (allowToSeek && skipSeparationSpace(state, true)) {
|
|
2285
|
+
atNewLine = true;
|
|
2286
|
+
if (state.lineIndent > parentIndent) indentStatus = 1;
|
|
2287
|
+
else if (state.lineIndent === parentIndent) indentStatus = 0;
|
|
2288
|
+
else indentStatus = -1;
|
|
2289
|
+
}
|
|
2290
|
+
if (indentStatus === 1) while (true) {
|
|
2291
|
+
const ch = state.input.charCodeAt(state.position);
|
|
2292
|
+
const propertyState = snapshotState(state);
|
|
2293
|
+
if (atNewLine && indentStatus !== 1 && (ch === 33 || ch === 38)) break;
|
|
2294
|
+
if (atNewLine && allowBlockStyles && (props.tagStart !== NO_RANGE$1 || props.anchorStart !== NO_RANGE$1) && (ch === 33 || ch === 38)) {
|
|
2295
|
+
const fallbackState = snapshotState(state);
|
|
2296
|
+
const flowIndent = parentIndent + 1;
|
|
2297
|
+
if (readBlockMapping(state, state.position - state.lineStart, flowIndent, props) && state.events[fallbackState.eventsLength]?.type === EVENT_ID.MAPPING) {
|
|
2298
|
+
state.depth--;
|
|
2299
|
+
return true;
|
|
2300
|
+
}
|
|
2301
|
+
restoreState(state, fallbackState);
|
|
403
2302
|
}
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
2303
|
+
if (atNewLine && (ch === 33 && props.tagStart !== NO_RANGE$1 || ch === 38 && props.anchorStart !== NO_RANGE$1)) break;
|
|
2304
|
+
if (!readTagProperty(state, props, nodeContext === CONTEXT_FLOW_IN) && !readAnchorProperty(state, props)) break;
|
|
2305
|
+
if (propertyStart === null) propertyStart = propertyState;
|
|
2306
|
+
if (skipSeparationSpace(state, true)) {
|
|
2307
|
+
atNewLine = true;
|
|
2308
|
+
allowBlockCollections = allowBlockStyles;
|
|
2309
|
+
if (state.lineIndent > parentIndent) indentStatus = 1;
|
|
2310
|
+
else if (state.lineIndent === parentIndent) indentStatus = 0;
|
|
2311
|
+
else indentStatus = -1;
|
|
2312
|
+
} else allowBlockCollections = false;
|
|
2313
|
+
}
|
|
2314
|
+
if (allowBlockCollections) allowBlockCollections = atNewLine || allowCompact;
|
|
2315
|
+
if (indentStatus === 1 || nodeContext === CONTEXT_BLOCK_OUT) {
|
|
2316
|
+
const flowIndent = nodeContext === CONTEXT_FLOW_IN || nodeContext === CONTEXT_FLOW_OUT ? parentIndent : parentIndent + 1;
|
|
2317
|
+
const blockIndent = state.position - state.lineStart;
|
|
2318
|
+
if (indentStatus === 1) if (allowBlockCollections && (readBlockSequence(state, blockIndent, props) || readBlockMapping(state, blockIndent, flowIndent, props)) || readFlowCollection(state, flowIndent, props)) hasContent = true;
|
|
2319
|
+
else {
|
|
2320
|
+
const ch = state.input.charCodeAt(state.position);
|
|
2321
|
+
if (propertyStart !== null && allowPropertyMapping && allowBlockStyles && !allowBlockCollections && ch !== 124 && ch !== 62) {
|
|
2322
|
+
const fallbackState = snapshotState(state);
|
|
2323
|
+
const propertyIndent = propertyStart.position - propertyStart.lineStart;
|
|
2324
|
+
restoreState(state, propertyStart);
|
|
2325
|
+
if (readBlockMapping(state, propertyIndent, flowIndent, emptyProperties()) && state.events[fallbackState.eventsLength]?.type === EVENT_ID.MAPPING) hasContent = true;
|
|
2326
|
+
else restoreState(state, fallbackState);
|
|
2327
|
+
}
|
|
2328
|
+
if (!hasContent && (allowBlockScalars && readBlockScalar(state, flowIndent, props) || readSingleQuotedScalar(state, flowIndent, props) || readDoubleQuotedScalar(state, flowIndent, props) || readAlias(state, props) || readPlainScalar(state, flowIndent, nodeContext, props))) hasContent = true;
|
|
410
2329
|
}
|
|
2330
|
+
else if (indentStatus === 0) hasContent = allowBlockCollections && readBlockSequence(state, blockIndent, props);
|
|
2331
|
+
}
|
|
2332
|
+
allowBlockScalars = allowBlockScalars && !hasContent;
|
|
2333
|
+
if (!hasContent && (props.anchorStart !== NO_RANGE$1 || props.tagStart !== NO_RANGE$1 || allowBlockScalars)) {
|
|
2334
|
+
addScalarEvent(state, NO_RANGE$1, NO_RANGE$1, props.anchorStart, props.anchorEnd, props.tagStart, props.tagEnd, SCALAR_STYLE.PLAIN);
|
|
2335
|
+
hasContent = true;
|
|
2336
|
+
}
|
|
2337
|
+
state.depth--;
|
|
2338
|
+
return hasContent || props.anchorStart !== NO_RANGE$1 || props.tagStart !== NO_RANGE$1;
|
|
411
2339
|
}
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
2340
|
+
function readDirective(state) {
|
|
2341
|
+
if (state.lineIndent > 0 || state.input.charCodeAt(state.position) !== 37) return false;
|
|
2342
|
+
state.position++;
|
|
2343
|
+
const nameStart = state.position;
|
|
2344
|
+
while (state.input.charCodeAt(state.position) !== 0 && !isWsOrEol(state.input.charCodeAt(state.position))) state.position++;
|
|
2345
|
+
const name = state.input.slice(nameStart, state.position);
|
|
2346
|
+
const args = [];
|
|
2347
|
+
if (name.length === 0) throwError(state, "directive name must not be less than one character in length");
|
|
2348
|
+
while (state.input.charCodeAt(state.position) !== 0 && !isEol(state.input.charCodeAt(state.position))) {
|
|
2349
|
+
while (isWhiteSpace(state.input.charCodeAt(state.position))) state.position++;
|
|
2350
|
+
if (state.input.charCodeAt(state.position) === 35 || isEol(state.input.charCodeAt(state.position)) || state.input.charCodeAt(state.position) === 0) break;
|
|
2351
|
+
const start = state.position;
|
|
2352
|
+
while (state.input.charCodeAt(state.position) !== 0 && !isWsOrEol(state.input.charCodeAt(state.position))) state.position++;
|
|
2353
|
+
args.push(state.input.slice(start, state.position));
|
|
2354
|
+
}
|
|
2355
|
+
if (isEol(state.input.charCodeAt(state.position))) consumeLineBreak(state);
|
|
2356
|
+
if (name === "YAML") {
|
|
2357
|
+
if (state.directives.some((directive) => directive.kind === "yaml")) throwError(state, "duplication of %YAML directive");
|
|
2358
|
+
if (args.length !== 1) throwError(state, "YAML directive accepts exactly one argument");
|
|
2359
|
+
const match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
|
|
2360
|
+
if (match === null) throwError(state, "ill-formed argument of the YAML directive");
|
|
2361
|
+
if (parseInt(match[1], 10) !== 1) throwError(state, "unacceptable YAML version of the document");
|
|
2362
|
+
state.directives.push({
|
|
2363
|
+
kind: "yaml",
|
|
2364
|
+
version: args[0]
|
|
2365
|
+
});
|
|
2366
|
+
} else if (name === "TAG") {
|
|
2367
|
+
if (args.length !== 2) throwError(state, "TAG directive accepts exactly two arguments");
|
|
2368
|
+
const [handle, prefix] = args;
|
|
2369
|
+
if (!PATTERN_TAG_HANDLE.test(handle)) throwError(state, "ill-formed tag handle (first argument) of the TAG directive");
|
|
2370
|
+
if (HAS_OWN.call(state.tagHandlers, handle)) throwError(state, `there is a previously declared suffix for "${handle}" tag handle`);
|
|
2371
|
+
if (!PATTERN_TAG_PREFIX.test(prefix)) throwError(state, "ill-formed tag prefix (second argument) of the TAG directive");
|
|
2372
|
+
state.tagHandlers[handle] = prefix;
|
|
2373
|
+
state.directives.push({
|
|
2374
|
+
kind: "tag",
|
|
2375
|
+
handle,
|
|
2376
|
+
prefix
|
|
2377
|
+
});
|
|
2378
|
+
}
|
|
2379
|
+
return true;
|
|
2380
|
+
}
|
|
2381
|
+
function readDocument(state) {
|
|
2382
|
+
state.directives = [];
|
|
2383
|
+
state.tagHandlers = /* @__PURE__ */ Object.create(null);
|
|
2384
|
+
let hasDirectives = false;
|
|
2385
|
+
skipSeparationSpace(state, true);
|
|
2386
|
+
while (readDirective(state)) {
|
|
2387
|
+
hasDirectives = true;
|
|
2388
|
+
skipSeparationSpace(state, true);
|
|
2389
|
+
}
|
|
2390
|
+
let explicitStart = false;
|
|
2391
|
+
let explicitEnd = false;
|
|
2392
|
+
let allowCompact = true;
|
|
2393
|
+
if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 45 && state.input.charCodeAt(state.position + 1) === 45 && state.input.charCodeAt(state.position + 2) === 45 && isWsOrEolOrEnd(state.input.charCodeAt(state.position + 3))) {
|
|
2394
|
+
explicitStart = true;
|
|
2395
|
+
const markerLine = state.line;
|
|
2396
|
+
state.position += 3;
|
|
2397
|
+
skipSeparationSpace(state, true);
|
|
2398
|
+
allowCompact = state.line > markerLine;
|
|
2399
|
+
} else if (hasDirectives) throwError(state, "directives end mark is expected");
|
|
2400
|
+
const documentEventIndex = state.events.length;
|
|
2401
|
+
if (!explicitStart && state.position === state.lineStart && state.input.charCodeAt(state.position) === 46 && testDocumentSeparator(state)) {
|
|
2402
|
+
state.position += 3;
|
|
2403
|
+
skipSeparationSpace(state, true);
|
|
2404
|
+
return;
|
|
2405
|
+
}
|
|
2406
|
+
addDocumentEvent(state, explicitStart, false);
|
|
2407
|
+
if (!parseNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, allowCompact, allowCompact)) addEmptyScalarEvent(state);
|
|
2408
|
+
skipSeparationSpace(state, true);
|
|
2409
|
+
if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
2410
|
+
explicitEnd = state.input.charCodeAt(state.position) === 46;
|
|
2411
|
+
if (explicitEnd) {
|
|
2412
|
+
const markerLine = state.line;
|
|
2413
|
+
state.position += 3;
|
|
2414
|
+
skipSeparationSpace(state, true);
|
|
2415
|
+
if (state.line === markerLine && state.position < state.length) throwError(state, "end of the stream or a document separator is expected");
|
|
420
2416
|
}
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
};
|
|
2417
|
+
}
|
|
2418
|
+
const documentEvent = state.events[documentEventIndex];
|
|
2419
|
+
if (documentEvent?.type === EVENT_ID.DOCUMENT) documentEvent.explicitEnd = explicitEnd;
|
|
2420
|
+
addPopEvent(state);
|
|
2421
|
+
if (!explicitEnd && state.position < state.length && !testDocumentBoundary(state)) throwError(state, "end of the stream or a document separator is expected");
|
|
427
2422
|
}
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
2423
|
+
function parseEvents(input, options) {
|
|
2424
|
+
const length = input.length;
|
|
2425
|
+
const state = {
|
|
2426
|
+
...DEFAULT_PARSER_OPTIONS,
|
|
2427
|
+
...options,
|
|
2428
|
+
input: `${input}\0`,
|
|
2429
|
+
length,
|
|
2430
|
+
position: 0,
|
|
2431
|
+
line: 0,
|
|
2432
|
+
lineStart: 0,
|
|
2433
|
+
lineIndent: 0,
|
|
2434
|
+
firstTabInLine: -1,
|
|
2435
|
+
depth: 0,
|
|
2436
|
+
directives: [],
|
|
2437
|
+
tagHandlers: /* @__PURE__ */ Object.create(null),
|
|
2438
|
+
events: []
|
|
2439
|
+
};
|
|
2440
|
+
const nullpos = input.indexOf("\0");
|
|
2441
|
+
if (nullpos !== -1) YAMLException.throwAt(input, nullpos, "null byte is not allowed in input", state.filename);
|
|
2442
|
+
while (state.position < state.length) {
|
|
2443
|
+
skipByteOrderMark(state);
|
|
2444
|
+
skipSeparationSpace(state, true);
|
|
2445
|
+
if (state.position >= state.length) break;
|
|
2446
|
+
const documentStart = state.position;
|
|
2447
|
+
readDocument(state);
|
|
2448
|
+
if (state.position === documentStart)
|
|
2449
|
+
throwError(state, "can not read a document");
|
|
2450
|
+
}
|
|
2451
|
+
return state.events;
|
|
2452
|
+
}
|
|
2453
|
+
var DEFAULT_LOAD_OPTIONS = {
|
|
2454
|
+
...DEFAULT_PARSER_OPTIONS,
|
|
2455
|
+
...DEFAULT_CONSTRUCTOR_OPTIONS
|
|
2456
|
+
};
|
|
2457
|
+
function loadDocuments(input, options = {}) {
|
|
2458
|
+
const opts = {
|
|
2459
|
+
...DEFAULT_LOAD_OPTIONS,
|
|
2460
|
+
...options
|
|
2461
|
+
};
|
|
2462
|
+
const source = String(input);
|
|
2463
|
+
const PARSER_OPT_KEYS = Object.keys(DEFAULT_PARSER_OPTIONS);
|
|
2464
|
+
const CONSTRUCTOR_OPT_KEYS = Object.keys(DEFAULT_CONSTRUCTOR_OPTIONS);
|
|
2465
|
+
return constructFromEvents(parseEvents(source, pick(opts, PARSER_OPT_KEYS)), {
|
|
2466
|
+
...pick(opts, CONSTRUCTOR_OPT_KEYS),
|
|
2467
|
+
source
|
|
2468
|
+
});
|
|
2469
|
+
}
|
|
2470
|
+
function load(input, options) {
|
|
2471
|
+
const documents = loadDocuments(input, options);
|
|
2472
|
+
if (documents.length === 0) throw new YAMLException("expected a document, but the input is empty");
|
|
2473
|
+
if (documents.length === 1) return documents[0];
|
|
2474
|
+
throw new YAMLException("expected a single document in the stream, but found more");
|
|
2475
|
+
}
|
|
2476
|
+
function hasBit(mask, bit) {
|
|
2477
|
+
return (mask & 1 << bit) !== 0;
|
|
2478
|
+
}
|
|
2479
|
+
var DEFAULT_SCALAR_STYLE_RULES = {
|
|
2480
|
+
applyQuoteFlowKeysOption,
|
|
2481
|
+
doubleQuoteForInvisibles,
|
|
2482
|
+
doubleQuoteWhitespaceOnly,
|
|
2483
|
+
applyForceQuotesOption,
|
|
2484
|
+
tryLongOrMultilineAsBlock,
|
|
2485
|
+
quoteInvalidPlain,
|
|
2486
|
+
fallbackToDoubleQuoted
|
|
2487
|
+
};
|
|
2488
|
+
function _preferredQuotedStyle(layout) {
|
|
2489
|
+
if (layout.presenterOptions.quoteStyle === "single" && hasBit(layout.allowedStylesMask, SCALAR_STYLE.SINGLE_QUOTED)) return SCALAR_STYLE.SINGLE_QUOTED;
|
|
2490
|
+
return SCALAR_STYLE.DOUBLE_QUOTED;
|
|
2491
|
+
}
|
|
2492
|
+
function applyQuoteFlowKeysOption(layout) {
|
|
2493
|
+
if (!layout.presenterOptions.quoteFlowKeys) return;
|
|
2494
|
+
if (!layout.isKey || !layout.flowOnly || layout.style !== SCALAR_STYLE.PLAIN) return;
|
|
2495
|
+
layout.style = SCALAR_STYLE.DOUBLE_QUOTED;
|
|
2496
|
+
}
|
|
2497
|
+
function doubleQuoteForInvisibles(layout) {
|
|
2498
|
+
if (layout.style === SCALAR_STYLE.PLAIN && /[\t\x7F-\xA0\u2028\u2029\uFEFF\uFFFE\uFFFF]/.test(layout.node.value)) layout.style = SCALAR_STYLE.DOUBLE_QUOTED;
|
|
2499
|
+
}
|
|
2500
|
+
function doubleQuoteWhitespaceOnly(layout) {
|
|
2501
|
+
if (layout.style === SCALAR_STYLE.PLAIN && /^\s+$/.test(layout.node.value)) layout.style = SCALAR_STYLE.DOUBLE_QUOTED;
|
|
2502
|
+
}
|
|
2503
|
+
function applyForceQuotesOption(layout) {
|
|
2504
|
+
if (!layout.presenterOptions.forceQuotes) return;
|
|
2505
|
+
if (layout.isKey || layout.style !== SCALAR_STYLE.PLAIN) return;
|
|
2506
|
+
if (layout.node.tag !== layout.presenterOptions.schema.defaultScalarTag.tagName) return;
|
|
2507
|
+
layout.style = layout.node.value.includes("\n") ? SCALAR_STYLE.DOUBLE_QUOTED : _preferredQuotedStyle(layout);
|
|
2508
|
+
}
|
|
2509
|
+
function tryLongOrMultilineAsBlock(layout) {
|
|
2510
|
+
if (layout.style !== SCALAR_STYLE.PLAIN || layout.isKey) return;
|
|
2511
|
+
const value = layout.node.value;
|
|
2512
|
+
const multiline = value.indexOf("\n") !== -1;
|
|
2513
|
+
if (!hasBit(layout.allowedStylesMask, SCALAR_STYLE.LITERAL_BLOCK)) {
|
|
2514
|
+
if (multiline) layout.style = SCALAR_STYLE.DOUBLE_QUOTED;
|
|
2515
|
+
return;
|
|
2516
|
+
}
|
|
2517
|
+
const w = layout.presenterOptions.lineWidth;
|
|
2518
|
+
if (w === -1) {
|
|
2519
|
+
if (multiline) layout.style = SCALAR_STYLE.LITERAL_BLOCK;
|
|
2520
|
+
return;
|
|
2521
|
+
}
|
|
2522
|
+
const availableWidth = Math.max(Math.min(w, 40), w - layout.shiftOfContent);
|
|
2523
|
+
let position = 0;
|
|
2524
|
+
let shouldFold = false;
|
|
2525
|
+
while (position <= value.length) {
|
|
2526
|
+
let lineEnd = value.length;
|
|
2527
|
+
const nextLineBreak = value.indexOf("\n", position);
|
|
2528
|
+
if (nextLineBreak !== -1) lineEnd = nextLineBreak;
|
|
2529
|
+
const line = value.slice(position, lineEnd);
|
|
2530
|
+
if (line.length > availableWidth && line[0] !== " " && / [^ \t]/.test(line)) shouldFold = true;
|
|
2531
|
+
if (nextLineBreak === -1) break;
|
|
2532
|
+
position = nextLineBreak + 1;
|
|
2533
|
+
}
|
|
2534
|
+
if (shouldFold) layout.style = SCALAR_STYLE.FOLDED_BLOCK;
|
|
2535
|
+
else if (multiline) layout.style = SCALAR_STYLE.LITERAL_BLOCK;
|
|
2536
|
+
}
|
|
2537
|
+
function quoteInvalidPlain(layout) {
|
|
2538
|
+
if (layout.style === SCALAR_STYLE.PLAIN && !hasBit(layout.allowedStylesMask, SCALAR_STYLE.PLAIN)) layout.style = _preferredQuotedStyle(layout);
|
|
2539
|
+
}
|
|
2540
|
+
function fallbackToDoubleQuoted(layout) {
|
|
2541
|
+
if (!hasBit(layout.allowedStylesMask, layout.style)) layout.style = SCALAR_STYLE.DOUBLE_QUOTED;
|
|
2542
|
+
}
|
|
2543
|
+
var SRC_C_PRINTABLE = "[\\x09\\x0A\\x0D\\x20-\\x7E\\x85\\xA0-\\uD7FF\\uE000-\\uFFFD\\u{10000}-\\u{10FFFF}]";
|
|
2544
|
+
var SRC_B_CHAR = "[\\n\\r]";
|
|
2545
|
+
var SRC_C_BYTE_ORDER_MARK = "\\uFEFF";
|
|
2546
|
+
var SRC_S_WHITE = "[ \\t]";
|
|
2547
|
+
var SRC_NB_CHAR = `(?:(?!(?:${SRC_B_CHAR}|${SRC_C_BYTE_ORDER_MARK}))${SRC_C_PRINTABLE})`;
|
|
2548
|
+
var SRC_NS_CHAR = `(?:(?!${SRC_S_WHITE})${SRC_NB_CHAR})`;
|
|
2549
|
+
var SRC_NB_JSON = "[\\x09\\x20-\\uD7FF\\uE000-\\uFFFF\\u{10000}-\\u{10FFFF}]";
|
|
2550
|
+
var SRC_C_INDICATOR = "[-?:,\\[\\]{}#&*!|>'\"%@`]";
|
|
2551
|
+
var SRC_C_FLOW_INDICATOR = "[,\\[\\]{}]";
|
|
2552
|
+
var SRC_NS_PLAIN_SAFE_FLOW_OUT = SRC_NS_CHAR;
|
|
2553
|
+
var SRC_NS_PLAIN_SAFE_FLOW_IN = `(?:(?!${SRC_C_FLOW_INDICATOR})${SRC_NS_CHAR})`;
|
|
2554
|
+
var SRC_NS_PLAIN_FIRST_FLOW_OUT = `(?:(?:(?!${SRC_C_INDICATOR})${SRC_NS_CHAR})|[?:-](?=${SRC_NS_PLAIN_SAFE_FLOW_OUT}))`;
|
|
2555
|
+
var SRC_NS_PLAIN_FIRST_FLOW_IN = `(?:(?:(?!${SRC_C_INDICATOR})${SRC_NS_CHAR})|[?:-](?=${SRC_NS_PLAIN_SAFE_FLOW_IN}))`;
|
|
2556
|
+
var SRC_NS_PLAIN_CHAR_FLOW_OUT = `(?:(?:(?![:#])${SRC_NS_PLAIN_SAFE_FLOW_OUT})|:(?=${SRC_NS_PLAIN_SAFE_FLOW_OUT}))#*`;
|
|
2557
|
+
var SRC_NS_PLAIN_CHAR_FLOW_IN = `(?:(?:(?![:#])${SRC_NS_PLAIN_SAFE_FLOW_IN})|:(?=${SRC_NS_PLAIN_SAFE_FLOW_IN}))#*`;
|
|
2558
|
+
var SRC_NB_NS_PLAIN_IN_LINE_FLOW_OUT = `(?:${SRC_S_WHITE}*${SRC_NS_PLAIN_CHAR_FLOW_OUT})*`;
|
|
2559
|
+
var SRC_NB_NS_PLAIN_IN_LINE_FLOW_IN = `(?:${SRC_S_WHITE}*${SRC_NS_PLAIN_CHAR_FLOW_IN})*`;
|
|
2560
|
+
var SRC_NS_PLAIN_ONE_LINE_FLOW_OUT = `${SRC_NS_PLAIN_FIRST_FLOW_OUT}#*${SRC_NB_NS_PLAIN_IN_LINE_FLOW_OUT}`;
|
|
2561
|
+
var SRC_NS_PLAIN_ONE_LINE_FLOW_IN = `${SRC_NS_PLAIN_FIRST_FLOW_IN}#*${SRC_NB_NS_PLAIN_IN_LINE_FLOW_IN}`;
|
|
2562
|
+
var SRC_NS_PLAIN_ONE_LINE_BLOCK_KEY = SRC_NS_PLAIN_ONE_LINE_FLOW_OUT;
|
|
2563
|
+
var SRC_NS_PLAIN_ONE_LINE_FLOW_KEY = SRC_NS_PLAIN_ONE_LINE_FLOW_IN;
|
|
2564
|
+
var SRC_S_NS_PLAIN_NEXT_LINE_FLOW_OUT = `\\n+${SRC_NS_PLAIN_CHAR_FLOW_OUT}${SRC_NB_NS_PLAIN_IN_LINE_FLOW_OUT}`;
|
|
2565
|
+
var SRC_S_NS_PLAIN_NEXT_LINE_FLOW_IN = `\\n+${SRC_NS_PLAIN_CHAR_FLOW_IN}${SRC_NB_NS_PLAIN_IN_LINE_FLOW_IN}`;
|
|
2566
|
+
var SRC_NS_PLAIN_MULTI_LINE_FLOW_OUT = `${SRC_NS_PLAIN_ONE_LINE_FLOW_OUT}(?:${SRC_S_NS_PLAIN_NEXT_LINE_FLOW_OUT})*`;
|
|
2567
|
+
var SRC_NS_PLAIN_MULTI_LINE_FLOW_IN = `${SRC_NS_PLAIN_ONE_LINE_FLOW_IN}(?:${SRC_S_NS_PLAIN_NEXT_LINE_FLOW_IN})*`;
|
|
2568
|
+
var NS_PLAIN_FLOW_OUT = new RegExp(`^(?:${SRC_NS_PLAIN_MULTI_LINE_FLOW_OUT})$`, "u");
|
|
2569
|
+
var NS_PLAIN_FLOW_IN = new RegExp(`^(?:${SRC_NS_PLAIN_MULTI_LINE_FLOW_IN})$`, "u");
|
|
2570
|
+
var NS_PLAIN_BLOCK_KEY = new RegExp(`^(?:${SRC_NS_PLAIN_ONE_LINE_BLOCK_KEY})$`, "u");
|
|
2571
|
+
var NS_PLAIN_FLOW_KEY = new RegExp(`^(?:${SRC_NS_PLAIN_ONE_LINE_FLOW_KEY})$`, "u");
|
|
2572
|
+
var NB_SINGLE_ONE_LINE = new RegExp(`^(?:${SRC_NB_JSON})*$`, "u");
|
|
2573
|
+
var NB_SINGLE_MULTI_LINE = new RegExp(`^(?:${SRC_NB_JSON}|\\n)*$`, "u");
|
|
2574
|
+
var BLOCK_SCALAR_CONTENT = new RegExp(`^(?:${SRC_NB_CHAR}|\\n)*$`, "u");
|
|
2575
|
+
var DEFAULT_PRESENTER_OPTIONS = {
|
|
2576
|
+
indent: 2,
|
|
2577
|
+
seqNoIndent: false,
|
|
2578
|
+
seqInlineFirst: true,
|
|
2579
|
+
lineWidth: 80,
|
|
2580
|
+
flowBracketPadding: false,
|
|
2581
|
+
flowSkipCommaSpace: false,
|
|
2582
|
+
flowSkipColonSpace: false,
|
|
2583
|
+
quoteFlowKeys: false,
|
|
2584
|
+
quoteStyle: "single",
|
|
2585
|
+
forceQuotes: false,
|
|
2586
|
+
scalarStyleRules: Object.keys(DEFAULT_SCALAR_STYLE_RULES).map((name) => Reflect.get(DEFAULT_SCALAR_STYLE_RULES, name)),
|
|
2587
|
+
tagBeforeAnchor: false
|
|
2588
|
+
};
|
|
2589
|
+
var DEFAULT_DUMP_OPTIONS = {
|
|
2590
|
+
...DEFAULT_PRESENTER_OPTIONS,
|
|
2591
|
+
schema: DUMP_SCHEMA,
|
|
2592
|
+
skipInvalid: false,
|
|
2593
|
+
noRefs: false,
|
|
2594
|
+
flowLevel: -1,
|
|
2595
|
+
sortKeys: false,
|
|
2596
|
+
transform: () => {
|
|
2597
|
+
}
|
|
2598
|
+
};
|
|
2599
|
+
var EVENT_DOCUMENT = EVENT_ID.DOCUMENT;
|
|
2600
|
+
var EVENT_SEQUENCE = EVENT_ID.SEQUENCE;
|
|
2601
|
+
var EVENT_MAPPING = EVENT_ID.MAPPING;
|
|
2602
|
+
var EVENT_SCALAR = EVENT_ID.SCALAR;
|
|
2603
|
+
var EVENT_ALIAS = EVENT_ID.ALIAS;
|
|
2604
|
+
var EVENT_POP = EVENT_ID.POP;
|
|
2605
|
+
var SCALAR_STYLE_PLAIN = SCALAR_STYLE.PLAIN;
|
|
2606
|
+
var SCALAR_STYLE_SINGLE_QUOTED = SCALAR_STYLE.SINGLE_QUOTED;
|
|
2607
|
+
var SCALAR_STYLE_DOUBLE_QUOTED = SCALAR_STYLE.DOUBLE_QUOTED;
|
|
2608
|
+
var SCALAR_STYLE_LITERAL_BLOCK = SCALAR_STYLE.LITERAL_BLOCK;
|
|
2609
|
+
var SCALAR_STYLE_FOLDED_BLOCK = SCALAR_STYLE.FOLDED_BLOCK;
|
|
2610
|
+
var COLLECTION_STYLE_BLOCK = COLLECTION_STYLE.BLOCK;
|
|
2611
|
+
var COLLECTION_STYLE_FLOW = COLLECTION_STYLE.FLOW;
|
|
2612
|
+
var CHOMPING_CLIP = CHOMPING_MODE.CLIP;
|
|
2613
|
+
var CHOMPING_STRIP = CHOMPING_MODE.STRIP;
|
|
2614
|
+
var CHOMPING_KEEP = CHOMPING_MODE.KEEP;
|
|
2615
|
+
|
|
2616
|
+
// src/cli/utils/logger.ts
|
|
2617
|
+
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
2618
|
+
var isTTY = process.stdout.isTTY === true;
|
|
2619
|
+
var SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
2620
|
+
var humanToStderr = false;
|
|
2621
|
+
var print = (...args) => {
|
|
2622
|
+
if (humanToStderr) console.error(...args);
|
|
2623
|
+
else console.log(...args);
|
|
2624
|
+
};
|
|
2625
|
+
var logger = {
|
|
2626
|
+
/** Send what the logger prints for a person to stderr (true) or back to stdout. */
|
|
2627
|
+
toStderr(on) {
|
|
2628
|
+
humanToStderr = on;
|
|
2629
|
+
},
|
|
2630
|
+
info(message) {
|
|
2631
|
+
print(`${import_picocolors.default.blue("\u2139")} ${message}`);
|
|
2632
|
+
},
|
|
2633
|
+
success(message) {
|
|
2634
|
+
print(`${import_picocolors.default.green("\u2713")} ${message}`);
|
|
2635
|
+
},
|
|
2636
|
+
error(message) {
|
|
2637
|
+
console.error(`${import_picocolors.default.red("\u2717")} ${message}`);
|
|
2638
|
+
},
|
|
2639
|
+
warn(message) {
|
|
2640
|
+
console.warn(import_picocolors.default.yellow(message));
|
|
2641
|
+
},
|
|
2642
|
+
debug(message) {
|
|
2643
|
+
if (process.env.DEBUG) {
|
|
2644
|
+
print(import_picocolors.default.dim(message));
|
|
437
2645
|
}
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
2646
|
+
},
|
|
2647
|
+
log(message) {
|
|
2648
|
+
print(message);
|
|
2649
|
+
},
|
|
2650
|
+
newline() {
|
|
2651
|
+
print();
|
|
2652
|
+
},
|
|
2653
|
+
section(title) {
|
|
2654
|
+
print();
|
|
2655
|
+
print(` ${import_picocolors.default.bold(title)}`);
|
|
2656
|
+
print();
|
|
2657
|
+
},
|
|
2658
|
+
progress(current, total, item) {
|
|
2659
|
+
print(`${import_picocolors.default.dim(`[${current}/${total}]`)} ${item}`);
|
|
2660
|
+
},
|
|
2661
|
+
// --- Formatting helpers ---
|
|
2662
|
+
dim(message) {
|
|
2663
|
+
return import_picocolors.default.dim(message);
|
|
2664
|
+
},
|
|
2665
|
+
bold(message) {
|
|
2666
|
+
return import_picocolors.default.bold(message);
|
|
2667
|
+
},
|
|
2668
|
+
highlight(value) {
|
|
2669
|
+
return import_picocolors.default.cyan(value);
|
|
2670
|
+
},
|
|
2671
|
+
// --- Branded output ---
|
|
2672
|
+
banner(version) {
|
|
2673
|
+
print(` ${import_picocolors.default.bold(import_picocolors.default.cyan("flow-weaver"))} ${import_picocolors.default.dim(`v${version}`)}`);
|
|
2674
|
+
},
|
|
2675
|
+
// --- Table output ---
|
|
2676
|
+
table(rows) {
|
|
2677
|
+
if (rows.length === 0) return;
|
|
2678
|
+
const col0 = Math.max(...rows.map((r) => r[0].length)) + 2;
|
|
2679
|
+
const col1 = Math.max(...rows.map((r) => r[1].length)) + 2;
|
|
2680
|
+
for (const [label, value, status] of rows) {
|
|
2681
|
+
const line = ` ${label.padEnd(col0)}${value.padEnd(col1)}${status ?? ""}`;
|
|
2682
|
+
print(line);
|
|
446
2683
|
}
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
2684
|
+
},
|
|
2685
|
+
// --- Spinner ---
|
|
2686
|
+
spinner(message) {
|
|
2687
|
+
if (!isTTY) {
|
|
2688
|
+
process.stderr.write(` ${message}
|
|
2689
|
+
`);
|
|
2690
|
+
return {
|
|
2691
|
+
stop(msg) {
|
|
2692
|
+
if (msg) process.stderr.write(` ${import_picocolors.default.green("\u2713")} ${msg}
|
|
2693
|
+
`);
|
|
2694
|
+
},
|
|
2695
|
+
fail(msg) {
|
|
2696
|
+
if (msg) process.stderr.write(` ${import_picocolors.default.red("\u2717")} ${msg}
|
|
2697
|
+
`);
|
|
2698
|
+
},
|
|
2699
|
+
update() {
|
|
2700
|
+
}
|
|
2701
|
+
};
|
|
454
2702
|
}
|
|
2703
|
+
let frame = 0;
|
|
2704
|
+
let text = message;
|
|
2705
|
+
const interval = setInterval(() => {
|
|
2706
|
+
const spinner = import_picocolors.default.cyan(SPINNER_FRAMES[frame % SPINNER_FRAMES.length]);
|
|
2707
|
+
process.stderr.write(`\r\x1B[K ${spinner} ${text}`);
|
|
2708
|
+
frame++;
|
|
2709
|
+
}, 80);
|
|
2710
|
+
const clear = () => {
|
|
2711
|
+
clearInterval(interval);
|
|
2712
|
+
process.stderr.write("\r\x1B[K");
|
|
2713
|
+
};
|
|
2714
|
+
return {
|
|
2715
|
+
stop(msg) {
|
|
2716
|
+
clear();
|
|
2717
|
+
if (msg) process.stderr.write(` ${import_picocolors.default.green("\u2713")} ${msg}
|
|
2718
|
+
`);
|
|
2719
|
+
},
|
|
2720
|
+
fail(msg) {
|
|
2721
|
+
clear();
|
|
2722
|
+
if (msg) process.stderr.write(` ${import_picocolors.default.red("\u2717")} ${msg}
|
|
2723
|
+
`);
|
|
2724
|
+
},
|
|
2725
|
+
update(msg) {
|
|
2726
|
+
text = msg;
|
|
2727
|
+
}
|
|
2728
|
+
};
|
|
2729
|
+
},
|
|
2730
|
+
// --- Timer ---
|
|
2731
|
+
timer() {
|
|
2732
|
+
const start = performance.now();
|
|
2733
|
+
return {
|
|
2734
|
+
elapsed() {
|
|
2735
|
+
const ms = performance.now() - start;
|
|
2736
|
+
if (ms < 1e3) return `${Math.round(ms)}ms`;
|
|
2737
|
+
if (ms < 6e4) return `${(ms / 1e3).toFixed(1)}s`;
|
|
2738
|
+
const mins = Math.floor(ms / 6e4);
|
|
2739
|
+
const secs = Math.round(ms % 6e4 / 1e3);
|
|
2740
|
+
return `${mins}m ${secs}s`;
|
|
2741
|
+
},
|
|
2742
|
+
ms() {
|
|
2743
|
+
return Math.round(performance.now() - start);
|
|
2744
|
+
}
|
|
2745
|
+
};
|
|
2746
|
+
}
|
|
2747
|
+
};
|
|
2748
|
+
|
|
2749
|
+
// src/constants.ts
|
|
2750
|
+
var MIN_NODE_MAJOR = 22;
|
|
2751
|
+
|
|
2752
|
+
// src/utils/error-utils.ts
|
|
2753
|
+
function getErrorMessage(error) {
|
|
2754
|
+
if (error instanceof Error) {
|
|
2755
|
+
return error.message;
|
|
2756
|
+
}
|
|
2757
|
+
return String(error);
|
|
455
2758
|
}
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
2759
|
+
|
|
2760
|
+
// src/cli/commands/doctor.ts
|
|
2761
|
+
function stripJsonComments(text) {
|
|
2762
|
+
let result = "";
|
|
2763
|
+
let i = 0;
|
|
2764
|
+
while (i < text.length) {
|
|
2765
|
+
if (text[i] === '"') {
|
|
2766
|
+
const start = i;
|
|
2767
|
+
i++;
|
|
2768
|
+
while (i < text.length && text[i] !== '"') {
|
|
2769
|
+
if (text[i] === "\\") i++;
|
|
2770
|
+
i++;
|
|
2771
|
+
}
|
|
2772
|
+
i++;
|
|
2773
|
+
result += text.slice(start, i);
|
|
2774
|
+
continue;
|
|
464
2775
|
}
|
|
465
|
-
|
|
466
|
-
|
|
2776
|
+
if (text[i] === "/" && text[i + 1] === "/") {
|
|
2777
|
+
while (i < text.length && text[i] !== "\n") i++;
|
|
2778
|
+
continue;
|
|
467
2779
|
}
|
|
2780
|
+
if (text[i] === "/" && text[i + 1] === "*") {
|
|
2781
|
+
i += 2;
|
|
2782
|
+
while (i < text.length && !(text[i] === "*" && text[i + 1] === "/")) i++;
|
|
2783
|
+
i += 2;
|
|
2784
|
+
continue;
|
|
2785
|
+
}
|
|
2786
|
+
result += text[i];
|
|
2787
|
+
i++;
|
|
2788
|
+
}
|
|
2789
|
+
return result;
|
|
468
2790
|
}
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
2791
|
+
function detectProjectModuleFormat(cwd) {
|
|
2792
|
+
const pkgPath = path2.join(cwd, "package.json");
|
|
2793
|
+
if (fs2.existsSync(pkgPath)) {
|
|
2794
|
+
try {
|
|
2795
|
+
const pkg = JSON.parse(fs2.readFileSync(pkgPath, "utf8"));
|
|
2796
|
+
if (pkg.type === "module") {
|
|
2797
|
+
return { format: "esm", source: "package.json", details: '"type": "module"' };
|
|
2798
|
+
}
|
|
2799
|
+
if (pkg.type === "commonjs" || !pkg.type) {
|
|
472
2800
|
return {
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
fix: 'Create .flowweaver/config.yaml with at least: defaultFileType: ts',
|
|
2801
|
+
format: "cjs",
|
|
2802
|
+
source: "package.json",
|
|
2803
|
+
details: pkg.type ? '"type": "commonjs"' : 'no "type" field (defaults to CommonJS)'
|
|
477
2804
|
};
|
|
2805
|
+
}
|
|
2806
|
+
} catch {
|
|
478
2807
|
}
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
};
|
|
2808
|
+
}
|
|
2809
|
+
const { parsed } = readTsconfig(cwd);
|
|
2810
|
+
if (parsed) {
|
|
2811
|
+
const compilerOptions = parsed.compilerOptions ?? {};
|
|
2812
|
+
const mod = typeof compilerOptions.module === "string" ? compilerOptions.module.toLowerCase() : void 0;
|
|
2813
|
+
if (mod === "commonjs") {
|
|
2814
|
+
return { format: "cjs", source: "tsconfig", details: '"module": "commonjs"' };
|
|
487
2815
|
}
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
fix: `Set defaultFileType to one of: ${VALID_FILE_TYPES.join(', ')}`,
|
|
495
|
-
};
|
|
2816
|
+
if (mod && ["es2015", "es2020", "es2022", "esnext", "nodenext", "node16"].includes(mod)) {
|
|
2817
|
+
return {
|
|
2818
|
+
format: "esm",
|
|
2819
|
+
source: "tsconfig",
|
|
2820
|
+
details: `"module": "${compilerOptions.module}"`
|
|
2821
|
+
};
|
|
496
2822
|
}
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
2823
|
+
}
|
|
2824
|
+
return { format: "esm", source: "default", details: "defaulting to ESM" };
|
|
2825
|
+
}
|
|
2826
|
+
var PACKAGE_NAME = "@synergenius/flow-weaver";
|
|
2827
|
+
function realpathOr(p) {
|
|
2828
|
+
try {
|
|
2829
|
+
return fs2.realpathSync(p);
|
|
2830
|
+
} catch {
|
|
2831
|
+
return p;
|
|
2832
|
+
}
|
|
2833
|
+
}
|
|
2834
|
+
function isFlowWeaverPackageRoot(dir) {
|
|
2835
|
+
try {
|
|
2836
|
+
const pkg = JSON.parse(fs2.readFileSync(path2.join(dir, "package.json"), "utf8"));
|
|
2837
|
+
return pkg.name === PACKAGE_NAME;
|
|
2838
|
+
} catch {
|
|
2839
|
+
return false;
|
|
2840
|
+
}
|
|
2841
|
+
}
|
|
2842
|
+
function serverInstallInfo() {
|
|
2843
|
+
let here;
|
|
2844
|
+
try {
|
|
2845
|
+
here = path2.dirname(fileURLToPath(import.meta.url));
|
|
2846
|
+
} catch {
|
|
2847
|
+
here = __dirname;
|
|
2848
|
+
}
|
|
2849
|
+
let dir = here;
|
|
2850
|
+
for (let depth = 0; depth < 8; depth++) {
|
|
2851
|
+
if (isFlowWeaverPackageRoot(dir)) {
|
|
2852
|
+
return { version: VERSION, installPath: realpathOr(dir) };
|
|
504
2853
|
}
|
|
2854
|
+
const parent = path2.dirname(dir);
|
|
2855
|
+
if (parent === dir) break;
|
|
2856
|
+
dir = parent;
|
|
2857
|
+
}
|
|
2858
|
+
return { version: VERSION, installPath: realpathOr(here) };
|
|
2859
|
+
}
|
|
2860
|
+
function checkServerInstall(cwd) {
|
|
2861
|
+
const { version, installPath } = serverInstallInfo();
|
|
2862
|
+
const checked = realpathOr(path2.resolve(cwd));
|
|
2863
|
+
if (isFlowWeaverPackageRoot(checked) && checked !== installPath) {
|
|
505
2864
|
return {
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
2865
|
+
name: "Running install",
|
|
2866
|
+
status: "warn",
|
|
2867
|
+
message: `This is a Flow Weaver checkout, but the running server is ${PACKAGE_NAME} ${version} from ${installPath}`,
|
|
2868
|
+
fix: `Edits and rebuilds here do not reach the running server. Restart the MCP server from ${path2.join(checked, "dist", "cli", "flow-weaver.mjs")}, or rebuild the install it runs from.`
|
|
510
2869
|
};
|
|
2870
|
+
}
|
|
2871
|
+
return {
|
|
2872
|
+
name: "Running install",
|
|
2873
|
+
status: "pass",
|
|
2874
|
+
message: `${PACKAGE_NAME} ${version} running from ${installPath}`
|
|
2875
|
+
};
|
|
511
2876
|
}
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
2877
|
+
function checkNodeVersion(version = process.version) {
|
|
2878
|
+
const major = parseInt(version.slice(1), 10);
|
|
2879
|
+
if (major >= MIN_NODE_MAJOR) {
|
|
2880
|
+
return {
|
|
2881
|
+
name: "Node.js version",
|
|
2882
|
+
status: "pass",
|
|
2883
|
+
message: `Node.js ${version} (>= ${MIN_NODE_MAJOR} required)`
|
|
2884
|
+
};
|
|
2885
|
+
}
|
|
2886
|
+
return {
|
|
2887
|
+
name: "Node.js version",
|
|
2888
|
+
status: "fail",
|
|
2889
|
+
message: `Node.js ${version} is below the minimum (${MIN_NODE_MAJOR})`,
|
|
2890
|
+
fix: `Install Node.js ${MIN_NODE_MAJOR} or later: https://nodejs.org`
|
|
2891
|
+
};
|
|
2892
|
+
}
|
|
2893
|
+
function checkTypeScriptVersion(cwd) {
|
|
2894
|
+
const tsPath = path2.join(cwd, "node_modules", "typescript", "package.json");
|
|
2895
|
+
if (!fs2.existsSync(tsPath)) {
|
|
2896
|
+
return {
|
|
2897
|
+
name: "TypeScript version",
|
|
2898
|
+
status: "fail",
|
|
2899
|
+
message: "TypeScript is not installed locally",
|
|
2900
|
+
fix: "npm install -D typescript"
|
|
2901
|
+
};
|
|
2902
|
+
}
|
|
2903
|
+
try {
|
|
2904
|
+
const tsPkg = JSON.parse(fs2.readFileSync(tsPath, "utf8"));
|
|
2905
|
+
const major = parseInt(tsPkg.version.split(".")[0], 10);
|
|
2906
|
+
if (major >= 5) {
|
|
2907
|
+
return {
|
|
2908
|
+
name: "TypeScript version",
|
|
2909
|
+
status: "pass",
|
|
2910
|
+
message: `TypeScript ${tsPkg.version} (>= 5.0 required)`
|
|
2911
|
+
};
|
|
529
2912
|
}
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
2913
|
+
return {
|
|
2914
|
+
name: "TypeScript version",
|
|
2915
|
+
status: "fail",
|
|
2916
|
+
message: `TypeScript ${tsPkg.version} is below the minimum (5.0)`,
|
|
2917
|
+
fix: "npm install -D typescript@latest"
|
|
2918
|
+
};
|
|
2919
|
+
} catch {
|
|
2920
|
+
return {
|
|
2921
|
+
name: "TypeScript version",
|
|
2922
|
+
status: "fail",
|
|
2923
|
+
message: "Could not read TypeScript version",
|
|
2924
|
+
fix: "npm install -D typescript@latest"
|
|
2925
|
+
};
|
|
2926
|
+
}
|
|
2927
|
+
}
|
|
2928
|
+
function checkPackageJsonType(cwd) {
|
|
2929
|
+
const pkgPath = path2.join(cwd, "package.json");
|
|
2930
|
+
if (!fs2.existsSync(pkgPath)) {
|
|
2931
|
+
return {
|
|
2932
|
+
name: 'package.json "type"',
|
|
2933
|
+
status: "fail",
|
|
2934
|
+
message: "No package.json found",
|
|
2935
|
+
fix: "Run npm init -y"
|
|
2936
|
+
};
|
|
2937
|
+
}
|
|
2938
|
+
try {
|
|
2939
|
+
const pkg = JSON.parse(fs2.readFileSync(pkgPath, "utf8"));
|
|
2940
|
+
if (pkg.type === "module") {
|
|
2941
|
+
return {
|
|
2942
|
+
name: 'package.json "type"',
|
|
2943
|
+
status: "pass",
|
|
2944
|
+
message: '"type": "module" is set (ESM project)'
|
|
2945
|
+
};
|
|
538
2946
|
}
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
fix: 'Add activeProfile: default to manifest.yaml',
|
|
546
|
-
};
|
|
2947
|
+
if (pkg.type === "commonjs") {
|
|
2948
|
+
return {
|
|
2949
|
+
name: 'package.json "type"',
|
|
2950
|
+
status: "pass",
|
|
2951
|
+
message: '"type": "commonjs" is set (CJS project)'
|
|
2952
|
+
};
|
|
547
2953
|
}
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
2954
|
+
return {
|
|
2955
|
+
name: 'package.json "type"',
|
|
2956
|
+
status: "pass",
|
|
2957
|
+
message: 'No "type" field (defaults to CommonJS)',
|
|
2958
|
+
details: 'Add "type": "module" if you prefer ESM'
|
|
2959
|
+
};
|
|
2960
|
+
} catch {
|
|
2961
|
+
return {
|
|
2962
|
+
name: 'package.json "type"',
|
|
2963
|
+
status: "fail",
|
|
2964
|
+
message: "Could not parse package.json",
|
|
2965
|
+
fix: "Fix JSON syntax in package.json"
|
|
2966
|
+
};
|
|
2967
|
+
}
|
|
2968
|
+
}
|
|
2969
|
+
function readTsconfigAt(tsconfigPath, compilerOptions, depth) {
|
|
2970
|
+
if (depth > 10 || !fs2.existsSync(tsconfigPath)) return;
|
|
2971
|
+
let parsed;
|
|
2972
|
+
try {
|
|
2973
|
+
parsed = JSON.parse(stripJsonComments(fs2.readFileSync(tsconfigPath, "utf8")));
|
|
2974
|
+
} catch {
|
|
2975
|
+
return;
|
|
2976
|
+
}
|
|
2977
|
+
const base = parsed.extends;
|
|
2978
|
+
const bases = typeof base === "string" ? [base] : Array.isArray(base) ? base : [];
|
|
2979
|
+
for (const b of bases) {
|
|
2980
|
+
if (typeof b !== "string") continue;
|
|
2981
|
+
readTsconfigAt(resolveExtends(b, path2.dirname(tsconfigPath)), compilerOptions, depth + 1);
|
|
2982
|
+
}
|
|
2983
|
+
const own = parsed.compilerOptions ?? {};
|
|
2984
|
+
Object.assign(compilerOptions, own);
|
|
2985
|
+
}
|
|
2986
|
+
function resolveExtends(ref, fromDir) {
|
|
2987
|
+
if (ref.startsWith(".") || ref.startsWith("/")) {
|
|
2988
|
+
return ref.endsWith(".json") ? path2.resolve(fromDir, ref) : path2.resolve(fromDir, `${ref}.json`);
|
|
2989
|
+
}
|
|
2990
|
+
const withExt = ref.endsWith(".json") ? ref : `${ref}/tsconfig.json`;
|
|
2991
|
+
return path2.join(fromDir, "node_modules", withExt);
|
|
2992
|
+
}
|
|
2993
|
+
function readTsconfig(cwd) {
|
|
2994
|
+
const tsconfigPath = path2.join(cwd, "tsconfig.json");
|
|
2995
|
+
if (!fs2.existsSync(tsconfigPath)) {
|
|
2996
|
+
return { parsed: null, error: "No tsconfig.json found" };
|
|
2997
|
+
}
|
|
2998
|
+
try {
|
|
2999
|
+
JSON.parse(stripJsonComments(fs2.readFileSync(tsconfigPath, "utf8")));
|
|
3000
|
+
} catch {
|
|
3001
|
+
return { parsed: null, error: "Could not parse tsconfig.json" };
|
|
3002
|
+
}
|
|
3003
|
+
const compilerOptions = {};
|
|
3004
|
+
readTsconfigAt(tsconfigPath, compilerOptions, 0);
|
|
3005
|
+
return { parsed: { compilerOptions } };
|
|
3006
|
+
}
|
|
3007
|
+
function checkTsconfigModule(cwd) {
|
|
3008
|
+
const { parsed, error } = readTsconfig(cwd);
|
|
3009
|
+
if (!parsed) {
|
|
3010
|
+
return {
|
|
3011
|
+
name: 'tsconfig "module"',
|
|
3012
|
+
status: "warn",
|
|
3013
|
+
message: error ?? "No tsconfig.json found",
|
|
3014
|
+
fix: 'Create a tsconfig.json with appropriate "module" setting'
|
|
3015
|
+
};
|
|
3016
|
+
}
|
|
3017
|
+
const compilerOptions = parsed.compilerOptions ?? {};
|
|
3018
|
+
const mod = typeof compilerOptions.module === "string" ? compilerOptions.module.toLowerCase() : void 0;
|
|
3019
|
+
if (!mod) {
|
|
3020
|
+
return {
|
|
3021
|
+
name: 'tsconfig "module"',
|
|
3022
|
+
status: "warn",
|
|
3023
|
+
message: '"module" is not set in compilerOptions',
|
|
3024
|
+
fix: 'Set "module" in tsconfig.json compilerOptions (e.g., "nodenext" for ESM, "commonjs" for CJS)'
|
|
3025
|
+
};
|
|
3026
|
+
}
|
|
3027
|
+
const detection = detectProjectModuleFormat(cwd);
|
|
3028
|
+
if (mod === "commonjs") {
|
|
3029
|
+
if (detection.format === "cjs") {
|
|
3030
|
+
return {
|
|
3031
|
+
name: 'tsconfig "module"',
|
|
3032
|
+
status: "pass",
|
|
3033
|
+
message: '"module": "commonjs" (CJS project)'
|
|
3034
|
+
};
|
|
555
3035
|
}
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
3036
|
+
return {
|
|
3037
|
+
name: 'tsconfig "module"',
|
|
3038
|
+
status: "warn",
|
|
3039
|
+
message: '"module" is "commonjs" but package.json suggests ESM',
|
|
3040
|
+
fix: 'Align tsconfig.json "module" with package.json "type"'
|
|
3041
|
+
};
|
|
3042
|
+
}
|
|
3043
|
+
const esmModules = ["es2015", "es2020", "es2022", "esnext", "nodenext", "node16"];
|
|
3044
|
+
if (esmModules.includes(mod)) {
|
|
3045
|
+
if (detection.format === "esm") {
|
|
3046
|
+
return {
|
|
3047
|
+
name: 'tsconfig "module"',
|
|
3048
|
+
status: "pass",
|
|
3049
|
+
message: `"module": "${compilerOptions.module}" (ESM project)`
|
|
3050
|
+
};
|
|
563
3051
|
}
|
|
564
3052
|
return {
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
3053
|
+
name: 'tsconfig "module"',
|
|
3054
|
+
status: "warn",
|
|
3055
|
+
message: `"module" is "${compilerOptions.module}" but package.json suggests CJS`,
|
|
3056
|
+
fix: 'Align tsconfig.json "module" with package.json "type"'
|
|
568
3057
|
};
|
|
3058
|
+
}
|
|
3059
|
+
return {
|
|
3060
|
+
name: 'tsconfig "module"',
|
|
3061
|
+
status: "pass",
|
|
3062
|
+
message: `"module": "${compilerOptions.module}"`
|
|
3063
|
+
};
|
|
569
3064
|
}
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
3065
|
+
function checkTsconfigModuleResolution(cwd) {
|
|
3066
|
+
const { parsed, error } = readTsconfig(cwd);
|
|
3067
|
+
if (!parsed) {
|
|
3068
|
+
return {
|
|
3069
|
+
name: 'tsconfig "moduleResolution"',
|
|
3070
|
+
status: "warn",
|
|
3071
|
+
message: error ?? "No tsconfig.json found",
|
|
3072
|
+
fix: 'Create a tsconfig.json with "moduleResolution": "nodenext" or "bundler"'
|
|
3073
|
+
};
|
|
3074
|
+
}
|
|
3075
|
+
const compilerOptions = parsed.compilerOptions ?? {};
|
|
3076
|
+
const res = typeof compilerOptions.moduleResolution === "string" ? compilerOptions.moduleResolution.toLowerCase() : void 0;
|
|
3077
|
+
if (!res) {
|
|
3078
|
+
return {
|
|
3079
|
+
name: 'tsconfig "moduleResolution"',
|
|
3080
|
+
status: "warn",
|
|
3081
|
+
message: '"moduleResolution" is not set in compilerOptions',
|
|
3082
|
+
fix: 'Set "moduleResolution": "nodenext" in tsconfig.json compilerOptions'
|
|
3083
|
+
};
|
|
3084
|
+
}
|
|
3085
|
+
if (res === "node") {
|
|
3086
|
+
return {
|
|
3087
|
+
name: 'tsconfig "moduleResolution"',
|
|
3088
|
+
status: "fail",
|
|
3089
|
+
message: '"moduleResolution" is "node" (Node10), which cannot resolve ESM exports',
|
|
3090
|
+
fix: 'Set "moduleResolution": "nodenext" or "bundler" in tsconfig.json'
|
|
3091
|
+
};
|
|
3092
|
+
}
|
|
3093
|
+
return {
|
|
3094
|
+
name: 'tsconfig "moduleResolution"',
|
|
3095
|
+
status: "pass",
|
|
3096
|
+
message: `"moduleResolution": "${compilerOptions.moduleResolution}"`
|
|
3097
|
+
};
|
|
3098
|
+
}
|
|
3099
|
+
function checkFlowWeaverInstalled(cwd) {
|
|
3100
|
+
if (isFlowWeaverPackageRoot(realpathOr(path2.resolve(cwd)))) {
|
|
3101
|
+
return {
|
|
3102
|
+
name: "@synergenius/flow-weaver installed",
|
|
3103
|
+
status: "pass",
|
|
3104
|
+
message: "This is the Flow Weaver source checkout (not a dependency)"
|
|
3105
|
+
};
|
|
3106
|
+
}
|
|
3107
|
+
const pkgPath = path2.join(cwd, "node_modules", "@synergenius", "flow-weaver", "package.json");
|
|
3108
|
+
if (fs2.existsSync(pkgPath)) {
|
|
3109
|
+
try {
|
|
3110
|
+
const pkg = JSON.parse(fs2.readFileSync(pkgPath, "utf8"));
|
|
3111
|
+
return {
|
|
3112
|
+
name: "@synergenius/flow-weaver installed",
|
|
3113
|
+
status: "pass",
|
|
3114
|
+
message: `@synergenius/flow-weaver ${pkg.version} is installed`
|
|
3115
|
+
};
|
|
3116
|
+
} catch {
|
|
3117
|
+
return {
|
|
3118
|
+
name: "@synergenius/flow-weaver installed",
|
|
3119
|
+
status: "pass",
|
|
3120
|
+
message: "@synergenius/flow-weaver is installed"
|
|
3121
|
+
};
|
|
586
3122
|
}
|
|
587
|
-
|
|
588
|
-
|
|
3123
|
+
}
|
|
3124
|
+
return {
|
|
3125
|
+
name: "@synergenius/flow-weaver installed",
|
|
3126
|
+
status: "fail",
|
|
3127
|
+
message: "@synergenius/flow-weaver is not installed",
|
|
3128
|
+
fix: "npm install @synergenius/flow-weaver"
|
|
3129
|
+
};
|
|
3130
|
+
}
|
|
3131
|
+
function checkFlowWeaverVersion(cwd) {
|
|
3132
|
+
const libraryPath = path2.join(cwd, "node_modules", "@synergenius", "flow-weaver");
|
|
3133
|
+
const pkgPath = path2.join(libraryPath, "package.json");
|
|
3134
|
+
if (!fs2.existsSync(pkgPath)) {
|
|
3135
|
+
return {
|
|
3136
|
+
name: "Library version",
|
|
3137
|
+
status: "pass",
|
|
3138
|
+
message: "Skipped (library not installed)"
|
|
3139
|
+
};
|
|
3140
|
+
}
|
|
3141
|
+
try {
|
|
3142
|
+
const projectPkgPath = path2.join(cwd, "package.json");
|
|
3143
|
+
if (fs2.existsSync(projectPkgPath)) {
|
|
3144
|
+
const projectPkg = JSON.parse(fs2.readFileSync(projectPkgPath, "utf8"));
|
|
3145
|
+
const depSpec = projectPkg.dependencies?.["@synergenius/flow-weaver"] ?? projectPkg.devDependencies?.["@synergenius/flow-weaver"];
|
|
3146
|
+
if (typeof depSpec === "string" && (depSpec.startsWith("file:") || depSpec.startsWith("link:") || depSpec.startsWith("workspace:"))) {
|
|
589
3147
|
return {
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
3148
|
+
name: "Library version",
|
|
3149
|
+
status: "pass",
|
|
3150
|
+
message: "Local dependency (version check skipped)"
|
|
593
3151
|
};
|
|
3152
|
+
}
|
|
594
3153
|
}
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
missing.push(profile);
|
|
602
|
-
continue;
|
|
603
|
-
}
|
|
604
|
-
const { data, error } = readYaml(profilePath);
|
|
605
|
-
if (error || data == null) {
|
|
606
|
-
invalid.push(`${profile} (parse error)`);
|
|
607
|
-
continue;
|
|
608
|
-
}
|
|
609
|
-
const config = data;
|
|
610
|
-
// Target names are validated at export time via the target registry.
|
|
611
|
-
// We only check that the value is a non-empty string here.
|
|
612
|
-
if (config.target && typeof config.target !== 'string') {
|
|
613
|
-
invalid.push(`${profile} (target must be a string)`);
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
if (invalid.length > 0) {
|
|
617
|
-
return {
|
|
618
|
-
name: 'Deployment profiles',
|
|
619
|
-
status: 'fail',
|
|
620
|
-
message: `Invalid profiles: ${invalid.join(', ')}`,
|
|
621
|
-
fix: 'Fix the listed profile files in .flowweaver/deployment/',
|
|
622
|
-
};
|
|
3154
|
+
if (fs2.lstatSync(libraryPath).isSymbolicLink()) {
|
|
3155
|
+
return {
|
|
3156
|
+
name: "Library version",
|
|
3157
|
+
status: "pass",
|
|
3158
|
+
message: "Linked dependency (version check skipped)"
|
|
3159
|
+
};
|
|
623
3160
|
}
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
3161
|
+
} catch {
|
|
3162
|
+
}
|
|
3163
|
+
try {
|
|
3164
|
+
const pkg = JSON.parse(fs2.readFileSync(pkgPath, "utf8"));
|
|
3165
|
+
const currentVersion = pkg.version;
|
|
3166
|
+
const latestVersion = execSync("npm view @synergenius/flow-weaver version", {
|
|
3167
|
+
timeout: 5e3,
|
|
3168
|
+
stdio: "pipe"
|
|
3169
|
+
}).toString().trim();
|
|
3170
|
+
if (currentVersion === latestVersion) {
|
|
3171
|
+
return {
|
|
3172
|
+
name: "Library version",
|
|
3173
|
+
status: "pass",
|
|
3174
|
+
message: `@synergenius/flow-weaver ${currentVersion} is up to date`
|
|
3175
|
+
};
|
|
631
3176
|
}
|
|
632
3177
|
return {
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
}
|
|
638
|
-
|
|
639
|
-
export function runDoctorChecks(cwd) {
|
|
640
|
-
const moduleFormat = detectProjectModuleFormat(cwd);
|
|
641
|
-
const checks = [
|
|
642
|
-
checkNodeVersion(),
|
|
643
|
-
checkTypeScriptVersion(cwd),
|
|
644
|
-
checkPackageJsonType(cwd),
|
|
645
|
-
checkTsconfigModule(cwd),
|
|
646
|
-
checkTsconfigModuleResolution(cwd),
|
|
647
|
-
checkFlowWeaverInstalled(cwd),
|
|
648
|
-
checkFlowWeaverVersion(cwd),
|
|
649
|
-
checkTypesNodeInstalled(cwd),
|
|
650
|
-
checkTsxAvailable(cwd),
|
|
651
|
-
checkProjectConfig(cwd),
|
|
652
|
-
checkDeploymentManifest(cwd),
|
|
653
|
-
checkDeploymentProfiles(cwd),
|
|
654
|
-
];
|
|
655
|
-
const summary = { pass: 0, warn: 0, fail: 0 };
|
|
656
|
-
for (const check of checks) {
|
|
657
|
-
summary[check.status]++;
|
|
658
|
-
}
|
|
3178
|
+
name: "Library version",
|
|
3179
|
+
status: "warn",
|
|
3180
|
+
message: `Library update available: ${currentVersion} \u2192 ${latestVersion}`,
|
|
3181
|
+
fix: "npm update @synergenius/flow-weaver"
|
|
3182
|
+
};
|
|
3183
|
+
} catch {
|
|
659
3184
|
return {
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
moduleFormat,
|
|
3185
|
+
name: "Library version",
|
|
3186
|
+
status: "pass",
|
|
3187
|
+
message: "Could not check for updates (registry unreachable)"
|
|
664
3188
|
};
|
|
3189
|
+
}
|
|
665
3190
|
}
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
3191
|
+
function checkTypesNodeInstalled(cwd) {
|
|
3192
|
+
const pkgPath = path2.join(cwd, "node_modules", "@types", "node", "package.json");
|
|
3193
|
+
if (fs2.existsSync(pkgPath)) {
|
|
3194
|
+
return {
|
|
3195
|
+
name: "@types/node installed",
|
|
3196
|
+
status: "pass",
|
|
3197
|
+
message: "@types/node is installed"
|
|
3198
|
+
};
|
|
3199
|
+
}
|
|
3200
|
+
return {
|
|
3201
|
+
name: "@types/node installed",
|
|
3202
|
+
status: "warn",
|
|
3203
|
+
message: "@types/node is not installed (recommended)",
|
|
3204
|
+
fix: "npm install -D @types/node"
|
|
3205
|
+
};
|
|
3206
|
+
}
|
|
3207
|
+
function checkTsxAvailable(cwd) {
|
|
3208
|
+
const localBin = path2.join(cwd, "node_modules", ".bin", "tsx");
|
|
3209
|
+
if (fs2.existsSync(localBin)) {
|
|
3210
|
+
return {
|
|
3211
|
+
name: "tsx available",
|
|
3212
|
+
status: "pass",
|
|
3213
|
+
message: "tsx is available (local)"
|
|
3214
|
+
};
|
|
3215
|
+
}
|
|
3216
|
+
try {
|
|
3217
|
+
execSync("tsx --version", { stdio: "pipe", timeout: 5e3 });
|
|
3218
|
+
return {
|
|
3219
|
+
name: "tsx available",
|
|
3220
|
+
status: "pass",
|
|
3221
|
+
message: "tsx is available (global)"
|
|
3222
|
+
};
|
|
3223
|
+
} catch {
|
|
3224
|
+
return {
|
|
3225
|
+
name: "tsx available",
|
|
3226
|
+
status: "warn",
|
|
3227
|
+
message: "tsx is not installed (recommended for running .ts files)",
|
|
3228
|
+
fix: "npm install -D tsx"
|
|
3229
|
+
};
|
|
3230
|
+
}
|
|
3231
|
+
}
|
|
3232
|
+
var VALID_FILE_TYPES = ["ts", "tsx", "js", "jsx"];
|
|
3233
|
+
function readYaml(filePath) {
|
|
3234
|
+
try {
|
|
3235
|
+
const content = fs2.readFileSync(filePath, "utf8");
|
|
3236
|
+
return { data: load(content) };
|
|
3237
|
+
} catch (e) {
|
|
3238
|
+
return { data: null, error: getErrorMessage(e) };
|
|
3239
|
+
}
|
|
3240
|
+
}
|
|
3241
|
+
function checkProjectConfig(cwd) {
|
|
3242
|
+
const configPath = path2.join(cwd, ".flowweaver", "config.yaml");
|
|
3243
|
+
if (!fs2.existsSync(configPath)) {
|
|
3244
|
+
return {
|
|
3245
|
+
name: "Project config",
|
|
3246
|
+
status: "warn",
|
|
3247
|
+
message: ".flowweaver/config.yaml not found",
|
|
3248
|
+
fix: "Create .flowweaver/config.yaml with at least: defaultFileType: ts"
|
|
3249
|
+
};
|
|
3250
|
+
}
|
|
3251
|
+
const { data, error } = readYaml(configPath);
|
|
3252
|
+
if (error || data == null) {
|
|
3253
|
+
return {
|
|
3254
|
+
name: "Project config",
|
|
3255
|
+
status: "fail",
|
|
3256
|
+
message: `Could not parse .flowweaver/config.yaml: ${error}`,
|
|
3257
|
+
fix: "Fix YAML syntax in .flowweaver/config.yaml"
|
|
3258
|
+
};
|
|
3259
|
+
}
|
|
3260
|
+
const config = data;
|
|
3261
|
+
if (config.defaultFileType && !VALID_FILE_TYPES.includes(config.defaultFileType)) {
|
|
3262
|
+
return {
|
|
3263
|
+
name: "Project config",
|
|
3264
|
+
status: "fail",
|
|
3265
|
+
message: `Invalid defaultFileType "${config.defaultFileType}", must be one of: ${VALID_FILE_TYPES.join(", ")}`,
|
|
3266
|
+
fix: `Set defaultFileType to one of: ${VALID_FILE_TYPES.join(", ")}`
|
|
3267
|
+
};
|
|
3268
|
+
}
|
|
3269
|
+
return {
|
|
3270
|
+
name: "Project config",
|
|
3271
|
+
status: "pass",
|
|
3272
|
+
message: `.flowweaver/config.yaml is valid`,
|
|
3273
|
+
details: `defaultFileType: ${config.defaultFileType ?? "not set"}`
|
|
3274
|
+
};
|
|
3275
|
+
}
|
|
3276
|
+
function checkRunningServices(services = listServices()) {
|
|
3277
|
+
if (!services.length) return { name: "Running services", status: "pass", message: "none" };
|
|
3278
|
+
const here = serverInstallInfo().installPath;
|
|
3279
|
+
const lines = services.map((s) => {
|
|
3280
|
+
const ago = Math.max(0, Math.round((Date.now() - Date.parse(s.lastActivityAt)) / 1e3));
|
|
3281
|
+
const where = s.url ?? s.transport ?? "";
|
|
3282
|
+
const client = s.client ? ` for ${s.client}` : "";
|
|
3283
|
+
const last = s.activity ? `, last ${s.activity} ${ago}s ago` : "";
|
|
3284
|
+
return `${s.kind} (pid ${s.pid}${where ? `, ${where}` : ""}${client}) from ${s.install}${last}`;
|
|
3285
|
+
});
|
|
3286
|
+
const elsewhere = services.filter((s) => s.kind === "mcp-server" && realpathOr(s.install) !== realpathOr(here));
|
|
3287
|
+
return {
|
|
3288
|
+
name: "Running services",
|
|
3289
|
+
status: elsewhere.length ? "warn" : "pass",
|
|
3290
|
+
message: lines.join("; "),
|
|
3291
|
+
...elsewhere.length ? { fix: `An MCP server runs from ${elsewhere[0].install}, not from here. Restart it from this install if this is the one you are changing.` } : {}
|
|
3292
|
+
};
|
|
3293
|
+
}
|
|
3294
|
+
function runDoctorChecks(cwd) {
|
|
3295
|
+
const moduleFormat = detectProjectModuleFormat(cwd);
|
|
3296
|
+
const server = serverInstallInfo();
|
|
3297
|
+
const services = listServices();
|
|
3298
|
+
const checks = [
|
|
3299
|
+
checkServerInstall(cwd),
|
|
3300
|
+
checkNodeVersion(),
|
|
3301
|
+
checkTypeScriptVersion(cwd),
|
|
3302
|
+
checkPackageJsonType(cwd),
|
|
3303
|
+
checkTsconfigModule(cwd),
|
|
3304
|
+
checkTsconfigModuleResolution(cwd),
|
|
3305
|
+
checkFlowWeaverInstalled(cwd),
|
|
3306
|
+
checkFlowWeaverVersion(cwd),
|
|
3307
|
+
checkTypesNodeInstalled(cwd),
|
|
3308
|
+
checkTsxAvailable(cwd),
|
|
3309
|
+
checkProjectConfig(cwd),
|
|
3310
|
+
checkRunningServices(services)
|
|
3311
|
+
];
|
|
3312
|
+
const summary = { pass: 0, warn: 0, fail: 0 };
|
|
3313
|
+
for (const check of checks) {
|
|
3314
|
+
summary[check.status]++;
|
|
3315
|
+
}
|
|
3316
|
+
return {
|
|
3317
|
+
ok: summary.fail === 0,
|
|
3318
|
+
checks,
|
|
3319
|
+
summary,
|
|
3320
|
+
moduleFormat,
|
|
3321
|
+
server,
|
|
3322
|
+
services
|
|
3323
|
+
};
|
|
3324
|
+
}
|
|
3325
|
+
async function doctorCommand(options = {}) {
|
|
3326
|
+
const cwd = process.cwd();
|
|
3327
|
+
const report = runDoctorChecks(cwd);
|
|
3328
|
+
if (options.json) {
|
|
3329
|
+
console.log(JSON.stringify(report, null, 2));
|
|
3330
|
+
} else {
|
|
3331
|
+
logger.section("Flow Weaver Doctor");
|
|
3332
|
+
const statusIcon = (s) => s === "pass" ? logger.highlight("pass") : s === "warn" ? "warn" : "\u2717 fail";
|
|
3333
|
+
const rows = report.checks.map((check) => [
|
|
3334
|
+
check.name,
|
|
3335
|
+
check.message,
|
|
3336
|
+
statusIcon(check.status)
|
|
3337
|
+
]);
|
|
3338
|
+
logger.table(rows);
|
|
3339
|
+
const fixable = report.checks.filter((c) => c.status !== "pass" && c.fix);
|
|
3340
|
+
if (fixable.length > 0) {
|
|
3341
|
+
logger.newline();
|
|
3342
|
+
for (const check of fixable) {
|
|
3343
|
+
logger.log(` ${logger.dim(check.name + ":")} ${check.fix}`);
|
|
3344
|
+
}
|
|
708
3345
|
}
|
|
709
|
-
|
|
710
|
-
|
|
3346
|
+
logger.newline();
|
|
3347
|
+
logger.log(` Running: ${PACKAGE_NAME} ${report.server.version} ${logger.dim(`(${report.server.installPath})`)}`);
|
|
3348
|
+
logger.log(` Module format: ${report.moduleFormat.format.toUpperCase()} ${logger.dim(`(${report.moduleFormat.details})`)}`);
|
|
3349
|
+
const parts = [];
|
|
3350
|
+
if (report.summary.pass > 0) parts.push(`${report.summary.pass} passed`);
|
|
3351
|
+
if (report.summary.warn > 0) parts.push(`${report.summary.warn} warnings`);
|
|
3352
|
+
if (report.summary.fail > 0) parts.push(`${report.summary.fail} failed`);
|
|
3353
|
+
logger.log(` ${parts.join(", ")}`);
|
|
3354
|
+
if (report.ok) {
|
|
3355
|
+
logger.newline();
|
|
3356
|
+
logger.success("Environment is ready for flow-weaver!");
|
|
3357
|
+
} else {
|
|
3358
|
+
logger.newline();
|
|
3359
|
+
logger.error("Fix the issues above to continue.");
|
|
711
3360
|
}
|
|
3361
|
+
}
|
|
3362
|
+
if (!report.ok) {
|
|
3363
|
+
throw new Error("Doctor found issues that need to be fixed");
|
|
3364
|
+
}
|
|
712
3365
|
}
|
|
713
|
-
|
|
3366
|
+
export {
|
|
3367
|
+
checkFlowWeaverInstalled,
|
|
3368
|
+
checkNodeVersion,
|
|
3369
|
+
checkPackageJsonType,
|
|
3370
|
+
checkProjectConfig,
|
|
3371
|
+
checkServerInstall,
|
|
3372
|
+
checkTsconfigModule,
|
|
3373
|
+
checkTsconfigModuleResolution,
|
|
3374
|
+
checkTsxAvailable,
|
|
3375
|
+
checkTypeScriptVersion,
|
|
3376
|
+
checkTypesNodeInstalled,
|
|
3377
|
+
detectProjectModuleFormat,
|
|
3378
|
+
doctorCommand,
|
|
3379
|
+
runDoctorChecks,
|
|
3380
|
+
serverInstallInfo,
|
|
3381
|
+
stripJsonComments
|
|
3382
|
+
};
|
|
3383
|
+
/*! Bundled license information:
|
|
3384
|
+
|
|
3385
|
+
js-yaml/dist/js-yaml.mjs:
|
|
3386
|
+
(*! js-yaml 5.4.2 https://github.com/nodeca/js-yaml @license MIT *)
|
|
3387
|
+
*/
|