@windrun-huaiin/dev-scripts 14.0.0 → 14.1.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.
Files changed (250) hide show
  1. package/dist/_virtual/_commonjsHelpers.js +7 -0
  2. package/dist/_virtual/_commonjsHelpers.mjs +5 -0
  3. package/dist/_virtual/index.js +11 -0
  4. package/dist/_virtual/index.mjs +7 -0
  5. package/dist/_virtual/re.js +5 -0
  6. package/dist/_virtual/re.mjs +3 -0
  7. package/dist/cli.js +33 -1
  8. package/dist/cli.mjs +33 -1
  9. package/dist/commands/diaomao-update.d.ts +3 -0
  10. package/dist/commands/diaomao-update.d.ts.map +1 -0
  11. package/dist/commands/diaomao-update.js +304 -0
  12. package/dist/commands/diaomao-update.mjs +302 -0
  13. package/dist/config/index.d.ts.map +1 -1
  14. package/dist/config/index.js +9 -0
  15. package/dist/config/index.mjs +9 -0
  16. package/dist/config/schema.d.ts +5 -0
  17. package/dist/config/schema.d.ts.map +1 -1
  18. package/dist/config/schema.js +5 -0
  19. package/dist/config/schema.mjs +5 -0
  20. package/dist/index.d.ts +1 -0
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +2 -0
  23. package/dist/index.mjs +1 -0
  24. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/comparator.js +161 -0
  25. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/comparator.mjs +159 -0
  26. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/range.js +576 -0
  27. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/range.mjs +574 -0
  28. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/semver.js +350 -0
  29. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/classes/semver.mjs +348 -0
  30. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/clean.js +21 -0
  31. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/clean.mjs +19 -0
  32. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/cmp.js +72 -0
  33. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/cmp.mjs +70 -0
  34. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/coerce.js +77 -0
  35. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/coerce.mjs +75 -0
  36. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare-build.js +22 -0
  37. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare-build.mjs +20 -0
  38. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare-loose.js +18 -0
  39. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare-loose.mjs +16 -0
  40. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare.js +20 -0
  41. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/compare.mjs +18 -0
  42. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/diff.js +73 -0
  43. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/diff.mjs +71 -0
  44. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/eq.js +18 -0
  45. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/eq.mjs +16 -0
  46. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/gt.js +18 -0
  47. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/gt.mjs +16 -0
  48. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/gte.js +18 -0
  49. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/gte.mjs +16 -0
  50. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/inc.js +34 -0
  51. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/inc.mjs +32 -0
  52. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/lt.js +18 -0
  53. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/lt.mjs +16 -0
  54. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/lte.js +18 -0
  55. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/lte.mjs +16 -0
  56. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/major.js +18 -0
  57. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/major.mjs +16 -0
  58. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/minor.js +18 -0
  59. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/minor.mjs +16 -0
  60. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/neq.js +18 -0
  61. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/neq.mjs +16 -0
  62. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/parse.js +31 -0
  63. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/parse.mjs +29 -0
  64. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/patch.js +18 -0
  65. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/patch.mjs +16 -0
  66. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/prerelease.js +21 -0
  67. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/prerelease.mjs +19 -0
  68. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/rcompare.js +18 -0
  69. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/rcompare.mjs +16 -0
  70. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/rsort.js +18 -0
  71. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/rsort.mjs +16 -0
  72. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/satisfies.js +25 -0
  73. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/satisfies.mjs +23 -0
  74. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/sort.js +18 -0
  75. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/sort.mjs +16 -0
  76. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/valid.js +21 -0
  77. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/functions/valid.mjs +19 -0
  78. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/index.js +144 -0
  79. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/index.mjs +142 -0
  80. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/constants.js +48 -0
  81. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/constants.mjs +46 -0
  82. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/debug.js +22 -0
  83. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/debug.mjs +20 -0
  84. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/identifiers.js +40 -0
  85. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/identifiers.mjs +38 -0
  86. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/lrucache.js +53 -0
  87. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/lrucache.mjs +51 -0
  88. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/parse-options.js +28 -0
  89. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/parse-options.mjs +26 -0
  90. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/re.js +239 -0
  91. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/internal/re.mjs +237 -0
  92. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/gtr.js +19 -0
  93. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/gtr.mjs +17 -0
  94. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/intersects.js +22 -0
  95. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/intersects.mjs +20 -0
  96. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/ltr.js +19 -0
  97. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/ltr.mjs +17 -0
  98. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/max-satisfying.js +41 -0
  99. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/max-satisfying.mjs +39 -0
  100. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/min-satisfying.js +40 -0
  101. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/min-satisfying.mjs +38 -0
  102. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/min-version.js +78 -0
  103. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/min-version.mjs +76 -0
  104. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/outside.js +102 -0
  105. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/outside.mjs +100 -0
  106. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/simplify.js +63 -0
  107. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/simplify.mjs +61 -0
  108. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/subset.js +265 -0
  109. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/subset.mjs +263 -0
  110. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/to-comparators.js +23 -0
  111. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/to-comparators.mjs +21 -0
  112. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/valid.js +26 -0
  113. package/dist/node_modules/.pnpm/semver@7.7.4/node_modules/semver/ranges/valid.mjs +24 -0
  114. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/compose-collection.js +90 -0
  115. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/compose-collection.mjs +88 -0
  116. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/compose-doc.js +45 -0
  117. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/compose-doc.mjs +43 -0
  118. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/compose-node.js +105 -0
  119. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/compose-node.mjs +102 -0
  120. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/compose-scalar.js +88 -0
  121. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/compose-scalar.mjs +86 -0
  122. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/composer.js +219 -0
  123. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/composer.mjs +217 -0
  124. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/resolve-block-map.js +117 -0
  125. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/resolve-block-map.mjs +115 -0
  126. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/resolve-block-scalar.js +200 -0
  127. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/resolve-block-scalar.mjs +198 -0
  128. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/resolve-block-seq.js +51 -0
  129. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/resolve-block-seq.mjs +49 -0
  130. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/resolve-end.js +39 -0
  131. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/resolve-end.mjs +37 -0
  132. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +209 -0
  133. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/resolve-flow-collection.mjs +207 -0
  134. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +225 -0
  135. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.mjs +223 -0
  136. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/resolve-props.js +148 -0
  137. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/resolve-props.mjs +146 -0
  138. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/util-contains-newline.js +36 -0
  139. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/util-contains-newline.mjs +34 -0
  140. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js +28 -0
  141. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.mjs +26 -0
  142. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/util-flow-indent-check.js +17 -0
  143. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/util-flow-indent-check.mjs +15 -0
  144. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/util-map-includes.js +15 -0
  145. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/compose/util-map-includes.mjs +13 -0
  146. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/doc/Document.js +337 -0
  147. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/doc/Document.mjs +335 -0
  148. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/doc/anchors.js +76 -0
  149. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/doc/anchors.mjs +71 -0
  150. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/doc/applyReviver.js +57 -0
  151. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/doc/applyReviver.mjs +55 -0
  152. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/doc/createNode.js +90 -0
  153. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/doc/createNode.mjs +88 -0
  154. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/doc/directives.js +178 -0
  155. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/doc/directives.mjs +176 -0
  156. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/errors.js +62 -0
  157. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/errors.mjs +57 -0
  158. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/log.js +9 -0
  159. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/log.mjs +7 -0
  160. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/Alias.js +116 -0
  161. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/Alias.mjs +114 -0
  162. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/Collection.js +151 -0
  163. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/Collection.mjs +147 -0
  164. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/Node.js +40 -0
  165. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/Node.mjs +38 -0
  166. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/Pair.js +39 -0
  167. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/Pair.mjs +36 -0
  168. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/Scalar.js +27 -0
  169. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/Scalar.mjs +24 -0
  170. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/YAMLMap.js +147 -0
  171. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/YAMLMap.mjs +144 -0
  172. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/YAMLSeq.js +115 -0
  173. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/YAMLSeq.mjs +113 -0
  174. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +65 -0
  175. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/addPairToJSMap.mjs +63 -0
  176. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/identity.js +53 -0
  177. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/identity.mjs +36 -0
  178. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/toJS.js +39 -0
  179. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/nodes/toJS.mjs +37 -0
  180. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/parse/cst.js +79 -0
  181. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/parse/cst.mjs +73 -0
  182. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/parse/lexer.js +719 -0
  183. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/parse/lexer.mjs +717 -0
  184. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/parse/line-counter.js +41 -0
  185. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/parse/line-counter.mjs +39 -0
  186. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/parse/parser.js +969 -0
  187. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/parse/parser.mjs +967 -0
  188. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/public-api.js +68 -0
  189. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/public-api.mjs +64 -0
  190. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/Schema.js +39 -0
  191. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/Schema.mjs +37 -0
  192. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/common/map.js +19 -0
  193. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/common/map.mjs +17 -0
  194. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/common/null.js +17 -0
  195. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/common/null.mjs +15 -0
  196. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/common/seq.js +19 -0
  197. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/common/seq.mjs +17 -0
  198. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/common/string.js +16 -0
  199. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/common/string.mjs +14 -0
  200. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/core/bool.js +21 -0
  201. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/core/bool.mjs +19 -0
  202. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/core/float.js +47 -0
  203. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/core/float.mjs +43 -0
  204. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/core/int.js +42 -0
  205. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/core/int.mjs +38 -0
  206. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/core/schema.js +25 -0
  207. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/core/schema.mjs +23 -0
  208. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/json/schema.js +64 -0
  209. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/json/schema.mjs +62 -0
  210. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/tags.js +99 -0
  211. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/tags.mjs +96 -0
  212. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +60 -0
  213. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.mjs +58 -0
  214. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js +29 -0
  215. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.mjs +26 -0
  216. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/float.js +50 -0
  217. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/float.mjs +46 -0
  218. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/int.js +76 -0
  219. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/int.mjs +71 -0
  220. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/merge.js +68 -0
  221. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/merge.mjs +64 -0
  222. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js +77 -0
  223. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.mjs +74 -0
  224. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +82 -0
  225. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.mjs +78 -0
  226. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js +41 -0
  227. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.mjs +39 -0
  228. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js +96 -0
  229. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/set.mjs +93 -0
  230. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js +105 -0
  231. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.mjs +101 -0
  232. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/stringify/foldFlowLines.js +151 -0
  233. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/stringify/foldFlowLines.mjs +146 -0
  234. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/stringify/stringify.js +131 -0
  235. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/stringify/stringify.mjs +128 -0
  236. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/stringify/stringifyCollection.js +145 -0
  237. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/stringify/stringifyCollection.mjs +143 -0
  238. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/stringify/stringifyComment.js +24 -0
  239. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/stringify/stringifyComment.mjs +20 -0
  240. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/stringify/stringifyDocument.js +87 -0
  241. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/stringify/stringifyDocument.mjs +85 -0
  242. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/stringify/stringifyNumber.js +26 -0
  243. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/stringify/stringifyNumber.mjs +24 -0
  244. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/stringify/stringifyPair.js +152 -0
  245. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/stringify/stringifyPair.mjs +150 -0
  246. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/stringify/stringifyString.js +338 -0
  247. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/stringify/stringifyString.mjs +336 -0
  248. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/visit.js +148 -0
  249. package/dist/node_modules/.pnpm/yaml@2.8.2/node_modules/yaml/browser/dist/visit.mjs +146 -0
  250. package/package.json +6 -4
