@windrun-huaiin/dev-scripts 13.1.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,90 @@
1
+ 'use strict';
2
+
3
+ var identity = require('../nodes/identity.js');
4
+ var Scalar = require('../nodes/Scalar.js');
5
+ var YAMLMap = require('../nodes/YAMLMap.js');
6
+ var YAMLSeq = require('../nodes/YAMLSeq.js');
7
+ var resolveBlockMap = require('./resolve-block-map.js');
8
+ var resolveBlockSeq = require('./resolve-block-seq.js');
9
+ var resolveFlowCollection = require('./resolve-flow-collection.js');
10
+
11
+ function resolveCollection(CN, ctx, token, onError, tagName, tag) {
12
+ const coll = token.type === 'block-map'
13
+ ? resolveBlockMap.resolveBlockMap(CN, ctx, token, onError, tag)
14
+ : token.type === 'block-seq'
15
+ ? resolveBlockSeq.resolveBlockSeq(CN, ctx, token, onError, tag)
16
+ : resolveFlowCollection.resolveFlowCollection(CN, ctx, token, onError, tag);
17
+ const Coll = coll.constructor;
18
+ // If we got a tagName matching the class, or the tag name is '!',
19
+ // then use the tagName from the node class used to create it.
20
+ if (tagName === '!' || tagName === Coll.tagName) {
21
+ coll.tag = Coll.tagName;
22
+ return coll;
23
+ }
24
+ if (tagName)
25
+ coll.tag = tagName;
26
+ return coll;
27
+ }
28
+ function composeCollection(CN, ctx, token, props, onError) {
29
+ const tagToken = props.tag;
30
+ const tagName = !tagToken
31
+ ? null
32
+ : ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg));
33
+ if (token.type === 'block-seq') {
34
+ const { anchor, newlineAfterProp: nl } = props;
35
+ const lastProp = anchor && tagToken
36
+ ? anchor.offset > tagToken.offset
37
+ ? anchor
38
+ : tagToken
39
+ : (anchor ?? tagToken);
40
+ if (lastProp && (!nl || nl.offset < lastProp.offset)) {
41
+ const message = 'Missing newline after block sequence props';
42
+ onError(lastProp, 'MISSING_CHAR', message);
43
+ }
44
+ }
45
+ const expType = token.type === 'block-map'
46
+ ? 'map'
47
+ : token.type === 'block-seq'
48
+ ? 'seq'
49
+ : token.start.source === '{'
50
+ ? 'map'
51
+ : 'seq';
52
+ // shortcut: check if it's a generic YAMLMap or YAMLSeq
53
+ // before jumping into the custom tag logic.
54
+ if (!tagToken ||
55
+ !tagName ||
56
+ tagName === '!' ||
57
+ (tagName === YAMLMap.YAMLMap.tagName && expType === 'map') ||
58
+ (tagName === YAMLSeq.YAMLSeq.tagName && expType === 'seq')) {
59
+ return resolveCollection(CN, ctx, token, onError, tagName);
60
+ }
61
+ let tag = ctx.schema.tags.find(t => t.tag === tagName && t.collection === expType);
62
+ if (!tag) {
63
+ const kt = ctx.schema.knownTags[tagName];
64
+ if (kt?.collection === expType) {
65
+ ctx.schema.tags.push(Object.assign({}, kt, { default: false }));
66
+ tag = kt;
67
+ }
68
+ else {
69
+ if (kt) {
70
+ onError(tagToken, 'BAD_COLLECTION_TYPE', `${kt.tag} used for ${expType} collection, but expects ${kt.collection ?? 'scalar'}`, true);
71
+ }
72
+ else {
73
+ onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, true);
74
+ }
75
+ return resolveCollection(CN, ctx, token, onError, tagName);
76
+ }
77
+ }
78
+ const coll = resolveCollection(CN, ctx, token, onError, tagName, tag);
79
+ const res = tag.resolve?.(coll, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg), ctx.options) ?? coll;
80
+ const node = identity.isNode(res)
81
+ ? res
82
+ : new Scalar.Scalar(res);
83
+ node.range = coll.range;
84
+ node.tag = tagName;
85
+ if (tag?.format)
86
+ node.format = tag.format;
87
+ return node;
88
+ }
89
+
90
+ exports.composeCollection = composeCollection;
@@ -0,0 +1,88 @@
1
+ import { isNode } from '../nodes/identity.mjs';
2
+ import { Scalar } from '../nodes/Scalar.mjs';
3
+ import { YAMLMap } from '../nodes/YAMLMap.mjs';
4
+ import { YAMLSeq } from '../nodes/YAMLSeq.mjs';
5
+ import { resolveBlockMap } from './resolve-block-map.mjs';
6
+ import { resolveBlockSeq } from './resolve-block-seq.mjs';
7
+ import { resolveFlowCollection } from './resolve-flow-collection.mjs';
8
+
9
+ function resolveCollection(CN, ctx, token, onError, tagName, tag) {
10
+ const coll = token.type === 'block-map'
11
+ ? resolveBlockMap(CN, ctx, token, onError, tag)
12
+ : token.type === 'block-seq'
13
+ ? resolveBlockSeq(CN, ctx, token, onError, tag)
14
+ : resolveFlowCollection(CN, ctx, token, onError, tag);
15
+ const Coll = coll.constructor;
16
+ // If we got a tagName matching the class, or the tag name is '!',
17
+ // then use the tagName from the node class used to create it.
18
+ if (tagName === '!' || tagName === Coll.tagName) {
19
+ coll.tag = Coll.tagName;
20
+ return coll;
21
+ }
22
+ if (tagName)
23
+ coll.tag = tagName;
24
+ return coll;
25
+ }
26
+ function composeCollection(CN, ctx, token, props, onError) {
27
+ const tagToken = props.tag;
28
+ const tagName = !tagToken
29
+ ? null
30
+ : ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg));
31
+ if (token.type === 'block-seq') {
32
+ const { anchor, newlineAfterProp: nl } = props;
33
+ const lastProp = anchor && tagToken
34
+ ? anchor.offset > tagToken.offset
35
+ ? anchor
36
+ : tagToken
37
+ : (anchor ?? tagToken);
38
+ if (lastProp && (!nl || nl.offset < lastProp.offset)) {
39
+ const message = 'Missing newline after block sequence props';
40
+ onError(lastProp, 'MISSING_CHAR', message);
41
+ }
42
+ }
43
+ const expType = token.type === 'block-map'
44
+ ? 'map'
45
+ : token.type === 'block-seq'
46
+ ? 'seq'
47
+ : token.start.source === '{'
48
+ ? 'map'
49
+ : 'seq';
50
+ // shortcut: check if it's a generic YAMLMap or YAMLSeq
51
+ // before jumping into the custom tag logic.
52
+ if (!tagToken ||
53
+ !tagName ||
54
+ tagName === '!' ||
55
+ (tagName === YAMLMap.tagName && expType === 'map') ||
56
+ (tagName === YAMLSeq.tagName && expType === 'seq')) {
57
+ return resolveCollection(CN, ctx, token, onError, tagName);
58
+ }
59
+ let tag = ctx.schema.tags.find(t => t.tag === tagName && t.collection === expType);
60
+ if (!tag) {
61
+ const kt = ctx.schema.knownTags[tagName];
62
+ if (kt?.collection === expType) {
63
+ ctx.schema.tags.push(Object.assign({}, kt, { default: false }));
64
+ tag = kt;
65
+ }
66
+ else {
67
+ if (kt) {
68
+ onError(tagToken, 'BAD_COLLECTION_TYPE', `${kt.tag} used for ${expType} collection, but expects ${kt.collection ?? 'scalar'}`, true);
69
+ }
70
+ else {
71
+ onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, true);
72
+ }
73
+ return resolveCollection(CN, ctx, token, onError, tagName);
74
+ }
75
+ }
76
+ const coll = resolveCollection(CN, ctx, token, onError, tagName, tag);
77
+ const res = tag.resolve?.(coll, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg), ctx.options) ?? coll;
78
+ const node = isNode(res)
79
+ ? res
80
+ : new Scalar(res);
81
+ node.range = coll.range;
82
+ node.tag = tagName;
83
+ if (tag?.format)
84
+ node.format = tag.format;
85
+ return node;
86
+ }
87
+
88
+ export { composeCollection };
@@ -0,0 +1,45 @@
1
+ 'use strict';
2
+
3
+ var Document = require('../doc/Document.js');
4
+ var composeNode = require('./compose-node.js');
5
+ var resolveEnd = require('./resolve-end.js');
6
+ var resolveProps = require('./resolve-props.js');
7
+
8
+ function composeDoc(options, directives, { offset, start, value, end }, onError) {
9
+ const opts = Object.assign({ _directives: directives }, options);
10
+ const doc = new Document.Document(undefined, opts);
11
+ const ctx = {
12
+ atKey: false,
13
+ atRoot: true,
14
+ directives: doc.directives,
15
+ options: doc.options,
16
+ schema: doc.schema
17
+ };
18
+ const props = resolveProps.resolveProps(start, {
19
+ indicator: 'doc-start',
20
+ next: value ?? end?.[0],
21
+ offset,
22
+ onError,
23
+ parentIndent: 0,
24
+ startOnNewline: true
25
+ });
26
+ if (props.found) {
27
+ doc.directives.docStart = true;
28
+ if (value &&
29
+ (value.type === 'block-map' || value.type === 'block-seq') &&
30
+ !props.hasNewline)
31
+ onError(props.end, 'MISSING_CHAR', 'Block collection cannot start on same line with directives-end marker');
32
+ }
33
+ // @ts-expect-error If Contents is set, let's trust the user
34
+ doc.contents = value
35
+ ? composeNode.composeNode(ctx, value, props, onError)
36
+ : composeNode.composeEmptyNode(ctx, props.end, start, null, props, onError);
37
+ const contentEnd = doc.contents.range[2];
38
+ const re = resolveEnd.resolveEnd(end, contentEnd, false, onError);
39
+ if (re.comment)
40
+ doc.comment = re.comment;
41
+ doc.range = [offset, contentEnd, re.offset];
42
+ return doc;
43
+ }
44
+
45
+ exports.composeDoc = composeDoc;
@@ -0,0 +1,43 @@
1
+ import { Document } from '../doc/Document.mjs';
2
+ import { composeNode, composeEmptyNode } from './compose-node.mjs';
3
+ import { resolveEnd } from './resolve-end.mjs';
4
+ import { resolveProps } from './resolve-props.mjs';
5
+
6
+ function composeDoc(options, directives, { offset, start, value, end }, onError) {
7
+ const opts = Object.assign({ _directives: directives }, options);
8
+ const doc = new Document(undefined, opts);
9
+ const ctx = {
10
+ atKey: false,
11
+ atRoot: true,
12
+ directives: doc.directives,
13
+ options: doc.options,
14
+ schema: doc.schema
15
+ };
16
+ const props = resolveProps(start, {
17
+ indicator: 'doc-start',
18
+ next: value ?? end?.[0],
19
+ offset,
20
+ onError,
21
+ parentIndent: 0,
22
+ startOnNewline: true
23
+ });
24
+ if (props.found) {
25
+ doc.directives.docStart = true;
26
+ if (value &&
27
+ (value.type === 'block-map' || value.type === 'block-seq') &&
28
+ !props.hasNewline)
29
+ onError(props.end, 'MISSING_CHAR', 'Block collection cannot start on same line with directives-end marker');
30
+ }
31
+ // @ts-expect-error If Contents is set, let's trust the user
32
+ doc.contents = value
33
+ ? composeNode(ctx, value, props, onError)
34
+ : composeEmptyNode(ctx, props.end, start, null, props, onError);
35
+ const contentEnd = doc.contents.range[2];
36
+ const re = resolveEnd(end, contentEnd, false, onError);
37
+ if (re.comment)
38
+ doc.comment = re.comment;
39
+ doc.range = [offset, contentEnd, re.offset];
40
+ return doc;
41
+ }
42
+
43
+ export { composeDoc };
@@ -0,0 +1,105 @@
1
+ 'use strict';
2
+
3
+ var Alias = require('../nodes/Alias.js');
4
+ var identity = require('../nodes/identity.js');
5
+ var composeCollection = require('./compose-collection.js');
6
+ var composeScalar = require('./compose-scalar.js');
7
+ var resolveEnd = require('./resolve-end.js');
8
+ var utilEmptyScalarPosition = require('./util-empty-scalar-position.js');
9
+
10
+ const CN = { composeNode, composeEmptyNode };
11
+ function composeNode(ctx, token, props, onError) {
12
+ const atKey = ctx.atKey;
13
+ const { spaceBefore, comment, anchor, tag } = props;
14
+ let node;
15
+ let isSrcToken = true;
16
+ switch (token.type) {
17
+ case 'alias':
18
+ node = composeAlias(ctx, token, onError);
19
+ if (anchor || tag)
20
+ onError(token, 'ALIAS_PROPS', 'An alias node must not specify any properties');
21
+ break;
22
+ case 'scalar':
23
+ case 'single-quoted-scalar':
24
+ case 'double-quoted-scalar':
25
+ case 'block-scalar':
26
+ node = composeScalar.composeScalar(ctx, token, tag, onError);
27
+ if (anchor)
28
+ node.anchor = anchor.source.substring(1);
29
+ break;
30
+ case 'block-map':
31
+ case 'block-seq':
32
+ case 'flow-collection':
33
+ node = composeCollection.composeCollection(CN, ctx, token, props, onError);
34
+ if (anchor)
35
+ node.anchor = anchor.source.substring(1);
36
+ break;
37
+ default: {
38
+ const message = token.type === 'error'
39
+ ? token.message
40
+ : `Unsupported token (type: ${token.type})`;
41
+ onError(token, 'UNEXPECTED_TOKEN', message);
42
+ node = composeEmptyNode(ctx, token.offset, undefined, null, props, onError);
43
+ isSrcToken = false;
44
+ }
45
+ }
46
+ if (anchor && node.anchor === '')
47
+ onError(anchor, 'BAD_ALIAS', 'Anchor cannot be an empty string');
48
+ if (atKey &&
49
+ ctx.options.stringKeys &&
50
+ (!identity.isScalar(node) ||
51
+ typeof node.value !== 'string' ||
52
+ (node.tag && node.tag !== 'tag:yaml.org,2002:str'))) {
53
+ const msg = 'With stringKeys, all keys must be strings';
54
+ onError(tag ?? token, 'NON_STRING_KEY', msg);
55
+ }
56
+ if (spaceBefore)
57
+ node.spaceBefore = true;
58
+ if (comment) {
59
+ if (token.type === 'scalar' && token.source === '')
60
+ node.comment = comment;
61
+ else
62
+ node.commentBefore = comment;
63
+ }
64
+ // @ts-expect-error Type checking misses meaning of isSrcToken
65
+ if (ctx.options.keepSourceTokens && isSrcToken)
66
+ node.srcToken = token;
67
+ return node;
68
+ }
69
+ function composeEmptyNode(ctx, offset, before, pos, { spaceBefore, comment, anchor, tag, end }, onError) {
70
+ const token = {
71
+ type: 'scalar',
72
+ offset: utilEmptyScalarPosition.emptyScalarPosition(offset, before, pos),
73
+ indent: -1,
74
+ source: ''
75
+ };
76
+ const node = composeScalar.composeScalar(ctx, token, tag, onError);
77
+ if (anchor) {
78
+ node.anchor = anchor.source.substring(1);
79
+ if (node.anchor === '')
80
+ onError(anchor, 'BAD_ALIAS', 'Anchor cannot be an empty string');
81
+ }
82
+ if (spaceBefore)
83
+ node.spaceBefore = true;
84
+ if (comment) {
85
+ node.comment = comment;
86
+ node.range[2] = end;
87
+ }
88
+ return node;
89
+ }
90
+ function composeAlias({ options }, { offset, source, end }, onError) {
91
+ const alias = new Alias.Alias(source.substring(1));
92
+ if (alias.source === '')
93
+ onError(offset, 'BAD_ALIAS', 'Alias cannot be an empty string');
94
+ if (alias.source.endsWith(':'))
95
+ onError(offset + source.length - 1, 'BAD_ALIAS', 'Alias ending in : is ambiguous', true);
96
+ const valueEnd = offset + source.length;
97
+ const re = resolveEnd.resolveEnd(end, valueEnd, options.strict, onError);
98
+ alias.range = [offset, valueEnd, re.offset];
99
+ if (re.comment)
100
+ alias.comment = re.comment;
101
+ return alias;
102
+ }
103
+
104
+ exports.composeEmptyNode = composeEmptyNode;
105
+ exports.composeNode = composeNode;
@@ -0,0 +1,102 @@
1
+ import { Alias } from '../nodes/Alias.mjs';
2
+ import { isScalar } from '../nodes/identity.mjs';
3
+ import { composeCollection } from './compose-collection.mjs';
4
+ import { composeScalar } from './compose-scalar.mjs';
5
+ import { resolveEnd } from './resolve-end.mjs';
6
+ import { emptyScalarPosition } from './util-empty-scalar-position.mjs';
7
+
8
+ const CN = { composeNode, composeEmptyNode };
9
+ function composeNode(ctx, token, props, onError) {
10
+ const atKey = ctx.atKey;
11
+ const { spaceBefore, comment, anchor, tag } = props;
12
+ let node;
13
+ let isSrcToken = true;
14
+ switch (token.type) {
15
+ case 'alias':
16
+ node = composeAlias(ctx, token, onError);
17
+ if (anchor || tag)
18
+ onError(token, 'ALIAS_PROPS', 'An alias node must not specify any properties');
19
+ break;
20
+ case 'scalar':
21
+ case 'single-quoted-scalar':
22
+ case 'double-quoted-scalar':
23
+ case 'block-scalar':
24
+ node = composeScalar(ctx, token, tag, onError);
25
+ if (anchor)
26
+ node.anchor = anchor.source.substring(1);
27
+ break;
28
+ case 'block-map':
29
+ case 'block-seq':
30
+ case 'flow-collection':
31
+ node = composeCollection(CN, ctx, token, props, onError);
32
+ if (anchor)
33
+ node.anchor = anchor.source.substring(1);
34
+ break;
35
+ default: {
36
+ const message = token.type === 'error'
37
+ ? token.message
38
+ : `Unsupported token (type: ${token.type})`;
39
+ onError(token, 'UNEXPECTED_TOKEN', message);
40
+ node = composeEmptyNode(ctx, token.offset, undefined, null, props, onError);
41
+ isSrcToken = false;
42
+ }
43
+ }
44
+ if (anchor && node.anchor === '')
45
+ onError(anchor, 'BAD_ALIAS', 'Anchor cannot be an empty string');
46
+ if (atKey &&
47
+ ctx.options.stringKeys &&
48
+ (!isScalar(node) ||
49
+ typeof node.value !== 'string' ||
50
+ (node.tag && node.tag !== 'tag:yaml.org,2002:str'))) {
51
+ const msg = 'With stringKeys, all keys must be strings';
52
+ onError(tag ?? token, 'NON_STRING_KEY', msg);
53
+ }
54
+ if (spaceBefore)
55
+ node.spaceBefore = true;
56
+ if (comment) {
57
+ if (token.type === 'scalar' && token.source === '')
58
+ node.comment = comment;
59
+ else
60
+ node.commentBefore = comment;
61
+ }
62
+ // @ts-expect-error Type checking misses meaning of isSrcToken
63
+ if (ctx.options.keepSourceTokens && isSrcToken)
64
+ node.srcToken = token;
65
+ return node;
66
+ }
67
+ function composeEmptyNode(ctx, offset, before, pos, { spaceBefore, comment, anchor, tag, end }, onError) {
68
+ const token = {
69
+ type: 'scalar',
70
+ offset: emptyScalarPosition(offset, before, pos),
71
+ indent: -1,
72
+ source: ''
73
+ };
74
+ const node = composeScalar(ctx, token, tag, onError);
75
+ if (anchor) {
76
+ node.anchor = anchor.source.substring(1);
77
+ if (node.anchor === '')
78
+ onError(anchor, 'BAD_ALIAS', 'Anchor cannot be an empty string');
79
+ }
80
+ if (spaceBefore)
81
+ node.spaceBefore = true;
82
+ if (comment) {
83
+ node.comment = comment;
84
+ node.range[2] = end;
85
+ }
86
+ return node;
87
+ }
88
+ function composeAlias({ options }, { offset, source, end }, onError) {
89
+ const alias = new Alias(source.substring(1));
90
+ if (alias.source === '')
91
+ onError(offset, 'BAD_ALIAS', 'Alias cannot be an empty string');
92
+ if (alias.source.endsWith(':'))
93
+ onError(offset + source.length - 1, 'BAD_ALIAS', 'Alias ending in : is ambiguous', true);
94
+ const valueEnd = offset + source.length;
95
+ const re = resolveEnd(end, valueEnd, options.strict, onError);
96
+ alias.range = [offset, valueEnd, re.offset];
97
+ if (re.comment)
98
+ alias.comment = re.comment;
99
+ return alias;
100
+ }
101
+
102
+ export { composeEmptyNode, composeNode };
@@ -0,0 +1,88 @@
1
+ 'use strict';
2
+
3
+ var identity = require('../nodes/identity.js');
4
+ var Scalar = require('../nodes/Scalar.js');
5
+ var resolveBlockScalar = require('./resolve-block-scalar.js');
6
+ var resolveFlowScalar = require('./resolve-flow-scalar.js');
7
+
8
+ function composeScalar(ctx, token, tagToken, onError) {
9
+ const { value, type, comment, range } = token.type === 'block-scalar'
10
+ ? resolveBlockScalar.resolveBlockScalar(ctx, token, onError)
11
+ : resolveFlowScalar.resolveFlowScalar(token, ctx.options.strict, onError);
12
+ const tagName = tagToken
13
+ ? ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg))
14
+ : null;
15
+ let tag;
16
+ if (ctx.options.stringKeys && ctx.atKey) {
17
+ tag = ctx.schema[identity.SCALAR];
18
+ }
19
+ else if (tagName)
20
+ tag = findScalarTagByName(ctx.schema, value, tagName, tagToken, onError);
21
+ else if (token.type === 'scalar')
22
+ tag = findScalarTagByTest(ctx, value, token, onError);
23
+ else
24
+ tag = ctx.schema[identity.SCALAR];
25
+ let scalar;
26
+ try {
27
+ const res = tag.resolve(value, msg => onError(tagToken ?? token, 'TAG_RESOLVE_FAILED', msg), ctx.options);
28
+ scalar = identity.isScalar(res) ? res : new Scalar.Scalar(res);
29
+ }
30
+ catch (error) {
31
+ const msg = error instanceof Error ? error.message : String(error);
32
+ onError(tagToken ?? token, 'TAG_RESOLVE_FAILED', msg);
33
+ scalar = new Scalar.Scalar(value);
34
+ }
35
+ scalar.range = range;
36
+ scalar.source = value;
37
+ if (type)
38
+ scalar.type = type;
39
+ if (tagName)
40
+ scalar.tag = tagName;
41
+ if (tag.format)
42
+ scalar.format = tag.format;
43
+ if (comment)
44
+ scalar.comment = comment;
45
+ return scalar;
46
+ }
47
+ function findScalarTagByName(schema, value, tagName, tagToken, onError) {
48
+ if (tagName === '!')
49
+ return schema[identity.SCALAR]; // non-specific tag
50
+ const matchWithTest = [];
51
+ for (const tag of schema.tags) {
52
+ if (!tag.collection && tag.tag === tagName) {
53
+ if (tag.default && tag.test)
54
+ matchWithTest.push(tag);
55
+ else
56
+ return tag;
57
+ }
58
+ }
59
+ for (const tag of matchWithTest)
60
+ if (tag.test?.test(value))
61
+ return tag;
62
+ const kt = schema.knownTags[tagName];
63
+ if (kt && !kt.collection) {
64
+ // Ensure that the known tag is available for stringifying,
65
+ // but does not get used by default.
66
+ schema.tags.push(Object.assign({}, kt, { default: false, test: undefined }));
67
+ return kt;
68
+ }
69
+ onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, tagName !== 'tag:yaml.org,2002:str');
70
+ return schema[identity.SCALAR];
71
+ }
72
+ function findScalarTagByTest({ atKey, directives, schema }, value, token, onError) {
73
+ const tag = schema.tags.find(tag => (tag.default === true || (atKey && tag.default === 'key')) &&
74
+ tag.test?.test(value)) || schema[identity.SCALAR];
75
+ if (schema.compat) {
76
+ const compat = schema.compat.find(tag => tag.default && tag.test?.test(value)) ??
77
+ schema[identity.SCALAR];
78
+ if (tag.tag !== compat.tag) {
79
+ const ts = directives.tagString(tag.tag);
80
+ const cs = directives.tagString(compat.tag);
81
+ const msg = `Value may be parsed as either ${ts} or ${cs}`;
82
+ onError(token, 'TAG_RESOLVE_FAILED', msg, true);
83
+ }
84
+ }
85
+ return tag;
86
+ }
87
+
88
+ exports.composeScalar = composeScalar;
@@ -0,0 +1,86 @@
1
+ import { SCALAR, isScalar } from '../nodes/identity.mjs';
2
+ import { Scalar } from '../nodes/Scalar.mjs';
3
+ import { resolveBlockScalar } from './resolve-block-scalar.mjs';
4
+ import { resolveFlowScalar } from './resolve-flow-scalar.mjs';
5
+
6
+ function composeScalar(ctx, token, tagToken, onError) {
7
+ const { value, type, comment, range } = token.type === 'block-scalar'
8
+ ? resolveBlockScalar(ctx, token, onError)
9
+ : resolveFlowScalar(token, ctx.options.strict, onError);
10
+ const tagName = tagToken
11
+ ? ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg))
12
+ : null;
13
+ let tag;
14
+ if (ctx.options.stringKeys && ctx.atKey) {
15
+ tag = ctx.schema[SCALAR];
16
+ }
17
+ else if (tagName)
18
+ tag = findScalarTagByName(ctx.schema, value, tagName, tagToken, onError);
19
+ else if (token.type === 'scalar')
20
+ tag = findScalarTagByTest(ctx, value, token, onError);
21
+ else
22
+ tag = ctx.schema[SCALAR];
23
+ let scalar;
24
+ try {
25
+ const res = tag.resolve(value, msg => onError(tagToken ?? token, 'TAG_RESOLVE_FAILED', msg), ctx.options);
26
+ scalar = isScalar(res) ? res : new Scalar(res);
27
+ }
28
+ catch (error) {
29
+ const msg = error instanceof Error ? error.message : String(error);
30
+ onError(tagToken ?? token, 'TAG_RESOLVE_FAILED', msg);
31
+ scalar = new Scalar(value);
32
+ }
33
+ scalar.range = range;
34
+ scalar.source = value;
35
+ if (type)
36
+ scalar.type = type;
37
+ if (tagName)
38
+ scalar.tag = tagName;
39
+ if (tag.format)
40
+ scalar.format = tag.format;
41
+ if (comment)
42
+ scalar.comment = comment;
43
+ return scalar;
44
+ }
45
+ function findScalarTagByName(schema, value, tagName, tagToken, onError) {
46
+ if (tagName === '!')
47
+ return schema[SCALAR]; // non-specific tag
48
+ const matchWithTest = [];
49
+ for (const tag of schema.tags) {
50
+ if (!tag.collection && tag.tag === tagName) {
51
+ if (tag.default && tag.test)
52
+ matchWithTest.push(tag);
53
+ else
54
+ return tag;
55
+ }
56
+ }
57
+ for (const tag of matchWithTest)
58
+ if (tag.test?.test(value))
59
+ return tag;
60
+ const kt = schema.knownTags[tagName];
61
+ if (kt && !kt.collection) {
62
+ // Ensure that the known tag is available for stringifying,
63
+ // but does not get used by default.
64
+ schema.tags.push(Object.assign({}, kt, { default: false, test: undefined }));
65
+ return kt;
66
+ }
67
+ onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, tagName !== 'tag:yaml.org,2002:str');
68
+ return schema[SCALAR];
69
+ }
70
+ function findScalarTagByTest({ atKey, directives, schema }, value, token, onError) {
71
+ const tag = schema.tags.find(tag => (tag.default === true || (atKey && tag.default === 'key')) &&
72
+ tag.test?.test(value)) || schema[SCALAR];
73
+ if (schema.compat) {
74
+ const compat = schema.compat.find(tag => tag.default && tag.test?.test(value)) ??
75
+ schema[SCALAR];
76
+ if (tag.tag !== compat.tag) {
77
+ const ts = directives.tagString(tag.tag);
78
+ const cs = directives.tagString(compat.tag);
79
+ const msg = `Value may be parsed as either ${ts} or ${cs}`;
80
+ onError(token, 'TAG_RESOLVE_FAILED', msg, true);
81
+ }
82
+ }
83
+ return tag;
84
+ }
85
+
86
+ export { composeScalar };