@windrun-huaiin/dev-scripts 14.0.0 → 14.1.1

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 +336 -0
  12. package/dist/commands/diaomao-update.mjs +334 -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,131 @@
1
+ 'use strict';
2
+
3
+ var anchors = require('../doc/anchors.js');
4
+ var identity = require('../nodes/identity.js');
5
+ var stringifyComment = require('./stringifyComment.js');
6
+ var stringifyString = require('./stringifyString.js');
7
+
8
+ function createStringifyContext(doc, options) {
9
+ const opt = Object.assign({
10
+ blockQuote: true,
11
+ commentString: stringifyComment.stringifyComment,
12
+ defaultKeyType: null,
13
+ defaultStringType: 'PLAIN',
14
+ directives: null,
15
+ doubleQuotedAsJSON: false,
16
+ doubleQuotedMinMultiLineLength: 40,
17
+ falseStr: 'false',
18
+ flowCollectionPadding: true,
19
+ indentSeq: true,
20
+ lineWidth: 80,
21
+ minContentWidth: 20,
22
+ nullStr: 'null',
23
+ simpleKeys: false,
24
+ singleQuote: null,
25
+ trueStr: 'true',
26
+ verifyAliasOrder: true
27
+ }, doc.schema.toStringOptions, options);
28
+ let inFlow;
29
+ switch (opt.collectionStyle) {
30
+ case 'block':
31
+ inFlow = false;
32
+ break;
33
+ case 'flow':
34
+ inFlow = true;
35
+ break;
36
+ default:
37
+ inFlow = null;
38
+ }
39
+ return {
40
+ anchors: new Set(),
41
+ doc,
42
+ flowCollectionPadding: opt.flowCollectionPadding ? ' ' : '',
43
+ indent: '',
44
+ indentStep: typeof opt.indent === 'number' ? ' '.repeat(opt.indent) : ' ',
45
+ inFlow,
46
+ options: opt
47
+ };
48
+ }
49
+ function getTagObject(tags, item) {
50
+ if (item.tag) {
51
+ const match = tags.filter(t => t.tag === item.tag);
52
+ if (match.length > 0)
53
+ return match.find(t => t.format === item.format) ?? match[0];
54
+ }
55
+ let tagObj = undefined;
56
+ let obj;
57
+ if (identity.isScalar(item)) {
58
+ obj = item.value;
59
+ let match = tags.filter(t => t.identify?.(obj));
60
+ if (match.length > 1) {
61
+ const testMatch = match.filter(t => t.test);
62
+ if (testMatch.length > 0)
63
+ match = testMatch;
64
+ }
65
+ tagObj =
66
+ match.find(t => t.format === item.format) ?? match.find(t => !t.format);
67
+ }
68
+ else {
69
+ obj = item;
70
+ tagObj = tags.find(t => t.nodeClass && obj instanceof t.nodeClass);
71
+ }
72
+ if (!tagObj) {
73
+ const name = obj?.constructor?.name ?? (obj === null ? 'null' : typeof obj);
74
+ throw new Error(`Tag not resolved for ${name} value`);
75
+ }
76
+ return tagObj;
77
+ }
78
+ // needs to be called before value stringifier to allow for circular anchor refs
79
+ function stringifyProps(node, tagObj, { anchors: anchors$1, doc }) {
80
+ if (!doc.directives)
81
+ return '';
82
+ const props = [];
83
+ const anchor = (identity.isScalar(node) || identity.isCollection(node)) && node.anchor;
84
+ if (anchor && anchors.anchorIsValid(anchor)) {
85
+ anchors$1.add(anchor);
86
+ props.push(`&${anchor}`);
87
+ }
88
+ const tag = node.tag ?? (tagObj.default ? null : tagObj.tag);
89
+ if (tag)
90
+ props.push(doc.directives.tagString(tag));
91
+ return props.join(' ');
92
+ }
93
+ function stringify(item, ctx, onComment, onChompKeep) {
94
+ if (identity.isPair(item))
95
+ return item.toString(ctx, onComment, onChompKeep);
96
+ if (identity.isAlias(item)) {
97
+ if (ctx.doc.directives)
98
+ return item.toString(ctx);
99
+ if (ctx.resolvedAliases?.has(item)) {
100
+ throw new TypeError(`Cannot stringify circular structure without alias nodes`);
101
+ }
102
+ else {
103
+ if (ctx.resolvedAliases)
104
+ ctx.resolvedAliases.add(item);
105
+ else
106
+ ctx.resolvedAliases = new Set([item]);
107
+ item = item.resolve(ctx.doc);
108
+ }
109
+ }
110
+ let tagObj = undefined;
111
+ const node = identity.isNode(item)
112
+ ? item
113
+ : ctx.doc.createNode(item, { onTagObj: o => (tagObj = o) });
114
+ tagObj ?? (tagObj = getTagObject(ctx.doc.schema.tags, node));
115
+ const props = stringifyProps(node, tagObj, ctx);
116
+ if (props.length > 0)
117
+ ctx.indentAtStart = (ctx.indentAtStart ?? 0) + props.length + 1;
118
+ const str = typeof tagObj.stringify === 'function'
119
+ ? tagObj.stringify(node, ctx, onComment, onChompKeep)
120
+ : identity.isScalar(node)
121
+ ? stringifyString.stringifyString(node, ctx, onComment, onChompKeep)
122
+ : node.toString(ctx, onComment, onChompKeep);
123
+ if (!props)
124
+ return str;
125
+ return identity.isScalar(node) || str[0] === '{' || str[0] === '['
126
+ ? `${props} ${str}`
127
+ : `${props}\n${ctx.indent}${str}`;
128
+ }
129
+
130
+ exports.createStringifyContext = createStringifyContext;
131
+ exports.stringify = stringify;
@@ -0,0 +1,128 @@
1
+ import { anchorIsValid } from '../doc/anchors.mjs';
2
+ import { isPair, isAlias, isNode, isScalar, isCollection } from '../nodes/identity.mjs';
3
+ import { stringifyComment } from './stringifyComment.mjs';
4
+ import { stringifyString } from './stringifyString.mjs';
5
+
6
+ function createStringifyContext(doc, options) {
7
+ const opt = Object.assign({
8
+ blockQuote: true,
9
+ commentString: stringifyComment,
10
+ defaultKeyType: null,
11
+ defaultStringType: 'PLAIN',
12
+ directives: null,
13
+ doubleQuotedAsJSON: false,
14
+ doubleQuotedMinMultiLineLength: 40,
15
+ falseStr: 'false',
16
+ flowCollectionPadding: true,
17
+ indentSeq: true,
18
+ lineWidth: 80,
19
+ minContentWidth: 20,
20
+ nullStr: 'null',
21
+ simpleKeys: false,
22
+ singleQuote: null,
23
+ trueStr: 'true',
24
+ verifyAliasOrder: true
25
+ }, doc.schema.toStringOptions, options);
26
+ let inFlow;
27
+ switch (opt.collectionStyle) {
28
+ case 'block':
29
+ inFlow = false;
30
+ break;
31
+ case 'flow':
32
+ inFlow = true;
33
+ break;
34
+ default:
35
+ inFlow = null;
36
+ }
37
+ return {
38
+ anchors: new Set(),
39
+ doc,
40
+ flowCollectionPadding: opt.flowCollectionPadding ? ' ' : '',
41
+ indent: '',
42
+ indentStep: typeof opt.indent === 'number' ? ' '.repeat(opt.indent) : ' ',
43
+ inFlow,
44
+ options: opt
45
+ };
46
+ }
47
+ function getTagObject(tags, item) {
48
+ if (item.tag) {
49
+ const match = tags.filter(t => t.tag === item.tag);
50
+ if (match.length > 0)
51
+ return match.find(t => t.format === item.format) ?? match[0];
52
+ }
53
+ let tagObj = undefined;
54
+ let obj;
55
+ if (isScalar(item)) {
56
+ obj = item.value;
57
+ let match = tags.filter(t => t.identify?.(obj));
58
+ if (match.length > 1) {
59
+ const testMatch = match.filter(t => t.test);
60
+ if (testMatch.length > 0)
61
+ match = testMatch;
62
+ }
63
+ tagObj =
64
+ match.find(t => t.format === item.format) ?? match.find(t => !t.format);
65
+ }
66
+ else {
67
+ obj = item;
68
+ tagObj = tags.find(t => t.nodeClass && obj instanceof t.nodeClass);
69
+ }
70
+ if (!tagObj) {
71
+ const name = obj?.constructor?.name ?? (obj === null ? 'null' : typeof obj);
72
+ throw new Error(`Tag not resolved for ${name} value`);
73
+ }
74
+ return tagObj;
75
+ }
76
+ // needs to be called before value stringifier to allow for circular anchor refs
77
+ function stringifyProps(node, tagObj, { anchors, doc }) {
78
+ if (!doc.directives)
79
+ return '';
80
+ const props = [];
81
+ const anchor = (isScalar(node) || isCollection(node)) && node.anchor;
82
+ if (anchor && anchorIsValid(anchor)) {
83
+ anchors.add(anchor);
84
+ props.push(`&${anchor}`);
85
+ }
86
+ const tag = node.tag ?? (tagObj.default ? null : tagObj.tag);
87
+ if (tag)
88
+ props.push(doc.directives.tagString(tag));
89
+ return props.join(' ');
90
+ }
91
+ function stringify(item, ctx, onComment, onChompKeep) {
92
+ if (isPair(item))
93
+ return item.toString(ctx, onComment, onChompKeep);
94
+ if (isAlias(item)) {
95
+ if (ctx.doc.directives)
96
+ return item.toString(ctx);
97
+ if (ctx.resolvedAliases?.has(item)) {
98
+ throw new TypeError(`Cannot stringify circular structure without alias nodes`);
99
+ }
100
+ else {
101
+ if (ctx.resolvedAliases)
102
+ ctx.resolvedAliases.add(item);
103
+ else
104
+ ctx.resolvedAliases = new Set([item]);
105
+ item = item.resolve(ctx.doc);
106
+ }
107
+ }
108
+ let tagObj = undefined;
109
+ const node = isNode(item)
110
+ ? item
111
+ : ctx.doc.createNode(item, { onTagObj: o => (tagObj = o) });
112
+ tagObj ?? (tagObj = getTagObject(ctx.doc.schema.tags, node));
113
+ const props = stringifyProps(node, tagObj, ctx);
114
+ if (props.length > 0)
115
+ ctx.indentAtStart = (ctx.indentAtStart ?? 0) + props.length + 1;
116
+ const str = typeof tagObj.stringify === 'function'
117
+ ? tagObj.stringify(node, ctx, onComment, onChompKeep)
118
+ : isScalar(node)
119
+ ? stringifyString(node, ctx, onComment, onChompKeep)
120
+ : node.toString(ctx, onComment, onChompKeep);
121
+ if (!props)
122
+ return str;
123
+ return isScalar(node) || str[0] === '{' || str[0] === '['
124
+ ? `${props} ${str}`
125
+ : `${props}\n${ctx.indent}${str}`;
126
+ }
127
+
128
+ export { createStringifyContext, stringify };
@@ -0,0 +1,145 @@
1
+ 'use strict';
2
+
3
+ var identity = require('../nodes/identity.js');
4
+ var stringify = require('./stringify.js');
5
+ var stringifyComment = require('./stringifyComment.js');
6
+
7
+ function stringifyCollection(collection, ctx, options) {
8
+ const flow = ctx.inFlow ?? collection.flow;
9
+ const stringify = flow ? stringifyFlowCollection : stringifyBlockCollection;
10
+ return stringify(collection, ctx, options);
11
+ }
12
+ function stringifyBlockCollection({ comment, items }, ctx, { blockItemPrefix, flowChars, itemIndent, onChompKeep, onComment }) {
13
+ const { indent, options: { commentString } } = ctx;
14
+ const itemCtx = Object.assign({}, ctx, { indent: itemIndent, type: null });
15
+ let chompKeep = false; // flag for the preceding node's status
16
+ const lines = [];
17
+ for (let i = 0; i < items.length; ++i) {
18
+ const item = items[i];
19
+ let comment = null;
20
+ if (identity.isNode(item)) {
21
+ if (!chompKeep && item.spaceBefore)
22
+ lines.push('');
23
+ addCommentBefore(ctx, lines, item.commentBefore, chompKeep);
24
+ if (item.comment)
25
+ comment = item.comment;
26
+ }
27
+ else if (identity.isPair(item)) {
28
+ const ik = identity.isNode(item.key) ? item.key : null;
29
+ if (ik) {
30
+ if (!chompKeep && ik.spaceBefore)
31
+ lines.push('');
32
+ addCommentBefore(ctx, lines, ik.commentBefore, chompKeep);
33
+ }
34
+ }
35
+ chompKeep = false;
36
+ let str = stringify.stringify(item, itemCtx, () => (comment = null), () => (chompKeep = true));
37
+ if (comment)
38
+ str += stringifyComment.lineComment(str, itemIndent, commentString(comment));
39
+ if (chompKeep && comment)
40
+ chompKeep = false;
41
+ lines.push(blockItemPrefix + str);
42
+ }
43
+ let str;
44
+ if (lines.length === 0) {
45
+ str = flowChars.start + flowChars.end;
46
+ }
47
+ else {
48
+ str = lines[0];
49
+ for (let i = 1; i < lines.length; ++i) {
50
+ const line = lines[i];
51
+ str += line ? `\n${indent}${line}` : '\n';
52
+ }
53
+ }
54
+ if (comment) {
55
+ str += '\n' + stringifyComment.indentComment(commentString(comment), indent);
56
+ if (onComment)
57
+ onComment();
58
+ }
59
+ else if (chompKeep && onChompKeep)
60
+ onChompKeep();
61
+ return str;
62
+ }
63
+ function stringifyFlowCollection({ items }, ctx, { flowChars, itemIndent }) {
64
+ const { indent, indentStep, flowCollectionPadding: fcPadding, options: { commentString } } = ctx;
65
+ itemIndent += indentStep;
66
+ const itemCtx = Object.assign({}, ctx, {
67
+ indent: itemIndent,
68
+ inFlow: true,
69
+ type: null
70
+ });
71
+ let reqNewline = false;
72
+ let linesAtValue = 0;
73
+ const lines = [];
74
+ for (let i = 0; i < items.length; ++i) {
75
+ const item = items[i];
76
+ let comment = null;
77
+ if (identity.isNode(item)) {
78
+ if (item.spaceBefore)
79
+ lines.push('');
80
+ addCommentBefore(ctx, lines, item.commentBefore, false);
81
+ if (item.comment)
82
+ comment = item.comment;
83
+ }
84
+ else if (identity.isPair(item)) {
85
+ const ik = identity.isNode(item.key) ? item.key : null;
86
+ if (ik) {
87
+ if (ik.spaceBefore)
88
+ lines.push('');
89
+ addCommentBefore(ctx, lines, ik.commentBefore, false);
90
+ if (ik.comment)
91
+ reqNewline = true;
92
+ }
93
+ const iv = identity.isNode(item.value) ? item.value : null;
94
+ if (iv) {
95
+ if (iv.comment)
96
+ comment = iv.comment;
97
+ if (iv.commentBefore)
98
+ reqNewline = true;
99
+ }
100
+ else if (item.value == null && ik?.comment) {
101
+ comment = ik.comment;
102
+ }
103
+ }
104
+ if (comment)
105
+ reqNewline = true;
106
+ let str = stringify.stringify(item, itemCtx, () => (comment = null));
107
+ if (i < items.length - 1)
108
+ str += ',';
109
+ if (comment)
110
+ str += stringifyComment.lineComment(str, itemIndent, commentString(comment));
111
+ if (!reqNewline && (lines.length > linesAtValue || str.includes('\n')))
112
+ reqNewline = true;
113
+ lines.push(str);
114
+ linesAtValue = lines.length;
115
+ }
116
+ const { start, end } = flowChars;
117
+ if (lines.length === 0) {
118
+ return start + end;
119
+ }
120
+ else {
121
+ if (!reqNewline) {
122
+ const len = lines.reduce((sum, line) => sum + line.length + 2, 2);
123
+ reqNewline = ctx.options.lineWidth > 0 && len > ctx.options.lineWidth;
124
+ }
125
+ if (reqNewline) {
126
+ let str = start;
127
+ for (const line of lines)
128
+ str += line ? `\n${indentStep}${indent}${line}` : '\n';
129
+ return `${str}\n${indent}${end}`;
130
+ }
131
+ else {
132
+ return `${start}${fcPadding}${lines.join(' ')}${fcPadding}${end}`;
133
+ }
134
+ }
135
+ }
136
+ function addCommentBefore({ indent, options: { commentString } }, lines, comment, chompKeep) {
137
+ if (comment && chompKeep)
138
+ comment = comment.replace(/^\n+/, '');
139
+ if (comment) {
140
+ const ic = stringifyComment.indentComment(commentString(comment), indent);
141
+ lines.push(ic.trimStart()); // Avoid double indent on first line
142
+ }
143
+ }
144
+
145
+ exports.stringifyCollection = stringifyCollection;
@@ -0,0 +1,143 @@
1
+ import { isNode, isPair } from '../nodes/identity.mjs';
2
+ import { stringify } from './stringify.mjs';
3
+ import { lineComment, indentComment } from './stringifyComment.mjs';
4
+
5
+ function stringifyCollection(collection, ctx, options) {
6
+ const flow = ctx.inFlow ?? collection.flow;
7
+ const stringify = flow ? stringifyFlowCollection : stringifyBlockCollection;
8
+ return stringify(collection, ctx, options);
9
+ }
10
+ function stringifyBlockCollection({ comment, items }, ctx, { blockItemPrefix, flowChars, itemIndent, onChompKeep, onComment }) {
11
+ const { indent, options: { commentString } } = ctx;
12
+ const itemCtx = Object.assign({}, ctx, { indent: itemIndent, type: null });
13
+ let chompKeep = false; // flag for the preceding node's status
14
+ const lines = [];
15
+ for (let i = 0; i < items.length; ++i) {
16
+ const item = items[i];
17
+ let comment = null;
18
+ if (isNode(item)) {
19
+ if (!chompKeep && item.spaceBefore)
20
+ lines.push('');
21
+ addCommentBefore(ctx, lines, item.commentBefore, chompKeep);
22
+ if (item.comment)
23
+ comment = item.comment;
24
+ }
25
+ else if (isPair(item)) {
26
+ const ik = isNode(item.key) ? item.key : null;
27
+ if (ik) {
28
+ if (!chompKeep && ik.spaceBefore)
29
+ lines.push('');
30
+ addCommentBefore(ctx, lines, ik.commentBefore, chompKeep);
31
+ }
32
+ }
33
+ chompKeep = false;
34
+ let str = stringify(item, itemCtx, () => (comment = null), () => (chompKeep = true));
35
+ if (comment)
36
+ str += lineComment(str, itemIndent, commentString(comment));
37
+ if (chompKeep && comment)
38
+ chompKeep = false;
39
+ lines.push(blockItemPrefix + str);
40
+ }
41
+ let str;
42
+ if (lines.length === 0) {
43
+ str = flowChars.start + flowChars.end;
44
+ }
45
+ else {
46
+ str = lines[0];
47
+ for (let i = 1; i < lines.length; ++i) {
48
+ const line = lines[i];
49
+ str += line ? `\n${indent}${line}` : '\n';
50
+ }
51
+ }
52
+ if (comment) {
53
+ str += '\n' + indentComment(commentString(comment), indent);
54
+ if (onComment)
55
+ onComment();
56
+ }
57
+ else if (chompKeep && onChompKeep)
58
+ onChompKeep();
59
+ return str;
60
+ }
61
+ function stringifyFlowCollection({ items }, ctx, { flowChars, itemIndent }) {
62
+ const { indent, indentStep, flowCollectionPadding: fcPadding, options: { commentString } } = ctx;
63
+ itemIndent += indentStep;
64
+ const itemCtx = Object.assign({}, ctx, {
65
+ indent: itemIndent,
66
+ inFlow: true,
67
+ type: null
68
+ });
69
+ let reqNewline = false;
70
+ let linesAtValue = 0;
71
+ const lines = [];
72
+ for (let i = 0; i < items.length; ++i) {
73
+ const item = items[i];
74
+ let comment = null;
75
+ if (isNode(item)) {
76
+ if (item.spaceBefore)
77
+ lines.push('');
78
+ addCommentBefore(ctx, lines, item.commentBefore, false);
79
+ if (item.comment)
80
+ comment = item.comment;
81
+ }
82
+ else if (isPair(item)) {
83
+ const ik = isNode(item.key) ? item.key : null;
84
+ if (ik) {
85
+ if (ik.spaceBefore)
86
+ lines.push('');
87
+ addCommentBefore(ctx, lines, ik.commentBefore, false);
88
+ if (ik.comment)
89
+ reqNewline = true;
90
+ }
91
+ const iv = isNode(item.value) ? item.value : null;
92
+ if (iv) {
93
+ if (iv.comment)
94
+ comment = iv.comment;
95
+ if (iv.commentBefore)
96
+ reqNewline = true;
97
+ }
98
+ else if (item.value == null && ik?.comment) {
99
+ comment = ik.comment;
100
+ }
101
+ }
102
+ if (comment)
103
+ reqNewline = true;
104
+ let str = stringify(item, itemCtx, () => (comment = null));
105
+ if (i < items.length - 1)
106
+ str += ',';
107
+ if (comment)
108
+ str += lineComment(str, itemIndent, commentString(comment));
109
+ if (!reqNewline && (lines.length > linesAtValue || str.includes('\n')))
110
+ reqNewline = true;
111
+ lines.push(str);
112
+ linesAtValue = lines.length;
113
+ }
114
+ const { start, end } = flowChars;
115
+ if (lines.length === 0) {
116
+ return start + end;
117
+ }
118
+ else {
119
+ if (!reqNewline) {
120
+ const len = lines.reduce((sum, line) => sum + line.length + 2, 2);
121
+ reqNewline = ctx.options.lineWidth > 0 && len > ctx.options.lineWidth;
122
+ }
123
+ if (reqNewline) {
124
+ let str = start;
125
+ for (const line of lines)
126
+ str += line ? `\n${indentStep}${indent}${line}` : '\n';
127
+ return `${str}\n${indent}${end}`;
128
+ }
129
+ else {
130
+ return `${start}${fcPadding}${lines.join(' ')}${fcPadding}${end}`;
131
+ }
132
+ }
133
+ }
134
+ function addCommentBefore({ indent, options: { commentString } }, lines, comment, chompKeep) {
135
+ if (comment && chompKeep)
136
+ comment = comment.replace(/^\n+/, '');
137
+ if (comment) {
138
+ const ic = indentComment(commentString(comment), indent);
139
+ lines.push(ic.trimStart()); // Avoid double indent on first line
140
+ }
141
+ }
142
+
143
+ export { stringifyCollection };
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Stringifies a comment.
5
+ *
6
+ * Empty comment lines are left empty,
7
+ * lines consisting of a single space are replaced by `#`,
8
+ * and all other lines are prefixed with a `#`.
9
+ */
10
+ const stringifyComment = (str) => str.replace(/^(?!$)(?: $)?/gm, '#');
11
+ function indentComment(comment, indent) {
12
+ if (/^\n+$/.test(comment))
13
+ return comment.substring(1);
14
+ return indent ? comment.replace(/^(?! *$)/gm, indent) : comment;
15
+ }
16
+ const lineComment = (str, indent, comment) => str.endsWith('\n')
17
+ ? indentComment(comment, indent)
18
+ : comment.includes('\n')
19
+ ? '\n' + indentComment(comment, indent)
20
+ : (str.endsWith(' ') ? '' : ' ') + comment;
21
+
22
+ exports.indentComment = indentComment;
23
+ exports.lineComment = lineComment;
24
+ exports.stringifyComment = stringifyComment;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Stringifies a comment.
3
+ *
4
+ * Empty comment lines are left empty,
5
+ * lines consisting of a single space are replaced by `#`,
6
+ * and all other lines are prefixed with a `#`.
7
+ */
8
+ const stringifyComment = (str) => str.replace(/^(?!$)(?: $)?/gm, '#');
9
+ function indentComment(comment, indent) {
10
+ if (/^\n+$/.test(comment))
11
+ return comment.substring(1);
12
+ return indent ? comment.replace(/^(?! *$)/gm, indent) : comment;
13
+ }
14
+ const lineComment = (str, indent, comment) => str.endsWith('\n')
15
+ ? indentComment(comment, indent)
16
+ : comment.includes('\n')
17
+ ? '\n' + indentComment(comment, indent)
18
+ : (str.endsWith(' ') ? '' : ' ') + comment;
19
+
20
+ export { indentComment, lineComment, stringifyComment };
@@ -0,0 +1,87 @@
1
+ 'use strict';
2
+
3
+ var identity = require('../nodes/identity.js');
4
+ var stringify = require('./stringify.js');
5
+ var stringifyComment = require('./stringifyComment.js');
6
+
7
+ function stringifyDocument(doc, options) {
8
+ const lines = [];
9
+ let hasDirectives = options.directives === true;
10
+ if (options.directives !== false && doc.directives) {
11
+ const dir = doc.directives.toString(doc);
12
+ if (dir) {
13
+ lines.push(dir);
14
+ hasDirectives = true;
15
+ }
16
+ else if (doc.directives.docStart)
17
+ hasDirectives = true;
18
+ }
19
+ if (hasDirectives)
20
+ lines.push('---');
21
+ const ctx = stringify.createStringifyContext(doc, options);
22
+ const { commentString } = ctx.options;
23
+ if (doc.commentBefore) {
24
+ if (lines.length !== 1)
25
+ lines.unshift('');
26
+ const cs = commentString(doc.commentBefore);
27
+ lines.unshift(stringifyComment.indentComment(cs, ''));
28
+ }
29
+ let chompKeep = false;
30
+ let contentComment = null;
31
+ if (doc.contents) {
32
+ if (identity.isNode(doc.contents)) {
33
+ if (doc.contents.spaceBefore && hasDirectives)
34
+ lines.push('');
35
+ if (doc.contents.commentBefore) {
36
+ const cs = commentString(doc.contents.commentBefore);
37
+ lines.push(stringifyComment.indentComment(cs, ''));
38
+ }
39
+ // top-level block scalars need to be indented if followed by a comment
40
+ ctx.forceBlockIndent = !!doc.comment;
41
+ contentComment = doc.contents.comment;
42
+ }
43
+ const onChompKeep = contentComment ? undefined : () => (chompKeep = true);
44
+ let body = stringify.stringify(doc.contents, ctx, () => (contentComment = null), onChompKeep);
45
+ if (contentComment)
46
+ body += stringifyComment.lineComment(body, '', commentString(contentComment));
47
+ if ((body[0] === '|' || body[0] === '>') &&
48
+ lines[lines.length - 1] === '---') {
49
+ // Top-level block scalars with a preceding doc marker ought to use the
50
+ // same line for their header.
51
+ lines[lines.length - 1] = `--- ${body}`;
52
+ }
53
+ else
54
+ lines.push(body);
55
+ }
56
+ else {
57
+ lines.push(stringify.stringify(doc.contents, ctx));
58
+ }
59
+ if (doc.directives?.docEnd) {
60
+ if (doc.comment) {
61
+ const cs = commentString(doc.comment);
62
+ if (cs.includes('\n')) {
63
+ lines.push('...');
64
+ lines.push(stringifyComment.indentComment(cs, ''));
65
+ }
66
+ else {
67
+ lines.push(`... ${cs}`);
68
+ }
69
+ }
70
+ else {
71
+ lines.push('...');
72
+ }
73
+ }
74
+ else {
75
+ let dc = doc.comment;
76
+ if (dc && chompKeep)
77
+ dc = dc.replace(/^\n+/, '');
78
+ if (dc) {
79
+ if ((!chompKeep || contentComment) && lines[lines.length - 1] !== '')
80
+ lines.push('');
81
+ lines.push(stringifyComment.indentComment(commentString(dc), ''));
82
+ }
83
+ }
84
+ return lines.join('\n') + '\n';
85
+ }
86
+
87
+ exports.stringifyDocument = stringifyDocument;