@@ -0,0 +1,969 @@
1
+ 'use strict';
2
+
3
+ var cst = require('./cst.js');
4
+ var lexer = require('./lexer.js');
5
+
6
+ function includesToken(list, type) {
7
+ for (let i = 0; i < list.length; ++i)
8
+ if (list[i].type === type)
9
+ return true;
10
+ return false;
11
+ }
12
+ function findNonEmptyIndex(list) {
13
+ for (let i = 0; i < list.length; ++i) {
14
+ switch (list[i].type) {
15
+ case 'space':
16
+ case 'comment':
17
+ case 'newline':
18
+ break;
19
+ default:
20
+ return i;
21
+ }
22
+ }
23
+ return -1;
24
+ }
25
+ function isFlowToken(token) {
26
+ switch (token?.type) {
27
+ case 'alias':
28
+ case 'scalar':
29
+ case 'single-quoted-scalar':
30
+ case 'double-quoted-scalar':
31
+ case 'flow-collection':
32
+ return true;
33
+ default:
34
+ return false;
35
+ }
36
+ }
37
+ function getPrevProps(parent) {
38
+ switch (parent.type) {
39
+ case 'document':
40
+ return parent.start;
41
+ case 'block-map': {
42
+ const it = parent.items[parent.items.length - 1];
43
+ return it.sep ?? it.start;
44
+ }
45
+ case 'block-seq':
46
+ return parent.items[parent.items.length - 1].start;
47
+ /* istanbul ignore next should not happen */
48
+ default:
49
+ return [];
50
+ }
51
+ }
52
+ /** Note: May modify input array */
53
+ function getFirstKeyStartProps(prev) {
54
+ if (prev.length === 0)
55
+ return [];
56
+ let i = prev.length;
57
+ loop: while (--i >= 0) {
58
+ switch (prev[i].type) {
59
+ case 'doc-start':
60
+ case 'explicit-key-ind':
61
+ case 'map-value-ind':
62
+ case 'seq-item-ind':
63
+ case 'newline':
64
+ break loop;
65
+ }
66
+ }
67
+ while (prev[++i]?.type === 'space') {
68
+ /* loop */
69
+ }
70
+ return prev.splice(i, prev.length);
71
+ }
72
+ function fixFlowSeqItems(fc) {
73
+ if (fc.start.type === 'flow-seq-start') {
74
+ for (const it of fc.items) {
75
+ if (it.sep &&
76
+ !it.value &&
77
+ !includesToken(it.start, 'explicit-key-ind') &&
78
+ !includesToken(it.sep, 'map-value-ind')) {
79
+ if (it.key)
80
+ it.value = it.key;
81
+ delete it.key;
82
+ if (isFlowToken(it.value)) {
83
+ if (it.value.end)
84
+ Array.prototype.push.apply(it.value.end, it.sep);
85
+ else
86
+ it.value.end = it.sep;
87
+ }
88
+ else
89
+ Array.prototype.push.apply(it.start, it.sep);
90
+ delete it.sep;
91
+ }
92
+ }
93
+ }
94
+ }
95
+ /**
96
+ * A YAML concrete syntax tree (CST) parser
97
+ *
98
+ * ```ts
99
+ * const src: string = ...
100
+ * for (const token of new Parser().parse(src)) {
101
+ * // token: Token
102
+ * }
103
+ * ```
104
+ *
105
+ * To use the parser with a user-provided lexer:
106
+ *
107
+ * ```ts
108
+ * function* parse(source: string, lexer: Lexer) {
109
+ * const parser = new Parser()
110
+ * for (const lexeme of lexer.lex(source))
111
+ * yield* parser.next(lexeme)
112
+ * yield* parser.end()
113
+ * }
114
+ *
115
+ * const src: string = ...
116
+ * const lexer = new Lexer()
117
+ * for (const token of parse(src, lexer)) {
118
+ * // token: Token
119
+ * }
120
+ * ```
121
+ */
122
+ class Parser {
123
+ /**
124
+ * @param onNewLine - If defined, called separately with the start position of
125
+ * each new line (in `parse()`, including the start of input).
126
+ */
127
+ constructor(onNewLine) {
128
+ /** If true, space and sequence indicators count as indentation */
129
+ this.atNewLine = true;
130
+ /** If true, next token is a scalar value */
131
+ this.atScalar = false;
132
+ /** Current indentation level */
133
+ this.indent = 0;
134
+ /** Current offset since the start of parsing */
135
+ this.offset = 0;
136
+ /** On the same line with a block map key */
137
+ this.onKeyLine = false;
138
+ /** Top indicates the node that's currently being built */
139
+ this.stack = [];
140
+ /** The source of the current token, set in parse() */
141
+ this.source = '';
142
+ /** The type of the current token, set in parse() */
143
+ this.type = '';
144
+ // Must be defined after `next()`
145
+ this.lexer = new lexer.Lexer();
146
+ this.onNewLine = onNewLine;
147
+ }
148
+ /**
149
+ * Parse `source` as a YAML stream.
150
+ * If `incomplete`, a part of the last line may be left as a buffer for the next call.
151
+ *
152
+ * Errors are not thrown, but yielded as `{ type: 'error', message }` tokens.
153
+ *
154
+ * @returns A generator of tokens representing each directive, document, and other structure.
155
+ */
156
+ *parse(source, incomplete = false) {
157
+ if (this.onNewLine && this.offset === 0)
158
+ this.onNewLine(0);
159
+ for (const lexeme of this.lexer.lex(source, incomplete))
160
+ yield* this.next(lexeme);
161
+ if (!incomplete)
162
+ yield* this.end();
163
+ }
164
+ /**
165
+ * Advance the parser by the `source` of one lexical token.
166
+ */
167
+ *next(source) {
168
+ this.source = source;
169
+ if (this.atScalar) {
170
+ this.atScalar = false;
171
+ yield* this.step();
172
+ this.offset += source.length;
173
+ return;
174
+ }
175
+ const type = cst.tokenType(source);
176
+ if (!type) {
177
+ const message = `Not a YAML token: ${source}`;
178
+ yield* this.pop({ type: 'error', offset: this.offset, message, source });
179
+ this.offset += source.length;
180
+ }
181
+ else if (type === 'scalar') {
182
+ this.atNewLine = false;
183
+ this.atScalar = true;
184
+ this.type = 'scalar';
185
+ }
186
+ else {
187
+ this.type = type;
188
+ yield* this.step();
189
+ switch (type) {
190
+ case 'newline':
191
+ this.atNewLine = true;
192
+ this.indent = 0;
193
+ if (this.onNewLine)
194
+ this.onNewLine(this.offset + source.length);
195
+ break;
196
+ case 'space':
197
+ if (this.atNewLine && source[0] === ' ')
198
+ this.indent += source.length;
199
+ break;
200
+ case 'explicit-key-ind':
201
+ case 'map-value-ind':
202
+ case 'seq-item-ind':
203
+ if (this.atNewLine)
204
+ this.indent += source.length;
205
+ break;
206
+ case 'doc-mode':
207
+ case 'flow-error-end':
208
+ return;
209
+ default:
210
+ this.atNewLine = false;
211
+ }
212
+ this.offset += source.length;
213
+ }
214
+ }
215
+ /** Call at end of input to push out any remaining constructions */
216
+ *end() {
217
+ while (this.stack.length > 0)
218
+ yield* this.pop();
219
+ }
220
+ get sourceToken() {
221
+ const st = {
222
+ type: this.type,
223
+ offset: this.offset,
224
+ indent: this.indent,
225
+ source: this.source
226
+ };
227
+ return st;
228
+ }
229
+ *step() {
230
+ const top = this.peek(1);
231
+ if (this.type === 'doc-end' && top?.type !== 'doc-end') {
232
+ while (this.stack.length > 0)
233
+ yield* this.pop();
234
+ this.stack.push({
235
+ type: 'doc-end',
236
+ offset: this.offset,
237
+ source: this.source
238
+ });
239
+ return;
240
+ }
241
+ if (!top)
242
+ return yield* this.stream();
243
+ switch (top.type) {
244
+ case 'document':
245
+ return yield* this.document(top);
246
+ case 'alias':
247
+ case 'scalar':
248
+ case 'single-quoted-scalar':
249
+ case 'double-quoted-scalar':
250
+ return yield* this.scalar(top);
251
+ case 'block-scalar':
252
+ return yield* this.blockScalar(top);
253
+ case 'block-map':
254
+ return yield* this.blockMap(top);
255
+ case 'block-seq':
256
+ return yield* this.blockSequence(top);
257
+ case 'flow-collection':
258
+ return yield* this.flowCollection(top);
259
+ case 'doc-end':
260
+ return yield* this.documentEnd(top);
261
+ }
262
+ /* istanbul ignore next should not happen */
263
+ yield* this.pop();
264
+ }
265
+ peek(n) {
266
+ return this.stack[this.stack.length - n];
267
+ }
268
+ *pop(error) {
269
+ const token = error ?? this.stack.pop();
270
+ /* istanbul ignore if should not happen */
271
+ if (!token) {
272
+ const message = 'Tried to pop an empty stack';
273
+ yield { type: 'error', offset: this.offset, source: '', message };
274
+ }
275
+ else if (this.stack.length === 0) {
276
+ yield token;
277
+ }
278
+ else {
279
+ const top = this.peek(1);
280
+ if (token.type === 'block-scalar') {
281
+ // Block scalars use their parent rather than header indent
282
+ token.indent = 'indent' in top ? top.indent : 0;
283
+ }
284
+ else if (token.type === 'flow-collection' && top.type === 'document') {
285
+ // Ignore all indent for top-level flow collections
286
+ token.indent = 0;
287
+ }
288
+ if (token.type === 'flow-collection')
289
+ fixFlowSeqItems(token);
290
+ switch (top.type) {
291
+ case 'document':
292
+ top.value = token;
293
+ break;
294
+ case 'block-scalar':
295
+ top.props.push(token); // error
296
+ break;
297
+ case 'block-map': {
298
+ const it = top.items[top.items.length - 1];
299
+ if (it.value) {
300
+ top.items.push({ start: [], key: token, sep: [] });
301
+ this.onKeyLine = true;
302
+ return;
303
+ }
304
+ else if (it.sep) {
305
+ it.value = token;
306
+ }
307
+ else {
308
+ Object.assign(it, { key: token, sep: [] });
309
+ this.onKeyLine = !it.explicitKey;
310
+ return;
311
+ }
312
+ break;
313
+ }
314
+ case 'block-seq': {
315
+ const it = top.items[top.items.length - 1];
316
+ if (it.value)
317
+ top.items.push({ start: [], value: token });
318
+ else
319
+ it.value = token;
320
+ break;
321
+ }
322
+ case 'flow-collection': {
323
+ const it = top.items[top.items.length - 1];
324
+ if (!it || it.value)
325
+ top.items.push({ start: [], key: token, sep: [] });
326
+ else if (it.sep)
327
+ it.value = token;
328
+ else
329
+ Object.assign(it, { key: token, sep: [] });
330
+ return;
331
+ }
332
+ /* istanbul ignore next should not happen */
333
+ default:
334
+ yield* this.pop();
335
+ yield* this.pop(token);
336
+ }
337
+ if ((top.type === 'document' ||
338
+ top.type === 'block-map' ||
339
+ top.type === 'block-seq') &&
340
+ (token.type === 'block-map' || token.type === 'block-seq')) {
341
+ const last = token.items[token.items.length - 1];
342
+ if (last &&
343
+ !last.sep &&
344
+ !last.value &&
345
+ last.start.length > 0 &&
346
+ findNonEmptyIndex(last.start) === -1 &&
347
+ (token.indent === 0 ||
348
+ last.start.every(st => st.type !== 'comment' || st.indent < token.indent))) {
349
+ if (top.type === 'document')
350
+ top.end = last.start;
351
+ else
352
+ top.items.push({ start: last.start });
353
+ token.items.splice(-1, 1);
354
+ }
355
+ }
356
+ }
357
+ }
358
+ *stream() {
359
+ switch (this.type) {
360
+ case 'directive-line':
361
+ yield { type: 'directive', offset: this.offset, source: this.source };
362
+ return;
363
+ case 'byte-order-mark':
364
+ case 'space':
365
+ case 'comment':
366
+ case 'newline':
367
+ yield this.sourceToken;
368
+ return;
369
+ case 'doc-mode':
370
+ case 'doc-start': {
371
+ const doc = {
372
+ type: 'document',
373
+ offset: this.offset,
374
+ start: []
375
+ };
376
+ if (this.type === 'doc-start')
377
+ doc.start.push(this.sourceToken);
378
+ this.stack.push(doc);
379
+ return;
380
+ }
381
+ }
382
+ yield {
383
+ type: 'error',
384
+ offset: this.offset,
385
+ message: `Unexpected ${this.type} token in YAML stream`,
386
+ source: this.source
387
+ };
388
+ }
389
+ *document(doc) {
390
+ if (doc.value)
391
+ return yield* this.lineEnd(doc);
392
+ switch (this.type) {
393
+ case 'doc-start': {
394
+ if (findNonEmptyIndex(doc.start) !== -1) {
395
+ yield* this.pop();
396
+ yield* this.step();
397
+ }
398
+ else
399
+ doc.start.push(this.sourceToken);
400
+ return;
401
+ }
402
+ case 'anchor':
403
+ case 'tag':
404
+ case 'space':
405
+ case 'comment':
406
+ case 'newline':
407
+ doc.start.push(this.sourceToken);
408
+ return;
409
+ }
410
+ const bv = this.startBlockValue(doc);
411
+ if (bv)
412
+ this.stack.push(bv);
413
+ else {
414
+ yield {
415
+ type: 'error',
416
+ offset: this.offset,
417
+ message: `Unexpected ${this.type} token in YAML document`,
418
+ source: this.source
419
+ };
420
+ }
421
+ }
422
+ *scalar(scalar) {
423
+ if (this.type === 'map-value-ind') {
424
+ const prev = getPrevProps(this.peek(2));
425
+ const start = getFirstKeyStartProps(prev);
426
+ let sep;
427
+ if (scalar.end) {
428
+ sep = scalar.end;
429
+ sep.push(this.sourceToken);
430
+ delete scalar.end;
431
+ }
432
+ else
433
+ sep = [this.sourceToken];
434
+ const map = {
435
+ type: 'block-map',
436
+ offset: scalar.offset,
437
+ indent: scalar.indent,
438
+ items: [{ start, key: scalar, sep }]
439
+ };
440
+ this.onKeyLine = true;
441
+ this.stack[this.stack.length - 1] = map;
442
+ }
443
+ else
444
+ yield* this.lineEnd(scalar);
445
+ }
446
+ *blockScalar(scalar) {
447
+ switch (this.type) {
448
+ case 'space':
449
+ case 'comment':
450
+ case 'newline':
451
+ scalar.props.push(this.sourceToken);
452
+ return;
453
+ case 'scalar':
454
+ scalar.source = this.source;
455
+ // block-scalar source includes trailing newline
456
+ this.atNewLine = true;
457
+ this.indent = 0;
458
+ if (this.onNewLine) {
459
+ let nl = this.source.indexOf('\n') + 1;
460
+ while (nl !== 0) {
461
+ this.onNewLine(this.offset + nl);
462
+ nl = this.source.indexOf('\n', nl) + 1;
463
+ }
464
+ }
465
+ yield* this.pop();
466
+ break;
467
+ /* istanbul ignore next should not happen */
468
+ default:
469
+ yield* this.pop();
470
+ yield* this.step();
471
+ }
472
+ }
473
+ *blockMap(map) {
474
+ const it = map.items[map.items.length - 1];
475
+ // it.sep is true-ish if pair already has key or : separator
476
+ switch (this.type) {
477
+ case 'newline':
478
+ this.onKeyLine = false;
479
+ if (it.value) {
480
+ const end = 'end' in it.value ? it.value.end : undefined;
481
+ const last = Array.isArray(end) ? end[end.length - 1] : undefined;
482
+ if (last?.type === 'comment')
483
+ end?.push(this.sourceToken);
484
+ else
485
+ map.items.push({ start: [this.sourceToken] });
486
+ }
487
+ else if (it.sep) {
488
+ it.sep.push(this.sourceToken);
489
+ }
490
+ else {
491
+ it.start.push(this.sourceToken);
492
+ }
493
+ return;
494
+ case 'space':
495
+ case 'comment':
496
+ if (it.value) {
497
+ map.items.push({ start: [this.sourceToken] });
498
+ }
499
+ else if (it.sep) {
500
+ it.sep.push(this.sourceToken);
501
+ }
502
+ else {
503
+ if (this.atIndentedComment(it.start, map.indent)) {
504
+ const prev = map.items[map.items.length - 2];
505
+ const end = prev?.value?.end;
506
+ if (Array.isArray(end)) {
507
+ Array.prototype.push.apply(end, it.start);
508
+ end.push(this.sourceToken);
509
+ map.items.pop();
510
+ return;
511
+ }
512
+ }
513
+ it.start.push(this.sourceToken);
514
+ }
515
+ return;
516
+ }
517
+ if (this.indent >= map.indent) {
518
+ const atMapIndent = !this.onKeyLine && this.indent === map.indent;
519
+ const atNextItem = atMapIndent &&
520
+ (it.sep || it.explicitKey) &&
521
+ this.type !== 'seq-item-ind';
522
+ // For empty nodes, assign newline-separated not indented empty tokens to following node
523
+ let start = [];
524
+ if (atNextItem && it.sep && !it.value) {
525
+ const nl = [];
526
+ for (let i = 0; i < it.sep.length; ++i) {
527
+ const st = it.sep[i];
528
+ switch (st.type) {
529
+ case 'newline':
530
+ nl.push(i);
531
+ break;
532
+ case 'space':
533
+ break;
534
+ case 'comment':
535
+ if (st.indent > map.indent)
536
+ nl.length = 0;
537
+ break;
538
+ default:
539
+ nl.length = 0;
540
+ }
541
+ }
542
+ if (nl.length >= 2)
543
+ start = it.sep.splice(nl[1]);
544
+ }
545
+ switch (this.type) {
546
+ case 'anchor':
547
+ case 'tag':
548
+ if (atNextItem || it.value) {
549
+ start.push(this.sourceToken);
550
+ map.items.push({ start });
551
+ this.onKeyLine = true;
552
+ }
553
+ else if (it.sep) {
554
+ it.sep.push(this.sourceToken);
555
+ }
556
+ else {
557
+ it.start.push(this.sourceToken);
558
+ }
559
+ return;
560
+ case 'explicit-key-ind':
561
+ if (!it.sep && !it.explicitKey) {
562
+ it.start.push(this.sourceToken);
563
+ it.explicitKey = true;
564
+ }
565
+ else if (atNextItem || it.value) {
566
+ start.push(this.sourceToken);
567
+ map.items.push({ start, explicitKey: true });
568
+ }
569
+ else {
570
+ this.stack.push({
571
+ type: 'block-map',
572
+ offset: this.offset,
573
+ indent: this.indent,
574
+ items: [{ start: [this.sourceToken], explicitKey: true }]
575
+ });
576
+ }
577
+ this.onKeyLine = true;
578
+ return;
579
+ case 'map-value-ind':
580
+ if (it.explicitKey) {
581
+ if (!it.sep) {
582
+ if (includesToken(it.start, 'newline')) {
583
+ Object.assign(it, { key: null, sep: [this.sourceToken] });
584
+ }
585
+ else {
586
+ const start = getFirstKeyStartProps(it.start);
587
+ this.stack.push({
588
+ type: 'block-map',
589
+ offset: this.offset,
590
+ indent: this.indent,
591
+ items: [{ start, key: null, sep: [this.sourceToken] }]
592
+ });
593
+ }
594
+ }
595
+ else if (it.value) {
596
+ map.items.push({ start: [], key: null, sep: [this.sourceToken] });
597
+ }
598
+ else if (includesToken(it.sep, 'map-value-ind')) {
599
+ this.stack.push({
600
+ type: 'block-map',
601
+ offset: this.offset,
602
+ indent: this.indent,
603
+ items: [{ start, key: null, sep: [this.sourceToken] }]
604
+ });
605
+ }
606
+ else if (isFlowToken(it.key) &&
607
+ !includesToken(it.sep, 'newline')) {
608
+ const start = getFirstKeyStartProps(it.start);
609
+ const key = it.key;
610
+ const sep = it.sep;
611
+ sep.push(this.sourceToken);
612
+ // @ts-expect-error type guard is wrong here
613
+ delete it.key;
614
+ // @ts-expect-error type guard is wrong here
615
+ delete it.sep;
616
+ this.stack.push({
617
+ type: 'block-map',
618
+ offset: this.offset,
619
+ indent: this.indent,
620
+ items: [{ start, key, sep }]
621
+ });
622
+ }
623
+ else if (start.length > 0) {
624
+ // Not actually at next item
625
+ it.sep = it.sep.concat(start, this.sourceToken);
626
+ }
627
+ else {
628
+ it.sep.push(this.sourceToken);
629
+ }
630
+ }
631
+ else {
632
+ if (!it.sep) {
633
+ Object.assign(it, { key: null, sep: [this.sourceToken] });
634
+ }
635
+ else if (it.value || atNextItem) {
636
+ map.items.push({ start, key: null, sep: [this.sourceToken] });
637
+ }
638
+ else if (includesToken(it.sep, 'map-value-ind')) {
639
+ this.stack.push({
640
+ type: 'block-map',
641
+ offset: this.offset,
642
+ indent: this.indent,
643
+ items: [{ start: [], key: null, sep: [this.sourceToken] }]
644
+ });
645
+ }
646
+ else {
647
+ it.sep.push(this.sourceToken);
648
+ }
649
+ }
650
+ this.onKeyLine = true;
651
+ return;
652
+ case 'alias':
653
+ case 'scalar':
654
+ case 'single-quoted-scalar':
655
+ case 'double-quoted-scalar': {
656
+ const fs = this.flowScalar(this.type);
657
+ if (atNextItem || it.value) {
658
+ map.items.push({ start, key: fs, sep: [] });
659
+ this.onKeyLine = true;
660
+ }
661
+ else if (it.sep) {
662
+ this.stack.push(fs);
663
+ }
664
+ else {
665
+ Object.assign(it, { key: fs, sep: [] });
666
+ this.onKeyLine = true;
667
+ }
668
+ return;
669
+ }
670
+ default: {
671
+ const bv = this.startBlockValue(map);
672
+ if (bv) {
673
+ if (bv.type === 'block-seq') {
674
+ if (!it.explicitKey &&
675
+ it.sep &&
676
+ !includesToken(it.sep, 'newline')) {
677
+ yield* this.pop({
678
+ type: 'error',
679
+ offset: this.offset,
680
+ message: 'Unexpected block-seq-ind on same line with key',
681
+ source: this.source
682
+ });
683
+ return;
684
+ }
685
+ }
686
+ else if (atMapIndent) {
687
+ map.items.push({ start });
688
+ }
689
+ this.stack.push(bv);
690
+ return;
691
+ }
692
+ }
693
+ }
694
+ }
695
+ yield* this.pop();
696
+ yield* this.step();
697
+ }
698
+ *blockSequence(seq) {
699
+ const it = seq.items[seq.items.length - 1];
700
+ switch (this.type) {
701
+ case 'newline':
702
+ if (it.value) {
703
+ const end = 'end' in it.value ? it.value.end : undefined;
704
+ const last = Array.isArray(end) ? end[end.length - 1] : undefined;
705
+ if (last?.type === 'comment')
706
+ end?.push(this.sourceToken);
707
+ else
708
+ seq.items.push({ start: [this.sourceToken] });
709
+ }
710
+ else
711
+ it.start.push(this.sourceToken);
712
+ return;
713
+ case 'space':
714
+ case 'comment':
715
+ if (it.value)
716
+ seq.items.push({ start: [this.sourceToken] });
717
+ else {
718
+ if (this.atIndentedComment(it.start, seq.indent)) {
719
+ const prev = seq.items[seq.items.length - 2];
720
+ const end = prev?.value?.end;
721
+ if (Array.isArray(end)) {
722
+ Array.prototype.push.apply(end, it.start);
723
+ end.push(this.sourceToken);
724
+ seq.items.pop();
725
+ return;
726
+ }
727
+ }
728
+ it.start.push(this.sourceToken);
729
+ }
730
+ return;
731
+ case 'anchor':
732
+ case 'tag':
733
+ if (it.value || this.indent <= seq.indent)
734
+ break;
735
+ it.start.push(this.sourceToken);
736
+ return;
737
+ case 'seq-item-ind':
738
+ if (this.indent !== seq.indent)
739
+ break;
740
+ if (it.value || includesToken(it.start, 'seq-item-ind'))
741
+ seq.items.push({ start: [this.sourceToken] });
742
+ else
743
+ it.start.push(this.sourceToken);
744
+ return;
745
+ }
746
+ if (this.indent > seq.indent) {
747
+ const bv = this.startBlockValue(seq);
748
+ if (bv) {
749
+ this.stack.push(bv);
750
+ return;
751
+ }
752
+ }
753
+ yield* this.pop();
754
+ yield* this.step();
755
+ }
756
+ *flowCollection(fc) {
757
+ const it = fc.items[fc.items.length - 1];
758
+ if (this.type === 'flow-error-end') {
759
+ let top;
760
+ do {
761
+ yield* this.pop();
762
+ top = this.peek(1);
763
+ } while (top?.type === 'flow-collection');
764
+ }
765
+ else if (fc.end.length === 0) {
766
+ switch (this.type) {
767
+ case 'comma':
768
+ case 'explicit-key-ind':
769
+ if (!it || it.sep)
770
+ fc.items.push({ start: [this.sourceToken] });
771
+ else
772
+ it.start.push(this.sourceToken);
773
+ return;
774
+ case 'map-value-ind':
775
+ if (!it || it.value)
776
+ fc.items.push({ start: [], key: null, sep: [this.sourceToken] });
777
+ else if (it.sep)
778
+ it.sep.push(this.sourceToken);
779
+ else
780
+ Object.assign(it, { key: null, sep: [this.sourceToken] });
781
+ return;
782
+ case 'space':
783
+ case 'comment':
784
+ case 'newline':
785
+ case 'anchor':
786
+ case 'tag':
787
+ if (!it || it.value)
788
+ fc.items.push({ start: [this.sourceToken] });
789
+ else if (it.sep)
790
+ it.sep.push(this.sourceToken);
791
+ else
792
+ it.start.push(this.sourceToken);
793
+ return;
794
+ case 'alias':
795
+ case 'scalar':
796
+ case 'single-quoted-scalar':
797
+ case 'double-quoted-scalar': {
798
+ const fs = this.flowScalar(this.type);
799
+ if (!it || it.value)
800
+ fc.items.push({ start: [], key: fs, sep: [] });
801
+ else if (it.sep)
802
+ this.stack.push(fs);
803
+ else
804
+ Object.assign(it, { key: fs, sep: [] });
805
+ return;
806
+ }
807
+ case 'flow-map-end':
808
+ case 'flow-seq-end':
809
+ fc.end.push(this.sourceToken);
810
+ return;
811
+ }
812
+ const bv = this.startBlockValue(fc);
813
+ /* istanbul ignore else should not happen */
814
+ if (bv)
815
+ this.stack.push(bv);
816
+ else {
817
+ yield* this.pop();
818
+ yield* this.step();
819
+ }
820
+ }
821
+ else {
822
+ const parent = this.peek(2);
823
+ if (parent.type === 'block-map' &&
824
+ ((this.type === 'map-value-ind' && parent.indent === fc.indent) ||
825
+ (this.type === 'newline' &&
826
+ !parent.items[parent.items.length - 1].sep))) {
827
+ yield* this.pop();
828
+ yield* this.step();
829
+ }
830
+ else if (this.type === 'map-value-ind' &&
831
+ parent.type !== 'flow-collection') {
832
+ const prev = getPrevProps(parent);
833
+ const start = getFirstKeyStartProps(prev);
834
+ fixFlowSeqItems(fc);
835
+ const sep = fc.end.splice(1, fc.end.length);
836
+ sep.push(this.sourceToken);
837
+ const map = {
838
+ type: 'block-map',
839
+ offset: fc.offset,
840
+ indent: fc.indent,
841
+ items: [{ start, key: fc, sep }]
842
+ };
843
+ this.onKeyLine = true;
844
+ this.stack[this.stack.length - 1] = map;
845
+ }
846
+ else {
847
+ yield* this.lineEnd(fc);
848
+ }
849
+ }
850
+ }
851
+ flowScalar(type) {
852
+ if (this.onNewLine) {
853
+ let nl = this.source.indexOf('\n') + 1;
854
+ while (nl !== 0) {
855
+ this.onNewLine(this.offset + nl);
856
+ nl = this.source.indexOf('\n', nl) + 1;
857
+ }
858
+ }
859
+ return {
860
+ type,
861
+ offset: this.offset,
862
+ indent: this.indent,
863
+ source: this.source
864
+ };
865
+ }
866
+ startBlockValue(parent) {
867
+ switch (this.type) {
868
+ case 'alias':
869
+ case 'scalar':
870
+ case 'single-quoted-scalar':
871
+ case 'double-quoted-scalar':
872
+ return this.flowScalar(this.type);
873
+ case 'block-scalar-header':
874
+ return {
875
+ type: 'block-scalar',
876
+ offset: this.offset,
877
+ indent: this.indent,
878
+ props: [this.sourceToken],
879
+ source: ''
880
+ };
881
+ case 'flow-map-start':
882
+ case 'flow-seq-start':
883
+ return {
884
+ type: 'flow-collection',
885
+ offset: this.offset,
886
+ indent: this.indent,
887
+ start: this.sourceToken,
888
+ items: [],
889
+ end: []
890
+ };
891
+ case 'seq-item-ind':
892
+ return {
893
+ type: 'block-seq',
894
+ offset: this.offset,
895
+ indent: this.indent,
896
+ items: [{ start: [this.sourceToken] }]
897
+ };
898
+ case 'explicit-key-ind': {
899
+ this.onKeyLine = true;
900
+ const prev = getPrevProps(parent);
901
+ const start = getFirstKeyStartProps(prev);
902
+ start.push(this.sourceToken);
903
+ return {
904
+ type: 'block-map',
905
+ offset: this.offset,
906
+ indent: this.indent,
907
+ items: [{ start, explicitKey: true }]
908
+ };
909
+ }
910
+ case 'map-value-ind': {
911
+ this.onKeyLine = true;
912
+ const prev = getPrevProps(parent);
913
+ const start = getFirstKeyStartProps(prev);
914
+ return {
915
+ type: 'block-map',
916
+ offset: this.offset,
917
+ indent: this.indent,
918
+ items: [{ start, key: null, sep: [this.sourceToken] }]
919
+ };
920
+ }
921
+ }
922
+ return null;
923
+ }
924
+ atIndentedComment(start, indent) {
925
+ if (this.type !== 'comment')
926
+ return false;
927
+ if (this.indent <= indent)
928
+ return false;
929
+ return start.every(st => st.type === 'newline' || st.type === 'space');
930
+ }
931
+ *documentEnd(docEnd) {
932
+ if (this.type !== 'doc-mode') {
933
+ if (docEnd.end)
934
+ docEnd.end.push(this.sourceToken);
935
+ else
936
+ docEnd.end = [this.sourceToken];
937
+ if (this.type === 'newline')
938
+ yield* this.pop();
939
+ }
940
+ }
941
+ *lineEnd(token) {
942
+ switch (this.type) {
943
+ case 'comma':
944
+ case 'doc-start':
945
+ case 'doc-end':
946
+ case 'flow-seq-end':
947
+ case 'flow-map-end':
948
+ case 'map-value-ind':
949
+ yield* this.pop();
950
+ yield* this.step();
951
+ break;
952
+ case 'newline':
953
+ this.onKeyLine = false;
954
+ // fallthrough
955
+ case 'space':
956
+ case 'comment':
957
+ default:
958
+ // all other values are errors
959
+ if (token.end)
960
+ token.end.push(this.sourceToken);
961
+ else
962
+ token.end = [this.sourceToken];
963
+ if (this.type === 'newline')
964
+ yield* this.pop();
965
+ }
966
+ }
967
+ }
968
+
969
+ exports.Parser = Parser;